diff options
author | Hao Zheng <hzheng@nicira.com> | 2010-10-20 09:56:11 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-10-21 04:26:56 -0400 |
commit | 9bcc08939223c5a2bad42748ee53ab69f5338a32 (patch) | |
tree | 174e77181d9325bf39c738c02af98e5667cd9403 /drivers/net/bnx2x | |
parent | f62bbb5e62c6e4a91fb222d22bc46e8d4d7e59ef (diff) |
bnx2x: Update bnx2x to use new vlan accleration.
Make the bnx2x driver use the new vlan accleration model.
Signed-off-by: Hao Zheng <hzheng@nicira.com>
Signed-off-by: Jesse Gross <jesse@nicira.com>
CC: Eilon Greenstein <eilong@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/bnx2x')
-rw-r--r-- | drivers/net/bnx2x/bnx2x.h | 10 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_cmn.c | 60 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_ethtool.c | 33 | ||||
-rw-r--r-- | drivers/net/bnx2x/bnx2x_main.c | 8 |
4 files changed, 27 insertions, 84 deletions
diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h index 3bf236b160dd..9571ecf48f35 100644 --- a/drivers/net/bnx2x/bnx2x.h +++ b/drivers/net/bnx2x/bnx2x.h | |||
@@ -24,10 +24,6 @@ | |||
24 | #define DRV_MODULE_RELDATE "2010/10/19" | 24 | #define DRV_MODULE_RELDATE "2010/10/19" |
25 | #define BNX2X_BC_VER 0x040200 | 25 | #define BNX2X_BC_VER 0x040200 |
26 | 26 | ||
27 | #if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE) | ||
28 | #define BCM_VLAN 1 | ||
29 | #endif | ||
30 | |||
31 | #define BNX2X_MULTI_QUEUE | 27 | #define BNX2X_MULTI_QUEUE |
32 | 28 | ||
33 | #define BNX2X_NEW_NAPI | 29 | #define BNX2X_NEW_NAPI |
@@ -858,10 +854,6 @@ struct bnx2x { | |||
858 | 854 | ||
859 | int tx_ring_size; | 855 | int tx_ring_size; |
860 | 856 | ||
861 | #ifdef BCM_VLAN | ||
862 | struct vlan_group *vlgrp; | ||
863 | #endif | ||
864 | |||
865 | u32 rx_csum; | 857 | u32 rx_csum; |
866 | u32 rx_buf_size; | 858 | u32 rx_buf_size; |
867 | /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */ | 859 | /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */ |
@@ -925,8 +917,6 @@ struct bnx2x { | |||
925 | #define NO_MCP_FLAG 0x100 | 917 | #define NO_MCP_FLAG 0x100 |
926 | #define DISABLE_MSI_FLAG 0x200 | 918 | #define DISABLE_MSI_FLAG 0x200 |
927 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) | 919 | #define BP_NOMCP(bp) (bp->flags & NO_MCP_FLAG) |
928 | #define HW_VLAN_TX_FLAG 0x400 | ||
929 | #define HW_VLAN_RX_FLAG 0x800 | ||
930 | #define MF_FUNC_DIS 0x1000 | 920 | #define MF_FUNC_DIS 0x1000 |
931 | 921 | ||
932 | int pf_num; /* absolute PF number */ | 922 | int pf_num; /* absolute PF number */ |
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c index 6905b2e0609e..bc5837514074 100644 --- a/drivers/net/bnx2x/bnx2x_cmn.c +++ b/drivers/net/bnx2x/bnx2x_cmn.c | |||
@@ -16,16 +16,13 @@ | |||
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <linux/etherdevice.h> | 18 | #include <linux/etherdevice.h> |
19 | #include <linux/if_vlan.h> | ||
19 | #include <linux/ip.h> | 20 | #include <linux/ip.h> |
20 | #include <net/ipv6.h> | 21 | #include <net/ipv6.h> |
21 | #include <net/ip6_checksum.h> | 22 | #include <net/ip6_checksum.h> |
22 | #include <linux/firmware.h> | 23 | #include <linux/firmware.h> |
23 | #include "bnx2x_cmn.h" | 24 | #include "bnx2x_cmn.h" |
24 | 25 | ||
25 | #ifdef BCM_VLAN | ||
26 | #include <linux/if_vlan.h> | ||
27 | #endif | ||
28 | |||
29 | #include "bnx2x_init.h" | 26 | #include "bnx2x_init.h" |
30 | 27 | ||
31 | 28 | ||
@@ -346,13 +343,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
346 | if (likely(new_skb)) { | 343 | if (likely(new_skb)) { |
347 | /* fix ip xsum and give it to the stack */ | 344 | /* fix ip xsum and give it to the stack */ |
348 | /* (no need to map the new skb) */ | 345 | /* (no need to map the new skb) */ |
349 | #ifdef BCM_VLAN | ||
350 | int is_vlan_cqe = | ||
351 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | ||
352 | PARSING_FLAGS_VLAN); | ||
353 | int is_not_hwaccel_vlan_cqe = | ||
354 | (is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG))); | ||
355 | #endif | ||
356 | 346 | ||
357 | prefetch(skb); | 347 | prefetch(skb); |
358 | prefetch(((char *)(skb)) + L1_CACHE_BYTES); | 348 | prefetch(((char *)(skb)) + L1_CACHE_BYTES); |
@@ -377,28 +367,18 @@ static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp, | |||
377 | struct iphdr *iph; | 367 | struct iphdr *iph; |
378 | 368 | ||
379 | iph = (struct iphdr *)skb->data; | 369 | iph = (struct iphdr *)skb->data; |
380 | #ifdef BCM_VLAN | ||
381 | /* If there is no Rx VLAN offloading - | ||
382 | take VLAN tag into an account */ | ||
383 | if (unlikely(is_not_hwaccel_vlan_cqe)) | ||
384 | iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN); | ||
385 | #endif | ||
386 | iph->check = 0; | 370 | iph->check = 0; |
387 | iph->check = ip_fast_csum((u8 *)iph, iph->ihl); | 371 | iph->check = ip_fast_csum((u8 *)iph, iph->ihl); |
388 | } | 372 | } |
389 | 373 | ||
390 | if (!bnx2x_fill_frag_skb(bp, fp, skb, | 374 | if (!bnx2x_fill_frag_skb(bp, fp, skb, |
391 | &cqe->fast_path_cqe, cqe_idx)) { | 375 | &cqe->fast_path_cqe, cqe_idx)) { |
392 | #ifdef BCM_VLAN | 376 | if ((le16_to_cpu(cqe->fast_path_cqe. |
393 | if ((bp->vlgrp != NULL) && | 377 | pars_flags.flags) & PARSING_FLAGS_VLAN)) |
394 | (le16_to_cpu(cqe->fast_path_cqe. | 378 | __vlan_hwaccel_put_tag(skb, |
395 | pars_flags.flags) & PARSING_FLAGS_VLAN)) | ||
396 | vlan_gro_receive(&fp->napi, bp->vlgrp, | ||
397 | le16_to_cpu(cqe->fast_path_cqe. | 379 | le16_to_cpu(cqe->fast_path_cqe. |
398 | vlan_tag), skb); | 380 | vlan_tag)); |
399 | else | 381 | napi_gro_receive(&fp->napi, skb); |
400 | #endif | ||
401 | napi_gro_receive(&fp->napi, skb); | ||
402 | } else { | 382 | } else { |
403 | DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages" | 383 | DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages" |
404 | " - dropping packet!\n"); | 384 | " - dropping packet!\n"); |
@@ -633,15 +613,11 @@ reuse_rx: | |||
633 | 613 | ||
634 | skb_record_rx_queue(skb, fp->index); | 614 | skb_record_rx_queue(skb, fp->index); |
635 | 615 | ||
636 | #ifdef BCM_VLAN | 616 | if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & |
637 | if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) && | 617 | PARSING_FLAGS_VLAN) |
638 | (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) & | 618 | __vlan_hwaccel_put_tag(skb, |
639 | PARSING_FLAGS_VLAN)) | 619 | le16_to_cpu(cqe->fast_path_cqe.vlan_tag)); |
640 | vlan_gro_receive(&fp->napi, bp->vlgrp, | 620 | napi_gro_receive(&fp->napi, skb); |
641 | le16_to_cpu(cqe->fast_path_cqe.vlan_tag), skb); | ||
642 | else | ||
643 | #endif | ||
644 | napi_gro_receive(&fp->napi, skb); | ||
645 | 621 | ||
646 | 622 | ||
647 | next_rx: | 623 | next_rx: |
@@ -2025,14 +2001,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev) | |||
2025 | "sending pkt %u @%p next_idx %u bd %u @%p\n", | 2001 | "sending pkt %u @%p next_idx %u bd %u @%p\n", |
2026 | pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd); | 2002 | pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd); |
2027 | 2003 | ||
2028 | #ifdef BCM_VLAN | ||
2029 | if (vlan_tx_tag_present(skb)) { | 2004 | if (vlan_tx_tag_present(skb)) { |
2030 | tx_start_bd->vlan_or_ethertype = | 2005 | tx_start_bd->vlan_or_ethertype = |
2031 | cpu_to_le16(vlan_tx_tag_get(skb)); | 2006 | cpu_to_le16(vlan_tx_tag_get(skb)); |
2032 | tx_start_bd->bd_flags.as_bitfield |= | 2007 | tx_start_bd->bd_flags.as_bitfield |= |
2033 | (X_ETH_OUTBAND_VLAN << ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); | 2008 | (X_ETH_OUTBAND_VLAN << ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT); |
2034 | } else | 2009 | } else |
2035 | #endif | ||
2036 | tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod); | 2010 | tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod); |
2037 | 2011 | ||
2038 | /* turn on parsing and get a BD */ | 2012 | /* turn on parsing and get a BD */ |
@@ -2317,18 +2291,6 @@ void bnx2x_tx_timeout(struct net_device *dev) | |||
2317 | schedule_delayed_work(&bp->reset_task, 0); | 2291 | schedule_delayed_work(&bp->reset_task, 0); |
2318 | } | 2292 | } |
2319 | 2293 | ||
2320 | #ifdef BCM_VLAN | ||
2321 | /* called with rtnl_lock */ | ||
2322 | void bnx2x_vlan_rx_register(struct net_device *dev, | ||
2323 | struct vlan_group *vlgrp) | ||
2324 | { | ||
2325 | struct bnx2x *bp = netdev_priv(dev); | ||
2326 | |||
2327 | bp->vlgrp = vlgrp; | ||
2328 | } | ||
2329 | |||
2330 | #endif | ||
2331 | |||
2332 | int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state) | 2294 | int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state) |
2333 | { | 2295 | { |
2334 | struct net_device *dev = pci_get_drvdata(pdev); | 2296 | struct net_device *dev = pci_get_drvdata(pdev); |
diff --git a/drivers/net/bnx2x/bnx2x_ethtool.c b/drivers/net/bnx2x/bnx2x_ethtool.c index 54fe0615a8b9..daefef618ef7 100644 --- a/drivers/net/bnx2x/bnx2x_ethtool.c +++ b/drivers/net/bnx2x/bnx2x_ethtool.c | |||
@@ -1117,35 +1117,34 @@ static int bnx2x_set_flags(struct net_device *dev, u32 data) | |||
1117 | int changed = 0; | 1117 | int changed = 0; |
1118 | int rc = 0; | 1118 | int rc = 0; |
1119 | 1119 | ||
1120 | if (data & ~(ETH_FLAG_LRO | ETH_FLAG_RXHASH)) | ||
1121 | return -EINVAL; | ||
1122 | |||
1123 | if (bp->recovery_state != BNX2X_RECOVERY_DONE) { | 1120 | if (bp->recovery_state != BNX2X_RECOVERY_DONE) { |
1124 | printk(KERN_ERR "Handling parity error recovery. Try again later\n"); | 1121 | printk(KERN_ERR "Handling parity error recovery. Try again later\n"); |
1125 | return -EAGAIN; | 1122 | return -EAGAIN; |
1126 | } | 1123 | } |
1127 | 1124 | ||
1125 | if (!(data & ETH_FLAG_RXVLAN)) | ||
1126 | return -EOPNOTSUPP; | ||
1127 | |||
1128 | if ((data & ETH_FLAG_LRO) && bp->rx_csum && bp->disable_tpa) | ||
1129 | return -EINVAL; | ||
1130 | |||
1131 | rc = ethtool_op_set_flags(dev, data, ETH_FLAG_LRO | ETH_FLAG_RXVLAN | | ||
1132 | ETH_FLAG_TXVLAN | ETH_FLAG_RXHASH); | ||
1133 | if (rc) | ||
1134 | return rc; | ||
1135 | |||
1128 | /* TPA requires Rx CSUM offloading */ | 1136 | /* TPA requires Rx CSUM offloading */ |
1129 | if ((data & ETH_FLAG_LRO) && bp->rx_csum) { | 1137 | if ((data & ETH_FLAG_LRO) && bp->rx_csum) { |
1130 | if (!bp->disable_tpa) { | 1138 | if (!(bp->flags & TPA_ENABLE_FLAG)) { |
1131 | if (!(dev->features & NETIF_F_LRO)) { | 1139 | bp->flags |= TPA_ENABLE_FLAG; |
1132 | dev->features |= NETIF_F_LRO; | 1140 | changed = 1; |
1133 | bp->flags |= TPA_ENABLE_FLAG; | 1141 | } |
1134 | changed = 1; | 1142 | } else if (bp->flags & TPA_ENABLE_FLAG) { |
1135 | } | ||
1136 | } else | ||
1137 | rc = -EINVAL; | ||
1138 | } else if (dev->features & NETIF_F_LRO) { | ||
1139 | dev->features &= ~NETIF_F_LRO; | 1143 | dev->features &= ~NETIF_F_LRO; |
1140 | bp->flags &= ~TPA_ENABLE_FLAG; | 1144 | bp->flags &= ~TPA_ENABLE_FLAG; |
1141 | changed = 1; | 1145 | changed = 1; |
1142 | } | 1146 | } |
1143 | 1147 | ||
1144 | if (data & ETH_FLAG_RXHASH) | ||
1145 | dev->features |= NETIF_F_RXHASH; | ||
1146 | else | ||
1147 | dev->features &= ~NETIF_F_RXHASH; | ||
1148 | |||
1149 | if (changed && netif_running(dev)) { | 1148 | if (changed && netif_running(dev)) { |
1150 | bnx2x_nic_unload(bp, UNLOAD_NORMAL); | 1149 | bnx2x_nic_unload(bp, UNLOAD_NORMAL); |
1151 | rc = bnx2x_nic_load(bp, LOAD_NORMAL); | 1150 | rc = bnx2x_nic_load(bp, LOAD_NORMAL); |
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c index f22e283cabef..ff99a2fc0426 100644 --- a/drivers/net/bnx2x/bnx2x_main.c +++ b/drivers/net/bnx2x/bnx2x_main.c | |||
@@ -2371,10 +2371,8 @@ static inline u16 bnx2x_get_cl_flags(struct bnx2x *bp, | |||
2371 | flags |= QUEUE_FLG_HC; | 2371 | flags |= QUEUE_FLG_HC; |
2372 | flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0; | 2372 | flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0; |
2373 | 2373 | ||
2374 | #ifdef BCM_VLAN | ||
2375 | flags |= QUEUE_FLG_VLAN; | 2374 | flags |= QUEUE_FLG_VLAN; |
2376 | DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); | 2375 | DP(NETIF_MSG_IFUP, "vlan removal enabled\n"); |
2377 | #endif | ||
2378 | 2376 | ||
2379 | if (!fp->disable_tpa) | 2377 | if (!fp->disable_tpa) |
2380 | flags |= QUEUE_FLG_TPA; | 2378 | flags |= QUEUE_FLG_TPA; |
@@ -8630,9 +8628,6 @@ static const struct net_device_ops bnx2x_netdev_ops = { | |||
8630 | .ndo_do_ioctl = bnx2x_ioctl, | 8628 | .ndo_do_ioctl = bnx2x_ioctl, |
8631 | .ndo_change_mtu = bnx2x_change_mtu, | 8629 | .ndo_change_mtu = bnx2x_change_mtu, |
8632 | .ndo_tx_timeout = bnx2x_tx_timeout, | 8630 | .ndo_tx_timeout = bnx2x_tx_timeout, |
8633 | #ifdef BCM_VLAN | ||
8634 | .ndo_vlan_rx_register = bnx2x_vlan_rx_register, | ||
8635 | #endif | ||
8636 | #ifdef CONFIG_NET_POLL_CONTROLLER | 8631 | #ifdef CONFIG_NET_POLL_CONTROLLER |
8637 | .ndo_poll_controller = poll_bnx2x, | 8632 | .ndo_poll_controller = poll_bnx2x, |
8638 | #endif | 8633 | #endif |
@@ -8764,9 +8759,7 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
8764 | dev->features |= NETIF_F_HIGHDMA; | 8759 | dev->features |= NETIF_F_HIGHDMA; |
8765 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); | 8760 | dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); |
8766 | dev->features |= NETIF_F_TSO6; | 8761 | dev->features |= NETIF_F_TSO6; |
8767 | #ifdef BCM_VLAN | ||
8768 | dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); | 8762 | dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX); |
8769 | bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG); | ||
8770 | 8763 | ||
8771 | dev->vlan_features |= NETIF_F_SG; | 8764 | dev->vlan_features |= NETIF_F_SG; |
8772 | dev->vlan_features |= NETIF_F_HW_CSUM; | 8765 | dev->vlan_features |= NETIF_F_HW_CSUM; |
@@ -8774,7 +8767,6 @@ static int __devinit bnx2x_init_dev(struct pci_dev *pdev, | |||
8774 | dev->vlan_features |= NETIF_F_HIGHDMA; | 8767 | dev->vlan_features |= NETIF_F_HIGHDMA; |
8775 | dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); | 8768 | dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN); |
8776 | dev->vlan_features |= NETIF_F_TSO6; | 8769 | dev->vlan_features |= NETIF_F_TSO6; |
8777 | #endif | ||
8778 | 8770 | ||
8779 | /* get_port_hwinfo() will set prtad and mmds properly */ | 8771 | /* get_port_hwinfo() will set prtad and mmds properly */ |
8780 | bp->mdio.prtad = MDIO_PRTAD_NONE; | 8772 | bp->mdio.prtad = MDIO_PRTAD_NONE; |