aoe  87
About: AoE (ATA over Ethernet) Protocol Driver (Linux kernel 4.8.x and greater are not supported).
  Fossies Dox: aoe-87.tar.gz  ("inofficial" and yet experimental doxygen-generated source code documentation)  

aoecmd.c File Reference
#include <linux/ata.h>
#include <linux/hdreg.h>
#include <linux/blkdev.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/genhd.h>
#include <linux/moduleparam.h>
#include <linux/workqueue.h>
#include <linux/kthread.h>
#include <net/net_namespace.h>
#include <asm/unaligned.h>
#include <linux/uio.h>
#include "aoe.h"
Include dependency graph for aoecmd.c:

Go to the source code of this file.

Data Structures

struct  iocq_ktio
 

Functions

static void ktcomplete (struct frame *, struct sk_buff *)
 
static int count_targets (struct aoedev *d, int *untainted)
 
static struct bufnextbuf (struct aoedev *)
 
 module_param (aoe_deadsecs, int, 0644)
 
 MODULE_PARM_DESC (aoe_deadsecs, "After aoe_deadsecs seconds, give up and fail dev.")
 
 module_param (aoe_maxout, int, 0644)
 
 MODULE_PARM_DESC (aoe_maxout, "Only aoe_maxout outstanding packets for every MAC on eX.Y.")
 
 module_param (aoe_maxioc, int, 0644)
 
 MODULE_PARM_DESC (aoe_maxioc, "When nonzero, perform at most aoe_maxioc I/O completions before scheduling.")
 
static DEFINE_MUTEX (ktio_spawn_lock)
 
static struct sk_buff * new_skb (ulong len)
 
static struct framegetframe_deferred (struct aoedev *d, u32 tag)
 
static struct framegetframe (struct aoedev *d, u32 tag)
 
static int newtag (struct aoedev *d)
 
static u32 aoehdr_atainit (struct aoedev *d, struct aoetgt *t, struct aoe_hdr *h)
 
static void put_lba (struct aoe_atahdr *ah, sector_t lba)
 
static struct aoeififrotate (struct aoetgt *t)
 
static void skb_pool_put (struct aoedev *d, struct sk_buff *skb)
 
static struct sk_buff * skb_pool_get (struct aoedev *d)
 
void aoe_freetframe (struct frame *f)
 
struct framenewtframe (struct aoedev *d, struct aoetgt *t)
 
static struct framenewframe (struct aoedev *d)
 
static void skb_fillup (struct sk_buff *skb, struct bio *bio, struct bvec_iter iter)
 
static void fhash (struct frame *f)
 
static void ata_rw_frameinit (struct frame *f)
 
static int aoecmd_ata_rw (struct aoedev *d)
 
static struct sk_buff * aoecmd_cfg_pkts (ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
 
static void resend (struct aoedev *d, struct frame *f)
 
static int tsince_hr (struct frame *f)
 
static int tsince (u32 tag)
 
static struct aoeifgetif (struct aoetgt *t, struct net_device *nd)
 
static void ejectif (struct aoetgt *t, struct aoeif *ifp)
 
static struct framereassign_frame (struct frame *f)
 
static void probe (struct aoetgt *t)
 
static long rto (struct aoedev *d)
 
static void rexmit_deferred (struct aoedev *d)
 
static void scorn (struct aoetgt *t)
 
static void rexmit_timer (ulong vp)
 
static unsigned long rqbiocnt (struct request *r)
 
static void bio_pageinc (struct bio *bio)
 
static void bufinit (struct buf *buf, struct request *rq, struct bio *bio)
 
void aoecmd_work (struct aoedev *d)
 
void aoecmd_sleepwork (struct work_struct *work)
 
static void ata_ident_fixstring (u16 *id, int ns)
 
static void ataid_complete (struct aoedev *d, struct aoetgt *t, unsigned char *id)
 
static void calc_rttavg (struct aoedev *d, struct aoe_hdr *h, struct frame *f, struct aoetgt *t, int rtt)
 
static struct aoetgtgettgt (struct aoedev *d, char *addr)
 
static void bvcpy (struct sk_buff *skb, struct bio *bio, struct bvec_iter iter, long cnt)
 
void aoe_end_request (struct aoedev *d, struct request *rq, int fastfail)
 
static void aoe_end_buf (struct aoedev *d, struct buf *buf)
 
static void ktiocomplete (struct frame *f)
 
static int ktio (int id)
 
static int kthread (void *vp)
 
void aoe_ktstop (struct ktstate *k)
 
int aoe_ktstart (struct ktstate *k)
 
struct sk_buff * aoecmd_ata_rsp (struct sk_buff *skb)
 
void aoecmd_cfg (ushort aoemajor, unsigned char aoeminor)
 
struct sk_buff * aoecmd_ata_id (struct aoedev *d)
 
static struct aoetgt ** grow_targets (struct aoedev *d)
 
static struct aoetgtaddtgt (struct aoedev *d, char *addr, ulong nframes)
 
static void setdbcnt (struct aoedev *d)
 
static void setifbcnt (struct aoetgt *t, struct net_device *nd, int bcnt)
 
void aoecmd_cfg_rsp (struct sk_buff *skb)
 
void aoecmd_wreset (struct aoetgt *t)
 
void aoecmd_cleanslate (struct aoedev *d)
 
void aoe_failbuf (struct aoedev *d, struct buf *buf)
 
void aoe_flush_iocq (void)
 
void aoe_flush_iocq_by_index (int id)
 
int __init aoecmd_init (void)
 
void aoecmd_exit (void)
 

Variables

static int aoe_deadsecs = 60 * 3
 
static int aoe_maxout = 128
 
static int aoe_maxioc = 8192
 
static int ncpus
 
static wait_queue_head_t * ktiowq
 
static struct ktstatekts
 
static struct iocq_ktioiocq
 
static struct page * empty_page
 

Function Documentation

◆ addtgt()

static struct aoetgt* addtgt ( struct aoedev d,
char *  addr,
ulong  nframes 
)
static

◆ aoe_end_buf()

static void aoe_end_buf ( struct aoedev d,
struct buf buf 
)
static

◆ aoe_end_request()

void aoe_end_request ( struct aoedev d,
struct request *  rq,
int  fastfail 
)

Definition at line 1119 of file aoecmd.c.

References aoedev::blkq, aoedev::ip, and aoedev::rq.

Referenced by aoe_end_buf(), aoe_failip(), aoeblk_request(), and aoedev_downdev().

◆ aoe_failbuf()

void aoe_failbuf ( struct aoedev d,
struct buf buf 
)

Definition at line 1718 of file aoecmd.c.

References aoe_end_buf(), buf::bio, aoetgt::d, buf::iter, and buf::nframesout.

Referenced by aoe_failip(), aoe_flush_iocq_by_index(), and downdev_frame().

◆ aoe_flush_iocq()

void aoe_flush_iocq ( void  )

Definition at line 1729 of file aoecmd.c.

References aoe_flush_iocq_by_index(), kts, and ncpus.

Referenced by aoecmd_exit().

◆ aoe_flush_iocq_by_index()

void aoe_flush_iocq_by_index ( int  id)

◆ aoe_freetframe()

◆ aoe_ktstart()

int aoe_ktstart ( struct ktstate k)

Definition at line 1346 of file aoecmd.c.

References kthread(), ktstate::name, ktstate::rendez, and ktstate::task.

Referenced by aoecmd_init(), aoenet_init(), and ktio().

◆ aoe_ktstop()

void aoe_ktstop ( struct ktstate k)

Definition at line 1339 of file aoecmd.c.

References ktstate::rendez, and ktstate::task.

Referenced by aoecmd_exit(), and aoenet_exit().

◆ aoecmd_ata_id()

◆ aoecmd_ata_rsp()

◆ aoecmd_ata_rw()

◆ aoecmd_cfg()

void aoecmd_cfg ( ushort  aoemajor,
unsigned char  aoeminor 
)

Definition at line 1454 of file aoecmd.c.

References aoecmd_cfg_pkts(), and aoenet_xmit().

Referenced by aoeblk_release(), discover(), discover_timer(), and revalidate().

◆ aoecmd_cfg_pkts()

static struct sk_buff* aoecmd_cfg_pkts ( ushort  aoemajor,
unsigned char  aoeminor,
struct sk_buff **  tail 
)
static

◆ aoecmd_cfg_rsp()

◆ aoecmd_cleanslate()

void aoecmd_cleanslate ( struct aoedev d)

◆ aoecmd_exit()

void aoecmd_exit ( void  )

Definition at line 1837 of file aoecmd.c.

References aoe_flush_iocq(), aoe_ktstop(), empty_page, iocq, ktiowq, kts, and ncpus.

Referenced by aoe_exit(), and aoe_init().

◆ aoecmd_init()

int __init aoecmd_init ( void  )

◆ aoecmd_sleepwork()

void aoecmd_sleepwork ( struct work_struct *  work)

◆ aoecmd_work()

void aoecmd_work ( struct aoedev d)

Definition at line 956 of file aoecmd.c.

References aoecmd_ata_rw(), and rexmit_deferred().

Referenced by aoeblk_request(), and aoecmd_ata_rsp().

◆ aoecmd_wreset()

void aoecmd_wreset ( struct aoetgt t)

◆ aoehdr_atainit()

static u32 aoehdr_atainit ( struct aoedev d,
struct aoetgt t,
struct aoe_hdr h 
)
static

◆ ata_ident_fixstring()

static void ata_ident_fixstring ( u16 id,
int  ns 
)
static

Definition at line 994 of file aoecmd.c.

Referenced by ataid_complete().

◆ ata_rw_frameinit()

◆ ataid_complete()

static void ataid_complete ( struct aoedev d,
struct aoetgt t,
unsigned char *  id 
)
static

◆ bio_pageinc()

static void bio_pageinc ( struct bio *  bio)
static

Definition at line 892 of file aoecmd.c.

References iter.

Referenced by bufinit().

◆ bufinit()

static void bufinit ( struct buf buf,
struct request *  rq,
struct bio *  bio 
)
static

Definition at line 908 of file aoecmd.c.

References buf::bio, bio_pageinc(), buf::iter, and buf::rq.

Referenced by nextbuf().

◆ bvcpy()

static void bvcpy ( struct sk_buff *  skb,
struct bio *  bio,
struct bvec_iter  iter,
long  cnt 
)
static

Definition at line 1104 of file aoecmd.c.

References iter.

Referenced by ktiocomplete().

◆ calc_rttavg()

static void calc_rttavg ( struct aoedev d,
struct aoe_hdr h,
struct frame f,
struct aoetgt t,
int  rtt 
)
static

◆ count_targets()

static int count_targets ( struct aoedev d,
int untainted 
)
static

Definition at line 756 of file aoecmd.c.

References aoedev::ntargets, aoetgt::taint, and aoedev::targets.

Referenced by ktiocomplete(), rexmit_deferred(), and rexmit_timer().

◆ DEFINE_MUTEX()

static DEFINE_MUTEX ( ktio_spawn_lock  )
static

◆ ejectif()

static void ejectif ( struct aoetgt t,
struct aoeif ifp 
)
static

Definition at line 582 of file aoecmd.c.

References aoetgt::ifs, NAOEIFS, and aoeif::nd.

Referenced by rexmit_timer().

◆ fhash()

static void fhash ( struct frame f)
static

Definition at line 320 of file aoecmd.c.

References aoetgt::d, aoedev::factive, frame::head, NFACTIVE, frame::t, and frame::tag.

Referenced by aoecmd_ata_id(), ata_rw_frameinit(), and resend().

◆ getframe()

static struct frame* getframe ( struct aoedev d,
u32  tag 
)
static

Definition at line 101 of file aoecmd.c.

References aoedev::factive, NFACTIVE, and frame::tag.

Referenced by aoecmd_ata_rsp().

◆ getframe_deferred()

static struct frame* getframe_deferred ( struct aoedev d,
u32  tag 
)
static

Definition at line 84 of file aoecmd.c.

References frame::head, aoedev::rexmitq, and frame::tag.

Referenced by aoecmd_ata_rsp().

◆ getif()

static struct aoeif* getif ( struct aoetgt t,
struct net_device *  nd 
)
static

Definition at line 569 of file aoecmd.c.

References aoetgt::ifs, NAOEIFS, and aoeif::nd.

Referenced by ktiocomplete(), and rexmit_timer().

◆ gettgt()

static struct aoetgt* gettgt ( struct aoedev d,
char *  addr 
)
static

Definition at line 1091 of file aoecmd.c.

References aoetgt::addr, aoetgt::d, aoedev::ntargets, and aoedev::targets.

Referenced by aoecmd_ata_rsp(), and aoecmd_cfg_rsp().

◆ grow_targets()

static struct aoetgt** grow_targets ( struct aoedev d)
static

Definition at line 1511 of file aoecmd.c.

References aoe_kcalloc(), aoetgt::d, aoedev::ntargets, aoedev::targets, and aoedev::tgt.

Referenced by addtgt().

◆ ifrotate()

static struct aoeif* ifrotate ( struct aoetgt t)
static

Definition at line 162 of file aoecmd.c.

References aoetgt::ifp, aoetgt::ifs, NAOEIFS, and aoeif::nd.

Referenced by newframe(), probe(), and resend().

◆ ktcomplete()

static void ktcomplete ( struct frame f,
struct sk_buff *  skb 
)
static

Definition at line 1362 of file aoecmd.c.

References aoedev::aoeminor, aoetgt::d, frame::head, iocq_ktio::head, iocq, ktiowq, kts, ncpus, frame::r_skb, and frame::t.

Referenced by aoecmd_ata_rsp(), and resend().

◆ kthread()

static int kthread ( void *  vp)
static

Definition at line 1310 of file aoecmd.c.

References ktstate::fn, ktstate::id, ktstate::lock, ktstate::rendez, and ktstate::waitq.

Referenced by aoe_ktstart().

◆ ktio()

static int ktio ( int  id)
static

◆ ktiocomplete()

◆ module_param() [1/3]

module_param ( aoe_deadsecs  ,
int  ,
0644   
)

◆ module_param() [2/3]

module_param ( aoe_maxioc  ,
int  ,
0644   
)

◆ module_param() [3/3]

module_param ( aoe_maxout  ,
int  ,
0644   
)

◆ MODULE_PARM_DESC() [1/3]

MODULE_PARM_DESC ( aoe_deadsecs  ,
"After aoe_deadsecs  seconds,
give up and fail dev."   
)

◆ MODULE_PARM_DESC() [2/3]

MODULE_PARM_DESC ( aoe_maxioc  ,
"When  nonzero,
perform at most aoe_maxioc I/O completions before scheduling."   
)

◆ MODULE_PARM_DESC() [3/3]

MODULE_PARM_DESC ( aoe_maxout  ,
"Only aoe_maxout outstanding packets for every MAC on eX.Y."   
)

◆ new_skb()

static struct sk_buff* new_skb ( ulong  len)
static

Definition at line 62 of file aoecmd.c.

References ETH_P_AOE, and skb_reset_mac_header().

Referenced by aoecmd_cfg_pkts(), newtframe(), and skb_pool_get().

◆ newframe()

◆ newtag()

static int newtag ( struct aoedev d)
static

Definition at line 125 of file aoecmd.c.

References aoedev::lasttag.

Referenced by aoehdr_atainit(), and resend().

◆ newtframe()

struct frame* newtframe ( struct aoedev d,
struct aoetgt t 
)

◆ nextbuf()

static struct buf * nextbuf ( struct aoedev d)
static

Definition at line 918 of file aoecmd.c.

References aoedev::blkq, buf, aoedev::buf, bufinit(), aoedev::bufpool, aoedev::ip, aoedev::nxbio, aoedev::rq, and rqbiocnt().

Referenced by aoecmd_ata_rw().

◆ probe()

◆ put_lba()

static void put_lba ( struct aoe_atahdr ah,
sector_t  lba 
)
inlinestatic

◆ reassign_frame()

static struct frame* reassign_frame ( struct frame f)
static

◆ resend()

◆ rexmit_deferred()

◆ rexmit_timer()

◆ rqbiocnt()

static unsigned long rqbiocnt ( struct request *  r)
static

Definition at line 871 of file aoecmd.c.

Referenced by nextbuf().

◆ rto()

static long rto ( struct aoedev d)
static

Definition at line 668 of file aoecmd.c.

References aoedev::rttavg, aoedev::rttdev, RTTDSCALE, and RTTSCALE.

Referenced by rexmit_deferred(), and rexmit_timer().

◆ scorn()

static void scorn ( struct aoetgt t)
static

Definition at line 743 of file aoecmd.c.

References MAX_TAINT, and aoetgt::taint.

Referenced by rexmit_timer().

◆ setdbcnt()

static void setdbcnt ( struct aoedev d)
static

Definition at line 1564 of file aoecmd.c.

References aoedev::aoemajor, aoedev::aoeminor, aoetgt::d, aoedev::maxbcnt, aoedev::ntargets, and aoedev::targets.

Referenced by setifbcnt().

◆ setifbcnt()

static void setifbcnt ( struct aoetgt t,
struct net_device *  nd,
int  bcnt 
)
static

Definition at line 1583 of file aoecmd.c.

References aoeif::bcnt, aoetgt::d, aoetgt::ifs, aoetgt::minbcnt, NAOEIFS, aoeif::nd, and setdbcnt().

Referenced by aoecmd_cfg_rsp().

◆ skb_fillup()

static void skb_fillup ( struct sk_buff *  skb,
struct bio *  bio,
struct bvec_iter  iter 
)
static

Definition at line 309 of file aoecmd.c.

References iter.

Referenced by ata_rw_frameinit().

◆ skb_pool_get()

static struct sk_buff* skb_pool_get ( struct aoedev d)
static

Definition at line 186 of file aoecmd.c.

References new_skb(), aoedev::nskbpool, NSKBPOOLMAX, and aoedev::skbpool_hd.

Referenced by newtframe().

◆ skb_pool_put()

static void skb_pool_put ( struct aoedev d,
struct sk_buff *  skb 
)
static

Definition at line 176 of file aoecmd.c.

References aoedev::skbpool_hd, and aoedev::skbpool_tl.

Referenced by newtframe().

◆ tsince()

static int tsince ( u32  tag)
static

Definition at line 557 of file aoecmd.c.

Referenced by aoecmd_ata_rsp().

◆ tsince_hr()

static int tsince_hr ( struct frame f)
static

Definition at line 525 of file aoecmd.c.

References frame::sent, and frame::sent_jiffs.

Referenced by aoecmd_ata_rsp(), rexmit_deferred(), and rexmit_timer().

Variable Documentation

◆ aoe_deadsecs

int aoe_deadsecs = 60 * 3
static

Definition at line 26 of file aoecmd.c.

Referenced by rexmit_timer().

◆ aoe_maxioc

int aoe_maxioc = 8192
static

Definition at line 35 of file aoecmd.c.

Referenced by ktio().

◆ aoe_maxout

int aoe_maxout = 128
static

Definition at line 30 of file aoecmd.c.

Referenced by aoecmd_cfg_rsp().

◆ empty_page

struct page* empty_page
static

Definition at line 59 of file aoecmd.c.

Referenced by aoecmd_exit(), aoecmd_init(), and probe().

◆ iocq

struct iocq_ktio* iocq
static

Definition at line 56 of file aoecmd.c.

Referenced by aoe_flush_iocq_by_index(), aoecmd_exit(), aoecmd_init(), ktcomplete(), and ktio().

◆ ktiowq

wait_queue_head_t* ktiowq
static

Definition at line 48 of file aoecmd.c.

Referenced by aoecmd_exit(), aoecmd_init(), and ktcomplete().

◆ kts

struct ktstate* kts
static

Definition at line 49 of file aoecmd.c.

Referenced by aoe_flush_iocq(), aoecmd_exit(), aoecmd_init(), ktcomplete(), and ktio().

◆ ncpus

int ncpus
static

Definition at line 43 of file aoecmd.c.

Referenced by aoe_flush_iocq(), aoecmd_exit(), aoecmd_init(), ktcomplete(), and ktio().