aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/ocrdma
diff options
context:
space:
mode:
authorDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>2017-04-29 14:41:29 -0400
committerDoug Ledford <dledford@redhat.com>2017-05-01 14:32:43 -0400
commit44c58487d51a0dc43d96f1dc864f0461ec6a346a (patch)
treeedab4f4f87a0347b8abf9169cd3f030ffc6439bd /drivers/infiniband/hw/ocrdma
parentIB/core: Use rdma_ah_attr accessor functions (diff)
downloadlinux-dev-44c58487d51a0dc43d96f1dc864f0461ec6a346a.tar.xz
linux-dev-44c58487d51a0dc43d96f1dc864f0461ec6a346a.zip
IB/core: Define 'ib' and 'roce' rdma_ah_attr types
rdma_ah_attr can now be either ib or roce allowing core components to use one type or the other and also to define attributes unique to a specific type. struct ib_ah is also initialized with the type when its first created. This ensures that calls such as modify_ah dont modify the type of the address handle attribute. Reviewed-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Don Hiatt <don.hiatt@intel.com> Reviewed-by: Sean Hefty <sean.hefty@intel.com> Reviewed-by: Niranjana Vishwanathapura <niranjana.vishwanathapura@intel.com> Signed-off-by: Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'drivers/infiniband/hw/ocrdma')
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma.h2
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_ah.c6
-rw-r--r--drivers/infiniband/hw/ocrdma/ocrdma_verbs.c1
3 files changed, 6 insertions, 3 deletions
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma.h b/drivers/infiniband/hw/ocrdma/ocrdma.h
index afcbd2acf835..7baedc74e39d 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma.h
+++ b/drivers/infiniband/hw/ocrdma/ocrdma.h
@@ -537,7 +537,7 @@ static inline int ocrdma_resolve_dmac(struct ocrdma_dev *dev,
else if (rdma_link_local_addr(&in6))
rdma_get_ll_mac(&in6, mac_addr);
else
- memcpy(mac_addr, ah_attr->dmac, ETH_ALEN);
+ memcpy(mac_addr, ah_attr->roce.dmac, ETH_ALEN);
return 0;
}
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
index 97a829d98ffe..d0249e463338 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_ah.c
@@ -170,7 +170,8 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct rdma_ah_attr *attr,
const struct ib_global_route *grh;
union ib_gid sgid;
- if (!(rdma_ah_get_ah_flags(attr) & IB_AH_GRH))
+ if ((attr->type != RDMA_AH_ATTR_TYPE_ROCE) ||
+ !(rdma_ah_get_ah_flags(attr) & IB_AH_GRH))
return ERR_PTR(-EINVAL);
grh = rdma_ah_read_grh(attr);
@@ -204,7 +205,7 @@ struct ib_ah *ocrdma_create_ah(struct ib_pd *ibpd, struct rdma_ah_attr *attr,
(!rdma_is_multicast_addr((struct in6_addr *)grh->dgid.raw)) &&
(!rdma_link_local_addr((struct in6_addr *)grh->dgid.raw))) {
status = rdma_addr_find_l2_eth_by_grh(&sgid, &grh->dgid,
- attr->dmac,
+ attr->roce.dmac,
&vlan_tag,
&sgid_attr.ndev->ifindex,
NULL);
@@ -259,6 +260,7 @@ int ocrdma_query_ah(struct ib_ah *ibah, struct rdma_ah_attr *attr)
struct ocrdma_av *av = ah->av;
struct ocrdma_grh *grh;
+ attr->type = ibah->type;
if (ah->av->valid & OCRDMA_AV_VALID) {
grh = (struct ocrdma_grh *)((u8 *)ah->av +
sizeof(struct ocrdma_eth_vlan));
diff --git a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
index caec48c6e1ec..2f30bda8457a 100644
--- a/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
+++ b/drivers/infiniband/hw/ocrdma/ocrdma_verbs.c
@@ -1598,6 +1598,7 @@ int ocrdma_query_qp(struct ib_qp *ibqp,
qp_attr->cap.max_recv_sge = qp->rq.max_sges;
qp_attr->cap.max_inline_data = qp->max_inline_data;
qp_init_attr->cap = qp_attr->cap;
+ qp_attr->ah_attr.type = RDMA_AH_ATTR_TYPE_ROCE;
rdma_ah_set_grh(&qp_attr->ah_attr, NULL,
params.rnt_rc_sl_fl &