aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/pasemi_mac.c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2007-08-22 10:12:59 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-10 19:50:57 -0400
commit26fcfa95aef980cab4ff1ea55979c30e772dd0dd (patch)
tree412e07040cf1adf912cf8098656243e1b9bd2ea4 /drivers/net/pasemi_mac.c
parent73344863e426a3c56c7f3ac80fc6f1d4cb10460b (diff)
pasemi_mac: RX performance tweaks
Various RX performance tweaks, do some explicit prefetching of packet data, etc. Signed-off-by: Olof Johansson <olof@lixom.net> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers/net/pasemi_mac.c')
-rw-r--r--drivers/net/pasemi_mac.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/net/pasemi_mac.c b/drivers/net/pasemi_mac.c
index 0d80b9d48c26..f71a6864cdc2 100644
--- a/drivers/net/pasemi_mac.c
+++ b/drivers/net/pasemi_mac.c
@@ -471,6 +471,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
471 rmb(); 471 rmb();
472 472
473 dp = &RX_DESC(mac, n); 473 dp = &RX_DESC(mac, n);
474 prefetchw(dp);
474 macrx = dp->macrx; 475 macrx = dp->macrx;
475 476
476 if (!(macrx & XCT_MACRX_O)) 477 if (!(macrx & XCT_MACRX_O))
@@ -492,8 +493,10 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
492 if (info->dma == dma) 493 if (info->dma == dma)
493 break; 494 break;
494 } 495 }
496 prefetchw(info);
495 497
496 skb = info->skb; 498 skb = info->skb;
499 prefetchw(skb);
497 info->dma = 0; 500 info->dma = 0;
498 501
499 pci_unmap_single(mac->dma_pdev, dma, skb->len, 502 pci_unmap_single(mac->dma_pdev, dma, skb->len,
@@ -516,9 +519,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
516 519
517 skb_put(skb, len); 520 skb_put(skb, len);
518 521
519 skb->protocol = eth_type_trans(skb, mac->netdev); 522 if (likely((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK)) {
520
521 if ((macrx & XCT_MACRX_HTY_M) == XCT_MACRX_HTY_IPV4_OK) {
522 skb->ip_summed = CHECKSUM_COMPLETE; 523 skb->ip_summed = CHECKSUM_COMPLETE;
523 skb->csum = (macrx & XCT_MACRX_CSUM_M) >> 524 skb->csum = (macrx & XCT_MACRX_CSUM_M) >>
524 XCT_MACRX_CSUM_S; 525 XCT_MACRX_CSUM_S;
@@ -528,6 +529,7 @@ static int pasemi_mac_clean_rx(struct pasemi_mac *mac, int limit)
528 mac->stats.rx_bytes += len; 529 mac->stats.rx_bytes += len;
529 mac->stats.rx_packets++; 530 mac->stats.rx_packets++;
530 531
532 skb->protocol = eth_type_trans(skb, mac->netdev);
531 netif_receive_skb(skb); 533 netif_receive_skb(skb);
532 534
533 dp->ptr = 0; 535 dp->ptr = 0;
@@ -559,7 +561,7 @@ static int pasemi_mac_clean_tx(struct pasemi_mac *mac)
559 561
560 for (i = start; i < mac->tx->next_to_use; i++) { 562 for (i = start; i < mac->tx->next_to_use; i++) {
561 dp = &TX_DESC(mac, i); 563 dp = &TX_DESC(mac, i);
562 if (!dp || (dp->mactx & XCT_MACTX_O)) 564 if (unlikely(dp->mactx & XCT_MACTX_O))
563 break; 565 break;
564 566
565 count++; 567 count++;
@@ -948,7 +950,7 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
948 struct pasemi_mac_txring *txring; 950 struct pasemi_mac_txring *txring;
949 struct pasemi_mac_buffer *info; 951 struct pasemi_mac_buffer *info;
950 struct pas_dma_xct_descr *dp; 952 struct pas_dma_xct_descr *dp;
951 u64 dflags; 953 u64 dflags, mactx, ptr;
952 dma_addr_t map; 954 dma_addr_t map;
953 int flags; 955 int flags;
954 956
@@ -976,6 +978,9 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
976 if (dma_mapping_error(map)) 978 if (dma_mapping_error(map))
977 return NETDEV_TX_BUSY; 979 return NETDEV_TX_BUSY;
978 980
981 mactx = dflags | XCT_MACTX_LLEN(skb->len);
982 ptr = XCT_PTR_LEN(skb->len) | XCT_PTR_ADDR(map);
983
979 txring = mac->tx; 984 txring = mac->tx;
980 985
981 spin_lock_irqsave(&txring->lock, flags); 986 spin_lock_irqsave(&txring->lock, flags);
@@ -996,12 +1001,11 @@ static int pasemi_mac_start_tx(struct sk_buff *skb, struct net_device *dev)
996 } 1001 }
997 } 1002 }
998 1003
999
1000 dp = &TX_DESC(mac, txring->next_to_use); 1004 dp = &TX_DESC(mac, txring->next_to_use);
1001 info = &TX_DESC_INFO(mac, txring->next_to_use); 1005 info = &TX_DESC_INFO(mac, txring->next_to_use);
1002 1006
1003 dp->mactx = dflags | XCT_MACTX_LLEN(skb->len); 1007 dp->mactx = mactx;
1004 dp->ptr = XCT_PTR_LEN(skb->len) | XCT_PTR_ADDR(map); 1008 dp->ptr = ptr;
1005 info->dma = map; 1009 info->dma = map;
1006 info->skb = skb; 1010 info->skb = skb;
1007 1011