aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/cxgb4/cm.c
diff options
context:
space:
mode:
authorSteve Wise <swise@opengridcomputing.com>2013-07-04 06:40:44 -0400
committerRoland Dreier <roland@purestorage.com>2013-08-12 15:32:31 -0400
commit24d44a391f1b5d56e9c7a4fc1edd085687864ff9 (patch)
tree3076b01a1b85d6b21d08f615a44a4b7c2f5b5acb /drivers/infiniband/hw/cxgb4/cm.c
parentc095ba7224d8edc71dcef0d655911399a8bd4a3f (diff)
RDMA/cma: Add IPv6 support for iWARP
Modify the type of local_addr and remote_addr fields in struct iw_cm_id from struct sockaddr_in to struct sockaddr_storage to hold IPv6 and IPv4 addresses uniformly. Change the references of local_addr and remote_addr in cxgb4, cxgb3, nes and amso drivers to match this. However to be able to actully run traffic over IPv6, low-level drivers have to add code to support this. Signed-off-by: Steve Wise <swise@opengridcomputing.com> Reviewed-by: Sean Hefty <sean.hefty@intel.com> [ Fix unused variable warnings when INFINIBAND_NES_DEBUG not set. - Roland ] Signed-off-by: Roland Dreier <roland@purestorage.com>
Diffstat (limited to 'drivers/infiniband/hw/cxgb4/cm.c')
-rw-r--r--drivers/infiniband/hw/cxgb4/cm.c55
1 files changed, 29 insertions, 26 deletions
diff --git a/drivers/infiniband/hw/cxgb4/cm.c b/drivers/infiniband/hw/cxgb4/cm.c
index 65c30ea8c1a1..76d8812f9e9a 100644
--- a/drivers/infiniband/hw/cxgb4/cm.c
+++ b/drivers/infiniband/hw/cxgb4/cm.c
@@ -952,8 +952,10 @@ static void connect_reply_upcall(struct c4iw_ep *ep, int status)
952 memset(&event, 0, sizeof(event)); 952 memset(&event, 0, sizeof(event));
953 event.event = IW_CM_EVENT_CONNECT_REPLY; 953 event.event = IW_CM_EVENT_CONNECT_REPLY;
954 event.status = status; 954 event.status = status;
955 event.local_addr = ep->com.local_addr; 955 memcpy(&event.local_addr, &ep->com.local_addr,
956 event.remote_addr = ep->com.remote_addr; 956 sizeof(ep->com.local_addr));
957 memcpy(&event.remote_addr, &ep->com.remote_addr,
958 sizeof(ep->com.remote_addr));
957 959
958 if ((status == 0) || (status == -ECONNREFUSED)) { 960 if ((status == 0) || (status == -ECONNREFUSED)) {
959 if (!ep->tried_with_mpa_v1) { 961 if (!ep->tried_with_mpa_v1) {
@@ -989,8 +991,10 @@ static void connect_request_upcall(struct c4iw_ep *ep)
989 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid); 991 PDBG("%s ep %p tid %u\n", __func__, ep, ep->hwtid);
990 memset(&event, 0, sizeof(event)); 992 memset(&event, 0, sizeof(event));
991 event.event = IW_CM_EVENT_CONNECT_REQUEST; 993 event.event = IW_CM_EVENT_CONNECT_REQUEST;
992 event.local_addr = ep->com.local_addr; 994 memcpy(&event.local_addr, &ep->com.local_addr,
993 event.remote_addr = ep->com.remote_addr; 995 sizeof(ep->com.local_addr));
996 memcpy(&event.remote_addr, &ep->com.remote_addr,
997 sizeof(ep->com.remote_addr));
994 event.provider_data = ep; 998 event.provider_data = ep;
995 if (!ep->tried_with_mpa_v1) { 999 if (!ep->tried_with_mpa_v1) {
996 /* this means MPA_v2 is used */ 1000 /* this means MPA_v2 is used */
@@ -1568,6 +1572,10 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
1568 struct net_device *pdev; 1572 struct net_device *pdev;
1569 int step; 1573 int step;
1570 struct neighbour *neigh; 1574 struct neighbour *neigh;
1575 struct sockaddr_in *laddr = (struct sockaddr_in *)
1576 &ep->com.cm_id->local_addr;
1577 struct sockaddr_in *raddr = (struct sockaddr_in *)
1578 &ep->com.cm_id->remote_addr;
1571 1579
1572 PDBG("%s qp %p cm_id %p\n", __func__, ep->com.qp, ep->com.cm_id); 1580 PDBG("%s qp %p cm_id %p\n", __func__, ep->com.qp, ep->com.cm_id);
1573 init_timer(&ep->timer); 1581 init_timer(&ep->timer);
@@ -1585,10 +1593,8 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
1585 1593
1586 /* find a route */ 1594 /* find a route */
1587 rt = find_route(ep->com.dev, 1595 rt = find_route(ep->com.dev,
1588 ep->com.cm_id->local_addr.sin_addr.s_addr, 1596 laddr->sin_addr.s_addr, raddr->sin_addr.s_addr,
1589 ep->com.cm_id->remote_addr.sin_addr.s_addr, 1597 laddr->sin_port, raddr->sin_port, 0);
1590 ep->com.cm_id->local_addr.sin_port,
1591 ep->com.cm_id->remote_addr.sin_port, 0);
1592 if (!rt) { 1598 if (!rt) {
1593 pr_err("%s - cannot find route.\n", __func__); 1599 pr_err("%s - cannot find route.\n", __func__);
1594 err = -EHOSTUNREACH; 1600 err = -EHOSTUNREACH;
@@ -1596,8 +1602,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
1596 } 1602 }
1597 ep->dst = &rt->dst; 1603 ep->dst = &rt->dst;
1598 1604
1599 neigh = dst_neigh_lookup(ep->dst, 1605 neigh = dst_neigh_lookup(ep->dst, &raddr->sin_addr.s_addr);
1600 &ep->com.cm_id->remote_addr.sin_addr.s_addr);
1601 if (!neigh) { 1606 if (!neigh) {
1602 pr_err("%s - cannot alloc neigh.\n", __func__); 1607 pr_err("%s - cannot alloc neigh.\n", __func__);
1603 err = -ENOMEM; 1608 err = -ENOMEM;
@@ -1607,8 +1612,7 @@ static int c4iw_reconnect(struct c4iw_ep *ep)
1607 /* get a l2t entry */ 1612 /* get a l2t entry */
1608 if (neigh->dev->flags & IFF_LOOPBACK) { 1613 if (neigh->dev->flags & IFF_LOOPBACK) {
1609 PDBG("%s LOOPBACK\n", __func__); 1614 PDBG("%s LOOPBACK\n", __func__);
1610 pdev = ip_dev_find(&init_net, 1615 pdev = ip_dev_find(&init_net, raddr->sin_addr.s_addr);
1611 ep->com.cm_id->remote_addr.sin_addr.s_addr);
1612 ep->l2t = cxgb4_l2t_get(ep->com.dev->rdev.lldi.l2t, 1616 ep->l2t = cxgb4_l2t_get(ep->com.dev->rdev.lldi.l2t,
1613 neigh, pdev, 0); 1617 neigh, pdev, 0);
1614 pi = (struct port_info *)netdev_priv(pdev); 1618 pi = (struct port_info *)netdev_priv(pdev);
@@ -2518,6 +2522,8 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2518 struct c4iw_ep *ep; 2522 struct c4iw_ep *ep;
2519 struct rtable *rt; 2523 struct rtable *rt;
2520 int err = 0; 2524 int err = 0;
2525 struct sockaddr_in *laddr = (struct sockaddr_in *)&cm_id->local_addr;
2526 struct sockaddr_in *raddr = (struct sockaddr_in *)&cm_id->remote_addr;
2521 2527
2522 if ((conn_param->ord > c4iw_max_read_depth) || 2528 if ((conn_param->ord > c4iw_max_read_depth) ||
2523 (conn_param->ird > c4iw_max_read_depth)) { 2529 (conn_param->ird > c4iw_max_read_depth)) {
@@ -2562,17 +2568,12 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2562 insert_handle(dev, &dev->atid_idr, ep, ep->atid); 2568 insert_handle(dev, &dev->atid_idr, ep, ep->atid);
2563 2569
2564 PDBG("%s saddr 0x%x sport 0x%x raddr 0x%x rport 0x%x\n", __func__, 2570 PDBG("%s saddr 0x%x sport 0x%x raddr 0x%x rport 0x%x\n", __func__,
2565 ntohl(cm_id->local_addr.sin_addr.s_addr), 2571 ntohl(laddr->sin_addr.s_addr), ntohs(laddr->sin_port),
2566 ntohs(cm_id->local_addr.sin_port), 2572 ntohl(raddr->sin_addr.s_addr), ntohs(raddr->sin_port));
2567 ntohl(cm_id->remote_addr.sin_addr.s_addr),
2568 ntohs(cm_id->remote_addr.sin_port));
2569 2573
2570 /* find a route */ 2574 /* find a route */
2571 rt = find_route(dev, 2575 rt = find_route(dev, laddr->sin_addr.s_addr, raddr->sin_addr.s_addr,
2572 cm_id->local_addr.sin_addr.s_addr, 2576 laddr->sin_port, raddr->sin_port, 0);
2573 cm_id->remote_addr.sin_addr.s_addr,
2574 cm_id->local_addr.sin_port,
2575 cm_id->remote_addr.sin_port, 0);
2576 if (!rt) { 2577 if (!rt) {
2577 printk(KERN_ERR MOD "%s - cannot find route.\n", __func__); 2578 printk(KERN_ERR MOD "%s - cannot find route.\n", __func__);
2578 err = -EHOSTUNREACH; 2579 err = -EHOSTUNREACH;
@@ -2580,8 +2581,7 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2580 } 2581 }
2581 ep->dst = &rt->dst; 2582 ep->dst = &rt->dst;
2582 2583
2583 err = import_ep(ep, cm_id->remote_addr.sin_addr.s_addr, 2584 err = import_ep(ep, raddr->sin_addr.s_addr, ep->dst, ep->com.dev, true);
2584 ep->dst, ep->com.dev, true);
2585 if (err) { 2585 if (err) {
2586 printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__); 2586 printk(KERN_ERR MOD "%s - cannot alloc l2e.\n", __func__);
2587 goto fail4; 2587 goto fail4;
@@ -2593,8 +2593,10 @@ int c4iw_connect(struct iw_cm_id *cm_id, struct iw_cm_conn_param *conn_param)
2593 2593
2594 state_set(&ep->com, CONNECTING); 2594 state_set(&ep->com, CONNECTING);
2595 ep->tos = 0; 2595 ep->tos = 0;
2596 ep->com.local_addr = cm_id->local_addr; 2596 memcpy(&ep->com.local_addr, &cm_id->local_addr,
2597 ep->com.remote_addr = cm_id->remote_addr; 2597 sizeof(ep->com.local_addr));
2598 memcpy(&ep->com.remote_addr, &cm_id->remote_addr,
2599 sizeof(ep->com.remote_addr));
2598 2600
2599 /* send connect request to rnic */ 2601 /* send connect request to rnic */
2600 err = send_connect(ep); 2602 err = send_connect(ep);
@@ -2633,7 +2635,8 @@ int c4iw_create_listen(struct iw_cm_id *cm_id, int backlog)
2633 ep->com.cm_id = cm_id; 2635 ep->com.cm_id = cm_id;
2634 ep->com.dev = dev; 2636 ep->com.dev = dev;
2635 ep->backlog = backlog; 2637 ep->backlog = backlog;
2636 ep->com.local_addr = cm_id->local_addr; 2638 memcpy(&ep->com.local_addr, &cm_id->local_addr,
2639 sizeof(ep->com.local_addr));
2637 2640
2638 /* 2641 /*
2639 * Allocate a server TID. 2642 * Allocate a server TID.