Skip to content

Commit 13edc7d

Browse files
kaleshap86rleon
authored andcommitted
RDMA/bnxt_re: Report packet pacing capabilities when querying device
Enable the support to report packet pacing capabilities from kernel to user space. Packet pacing allows to limit the rate to any number between the maximum and minimum. The capabilities are exposed to user space through query_device. The following capabilities are reported: 1. The maximum and minimum rate limit in kbps. 2. Bitmap showing which QP types support rate limit. Signed-off-by: Damodharam Ammepalli <damodharam.ammepalli@broadcom.com> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Link: https://patch.msgid.link/20260202133413.3182578-3-kalesh-anakkur.purayil@broadcom.com Reviewed-by: Anantha Prabhu <anantha.prabhu@broadcom.com> Signed-off-by: Leon Romanovsky <leon@kernel.org>
1 parent e72d45d commit 13edc7d

2 files changed

Lines changed: 37 additions & 1 deletion

File tree

drivers/infiniband/hw/bnxt_re/ib_verbs.c

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,6 +186,9 @@ int bnxt_re_query_device(struct ib_device *ibdev,
186186
{
187187
struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
188188
struct bnxt_qplib_dev_attr *dev_attr = rdev->dev_attr;
189+
struct bnxt_re_query_device_ex_resp resp = {};
190+
size_t outlen = (udata) ? udata->outlen : 0;
191+
int rc = 0;
189192

190193
memset(ib_attr, 0, sizeof(*ib_attr));
191194
memcpy(&ib_attr->fw_ver, dev_attr->fw_ver,
@@ -250,7 +253,21 @@ int bnxt_re_query_device(struct ib_device *ibdev,
250253

251254
ib_attr->max_pkeys = 1;
252255
ib_attr->local_ca_ack_delay = BNXT_RE_DEFAULT_ACK_DELAY;
253-
return 0;
256+
257+
if ((offsetofend(typeof(resp), packet_pacing_caps) <= outlen) &&
258+
_is_modify_qp_rate_limit_supported(dev_attr->dev_cap_flags2)) {
259+
resp.packet_pacing_caps.qp_rate_limit_min =
260+
dev_attr->rate_limit_min;
261+
resp.packet_pacing_caps.qp_rate_limit_max =
262+
dev_attr->rate_limit_max;
263+
resp.packet_pacing_caps.supported_qpts =
264+
1 << IB_QPT_RC;
265+
}
266+
if (outlen)
267+
rc = ib_copy_to_udata(udata, &resp,
268+
min(sizeof(resp), outlen));
269+
270+
return rc;
254271
}
255272

256273
int bnxt_re_modify_device(struct ib_device *ibdev,
@@ -4401,6 +4418,9 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata)
44014418
if (_is_host_msn_table(rdev->qplib_res.dattr->dev_cap_flags2))
44024419
resp.comp_mask |= BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED;
44034420

4421+
if (_is_modify_qp_rate_limit_supported(dev_attr->dev_cap_flags2))
4422+
resp.comp_mask |= BNXT_RE_UCNTX_CMASK_QP_RATE_LIMIT_ENABLED;
4423+
44044424
if (udata->inlen >= sizeof(ureq)) {
44054425
rc = ib_copy_from_udata(&ureq, udata, min(udata->inlen, sizeof(ureq)));
44064426
if (rc)

include/uapi/rdma/bnxt_re-abi.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ enum {
5656
BNXT_RE_UCNTX_CMASK_DBR_PACING_ENABLED = 0x08ULL,
5757
BNXT_RE_UCNTX_CMASK_POW2_DISABLED = 0x10ULL,
5858
BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED = 0x40,
59+
BNXT_RE_UCNTX_CMASK_QP_RATE_LIMIT_ENABLED = 0x80ULL,
5960
};
6061

6162
enum bnxt_re_wqe_mode {
@@ -215,4 +216,19 @@ enum bnxt_re_toggle_mem_methods {
215216
BNXT_RE_METHOD_GET_TOGGLE_MEM = (1U << UVERBS_ID_NS_SHIFT),
216217
BNXT_RE_METHOD_RELEASE_TOGGLE_MEM,
217218
};
219+
220+
struct bnxt_re_packet_pacing_caps {
221+
__u32 qp_rate_limit_min;
222+
__u32 qp_rate_limit_max; /* In kbps */
223+
/* Corresponding bit will be set if qp type from
224+
* 'enum ib_qp_type' is supported, e.g.
225+
* supported_qpts |= 1 << IB_QPT_RC
226+
*/
227+
__u32 supported_qpts;
228+
__u32 reserved;
229+
};
230+
231+
struct bnxt_re_query_device_ex_resp {
232+
struct bnxt_re_packet_pacing_caps packet_pacing_caps;
233+
};
218234
#endif /* __BNXT_RE_UVERBS_ABI_H__*/

0 commit comments

Comments
 (0)