[ewg] [PATCH] RDMA/nes: Updated backports

Tatyana Nikolova Tatyana.E.Nikolova at intel.com
Sat Aug 25 18:39:12 PDT 2012


OFED-3.5/NES: Updated backports to be applied on top of the previously submitted backport patch.

Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova at intel.com>
---
 drivers/infiniband/hw/nes/nes_hw.c  |   11 ++++++++
 drivers/infiniband/hw/nes/nes_hw.h  |    3 ++
 drivers/infiniband/hw/nes/nes_nic.c |   49 ++++++++++++++++++++++++++++------
 3 files changed, 54 insertions(+), 9 deletions(-)

diff --git a/drivers/infiniband/hw/nes/nes_hw.c b/drivers/infiniband/hw/nes/nes_hw.c
index d42c9f4..151cefe 100644
--- a/drivers/infiniband/hw/nes/nes_hw.c
+++ b/drivers/infiniband/hw/nes/nes_hw.c
@@ -2951,7 +2951,18 @@ void nes_nic_ce_handler(struct nes_device *nesdev, struct nes_hw_nic_cq *cq)
 					nes_debug(NES_DBG_CQ, "%s: Reporting stripped VLAN packet. Tag = 0x%04X\n",
 							nesvnic->netdev->name, vlan_tag);
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
+					if (nesvnic->vlan_grp != NULL) {
+						if (nes_use_lro)
+							lro_vlan_hwaccel_receive_skb(&nesvnic->lro_mgr, rx_skb,
+								nesvnic->vlan_grp, vlan_tag, NULL);
+						else
+							vlan_hwaccel_receive_skb(rx_skb, nesvnic->vlan_grp, vlan_tag);
+						goto skip_rx_indicate0;
+					}
+#endif
 					__vlan_hwaccel_put_tag(rx_skb, vlan_tag);
+
 				}
 				if (nes_use_lro)
 					lro_receive_skb(&nesvnic->lro_mgr, rx_skb, NULL);
diff --git a/drivers/infiniband/hw/nes/nes_hw.h b/drivers/infiniband/hw/nes/nes_hw.h
index d748e4b..b4a31de 100644
--- a/drivers/infiniband/hw/nes/nes_hw.h
+++ b/drivers/infiniband/hw/nes/nes_hw.h
@@ -1236,6 +1236,9 @@ struct nes_vnic {
 	/* void *mem; */
 	struct nes_device *nesdev;
 	struct net_device *netdev;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
+	struct vlan_group *vlan_grp;
+#endif
 	atomic_t          rx_skbs_needed;
 	atomic_t          rx_skb_timer_running;
 	int               budget;
diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
index 8544d0a..864469f 100644
--- a/drivers/infiniband/hw/nes/nes_nic.c
+++ b/drivers/infiniband/hw/nes/nes_nic.c
@@ -1597,6 +1597,33 @@ static const struct ethtool_ops nes_ethtool_ops = {
 	.set_pauseparam = nes_netdev_set_pauseparam,
 };
 
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
+static void nes_netdev_vlan_rx_register(struct net_device *netdev, struct vlan_group *grp)
+{
+	struct nes_vnic *nesvnic = netdev_priv(netdev);
+	struct nes_device *nesdev = nesvnic->nesdev;
+	struct nes_adapter *nesadapter = nesdev->nesadapter;
+	u32 u32temp;
+	unsigned long flags;
+
+	spin_lock_irqsave(&nesadapter->phy_lock, flags);
+	nesvnic->vlan_grp = grp;
+
+	nes_debug(NES_DBG_NETDEV, "%s: %s\n", __func__, netdev->name);
+
+	/* Enable/Disable VLAN Stripping */
+	u32temp = nes_read_indexed(nesdev, NES_IDX_PCIX_DIAG);
+	if (grp)
+		u32temp &= 0xfdffffff;
+	else
+		u32temp |= 0x02000000;
+
+	nes_write_indexed(nesdev, NES_IDX_PCIX_DIAG, u32temp);
+	spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
+}
+#endif
+
 static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev, netdev_features_t features)
 {
 	struct nes_adapter *nesadapter = nesdev->nesadapter;
@@ -1618,6 +1645,7 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev,
 	spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
 }
 
+
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
 static netdev_features_t nes_fix_features(struct net_device *netdev, netdev_features_t features)
 {
@@ -1656,6 +1684,9 @@ static const struct net_device_ops nes_netdev_ops = {
 	.ndo_set_rx_mode	= nes_netdev_set_multicast_list,
 	.ndo_change_mtu		= nes_netdev_change_mtu,
 	.ndo_validate_addr	= eth_validate_addr,
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,1,0))
+	.ndo_vlan_rx_register   = nes_netdev_vlan_rx_register,
+#endif
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
 	.ndo_fix_features	= nes_fix_features,
 	.ndo_set_features	= nes_set_features,
@@ -1691,12 +1722,10 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
 	netdev->hard_header_len = ETH_HLEN;
 	netdev->addr_len = ETH_ALEN;
 	netdev->type = ARPHRD_ETHER;
-	netdev->features = NETIF_F_HIGHDMA;
 	netdev->netdev_ops = &nes_netdev_ops;
 	netdev->ethtool_ops = &nes_ethtool_ops;
 	netif_napi_add(netdev, &nesvnic->napi, nes_netdev_poll, 128);
 	nes_debug(NES_DBG_INIT, "Enabling VLAN Insert/Delete.\n");
-	netdev->features |= NETIF_F_HW_VLAN_TX;
 
 	/* Fill in the port structure */
 	nesvnic->netdev = netdev;
@@ -1723,19 +1752,20 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
 	netdev->dev_addr[5] = (u8)u64temp;
 	memcpy(netdev->perm_addr, netdev->dev_addr, 6);
 
-	netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
+	netdev->features = NETIF_F_SG | NETIF_F_IP_CSUM | NETIF_F_RXCSUM | NETIF_F_HW_VLAN_RX;
 
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
-	netdev->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM |
-			      NETIF_F_HW_VLAN_RX;
-	netdev->features |= netdev->hw_features;
-	netdev->hw_features |= NETIF_F_LRO;
+	netdev->hw_features |= netdev->features | NETIF_F_LRO;
 #endif
+	netdev->features |= NETIF_F_HIGHDMA | NETIF_F_HW_VLAN_TX;
+
 	if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) {
+#if (LINUX_VERSION_CODE <= KERNEL_VERSION(3,3,0))
+		netdev->features |= NETIF_F_TSO;
 #if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,39))
 		netdev->hw_features |= NETIF_F_TSO;
 #endif
-		netdev->features |= NETIF_F_TSO | NETIF_F_GSO;
+#endif
 	}
 
 	nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
@@ -1864,8 +1894,9 @@ struct net_device *nes_netdev_init(struct nes_device *nesdev,
 		nes_init_phy(nesdev);
 	}
 
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,1,0))
 	nes_vlan_mode(netdev, nesdev, netdev->features);
-
+#endif
 	return netdev;
 }
 
-- 
1.7.4.2




More information about the ewg mailing list