diff options
author | Dasaratharaman Chandramouli <dasaratharaman.chandramouli@intel.com> | 2017-04-29 20:41:29 +0200 |
---|---|---|
committer | Doug Ledford <dledford@redhat.com> | 2017-05-01 20:32:43 +0200 |
commit | 44c58487d51a0dc43d96f1dc864f0461ec6a346a (patch) | |
tree | edab4f4f87a0347b8abf9169cd3f030ffc6439bd /drivers/infiniband/hw/vmw_pvrdma | |
parent | IB/core: Use rdma_ah_attr accessor functions (diff) | |
download | linux-44c58487d51a0dc43d96f1dc864f0461ec6a346a.tar.xz linux-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/vmw_pvrdma')
-rw-r--r-- | drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c | 5 | ||||
-rw-r--r-- | drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c | 9 |
2 files changed, 6 insertions, 8 deletions
diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c index 1c6e80a008c6..ec6a4ca1eeb7 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_misc.c @@ -280,6 +280,7 @@ void ib_global_route_to_pvrdma(struct pvrdma_global_route *dst, void pvrdma_ah_attr_to_rdma(struct rdma_ah_attr *dst, const struct pvrdma_ah_attr *src) { + dst->type = RDMA_AH_ATTR_TYPE_ROCE; pvrdma_global_route_to_ib(rdma_ah_retrieve_grh(dst), &src->grh); rdma_ah_set_dlid(dst, src->dlid); rdma_ah_set_sl(dst, src->sl); @@ -287,7 +288,7 @@ void pvrdma_ah_attr_to_rdma(struct rdma_ah_attr *dst, rdma_ah_set_static_rate(dst, src->static_rate); rdma_ah_set_ah_flags(dst, src->ah_flags); rdma_ah_set_port_num(dst, src->port_num); - memcpy(dst->dmac, &src->dmac, ETH_ALEN); + memcpy(dst->roce.dmac, &src->dmac, ETH_ALEN); } void rdma_ah_attr_to_pvrdma(struct pvrdma_ah_attr *dst, @@ -300,5 +301,5 @@ void rdma_ah_attr_to_pvrdma(struct pvrdma_ah_attr *dst, dst->static_rate = rdma_ah_get_static_rate(src); dst->ah_flags = rdma_ah_get_ah_flags(src); dst->port_num = rdma_ah_get_port_num(src); - memcpy(&dst->dmac, src->dmac, sizeof(dst->dmac)); + memcpy(&dst->dmac, src->roce.dmac, sizeof(dst->dmac)); } diff --git a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c index 6b11e574b21c..28517042011d 100644 --- a/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c +++ b/drivers/infiniband/hw/vmw_pvrdma/pvrdma_verbs.c @@ -525,17 +525,14 @@ struct ib_ah *pvrdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr, { struct pvrdma_dev *dev = to_vdev(pd->device); struct pvrdma_ah *ah; - enum rdma_link_layer ll; const struct ib_global_route *grh; u8 port_num = rdma_ah_get_port_num(ah_attr); if (!(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH)) return ERR_PTR(-EINVAL); - ll = rdma_port_get_link_layer(pd->device, - rdma_ah_get_port_num(ah_attr)); - grh = rdma_ah_read_grh(ah_attr); - if (ll != IB_LINK_LAYER_ETHERNET || + grh = rdma_ah_read_grh(ah_attr); + if ((ah_attr->type != RDMA_AH_ATTR_TYPE_ROCE) || rdma_is_multicast_addr((struct in6_addr *)grh->dgid.raw)) return ERR_PTR(-EINVAL); @@ -556,7 +553,7 @@ struct ib_ah *pvrdma_create_ah(struct ib_pd *pd, struct rdma_ah_attr *ah_attr, ah->av.sl_tclass_flowlabel = (grh->traffic_class << 20) | grh->flow_label; memcpy(ah->av.dgid, grh->dgid.raw, 16); - memcpy(ah->av.dmac, ah_attr->dmac, ETH_ALEN); + memcpy(ah->av.dmac, ah_attr->roce.dmac, ETH_ALEN); ah->ibah.device = pd->device; ah->ibah.pd = pd; |