aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/aoe/aoe.h
diff options
context:
space:
mode:
authorEd L. Cashin <ecashin@coraid.com>2008-02-08 07:20:00 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2008-02-08 12:22:31 -0500
commit68e0d42f39d85b334d3867a4e5fc2e0e775c1a6c (patch)
treef4cdb47157de4dace5b99e69fc39ea017495922e /drivers/block/aoe/aoe.h
parent8911ef4dc97f77797f297318010a7424300d2d50 (diff)
aoe: handle multiple network paths to AoE device
A remote AoE device is something can process ATA commands and is identified by an AoE shelf number and an AoE slot number. Such a device might have more than one network interface, and it might be reachable by more than one local network interface. This patch tracks the available network paths available to each AoE device, allowing them to be used more efficiently. Andrew Morton asked about the call to msleep_interruptible in the revalidate function. Yes, if a signal is pending, then msleep_interruptible will not return 0. That means we will not loop but will call aoenet_xmit with a NULL skb, which is a noop. If the system is too low on memory or the aoe driver is too low on frames, then the user can hit control-C to interrupt the attempt to do a revalidate. I have added a comment to the code summarizing that. Andrew Morton asked whether the allocation performed inside addtgt could use a more relaxed allocation like GFP_KERNEL, but addtgt is called when the aoedev lock has been locked with spin_lock_irqsave. It would be nice to allocate the memory under fewer restrictions, but targets are only added when the device is being discovered, and if the target can't be added right now, we can try again in a minute when then next AoE config query broadcast goes out. Andrew Morton pointed out that the "too many targets" message could be printed for failing GFP_ATOMIC allocations. The last patch in this series makes the messages more specific. Signed-off-by: Ed L. Cashin <ecashin@coraid.com> Cc: Greg KH <greg@kroah.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/block/aoe/aoe.h')
-rw-r--r--drivers/block/aoe/aoe.h57
1 files changed, 40 insertions, 17 deletions
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h
index 4d0543a145df..87df18bf4dea 100644
--- a/drivers/block/aoe/aoe.h
+++ b/drivers/block/aoe/aoe.h
@@ -76,10 +76,8 @@ enum {
76 DEVFL_EXT = (1<<2), /* device accepts lba48 commands */ 76 DEVFL_EXT = (1<<2), /* device accepts lba48 commands */
77 DEVFL_CLOSEWAIT = (1<<3), /* device is waiting for all closes to revalidate */ 77 DEVFL_CLOSEWAIT = (1<<3), /* device is waiting for all closes to revalidate */
78 DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */ 78 DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */
79 DEVFL_PAUSE = (1<<5), 79 DEVFL_KICKME = (1<<5), /* slow polling network card catch */
80 DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */ 80 DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
81 DEVFL_MAXBCNT = (1<<7), /* d->maxbcnt is not changeable */
82 DEVFL_KICKME = (1<<8),
83 81
84 BUFFL_FAIL = 1, 82 BUFFL_FAIL = 1,
85}; 83};
@@ -88,17 +86,24 @@ enum {
88 DEFAULTBCNT = 2 * 512, /* 2 sectors */ 86 DEFAULTBCNT = 2 * 512, /* 2 sectors */
89 NPERSHELF = 16, /* number of slots per shelf address */ 87 NPERSHELF = 16, /* number of slots per shelf address */
90 FREETAG = -1, 88 FREETAG = -1,
91 MIN_BUFS = 8, 89 MIN_BUFS = 16,
90 NTARGETS = 8,
91 NAOEIFS = 8,
92
93 TIMERTICK = HZ / 10,
94 MINTIMER = HZ >> 2,
95 MAXTIMER = HZ << 1,
96 HELPWAIT = 20,
92}; 97};
93 98
94struct buf { 99struct buf {
95 struct list_head bufs; 100 struct list_head bufs;
96 ulong start_time; /* for disk stats */ 101 ulong stime; /* for disk stats */
97 ulong flags; 102 ulong flags;
98 ulong nframesout; 103 ulong nframesout;
99 char *bufaddr;
100 ulong resid; 104 ulong resid;
101 ulong bv_resid; 105 ulong bv_resid;
106 ulong bv_off;
102 sector_t sector; 107 sector_t sector;
103 struct bio *bio; 108 struct bio *bio;
104 struct bio_vec *bv; 109 struct bio_vec *bv;
@@ -114,19 +119,37 @@ struct frame {
114 struct sk_buff *skb; 119 struct sk_buff *skb;
115}; 120};
116 121
122struct aoeif {
123 struct net_device *nd;
124 unsigned char lost;
125 unsigned char lostjumbo;
126 ushort maxbcnt;
127};
128
129struct aoetgt {
130 unsigned char addr[6];
131 ushort nframes;
132 struct frame *frames;
133 struct aoeif ifs[NAOEIFS];
134 struct aoeif *ifp; /* current aoeif in use */
135 ushort nout;
136 ushort maxout;
137 u16 lasttag; /* last tag sent */
138 u16 useme;
139 ulong lastwadj; /* last window adjustment */
140 int wpkts, rpkts;
141};
142
117struct aoedev { 143struct aoedev {
118 struct aoedev *next; 144 struct aoedev *next;
119 unsigned char addr[6]; /* remote mac addr */
120 ushort flags;
121 ulong sysminor; 145 ulong sysminor;
122 ulong aoemajor; 146 ulong aoemajor;
123 ulong aoeminor; 147 u16 aoeminor;
148 u16 flags;
124 u16 nopen; /* (bd_openers isn't available without sleeping) */ 149 u16 nopen; /* (bd_openers isn't available without sleeping) */
125 u16 lasttag; /* last tag sent */
126 u16 rttavg; /* round trip average of requests/responses */ 150 u16 rttavg; /* round trip average of requests/responses */
127 u16 mintimer; 151 u16 mintimer;
128 u16 fw_ver; /* version of blade's firmware */ 152 u16 fw_ver; /* version of blade's firmware */
129 u16 maxbcnt;
130 struct work_struct work;/* disk create work struct */ 153 struct work_struct work;/* disk create work struct */
131 struct gendisk *gd; 154 struct gendisk *gd;
132 struct request_queue blkq; 155 struct request_queue blkq;
@@ -134,15 +157,14 @@ struct aoedev {
134 sector_t ssize; 157 sector_t ssize;
135 struct timer_list timer; 158 struct timer_list timer;
136 spinlock_t lock; 159 spinlock_t lock;
137 struct net_device *ifp; /* interface ed is attached to */
138 struct sk_buff *sendq_hd; /* packets needing to be sent, list head */ 160 struct sk_buff *sendq_hd; /* packets needing to be sent, list head */
139 struct sk_buff *sendq_tl; 161 struct sk_buff *sendq_tl;
140 mempool_t *bufpool; /* for deadlock-free Buf allocation */ 162 mempool_t *bufpool; /* for deadlock-free Buf allocation */
141 struct list_head bufq; /* queue of bios to work on */ 163 struct list_head bufq; /* queue of bios to work on */
142 struct buf *inprocess; /* the one we're currently working on */ 164 struct buf *inprocess; /* the one we're currently working on */
143 ushort lostjumbo; 165 struct aoetgt *targets[NTARGETS];
144 ushort nframes; /* number of frames below */ 166 struct aoetgt **tgt; /* target in use when working */
145 struct frame *frames; 167 struct aoetgt **htgt; /* target needing rexmit assistance */
146}; 168};
147 169
148 170
@@ -160,12 +182,13 @@ void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
160void aoecmd_ata_rsp(struct sk_buff *); 182void aoecmd_ata_rsp(struct sk_buff *);
161void aoecmd_cfg_rsp(struct sk_buff *); 183void aoecmd_cfg_rsp(struct sk_buff *);
162void aoecmd_sleepwork(struct work_struct *); 184void aoecmd_sleepwork(struct work_struct *);
163struct sk_buff *new_skb(ulong); 185void aoecmd_cleanslate(struct aoedev *);
186struct sk_buff *aoecmd_ata_id(struct aoedev *);
164 187
165int aoedev_init(void); 188int aoedev_init(void);
166void aoedev_exit(void); 189void aoedev_exit(void);
167struct aoedev *aoedev_by_aoeaddr(int maj, int min); 190struct aoedev *aoedev_by_aoeaddr(int maj, int min);
168struct aoedev *aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt); 191struct aoedev *aoedev_by_sysminor_m(ulong sysminor);
169void aoedev_downdev(struct aoedev *d); 192void aoedev_downdev(struct aoedev *d);
170int aoedev_isbusy(struct aoedev *d); 193int aoedev_isbusy(struct aoedev *d);
171 194