[ewg] [PATCH] RDMA/nes: Add RHEL6.2 Backports

Faisal Latif faisal.latif at intel.com
Mon Apr 23 07:45:51 PDT 2012


Add RHEL 6.2 Backport support

Signed-off-by: Faisal Latif <faisal.latif at intel.com>
---
 .../2.6.32-EL6.2/09-nes-RHEL6.2-backports.patch    |  261 ++++++++++++++++++++
 1 files changed, 261 insertions(+), 0 deletions(-)
 create mode 100644 backports/2.6.32-EL6.2/09-nes-RHEL6.2-backports.patch

diff --git a/backports/2.6.32-EL6.2/09-nes-RHEL6.2-backports.patch b/backports/2.6.32-EL6.2/09-nes-RHEL6.2-backports.patch
new file mode 100644
index 0000000..c6090f4
--- /dev/null
+++ b/backports/2.6.32-EL6.2/09-nes-RHEL6.2-backports.patch
@@ -0,0 +1,261 @@
+From 40c9be2518262d444504619daf15205e211d17d5 Mon Sep 17 00:00:00 2001
+From: Faisal Latif <faisal.latif at intel.com>
+Date: Sat, 21 Apr 2012 18:17:40 -0500
+Subject: [PATCH] nes: backport for RHEL6.2
+
+Add RHEL6.2 backports
+
+Signed-off-by: Faisal Latif <faisal.latif at intel.com>
+---
+ drivers/infiniband/hw/nes/nes.c     |    3 +-
+ drivers/infiniband/hw/nes/nes_cm.c  |   14 ++--
+ drivers/infiniband/hw/nes/nes_nic.c |  116 ++++++++++++-----------------------
+ 3 files changed, 48 insertions(+), 85 deletions(-)
+
+diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
+index 5965b3d..28e7ebc 100644
+--- a/drivers/infiniband/hw/nes/nes.c
++++ b/drivers/infiniband/hw/nes/nes.c
+@@ -150,8 +150,7 @@ static int nes_inetaddr_event(struct notifier_block *notifier,
+ 				nesdev, nesdev->netdev[0]->name);
+ 		netdev = nesdev->netdev[0];
+ 		nesvnic = netdev_priv(netdev);
+-		is_bonded = netif_is_bond_slave(netdev) &&
+-			    (netdev->master == event_netdev);
++		is_bonded = (netdev->master == event_netdev);
+ 		if ((netdev == event_netdev) || is_bonded) {
+ 			if (nesvnic->rdma_enabled == 0) {
+ 				nes_debug(NES_DBG_NETDEV, "Returning without processing event for %s since"
+diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
+index 0a52d72..bc01b81 100644
+--- a/drivers/infiniband/hw/nes/nes_cm.c
++++ b/drivers/infiniband/hw/nes/nes_cm.c
+@@ -1331,19 +1331,21 @@ static inline int mini_cm_accelerated(struct nes_cm_core *cm_core,
+ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpindex)
+ {
+ 	struct rtable *rt;
++	struct flowi fl;
+ 	struct neighbour *neigh;
+ 	int rc = arpindex;
+ 	struct net_device *netdev;
+ 	struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
+
+-	rt = ip_route_output(&init_net, htonl(dst_ip), 0, 0, 0);
+-	if (IS_ERR(rt)) {
++	memset(&fl, 0, sizeof fl);
++	fl.nl_u.ip4_u.daddr = htonl(dst_ip);
++	if (ip_route_output_key(&init_net, &rt, &fl)) {
+ 		printk(KERN_ERR "%s: ip_route_output_key failed for 0x%08X\n",
+-		       __func__, dst_ip);
++				__func__, dst_ip);
+ 		return rc;
+ 	}
+
+-	if (netif_is_bond_slave(nesvnic->netdev))
++	if (nesvnic->netdev->master)
+ 		netdev = nesvnic->netdev->master;
+ 	else
+ 		netdev = nesvnic->netdev;
+@@ -1378,9 +1380,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
+ 	}
+
+ 	if ((neigh == NULL) || (!(neigh->nud_state & NUD_VALID))) {
+-		rcu_read_lock();
+-		neigh_event_send(dst_get_neighbour(&rt->dst), NULL);
+-		rcu_read_unlock();
++		neigh_event_send(rt->u.dst.neighbour, NULL);
+ 	}
+ 	ip_rt_put(rt);
+ 	return rc;
+diff --git a/drivers/infiniband/hw/nes/nes_nic.c b/drivers/infiniband/hw/nes/nes_nic.c
+index c00d2f3..89d06f7 100644
+--- a/drivers/infiniband/hw/nes/nes_nic.c
++++ b/drivers/infiniband/hw/nes/nes_nic.c
+@@ -865,6 +865,7 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
+ 	struct nes_vnic *nesvnic = netdev_priv(netdev);
+ 	struct nes_device *nesdev = nesvnic->nesdev;
+ 	struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
++	struct dev_mc_list *multicast_addr;
+ 	u32 nic_active_bit;
+ 	u32 nic_active;
+ 	u32 perfect_filter_register_address;
+@@ -877,7 +878,6 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
+ 					nics_per_function, 4);
+ 	u8 max_pft_entries_avaiable = NES_PFT_SIZE - pft_entries_preallocated;
+ 	unsigned long flags;
+-	int mc_count = netdev_mc_count(netdev);
+
+ 	spin_lock_irqsave(&nesadapter->resource_lock, flags);
+ 	nic_active_bit = 1 << nesvnic->nic_index;
+@@ -907,61 +907,46 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
+ 		  mc_count, !!(netdev->flags & IFF_PROMISC),
+ 		  !!(netdev->flags & IFF_ALLMULTI));
+ 	if (!mc_all_on) {
+-		char *addrs;
+-		int i;
+-		struct netdev_hw_addr *ha;
+-
+-		addrs = kmalloc(ETH_ALEN * mc_count, GFP_ATOMIC);
+-		if (!addrs) {
+-			set_allmulti(nesdev, nic_active_bit);
+-			goto unlock;
+-		}
+-		i = 0;
+-		netdev_for_each_mc_addr(ha, netdev)
+-			memcpy(get_addr(addrs, i++), ha->addr, ETH_ALEN);
+-
++		multicast_addr = netdev->mc_list;
+ 		perfect_filter_register_address = NES_IDX_PERFECT_FILTER_LOW +
+-						pft_entries_preallocated * 0x8;
+-		for (i = 0, mc_index = 0; mc_index < max_pft_entries_avaiable;
+-		     mc_index++) {
+-			while (i < mc_count && nesvnic->mcrq_mcast_filter &&
+-			((mc_nic_index = nesvnic->mcrq_mcast_filter(nesvnic,
+-					get_addr(addrs, i++))) == 0));
++			pft_entries_preallocated * 0x8;
++		for (mc_index = 0; mc_index < max_pft_entries_avaiable;
++				mc_index++) {
++			while (multicast_addr && nesvnic->mcrq_mcast_filter &&
++				((mc_nic_index = nesvnic->mcrq_mcast_filter(nesvnic,
++						    multicast_addr->dmi_addr)) == 0)) {
++				multicast_addr = multicast_addr->next;
++			}
+ 			if (mc_nic_index < 0)
+-				mc_nic_index = nesvnic->nic_index;
++				mc_nic_index = (1 << nesvnic->nic_index);
+ 			while (nesadapter->pft_mcast_map[mc_index] < 16 &&
+ 				nesadapter->pft_mcast_map[mc_index] !=
+ 					nesvnic->nic_index &&
+ 					mc_index < max_pft_entries_avaiable) {
+ 						nes_debug(NES_DBG_NIC_RX,
+-					"mc_index=%d skipping nic_index=%d, "
+-					"used for=%d \n", mc_index,
++					"mc_index=%d skipping nic_index=%d,\
++					used for=%d \n", mc_index,
+ 					nesvnic->nic_index,
+ 					nesadapter->pft_mcast_map[mc_index]);
+ 				mc_index++;
+ 			}
+ 			if (mc_index >= max_pft_entries_avaiable)
+ 				break;
+-			if (i < mc_count) {
+-				char *addr = get_addr(addrs, i++);
+-
+-				nes_debug(NES_DBG_NIC_RX, "Assigning MC Address %pM to register 0x%04X nic_idx=%d\n",
+-					  addr,
+-					  perfect_filter_register_address+(mc_index * 8),
+-					  mc_nic_index);
+-				macaddr_high  = ((u16) addr[0]) << 8;
+-				macaddr_high += (u16) addr[1];
+-				macaddr_low   = ((u32) addr[2]) << 24;
+-				macaddr_low  += ((u32) addr[3]) << 16;
+-				macaddr_low  += ((u32) addr[4]) << 8;
+-				macaddr_low  += (u32) addr[5];
++			if (multicast_addr) {
++				macaddr_high  = ((u16)multicast_addr->dmi_addr[0]) << 8;
++				macaddr_high += (u16)multicast_addr->dmi_addr[1];
++				macaddr_low   = ((u32)multicast_addr->dmi_addr[2]) << 24;
++				macaddr_low  += ((u32)multicast_addr->dmi_addr[3]) << 16;
++				macaddr_low  += ((u32)multicast_addr->dmi_addr[4]) << 8;
++				macaddr_low  += (u32)multicast_addr->dmi_addr[5];
+ 				nes_write_indexed(nesdev,
+ 						perfect_filter_register_address+(mc_index * 8),
+ 						macaddr_low);
+ 				nes_write_indexed(nesdev,
+ 						perfect_filter_register_address+4+(mc_index * 8),
+ 						(u32)macaddr_high | NES_MAC_ADDR_VALID |
+-						((((u32)(1<<mc_nic_index)) << 16)));
++						((((u32)(mc_nic_index)) << 16)));
++				multicast_addr = multicast_addr->next;
+ 				nesadapter->pft_mcast_map[mc_index] =
+ 							nesvnic->nic_index;
+ 			} else {
+@@ -973,13 +958,20 @@ static void nes_netdev_set_multicast_list(struct net_device *netdev)
+ 				nesadapter->pft_mcast_map[mc_index] = 255;
+ 			}
+ 		}
+-		kfree(addrs);
+ 		/* PFT is not large enough */
+-		if (i < mc_count)
+-			set_allmulti(nesdev, nic_active_bit);
++		if (multicast_addr && multicast_addr->next) {
++			nic_active = nes_read_indexed(nesdev,
++						NES_IDX_NIC_MULTICAST_ALL);
++			nic_active |= nic_active_bit;
++			nes_write_indexed(nesdev, NES_IDX_NIC_MULTICAST_ALL,
++								nic_active);
++			nic_active = nes_read_indexed(nesdev,
++						NES_IDX_NIC_UNICAST_ALL);
++			nic_active &= ~nic_active_bit;
++			nes_write_indexed(nesdev, NES_IDX_NIC_UNICAST_ALL,
++								nic_active);
++		}
+ 	}
+-
+-unlock:
+ 	spin_unlock_irqrestore(&nesadapter->resource_lock, flags);
+ }
+
+@@ -1610,32 +1602,6 @@ static void nes_vlan_mode(struct net_device *netdev, struct nes_device *nesdev,
+ 	spin_unlock_irqrestore(&nesadapter->phy_lock, flags);
+ }
+
+-static u32 nes_fix_features(struct net_device *netdev, u32 features)
+-{
+-	/*
+-	 * Since there is no support for separate rx/tx vlan accel
+-	 * enable/disable make sure tx flag is always in same state as rx.
+-	 */
+-	if (features & NETIF_F_HW_VLAN_RX)
+-		features |= NETIF_F_HW_VLAN_TX;
+-	else
+-		features &= ~NETIF_F_HW_VLAN_TX;
+-
+-	return features;
+-}
+-
+-static int nes_set_features(struct net_device *netdev, u32 features)
+-{
+-	struct nes_vnic *nesvnic = netdev_priv(netdev);
+-	struct nes_device *nesdev = nesvnic->nesdev;
+-	u32 changed = netdev->features ^ features;
+-
+-	if (changed & NETIF_F_HW_VLAN_RX)
+-		nes_vlan_mode(netdev, nesdev, features);
+-
+-	return 0;
+-}
+-
+ static const struct net_device_ops nes_netdev_ops = {
+ 	.ndo_open		= nes_netdev_open,
+ 	.ndo_stop		= nes_netdev_stop,
+@@ -1646,8 +1612,6 @@ 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,
+-	.ndo_fix_features	= nes_fix_features,
+-	.ndo_set_features	= nes_set_features,
+ };
+
+ /**
+@@ -1711,12 +1675,12 @@ 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->hw_features = NETIF_F_RXCSUM | NETIF_F_SG | NETIF_F_IP_CSUM |
+-			      NETIF_F_HW_VLAN_RX;
+-	if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV))
+-		netdev->hw_features |= NETIF_F_TSO;
+-	netdev->features |= netdev->hw_features;
+-	netdev->hw_features |= NETIF_F_LRO;
++	if ((nesvnic->logical_port < 2) || (nesdev->nesadapter->hw_rev != NE020_REV)) {
++		netdev->features |= NETIF_F_TSO | NETIF_F_SG | NETIF_F_IP_CSUM;
++		netdev->features |= NETIF_F_GSO | NETIF_F_TSO | NETIF_F_SG | NETIF_F_IP_CSUM;
++	} else {
++		netdev->features |= NETIF_F_SG | NETIF_F_IP_CSUM;
++	}
+
+ 	nes_debug(NES_DBG_INIT, "nesvnic = %p, reported features = 0x%lX, QPid = %d,"
+ 			" nic_index = %d, logical_port = %d, mac_index = %d.\n",
+--
+1.7.1
+
-- 
1.7.1




More information about the ewg mailing list