aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/core/cma.c
diff options
context:
space:
mode:
authorSomnath Kotur <Somnath.Kotur@Avagotech.Com>2015-12-23 14:56:51 +0200
committerDoug Ledford <dledford@redhat.com>2015-12-23 10:35:11 -0500
commitc865f24628b9310e1815d59f723a34ea3df4890f (patch)
treee750ee0e0e8170bb1c4c6ae274a222724ea9ba72 /drivers/infiniband/core/cma.c
parentIB/core: Add ROCE_UDP_ENCAP (RoCE V2) type (diff)
downloadlinux-dev-c865f24628b9310e1815d59f723a34ea3df4890f.tar.xz
linux-dev-c865f24628b9310e1815d59f723a34ea3df4890f.zip
IB/core: Add rdma_network_type to wc
Providers should tell IB core the wc's network type. This is used in order to search for the proper GID in the GID table. When using HCAs that can't provide this info, IB core tries to deep examine the packet and extract the GID type by itself. We choose sgid_index and type from all the matching entries in RDMA-CM based on hint from the IP stack and we set hop_limit for the IP packet based on above hint from IP stack. Signed-off-by: Matan Barak <matanb@mellanox.com> Signed-off-by: Somnath Kotur <Somnath.Kotur@Avagotech.Com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/core/cma.c')
-rw-r--r--drivers/infiniband/core/cma.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/drivers/infiniband/core/cma.c b/drivers/infiniband/core/cma.c
index 446323a9d38f..0a29d6083b77 100644
--- a/drivers/infiniband/core/cma.c
+++ b/drivers/infiniband/core/cma.c
@@ -2291,6 +2291,7 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
{
struct rdma_route *route = &id_priv->id.route;
struct rdma_addr *addr = &route->addr;
+ enum ib_gid_type network_gid_type;
struct cma_work *work;
int ret;
struct net_device *ndev = NULL;
@@ -2329,7 +2330,15 @@ static int cma_resolve_iboe_route(struct rdma_id_private *id_priv)
rdma_ip2gid((struct sockaddr *)&id_priv->id.route.addr.dst_addr,
&route->path_rec->dgid);
- route->path_rec->hop_limit = 1;
+ /* Use the hint from IP Stack to select GID Type */
+ network_gid_type = ib_network_to_gid_type(addr->dev_addr.network);
+ if (addr->dev_addr.network != RDMA_NETWORK_IB) {
+ route->path_rec->gid_type = network_gid_type;
+ /* TODO: get the hoplimit from the inet/inet6 device */
+ route->path_rec->hop_limit = IPV6_DEFAULT_HOPLIMIT;
+ } else {
+ route->path_rec->hop_limit = 1;
+ }
route->path_rec->reversible = 1;
route->path_rec->pkey = cpu_to_be16(0xffff);
route->path_rec->mtu_selector = IB_SA_EQ;