Skip to content

Commit dc5006c

Browse files
Kalesh APjgunthorpe
authored andcommitted
RDMA/bnxt_re: Fix the GID table length
GID table length is reported by FW. The gid index which is passed to the driver during modify_qp/create_ah is restricted by the sgid_index field of struct ib_global_route. sgid_index is u8 and the max sgid possible is 256. Each GID entry in HW will have 2 GID entries in the kernel gid table. So we can support twice the gid table size reported by FW. Also, restrict the max GID to 256 also. Fixes: 847b978 ("RDMA/bnxt_re: Restrict the max_gids to 256") Link: https://patch.msgid.link/r/[email protected] Signed-off-by: Kalesh AP <[email protected]> Signed-off-by: Selvin Xavier <[email protected]> Signed-off-by: Jason Gunthorpe <[email protected]>
1 parent 7988bdb commit dc5006c

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

drivers/infiniband/hw/bnxt_re/qplib_sp.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,14 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,
159159
if (!bnxt_qplib_is_chip_gen_p7(rcfw->res->cctx))
160160
attr->l2_db_size = (sb->l2_db_space_size + 1) *
161161
(0x01 << RCFW_DBR_BASE_PAGE_SHIFT);
162-
attr->max_sgid = BNXT_QPLIB_NUM_GIDS_SUPPORTED;
162+
/*
163+
* Read the max gid supported by HW.
164+
* For each entry in HW GID in HW table, we consume 2
165+
* GID entries in the kernel GID table. So max_gid reported
166+
* to stack can be up to twice the value reported by the HW, up to 256 gids.
167+
*/
168+
attr->max_sgid = le32_to_cpu(sb->max_gid);
169+
attr->max_sgid = min_t(u32, BNXT_QPLIB_NUM_GIDS_SUPPORTED, 2 * attr->max_sgid);
163170
attr->dev_cap_flags = le16_to_cpu(sb->dev_cap_flags);
164171
attr->dev_cap_flags2 = le16_to_cpu(sb->dev_cap_ext_flags_2);
165172

0 commit comments

Comments
 (0)