aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid S. Miller <davem@davemloft.net>2009-06-09 04:01:31 -0400
committerDavid S. Miller <davem@davemloft.net>2009-06-09 04:01:31 -0400
commitebc8d2ab61dde6cf775ae7bb1ed9e38dfe12ca65 (patch)
treeb8c26cff066e25e795d45b98d00047214bfa31de
parentd4fd3bc101909802f9ed083093cce688cc3416aa (diff)
be2net: Remove unnecessary frag list traversing.
This driver does not indicate support for frag lists. Furthermore, even if it did, the code is walking the frag lists incorrectly. The idiom is: for (iter = skb_shinfo(skb)->frag_list; iter; iter = iter->next) but it's doing: for (iter = skb_shinfo(skb)->frag_list; iter; iter = skb_shinfo(iter)->frag_list) which would never work. And this proves that this driver never saw an SKB with active frag lists. So just remove the code altogether and the driver TX path becomes much simpler. Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/benet/be_main.c56
1 files changed, 25 insertions, 31 deletions
diff --git a/drivers/net/benet/be_main.c b/drivers/net/benet/be_main.c
index 5f17d80300ae..347d002fa425 100644
--- a/drivers/net/benet/be_main.c
+++ b/drivers/net/benet/be_main.c
@@ -337,13 +337,10 @@ static void be_tx_stats_update(struct be_adapter *adapter,
337/* Determine number of WRB entries needed to xmit data in an skb */ 337/* Determine number of WRB entries needed to xmit data in an skb */
338static u32 wrb_cnt_for_skb(struct sk_buff *skb, bool *dummy) 338static u32 wrb_cnt_for_skb(struct sk_buff *skb, bool *dummy)
339{ 339{
340 int cnt = 0; 340 int cnt = (skb->len > skb->data_len);
341 while (skb) { 341
342 if (skb->len > skb->data_len) 342 cnt += skb_shinfo(skb)->nr_frags;
343 cnt++; 343
344 cnt += skb_shinfo(skb)->nr_frags;
345 skb = skb_shinfo(skb)->frag_list;
346 }
347 /* to account for hdr wrb */ 344 /* to account for hdr wrb */
348 cnt++; 345 cnt++;
349 if (cnt & 1) { 346 if (cnt & 1) {
@@ -409,31 +406,28 @@ static int make_tx_wrbs(struct be_adapter *adapter,
409 hdr = queue_head_node(txq); 406 hdr = queue_head_node(txq);
410 queue_head_inc(txq); 407 queue_head_inc(txq);
411 408
412 while (skb) { 409 if (skb->len > skb->data_len) {
413 if (skb->len > skb->data_len) { 410 int len = skb->len - skb->data_len;
414 int len = skb->len - skb->data_len; 411 busaddr = pci_map_single(pdev, skb->data, len,
415 busaddr = pci_map_single(pdev, skb->data, len, 412 PCI_DMA_TODEVICE);
416 PCI_DMA_TODEVICE); 413 wrb = queue_head_node(txq);
417 wrb = queue_head_node(txq); 414 wrb_fill(wrb, busaddr, len);
418 wrb_fill(wrb, busaddr, len); 415 be_dws_cpu_to_le(wrb, sizeof(*wrb));
419 be_dws_cpu_to_le(wrb, sizeof(*wrb)); 416 queue_head_inc(txq);
420 queue_head_inc(txq); 417 copied += len;
421 copied += len; 418 }
422 }
423 419
424 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) { 420 for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
425 struct skb_frag_struct *frag = 421 struct skb_frag_struct *frag =
426 &skb_shinfo(skb)->frags[i]; 422 &skb_shinfo(skb)->frags[i];
427 busaddr = pci_map_page(pdev, frag->page, 423 busaddr = pci_map_page(pdev, frag->page,
428 frag->page_offset, 424 frag->page_offset,
429 frag->size, PCI_DMA_TODEVICE); 425 frag->size, PCI_DMA_TODEVICE);
430 wrb = queue_head_node(txq); 426 wrb = queue_head_node(txq);
431 wrb_fill(wrb, busaddr, frag->size); 427 wrb_fill(wrb, busaddr, frag->size);
432 be_dws_cpu_to_le(wrb, sizeof(*wrb)); 428 be_dws_cpu_to_le(wrb, sizeof(*wrb));
433 queue_head_inc(txq); 429 queue_head_inc(txq);
434 copied += frag->size; 430 copied += frag->size;
435 }
436 skb = skb_shinfo(skb)->frag_list;
437 } 431 }
438 432
439 if (dummy_wrb) { 433 if (dummy_wrb) {