[ewg] [PATCH 1/4] RDMA/nes: enable bonds on iw_nes

Maciej Sosnowski maciej.sosnowski at intel.com
Fri Dec 3 07:53:24 PST 2010


Enable configuring bonds on nes devices by adding
missing support for master net_device to the driver

Signed-off-by: Maciej Sosnowski <maciej.sosnowski at intel.com>
---

 kernel_patches/fixes/nes_0047_bonds.patch |   88 +++++++++++++++++++++++++++++
 1 files changed, 88 insertions(+), 0 deletions(-)

diff --git a/kernel_patches/fixes/nes_0047_bonds.patch b/kernel_patches/fixes/nes_0047_bonds.patch
new file mode 100644
index 0000000..d2141df
--- /dev/null
+++ b/kernel_patches/fixes/nes_0047_bonds.patch
@@ -0,0 +1,88 @@
+diff --git a/drivers/infiniband/hw/nes/nes.c b/drivers/infiniband/hw/nes/nes.c
+index 3817463..a7aea75 100644
+--- a/drivers/infiniband/hw/nes/nes.c
++++ b/drivers/infiniband/hw/nes/nes.c
+@@ -145,6 +145,7 @@ static int nes_inetaddr_event(struct not
+ 	struct nes_device *nesdev;
+ 	struct net_device *netdev;
+ 	struct nes_vnic *nesvnic;
++	unsigned int is_bonded;
+ 
+ 	nes_debug(NES_DBG_NETDEV, "nes_inetaddr_event: ip address %pI4, netmask %pI4.\n",
+ 		  &ifa->ifa_address, &ifa->ifa_mask);
+@@ -153,7 +154,8 @@ static int nes_inetaddr_event(struct not
+ 				nesdev, nesdev->netdev[0]->name);
+ 		netdev = nesdev->netdev[0];
+ 		nesvnic = netdev_priv(netdev);
+-		if (netdev == 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"
+ 						" RDMA is not enabled.\n",
+@@ -170,7 +172,10 @@ static int nes_inetaddr_event(struct not
+ 					nes_manage_arp_cache(netdev, netdev->dev_addr,
+ 							ntohl(nesvnic->local_ipaddr), NES_ARP_DELETE);
+ 					nesvnic->local_ipaddr = 0;
+-					return NOTIFY_OK;
++					if (is_bonded)
++						continue;
++					else
++						return NOTIFY_OK;
+ 					break;
+ 				case NETDEV_UP:
+ 					nes_debug(NES_DBG_NETDEV, "event:UP\n");
+@@ -179,15 +184,24 @@ static int nes_inetaddr_event(struct not
+ 						nes_debug(NES_DBG_NETDEV, "Interface already has local_ipaddr\n");
+ 						return NOTIFY_OK;
+ 					}
++					/* fall through */
++				case NETDEV_CHANGEADDR:
+ 					/* Add the address to the IP table */
+-					nesvnic->local_ipaddr = ifa->ifa_address;
++					if (netdev->master)
++						nesvnic->local_ipaddr =
++							((struct in_device *)netdev->master->ip_ptr)->ifa_list->ifa_address;
++					else
++						nesvnic->local_ipaddr = ifa->ifa_address;
+ 
+ 					nes_write_indexed(nesdev,
+ 							NES_IDX_DST_IP_ADDR+(0x10*PCI_FUNC(nesdev->pcidev->devfn)),
+-							ntohl(ifa->ifa_address));
++							ntohl(nesvnic->local_ipaddr));
+ 					nes_manage_arp_cache(netdev, netdev->dev_addr,
+ 							ntohl(nesvnic->local_ipaddr), NES_ARP_ADD);
+-					return NOTIFY_OK;
++					if (is_bonded)
++						continue;
++					else
++						return NOTIFY_OK;
+ 					break;
+ 				default:
+ 					break;
+diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
+index 41b4fc2..f7edf6a 100644
+--- a/drivers/infiniband/hw/nes/nes_cm.c
++++ b/drivers/infiniband/hw/nes/nes_cm.c
+@@ -1108,6 +1108,7 @@ static int nes_addr_resolve_neigh(struct
+ 	struct flowi fl;
+ 	struct neighbour *neigh;
+ 	int rc = arpindex;
++	struct net_device *netdev;
+ 	struct nes_adapter *nesadapter = nesvnic->nesdev->nesadapter;
+ 
+ 	memset(&fl, 0, sizeof fl);
+@@ -1118,7 +1119,12 @@ static int nes_addr_resolve_neigh(struct
+ 		return rc;
+ 	}
+ 
+-	neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, nesvnic->netdev);
++	if (nesvnic->netdev->master)
++		netdev = nesvnic->netdev->master;
++	else
++		netdev = nesvnic->netdev;
++
++	neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev);
+ 	if (neigh) {
+ 		if (neigh->nud_state & NUD_VALID) {
+ 			if (arpindex >= 0) {




More information about the ewg mailing list