aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/bnx2.c
diff options
context:
space:
mode:
authorPatrick McHardy <kaber@trash.net>2010-05-10 12:39:28 -0400
committerPatrick McHardy <kaber@trash.net>2010-05-10 12:39:28 -0400
commit1e4b1057121bc756b91758a434b504d2010f6088 (patch)
treeb016cf2c728289c7e36d9e4e488f30ab0bd0ae6e /drivers/net/bnx2.c
parent3b254c54ec46eb022cb26ee6ab37fae23f5f7d6a (diff)
parent3ee943728fff536edaf8f59faa58aaa1aa7366e3 (diff)
Merge branch 'master' of /repos/git/net-next-2.6
Conflicts: net/bridge/br_device.c net/bridge/br_forward.c Signed-off-by: Patrick McHardy <kaber@trash.net>
Diffstat (limited to 'drivers/net/bnx2.c')
-rw-r--r--drivers/net/bnx2.c70
1 files changed, 43 insertions, 27 deletions
diff --git a/drivers/net/bnx2.c b/drivers/net/bnx2.c
index 53326fed6c81..667f4196dc29 100644
--- a/drivers/net/bnx2.c
+++ b/drivers/net/bnx2.c
@@ -58,8 +58,8 @@
58#include "bnx2_fw.h" 58#include "bnx2_fw.h"
59 59
60#define DRV_MODULE_NAME "bnx2" 60#define DRV_MODULE_NAME "bnx2"
61#define DRV_MODULE_VERSION "2.0.8" 61#define DRV_MODULE_VERSION "2.0.9"
62#define DRV_MODULE_RELDATE "Feb 15, 2010" 62#define DRV_MODULE_RELDATE "April 27, 2010"
63#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-5.0.0.j6.fw" 63#define FW_MIPS_FILE_06 "bnx2/bnx2-mips-06-5.0.0.j6.fw"
64#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-5.0.0.j3.fw" 64#define FW_RV2P_FILE_06 "bnx2/bnx2-rv2p-06-5.0.0.j3.fw"
65#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-5.0.0.j9.fw" 65#define FW_MIPS_FILE_09 "bnx2/bnx2-mips-09-5.0.0.j9.fw"
@@ -651,9 +651,10 @@ bnx2_napi_enable(struct bnx2 *bp)
651} 651}
652 652
653static void 653static void
654bnx2_netif_stop(struct bnx2 *bp) 654bnx2_netif_stop(struct bnx2 *bp, bool stop_cnic)
655{ 655{
656 bnx2_cnic_stop(bp); 656 if (stop_cnic)
657 bnx2_cnic_stop(bp);
657 if (netif_running(bp->dev)) { 658 if (netif_running(bp->dev)) {
658 int i; 659 int i;
659 660
@@ -671,14 +672,15 @@ bnx2_netif_stop(struct bnx2 *bp)
671} 672}
672 673
673static void 674static void
674bnx2_netif_start(struct bnx2 *bp) 675bnx2_netif_start(struct bnx2 *bp, bool start_cnic)
675{ 676{
676 if (atomic_dec_and_test(&bp->intr_sem)) { 677 if (atomic_dec_and_test(&bp->intr_sem)) {
677 if (netif_running(bp->dev)) { 678 if (netif_running(bp->dev)) {
678 netif_tx_wake_all_queues(bp->dev); 679 netif_tx_wake_all_queues(bp->dev);
679 bnx2_napi_enable(bp); 680 bnx2_napi_enable(bp);
680 bnx2_enable_int(bp); 681 bnx2_enable_int(bp);
681 bnx2_cnic_start(bp); 682 if (start_cnic)
683 bnx2_cnic_start(bp);
682 } 684 }
683 } 685 }
684} 686}
@@ -2717,6 +2719,7 @@ bnx2_alloc_rx_skb(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr, u16 index)
2717 } 2719 }
2718 2720
2719 rx_buf->skb = skb; 2721 rx_buf->skb = skb;
2722 rx_buf->desc = (struct l2_fhdr *) skb->data;
2720 dma_unmap_addr_set(rx_buf, mapping, mapping); 2723 dma_unmap_addr_set(rx_buf, mapping, mapping);
2721 2724
2722 rxbd->rx_bd_haddr_hi = (u64) mapping >> 32; 2725 rxbd->rx_bd_haddr_hi = (u64) mapping >> 32;
@@ -2939,6 +2942,7 @@ bnx2_reuse_rx_skb(struct bnx2 *bp, struct bnx2_rx_ring_info *rxr,
2939 rxr->rx_prod_bseq += bp->rx_buf_use_size; 2942 rxr->rx_prod_bseq += bp->rx_buf_use_size;
2940 2943
2941 prod_rx_buf->skb = skb; 2944 prod_rx_buf->skb = skb;
2945 prod_rx_buf->desc = (struct l2_fhdr *) skb->data;
2942 2946
2943 if (cons == prod) 2947 if (cons == prod)
2944 return; 2948 return;
@@ -3072,6 +3076,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3072 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod; 3076 u16 hw_cons, sw_cons, sw_ring_cons, sw_prod, sw_ring_prod;
3073 struct l2_fhdr *rx_hdr; 3077 struct l2_fhdr *rx_hdr;
3074 int rx_pkt = 0, pg_ring_used = 0; 3078 int rx_pkt = 0, pg_ring_used = 0;
3079 struct pci_dev *pdev = bp->pdev;
3075 3080
3076 hw_cons = bnx2_get_hw_rx_cons(bnapi); 3081 hw_cons = bnx2_get_hw_rx_cons(bnapi);
3077 sw_cons = rxr->rx_cons; 3082 sw_cons = rxr->rx_cons;
@@ -3084,7 +3089,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3084 while (sw_cons != hw_cons) { 3089 while (sw_cons != hw_cons) {
3085 unsigned int len, hdr_len; 3090 unsigned int len, hdr_len;
3086 u32 status; 3091 u32 status;
3087 struct sw_bd *rx_buf; 3092 struct sw_bd *rx_buf, *next_rx_buf;
3088 struct sk_buff *skb; 3093 struct sk_buff *skb;
3089 dma_addr_t dma_addr; 3094 dma_addr_t dma_addr;
3090 u16 vtag = 0; 3095 u16 vtag = 0;
@@ -3095,7 +3100,14 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3095 3100
3096 rx_buf = &rxr->rx_buf_ring[sw_ring_cons]; 3101 rx_buf = &rxr->rx_buf_ring[sw_ring_cons];
3097 skb = rx_buf->skb; 3102 skb = rx_buf->skb;
3103 prefetchw(skb);
3098 3104
3105 if (!get_dma_ops(&pdev->dev)->sync_single_for_cpu) {
3106 next_rx_buf =
3107 &rxr->rx_buf_ring[
3108 RX_RING_IDX(NEXT_RX_BD(sw_cons))];
3109 prefetch(next_rx_buf->desc);
3110 }
3099 rx_buf->skb = NULL; 3111 rx_buf->skb = NULL;
3100 3112
3101 dma_addr = dma_unmap_addr(rx_buf, mapping); 3113 dma_addr = dma_unmap_addr(rx_buf, mapping);
@@ -3104,7 +3116,7 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3104 BNX2_RX_OFFSET + BNX2_RX_COPY_THRESH, 3116 BNX2_RX_OFFSET + BNX2_RX_COPY_THRESH,
3105 PCI_DMA_FROMDEVICE); 3117 PCI_DMA_FROMDEVICE);
3106 3118
3107 rx_hdr = (struct l2_fhdr *) skb->data; 3119 rx_hdr = rx_buf->desc;
3108 len = rx_hdr->l2_fhdr_pkt_len; 3120 len = rx_hdr->l2_fhdr_pkt_len;
3109 status = rx_hdr->l2_fhdr_status; 3121 status = rx_hdr->l2_fhdr_status;
3110 3122
@@ -3205,10 +3217,10 @@ bnx2_rx_int(struct bnx2 *bp, struct bnx2_napi *bnapi, int budget)
3205 3217
3206#ifdef BCM_VLAN 3218#ifdef BCM_VLAN
3207 if (hw_vlan) 3219 if (hw_vlan)
3208 vlan_hwaccel_receive_skb(skb, bp->vlgrp, vtag); 3220 vlan_gro_receive(&bnapi->napi, bp->vlgrp, vtag, skb);
3209 else 3221 else
3210#endif 3222#endif
3211 netif_receive_skb(skb); 3223 napi_gro_receive(&bnapi->napi, skb);
3212 3224
3213 rx_pkt++; 3225 rx_pkt++;
3214 3226
@@ -4758,8 +4770,12 @@ bnx2_reset_chip(struct bnx2 *bp, u32 reset_code)
4758 rc = bnx2_alloc_bad_rbuf(bp); 4770 rc = bnx2_alloc_bad_rbuf(bp);
4759 } 4771 }
4760 4772
4761 if (bp->flags & BNX2_FLAG_USING_MSIX) 4773 if (bp->flags & BNX2_FLAG_USING_MSIX) {
4762 bnx2_setup_msix_tbl(bp); 4774 bnx2_setup_msix_tbl(bp);
4775 /* Prevent MSIX table reads and write from timing out */
4776 REG_WR(bp, BNX2_MISC_ECO_HW_CTL,
4777 BNX2_MISC_ECO_HW_CTL_LARGE_GRC_TMOUT_EN);
4778 }
4763 4779
4764 return rc; 4780 return rc;
4765} 4781}
@@ -5758,7 +5774,7 @@ bnx2_run_loopback(struct bnx2 *bp, int loopback_mode)
5758 rx_buf = &rxr->rx_buf_ring[rx_start_idx]; 5774 rx_buf = &rxr->rx_buf_ring[rx_start_idx];
5759 rx_skb = rx_buf->skb; 5775 rx_skb = rx_buf->skb;
5760 5776
5761 rx_hdr = (struct l2_fhdr *) rx_skb->data; 5777 rx_hdr = rx_buf->desc;
5762 skb_reserve(rx_skb, BNX2_RX_OFFSET); 5778 skb_reserve(rx_skb, BNX2_RX_OFFSET);
5763 5779
5764 pci_dma_sync_single_for_cpu(bp->pdev, 5780 pci_dma_sync_single_for_cpu(bp->pdev,
@@ -6272,12 +6288,12 @@ bnx2_reset_task(struct work_struct *work)
6272 return; 6288 return;
6273 } 6289 }
6274 6290
6275 bnx2_netif_stop(bp); 6291 bnx2_netif_stop(bp, true);
6276 6292
6277 bnx2_init_nic(bp, 1); 6293 bnx2_init_nic(bp, 1);
6278 6294
6279 atomic_set(&bp->intr_sem, 1); 6295 atomic_set(&bp->intr_sem, 1);
6280 bnx2_netif_start(bp); 6296 bnx2_netif_start(bp, true);
6281 rtnl_unlock(); 6297 rtnl_unlock();
6282} 6298}
6283 6299
@@ -6319,7 +6335,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
6319 struct bnx2 *bp = netdev_priv(dev); 6335 struct bnx2 *bp = netdev_priv(dev);
6320 6336
6321 if (netif_running(dev)) 6337 if (netif_running(dev))
6322 bnx2_netif_stop(bp); 6338 bnx2_netif_stop(bp, false);
6323 6339
6324 bp->vlgrp = vlgrp; 6340 bp->vlgrp = vlgrp;
6325 6341
@@ -6330,7 +6346,7 @@ bnx2_vlan_rx_register(struct net_device *dev, struct vlan_group *vlgrp)
6330 if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN) 6346 if (bp->flags & BNX2_FLAG_CAN_KEEP_VLAN)
6331 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1); 6347 bnx2_fw_sync(bp, BNX2_DRV_MSG_CODE_KEEP_VLAN_UPDATE, 0, 1);
6332 6348
6333 bnx2_netif_start(bp); 6349 bnx2_netif_start(bp, false);
6334} 6350}
6335#endif 6351#endif
6336 6352
@@ -7050,9 +7066,9 @@ bnx2_set_coalesce(struct net_device *dev, struct ethtool_coalesce *coal)
7050 bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS; 7066 bp->stats_ticks &= BNX2_HC_STATS_TICKS_HC_STAT_TICKS;
7051 7067
7052 if (netif_running(bp->dev)) { 7068 if (netif_running(bp->dev)) {
7053 bnx2_netif_stop(bp); 7069 bnx2_netif_stop(bp, true);
7054 bnx2_init_nic(bp, 0); 7070 bnx2_init_nic(bp, 0);
7055 bnx2_netif_start(bp); 7071 bnx2_netif_start(bp, true);
7056 } 7072 }
7057 7073
7058 return 0; 7074 return 0;
@@ -7082,7 +7098,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
7082 /* Reset will erase chipset stats; save them */ 7098 /* Reset will erase chipset stats; save them */
7083 bnx2_save_stats(bp); 7099 bnx2_save_stats(bp);
7084 7100
7085 bnx2_netif_stop(bp); 7101 bnx2_netif_stop(bp, true);
7086 bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET); 7102 bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_RESET);
7087 bnx2_free_skbs(bp); 7103 bnx2_free_skbs(bp);
7088 bnx2_free_mem(bp); 7104 bnx2_free_mem(bp);
@@ -7110,7 +7126,7 @@ bnx2_change_ring_size(struct bnx2 *bp, u32 rx, u32 tx)
7110 bnx2_setup_cnic_irq_info(bp); 7126 bnx2_setup_cnic_irq_info(bp);
7111 mutex_unlock(&bp->cnic_lock); 7127 mutex_unlock(&bp->cnic_lock);
7112#endif 7128#endif
7113 bnx2_netif_start(bp); 7129 bnx2_netif_start(bp, true);
7114 } 7130 }
7115 return 0; 7131 return 0;
7116} 7132}
@@ -7363,7 +7379,7 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf)
7363 if (etest->flags & ETH_TEST_FL_OFFLINE) { 7379 if (etest->flags & ETH_TEST_FL_OFFLINE) {
7364 int i; 7380 int i;
7365 7381
7366 bnx2_netif_stop(bp); 7382 bnx2_netif_stop(bp, true);
7367 bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_DIAG); 7383 bnx2_reset_chip(bp, BNX2_DRV_MSG_CODE_DIAG);
7368 bnx2_free_skbs(bp); 7384 bnx2_free_skbs(bp);
7369 7385
@@ -7382,7 +7398,7 @@ bnx2_self_test(struct net_device *dev, struct ethtool_test *etest, u64 *buf)
7382 bnx2_shutdown_chip(bp); 7398 bnx2_shutdown_chip(bp);
7383 else { 7399 else {
7384 bnx2_init_nic(bp, 1); 7400 bnx2_init_nic(bp, 1);
7385 bnx2_netif_start(bp); 7401 bnx2_netif_start(bp, true);
7386 } 7402 }
7387 7403
7388 /* wait for link up */ 7404 /* wait for link up */
@@ -8290,7 +8306,7 @@ bnx2_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
8290 memcpy(dev->dev_addr, bp->mac_addr, 6); 8306 memcpy(dev->dev_addr, bp->mac_addr, 6);
8291 memcpy(dev->perm_addr, bp->mac_addr, 6); 8307 memcpy(dev->perm_addr, bp->mac_addr, 6);
8292 8308
8293 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 8309 dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG | NETIF_F_GRO;
8294 vlan_features_add(dev, NETIF_F_IP_CSUM | NETIF_F_SG); 8310 vlan_features_add(dev, NETIF_F_IP_CSUM | NETIF_F_SG);
8295 if (CHIP_NUM(bp) == CHIP_NUM_5709) { 8311 if (CHIP_NUM(bp) == CHIP_NUM_5709) {
8296 dev->features |= NETIF_F_IPV6_CSUM; 8312 dev->features |= NETIF_F_IPV6_CSUM;
@@ -8376,7 +8392,7 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
8376 return 0; 8392 return 0;
8377 8393
8378 flush_scheduled_work(); 8394 flush_scheduled_work();
8379 bnx2_netif_stop(bp); 8395 bnx2_netif_stop(bp, true);
8380 netif_device_detach(dev); 8396 netif_device_detach(dev);
8381 del_timer_sync(&bp->timer); 8397 del_timer_sync(&bp->timer);
8382 bnx2_shutdown_chip(bp); 8398 bnx2_shutdown_chip(bp);
@@ -8398,7 +8414,7 @@ bnx2_resume(struct pci_dev *pdev)
8398 bnx2_set_power_state(bp, PCI_D0); 8414 bnx2_set_power_state(bp, PCI_D0);
8399 netif_device_attach(dev); 8415 netif_device_attach(dev);
8400 bnx2_init_nic(bp, 1); 8416 bnx2_init_nic(bp, 1);
8401 bnx2_netif_start(bp); 8417 bnx2_netif_start(bp, true);
8402 return 0; 8418 return 0;
8403} 8419}
8404 8420
@@ -8425,7 +8441,7 @@ static pci_ers_result_t bnx2_io_error_detected(struct pci_dev *pdev,
8425 } 8441 }
8426 8442
8427 if (netif_running(dev)) { 8443 if (netif_running(dev)) {
8428 bnx2_netif_stop(bp); 8444 bnx2_netif_stop(bp, true);
8429 del_timer_sync(&bp->timer); 8445 del_timer_sync(&bp->timer);
8430 bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_RESET); 8446 bnx2_reset_nic(bp, BNX2_DRV_MSG_CODE_RESET);
8431 } 8447 }
@@ -8482,7 +8498,7 @@ static void bnx2_io_resume(struct pci_dev *pdev)
8482 8498
8483 rtnl_lock(); 8499 rtnl_lock();
8484 if (netif_running(dev)) 8500 if (netif_running(dev))
8485 bnx2_netif_start(bp); 8501 bnx2_netif_start(bp, true);
8486 8502
8487 netif_device_attach(dev); 8503 netif_device_attach(dev);
8488 rtnl_unlock(); 8504 rtnl_unlock();