|
@@ -672,8 +672,6 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
|
|
|
int rc;
|
|
|
u8 nw_type;
|
|
|
|
|
|
- struct ib_gid_attr sgid_attr;
|
|
|
-
|
|
|
if (!(rdma_ah_get_ah_flags(ah_attr) & IB_AH_GRH)) {
|
|
|
dev_err(rdev_to_dev(rdev), "Failed to alloc AH: GRH not set");
|
|
|
return ERR_PTR(-EINVAL);
|
|
@@ -704,20 +702,11 @@ struct ib_ah *bnxt_re_create_ah(struct ib_pd *ib_pd,
|
|
|
grh->dgid.raw) &&
|
|
|
!rdma_link_local_addr((struct in6_addr *)
|
|
|
grh->dgid.raw)) {
|
|
|
- union ib_gid sgid;
|
|
|
+ const struct ib_gid_attr *sgid_attr;
|
|
|
|
|
|
- rc = ib_get_cached_gid(&rdev->ibdev, 1,
|
|
|
- grh->sgid_index, &sgid,
|
|
|
- &sgid_attr);
|
|
|
- if (rc) {
|
|
|
- dev_err(rdev_to_dev(rdev),
|
|
|
- "Failed to query gid at index %d",
|
|
|
- grh->sgid_index);
|
|
|
- goto fail;
|
|
|
- }
|
|
|
- dev_put(sgid_attr.ndev);
|
|
|
+ sgid_attr = grh->sgid_attr;
|
|
|
/* Get network header type for this GID */
|
|
|
- nw_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
|
|
|
+ nw_type = rdma_gid_attr_network_type(sgid_attr);
|
|
|
switch (nw_type) {
|
|
|
case RDMA_NETWORK_IPV4:
|
|
|
ah->qplib_ah.nw_type = CMDQ_CREATE_AH_TYPE_V2IPV4;
|
|
@@ -1598,9 +1587,6 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
|
|
|
struct bnxt_qplib_dev_attr *dev_attr = &rdev->dev_attr;
|
|
|
enum ib_qp_state curr_qp_state, new_qp_state;
|
|
|
int rc, entries;
|
|
|
- int status;
|
|
|
- union ib_gid sgid;
|
|
|
- struct ib_gid_attr sgid_attr;
|
|
|
unsigned int flags;
|
|
|
u8 nw_type;
|
|
|
|
|
@@ -1667,6 +1653,7 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
|
|
|
if (qp_attr_mask & IB_QP_AV) {
|
|
|
const struct ib_global_route *grh =
|
|
|
rdma_ah_read_grh(&qp_attr->ah_attr);
|
|
|
+ const struct ib_gid_attr *sgid_attr;
|
|
|
|
|
|
qp->qplib_qp.modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_DGID |
|
|
|
CMDQ_MODIFY_QP_MODIFY_MASK_FLOW_LABEL |
|
|
@@ -1690,29 +1677,23 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
|
|
|
ether_addr_copy(qp->qplib_qp.ah.dmac,
|
|
|
qp_attr->ah_attr.roce.dmac);
|
|
|
|
|
|
- status = ib_get_cached_gid(&rdev->ibdev, 1,
|
|
|
- grh->sgid_index,
|
|
|
- &sgid, &sgid_attr);
|
|
|
- if (!status) {
|
|
|
- memcpy(qp->qplib_qp.smac, sgid_attr.ndev->dev_addr,
|
|
|
- ETH_ALEN);
|
|
|
- dev_put(sgid_attr.ndev);
|
|
|
- nw_type = ib_gid_to_network_type(sgid_attr.gid_type,
|
|
|
- &sgid);
|
|
|
- switch (nw_type) {
|
|
|
- case RDMA_NETWORK_IPV4:
|
|
|
- qp->qplib_qp.nw_type =
|
|
|
- CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV2_IPV4;
|
|
|
- break;
|
|
|
- case RDMA_NETWORK_IPV6:
|
|
|
- qp->qplib_qp.nw_type =
|
|
|
- CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV2_IPV6;
|
|
|
- break;
|
|
|
- default:
|
|
|
- qp->qplib_qp.nw_type =
|
|
|
- CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV1;
|
|
|
- break;
|
|
|
- }
|
|
|
+ sgid_attr = qp_attr->ah_attr.grh.sgid_attr;
|
|
|
+ memcpy(qp->qplib_qp.smac, sgid_attr->ndev->dev_addr,
|
|
|
+ ETH_ALEN);
|
|
|
+ nw_type = rdma_gid_attr_network_type(sgid_attr);
|
|
|
+ switch (nw_type) {
|
|
|
+ case RDMA_NETWORK_IPV4:
|
|
|
+ qp->qplib_qp.nw_type =
|
|
|
+ CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV2_IPV4;
|
|
|
+ break;
|
|
|
+ case RDMA_NETWORK_IPV6:
|
|
|
+ qp->qplib_qp.nw_type =
|
|
|
+ CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV2_IPV6;
|
|
|
+ break;
|
|
|
+ default:
|
|
|
+ qp->qplib_qp.nw_type =
|
|
|
+ CMDQ_MODIFY_QP_NETWORK_TYPE_ROCEV1;
|
|
|
+ break;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -1934,7 +1915,7 @@ static int bnxt_re_build_qp1_send_v2(struct bnxt_re_qp *qp,
|
|
|
dev_put(sgid_attr.ndev);
|
|
|
}
|
|
|
/* Get network header type for this GID */
|
|
|
- nw_type = ib_gid_to_network_type(sgid_attr.gid_type, &sgid);
|
|
|
+ nw_type = rdma_gid_attr_network_type(&sgid_attr);
|
|
|
switch (nw_type) {
|
|
|
case RDMA_NETWORK_IPV4:
|
|
|
nw_type = BNXT_RE_ROCEV2_IPV4_PACKET;
|