diff mbox

[v2,11/14] bnx2x: Update bnx2x to use new vlan accleration.

Message ID 1287618974-4714-12-git-send-email-jesse@nicira.com
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

Jesse Gross Oct. 20, 2010, 11:56 p.m. UTC
From: Hao Zheng <hzheng@nicira.com>

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>
---
 drivers/net/bnx2x/bnx2x.h         |   10 ------
 drivers/net/bnx2x/bnx2x_cmn.c     |   60 +++++++------------------------------
 drivers/net/bnx2x/bnx2x_ethtool.c |   33 ++++++++++----------
 drivers/net/bnx2x/bnx2x_main.c    |    8 -----
 4 files changed, 27 insertions(+), 84 deletions(-)

Comments

Vladislav Zolotarov Oct. 21, 2010, 1:54 p.m. UTC | #1
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Jesse Gross
> Sent: Thursday, October 21, 2010 1:56 AM
> To: David Miller
> Cc: netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> Subject: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> accleration.
> 
> From: Hao Zheng <hzheng@nicira.com>
> 
> 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>
> ---
>  drivers/net/bnx2x/bnx2x.h         |   10 ------
>  drivers/net/bnx2x/bnx2x_cmn.c     |   60 +++++++----------------------
> --------
>  drivers/net/bnx2x/bnx2x_ethtool.c |   33 ++++++++++----------
>  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 3bf236b..9571ecf 100644
> --- a/drivers/net/bnx2x/bnx2x.h
> +++ b/drivers/net/bnx2x/bnx2x.h
> @@ -24,10 +24,6 @@
>  #define DRV_MODULE_RELDATE      "2010/10/19"
>  #define BNX2X_BC_VER            0x040200
> 
> -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
> -#define BCM_VLAN			1
> -#endif
> -
>  #define BNX2X_MULTI_QUEUE
> 
>  #define BNX2X_NEW_NAPI
> @@ -858,10 +854,6 @@ struct bnx2x {
> 
>  	int			tx_ring_size;
> 
> -#ifdef BCM_VLAN
> -	struct vlan_group	*vlgrp;
> -#endif
> -
>  	u32			rx_csum;
>  	u32			rx_buf_size;
>  /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */
> @@ -925,8 +917,6 @@ struct bnx2x {
>  #define NO_MCP_FLAG			0x100
>  #define DISABLE_MSI_FLAG		0x200
>  #define BP_NOMCP(bp)			(bp->flags & NO_MCP_FLAG)
> -#define HW_VLAN_TX_FLAG			0x400
> -#define HW_VLAN_RX_FLAG			0x800
>  #define MF_FUNC_DIS			0x1000
> 
>  	int			pf_num;	/* absolute PF number */
> diff --git a/drivers/net/bnx2x/bnx2x_cmn.c
> b/drivers/net/bnx2x/bnx2x_cmn.c
> index 6905b2e..bc58375 100644
> --- a/drivers/net/bnx2x/bnx2x_cmn.c
> +++ b/drivers/net/bnx2x/bnx2x_cmn.c
> @@ -16,16 +16,13 @@
>   */
> 
>  #include <linux/etherdevice.h>
> +#include <linux/if_vlan.h>
>  #include <linux/ip.h>
>  #include <net/ipv6.h>
>  #include <net/ip6_checksum.h>
>  #include <linux/firmware.h>
>  #include "bnx2x_cmn.h"
> 
> -#ifdef BCM_VLAN
> -#include <linux/if_vlan.h>
> -#endif
> -
>  #include "bnx2x_init.h"
> 
> 
> @@ -346,13 +343,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp,
> struct bnx2x_fastpath *fp,
>  	if (likely(new_skb)) {
>  		/* fix ip xsum and give it to the stack */
>  		/* (no need to map the new skb) */
> -#ifdef BCM_VLAN
> -		int is_vlan_cqe =
> -			(le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> -			 PARSING_FLAGS_VLAN);
> -		int is_not_hwaccel_vlan_cqe =
> -			(is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG)));
> -#endif
> 
>  		prefetch(skb);
>  		prefetch(((char *)(skb)) + L1_CACHE_BYTES);
> @@ -377,28 +367,18 @@ static void bnx2x_tpa_stop(struct bnx2x *bp,
> struct bnx2x_fastpath *fp,
>  			struct iphdr *iph;
> 
>  			iph = (struct iphdr *)skb->data;
> -#ifdef BCM_VLAN
> -			/* If there is no Rx VLAN offloading -
> -			   take VLAN tag into an account */
> -			if (unlikely(is_not_hwaccel_vlan_cqe))
> -				iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN);
> -#endif
>  			iph->check = 0;
>  			iph->check = ip_fast_csum((u8 *)iph, iph->ihl);
>  		}
> 
>  		if (!bnx2x_fill_frag_skb(bp, fp, skb,
>  					 &cqe->fast_path_cqe, cqe_idx)) {
> -#ifdef BCM_VLAN
> -			if ((bp->vlgrp != NULL) &&
> -				(le16_to_cpu(cqe->fast_path_cqe.
> -				pars_flags.flags) & PARSING_FLAGS_VLAN))
> -				vlan_gro_receive(&fp->napi, bp->vlgrp,
> +			if ((le16_to_cpu(cqe->fast_path_cqe.
> +			    pars_flags.flags) & PARSING_FLAGS_VLAN))
> +				__vlan_hwaccel_put_tag(skb,
>  						 le16_to_cpu(cqe->fast_path_cqe.
> -							     vlan_tag), skb);
> -			else
> -#endif
> -				napi_gro_receive(&fp->napi, skb);
> +							     vlan_tag));
> +			napi_gro_receive(&fp->napi, skb);
>  		} else {
>  			DP(NETIF_MSG_RX_STATUS, "Failed to allocate new
> pages"
>  			   " - dropping packet!\n");
> @@ -633,15 +613,11 @@ reuse_rx:
> 
>  		skb_record_rx_queue(skb, fp->index);
> 
> -#ifdef BCM_VLAN
> -		if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
> -		    (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> -		     PARSING_FLAGS_VLAN))
> -			vlan_gro_receive(&fp->napi, bp->vlgrp,
> -				le16_to_cpu(cqe->fast_path_cqe.vlan_tag), skb);
> -		else
> -#endif
> -			napi_gro_receive(&fp->napi, skb);
> +		if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> +		     PARSING_FLAGS_VLAN)
> +			__vlan_hwaccel_put_tag(skb,
> +				le16_to_cpu(cqe->fast_path_cqe.vlan_tag));
> +		napi_gro_receive(&fp->napi, skb);
> 
> 
>  next_rx:
> @@ -2025,14 +2001,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff
> *skb, struct net_device *dev)
>  	   "sending pkt %u @%p  next_idx %u  bd %u @%p\n",
>  	   pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd);
> 
> -#ifdef BCM_VLAN
>  	if (vlan_tx_tag_present(skb)) {
>  		tx_start_bd->vlan_or_ethertype =
>  		    cpu_to_le16(vlan_tx_tag_get(skb));
>  		tx_start_bd->bd_flags.as_bitfield |=
>  		    (X_ETH_OUTBAND_VLAN <<
> ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
>  	} else
> -#endif
>  		tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
> 
>  	/* turn on parsing and get a BD */
> @@ -2317,18 +2291,6 @@ void bnx2x_tx_timeout(struct net_device *dev)
>  	schedule_delayed_work(&bp->reset_task, 0);
>  }
> 
> -#ifdef BCM_VLAN
> -/* called with rtnl_lock */
> -void bnx2x_vlan_rx_register(struct net_device *dev,
> -				   struct vlan_group *vlgrp)
> -{
> -	struct bnx2x *bp = netdev_priv(dev);
> -
> -	bp->vlgrp = vlgrp;
> -}
> -
> -#endif
> -
>  int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
>  {
>  	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 54fe061..daefef6 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)
>  	int changed = 0;
>  	int rc = 0;
> 
> -	if (data & ~(ETH_FLAG_LRO | ETH_FLAG_RXHASH))
> -		return -EINVAL;
> -
>  	if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
>  		printk(KERN_ERR "Handling parity error recovery. Try again
> later\n");
>  		return -EAGAIN;
>  	}
> 
> +	if (!(data & ETH_FLAG_RXVLAN))
> +		return -EOPNOTSUPP;
> +
> +	if ((data & ETH_FLAG_LRO) && bp->rx_csum && bp->disable_tpa)
> +		return -EINVAL;
> +
> +	rc = ethtool_op_set_flags(dev, data, ETH_FLAG_LRO |
> ETH_FLAG_RXVLAN |
> +					ETH_FLAG_TXVLAN | ETH_FLAG_RXHASH);
> +	if (rc)
> +		return rc;
> +
>  	/* TPA requires Rx CSUM offloading */
>  	if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
> -		if (!bp->disable_tpa) {
> -			if (!(dev->features & NETIF_F_LRO)) {
> -				dev->features |= NETIF_F_LRO;
> -				bp->flags |= TPA_ENABLE_FLAG;
> -				changed = 1;
> -			}
> -		} else
> -			rc = -EINVAL;
> -	} else if (dev->features & NETIF_F_LRO) {
> +		if (!(bp->flags & TPA_ENABLE_FLAG)) {
> +			bp->flags |= TPA_ENABLE_FLAG;
> +			changed = 1;
> +		}
> +	} else if (bp->flags & TPA_ENABLE_FLAG) {
>  		dev->features &= ~NETIF_F_LRO;
>  		bp->flags &= ~TPA_ENABLE_FLAG;
>  		changed = 1;
>  	}
> 
> -	if (data & ETH_FLAG_RXHASH)
> -		dev->features |= NETIF_F_RXHASH;
> -	else
> -		dev->features &= ~NETIF_F_RXHASH;
> -
>  	if (changed && netif_running(dev)) {
>  		bnx2x_nic_unload(bp, UNLOAD_NORMAL);
>  		rc = bnx2x_nic_load(bp, LOAD_NORMAL);
> diff --git a/drivers/net/bnx2x/bnx2x_main.c
> b/drivers/net/bnx2x/bnx2x_main.c
> index f22e283..ff99a2f 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,
>  	flags |= QUEUE_FLG_HC;
>  	flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0;
> 
> -#ifdef BCM_VLAN
>  	flags |= QUEUE_FLG_VLAN;
>  	DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
> -#endif
> 
>  	if (!fp->disable_tpa)
>  		flags |= QUEUE_FLG_TPA;
> @@ -8630,9 +8628,6 @@ static const struct net_device_ops
> bnx2x_netdev_ops = {
>  	.ndo_do_ioctl		= bnx2x_ioctl,
>  	.ndo_change_mtu		= bnx2x_change_mtu,
>  	.ndo_tx_timeout		= bnx2x_tx_timeout,
> -#ifdef BCM_VLAN
> -	.ndo_vlan_rx_register	= bnx2x_vlan_rx_register,
> -#endif
>  #ifdef CONFIG_NET_POLL_CONTROLLER
>  	.ndo_poll_controller	= poll_bnx2x,
>  #endif
> @@ -8764,9 +8759,7 @@ static int __devinit bnx2x_init_dev(struct
> pci_dev *pdev,
>  		dev->features |= NETIF_F_HIGHDMA;
>  	dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
>  	dev->features |= NETIF_F_TSO6;
> -#ifdef BCM_VLAN
>  	dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
> -	bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
> 
>  	dev->vlan_features |= NETIF_F_SG;
>  	dev->vlan_features |= NETIF_F_HW_CSUM;
> @@ -8774,7 +8767,6 @@ static int __devinit bnx2x_init_dev(struct
> pci_dev *pdev,
>  		dev->vlan_features |= NETIF_F_HIGHDMA;
>  	dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
>  	dev->vlan_features |= NETIF_F_TSO6;
> -#endif
> 
>  	/* get_port_hwinfo() will set prtad and mmds properly */
>  	bp->mdio.prtad = MDIO_PRTAD_NONE;
> --
> 1.7.1

Guys, when I compiled the kernel with these patches without VLAN 
support (CONFIG_VLAN_8021Q is not set) and tried to send VLAN tagged 
frames from the remote side to the bnx2x interface the kernel panicked. 

The stack trace got cut with the __netif_receive_skb() on top by the 
IPKVM and I'll have to connect a serial to get it all. But until I
did that maybe somebody will have any ideas anyway...

It happens regardless there is HW RX VLAN stripping enabled or not.

Thanks,
vlad

> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Zolotarov Oct. 21, 2010, 2:02 p.m. UTC | #2
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Vladislav Zolotarov
> Sent: Thursday, October 21, 2010 3:55 PM
> To: Jesse Gross; David Miller
> Cc: netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> Subject: RE: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> accleration.
> 
> 
> 
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > owner@vger.kernel.org] On Behalf Of Jesse Gross
> > Sent: Thursday, October 21, 2010 1:56 AM
> > To: David Miller
> > Cc: netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> > Subject: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> > accleration.
> >
> > From: Hao Zheng <hzheng@nicira.com>
> >
> > 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>
> > ---
> >  drivers/net/bnx2x/bnx2x.h         |   10 ------
> >  drivers/net/bnx2x/bnx2x_cmn.c     |   60 +++++++--------------------
> --
> > --------
> >  drivers/net/bnx2x/bnx2x_ethtool.c |   33 ++++++++++----------
> >  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 3bf236b..9571ecf 100644
> > --- a/drivers/net/bnx2x/bnx2x.h
> > +++ b/drivers/net/bnx2x/bnx2x.h
> > @@ -24,10 +24,6 @@
> >  #define DRV_MODULE_RELDATE      "2010/10/19"
> >  #define BNX2X_BC_VER            0x040200
> >
> > -#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
> > -#define BCM_VLAN			1
> > -#endif
> > -
> >  #define BNX2X_MULTI_QUEUE
> >
> >  #define BNX2X_NEW_NAPI
> > @@ -858,10 +854,6 @@ struct bnx2x {
> >
> >  	int			tx_ring_size;
> >
> > -#ifdef BCM_VLAN
> > -	struct vlan_group	*vlgrp;
> > -#endif
> > -
> >  	u32			rx_csum;
> >  	u32			rx_buf_size;
> >  /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */
> > @@ -925,8 +917,6 @@ struct bnx2x {
> >  #define NO_MCP_FLAG			0x100
> >  #define DISABLE_MSI_FLAG		0x200
> >  #define BP_NOMCP(bp)			(bp->flags & NO_MCP_FLAG)
> > -#define HW_VLAN_TX_FLAG			0x400
> > -#define HW_VLAN_RX_FLAG			0x800
> >  #define MF_FUNC_DIS			0x1000
> >
> >  	int			pf_num;	/* absolute PF number */
> > diff --git a/drivers/net/bnx2x/bnx2x_cmn.c
> > b/drivers/net/bnx2x/bnx2x_cmn.c
> > index 6905b2e..bc58375 100644
> > --- a/drivers/net/bnx2x/bnx2x_cmn.c
> > +++ b/drivers/net/bnx2x/bnx2x_cmn.c
> > @@ -16,16 +16,13 @@
> >   */
> >
> >  #include <linux/etherdevice.h>
> > +#include <linux/if_vlan.h>
> >  #include <linux/ip.h>
> >  #include <net/ipv6.h>
> >  #include <net/ip6_checksum.h>
> >  #include <linux/firmware.h>
> >  #include "bnx2x_cmn.h"
> >
> > -#ifdef BCM_VLAN
> > -#include <linux/if_vlan.h>
> > -#endif
> > -
> >  #include "bnx2x_init.h"
> >
> >
> > @@ -346,13 +343,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp,
> > struct bnx2x_fastpath *fp,
> >  	if (likely(new_skb)) {
> >  		/* fix ip xsum and give it to the stack */
> >  		/* (no need to map the new skb) */
> > -#ifdef BCM_VLAN
> > -		int is_vlan_cqe =
> > -			(le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> > -			 PARSING_FLAGS_VLAN);
> > -		int is_not_hwaccel_vlan_cqe =
> > -			(is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG)));
> > -#endif
> >
> >  		prefetch(skb);
> >  		prefetch(((char *)(skb)) + L1_CACHE_BYTES);
> > @@ -377,28 +367,18 @@ static void bnx2x_tpa_stop(struct bnx2x *bp,
> > struct bnx2x_fastpath *fp,
> >  			struct iphdr *iph;
> >
> >  			iph = (struct iphdr *)skb->data;
> > -#ifdef BCM_VLAN
> > -			/* If there is no Rx VLAN offloading -
> > -			   take VLAN tag into an account */
> > -			if (unlikely(is_not_hwaccel_vlan_cqe))
> > -				iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN);
> > -#endif
> >  			iph->check = 0;
> >  			iph->check = ip_fast_csum((u8 *)iph, iph->ihl);
> >  		}
> >
> >  		if (!bnx2x_fill_frag_skb(bp, fp, skb,
> >  					 &cqe->fast_path_cqe, cqe_idx)) {
> > -#ifdef BCM_VLAN
> > -			if ((bp->vlgrp != NULL) &&
> > -				(le16_to_cpu(cqe->fast_path_cqe.
> > -				pars_flags.flags) & PARSING_FLAGS_VLAN))
> > -				vlan_gro_receive(&fp->napi, bp->vlgrp,
> > +			if ((le16_to_cpu(cqe->fast_path_cqe.
> > +			    pars_flags.flags) & PARSING_FLAGS_VLAN))
> > +				__vlan_hwaccel_put_tag(skb,
> >  						 le16_to_cpu(cqe->fast_path_cqe.
> > -							     vlan_tag), skb);
> > -			else
> > -#endif
> > -				napi_gro_receive(&fp->napi, skb);
> > +							     vlan_tag));
> > +			napi_gro_receive(&fp->napi, skb);
> >  		} else {
> >  			DP(NETIF_MSG_RX_STATUS, "Failed to allocate new
> > pages"
> >  			   " - dropping packet!\n");
> > @@ -633,15 +613,11 @@ reuse_rx:
> >
> >  		skb_record_rx_queue(skb, fp->index);
> >
> > -#ifdef BCM_VLAN
> > -		if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
> > -		    (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> > -		     PARSING_FLAGS_VLAN))
> > -			vlan_gro_receive(&fp->napi, bp->vlgrp,
> > -				le16_to_cpu(cqe->fast_path_cqe.vlan_tag), skb);
> > -		else
> > -#endif
> > -			napi_gro_receive(&fp->napi, skb);
> > +		if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> > +		     PARSING_FLAGS_VLAN)
> > +			__vlan_hwaccel_put_tag(skb,
> > +				le16_to_cpu(cqe->fast_path_cqe.vlan_tag));
> > +		napi_gro_receive(&fp->napi, skb);
> >
> >
> >  next_rx:
> > @@ -2025,14 +2001,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff
> > *skb, struct net_device *dev)
> >  	   "sending pkt %u @%p  next_idx %u  bd %u @%p\n",
> >  	   pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd);
> >
> > -#ifdef BCM_VLAN
> >  	if (vlan_tx_tag_present(skb)) {
> >  		tx_start_bd->vlan_or_ethertype =
> >  		    cpu_to_le16(vlan_tx_tag_get(skb));
> >  		tx_start_bd->bd_flags.as_bitfield |=
> >  		    (X_ETH_OUTBAND_VLAN <<
> > ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
> >  	} else
> > -#endif
> >  		tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
> >
> >  	/* turn on parsing and get a BD */
> > @@ -2317,18 +2291,6 @@ void bnx2x_tx_timeout(struct net_device *dev)
> >  	schedule_delayed_work(&bp->reset_task, 0);
> >  }
> >
> > -#ifdef BCM_VLAN
> > -/* called with rtnl_lock */
> > -void bnx2x_vlan_rx_register(struct net_device *dev,
> > -				   struct vlan_group *vlgrp)
> > -{
> > -	struct bnx2x *bp = netdev_priv(dev);
> > -
> > -	bp->vlgrp = vlgrp;
> > -}
> > -
> > -#endif
> > -
> >  int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
> >  {
> >  	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 54fe061..daefef6 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)
> >  	int changed = 0;
> >  	int rc = 0;
> >
> > -	if (data & ~(ETH_FLAG_LRO | ETH_FLAG_RXHASH))
> > -		return -EINVAL;
> > -
> >  	if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
> >  		printk(KERN_ERR "Handling parity error recovery. Try again
> > later\n");
> >  		return -EAGAIN;
> >  	}
> >
> > +	if (!(data & ETH_FLAG_RXVLAN))
> > +		return -EOPNOTSUPP;
> > +
> > +	if ((data & ETH_FLAG_LRO) && bp->rx_csum && bp->disable_tpa)
> > +		return -EINVAL;
> > +
> > +	rc = ethtool_op_set_flags(dev, data, ETH_FLAG_LRO |
> > ETH_FLAG_RXVLAN |
> > +					ETH_FLAG_TXVLAN | ETH_FLAG_RXHASH);
> > +	if (rc)
> > +		return rc;
> > +
> >  	/* TPA requires Rx CSUM offloading */
> >  	if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
> > -		if (!bp->disable_tpa) {
> > -			if (!(dev->features & NETIF_F_LRO)) {
> > -				dev->features |= NETIF_F_LRO;
> > -				bp->flags |= TPA_ENABLE_FLAG;
> > -				changed = 1;
> > -			}
> > -		} else
> > -			rc = -EINVAL;
> > -	} else if (dev->features & NETIF_F_LRO) {
> > +		if (!(bp->flags & TPA_ENABLE_FLAG)) {
> > +			bp->flags |= TPA_ENABLE_FLAG;
> > +			changed = 1;
> > +		}
> > +	} else if (bp->flags & TPA_ENABLE_FLAG) {
> >  		dev->features &= ~NETIF_F_LRO;
> >  		bp->flags &= ~TPA_ENABLE_FLAG;
> >  		changed = 1;
> >  	}
> >
> > -	if (data & ETH_FLAG_RXHASH)
> > -		dev->features |= NETIF_F_RXHASH;
> > -	else
> > -		dev->features &= ~NETIF_F_RXHASH;
> > -
> >  	if (changed && netif_running(dev)) {
> >  		bnx2x_nic_unload(bp, UNLOAD_NORMAL);
> >  		rc = bnx2x_nic_load(bp, LOAD_NORMAL);
> > diff --git a/drivers/net/bnx2x/bnx2x_main.c
> > b/drivers/net/bnx2x/bnx2x_main.c
> > index f22e283..ff99a2f 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,
> >  	flags |= QUEUE_FLG_HC;
> >  	flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0;
> >
> > -#ifdef BCM_VLAN
> >  	flags |= QUEUE_FLG_VLAN;
> >  	DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
> > -#endif
> >
> >  	if (!fp->disable_tpa)
> >  		flags |= QUEUE_FLG_TPA;
> > @@ -8630,9 +8628,6 @@ static const struct net_device_ops
> > bnx2x_netdev_ops = {
> >  	.ndo_do_ioctl		= bnx2x_ioctl,
> >  	.ndo_change_mtu		= bnx2x_change_mtu,
> >  	.ndo_tx_timeout		= bnx2x_tx_timeout,
> > -#ifdef BCM_VLAN
> > -	.ndo_vlan_rx_register	= bnx2x_vlan_rx_register,
> > -#endif
> >  #ifdef CONFIG_NET_POLL_CONTROLLER
> >  	.ndo_poll_controller	= poll_bnx2x,
> >  #endif
> > @@ -8764,9 +8759,7 @@ static int __devinit bnx2x_init_dev(struct
> > pci_dev *pdev,
> >  		dev->features |= NETIF_F_HIGHDMA;
> >  	dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
> >  	dev->features |= NETIF_F_TSO6;
> > -#ifdef BCM_VLAN
> >  	dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
> > -	bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
> >
> >  	dev->vlan_features |= NETIF_F_SG;
> >  	dev->vlan_features |= NETIF_F_HW_CSUM;
> > @@ -8774,7 +8767,6 @@ static int __devinit bnx2x_init_dev(struct
> > pci_dev *pdev,
> >  		dev->vlan_features |= NETIF_F_HIGHDMA;
> >  	dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
> >  	dev->vlan_features |= NETIF_F_TSO6;
> > -#endif
> >
> >  	/* get_port_hwinfo() will set prtad and mmds properly */
> >  	bp->mdio.prtad = MDIO_PRTAD_NONE;
> > --
> > 1.7.1
> 
> Guys, when I compiled the kernel with these patches without VLAN
> support (CONFIG_VLAN_8021Q is not set) and tried to send VLAN tagged
> frames from the remote side to the bnx2x interface the kernel panicked.
> 
> The stack trace got cut with the __netif_receive_skb() on top by the
> IPKVM and I'll have to connect a serial to get it all. But until I
> did that maybe somebody will have any ideas anyway...
> 
> It happens regardless there is HW RX VLAN stripping enabled or not.

When RX VLAN stripping is enabled we hit the BUG() in the 
vlan_hwaccel_do_receive().





> 
> Thanks,
> vlad
> 
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Zolotarov Oct. 21, 2010, 2:50 p.m. UTC | #3
> -----Original Message-----
> From: Vladislav Zolotarov
> Sent: Thursday, October 21, 2010 4:03 PM
> To: Vladislav Zolotarov; Jesse Gross; David Miller
> Cc: netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> Subject: RE: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> accleration.
> 
> 
> 
> > -----Original Message-----
> > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > owner@vger.kernel.org] On Behalf Of Vladislav Zolotarov
> > Sent: Thursday, October 21, 2010 3:55 PM
> > To: Jesse Gross; David Miller
> > Cc: netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> > Subject: RE: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> > accleration.
> >
> >
> >
> > > -----Original Message-----
> > > From: netdev-owner@vger.kernel.org [mailto:netdev-
> > > owner@vger.kernel.org] On Behalf Of Jesse Gross
> > > Sent: Thursday, October 21, 2010 1:56 AM
> > > To: David Miller
> > > Cc: netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> > > Subject: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> > > accleration.
> > >
> > > From: Hao Zheng <hzheng@nicira.com>
> > >
> > > 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>
> > > ---
> > >  drivers/net/bnx2x/bnx2x.h         |   10 ------
> > >  drivers/net/bnx2x/bnx2x_cmn.c     |   60 +++++++------------------
> --
> > --
> > > --------
> > >  drivers/net/bnx2x/bnx2x_ethtool.c |   33 ++++++++++----------
> > >  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 3bf236b..9571ecf 100644
> > > --- a/drivers/net/bnx2x/bnx2x.h
> > > +++ b/drivers/net/bnx2x/bnx2x.h
> > > @@ -24,10 +24,6 @@
> > >  #define DRV_MODULE_RELDATE      "2010/10/19"
> > >  #define BNX2X_BC_VER            0x040200
> > >
> > > -#if defined(CONFIG_VLAN_8021Q) ||
> defined(CONFIG_VLAN_8021Q_MODULE)
> > > -#define BCM_VLAN			1
> > > -#endif
> > > -
> > >  #define BNX2X_MULTI_QUEUE
> > >
> > >  #define BNX2X_NEW_NAPI
> > > @@ -858,10 +854,6 @@ struct bnx2x {
> > >
> > >  	int			tx_ring_size;
> > >
> > > -#ifdef BCM_VLAN
> > > -	struct vlan_group	*vlgrp;
> > > -#endif
> > > -
> > >  	u32			rx_csum;
> > >  	u32			rx_buf_size;
> > >  /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */
> > > @@ -925,8 +917,6 @@ struct bnx2x {
> > >  #define NO_MCP_FLAG			0x100
> > >  #define DISABLE_MSI_FLAG		0x200
> > >  #define BP_NOMCP(bp)			(bp->flags & NO_MCP_FLAG)
> > > -#define HW_VLAN_TX_FLAG			0x400
> > > -#define HW_VLAN_RX_FLAG			0x800
> > >  #define MF_FUNC_DIS			0x1000
> > >
> > >  	int			pf_num;	/* absolute PF number */
> > > diff --git a/drivers/net/bnx2x/bnx2x_cmn.c
> > > b/drivers/net/bnx2x/bnx2x_cmn.c
> > > index 6905b2e..bc58375 100644
> > > --- a/drivers/net/bnx2x/bnx2x_cmn.c
> > > +++ b/drivers/net/bnx2x/bnx2x_cmn.c
> > > @@ -16,16 +16,13 @@
> > >   */
> > >
> > >  #include <linux/etherdevice.h>
> > > +#include <linux/if_vlan.h>
> > >  #include <linux/ip.h>
> > >  #include <net/ipv6.h>
> > >  #include <net/ip6_checksum.h>
> > >  #include <linux/firmware.h>
> > >  #include "bnx2x_cmn.h"
> > >
> > > -#ifdef BCM_VLAN
> > > -#include <linux/if_vlan.h>
> > > -#endif
> > > -
> > >  #include "bnx2x_init.h"
> > >
> > >
> > > @@ -346,13 +343,6 @@ static void bnx2x_tpa_stop(struct bnx2x *bp,
> > > struct bnx2x_fastpath *fp,
> > >  	if (likely(new_skb)) {
> > >  		/* fix ip xsum and give it to the stack */
> > >  		/* (no need to map the new skb) */
> > > -#ifdef BCM_VLAN
> > > -		int is_vlan_cqe =
> > > -			(le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> > > -			 PARSING_FLAGS_VLAN);
> > > -		int is_not_hwaccel_vlan_cqe =
> > > -			(is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG)));
> > > -#endif
> > >
> > >  		prefetch(skb);
> > >  		prefetch(((char *)(skb)) + L1_CACHE_BYTES);
> > > @@ -377,28 +367,18 @@ static void bnx2x_tpa_stop(struct bnx2x *bp,
> > > struct bnx2x_fastpath *fp,
> > >  			struct iphdr *iph;
> > >
> > >  			iph = (struct iphdr *)skb->data;
> > > -#ifdef BCM_VLAN
> > > -			/* If there is no Rx VLAN offloading -
> > > -			   take VLAN tag into an account */
> > > -			if (unlikely(is_not_hwaccel_vlan_cqe))
> > > -				iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN);
> > > -#endif
> > >  			iph->check = 0;
> > >  			iph->check = ip_fast_csum((u8 *)iph, iph->ihl);
> > >  		}
> > >
> > >  		if (!bnx2x_fill_frag_skb(bp, fp, skb,
> > >  					 &cqe->fast_path_cqe, cqe_idx)) {
> > > -#ifdef BCM_VLAN
> > > -			if ((bp->vlgrp != NULL) &&
> > > -				(le16_to_cpu(cqe->fast_path_cqe.
> > > -				pars_flags.flags) & PARSING_FLAGS_VLAN))
> > > -				vlan_gro_receive(&fp->napi, bp->vlgrp,
> > > +			if ((le16_to_cpu(cqe->fast_path_cqe.
> > > +			    pars_flags.flags) & PARSING_FLAGS_VLAN))
> > > +				__vlan_hwaccel_put_tag(skb,
> > >  						 le16_to_cpu(cqe->fast_path_cqe.
> > > -							     vlan_tag), skb);
> > > -			else
> > > -#endif
> > > -				napi_gro_receive(&fp->napi, skb);
> > > +							     vlan_tag));
> > > +			napi_gro_receive(&fp->napi, skb);
> > >  		} else {
> > >  			DP(NETIF_MSG_RX_STATUS, "Failed to allocate new
> > > pages"
> > >  			   " - dropping packet!\n");
> > > @@ -633,15 +613,11 @@ reuse_rx:
> > >
> > >  		skb_record_rx_queue(skb, fp->index);
> > >
> > > -#ifdef BCM_VLAN
> > > -		if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
> > > -		    (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> > > -		     PARSING_FLAGS_VLAN))
> > > -			vlan_gro_receive(&fp->napi, bp->vlgrp,
> > > -				le16_to_cpu(cqe->fast_path_cqe.vlan_tag), skb);
> > > -		else
> > > -#endif
> > > -			napi_gro_receive(&fp->napi, skb);
> > > +		if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
> > > +		     PARSING_FLAGS_VLAN)
> > > +			__vlan_hwaccel_put_tag(skb,
> > > +				le16_to_cpu(cqe->fast_path_cqe.vlan_tag));
> > > +		napi_gro_receive(&fp->napi, skb);
> > >
> > >
> > >  next_rx:
> > > @@ -2025,14 +2001,12 @@ netdev_tx_t bnx2x_start_xmit(struct sk_buff
> > > *skb, struct net_device *dev)
> > >  	   "sending pkt %u @%p  next_idx %u  bd %u @%p\n",
> > >  	   pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd);
> > >
> > > -#ifdef BCM_VLAN
> > >  	if (vlan_tx_tag_present(skb)) {
> > >  		tx_start_bd->vlan_or_ethertype =
> > >  		    cpu_to_le16(vlan_tx_tag_get(skb));
> > >  		tx_start_bd->bd_flags.as_bitfield |=
> > >  		    (X_ETH_OUTBAND_VLAN <<
> > > ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
> > >  	} else
> > > -#endif
> > >  		tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
> > >
> > >  	/* turn on parsing and get a BD */
> > > @@ -2317,18 +2291,6 @@ void bnx2x_tx_timeout(struct net_device
> *dev)
> > >  	schedule_delayed_work(&bp->reset_task, 0);
> > >  }
> > >
> > > -#ifdef BCM_VLAN
> > > -/* called with rtnl_lock */
> > > -void bnx2x_vlan_rx_register(struct net_device *dev,
> > > -				   struct vlan_group *vlgrp)
> > > -{
> > > -	struct bnx2x *bp = netdev_priv(dev);
> > > -
> > > -	bp->vlgrp = vlgrp;
> > > -}
> > > -
> > > -#endif
> > > -
> > >  int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
> > >  {
> > >  	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 54fe061..daefef6 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)
> > >  	int changed = 0;
> > >  	int rc = 0;
> > >
> > > -	if (data & ~(ETH_FLAG_LRO | ETH_FLAG_RXHASH))
> > > -		return -EINVAL;
> > > -
> > >  	if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
> > >  		printk(KERN_ERR "Handling parity error recovery. Try again
> > > later\n");
> > >  		return -EAGAIN;
> > >  	}
> > >
> > > +	if (!(data & ETH_FLAG_RXVLAN))
> > > +		return -EOPNOTSUPP;
> > > +
> > > +	if ((data & ETH_FLAG_LRO) && bp->rx_csum && bp->disable_tpa)
> > > +		return -EINVAL;
> > > +
> > > +	rc = ethtool_op_set_flags(dev, data, ETH_FLAG_LRO |
> > > ETH_FLAG_RXVLAN |
> > > +					ETH_FLAG_TXVLAN | ETH_FLAG_RXHASH);
> > > +	if (rc)
> > > +		return rc;
> > > +
> > >  	/* TPA requires Rx CSUM offloading */
> > >  	if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
> > > -		if (!bp->disable_tpa) {
> > > -			if (!(dev->features & NETIF_F_LRO)) {
> > > -				dev->features |= NETIF_F_LRO;
> > > -				bp->flags |= TPA_ENABLE_FLAG;
> > > -				changed = 1;
> > > -			}
> > > -		} else
> > > -			rc = -EINVAL;
> > > -	} else if (dev->features & NETIF_F_LRO) {
> > > +		if (!(bp->flags & TPA_ENABLE_FLAG)) {
> > > +			bp->flags |= TPA_ENABLE_FLAG;
> > > +			changed = 1;
> > > +		}
> > > +	} else if (bp->flags & TPA_ENABLE_FLAG) {
> > >  		dev->features &= ~NETIF_F_LRO;
> > >  		bp->flags &= ~TPA_ENABLE_FLAG;
> > >  		changed = 1;
> > >  	}
> > >
> > > -	if (data & ETH_FLAG_RXHASH)
> > > -		dev->features |= NETIF_F_RXHASH;
> > > -	else
> > > -		dev->features &= ~NETIF_F_RXHASH;
> > > -
> > >  	if (changed && netif_running(dev)) {
> > >  		bnx2x_nic_unload(bp, UNLOAD_NORMAL);
> > >  		rc = bnx2x_nic_load(bp, LOAD_NORMAL);
> > > diff --git a/drivers/net/bnx2x/bnx2x_main.c
> > > b/drivers/net/bnx2x/bnx2x_main.c
> > > index f22e283..ff99a2f 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,
> > >  	flags |= QUEUE_FLG_HC;
> > >  	flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0;
> > >
> > > -#ifdef BCM_VLAN
> > >  	flags |= QUEUE_FLG_VLAN;
> > >  	DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
> > > -#endif
> > >
> > >  	if (!fp->disable_tpa)
> > >  		flags |= QUEUE_FLG_TPA;
> > > @@ -8630,9 +8628,6 @@ static const struct net_device_ops
> > > bnx2x_netdev_ops = {
> > >  	.ndo_do_ioctl		= bnx2x_ioctl,
> > >  	.ndo_change_mtu		= bnx2x_change_mtu,
> > >  	.ndo_tx_timeout		= bnx2x_tx_timeout,
> > > -#ifdef BCM_VLAN
> > > -	.ndo_vlan_rx_register	= bnx2x_vlan_rx_register,
> > > -#endif
> > >  #ifdef CONFIG_NET_POLL_CONTROLLER
> > >  	.ndo_poll_controller	= poll_bnx2x,
> > >  #endif
> > > @@ -8764,9 +8759,7 @@ static int __devinit bnx2x_init_dev(struct
> > > pci_dev *pdev,
> > >  		dev->features |= NETIF_F_HIGHDMA;
> > >  	dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
> > >  	dev->features |= NETIF_F_TSO6;
> > > -#ifdef BCM_VLAN
> > >  	dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
> > > -	bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
> > >
> > >  	dev->vlan_features |= NETIF_F_SG;
> > >  	dev->vlan_features |= NETIF_F_HW_CSUM;
> > > @@ -8774,7 +8767,6 @@ static int __devinit bnx2x_init_dev(struct
> > > pci_dev *pdev,
> > >  		dev->vlan_features |= NETIF_F_HIGHDMA;
> > >  	dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
> > >  	dev->vlan_features |= NETIF_F_TSO6;
> > > -#endif
> > >
> > >  	/* get_port_hwinfo() will set prtad and mmds properly */
> > >  	bp->mdio.prtad = MDIO_PRTAD_NONE;
> > > --
> > > 1.7.1
> >
> > Guys, when I compiled the kernel with these patches without VLAN
> > support (CONFIG_VLAN_8021Q is not set) and tried to send VLAN tagged
> > frames from the remote side to the bnx2x interface the kernel
> panicked.
> >
> > The stack trace got cut with the __netif_receive_skb() on top by the
> > IPKVM and I'll have to connect a serial to get it all. But until I
> > did that maybe somebody will have any ideas anyway...
> >
> > It happens regardless there is HW RX VLAN stripping enabled or not.
> 
> When RX VLAN stripping is enabled we hit the BUG() in the
> vlan_hwaccel_do_receive().:

We hit the same BUG() both when VLAN stripping is disabled. 

Thanks,
vlad

> 
> 
> 
> 
> 
> >
> > Thanks,
> > vlad
> >
> > >
> > > --
> > > To unsubscribe from this list: send the line "unsubscribe netdev"
> in
> > > the body of a message to majordomo@vger.kernel.org
> > > More majordomo info at  http://vger.kernel.org/majordomo-info.html
> >
> >
> > --
> > To unsubscribe from this list: send the line "unsubscribe netdev" in
> > the body of a message to majordomo@vger.kernel.org
> > More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Gross Oct. 21, 2010, 9:34 p.m. UTC | #4
On Thu, Oct 21, 2010 at 7:02 AM, Vladislav Zolotarov <vladz@broadcom.com> wrote:
>> Guys, when I compiled the kernel with these patches without VLAN
>> support (CONFIG_VLAN_8021Q is not set) and tried to send VLAN tagged
>> frames from the remote side to the bnx2x interface the kernel panicked.
>>
>> The stack trace got cut with the __netif_receive_skb() on top by the
>> IPKVM and I'll have to connect a serial to get it all. But until I
>> did that maybe somebody will have any ideas anyway...
>>
>> It happens regardless there is HW RX VLAN stripping enabled or not.
>
> When RX VLAN stripping is enabled we hit the BUG() in the
> vlan_hwaccel_do_receive().

Thanks, this is just a stupid mistake - I didn't update the
non-CONFIG_VLAN_8021Q version when I changed the semantics of that
function.  I've sent out a patch to fix it.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Gross Oct. 21, 2010, 9:36 p.m. UTC | #5
On Thu, Oct 21, 2010 at 7:50 AM, Vladislav Zolotarov <vladz@broadcom.com> wrote:
>> > Guys, when I compiled the kernel with these patches without VLAN
>> > support (CONFIG_VLAN_8021Q is not set) and tried to send VLAN tagged
>> > frames from the remote side to the bnx2x interface the kernel
>> panicked.
>> >
>> > The stack trace got cut with the __netif_receive_skb() on top by the
>> > IPKVM and I'll have to connect a serial to get it all. But until I
>> > did that maybe somebody will have any ideas anyway...
>> >
>> > It happens regardless there is HW RX VLAN stripping enabled or not.
>>
>> When RX VLAN stripping is enabled we hit the BUG() in the
>> vlan_hwaccel_do_receive().:
>
> We hit the same BUG() both when VLAN stripping is disabled.

This one surprises me because that function shouldn't get called at
all when VLAN stripping is disabled.  Are you sure that it is
disabled?  From my reading of the bnx2x driver it seems like it is
always enabled.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Dmitry Kravkov Oct. 22, 2010, 12:57 a.m. UTC | #6
With the latest patch this one also disappeared and I do see the packets with vlan tag on the receiver's side
(For this purpose the driver was patched do not configure the stripping)

-----Original Message-----
From: netdev-owner@vger.kernel.org [mailto:netdev-owner@vger.kernel.org] On Behalf Of Jesse Gross
Sent: Thursday, October 21, 2010 11:37 PM
To: Vladislav Zolotarov
Cc: David Miller; netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
Subject: Re: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan accleration.

On Thu, Oct 21, 2010 at 7:50 AM, Vladislav Zolotarov <vladz@broadcom.com> wrote:
>> > Guys, when I compiled the kernel with these patches without VLAN
>> > support (CONFIG_VLAN_8021Q is not set) and tried to send VLAN tagged
>> > frames from the remote side to the bnx2x interface the kernel
>> panicked.
>> >
>> > The stack trace got cut with the __netif_receive_skb() on top by the
>> > IPKVM and I'll have to connect a serial to get it all. But until I
>> > did that maybe somebody will have any ideas anyway...
>> >
>> > It happens regardless there is HW RX VLAN stripping enabled or not.
>>
>> When RX VLAN stripping is enabled we hit the BUG() in the
>> vlan_hwaccel_do_receive().:
>
> We hit the same BUG() both when VLAN stripping is disabled.

This one surprises me because that function shouldn't get called at
all when VLAN stripping is disabled.  Are you sure that it is
disabled?  From my reading of the bnx2x driver it seems like it is
always enabled.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Zolotarov Oct. 24, 2010, 9:21 a.m. UTC | #7
> >
> > We hit the same BUG() both when VLAN stripping is disabled.
> 
> This one surprises me because that function shouldn't get called at
> all when VLAN stripping is disabled.  Are you sure that it is
> disabled?  From my reading of the bnx2x driver it seems like it is
> always enabled.

I tried to check all possibilities and to check at which level the problem is,
so I patched the bnx2x not to do the stripping and recompiled it with the
kernel having CONFIG_VLAN_8021Q disabled. Then I saw the (same) BUG() message
again. It seems to me that your patch series were meant to remove the 
handling of this configuration (CONFIG_VLAN_8021Q) from the L2 drivers 
as well, isn't it? This means that the same VLAN flows, both accelerated and none
accelerated should be "active" both when this configuration is present and 
when it's not... Do I get it right?

Thanks,
vlad



--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Zolotarov Oct. 24, 2010, 10:11 a.m. UTC | #8
> -----Original Message-----
> From: netdev-owner@vger.kernel.org [mailto:netdev-
> owner@vger.kernel.org] On Behalf Of Vladislav Zolotarov
> Sent: Sunday, October 24, 2010 11:22 AM
> To: Jesse Gross
> Cc: David Miller; netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
> Subject: RE: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
> accleration.
> 
> 
> 
> > >
> > > We hit the same BUG() both when VLAN stripping is disabled.
> >
> > This one surprises me because that function shouldn't get called at
> > all when VLAN stripping is disabled.  Are you sure that it is
> > disabled?  From my reading of the bnx2x driver it seems like it is
> > always enabled.
> 
> I tried to check all possibilities and to check at which level the
> problem is,
> so I patched the bnx2x not to do the stripping and recompiled it with
> the
> kernel having CONFIG_VLAN_8021Q disabled. Then I saw the (same) BUG()
> message
> again. It seems to me that your patch series were meant to remove the
> handling of this configuration (CONFIG_VLAN_8021Q) from the L2 drivers
> as well, isn't it? This means that the same VLAN flows, both
> accelerated and none
> accelerated should be "active" both when this configuration is present
> and
> when it's not... Do I get it right?
> 
> Thanks,
> vlad

Jesse, from the fix u posted I conclude that the answer on the above questions is
obviously "yes"... ;) 

I first answered your question and only then looked at the "fixing" 
thread, my apologies... ;)

thanks,
vlad

> 
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Gross Oct. 26, 2010, 12:29 a.m. UTC | #9
On Sun, Oct 24, 2010 at 3:11 AM, Vladislav Zolotarov <vladz@broadcom.com> wrote:
>
>
>> -----Original Message-----
>> From: netdev-owner@vger.kernel.org [mailto:netdev-
>> owner@vger.kernel.org] On Behalf Of Vladislav Zolotarov
>> Sent: Sunday, October 24, 2010 11:22 AM
>> To: Jesse Gross
>> Cc: David Miller; netdev@vger.kernel.org; Hao Zheng; Eilon Greenstein
>> Subject: RE: [PATCH v2 11/14] bnx2x: Update bnx2x to use new vlan
>> accleration.
>>
>>
>>
>> > >
>> > > We hit the same BUG() both when VLAN stripping is disabled.
>> >
>> > This one surprises me because that function shouldn't get called at
>> > all when VLAN stripping is disabled.  Are you sure that it is
>> > disabled?  From my reading of the bnx2x driver it seems like it is
>> > always enabled.
>>
>> I tried to check all possibilities and to check at which level the
>> problem is,
>> so I patched the bnx2x not to do the stripping and recompiled it with
>> the
>> kernel having CONFIG_VLAN_8021Q disabled. Then I saw the (same) BUG()
>> message
>> again. It seems to me that your patch series were meant to remove the
>> handling of this configuration (CONFIG_VLAN_8021Q) from the L2 drivers
>> as well, isn't it? This means that the same VLAN flows, both
>> accelerated and none
>> accelerated should be "active" both when this configuration is present
>> and
>> when it's not... Do I get it right?
>>
>> Thanks,
>> vlad
>
> Jesse, from the fix u posted I conclude that the answer on the above questions is
> obviously "yes"... ;)

Yes, that's right.

>
> I first answered your question and only then looked at the "fixing"
> thread, my apologies... ;)

Even though the fix prevents the panic, I'm still a little concerned
that you ran into it at all when vlan stripping was disabled.  That
function should only be called when a tag was received by the card.
Is it possible that __vlan_hwaccel_put_tag is being called even in
cases when no tag was stripped?  Maybe we made a mistake when
converting the driver?
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Vladislav Zolotarov Oct. 26, 2010, 9:14 a.m. UTC | #10
> 
> Even though the fix prevents the panic, I'm still a little concerned
> that you ran into it at all when vlan stripping was disabled.  That
> function should only be called when a tag was received by the card.
> Is it possible that __vlan_hwaccel_put_tag is being called even in
> cases when no tag was stripped?  

Correct, and that's because u've patched the driver to put it the
following way:

if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
                     PARSING_FLAGS_VLAN)
        __vlan_hwaccel_put_tag(skb, le16_to_cpu(cqe->fast_path_cqe.vlan_tag));

The condition above will be TRUE regardless VLAN stripping is enabled or
disabled as the parsing flags come from our PARSER HW block and simply
indicates whether this frame has a VLAN header or not. When I disabled a VLAN
stripping I should have fixed this lines too but I think I didn't... ;)

> Maybe we made a mistake when converting the driver?

Since the driver always configures the VLAN stripping now, regardless the kernel
configuration, I think your patch was just fine. ;)

Thanks,
vlad




--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Jesse Gross Oct. 26, 2010, 5:57 p.m. UTC | #11
On Tue, Oct 26, 2010 at 2:14 AM, Vladislav Zolotarov <vladz@broadcom.com> wrote:
>>
>> Even though the fix prevents the panic, I'm still a little concerned
>> that you ran into it at all when vlan stripping was disabled.  That
>> function should only be called when a tag was received by the card.
>> Is it possible that __vlan_hwaccel_put_tag is being called even in
>> cases when no tag was stripped?
>
> Correct, and that's because u've patched the driver to put it the
> following way:
>
> if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
>                     PARSING_FLAGS_VLAN)
>        __vlan_hwaccel_put_tag(skb, le16_to_cpu(cqe->fast_path_cqe.vlan_tag));
>
> The condition above will be TRUE regardless VLAN stripping is enabled or
> disabled as the parsing flags come from our PARSER HW block and simply
> indicates whether this frame has a VLAN header or not. When I disabled a VLAN
> stripping I should have fixed this lines too but I think I didn't... ;)
>
>> Maybe we made a mistake when converting the driver?
>
> Since the driver always configures the VLAN stripping now, regardless the kernel
> configuration, I think your patch was just fine. ;)

Great.  Thanks for the explanation and confirmation.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/net/bnx2x/bnx2x.h b/drivers/net/bnx2x/bnx2x.h
index 3bf236b..9571ecf 100644
--- a/drivers/net/bnx2x/bnx2x.h
+++ b/drivers/net/bnx2x/bnx2x.h
@@ -24,10 +24,6 @@ 
 #define DRV_MODULE_RELDATE      "2010/10/19"
 #define BNX2X_BC_VER            0x040200
 
-#if defined(CONFIG_VLAN_8021Q) || defined(CONFIG_VLAN_8021Q_MODULE)
-#define BCM_VLAN			1
-#endif
-
 #define BNX2X_MULTI_QUEUE
 
 #define BNX2X_NEW_NAPI
@@ -858,10 +854,6 @@  struct bnx2x {
 
 	int			tx_ring_size;
 
-#ifdef BCM_VLAN
-	struct vlan_group	*vlgrp;
-#endif
-
 	u32			rx_csum;
 	u32			rx_buf_size;
 /* L2 header size + 2*VLANs (8 bytes) + LLC SNAP (8 bytes) */
@@ -925,8 +917,6 @@  struct bnx2x {
 #define NO_MCP_FLAG			0x100
 #define DISABLE_MSI_FLAG		0x200
 #define BP_NOMCP(bp)			(bp->flags & NO_MCP_FLAG)
-#define HW_VLAN_TX_FLAG			0x400
-#define HW_VLAN_RX_FLAG			0x800
 #define MF_FUNC_DIS			0x1000
 
 	int			pf_num;	/* absolute PF number */
diff --git a/drivers/net/bnx2x/bnx2x_cmn.c b/drivers/net/bnx2x/bnx2x_cmn.c
index 6905b2e..bc58375 100644
--- a/drivers/net/bnx2x/bnx2x_cmn.c
+++ b/drivers/net/bnx2x/bnx2x_cmn.c
@@ -16,16 +16,13 @@ 
  */
 
 #include <linux/etherdevice.h>
+#include <linux/if_vlan.h>
 #include <linux/ip.h>
 #include <net/ipv6.h>
 #include <net/ip6_checksum.h>
 #include <linux/firmware.h>
 #include "bnx2x_cmn.h"
 
-#ifdef BCM_VLAN
-#include <linux/if_vlan.h>
-#endif
-
 #include "bnx2x_init.h"
 
 
@@ -346,13 +343,6 @@  static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 	if (likely(new_skb)) {
 		/* fix ip xsum and give it to the stack */
 		/* (no need to map the new skb) */
-#ifdef BCM_VLAN
-		int is_vlan_cqe =
-			(le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
-			 PARSING_FLAGS_VLAN);
-		int is_not_hwaccel_vlan_cqe =
-			(is_vlan_cqe && (!(bp->flags & HW_VLAN_RX_FLAG)));
-#endif
 
 		prefetch(skb);
 		prefetch(((char *)(skb)) + L1_CACHE_BYTES);
@@ -377,28 +367,18 @@  static void bnx2x_tpa_stop(struct bnx2x *bp, struct bnx2x_fastpath *fp,
 			struct iphdr *iph;
 
 			iph = (struct iphdr *)skb->data;
-#ifdef BCM_VLAN
-			/* If there is no Rx VLAN offloading -
-			   take VLAN tag into an account */
-			if (unlikely(is_not_hwaccel_vlan_cqe))
-				iph = (struct iphdr *)((u8 *)iph + VLAN_HLEN);
-#endif
 			iph->check = 0;
 			iph->check = ip_fast_csum((u8 *)iph, iph->ihl);
 		}
 
 		if (!bnx2x_fill_frag_skb(bp, fp, skb,
 					 &cqe->fast_path_cqe, cqe_idx)) {
-#ifdef BCM_VLAN
-			if ((bp->vlgrp != NULL) &&
-				(le16_to_cpu(cqe->fast_path_cqe.
-				pars_flags.flags) & PARSING_FLAGS_VLAN))
-				vlan_gro_receive(&fp->napi, bp->vlgrp,
+			if ((le16_to_cpu(cqe->fast_path_cqe.
+			    pars_flags.flags) & PARSING_FLAGS_VLAN))
+				__vlan_hwaccel_put_tag(skb,
 						 le16_to_cpu(cqe->fast_path_cqe.
-							     vlan_tag), skb);
-			else
-#endif
-				napi_gro_receive(&fp->napi, skb);
+							     vlan_tag));
+			napi_gro_receive(&fp->napi, skb);
 		} else {
 			DP(NETIF_MSG_RX_STATUS, "Failed to allocate new pages"
 			   " - dropping packet!\n");
@@ -633,15 +613,11 @@  reuse_rx:
 
 		skb_record_rx_queue(skb, fp->index);
 
-#ifdef BCM_VLAN
-		if ((bp->vlgrp != NULL) && (bp->flags & HW_VLAN_RX_FLAG) &&
-		    (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
-		     PARSING_FLAGS_VLAN))
-			vlan_gro_receive(&fp->napi, bp->vlgrp,
-				le16_to_cpu(cqe->fast_path_cqe.vlan_tag), skb);
-		else
-#endif
-			napi_gro_receive(&fp->napi, skb);
+		if (le16_to_cpu(cqe->fast_path_cqe.pars_flags.flags) &
+		     PARSING_FLAGS_VLAN)
+			__vlan_hwaccel_put_tag(skb,
+				le16_to_cpu(cqe->fast_path_cqe.vlan_tag));
+		napi_gro_receive(&fp->napi, skb);
 
 
 next_rx:
@@ -2025,14 +2001,12 @@  netdev_tx_t bnx2x_start_xmit(struct sk_buff *skb, struct net_device *dev)
 	   "sending pkt %u @%p  next_idx %u  bd %u @%p\n",
 	   pkt_prod, tx_buf, fp->tx_pkt_prod, bd_prod, tx_start_bd);
 
-#ifdef BCM_VLAN
 	if (vlan_tx_tag_present(skb)) {
 		tx_start_bd->vlan_or_ethertype =
 		    cpu_to_le16(vlan_tx_tag_get(skb));
 		tx_start_bd->bd_flags.as_bitfield |=
 		    (X_ETH_OUTBAND_VLAN << ETH_TX_BD_FLAGS_VLAN_MODE_SHIFT);
 	} else
-#endif
 		tx_start_bd->vlan_or_ethertype = cpu_to_le16(pkt_prod);
 
 	/* turn on parsing and get a BD */
@@ -2317,18 +2291,6 @@  void bnx2x_tx_timeout(struct net_device *dev)
 	schedule_delayed_work(&bp->reset_task, 0);
 }
 
-#ifdef BCM_VLAN
-/* called with rtnl_lock */
-void bnx2x_vlan_rx_register(struct net_device *dev,
-				   struct vlan_group *vlgrp)
-{
-	struct bnx2x *bp = netdev_priv(dev);
-
-	bp->vlgrp = vlgrp;
-}
-
-#endif
-
 int bnx2x_suspend(struct pci_dev *pdev, pm_message_t state)
 {
 	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 54fe061..daefef6 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)
 	int changed = 0;
 	int rc = 0;
 
-	if (data & ~(ETH_FLAG_LRO | ETH_FLAG_RXHASH))
-		return -EINVAL;
-
 	if (bp->recovery_state != BNX2X_RECOVERY_DONE) {
 		printk(KERN_ERR "Handling parity error recovery. Try again later\n");
 		return -EAGAIN;
 	}
 
+	if (!(data & ETH_FLAG_RXVLAN))
+		return -EOPNOTSUPP;
+
+	if ((data & ETH_FLAG_LRO) && bp->rx_csum && bp->disable_tpa)
+		return -EINVAL;
+
+	rc = ethtool_op_set_flags(dev, data, ETH_FLAG_LRO | ETH_FLAG_RXVLAN |
+					ETH_FLAG_TXVLAN | ETH_FLAG_RXHASH);
+	if (rc)
+		return rc;
+
 	/* TPA requires Rx CSUM offloading */
 	if ((data & ETH_FLAG_LRO) && bp->rx_csum) {
-		if (!bp->disable_tpa) {
-			if (!(dev->features & NETIF_F_LRO)) {
-				dev->features |= NETIF_F_LRO;
-				bp->flags |= TPA_ENABLE_FLAG;
-				changed = 1;
-			}
-		} else
-			rc = -EINVAL;
-	} else if (dev->features & NETIF_F_LRO) {
+		if (!(bp->flags & TPA_ENABLE_FLAG)) {
+			bp->flags |= TPA_ENABLE_FLAG;
+			changed = 1;
+		}
+	} else if (bp->flags & TPA_ENABLE_FLAG) {
 		dev->features &= ~NETIF_F_LRO;
 		bp->flags &= ~TPA_ENABLE_FLAG;
 		changed = 1;
 	}
 
-	if (data & ETH_FLAG_RXHASH)
-		dev->features |= NETIF_F_RXHASH;
-	else
-		dev->features &= ~NETIF_F_RXHASH;
-
 	if (changed && netif_running(dev)) {
 		bnx2x_nic_unload(bp, UNLOAD_NORMAL);
 		rc = bnx2x_nic_load(bp, LOAD_NORMAL);
diff --git a/drivers/net/bnx2x/bnx2x_main.c b/drivers/net/bnx2x/bnx2x_main.c
index f22e283..ff99a2f 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,
 	flags |= QUEUE_FLG_HC;
 	flags |= IS_MF(bp) ? QUEUE_FLG_OV : 0;
 
-#ifdef BCM_VLAN
 	flags |= QUEUE_FLG_VLAN;
 	DP(NETIF_MSG_IFUP, "vlan removal enabled\n");
-#endif
 
 	if (!fp->disable_tpa)
 		flags |= QUEUE_FLG_TPA;
@@ -8630,9 +8628,6 @@  static const struct net_device_ops bnx2x_netdev_ops = {
 	.ndo_do_ioctl		= bnx2x_ioctl,
 	.ndo_change_mtu		= bnx2x_change_mtu,
 	.ndo_tx_timeout		= bnx2x_tx_timeout,
-#ifdef BCM_VLAN
-	.ndo_vlan_rx_register	= bnx2x_vlan_rx_register,
-#endif
 #ifdef CONFIG_NET_POLL_CONTROLLER
 	.ndo_poll_controller	= poll_bnx2x,
 #endif
@@ -8764,9 +8759,7 @@  static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
 		dev->features |= NETIF_F_HIGHDMA;
 	dev->features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
 	dev->features |= NETIF_F_TSO6;
-#ifdef BCM_VLAN
 	dev->features |= (NETIF_F_HW_VLAN_TX | NETIF_F_HW_VLAN_RX);
-	bp->flags |= (HW_VLAN_RX_FLAG | HW_VLAN_TX_FLAG);
 
 	dev->vlan_features |= NETIF_F_SG;
 	dev->vlan_features |= NETIF_F_HW_CSUM;
@@ -8774,7 +8767,6 @@  static int __devinit bnx2x_init_dev(struct pci_dev *pdev,
 		dev->vlan_features |= NETIF_F_HIGHDMA;
 	dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO_ECN);
 	dev->vlan_features |= NETIF_F_TSO6;
-#endif
 
 	/* get_port_hwinfo() will set prtad and mmds properly */
 	bp->mdio.prtad = MDIO_PRTAD_NONE;