summaryrefslogtreecommitdiff
path: root/drivers/infiniband/sw/rxe
diff options
context:
space:
mode:
authorDasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com>2017-04-29 21:41:28 +0300
committerDoug Ledford <dledford@redhat.com>2017-05-01 21:32:43 +0300
commitd8966fcd4c25708c3a76ea7619644218373df639 (patch)
treebd059c78ae118d3a16cada6228ea3b7a7e7f4fbd /drivers/infiniband/sw/rxe
parent2224c47ace2387610f8cff0c562db2c6e63df026 (diff)
downloadlinux-d8966fcd4c25708c3a76ea7619644218373df639.tar.xz
IB/core: Use rdma_ah_attr accessor functions
Modify core and driver components to use accessor functions introduced to access individual fields of rdma_ah_attr 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/sw/rxe')
-rw-r--r--drivers/infiniband/sw/rxe/rxe_av.c24
-rw-r--r--drivers/infiniband/sw/rxe/rxe_qp.c12
-rw-r--r--drivers/infiniband/sw/rxe/rxe_verbs.c6
3 files changed, 23 insertions, 19 deletions
diff --git a/drivers/infiniband/sw/rxe/rxe_av.c b/drivers/infiniband/sw/rxe/rxe_av.c
index fad68aaaeb28..e043e9998d4c 100644
--- a/drivers/infiniband/sw/rxe/rxe_av.c
+++ b/drivers/infiniband/sw/rxe/rxe_av.c
@@ -38,17 +38,18 @@ int rxe_av_chk_attr(struct rxe_dev *rxe, struct rdma_ah_attr *attr)
{
struct rxe_port *port;
- if (attr->port_num != 1) {
- pr_info("invalid port_num = %d\n", attr->port_num);
+ if (rdma_ah_get_port_num(attr) != 1) {
+ pr_info("invalid port_num = %d\n", rdma_ah_get_port_num(attr));
return -EINVAL;
}
port = &rxe->port;
- if (attr->ah_flags & IB_AH_GRH) {
- if (attr->grh.sgid_index > port->attr.gid_tbl_len) {
- pr_info("invalid sgid index = %d\n",
- attr->grh.sgid_index);
+ if (rdma_ah_get_ah_flags(attr) & IB_AH_GRH) {
+ u8 sgid_index = rdma_ah_read_grh(attr)->sgid_index;
+
+ if (sgid_index > port->attr.gid_tbl_len) {
+ pr_info("invalid sgid index = %d\n", sgid_index);
return -EINVAL;
}
}
@@ -60,7 +61,8 @@ int rxe_av_from_attr(struct rxe_dev *rxe, u8 port_num,
struct rxe_av *av, struct rdma_ah_attr *attr)
{
memset(av, 0, sizeof(*av));
- memcpy(&av->grh, &attr->grh, sizeof(attr->grh));
+ memcpy(&av->grh, rdma_ah_read_grh(attr),
+ sizeof(*rdma_ah_read_grh(attr)));
av->port_num = port_num;
return 0;
}
@@ -68,9 +70,9 @@ int rxe_av_from_attr(struct rxe_dev *rxe, u8 port_num,
int rxe_av_to_attr(struct rxe_dev *rxe, struct rxe_av *av,
struct rdma_ah_attr *attr)
{
- memcpy(&attr->grh, &av->grh, sizeof(av->grh));
- attr->ah_flags = IB_AH_GRH;
- attr->port_num = av->port_num;
+ memcpy(rdma_ah_retrieve_grh(attr), &av->grh, sizeof(av->grh));
+ rdma_ah_set_ah_flags(attr, IB_AH_GRH);
+ rdma_ah_set_port_num(attr, av->port_num);
return 0;
}
@@ -81,7 +83,7 @@ int rxe_av_fill_ip_info(struct rxe_dev *rxe,
union ib_gid *sgid)
{
rdma_gid2ip(&av->sgid_addr._sockaddr, sgid);
- rdma_gid2ip(&av->dgid_addr._sockaddr, &attr->grh.dgid);
+ rdma_gid2ip(&av->dgid_addr._sockaddr, &rdma_ah_read_grh(attr)->dgid);
av->network_type = ib_gid_to_network_type(sgid_attr->gid_type, sgid);
return 0;
diff --git a/drivers/infiniband/sw/rxe/rxe_qp.c b/drivers/infiniband/sw/rxe/rxe_qp.c
index 1a123edf555e..80ccc7c7c341 100644
--- a/drivers/infiniband/sw/rxe/rxe_qp.c
+++ b/drivers/infiniband/sw/rxe/rxe_qp.c
@@ -631,8 +631,8 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
if (mask & IB_QP_AV) {
ib_get_cached_gid(&rxe->ib_dev, 1,
- attr->ah_attr.grh.sgid_index, &sgid,
- &sgid_attr);
+ rdma_ah_read_grh(&attr->ah_attr)->sgid_index,
+ &sgid, &sgid_attr);
rxe_av_from_attr(rxe, attr->port_num, &qp->pri_av,
&attr->ah_attr);
rxe_av_fill_ip_info(rxe, &qp->pri_av, &attr->ah_attr,
@@ -642,9 +642,11 @@ int rxe_qp_from_attr(struct rxe_qp *qp, struct ib_qp_attr *attr, int mask,
}
if (mask & IB_QP_ALT_PATH) {
- ib_get_cached_gid(&rxe->ib_dev, 1,
- attr->alt_ah_attr.grh.sgid_index, &sgid,
- &sgid_attr);
+ u8 sgid_index =
+ rdma_ah_read_grh(&attr->alt_ah_attr)->sgid_index;
+
+ ib_get_cached_gid(&rxe->ib_dev, 1, sgid_index,
+ &sgid, &sgid_attr);
rxe_av_from_attr(rxe, attr->alt_port_num, &qp->alt_av,
&attr->alt_ah_attr);
diff --git a/drivers/infiniband/sw/rxe/rxe_verbs.c b/drivers/infiniband/sw/rxe/rxe_verbs.c
index 71f62e0fb542..090d12cef36b 100644
--- a/drivers/infiniband/sw/rxe/rxe_verbs.c
+++ b/drivers/infiniband/sw/rxe/rxe_verbs.c
@@ -304,15 +304,15 @@ static int rxe_init_av(struct rxe_dev *rxe, struct rdma_ah_attr *attr,
union ib_gid sgid;
struct ib_gid_attr sgid_attr;
- err = ib_get_cached_gid(&rxe->ib_dev, attr->port_num,
- attr->grh.sgid_index, &sgid,
+ err = ib_get_cached_gid(&rxe->ib_dev, rdma_ah_get_port_num(attr),
+ rdma_ah_read_grh(attr)->sgid_index, &sgid,
&sgid_attr);
if (err) {
pr_err("Failed to query sgid. err = %d\n", err);
return err;
}
- err = rxe_av_from_attr(rxe, attr->port_num, av, attr);
+ err = rxe_av_from_attr(rxe, rdma_ah_get_port_num(attr), av, attr);
if (!err)
err = rxe_av_fill_ip_info(rxe, av, attr, &sgid_attr, &sgid);