Ed L. Cashin | 2611464 | 2006-09-20 14:36:48 -0400 | [diff] [blame] | 1 | /* Copyright (c) 2006 Coraid, Inc. See COPYING for GPL terms. */ |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 2 | /* |
| 3 | * aoecmd.c |
| 4 | * Filesystem request handling methods |
| 5 | */ |
| 6 | |
| 7 | #include <linux/hdreg.h> |
| 8 | #include <linux/blkdev.h> |
| 9 | #include <linux/skbuff.h> |
| 10 | #include <linux/netdevice.h> |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 11 | #include <linux/genhd.h> |
Ed L. Cashin | 475172f | 2005-09-29 12:47:40 -0400 | [diff] [blame] | 12 | #include <asm/unaligned.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 13 | #include "aoe.h" |
| 14 | |
| 15 | #define TIMERTICK (HZ / 10) |
| 16 | #define MINTIMER (2 * TIMERTICK) |
| 17 | #define MAXTIMER (HZ << 1) |
| 18 | #define MAXWAIT (60 * 3) /* After MAXWAIT seconds, give up and fail dev */ |
| 19 | |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 20 | struct sk_buff * |
| 21 | new_skb(ulong len) |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 22 | { |
| 23 | struct sk_buff *skb; |
| 24 | |
| 25 | skb = alloc_skb(len, GFP_ATOMIC); |
| 26 | if (skb) { |
| 27 | skb->nh.raw = skb->mac.raw = skb->data; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 28 | skb->protocol = __constant_htons(ETH_P_AOE); |
| 29 | skb->priority = 0; |
| 30 | skb_put(skb, len); |
Ed L. Cashin | 50bba75 | 2006-01-19 12:37:24 -0500 | [diff] [blame] | 31 | memset(skb->head, 0, len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 32 | skb->next = skb->prev = NULL; |
| 33 | |
| 34 | /* tell the network layer not to perform IP checksums |
| 35 | * or to get the NIC to do it |
| 36 | */ |
| 37 | skb->ip_summed = CHECKSUM_NONE; |
| 38 | } |
| 39 | return skb; |
| 40 | } |
| 41 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 42 | static struct frame * |
| 43 | getframe(struct aoedev *d, int tag) |
| 44 | { |
| 45 | struct frame *f, *e; |
| 46 | |
| 47 | f = d->frames; |
| 48 | e = f + d->nframes; |
| 49 | for (; f<e; f++) |
| 50 | if (f->tag == tag) |
| 51 | return f; |
| 52 | return NULL; |
| 53 | } |
| 54 | |
| 55 | /* |
| 56 | * Leave the top bit clear so we have tagspace for userland. |
| 57 | * The bottom 16 bits are the xmit tick for rexmit/rttavg processing. |
| 58 | * This driver reserves tag -1 to mean "unused frame." |
| 59 | */ |
| 60 | static int |
| 61 | newtag(struct aoedev *d) |
| 62 | { |
| 63 | register ulong n; |
| 64 | |
| 65 | n = jiffies & 0xffff; |
| 66 | return n |= (++d->lasttag & 0x7fff) << 16; |
| 67 | } |
| 68 | |
| 69 | static int |
| 70 | aoehdr_atainit(struct aoedev *d, struct aoe_hdr *h) |
| 71 | { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 72 | u32 host_tag = newtag(d); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 73 | |
| 74 | memcpy(h->src, d->ifp->dev_addr, sizeof h->src); |
| 75 | memcpy(h->dst, d->addr, sizeof h->dst); |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 76 | h->type = __constant_cpu_to_be16(ETH_P_AOE); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 77 | h->verfl = AOE_HVER; |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 78 | h->major = cpu_to_be16(d->aoemajor); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 79 | h->minor = d->aoeminor; |
| 80 | h->cmd = AOECMD_ATA; |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 81 | h->tag = cpu_to_be32(host_tag); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 82 | |
| 83 | return host_tag; |
| 84 | } |
| 85 | |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 86 | static inline void |
| 87 | put_lba(struct aoe_atahdr *ah, sector_t lba) |
| 88 | { |
| 89 | ah->lba0 = lba; |
| 90 | ah->lba1 = lba >>= 8; |
| 91 | ah->lba2 = lba >>= 8; |
| 92 | ah->lba3 = lba >>= 8; |
| 93 | ah->lba4 = lba >>= 8; |
| 94 | ah->lba5 = lba >>= 8; |
| 95 | } |
| 96 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 97 | static void |
| 98 | aoecmd_ata_rw(struct aoedev *d, struct frame *f) |
| 99 | { |
| 100 | struct aoe_hdr *h; |
| 101 | struct aoe_atahdr *ah; |
| 102 | struct buf *buf; |
| 103 | struct sk_buff *skb; |
| 104 | ulong bcnt; |
| 105 | register sector_t sector; |
| 106 | char writebit, extbit; |
| 107 | |
| 108 | writebit = 0x10; |
| 109 | extbit = 0x4; |
| 110 | |
| 111 | buf = d->inprocess; |
| 112 | |
| 113 | sector = buf->sector; |
| 114 | bcnt = buf->bv_resid; |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 115 | if (bcnt > d->maxbcnt) |
| 116 | bcnt = d->maxbcnt; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 117 | |
| 118 | /* initialize the headers & frame */ |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 119 | skb = f->skb; |
| 120 | h = (struct aoe_hdr *) skb->mac.raw; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 121 | ah = (struct aoe_atahdr *) (h+1); |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 122 | skb->len = sizeof *h + sizeof *ah; |
| 123 | memset(h, 0, skb->len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 124 | f->tag = aoehdr_atainit(d, h); |
| 125 | f->waited = 0; |
| 126 | f->buf = buf; |
| 127 | f->bufaddr = buf->bufaddr; |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 128 | f->bcnt = bcnt; |
| 129 | f->lba = sector; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 130 | |
| 131 | /* set up ata header */ |
| 132 | ah->scnt = bcnt >> 9; |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 133 | put_lba(ah, sector); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 134 | if (d->flags & DEVFL_EXT) { |
| 135 | ah->aflags |= AOEAFL_EXT; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 136 | } else { |
| 137 | extbit = 0; |
| 138 | ah->lba3 &= 0x0f; |
| 139 | ah->lba3 |= 0xe0; /* LBA bit + obsolete 0xa0 */ |
| 140 | } |
| 141 | |
| 142 | if (bio_data_dir(buf->bio) == WRITE) { |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 143 | skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr), |
| 144 | offset_in_page(f->bufaddr), bcnt); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 145 | ah->aflags |= AOEAFL_WRITE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 146 | } else { |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 147 | skb_shinfo(skb)->nr_frags = 0; |
| 148 | skb->len = ETH_ZLEN; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 149 | writebit = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 150 | } |
| 151 | |
| 152 | ah->cmdstat = WIN_READ | writebit | extbit; |
| 153 | |
| 154 | /* mark all tracking fields and load out */ |
| 155 | buf->nframesout += 1; |
| 156 | buf->bufaddr += bcnt; |
| 157 | buf->bv_resid -= bcnt; |
| 158 | /* printk(KERN_INFO "aoe: bv_resid=%ld\n", buf->bv_resid); */ |
| 159 | buf->resid -= bcnt; |
| 160 | buf->sector += bcnt >> 9; |
| 161 | if (buf->resid == 0) { |
| 162 | d->inprocess = NULL; |
| 163 | } else if (buf->bv_resid == 0) { |
| 164 | buf->bv++; |
| 165 | buf->bv_resid = buf->bv->bv_len; |
| 166 | buf->bufaddr = page_address(buf->bv->bv_page) + buf->bv->bv_offset; |
| 167 | } |
| 168 | |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 169 | skb->dev = d->ifp; |
| 170 | skb_get(skb); |
| 171 | skb->next = NULL; |
| 172 | if (d->sendq_hd) |
| 173 | d->sendq_tl->next = skb; |
| 174 | else |
| 175 | d->sendq_hd = skb; |
| 176 | d->sendq_tl = skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 177 | } |
| 178 | |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 179 | /* some callers cannot sleep, and they can call this function, |
| 180 | * transmitting the packets later, when interrupts are on |
| 181 | */ |
| 182 | static struct sk_buff * |
| 183 | aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) |
| 184 | { |
| 185 | struct aoe_hdr *h; |
| 186 | struct aoe_cfghdr *ch; |
| 187 | struct sk_buff *skb, *sl, *sl_tail; |
| 188 | struct net_device *ifp; |
| 189 | |
| 190 | sl = sl_tail = NULL; |
| 191 | |
| 192 | read_lock(&dev_base_lock); |
| 193 | for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) { |
| 194 | dev_hold(ifp); |
| 195 | if (!is_aoe_netif(ifp)) |
| 196 | continue; |
| 197 | |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 198 | skb = new_skb(sizeof *h + sizeof *ch); |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 199 | if (skb == NULL) { |
| 200 | printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n"); |
| 201 | continue; |
| 202 | } |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 203 | skb->dev = ifp; |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 204 | if (sl_tail == NULL) |
| 205 | sl_tail = skb; |
| 206 | h = (struct aoe_hdr *) skb->mac.raw; |
| 207 | memset(h, 0, sizeof *h + sizeof *ch); |
| 208 | |
| 209 | memset(h->dst, 0xff, sizeof h->dst); |
| 210 | memcpy(h->src, ifp->dev_addr, sizeof h->src); |
| 211 | h->type = __constant_cpu_to_be16(ETH_P_AOE); |
| 212 | h->verfl = AOE_HVER; |
| 213 | h->major = cpu_to_be16(aoemajor); |
| 214 | h->minor = aoeminor; |
| 215 | h->cmd = AOECMD_CFG; |
| 216 | |
| 217 | skb->next = sl; |
| 218 | sl = skb; |
| 219 | } |
| 220 | read_unlock(&dev_base_lock); |
| 221 | |
| 222 | if (tail != NULL) |
| 223 | *tail = sl_tail; |
| 224 | return sl; |
| 225 | } |
| 226 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 227 | /* enters with d->lock held */ |
| 228 | void |
| 229 | aoecmd_work(struct aoedev *d) |
| 230 | { |
| 231 | struct frame *f; |
| 232 | struct buf *buf; |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 233 | |
| 234 | if (d->flags & DEVFL_PAUSE) { |
| 235 | if (!aoedev_isbusy(d)) |
| 236 | d->sendq_hd = aoecmd_cfg_pkts(d->aoemajor, |
| 237 | d->aoeminor, &d->sendq_tl); |
| 238 | return; |
| 239 | } |
| 240 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 241 | loop: |
| 242 | f = getframe(d, FREETAG); |
| 243 | if (f == NULL) |
| 244 | return; |
| 245 | if (d->inprocess == NULL) { |
| 246 | if (list_empty(&d->bufq)) |
| 247 | return; |
| 248 | buf = container_of(d->bufq.next, struct buf, bufs); |
| 249 | list_del(d->bufq.next); |
| 250 | /*printk(KERN_INFO "aoecmd_work: bi_size=%ld\n", buf->bio->bi_size); */ |
| 251 | d->inprocess = buf; |
| 252 | } |
| 253 | aoecmd_ata_rw(d, f); |
| 254 | goto loop; |
| 255 | } |
| 256 | |
| 257 | static void |
| 258 | rexmit(struct aoedev *d, struct frame *f) |
| 259 | { |
| 260 | struct sk_buff *skb; |
| 261 | struct aoe_hdr *h; |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 262 | struct aoe_atahdr *ah; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 263 | char buf[128]; |
| 264 | u32 n; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 265 | |
| 266 | n = newtag(d); |
| 267 | |
| 268 | snprintf(buf, sizeof buf, |
| 269 | "%15s e%ld.%ld oldtag=%08x@%08lx newtag=%08x\n", |
| 270 | "retransmit", |
| 271 | d->aoemajor, d->aoeminor, f->tag, jiffies, n); |
| 272 | aoechr_error(buf); |
| 273 | |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 274 | skb = f->skb; |
| 275 | h = (struct aoe_hdr *) skb->mac.raw; |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 276 | ah = (struct aoe_atahdr *) (h+1); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 277 | f->tag = n; |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 278 | h->tag = cpu_to_be32(n); |
Ed L. Cashin | 2dd5e42 | 2006-01-19 13:46:25 -0500 | [diff] [blame] | 279 | memcpy(h->dst, d->addr, sizeof h->dst); |
| 280 | memcpy(h->src, d->ifp->dev_addr, sizeof h->src); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 281 | |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 282 | n = DEFAULTBCNT / 512; |
| 283 | if (ah->scnt > n) { |
| 284 | ah->scnt = n; |
| 285 | if (ah->aflags & AOEAFL_WRITE) |
| 286 | skb_fill_page_desc(skb, 0, virt_to_page(f->bufaddr), |
| 287 | offset_in_page(f->bufaddr), DEFAULTBCNT); |
| 288 | if (++d->lostjumbo > (d->nframes << 1)) |
| 289 | if (d->maxbcnt != DEFAULTBCNT) { |
| 290 | printk(KERN_INFO "aoe: rexmit: too many lost jumbo. " |
| 291 | "dropping back to 1KB frames.\n"); |
| 292 | d->maxbcnt = DEFAULTBCNT; |
| 293 | d->flags |= DEVFL_MAXBCNT; |
| 294 | } |
| 295 | } |
| 296 | |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 297 | skb->dev = d->ifp; |
| 298 | skb_get(skb); |
| 299 | skb->next = NULL; |
| 300 | if (d->sendq_hd) |
| 301 | d->sendq_tl->next = skb; |
| 302 | else |
| 303 | d->sendq_hd = skb; |
| 304 | d->sendq_tl = skb; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 305 | } |
| 306 | |
| 307 | static int |
| 308 | tsince(int tag) |
| 309 | { |
| 310 | int n; |
| 311 | |
| 312 | n = jiffies & 0xffff; |
| 313 | n -= tag & 0xffff; |
| 314 | if (n < 0) |
| 315 | n += 1<<16; |
| 316 | return n; |
| 317 | } |
| 318 | |
| 319 | static void |
| 320 | rexmit_timer(ulong vp) |
| 321 | { |
| 322 | struct aoedev *d; |
| 323 | struct frame *f, *e; |
| 324 | struct sk_buff *sl; |
| 325 | register long timeout; |
| 326 | ulong flags, n; |
| 327 | |
| 328 | d = (struct aoedev *) vp; |
| 329 | sl = NULL; |
| 330 | |
| 331 | /* timeout is always ~150% of the moving average */ |
| 332 | timeout = d->rttavg; |
| 333 | timeout += timeout >> 1; |
| 334 | |
| 335 | spin_lock_irqsave(&d->lock, flags); |
| 336 | |
| 337 | if (d->flags & DEVFL_TKILL) { |
Ed L. Cashin | 1c6f3fc | 2006-01-25 13:54:44 -0500 | [diff] [blame] | 338 | spin_unlock_irqrestore(&d->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 339 | return; |
| 340 | } |
| 341 | f = d->frames; |
| 342 | e = f + d->nframes; |
| 343 | for (; f<e; f++) { |
| 344 | if (f->tag != FREETAG && tsince(f->tag) >= timeout) { |
| 345 | n = f->waited += timeout; |
| 346 | n /= HZ; |
| 347 | if (n > MAXWAIT) { /* waited too long. device failure. */ |
| 348 | aoedev_downdev(d); |
Ed L. Cashin | 1c6f3fc | 2006-01-25 13:54:44 -0500 | [diff] [blame] | 349 | break; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 350 | } |
| 351 | rexmit(d, f); |
| 352 | } |
| 353 | } |
| 354 | |
ecashin@coraid.com | a4b3836 | 2005-04-18 22:00:22 -0700 | [diff] [blame] | 355 | sl = d->sendq_hd; |
| 356 | d->sendq_hd = d->sendq_tl = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 357 | if (sl) { |
| 358 | n = d->rttavg <<= 1; |
| 359 | if (n > MAXTIMER) |
| 360 | d->rttavg = MAXTIMER; |
| 361 | } |
| 362 | |
| 363 | d->timer.expires = jiffies + TIMERTICK; |
| 364 | add_timer(&d->timer); |
| 365 | |
| 366 | spin_unlock_irqrestore(&d->lock, flags); |
| 367 | |
| 368 | aoenet_xmit(sl); |
| 369 | } |
| 370 | |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 371 | /* this function performs work that has been deferred until sleeping is OK |
| 372 | */ |
| 373 | void |
| 374 | aoecmd_sleepwork(void *vp) |
| 375 | { |
| 376 | struct aoedev *d = (struct aoedev *) vp; |
| 377 | |
| 378 | if (d->flags & DEVFL_GDALLOC) |
| 379 | aoeblk_gdalloc(d); |
| 380 | |
| 381 | if (d->flags & DEVFL_NEWSIZE) { |
| 382 | struct block_device *bd; |
| 383 | unsigned long flags; |
| 384 | u64 ssize; |
| 385 | |
| 386 | ssize = d->gd->capacity; |
| 387 | bd = bdget_disk(d->gd, 0); |
| 388 | |
| 389 | if (bd) { |
| 390 | mutex_lock(&bd->bd_inode->i_mutex); |
| 391 | i_size_write(bd->bd_inode, (loff_t)ssize<<9); |
| 392 | mutex_unlock(&bd->bd_inode->i_mutex); |
| 393 | bdput(bd); |
| 394 | } |
| 395 | spin_lock_irqsave(&d->lock, flags); |
| 396 | d->flags |= DEVFL_UP; |
| 397 | d->flags &= ~DEVFL_NEWSIZE; |
| 398 | spin_unlock_irqrestore(&d->lock, flags); |
| 399 | } |
| 400 | } |
| 401 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 402 | static void |
| 403 | ataid_complete(struct aoedev *d, unsigned char *id) |
| 404 | { |
| 405 | u64 ssize; |
| 406 | u16 n; |
| 407 | |
| 408 | /* word 83: command set supported */ |
Ed L. Cashin | 475172f | 2005-09-29 12:47:40 -0400 | [diff] [blame] | 409 | n = le16_to_cpu(get_unaligned((__le16 *) &id[83<<1])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 410 | |
| 411 | /* word 86: command set/feature enabled */ |
Ed L. Cashin | 475172f | 2005-09-29 12:47:40 -0400 | [diff] [blame] | 412 | n |= le16_to_cpu(get_unaligned((__le16 *) &id[86<<1])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 413 | |
| 414 | if (n & (1<<10)) { /* bit 10: LBA 48 */ |
| 415 | d->flags |= DEVFL_EXT; |
| 416 | |
| 417 | /* word 100: number lba48 sectors */ |
Ed L. Cashin | 475172f | 2005-09-29 12:47:40 -0400 | [diff] [blame] | 418 | ssize = le64_to_cpu(get_unaligned((__le64 *) &id[100<<1])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 419 | |
| 420 | /* set as in ide-disk.c:init_idedisk_capacity */ |
| 421 | d->geo.cylinders = ssize; |
| 422 | d->geo.cylinders /= (255 * 63); |
| 423 | d->geo.heads = 255; |
| 424 | d->geo.sectors = 63; |
| 425 | } else { |
| 426 | d->flags &= ~DEVFL_EXT; |
| 427 | |
| 428 | /* number lba28 sectors */ |
Ed L. Cashin | 475172f | 2005-09-29 12:47:40 -0400 | [diff] [blame] | 429 | ssize = le32_to_cpu(get_unaligned((__le32 *) &id[60<<1])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 430 | |
| 431 | /* NOTE: obsolete in ATA 6 */ |
Ed L. Cashin | 475172f | 2005-09-29 12:47:40 -0400 | [diff] [blame] | 432 | d->geo.cylinders = le16_to_cpu(get_unaligned((__le16 *) &id[54<<1])); |
| 433 | d->geo.heads = le16_to_cpu(get_unaligned((__le16 *) &id[55<<1])); |
| 434 | d->geo.sectors = le16_to_cpu(get_unaligned((__le16 *) &id[56<<1])); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 435 | } |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 436 | |
| 437 | if (d->ssize != ssize) |
| 438 | printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu " |
| 439 | "sectors\n", (unsigned long long)mac_addr(d->addr), |
| 440 | d->aoemajor, d->aoeminor, |
| 441 | d->fw_ver, (long long)ssize); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 442 | d->ssize = ssize; |
| 443 | d->geo.start = 0; |
| 444 | if (d->gd != NULL) { |
| 445 | d->gd->capacity = ssize; |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 446 | d->flags |= DEVFL_NEWSIZE; |
| 447 | } else { |
| 448 | if (d->flags & DEVFL_GDALLOC) { |
| 449 | printk(KERN_INFO "aoe: %s: %s e%lu.%lu, %s\n", |
| 450 | __FUNCTION__, |
| 451 | "can't schedule work for", |
| 452 | d->aoemajor, d->aoeminor, |
| 453 | "it's already on! (This really shouldn't happen).\n"); |
| 454 | return; |
| 455 | } |
| 456 | d->flags |= DEVFL_GDALLOC; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 457 | } |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 458 | schedule_work(&d->work); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 459 | } |
| 460 | |
| 461 | static void |
| 462 | calc_rttavg(struct aoedev *d, int rtt) |
| 463 | { |
| 464 | register long n; |
| 465 | |
| 466 | n = rtt; |
| 467 | if (n < MINTIMER) |
| 468 | n = MINTIMER; |
| 469 | else if (n > MAXTIMER) |
| 470 | n = MAXTIMER; |
| 471 | |
| 472 | /* g == .25; cf. Congestion Avoidance and Control, Jacobson & Karels; 1988 */ |
| 473 | n -= d->rttavg; |
| 474 | d->rttavg += n >> 2; |
| 475 | } |
| 476 | |
| 477 | void |
| 478 | aoecmd_ata_rsp(struct sk_buff *skb) |
| 479 | { |
| 480 | struct aoedev *d; |
| 481 | struct aoe_hdr *hin; |
| 482 | struct aoe_atahdr *ahin, *ahout; |
| 483 | struct frame *f; |
| 484 | struct buf *buf; |
| 485 | struct sk_buff *sl; |
| 486 | register long n; |
| 487 | ulong flags; |
| 488 | char ebuf[128]; |
ecashin@coraid.com | 32465c6 | 2005-04-18 22:00:18 -0700 | [diff] [blame] | 489 | u16 aoemajor; |
| 490 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 491 | hin = (struct aoe_hdr *) skb->mac.raw; |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 492 | aoemajor = be16_to_cpu(hin->major); |
ecashin@coraid.com | 32465c6 | 2005-04-18 22:00:18 -0700 | [diff] [blame] | 493 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 494 | if (d == NULL) { |
| 495 | snprintf(ebuf, sizeof ebuf, "aoecmd_ata_rsp: ata response " |
| 496 | "for unknown device %d.%d\n", |
ecashin@coraid.com | 32465c6 | 2005-04-18 22:00:18 -0700 | [diff] [blame] | 497 | aoemajor, hin->minor); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 498 | aoechr_error(ebuf); |
| 499 | return; |
| 500 | } |
| 501 | |
| 502 | spin_lock_irqsave(&d->lock, flags); |
| 503 | |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 504 | f = getframe(d, be32_to_cpu(hin->tag)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 505 | if (f == NULL) { |
| 506 | spin_unlock_irqrestore(&d->lock, flags); |
| 507 | snprintf(ebuf, sizeof ebuf, |
| 508 | "%15s e%d.%d tag=%08x@%08lx\n", |
| 509 | "unexpected rsp", |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 510 | be16_to_cpu(hin->major), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 511 | hin->minor, |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 512 | be32_to_cpu(hin->tag), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 513 | jiffies); |
| 514 | aoechr_error(ebuf); |
| 515 | return; |
| 516 | } |
| 517 | |
| 518 | calc_rttavg(d, tsince(f->tag)); |
| 519 | |
| 520 | ahin = (struct aoe_atahdr *) (hin+1); |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 521 | ahout = (struct aoe_atahdr *) (f->skb->mac.raw + sizeof(struct aoe_hdr)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 522 | buf = f->buf; |
| 523 | |
Ed L. Cashin | 9d41965 | 2006-02-07 11:37:24 -0500 | [diff] [blame] | 524 | if (ahout->cmdstat == WIN_IDENTIFY) |
| 525 | d->flags &= ~DEVFL_PAUSE; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 526 | if (ahin->cmdstat & 0xa9) { /* these bits cleared on success */ |
| 527 | printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh " |
| 528 | "stat=%2.2Xh from e%ld.%ld\n", |
| 529 | ahout->cmdstat, ahin->cmdstat, |
| 530 | d->aoemajor, d->aoeminor); |
| 531 | if (buf) |
| 532 | buf->flags |= BUFFL_FAIL; |
| 533 | } else { |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 534 | n = ahout->scnt << 9; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 535 | switch (ahout->cmdstat) { |
| 536 | case WIN_READ: |
| 537 | case WIN_READ_EXT: |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 538 | if (skb->len - sizeof *hin - sizeof *ahin < n) { |
| 539 | printk(KERN_CRIT "aoe: aoecmd_ata_rsp: runt " |
| 540 | "ata data size in read. skb->len=%d\n", |
| 541 | skb->len); |
| 542 | /* fail frame f? just returning will rexmit. */ |
| 543 | spin_unlock_irqrestore(&d->lock, flags); |
| 544 | return; |
| 545 | } |
| 546 | memcpy(f->bufaddr, ahin+1, n); |
| 547 | case WIN_WRITE: |
| 548 | case WIN_WRITE_EXT: |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 549 | if (f->bcnt -= n) { |
| 550 | f->bufaddr += n; |
| 551 | put_lba(ahout, f->lba += ahout->scnt); |
| 552 | n = f->bcnt > DEFAULTBCNT ? DEFAULTBCNT : f->bcnt; |
| 553 | ahout->scnt = n >> 9; |
| 554 | if (ahout->aflags & AOEAFL_WRITE) |
| 555 | skb_fill_page_desc(f->skb, 0, virt_to_page(f->bufaddr), |
| 556 | offset_in_page(f->bufaddr), n); |
| 557 | skb_get(f->skb); |
| 558 | f->skb->next = NULL; |
| 559 | spin_unlock_irqrestore(&d->lock, flags); |
| 560 | aoenet_xmit(f->skb); |
| 561 | return; |
| 562 | } |
| 563 | if (n > DEFAULTBCNT) |
| 564 | d->lostjumbo = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 565 | break; |
| 566 | case WIN_IDENTIFY: |
| 567 | if (skb->len - sizeof *hin - sizeof *ahin < 512) { |
| 568 | printk(KERN_INFO "aoe: aoecmd_ata_rsp: runt data size " |
| 569 | "in ataid. skb->len=%d\n", skb->len); |
| 570 | spin_unlock_irqrestore(&d->lock, flags); |
| 571 | return; |
| 572 | } |
| 573 | ataid_complete(d, (char *) (ahin+1)); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 574 | break; |
| 575 | default: |
| 576 | printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized " |
| 577 | "outbound ata command %2.2Xh for %d.%d\n", |
| 578 | ahout->cmdstat, |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 579 | be16_to_cpu(hin->major), |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 580 | hin->minor); |
| 581 | } |
| 582 | } |
| 583 | |
| 584 | if (buf) { |
| 585 | buf->nframesout -= 1; |
| 586 | if (buf->nframesout == 0 && buf->resid == 0) { |
ecashin@coraid.com | 0c6f0e7 | 2005-04-18 22:00:22 -0700 | [diff] [blame] | 587 | unsigned long duration = jiffies - buf->start_time; |
| 588 | unsigned long n_sect = buf->bio->bi_size >> 9; |
| 589 | struct gendisk *disk = d->gd; |
Jens Axboe | 496456c | 2005-11-01 09:54:23 +0100 | [diff] [blame] | 590 | const int rw = bio_data_dir(buf->bio); |
ecashin@coraid.com | 0c6f0e7 | 2005-04-18 22:00:22 -0700 | [diff] [blame] | 591 | |
Jens Axboe | 496456c | 2005-11-01 09:54:23 +0100 | [diff] [blame] | 592 | disk_stat_inc(disk, ios[rw]); |
| 593 | disk_stat_add(disk, ticks[rw], duration); |
| 594 | disk_stat_add(disk, sectors[rw], n_sect); |
ecashin@coraid.com | 0c6f0e7 | 2005-04-18 22:00:22 -0700 | [diff] [blame] | 595 | disk_stat_add(disk, io_ticks, duration); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 596 | n = (buf->flags & BUFFL_FAIL) ? -EIO : 0; |
| 597 | bio_endio(buf->bio, buf->bio->bi_size, n); |
| 598 | mempool_free(buf, d->bufpool); |
| 599 | } |
| 600 | } |
| 601 | |
| 602 | f->buf = NULL; |
| 603 | f->tag = FREETAG; |
| 604 | |
| 605 | aoecmd_work(d); |
ecashin@coraid.com | a4b3836 | 2005-04-18 22:00:22 -0700 | [diff] [blame] | 606 | sl = d->sendq_hd; |
| 607 | d->sendq_hd = d->sendq_tl = NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 608 | |
| 609 | spin_unlock_irqrestore(&d->lock, flags); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 610 | aoenet_xmit(sl); |
| 611 | } |
| 612 | |
| 613 | void |
| 614 | aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) |
| 615 | { |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 616 | struct sk_buff *sl; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 617 | |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 618 | sl = aoecmd_cfg_pkts(aoemajor, aoeminor, NULL); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 619 | |
| 620 | aoenet_xmit(sl); |
| 621 | } |
| 622 | |
| 623 | /* |
| 624 | * Since we only call this in one place (and it only prepares one frame) |
ecashin@coraid.com | a4b3836 | 2005-04-18 22:00:22 -0700 | [diff] [blame] | 625 | * we just return the skb. Usually we'd chain it up to the aoedev sendq. |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 626 | */ |
| 627 | static struct sk_buff * |
| 628 | aoecmd_ata_id(struct aoedev *d) |
| 629 | { |
| 630 | struct aoe_hdr *h; |
| 631 | struct aoe_atahdr *ah; |
| 632 | struct frame *f; |
| 633 | struct sk_buff *skb; |
| 634 | |
| 635 | f = getframe(d, FREETAG); |
| 636 | if (f == NULL) { |
| 637 | printk(KERN_CRIT "aoe: aoecmd_ata_id: can't get a frame. " |
| 638 | "This shouldn't happen.\n"); |
| 639 | return NULL; |
| 640 | } |
| 641 | |
| 642 | /* initialize the headers & frame */ |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 643 | skb = f->skb; |
| 644 | h = (struct aoe_hdr *) skb->mac.raw; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 645 | ah = (struct aoe_atahdr *) (h+1); |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 646 | skb->len = sizeof *h + sizeof *ah; |
| 647 | memset(h, 0, skb->len); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 648 | f->tag = aoehdr_atainit(d, h); |
| 649 | f->waited = 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 650 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 651 | /* set up ata header */ |
| 652 | ah->scnt = 1; |
| 653 | ah->cmdstat = WIN_IDENTIFY; |
| 654 | ah->lba3 = 0xa0; |
| 655 | |
Ed L. Cashin | e407a7f | 2006-09-20 14:36:49 -0400 | [diff] [blame] | 656 | skb->dev = d->ifp; |
| 657 | skb_get(skb); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 658 | |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 659 | d->rttavg = MAXTIMER; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 660 | d->timer.function = rexmit_timer; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 661 | |
| 662 | return skb; |
| 663 | } |
| 664 | |
| 665 | void |
| 666 | aoecmd_cfg_rsp(struct sk_buff *skb) |
| 667 | { |
| 668 | struct aoedev *d; |
| 669 | struct aoe_hdr *h; |
| 670 | struct aoe_cfghdr *ch; |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 671 | ulong flags, sysminor, aoemajor; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 672 | struct sk_buff *sl; |
Ed L. Cashin | eaf0a3c | 2006-01-19 13:46:20 -0500 | [diff] [blame] | 673 | enum { MAXFRAMES = 16 }; |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 674 | u16 n; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 675 | |
| 676 | h = (struct aoe_hdr *) skb->mac.raw; |
| 677 | ch = (struct aoe_cfghdr *) (h+1); |
| 678 | |
| 679 | /* |
| 680 | * Enough people have their dip switches set backwards to |
| 681 | * warrant a loud message for this special case. |
| 682 | */ |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 683 | aoemajor = be16_to_cpu(h->major); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 684 | if (aoemajor == 0xfff) { |
| 685 | printk(KERN_CRIT "aoe: aoecmd_cfg_rsp: Warning: shelf " |
| 686 | "address is all ones. Check shelf dip switches\n"); |
| 687 | return; |
| 688 | } |
| 689 | |
| 690 | sysminor = SYSMINOR(aoemajor, h->minor); |
ecashin@coraid.com | fc458dc | 2005-04-18 22:00:17 -0700 | [diff] [blame] | 691 | if (sysminor * AOE_PARTITIONS + AOE_PARTITIONS > MINORMASK) { |
| 692 | printk(KERN_INFO |
| 693 | "aoe: e%ld.%d: minor number too large\n", |
| 694 | aoemajor, (int) h->minor); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 695 | return; |
| 696 | } |
| 697 | |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 698 | n = be16_to_cpu(ch->bufcnt); |
| 699 | if (n > MAXFRAMES) /* keep it reasonable */ |
| 700 | n = MAXFRAMES; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 701 | |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 702 | d = aoedev_by_sysminor_m(sysminor, n); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 703 | if (d == NULL) { |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 704 | printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device sysminor_m failure\n"); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 705 | return; |
| 706 | } |
| 707 | |
| 708 | spin_lock_irqsave(&d->lock, flags); |
| 709 | |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 710 | /* permit device to migrate mac and network interface */ |
| 711 | d->ifp = skb->dev; |
| 712 | memcpy(d->addr, h->src, sizeof d->addr); |
Ed L. Cashin | 19bf263 | 2006-09-20 14:36:49 -0400 | [diff] [blame^] | 713 | if (!(d->flags & DEVFL_MAXBCNT)) { |
| 714 | n = d->ifp->mtu; |
| 715 | n -= sizeof (struct aoe_hdr) + sizeof (struct aoe_atahdr); |
| 716 | n /= 512; |
| 717 | if (n > ch->scnt) |
| 718 | n = ch->scnt; |
| 719 | d->maxbcnt = n ? n * 512 : DEFAULTBCNT; |
| 720 | } |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 721 | |
| 722 | /* don't change users' perspective */ |
| 723 | if (d->nopen && !(d->flags & DEVFL_PAUSE)) { |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 724 | spin_unlock_irqrestore(&d->lock, flags); |
| 725 | return; |
| 726 | } |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 727 | d->flags |= DEVFL_PAUSE; /* force pause */ |
ecashin@coraid.com | 63e9cc5 | 2005-04-18 22:00:20 -0700 | [diff] [blame] | 728 | d->fw_ver = be16_to_cpu(ch->fwver); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 729 | |
Ed L. Cashin | 3ae1c24 | 2006-01-19 13:46:19 -0500 | [diff] [blame] | 730 | /* check for already outstanding ataid */ |
| 731 | sl = aoedev_isbusy(d) == 0 ? aoecmd_ata_id(d) : NULL; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 732 | |
| 733 | spin_unlock_irqrestore(&d->lock, flags); |
| 734 | |
| 735 | aoenet_xmit(sl); |
| 736 | } |
| 737 | |