Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

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>

authored by

Kalesh AP and committed by
Leon Romanovsky
13edc7d4 e72d45d2

+37 -1
+21 -1
drivers/infiniband/hw/bnxt_re/ib_verbs.c
··· 186 186 { 187 187 struct bnxt_re_dev *rdev = to_bnxt_re_dev(ibdev, ibdev); 188 188 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; 189 192 190 193 memset(ib_attr, 0, sizeof(*ib_attr)); 191 194 memcpy(&ib_attr->fw_ver, dev_attr->fw_ver, ··· 253 250 254 251 ib_attr->max_pkeys = 1; 255 252 ib_attr->local_ca_ack_delay = BNXT_RE_DEFAULT_ACK_DELAY; 256 - return 0; 253 + 254 + if ((offsetofend(typeof(resp), packet_pacing_caps) <= outlen) && 255 + _is_modify_qp_rate_limit_supported(dev_attr->dev_cap_flags2)) { 256 + resp.packet_pacing_caps.qp_rate_limit_min = 257 + dev_attr->rate_limit_min; 258 + resp.packet_pacing_caps.qp_rate_limit_max = 259 + dev_attr->rate_limit_max; 260 + resp.packet_pacing_caps.supported_qpts = 261 + 1 << IB_QPT_RC; 262 + } 263 + if (outlen) 264 + rc = ib_copy_to_udata(udata, &resp, 265 + min(sizeof(resp), outlen)); 266 + 267 + return rc; 257 268 } 258 269 259 270 int bnxt_re_modify_device(struct ib_device *ibdev, ··· 4417 4400 4418 4401 if (_is_host_msn_table(rdev->qplib_res.dattr->dev_cap_flags2)) 4419 4402 resp.comp_mask |= BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED; 4403 + 4404 + if (_is_modify_qp_rate_limit_supported(dev_attr->dev_cap_flags2)) 4405 + resp.comp_mask |= BNXT_RE_UCNTX_CMASK_QP_RATE_LIMIT_ENABLED; 4420 4406 4421 4407 if (udata->inlen >= sizeof(ureq)) { 4422 4408 rc = ib_copy_from_udata(&ureq, udata, min(udata->inlen, sizeof(ureq)));
+16
include/uapi/rdma/bnxt_re-abi.h
··· 56 56 BNXT_RE_UCNTX_CMASK_DBR_PACING_ENABLED = 0x08ULL, 57 57 BNXT_RE_UCNTX_CMASK_POW2_DISABLED = 0x10ULL, 58 58 BNXT_RE_UCNTX_CMASK_MSN_TABLE_ENABLED = 0x40, 59 + BNXT_RE_UCNTX_CMASK_QP_RATE_LIMIT_ENABLED = 0x80ULL, 59 60 }; 60 61 61 62 enum bnxt_re_wqe_mode { ··· 215 214 enum bnxt_re_toggle_mem_methods { 216 215 BNXT_RE_METHOD_GET_TOGGLE_MEM = (1U << UVERBS_ID_NS_SHIFT), 217 216 BNXT_RE_METHOD_RELEASE_TOGGLE_MEM, 217 + }; 218 + 219 + struct bnxt_re_packet_pacing_caps { 220 + __u32 qp_rate_limit_min; 221 + __u32 qp_rate_limit_max; /* In kbps */ 222 + /* Corresponding bit will be set if qp type from 223 + * 'enum ib_qp_type' is supported, e.g. 224 + * supported_qpts |= 1 << IB_QPT_RC 225 + */ 226 + __u32 supported_qpts; 227 + __u32 reserved; 228 + }; 229 + 230 + struct bnxt_re_query_device_ex_resp { 231 + struct bnxt_re_packet_pacing_caps packet_pacing_caps; 218 232 }; 219 233 #endif /* __BNXT_RE_UVERBS_ABI_H__*/