diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-11 12:33:18 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2008-10-11 12:33:18 -0400 |
commit | 4dd9ec4946b4651a295d3bc8df9c15ac692a8f4e (patch) | |
tree | afb300c752de7175bb2df4722d5c857e070c75d9 /drivers/block/aoe/aoecmd.c | |
parent | 86ed5a93b8b56e4e0877b914af0e10883a196384 (diff) | |
parent | 6861ff35ec5b60fafaf8651754c9a75142bfa9a4 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6: (1075 commits)
myri10ge: update driver version number to 1.4.3-1.369
r8169: add shutdown handler
r8169: preliminary 8168d support
r8169: support additional 8168cp chipset
r8169: change default behavior for mildly identified 8168c chipsets
r8169: add a new 8168cp flavor
r8169: add a new 8168c flavor (bis)
r8169: add a new 8168c flavor
r8169: sync existing 8168 device hardware start sequences with vendor driver
r8169: 8168b Tx performance tweak
r8169: make room for more specific 8168 hardware start procedure
r8169: shuffle some registers handling around (8168 operation only)
r8169: new phy init parameters for the 8168b
r8169: update phy init parameters
r8169: wake up the PHY of the 8168
af_key: fix SADB_X_SPDDELETE response
ath9k: Fix return code when ath9k_hw_setpower() fails on reset
ath9k: remove nasty FAIL macro from ath9k_hw_reset()
gre: minor cleanups in netlink interface
gre: fix copy and paste error
...
Diffstat (limited to 'drivers/block/aoe/aoecmd.c')
-rw-r--r-- | drivers/block/aoe/aoecmd.c | 85 |
1 files changed, 32 insertions, 53 deletions
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 961d29a53cab..71ff78c9e4d6 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -114,29 +114,22 @@ ifrotate(struct aoetgt *t) | |||
114 | static void | 114 | static void |
115 | skb_pool_put(struct aoedev *d, struct sk_buff *skb) | 115 | skb_pool_put(struct aoedev *d, struct sk_buff *skb) |
116 | { | 116 | { |
117 | if (!d->skbpool_hd) | 117 | __skb_queue_tail(&d->skbpool, skb); |
118 | d->skbpool_hd = skb; | ||
119 | else | ||
120 | d->skbpool_tl->next = skb; | ||
121 | d->skbpool_tl = skb; | ||
122 | } | 118 | } |
123 | 119 | ||
124 | static struct sk_buff * | 120 | static struct sk_buff * |
125 | skb_pool_get(struct aoedev *d) | 121 | skb_pool_get(struct aoedev *d) |
126 | { | 122 | { |
127 | struct sk_buff *skb; | 123 | struct sk_buff *skb = skb_peek(&d->skbpool); |
128 | 124 | ||
129 | skb = d->skbpool_hd; | ||
130 | if (skb && atomic_read(&skb_shinfo(skb)->dataref) == 1) { | 125 | if (skb && atomic_read(&skb_shinfo(skb)->dataref) == 1) { |
131 | d->skbpool_hd = skb->next; | 126 | __skb_unlink(skb, &d->skbpool); |
132 | skb->next = NULL; | ||
133 | return skb; | 127 | return skb; |
134 | } | 128 | } |
135 | if (d->nskbpool < NSKBPOOLMAX | 129 | if (skb_queue_len(&d->skbpool) < NSKBPOOLMAX && |
136 | && (skb = new_skb(ETH_ZLEN))) { | 130 | (skb = new_skb(ETH_ZLEN))) |
137 | d->nskbpool++; | ||
138 | return skb; | 131 | return skb; |
139 | } | 132 | |
140 | return NULL; | 133 | return NULL; |
141 | } | 134 | } |
142 | 135 | ||
@@ -293,29 +286,22 @@ aoecmd_ata_rw(struct aoedev *d) | |||
293 | 286 | ||
294 | skb->dev = t->ifp->nd; | 287 | skb->dev = t->ifp->nd; |
295 | skb = skb_clone(skb, GFP_ATOMIC); | 288 | skb = skb_clone(skb, GFP_ATOMIC); |
296 | if (skb) { | 289 | if (skb) |
297 | if (d->sendq_hd) | 290 | __skb_queue_tail(&d->sendq, skb); |
298 | d->sendq_tl->next = skb; | ||
299 | else | ||
300 | d->sendq_hd = skb; | ||
301 | d->sendq_tl = skb; | ||
302 | } | ||
303 | return 1; | 291 | return 1; |
304 | } | 292 | } |
305 | 293 | ||
306 | /* some callers cannot sleep, and they can call this function, | 294 | /* some callers cannot sleep, and they can call this function, |
307 | * transmitting the packets later, when interrupts are on | 295 | * transmitting the packets later, when interrupts are on |
308 | */ | 296 | */ |
309 | static struct sk_buff * | 297 | static void |
310 | aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) | 298 | aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff_head *queue) |
311 | { | 299 | { |
312 | struct aoe_hdr *h; | 300 | struct aoe_hdr *h; |
313 | struct aoe_cfghdr *ch; | 301 | struct aoe_cfghdr *ch; |
314 | struct sk_buff *skb, *sl, *sl_tail; | 302 | struct sk_buff *skb; |
315 | struct net_device *ifp; | 303 | struct net_device *ifp; |
316 | 304 | ||
317 | sl = sl_tail = NULL; | ||
318 | |||
319 | read_lock(&dev_base_lock); | 305 | read_lock(&dev_base_lock); |
320 | for_each_netdev(&init_net, ifp) { | 306 | for_each_netdev(&init_net, ifp) { |
321 | dev_hold(ifp); | 307 | dev_hold(ifp); |
@@ -329,8 +315,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) | |||
329 | } | 315 | } |
330 | skb_put(skb, sizeof *h + sizeof *ch); | 316 | skb_put(skb, sizeof *h + sizeof *ch); |
331 | skb->dev = ifp; | 317 | skb->dev = ifp; |
332 | if (sl_tail == NULL) | 318 | __skb_queue_tail(queue, skb); |
333 | sl_tail = skb; | ||
334 | h = (struct aoe_hdr *) skb_mac_header(skb); | 319 | h = (struct aoe_hdr *) skb_mac_header(skb); |
335 | memset(h, 0, sizeof *h + sizeof *ch); | 320 | memset(h, 0, sizeof *h + sizeof *ch); |
336 | 321 | ||
@@ -342,16 +327,10 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) | |||
342 | h->minor = aoeminor; | 327 | h->minor = aoeminor; |
343 | h->cmd = AOECMD_CFG; | 328 | h->cmd = AOECMD_CFG; |
344 | 329 | ||
345 | skb->next = sl; | ||
346 | sl = skb; | ||
347 | cont: | 330 | cont: |
348 | dev_put(ifp); | 331 | dev_put(ifp); |
349 | } | 332 | } |
350 | read_unlock(&dev_base_lock); | 333 | read_unlock(&dev_base_lock); |
351 | |||
352 | if (tail != NULL) | ||
353 | *tail = sl_tail; | ||
354 | return sl; | ||
355 | } | 334 | } |
356 | 335 | ||
357 | static void | 336 | static void |
@@ -406,11 +385,7 @@ resend(struct aoedev *d, struct aoetgt *t, struct frame *f) | |||
406 | skb = skb_clone(skb, GFP_ATOMIC); | 385 | skb = skb_clone(skb, GFP_ATOMIC); |
407 | if (skb == NULL) | 386 | if (skb == NULL) |
408 | return; | 387 | return; |
409 | if (d->sendq_hd) | 388 | __skb_queue_tail(&d->sendq, skb); |
410 | d->sendq_tl->next = skb; | ||
411 | else | ||
412 | d->sendq_hd = skb; | ||
413 | d->sendq_tl = skb; | ||
414 | } | 389 | } |
415 | 390 | ||
416 | static int | 391 | static int |
@@ -508,16 +483,15 @@ ata_scnt(unsigned char *packet) { | |||
508 | static void | 483 | static void |
509 | rexmit_timer(ulong vp) | 484 | rexmit_timer(ulong vp) |
510 | { | 485 | { |
486 | struct sk_buff_head queue; | ||
511 | struct aoedev *d; | 487 | struct aoedev *d; |
512 | struct aoetgt *t, **tt, **te; | 488 | struct aoetgt *t, **tt, **te; |
513 | struct aoeif *ifp; | 489 | struct aoeif *ifp; |
514 | struct frame *f, *e; | 490 | struct frame *f, *e; |
515 | struct sk_buff *sl; | ||
516 | register long timeout; | 491 | register long timeout; |
517 | ulong flags, n; | 492 | ulong flags, n; |
518 | 493 | ||
519 | d = (struct aoedev *) vp; | 494 | d = (struct aoedev *) vp; |
520 | sl = NULL; | ||
521 | 495 | ||
522 | /* timeout is always ~150% of the moving average */ | 496 | /* timeout is always ~150% of the moving average */ |
523 | timeout = d->rttavg; | 497 | timeout = d->rttavg; |
@@ -589,7 +563,7 @@ rexmit_timer(ulong vp) | |||
589 | } | 563 | } |
590 | } | 564 | } |
591 | 565 | ||
592 | if (d->sendq_hd) { | 566 | if (!skb_queue_empty(&d->sendq)) { |
593 | n = d->rttavg <<= 1; | 567 | n = d->rttavg <<= 1; |
594 | if (n > MAXTIMER) | 568 | if (n > MAXTIMER) |
595 | d->rttavg = MAXTIMER; | 569 | d->rttavg = MAXTIMER; |
@@ -600,15 +574,15 @@ rexmit_timer(ulong vp) | |||
600 | aoecmd_work(d); | 574 | aoecmd_work(d); |
601 | } | 575 | } |
602 | 576 | ||
603 | sl = d->sendq_hd; | 577 | __skb_queue_head_init(&queue); |
604 | d->sendq_hd = d->sendq_tl = NULL; | 578 | skb_queue_splice_init(&d->sendq, &queue); |
605 | 579 | ||
606 | d->timer.expires = jiffies + TIMERTICK; | 580 | d->timer.expires = jiffies + TIMERTICK; |
607 | add_timer(&d->timer); | 581 | add_timer(&d->timer); |
608 | 582 | ||
609 | spin_unlock_irqrestore(&d->lock, flags); | 583 | spin_unlock_irqrestore(&d->lock, flags); |
610 | 584 | ||
611 | aoenet_xmit(sl); | 585 | aoenet_xmit(&queue); |
612 | } | 586 | } |
613 | 587 | ||
614 | /* enters with d->lock held */ | 588 | /* enters with d->lock held */ |
@@ -772,12 +746,12 @@ diskstats(struct gendisk *disk, struct bio *bio, ulong duration, sector_t sector | |||
772 | void | 746 | void |
773 | aoecmd_ata_rsp(struct sk_buff *skb) | 747 | aoecmd_ata_rsp(struct sk_buff *skb) |
774 | { | 748 | { |
749 | struct sk_buff_head queue; | ||
775 | struct aoedev *d; | 750 | struct aoedev *d; |
776 | struct aoe_hdr *hin, *hout; | 751 | struct aoe_hdr *hin, *hout; |
777 | struct aoe_atahdr *ahin, *ahout; | 752 | struct aoe_atahdr *ahin, *ahout; |
778 | struct frame *f; | 753 | struct frame *f; |
779 | struct buf *buf; | 754 | struct buf *buf; |
780 | struct sk_buff *sl; | ||
781 | struct aoetgt *t; | 755 | struct aoetgt *t; |
782 | struct aoeif *ifp; | 756 | struct aoeif *ifp; |
783 | register long n; | 757 | register long n; |
@@ -898,21 +872,21 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
898 | 872 | ||
899 | aoecmd_work(d); | 873 | aoecmd_work(d); |
900 | xmit: | 874 | xmit: |
901 | sl = d->sendq_hd; | 875 | __skb_queue_head_init(&queue); |
902 | d->sendq_hd = d->sendq_tl = NULL; | 876 | skb_queue_splice_init(&d->sendq, &queue); |
903 | 877 | ||
904 | spin_unlock_irqrestore(&d->lock, flags); | 878 | spin_unlock_irqrestore(&d->lock, flags); |
905 | aoenet_xmit(sl); | 879 | aoenet_xmit(&queue); |
906 | } | 880 | } |
907 | 881 | ||
908 | void | 882 | void |
909 | aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) | 883 | aoecmd_cfg(ushort aoemajor, unsigned char aoeminor) |
910 | { | 884 | { |
911 | struct sk_buff *sl; | 885 | struct sk_buff_head queue; |
912 | |||
913 | sl = aoecmd_cfg_pkts(aoemajor, aoeminor, NULL); | ||
914 | 886 | ||
915 | aoenet_xmit(sl); | 887 | __skb_queue_head_init(&queue); |
888 | aoecmd_cfg_pkts(aoemajor, aoeminor, &queue); | ||
889 | aoenet_xmit(&queue); | ||
916 | } | 890 | } |
917 | 891 | ||
918 | struct sk_buff * | 892 | struct sk_buff * |
@@ -1081,7 +1055,12 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
1081 | 1055 | ||
1082 | spin_unlock_irqrestore(&d->lock, flags); | 1056 | spin_unlock_irqrestore(&d->lock, flags); |
1083 | 1057 | ||
1084 | aoenet_xmit(sl); | 1058 | if (sl) { |
1059 | struct sk_buff_head queue; | ||
1060 | __skb_queue_head_init(&queue); | ||
1061 | __skb_queue_tail(&queue, sl); | ||
1062 | aoenet_xmit(&queue); | ||
1063 | } | ||
1085 | } | 1064 | } |
1086 | 1065 | ||
1087 | void | 1066 | void |