[ewg] [PATCH 5/6] mlx4_en: backport mlx4 do vlan cleanup

Shawn Bohrer sbohrer at rgmadvisors.com
Wed Dec 7 16:56:54 PST 2011


The mlx4_en_0280_change_vlan_managing_scheme.patch conflicts with
kernel.org commit f1b553fbe73bfad38f41269d1c7a7ce3176d9539 "mlx4: do
vlan cleanup".  This drops the
mlx4_en_0280_change_vlan_managing_scheme.patch and backports
f1b553fbe73bfad38f41269d1c7a7ce3176d9539.

Signed-off-by: Shawn Bohrer <sbohrer at rgmadvisors.com>
---
 .../mlx4_en_0110_QUERY_PORT_from_workque.patch     |   63 ++--
 .../backport/3.1/mlx4_en_0060_vlan_cleanup.patch   |  407 ++++++++++++++++++++
 .../mlx4_en_0280_change_vlan_managing_scheme.patch |  207 ----------
 3 files changed, 437 insertions(+), 240 deletions(-)
 create mode 100644 kernel_patches/backport/3.1/mlx4_en_0060_vlan_cleanup.patch
 delete mode 100644 kernel_patches/fixes/mlx4_en_0280_change_vlan_managing_scheme.patch

diff --git a/kernel_patches/backport/2.6.16_sles10_sp4/mlx4_en_0110_QUERY_PORT_from_workque.patch b/kernel_patches/backport/2.6.16_sles10_sp4/mlx4_en_0110_QUERY_PORT_from_workque.patch
index e691fff..cfc5cca 100644
--- a/kernel_patches/backport/2.6.16_sles10_sp4/mlx4_en_0110_QUERY_PORT_from_workque.patch
+++ b/kernel_patches/backport/2.6.16_sles10_sp4/mlx4_en_0110_QUERY_PORT_from_workque.patch
@@ -12,11 +12,11 @@ Signed-off-by: Yevgeny Petrilin <yevgenyp at mellanox.co.il>
  drivers/net/mlx4/mlx4_en.h     |    3 +++
  5 files changed, 27 insertions(+), 13 deletions(-)
 
-diff --git a/drivers/net/mlx4/en_ethtool.c b/drivers/net/mlx4/en_ethtool.c
-index 69188c6..7b81ea1 100644
---- a/drivers/net/mlx4/en_ethtool.c
-+++ b/drivers/net/mlx4/en_ethtool.c
-@@ -281,9 +281,7 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+Index: ofed_1_5_kernel/drivers/net/mlx4/en_ethtool.c
+===================================================================
+--- ofed_1_5_kernel.orig/drivers/net/mlx4/en_ethtool.c
++++ ofed_1_5_kernel/drivers/net/mlx4/en_ethtool.c
+@@ -266,9 +266,7 @@ static int mlx4_en_get_settings(struct n
  	cmd->supported = SUPPORTED_10000baseT_Full;
  	cmd->advertising = ADVERTISED_10000baseT_Full;
  
@@ -27,7 +27,7 @@ index 69188c6..7b81ea1 100644
  	trans_type = priv->port_state.transciver;
  	if (netif_carrier_ok(dev)) {
  		cmd->speed = priv->port_state.link_speed;
-@@ -292,7 +290,7 @@ static int mlx4_en_get_settings(struct net_device *dev, struct ethtool_cmd *cmd)
+@@ -277,7 +275,7 @@ static int mlx4_en_get_settings(struct n
  		cmd->speed = -1;
  		cmd->duplex = -1;
  	}
@@ -36,11 +36,11 @@ index 69188c6..7b81ea1 100644
  	if (trans_type > 0 && trans_type <= 0xC) {
  		cmd->port = PORT_FIBRE;
  		cmd->transceiver = XCVR_EXTERNAL;
-diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
-index 4bb21c0..5b306b0 100644
---- a/drivers/net/mlx4/en_netdev.c
-+++ b/drivers/net/mlx4/en_netdev.c
-@@ -539,6 +539,12 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
+Index: ofed_1_5_kernel/drivers/net/mlx4/en_netdev.c
+===================================================================
+--- ofed_1_5_kernel.orig/drivers/net/mlx4/en_netdev.c
++++ ofed_1_5_kernel/drivers/net/mlx4/en_netdev.c
+@@ -603,6 +603,12 @@ static void mlx4_en_do_get_stats(struct
  	if (err)
  		en_dbg(HW, priv, "Could not update stats \n");
  
@@ -53,19 +53,19 @@ index 4bb21c0..5b306b0 100644
  	mutex_lock(&mdev->state_lock);
  	if (mdev->device_up) {
  		if (priv->port_up)
-@@ -1022,6 +1028,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
+@@ -1105,6 +1111,7 @@ int mlx4_en_init_netdev(struct mlx4_en_d
+ 	priv->mac_index = -1;
  	priv->msg_enable = MLX4_EN_MSG_LEVEL;
  	spin_lock_init(&priv->stats_lock);
-	spin_lock_init(&priv->vlan_lock);
 +	spin_lock_init(&priv->port_lock);
  	INIT_WORK(&priv->mcast_task, mlx4_en_do_set_multicast);
  	INIT_WORK(&priv->mac_task, mlx4_en_do_set_mac);
  	INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
-diff --git a/drivers/net/mlx4/en_port.c b/drivers/net/mlx4/en_port.c
-index 7f5a322..2fbc52f 100644
---- a/drivers/net/mlx4/en_port.c
-+++ b/drivers/net/mlx4/en_port.c
-@@ -160,8 +160,7 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port)
+Index: ofed_1_5_kernel/drivers/net/mlx4/en_port.c
+===================================================================
+--- ofed_1_5_kernel.orig/drivers/net/mlx4/en_port.c
++++ ofed_1_5_kernel/drivers/net/mlx4/en_port.c
+@@ -58,8 +58,7 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_de
  		goto out;
  	qport_context = mailbox->buf;
  
@@ -75,7 +75,7 @@ index 7f5a322..2fbc52f 100644
  	state->link_state = !!(qport_context->link_up & MLX4_EN_LINK_UP_MASK);
  	if ((qport_context->link_speed & MLX4_EN_SPEED_MASK) ==
  	    MLX4_EN_1G_SPEED)
-@@ -169,6 +168,7 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_dev *mdev, u8 port)
+@@ -69,6 +68,7 @@ int mlx4_en_QUERY_PORT(struct mlx4_en_de
  	state->transciver = qport_context->transceiver;
  	if (be32_to_cpu(qport_context->transceiver_code_hi) & 0x400)
  		state->transciver = 0x80;
@@ -83,10 +83,10 @@ index 7f5a322..2fbc52f 100644
  
  out:
  	mlx4_free_cmd_mailbox(mdev->dev, mailbox);
-diff --git a/drivers/net/mlx4/en_selftest.c b/drivers/net/mlx4/en_selftest.c
-index 43357d3..19eab82 100644
---- a/drivers/net/mlx4/en_selftest.c
-+++ b/drivers/net/mlx4/en_selftest.c
+Index: ofed_1_5_kernel/drivers/net/mlx4/en_selftest.c
+===================================================================
+--- ofed_1_5_kernel.orig/drivers/net/mlx4/en_selftest.c
++++ ofed_1_5_kernel/drivers/net/mlx4/en_selftest.c
 @@ -113,23 +113,29 @@ mlx4_en_test_loopback_exit:
  
  static int mlx4_en_test_link(struct mlx4_en_priv *priv)
@@ -124,11 +124,11 @@ index 43357d3..19eab82 100644
  	return 0;
  }
  
-diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
-index 9c616d6..7a2c1e6 100644
---- a/drivers/net/mlx4/mlx4_en.h
-+++ b/drivers/net/mlx4/mlx4_en.h
-@@ -102,6 +102,7 @@
+Index: ofed_1_5_kernel/drivers/net/mlx4/mlx4_en.h
+===================================================================
+--- ofed_1_5_kernel.orig/drivers/net/mlx4/mlx4_en.h
++++ ofed_1_5_kernel/drivers/net/mlx4/mlx4_en.h
+@@ -103,6 +103,7 @@
  #define STAMP_SHIFT		31
  #define STAMP_VAL		0x7fffffff
  #define STATS_DELAY		(HZ / 4)
@@ -136,7 +136,7 @@ index 9c616d6..7a2c1e6 100644
  
  /* Typical TSO descriptor with 16 gather entries is 352 bytes... */
  #define MAX_DESC_SIZE		512
-@@ -490,6 +491,7 @@ struct mlx4_en_priv {
+@@ -514,6 +515,7 @@ struct mlx4_en_priv {
  	struct net_device_stats ret_stats;
  	struct mlx4_en_port_state port_state;
  	spinlock_t stats_lock;
@@ -144,7 +144,7 @@ index 9c616d6..7a2c1e6 100644
  
  	unsigned long last_moder_packets;
  	unsigned long last_moder_tx_packets;
-@@ -535,6 +537,7 @@ struct mlx4_en_priv {
+@@ -559,6 +561,7 @@ struct mlx4_en_priv {
  	struct mlx4_en_frag_info frag_info[MLX4_EN_MAX_RX_FRAGS];
  	u16 num_frags;
  	u16 log_rx_info;
@@ -152,6 +152,3 @@ index 9c616d6..7a2c1e6 100644
  
  	struct mlx4_en_tx_ring tx_ring[MAX_TX_RINGS];
  	struct mlx4_en_rx_ring rx_ring[MAX_RX_RINGS];
--- 
-1.5.3.7
-
diff --git a/kernel_patches/backport/3.1/mlx4_en_0060_vlan_cleanup.patch b/kernel_patches/backport/3.1/mlx4_en_0060_vlan_cleanup.patch
new file mode 100644
index 0000000..5424f44
--- /dev/null
+++ b/kernel_patches/backport/3.1/mlx4_en_0060_vlan_cleanup.patch
@@ -0,0 +1,407 @@
+Backport upstream commit:
+
+commit f1b553fbe73bfad38f41269d1c7a7ce3176d9539
+Author: Jiri Pirko <jpirko at redhat.com>
+Date:   Wed Jul 20 04:54:22 2011 +0000
+
+    mlx4: do vlan cleanup
+    
+    - unify vlan and nonvlan path
+    - kill priv->vlgrp and mlx4_en_vlan_rx_register
+    
+    Signed-off-by: Jiri Pirko <jpirko at redhat.com>
+    Signed-off-by: David S. Miller <davem at davemloft.net>
+
+Index: ofed_kernel/drivers/net/mlx4/en_netdev.c
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/en_netdev.c
++++ ofed_kernel/drivers/net/mlx4/en_netdev.c
+@@ -44,58 +44,27 @@
+ #include "mlx4_en.h"
+ #include "en_port.h"
+ 
+-
+-static void mlx4_en_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
+-{
+-	struct mlx4_en_priv *priv = netdev_priv(dev);
+-	struct mlx4_en_dev *mdev = priv->mdev;
+-	int err;
+-
+-	en_dbg(HW, priv, "Registering VLAN group:%p\n", grp);
+-	priv->vlgrp = grp;
+-
+-	mutex_lock(&mdev->state_lock);
+-	if (mdev->device_up && priv->port_up) {
+-		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, grp);
+-		if (err)
+-			en_err(priv, "Failed configuring VLAN filter\n");
+-	}
+-	mutex_unlock(&mdev->state_lock);
+-}
+-
+ static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
+ {
+ 	struct mlx4_en_priv *priv = netdev_priv(dev);
+ 	struct mlx4_en_dev *mdev = priv->mdev;
+ 	int err;
+ 	int idx;
+-#ifndef HAVE_NETDEV_VLAN_FEATURES
+-	struct net_device *vdev;
+-#endif
+ 
+-	if (!priv->vlgrp)
+-		return;
++	en_dbg(HW, priv, "adding VLAN:%d\n", vid);
+ 
+-	en_dbg(HW, priv, "adding VLAN:%d (vlgrp entry:%p)\n",
+-	       vid, vlan_group_get_device(priv->vlgrp, vid));
++	set_bit(vid, priv->active_vlans);
+ 
+ 	/* Add VID to port VLAN filter */
+ 	mutex_lock(&mdev->state_lock);
+ 	if (mdev->device_up && priv->port_up) {
+-		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp);
++		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
+ 		if (err)
+ 			en_err(priv, "Failed configuring VLAN filter\n");
+ 	}
+ 	if (mlx4_register_vlan(mdev->dev, priv->port, vid, &idx))
+ 		en_dbg(HW, priv, "failed adding vlan %d\n", vid);
+ 	mutex_unlock(&mdev->state_lock);
+-
+-#ifndef HAVE_NETDEV_VLAN_FEATURES
+-	vdev = vlan_group_get_device(priv->vlgrp, vid);
+-	vdev->features |= dev->features;
+-	vdev->features |= NETIF_F_LLTX;
+-	vlan_group_set_device(priv->vlgrp, vid, vdev);
+-#endif
+ }
+ 
+ static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
+@@ -105,12 +74,9 @@ static void mlx4_en_vlan_rx_kill_vid(str
+ 	int err;
+ 	int idx;
+ 
+-	if (!priv->vlgrp)
+-		return;
++	en_dbg(HW, priv, "Killing VID:%d\n", vid);
+ 
+-	en_dbg(HW, priv, "Killing VID:%d (vlgrp:%p vlgrp entry:%p)\n",
+-	       vid, priv->vlgrp, vlan_group_get_device(priv->vlgrp, vid));
+-	vlan_group_set_device(priv->vlgrp, vid, NULL);
++	clear_bit(vid, priv->active_vlans);
+ 
+ 	/* Remove VID from port VLAN filter */
+ 	mutex_lock(&mdev->state_lock);
+@@ -120,7 +86,7 @@ static void mlx4_en_vlan_rx_kill_vid(str
+ 		en_dbg(HW, priv, "could not find vid %d in cache\n", vid);
+ 
+ 	if (mdev->device_up && priv->port_up) {
+-		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp);
++		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
+ 		if (err)
+ 			en_err(priv, "Failed configuring VLAN filter\n");
+ 	}
+@@ -283,12 +249,10 @@ static void mlx4_en_do_set_multicast(str
+ 				priv->flags |= MLX4_EN_FLAG_MC_PROMISC;
+ 			}
+ 
+-			if (priv->vlgrp) {
+-				/* Disable port VLAN filter */
+-				err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, NULL);
+-				if (err)
+-					en_err(priv, "Failed disabling VLAN filter\n");
+-			}
++			/* Disable port VLAN filter */
++			err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
++			if (err)
++				en_err(priv, "Failed disabling VLAN filter\n");
+ 		}
+ 		goto out;
+ 	}
+@@ -322,11 +286,9 @@ static void mlx4_en_do_set_multicast(str
+ 		}
+ 
+ 		/* Enable port VLAN filter */
+-		if (priv->vlgrp) {
+-			err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp);
+-			if (err)
+-				en_err(priv, "Failed enabling VLAN filter\n");
+-		}
++		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv);
++		if (err)
++			en_err(priv, "Failed enabling VLAN filter\n");
+ 	}
+ 
+ 	/* Enable/disable the multicast filter according to IFF_ALLMULTI */
+@@ -1058,7 +1020,6 @@ static const struct net_device_ops mlx4_
+ 	.ndo_validate_addr	= eth_validate_addr,
+ 	.ndo_change_mtu		= mlx4_en_change_mtu,
+ 	.ndo_tx_timeout		= mlx4_en_tx_timeout,
+-	.ndo_vlan_rx_register	= mlx4_en_vlan_rx_register,
+ 	.ndo_vlan_rx_add_vid	= mlx4_en_vlan_rx_add_vid,
+ 	.ndo_vlan_rx_kill_vid	= mlx4_en_vlan_rx_kill_vid,
+ #ifdef CONFIG_NET_POLL_CONTROLLER
+@@ -1155,10 +1116,8 @@ int mlx4_en_init_netdev(struct mlx4_en_d
+ 	 */
+ 	dev->features |= NETIF_F_SG;
+ 	dev->features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+-#ifdef HAVE_NETDEV_VLAN_FEATURES
+ 	dev->vlan_features |= NETIF_F_SG;
+ 	dev->vlan_features |= NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+-#endif
+ 	dev->features |= NETIF_F_HIGHDMA;
+ 	dev->features |= NETIF_F_HW_VLAN_TX |
+ 			 NETIF_F_HW_VLAN_RX |
+@@ -1167,10 +1126,8 @@ int mlx4_en_init_netdev(struct mlx4_en_d
+ 	if (mdev->LSO_support) {
+ 		dev->features |= NETIF_F_TSO;
+ 		dev->features |= NETIF_F_TSO6;
+-#ifdef HAVE_NETDEV_VLAN_FEATURES
+ 		dev->vlan_features |= NETIF_F_TSO;
+ 		dev->vlan_features |= NETIF_F_TSO6;
+-#endif
+ 	}
+ 
+ 	mdev->pndev[port] = dev;
+Index: ofed_kernel/drivers/net/mlx4/en_rx.c
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/en_rx.c
++++ ofed_kernel/drivers/net/mlx4/en_rx.c
+@@ -728,13 +728,12 @@ int mlx4_en_process_rx_cq_skb(struct net
+ 				goto next;
+ 		}
+ 
++		if (be32_to_cpu(cqe->vlan_my_qpn) &
++		    MLX4_CQE_VLAN_PRESENT_MASK)
++			__vlan_hwaccel_put_tag(skb, be16_to_cpu(cqe->sl_vid));
++
+ 		/* Push it up the stack */
+-		if (priv->vlgrp && (be32_to_cpu(cqe->vlan_my_qpn) &
+-				    MLX4_CQE_VLAN_PRESENT_MASK)) {
+-			vlan_hwaccel_receive_skb(skb, priv->vlgrp,
+-						be16_to_cpu(cqe->sl_vid));
+-		} else
+-			netif_receive_skb(skb);
++		netif_receive_skb(skb);
+ 
+ 		dev->last_rx = jiffies;
+ 
+@@ -829,11 +828,14 @@ int mlx4_en_process_rx_cq(struct net_dev
+ 					gro_skb->truesize += length;
+ 					gro_skb->ip_summed = CHECKSUM_UNNECESSARY;
+ 
+-					if (priv->vlgrp && (cqe->vlan_my_qpn &
+-							    cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)))
+-						vlan_gro_frags(&cq->napi, priv->vlgrp, be16_to_cpu(cqe->sl_vid));
+-					else
+-						napi_gro_frags(&cq->napi);
++					if (cqe->vlan_my_qpn &
++					    cpu_to_be32(MLX4_CQE_VLAN_PRESENT_MASK)) {
++						u16 vid = be16_to_cpu(cqe->sl_vid);
++
++						__vlan_hwaccel_put_tag(gro_skb, vid);
++					}
++
++					napi_gro_frags(&cq->napi);
+ 
+ 					goto next;
+ 				}
+@@ -865,13 +867,12 @@ int mlx4_en_process_rx_cq(struct net_dev
+ 		skb->protocol = eth_type_trans(skb, dev);
+ 		skb_record_rx_queue(skb, cq->ring);
+ 
++		if (be32_to_cpu(cqe->vlan_my_qpn) &
++		    MLX4_CQE_VLAN_PRESENT_MASK)
++			__vlan_hwaccel_put_tag(skb, be16_to_cpu(cqe->sl_vid));
++
+ 		/* Push it up the stack */
+-		if (priv->vlgrp && (be32_to_cpu(cqe->vlan_my_qpn) &
+-				    MLX4_CQE_VLAN_PRESENT_MASK)) {
+-			vlan_hwaccel_receive_skb(skb, priv->vlgrp,
+-						be16_to_cpu(cqe->sl_vid));
+-		} else
+-			netif_receive_skb(skb);
++		netif_receive_skb(skb);
+ 
+ next:
+ 		++cq->mcq.cons_index;
+Index: ofed_kernel/drivers/net/mlx4/mlx4_en.h
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/mlx4_en.h
++++ ofed_kernel/drivers/net/mlx4/mlx4_en.h
+@@ -34,10 +34,12 @@
+ #ifndef _MLX4_EN_H_
+ #define _MLX4_EN_H_
+ 
++#include <linux/bitops.h>
+ #include <linux/compiler.h>
+ #include <linux/list.h>
+ #include <linux/mutex.h>
+ #include <linux/netdevice.h>
++#include <linux/if_vlan.h>
+ 
+ #include <linux/mlx4/device.h>
+ #include <linux/mlx4/qp.h>
+@@ -474,7 +476,7 @@ struct mlx4_en_priv {
+ 	struct mlx4_en_dev *mdev;
+ 	struct mlx4_en_port_profile *prof;
+ 	struct net_device *dev;
+-	struct vlan_group *vlgrp;
++	unsigned long active_vlans[BITS_TO_LONGS(VLAN_N_VID)];
+ 	struct net_device_stats stats;
+ 	struct net_device_stats ret_stats;
+ 	struct mlx4_en_port_state port_state;
+@@ -609,7 +611,7 @@ void mlx4_en_release_rss_steer(struct ml
+ int mlx4_en_free_tx_buf(struct net_device *dev, struct mlx4_en_tx_ring *ring);
+ void mlx4_en_rx_irq(struct mlx4_cq *mcq);
+ 
+-int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, u8 port, struct vlan_group *grp);
++int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv);
+ int mlx4_SET_PORT_general(struct mlx4_dev *dev, u8 port, int mtu,
+ 			  u8 pptx, u8 pfctx, u8 pprx, u8 pfcrx);
+ int mlx4_SET_PORT_qpn_calc(struct mlx4_dev *dev, u8 port, u32 base_qpn,
+Index: ofed_kernel/drivers/net/mlx4/port.c
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/port.c
++++ ofed_kernel/drivers/net/mlx4/port.c
+@@ -39,6 +39,7 @@
+ #include <linux/mlx4/device.h>
+ 
+ #include "mlx4.h"
++#include "mlx4_en.h"
+ #include "en_port.h"
+ 
+ int mlx4_ib_set_4k_mtu = 0;
+@@ -59,7 +60,7 @@ int mlx4_SET_MCAST_FLTR(struct mlx4_dev
+ }
+ EXPORT_SYMBOL_GPL(mlx4_SET_MCAST_FLTR);
+ 
+-int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, u8 port, struct vlan_group *grp)
++int mlx4_SET_VLAN_FLTR(struct mlx4_dev *dev, struct mlx4_en_priv *priv)
+ {
+ 	struct mlx4_cmd_mailbox *mailbox;
+ 	struct mlx4_set_vlan_fltr_mbox *filter;
+@@ -74,20 +75,15 @@ int mlx4_SET_VLAN_FLTR(struct mlx4_dev *
+ 		return PTR_ERR(mailbox);
+ 
+ 	filter = mailbox->buf;
+-	if (grp) {
+-		memset(filter, 0, sizeof *filter);
+-		for (i = VLAN_FLTR_SIZE - 1; i >= 0; i--) {
+-			entry = 0;
+-			for (j = 0; j < 32; j++)
+-				if (vlan_group_get_device(grp, index++))
+-					entry |= 1 << j;
+-			filter->entry[i] = cpu_to_be32(entry);
+-		}
+-	} else {
+-		/* When no vlans are configured we block all vlans */
+-		memset(filter, 0, sizeof(*filter));
++	memset(filter, 0, sizeof(*filter));
++	for (i = VLAN_FLTR_SIZE - 1; i >= 0; i--) {
++		entry = 0;
++		for (j = 0; j < 32; j++)
++			if (test_bit(index++, priv->active_vlans))
++				entry |= 1 << j;
++		filter->entry[i] = cpu_to_be32(entry);
+ 	}
+-	err = mlx4_cmd(dev, mailbox->dma, port, 0, MLX4_CMD_SET_VLAN_FLTR,
++	err = mlx4_cmd(dev, mailbox->dma, priv->port, 0, MLX4_CMD_SET_VLAN_FLTR,
+ 		       MLX4_CMD_TIME_CLASS_B);
+ 	mlx4_free_cmd_mailbox(dev, mailbox);
+ 	return err;
+Index: ofed_kernel/drivers/net/mlx4/en_tx.c
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/en_tx.c
++++ ofed_kernel/drivers/net/mlx4/en_tx.c
+@@ -626,7 +626,7 @@ u16 mlx4_en_select_queue(struct net_devi
+ 	u32 hash_index;
+ 
+ 	/* Obtain VLAN information if present */
+-	if (priv->vlgrp && vlan_tx_tag_present(skb)) {
++	if (vlan_tx_tag_present(skb)) {
+ 		vlan_tag = vlan_tx_tag_get(skb);
+ 		/* Set the Tx ring to use according to vlan priority */
+ 		tx_ind = priv->tx_prio_map[vlan_tag >> 13];
+@@ -718,7 +718,7 @@ int mlx4_en_xmit(struct sk_buff *skb, st
+ 
+ 	tx_ind = skb->queue_mapping;
+ 	ring = &priv->tx_ring[tx_ind];
+-	if (priv->vlgrp && vlan_tx_tag_present(skb))
++	if (vlan_tx_tag_present(skb))
+ 		vlan_tag = vlan_tx_tag_get(skb);
+ 
+ 	/* Check available TXBBs And 2K spare for prefetch */
+Index: ofed_kernel/drivers/net/mlx4/en_ethtool.c
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/en_ethtool.c
++++ ofed_kernel/drivers/net/mlx4/en_ethtool.c
+@@ -71,38 +71,10 @@ static int mlx4_en_set_tso(struct net_de
+ 		if (!priv->mdev->LSO_support)
+ 			return -EPERM;
+ 		dev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
+-#ifdef HAVE_NETDEV_VLAN_FEATURES
+ 		dev->vlan_features |= (NETIF_F_TSO | NETIF_F_TSO6);
+-#else
+-		if (priv->vlgrp) {
+-			int i;
+-			struct net_device *vdev;
+-			for (i = 0; i < VLAN_N_VID; i++) {
+-				vdev = vlan_group_get_device(priv->vlgrp, i);
+-				if (vdev) {
+-					vdev->features |= (NETIF_F_TSO | NETIF_F_TSO6);
+-					vlan_group_set_device(priv->vlgrp, i, vdev);
+-				}
+-			}
+-		}
+-#endif
+ 	} else {
+ 		dev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+-#ifdef HAVE_NETDEV_VLAN_FEATURES
+ 		dev->vlan_features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+-#else
+-		if (priv->vlgrp) {
+-			int i;
+-			struct net_device *vdev;
+-			for (i = 0; i < VLAN_N_VID; i++) {
+-				vdev = vlan_group_get_device(priv->vlgrp, i);
+-				if (vdev) {
+-					vdev->features &= ~(NETIF_F_TSO | NETIF_F_TSO6);
+-					vlan_group_set_device(priv->vlgrp, i, vdev);
+-				}
+-			}
+-		}
+-#endif
+ 	}
+ 	return 0;
+ }
+Index: ofed_kernel/drivers/net/mlx4/en_frag.c
+===================================================================
+--- ofed_kernel.orig/drivers/net/mlx4/en_frag.c
++++ ofed_kernel/drivers/net/mlx4/en_frag.c
+@@ -97,10 +97,8 @@ static void flush_session(struct mlx4_en
+ 	iph->check = ip_fast_csum((unsigned char *)iph, iph->ihl);
+ 
+ 	if (session->vlan)
+-		vlan_hwaccel_receive_skb(skb, priv->vlgrp,
+-					 be16_to_cpu(session->sl_vid));
+-	else
+-		netif_receive_skb(skb);
++		__vlan_hwaccel_put_tag(skb, be16_to_cpu(session->sl_vid));
++	netif_receive_skb(skb);
+ 	dev->last_rx = jiffies;
+ 	session->fragments = NULL;
+ 	session->last = NULL;
+@@ -183,9 +181,8 @@ new_session:
+ 		session->protocol = iph->protocol;
+ 		session->total_len = ip_len;
+ 		session->offset = offset;
+-		session->vlan = (priv->vlgrp &&
+-				 (be32_to_cpu(cqe->vlan_my_qpn) &
+-				  MLX4_CQE_VLAN_PRESENT_MASK)) ? 1 : 0;
++		session->vlan = (be32_to_cpu(cqe->vlan_my_qpn) &
++				 MLX4_CQE_VLAN_PRESENT_MASK) ? 1 : 0;
+ 		session->sl_vid = cqe->sl_vid;
+ 	}
+ 	if (!(ntohs(iph->frag_off) & IP_MF))
diff --git a/kernel_patches/fixes/mlx4_en_0280_change_vlan_managing_scheme.patch b/kernel_patches/fixes/mlx4_en_0280_change_vlan_managing_scheme.patch
deleted file mode 100644
index b3f7907..0000000
--- a/kernel_patches/fixes/mlx4_en_0280_change_vlan_managing_scheme.patch
+++ /dev/null
@@ -1,207 +0,0 @@
-From fc501087682c9fd7c438ec6389093adf47e940eb Mon Sep 17 00:00:00 2001
-From: Yevgeny Petrilin <yevgenyp at mellanox.co.il>
-Date: Tue, 16 Nov 2010 15:53:40 +0200
-Subject: [PATCH] mlx4_en: performing the vlan operations from stats task
-
-Signed-off-by: Yevgeny Petrilin <yevgenyp at mellanox.co.il>
----
- drivers/net/mlx4/en_netdev.c |  110 +++++++++++++++++++++++++++---------------
- drivers/net/mlx4/mlx4_en.h   |    5 ++
- 2 files changed, 76 insertions(+), 39 deletions(-)
-
-diff --git a/drivers/net/mlx4/en_netdev.c b/drivers/net/mlx4/en_netdev.c
-index f990a03..261be53 100644
---- a/drivers/net/mlx4/en_netdev.c
-+++ b/drivers/net/mlx4/en_netdev.c
-@@ -49,27 +49,20 @@
- static void mlx4_en_vlan_rx_register(struct net_device *dev, struct vlan_group *grp)
- {
- 	struct mlx4_en_priv *priv = netdev_priv(dev);
--	struct mlx4_en_dev *mdev = priv->mdev;
--	int err;
- 
- 	en_dbg(HW, priv, "Registering VLAN group:%p\n", grp);
--	priv->vlgrp = grp;
- 
--	mutex_lock(&mdev->state_lock);
--	if (mdev->device_up && priv->port_up) {
--		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, grp);
--		if (err)
--			en_err(priv, "Failed configuring VLAN filter\n");
--	}
--	mutex_unlock(&mdev->state_lock);
-+	spin_lock_bh(&priv->vlan_lock);
-+	priv->vlgrp = grp;
-+	priv->vlgrp_modified = true;
-+	spin_unlock_bh(&priv->vlan_lock);
- }
- 
- static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
- {
- 	struct mlx4_en_priv *priv = netdev_priv(dev);
--	struct mlx4_en_dev *mdev = priv->mdev;
--	int err;
- 	int idx;
-+	u8 field;
- #ifndef HAVE_NETDEV_VLAN_FEATURES
- 	struct net_device *vdev;
- #endif
-@@ -80,17 +73,15 @@ static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
- 	en_dbg(HW, priv, "adding VLAN:%d (vlgrp entry:%p)\n",
- 	       vid, vlan_group_get_device(priv->vlgrp, vid));
- 
--	/* Add VID to port VLAN filter */
--	mutex_lock(&mdev->state_lock);
--	if (mdev->device_up && priv->port_up) {
--		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp);
--		if (err)
--			en_err(priv, "Failed configuring VLAN filter\n");
--	}
--	if (mlx4_register_vlan(mdev->dev, priv->port, vid, &idx))
--		en_dbg(HW, priv, "failed adding vlan %d\n", vid);
--	mutex_unlock(&mdev->state_lock);
--
-+	spin_lock_bh(&priv->vlan_lock);
-+	priv->vlgrp_modified = true;
-+	idx = vid >> 3;
-+	field = 1 << (vid & 0x7);
-+	if (priv->vlan_unregister[idx] & field)
-+		priv->vlan_unregister[idx] &= ~field;
-+	else
-+		priv->vlan_register[idx] |= field;
-+	spin_unlock_bh(&priv->vlan_lock);
- #ifndef HAVE_NETDEV_VLAN_FEATURES
- 	vdev = vlan_group_get_device(priv->vlgrp, vid);
- 	vdev->features |= dev->features;
-@@ -102,30 +93,24 @@ static void mlx4_en_vlan_rx_add_vid(struct net_device *dev, unsigned short vid)
- static void mlx4_en_vlan_rx_kill_vid(struct net_device *dev, unsigned short vid)
- {
- 	struct mlx4_en_priv *priv = netdev_priv(dev);
--	struct mlx4_en_dev *mdev = priv->mdev;
--	int err;
- 	int idx;
-+	u8 field;
- 
- 	if (!priv->vlgrp)
- 		return;
- 
- 	en_dbg(HW, priv, "Killing VID:%d (vlgrp:%p vlgrp entry:%p)\n",
- 	       vid, priv->vlgrp, vlan_group_get_device(priv->vlgrp, vid));
-+	spin_lock_bh(&priv->vlan_lock);
-+	priv->vlgrp_modified = true;
- 	vlan_group_set_device(priv->vlgrp, vid, NULL);
--
--	/* Remove VID from port VLAN filter */
--	mutex_lock(&mdev->state_lock);
--	if (!mlx4_find_cached_vlan(mdev->dev, priv->port, vid, &idx))
--		mlx4_unregister_vlan(mdev->dev, priv->port, idx);
-+	idx = vid >> 3;
-+	field = 1 << (vid & 0x7);
-+	if (priv->vlan_register[idx] & field)
-+		priv->vlan_register[idx] &= ~field;
- 	else
--		en_dbg(HW, priv, "could not find vid %d in cache\n", vid);
--
--	if (mdev->device_up && priv->port_up) {
--		err = mlx4_SET_VLAN_FLTR(mdev->dev, priv->port, priv->vlgrp);
--		if (err)
--			en_err(priv, "Failed configuring VLAN filter\n");
--	}
--	mutex_unlock(&mdev->state_lock);
-+		priv->vlan_unregister[idx] |= field;
-+	spin_unlock_bh(&priv->vlan_lock);
- }
- 
- u64 mlx4_en_mac_to_u64(u8 *addr)
-@@ -632,6 +617,47 @@ static void mlx4_en_set_stats(struct mlx4_en_priv *priv,
- 	spin_unlock_bh(&priv->stats_lock);
- }
- 
-+static void mlx4_en_handle_vlans(struct mlx4_en_priv *priv)
-+{
-+	u8 vlan_register[MLX4_VLREG_SIZE];
-+	u8 vlan_unregister[MLX4_VLREG_SIZE];
-+	int i, j, idx;
-+	u16 vid;
-+
-+	/* cache the vlan data for processing 
-+	 * done under lock to avoid changes during work */
-+	spin_lock_bh(&priv->vlan_lock);
-+	for (i = 0; i < MLX4_VLREG_SIZE; i++) {
-+		vlan_register[i] = priv->vlan_register[i];
-+		priv->vlan_register[i] = 0;
-+		vlan_unregister[i] = priv->vlan_unregister[i];
-+		priv->vlan_unregister[i] = 0;
-+	}
-+	priv->vlgrp_modified = false;
-+	spin_unlock_bh(&priv->vlan_lock);
-+
-+	/* Configure the vlan filter 
-+	 * The vlgrp is updated with all the vids that need to be allowed */
-+	if (mlx4_SET_VLAN_FLTR(priv->mdev->dev, priv->port, priv->vlgrp))
-+		en_err(priv, "Failed configuring VLAN filter\n");
-+
-+	/* Configure the VLAN table */
-+	for (i = 0; i < MLX4_VLREG_SIZE; i++) {
-+		for (j = 0; j < 8; j++) {
-+			vid = (i << 3) + j;
-+			if (vlan_register[i] & (1 << j))
-+				if (mlx4_register_vlan(priv->mdev->dev, priv->port, vid, &idx))
-+					en_dbg(HW, priv, "failed registering vlan %d\n", vid);
-+			if (vlan_unregister[i] & (1 << j)) {
-+				if (!mlx4_find_cached_vlan(priv->mdev->dev, priv->port, vid, &idx))
-+					mlx4_unregister_vlan(priv->mdev->dev, priv->port, idx);
-+				else
-+					en_dbg(HW, priv, "could not find vid %d in cache\n", vid);
-+			}
-+		}
-+	}
-+}
-+
- static void mlx4_en_do_get_stats(struct work_struct *work)
- {
- 	struct delayed_work *delay = to_delayed_work(work);
-@@ -649,10 +675,15 @@ static void mlx4_en_do_get_stats(struct work_struct *work)
- 	else
- 		en_dbg(HW, priv, "Could not update stats \n");
- 
-+
- 	mutex_lock(&mdev->state_lock);
- 	if (mdev->device_up) {
--		if (priv->port_up)
-+		if (priv->port_up) {
-+			if (priv->vlgrp_modified)
-+				mlx4_en_handle_vlans(priv);
-+
- 			mlx4_en_auto_moderation(priv);
-+		}
- 
- 		queue_delayed_work(mdev->workqueue, &priv->stats_task, STATS_DELAY);
- 	}
-@@ -1171,6 +1202,7 @@ int mlx4_en_init_netdev(struct mlx4_en_dev *mdev, int port,
- 	priv->mac_index = -1;
- 	priv->msg_enable = MLX4_EN_MSG_LEVEL;
- 	spin_lock_init(&priv->stats_lock);
-+	spin_lock_init(&priv->vlan_lock);
- 	INIT_WORK(&priv->mcast_task, mlx4_en_do_set_multicast);
- 	INIT_WORK(&priv->mac_task, mlx4_en_do_set_mac);
- 	INIT_WORK(&priv->watchdog_task, mlx4_en_restart);
-diff --git a/drivers/net/mlx4/mlx4_en.h b/drivers/net/mlx4/mlx4_en.h
-index 18b31a2..31bbbf6 100644
---- a/drivers/net/mlx4/mlx4_en.h
-+++ b/drivers/net/mlx4/mlx4_en.h
-@@ -490,6 +490,11 @@ struct mlx4_en_priv {
- 	struct mlx4_en_port_profile *prof;
- 	struct net_device *dev;
- 	struct vlan_group *vlgrp;
-+	bool vlgrp_modified;
-+#define MLX4_VLREG_SIZE	512
-+	u8 vlan_register[MLX4_VLREG_SIZE];
-+	u8 vlan_unregister[MLX4_VLREG_SIZE];
-+	spinlock_t vlan_lock;
- 	struct net_device_stats stats;
- 	struct net_device_stats ret_stats;
- 	struct mlx4_en_port_state port_state;
--- 
-1.7.1.1
-
-- 
1.7.6



---------------------------------------------------------------
This email, along with any attachments, is confidential. If you 
believe you received this message in error, please contact the 
sender immediately and delete all copies of the message.  
Thank you.




More information about the ewg mailing list