Commit 13edc7d4 authored by Kalesh AP's avatar Kalesh AP Committed by Leon Romanovsky
Browse files

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: default avatarDamodharam Ammepalli <damodharam.ammepalli@broadcom.com>
Signed-off-by: default avatarKalesh AP <kalesh-anakkur.purayil@broadcom.com>
Link: https://patch.msgid.link/20260202133413.3182578-3-kalesh-anakkur.purayil@broadcom.com


Reviewed-by: default avatarAnantha Prabhu <anantha.prabhu@broadcom.com>
Signed-off-by: default avatarLeon Romanovsky <leon@kernel.org>
parent e72d45d2
Loading
Loading
Loading
Loading
+21 −1
Original line number Diff line number Diff line
@@ -186,6 +186,9 @@ int bnxt_re_query_device(struct ib_device *ibdev,
{
	struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev);
	struct bnxt_qplib_dev_attr *dev_attr = rdev->dev_attr;
	struct bnxt_re_query_device_ex_resp resp = {};
	size_t outlen = (udata) ? udata->outlen : 0;
	int rc = 0;

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

	ib_attr->max_pkeys = 1;
	ib_attr->local_ca_ack_delay = BNXT_RE_DEFAULT_ACK_DELAY;
	return 0;

	if ((offsetofend(typeof(resp), packet_pacing_caps) <= outlen) &&
	    _is_modify_qp_rate_limit_supported(dev_attr->dev_cap_flags2)) {
		resp.packet_pacing_caps.qp_rate_limit_min =
			dev_attr->rate_limit_min;
		resp.packet_pacing_caps.qp_rate_limit_max =
			dev_attr->rate_limit_max;
		resp.packet_pacing_caps.supported_qpts =
			1 << IB_QPT_RC;
	}
	if (outlen)
		rc = ib_copy_to_udata(udata, &resp,
				      min(sizeof(resp), outlen));

	return rc;
}

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)
	if (_is_host_msn_table(rdev->qplib_res.dattr->dev_cap_flags2))
		resp.comp_mask |= BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED;

	if (_is_modify_qp_rate_limit_supported(dev_attr->dev_cap_flags2))
		resp.comp_mask |= BNXT_RE_UCNTX_CMASK_QP_RATE_LIMIT_ENABLED;

	if (udata->inlen >= sizeof(ureq)) {
		rc = ib_copy_from_udata(&ureq, udata, min(udata->inlen, sizeof(ureq)));
		if (rc)
+16 −0
Original line number Diff line number Diff line
@@ -56,6 +56,7 @@ enum {
	BNXT_RE_UCNTX_CMASK_DBR_PACING_ENABLED = 0x08ULL,
	BNXT_RE_UCNTX_CMASK_POW2_DISABLED = 0x10ULL,
	BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED = 0x40,
	BNXT_RE_UCNTX_CMASK_QP_RATE_LIMIT_ENABLED = 0x80ULL,
};

enum bnxt_re_wqe_mode {
@@ -215,4 +216,19 @@ enum bnxt_re_toggle_mem_methods {
	BNXT_RE_METHOD_GET_TOGGLE_MEM = (1U << UVERBS_ID_NS_SHIFT),
	BNXT_RE_METHOD_RELEASE_TOGGLE_MEM,
};

struct bnxt_re_packet_pacing_caps {
	__u32 qp_rate_limit_min;
	__u32 qp_rate_limit_max; /* In kbps */
	/* Corresponding bit will be set if qp type from
	 * 'enum ib_qp_type' is supported, e.g.
	 * supported_qpts |= 1 << IB_QPT_RC
	 */
	__u32 supported_qpts;
	__u32 reserved;
};

struct bnxt_re_query_device_ex_resp {
	struct bnxt_re_packet_pacing_caps packet_pacing_caps;
};
#endif /* __BNXT_RE_UVERBS_ABI_H__*/