@@ -639,6 +639,7 @@ int bnxt_re_create_ah(struct ib_ah *ib_ah, struct rdma_ah_attr *ah_attr,
639
639
const struct ib_global_route * grh = rdma_ah_read_grh (ah_attr );
640
640
struct bnxt_re_dev * rdev = pd -> rdev ;
641
641
const struct ib_gid_attr * sgid_attr ;
642
+ struct bnxt_re_gid_ctx * ctx ;
642
643
struct bnxt_re_ah * ah = container_of (ib_ah , struct bnxt_re_ah , ib_ah );
643
644
u8 nw_type ;
644
645
int rc ;
@@ -654,19 +655,18 @@ int bnxt_re_create_ah(struct ib_ah *ib_ah, struct rdma_ah_attr *ah_attr,
654
655
/* Supply the configuration for the HW */
655
656
memcpy (ah -> qplib_ah .dgid .data , grh -> dgid .raw ,
656
657
sizeof (union ib_gid ));
657
- /*
658
- * If RoCE V2 is enabled, stack will have two entries for
659
- * each GID entry. Avoiding this duplicte entry in HW. Dividing
660
- * the GID index by 2 for RoCE V2
658
+ sgid_attr = grh -> sgid_attr ;
659
+ /* Get the HW context of the GID. The reference
660
+ * of GID table entry is already taken by the caller.
661
661
*/
662
- ah -> qplib_ah .sgid_index = grh -> sgid_index / 2 ;
662
+ ctx = rdma_read_gid_hw_context (sgid_attr );
663
+ ah -> qplib_ah .sgid_index = ctx -> idx ;
663
664
ah -> qplib_ah .host_sgid_index = grh -> sgid_index ;
664
665
ah -> qplib_ah .traffic_class = grh -> traffic_class ;
665
666
ah -> qplib_ah .flow_label = grh -> flow_label ;
666
667
ah -> qplib_ah .hop_limit = grh -> hop_limit ;
667
668
ah -> qplib_ah .sl = rdma_ah_get_sl (ah_attr );
668
669
669
- sgid_attr = grh -> sgid_attr ;
670
670
/* Get network header type for this GID */
671
671
nw_type = rdma_gid_attr_network_type (sgid_attr );
672
672
ah -> qplib_ah .nw_type = bnxt_re_stack_to_dev_nw_type (nw_type );
@@ -1593,6 +1593,7 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
1593
1593
const struct ib_global_route * grh =
1594
1594
rdma_ah_read_grh (& qp_attr -> ah_attr );
1595
1595
const struct ib_gid_attr * sgid_attr ;
1596
+ struct bnxt_re_gid_ctx * ctx ;
1596
1597
1597
1598
qp -> qplib_qp .modify_flags |= CMDQ_MODIFY_QP_MODIFY_MASK_DGID |
1598
1599
CMDQ_MODIFY_QP_MODIFY_MASK_FLOW_LABEL |
@@ -1604,19 +1605,19 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,
1604
1605
memcpy (qp -> qplib_qp .ah .dgid .data , grh -> dgid .raw ,
1605
1606
sizeof (qp -> qplib_qp .ah .dgid .data ));
1606
1607
qp -> qplib_qp .ah .flow_label = grh -> flow_label ;
1607
- /* If RoCE V2 is enabled, stack will have two entries for
1608
- * each GID entry. Avoiding this duplicte entry in HW. Dividing
1609
- * the GID index by 2 for RoCE V2
1608
+ sgid_attr = grh -> sgid_attr ;
1609
+ /* Get the HW context of the GID. The reference
1610
+ * of GID table entry is already taken by the caller.
1610
1611
*/
1611
- qp -> qplib_qp .ah .sgid_index = grh -> sgid_index / 2 ;
1612
+ ctx = rdma_read_gid_hw_context (sgid_attr );
1613
+ qp -> qplib_qp .ah .sgid_index = ctx -> idx ;
1612
1614
qp -> qplib_qp .ah .host_sgid_index = grh -> sgid_index ;
1613
1615
qp -> qplib_qp .ah .hop_limit = grh -> hop_limit ;
1614
1616
qp -> qplib_qp .ah .traffic_class = grh -> traffic_class ;
1615
1617
qp -> qplib_qp .ah .sl = rdma_ah_get_sl (& qp_attr -> ah_attr );
1616
1618
ether_addr_copy (qp -> qplib_qp .ah .dmac ,
1617
1619
qp_attr -> ah_attr .roce .dmac );
1618
1620
1619
- sgid_attr = qp_attr -> ah_attr .grh .sgid_attr ;
1620
1621
rc = rdma_read_gid_l2_fields (sgid_attr , NULL ,
1621
1622
& qp -> qplib_qp .smac [0 ]);
1622
1623
if (rc )
0 commit comments