aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorTatyana Nikolova <Tatyana.E.Nikolova@intel.com>2012-09-20 15:23:14 -0400
committerRoland Dreier <roland@purestorage.com>2012-09-30 23:34:52 -0400
commitef3d0c4a5e8c7ad3429b9f9ef66cf5a7563cd513 (patch)
tree9914b85c88bb87b5af367c2a5c5b1449fbb50dd0 /drivers
parent979570e02981d4a8fc20b3cc8fd651856c98ee9d (diff)
RDMA/nes: Fix incorrect resolving of the loopback MAC address
Signed-off-by: Tatyana Nikolova <Tatyana.E.Nikolova@intel.com> Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/infiniband/hw/nes/nes_cm.c32
1 files changed, 7 insertions, 25 deletions
diff --git a/drivers/infiniband/hw/nes/nes_cm.c b/drivers/infiniband/hw/nes/nes_cm.c
index 020e95c4c4b9..49a9383137db 100644
--- a/drivers/infiniband/hw/nes/nes_cm.c
+++ b/drivers/infiniband/hw/nes/nes_cm.c
@@ -1356,7 +1356,7 @@ static int nes_addr_resolve_neigh(struct nes_vnic *nesvnic, u32 dst_ip, int arpi
1356 else 1356 else
1357 netdev = nesvnic->netdev; 1357 netdev = nesvnic->netdev;
1358 1358
1359 neigh = dst_neigh_lookup(&rt->dst, &dst_ip); 1359 neigh = neigh_lookup(&arp_tbl, &rt->rt_gateway, netdev);
1360 1360
1361 rcu_read_lock(); 1361 rcu_read_lock();
1362 if (neigh) { 1362 if (neigh) {
@@ -1465,12 +1465,8 @@ static struct nes_cm_node *make_cm_node(struct nes_cm_core *cm_core,
1465 cm_node->loopbackpartner = NULL; 1465 cm_node->loopbackpartner = NULL;
1466 1466
1467 /* get the mac addr for the remote node */ 1467 /* get the mac addr for the remote node */
1468 if (ipv4_is_loopback(htonl(cm_node->rem_addr))) { 1468 oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE);
1469 arpindex = nes_arp_table(nesdev, ntohl(nesvnic->local_ipaddr), NULL, NES_ARP_RESOLVE); 1469 arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex);
1470 } else {
1471 oldarpindex = nes_arp_table(nesdev, cm_node->rem_addr, NULL, NES_ARP_RESOLVE);
1472 arpindex = nes_addr_resolve_neigh(nesvnic, cm_info->rem_addr, oldarpindex);
1473 }
1474 if (arpindex < 0) { 1470 if (arpindex < 0) {
1475 kfree(cm_node); 1471 kfree(cm_node);
1476 return NULL; 1472 return NULL;
@@ -3153,11 +3149,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
3153 nesqp->nesqp_context->tcpPorts[1] = 3149 nesqp->nesqp_context->tcpPorts[1] =
3154 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port)); 3150 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port));
3155 3151
3156 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3152 nesqp->nesqp_context->ip0 =
3157 nesqp->nesqp_context->ip0 =
3158 cpu_to_le32(ntohl(nesvnic->local_ipaddr));
3159 else
3160 nesqp->nesqp_context->ip0 =
3161 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr)); 3153 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr));
3162 3154
3163 nesqp->nesqp_context->misc2 |= cpu_to_le32( 3155 nesqp->nesqp_context->misc2 |= cpu_to_le32(
@@ -3182,10 +3174,7 @@ int nes_accept(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
3182 memset(&nes_quad, 0, sizeof(nes_quad)); 3174 memset(&nes_quad, 0, sizeof(nes_quad));
3183 nes_quad.DstIpAdrIndex = 3175 nes_quad.DstIpAdrIndex =
3184 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24); 3176 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
3185 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3177 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3186 nes_quad.SrcIpadr = nesvnic->local_ipaddr;
3187 else
3188 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3189 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port; 3178 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
3190 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 3179 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
3191 3180
@@ -3538,11 +3527,7 @@ static void cm_event_connected(struct nes_cm_event *event)
3538 cpu_to_le16(ntohs(cm_id->local_addr.sin_port)); 3527 cpu_to_le16(ntohs(cm_id->local_addr.sin_port));
3539 nesqp->nesqp_context->tcpPorts[1] = 3528 nesqp->nesqp_context->tcpPorts[1] =
3540 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port)); 3529 cpu_to_le16(ntohs(cm_id->remote_addr.sin_port));
3541 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3530 nesqp->nesqp_context->ip0 =
3542 nesqp->nesqp_context->ip0 =
3543 cpu_to_le32(ntohl(nesvnic->local_ipaddr));
3544 else
3545 nesqp->nesqp_context->ip0 =
3546 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr)); 3531 cpu_to_le32(ntohl(cm_id->remote_addr.sin_addr.s_addr));
3547 3532
3548 nesqp->nesqp_context->misc2 |= cpu_to_le32( 3533 nesqp->nesqp_context->misc2 |= cpu_to_le32(
@@ -3571,10 +3556,7 @@ static void cm_event_connected(struct nes_cm_event *event)
3571 3556
3572 nes_quad.DstIpAdrIndex = 3557 nes_quad.DstIpAdrIndex =
3573 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24); 3558 cpu_to_le32((u32)PCI_FUNC(nesdev->pcidev->devfn) << 24);
3574 if (ipv4_is_loopback(cm_id->remote_addr.sin_addr.s_addr)) 3559 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3575 nes_quad.SrcIpadr = nesvnic->local_ipaddr;
3576 else
3577 nes_quad.SrcIpadr = cm_id->remote_addr.sin_addr.s_addr;
3578 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port; 3560 nes_quad.TcpPorts[0] = cm_id->remote_addr.sin_port;
3579 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port; 3561 nes_quad.TcpPorts[1] = cm_id->local_addr.sin_port;
3580 3562