1 /* Copyright (c) 2012 Coraid, Inc. See COPYING for GPL terms. */
4 #define DEVICE_NAME "aoe"
6 /* set AOE_PARTITIONS to 1 to use whole-disks only
7 * default is 16, which is 15 partitions plus the whole disk
10 #define AOE_PARTITIONS (16)
13 #define WHITESPACE " \t\v\f\n"
18 AOECMD_VEND_MIN = 0xf0,
25 AOEAFL_ASYNC = (1<<1),
26 AOEAFL_WRITE = (1<<0),
51 unsigned char errfeat;
53 unsigned char cmdstat;
67 unsigned char aoeccmd;
68 unsigned char cslen[2];
72 DEVFL_UP = 1, /* device is installed in system and ready for AoE->ATA commands */
73 DEVFL_TKILL = (1<<1), /* flag for timer to know when to kill self */
74 DEVFL_EXT = (1<<2), /* device accepts lba48 commands */
75 DEVFL_GDALLOC = (1<<3), /* need to alloc gendisk */
76 DEVFL_KICKME = (1<<4), /* slow polling network card catch */
77 DEVFL_NEWSIZE = (1<<5), /* need to update dev size in block layer */
81 DEFAULTBCNT = 2 * 512, /* 2 sectors */
104 struct list_head head;
107 struct aoetgt *t; /* parent target I belong to */
109 struct sk_buff *skb; /* command skb freed on module exit */
110 struct sk_buff *r_skb; /* response skb for async processing */
118 struct net_device *nd;
124 unsigned char addr[6];
126 struct aoedev *d; /* parent device I belong to */
127 struct list_head ffree; /* list of free frames */
128 struct aoeif ifs[NAOEIFS];
129 struct aoeif *ifp; /* current aoeif in use */
133 ulong lastwadj; /* last window adjustment */
144 u16 nopen; /* (bd_openers isn't available without sleeping) */
145 u16 rttavg; /* round trip average of requests/responses */
147 u16 fw_ver; /* version of blade's firmware */
148 u16 lasttag; /* last tag sent */
151 struct work_struct work;/* disk create work struct */
153 struct request_queue *blkq;
154 struct hd_geometry geo;
156 struct timer_list timer;
158 struct sk_buff_head skbpool;
159 mempool_t *bufpool; /* for deadlock-free Buf allocation */
160 struct { /* pointers to work in progress */
166 struct list_head factive[NFACTIVE]; /* hash of active frames */
167 struct aoetgt *targets[NTARGETS];
168 struct aoetgt **tgt; /* target in use when working */
169 struct aoetgt *htgt; /* target needing rexmit assistance */
174 /* kthread tracking */
176 struct completion rendez;
177 struct task_struct *task;
178 wait_queue_head_t *waitq;
184 int aoeblk_init(void);
185 void aoeblk_exit(void);
186 void aoeblk_gdalloc(void *);
187 void aoedisk_rm_sysfs(struct aoedev *d);
189 int aoechr_init(void);
190 void aoechr_exit(void);
191 void aoechr_error(char *);
193 void aoecmd_work(struct aoedev *d);
194 void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
195 struct sk_buff *aoecmd_ata_rsp(struct sk_buff *);
196 void aoecmd_cfg_rsp(struct sk_buff *);
197 void aoecmd_sleepwork(struct work_struct *);
198 void aoecmd_cleanslate(struct aoedev *);
199 void aoecmd_exit(void);
200 int aoecmd_init(void);
201 struct sk_buff *aoecmd_ata_id(struct aoedev *);
202 void aoe_freetframe(struct frame *);
203 void aoe_flush_iocq(void);
204 void aoe_end_request(struct aoedev *, struct request *, int);
205 int aoe_ktstart(struct ktstate *k);
206 void aoe_ktstop(struct ktstate *k);
208 int aoedev_init(void);
209 void aoedev_exit(void);
210 struct aoedev *aoedev_by_aoeaddr(ulong maj, int min, int do_alloc);
211 void aoedev_downdev(struct aoedev *d);
212 int aoedev_flush(const char __user *str, size_t size);
213 void aoe_failbuf(struct aoedev *, struct buf *);
214 void aoedev_put(struct aoedev *);
216 int aoenet_init(void);
217 void aoenet_exit(void);
218 void aoenet_xmit(struct sk_buff_head *);
219 int is_aoe_netif(struct net_device *ifp);
220 int set_aoe_iflist(const char __user *str, size_t size);