Broadcom's driver add global atomics
Subsystems (2)
v3 cover Broadcom's driver add global atomics
Adding automated detection and enablement of global PCI atomic operation support.
Updated to ABI to pass wqe-mode to user to support rdma-core pull request:
https://github.com/linux-rdma/rdma-core/pull/1007
v2->v3
Added additional patch to update ABI. A PR corresponding to this is open.
V1->V2
renamed bnxt_qplib_enable_atomic_ops_to_root tobnxt_qplib_determine_atomics
Devesh Sharma (3):
RDMA/bnxt_re: Enable global atomic ops if platform supports
bnxt_re: Update maintainers list
RDMA/bnxt_re: update ABI to pass wqe-mode to user space
MAINTAINERS | 2 -- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 +++++++ drivers/infiniband/hw/bnxt_re/main.c | 4 ++++ drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 13 ++++++++++++- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 -- include/uapi/rdma/bnxt_re-abi.h | 5 ++++- 8 files changed, 43 insertions(+), 6 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/3 RDMA/bnxt_re: Enable global atomic ops if platform supports
Enabling Atomic operations for Gen P5 devices if the underlying platform supports global atomic ops.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 4 ++++ drivers/infiniband/hw/bnxt_re/main.c | 4 ++++ drivers/infiniband/hw/bnxt_re/qplib_res.c | 15 +++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 13 ++++++++++++- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 -- 6 files changed, 36 insertions(+), 3 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 -0
@@ -163,6 +163,10 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom; ib_attr->atomic_cap =IB_ATOMIC_NONE ; ib_attr->masked_atomic_cap =IB_ATOMIC_NONE ; +if (dev_attr->is_atomic) { + ib_attr->atomic_cap =IB_ATOMIC_GLOB ; + ib_attr->masked_atomic_cap =IB_ATOMIC_GLOB ; + } ib_attr->max_ee_rd_atom =0 ; ib_attr->max_res_rd_atom =0 ;
drivers/infiniband/hw/bnxt_re/main.c +4 -0
@@ -128,6 +128,10 @@ static int bnxt_re_setup_chip_ctx(struct bnxt_re_dev *rdev, u8 wqe_mode) rdev->rcfw.res = &rdev->qplib_res;bnxt_re_set_drv_mode (rdev, wqe_mode); +if (bnxt_qplib_determine_atomics (en_dev->pdev)) +ibdev_info (&rdev->ibdev, +"platform doesn't support global atomics." ); +return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_res.c +15 -0
@@ -959,3 +959,18 @@ int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev,bnxt_qplib_free_res (res);return rc; } + +bool bnxt_qplib_determine_atomics (struct pci_dev *dev) +{ +u16 ctl2; + +if (pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP32 ) && +pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP64 )) +return true;/* Failure */ +pcie_capability_read_word (dev,PCI_EXP_DEVCTL2 , &ctl2); +if (ctl2 &PCI_EXP_DEVCTL2_ATOMIC_REQ ) +return 0 ;/* Success */ +pcie_capability_set_word (dev,PCI_EXP_DEVCTL2 , +PCI_EXP_DEVCTL2_ATOMIC_REQ ); +return 0 ;/* Success */ +}
drivers/infiniband/hw/bnxt_re/qplib_res.h +1 -0
@@ -373,6 +373,7 @@ void bnxt_qplib_free_ctx(struct bnxt_qplib_res *res,int bnxt_qplib_alloc_ctx (struct bnxt_qplib_res *res,struct bnxt_qplib_ctx *ctx,bool virt_fn,bool is_p5); +bool bnxt_qplib_determine_atomics (struct pci_dev *dev);static inline void bnxt_qplib_hwq_incr_prod (struct bnxt_qplib_hwq *hwq,u32 cnt) {
drivers/infiniband/hw/bnxt_re/qplib_sp.c +12 -1
@@ -54,6 +54,17 @@ const struct bnxt_qplib_gid bnxt_qplib_gid_zero = {{ 0, 0, 0, 0, 0, 0, 0, 0,/* Device */ +static u8 bnxt_qplib_is_atomic_cap (struct bnxt_qplib_rcfw *rcfw) +{ +u16 pcie_ctl2 =0 ; + +if (!bnxt_qplib_is_chip_gen_p5 (rcfw->res->cctx)) +return false; + +pcie_capability_read_word (rcfw->pdev,PCI_EXP_DEVCTL2 , &pcie_ctl2); +return (pcie_ctl2 &PCI_EXP_DEVCTL2_ATOMIC_REQ ); +} +static void bnxt_qplib_query_version (struct bnxt_qplib_rcfw *rcfw,char *fw_ver) {
@@ -162,7 +173,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, attr->tqm_alloc_reqs[i *4 +3 ] = *(++tqm_alloc); } - attr->is_atomic = false; + attr->is_atomic =bnxt_qplib_is_atomic_cap (rcfw); bail:bnxt_qplib_rcfw_free_sbuf (rcfw, sbuf);return rc;
drivers/infiniband/hw/bnxt_re/qplib_sp.h +0 -2
@@ -42,8 +42,6 @@#define BNXT_QPLIB_RESERVED_QP_WRS 128 -#define PCI_EXP_DEVCTL2_ATOMIC_REQ 0x0040 -struct bnxt_qplib_dev_attr {#define FW_VER_ARR_LEN 4u8 fw_ver[FW_VER_ARR_LEN ];
Signature · 1 line
2.25.1
Jason Gunthorpe
maintainerRe: [PATCH for-next V3 1/3] RDMA/bnxt_re: Enable global atomic ops if platform supports
Quoted 4 lines · Devesh Sharma
drivers/infiniband/hw/bnxt_re/qplib_res.c +4
-0+bool bnxt_qplib_determine_atomics (struct pci_dev *dev) +{ +u16 ctl2; +
drivers/infiniband/hw/bnxt_re/qplib_res.c int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev, · line 976
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/qplib_res.c +10
-0+if (pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP32 ) && +pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP64 )) +return true;/* Failure */ +pcie_capability_read_word (dev,PCI_EXP_DEVCTL2 , &ctl2); +if (ctl2 &PCI_EXP_DEVCTL2_ATOMIC_REQ ) +return 0 ;/* Success */ +pcie_capability_set_word (dev,PCI_EXP_DEVCTL2 , +PCI_EXP_DEVCTL2_ATOMIC_REQ ); +return 0 ;/* Success */ +}
true on failure, 0 on success and the error code is thrown away?? Please return -ENOTSUPP or something on error
Jason
Re: [PATCH for-next V3 1/3] RDMA/bnxt_re: Enable global atomic ops if platform supports
Quoted 11 lines · Jason Gunthorpe
Quoted 9 lines · Devesh Sharma
drivers/infiniband/hw/bnxt_re/qplib_res.c +9
-0+bool bnxt_qplib_determine_atomics (struct pci_dev *dev) +{ +u16 ctl2; + +if (pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP32 ) && +pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP64 )) +return true;/* Failure */ +pcie_capability_read_word (dev,PCI_EXP_DEVCTL2 , &ctl2); +if (ctl2 &PCI_EXP_DEVCTL2_ATOMIC_REQ )
Quoted 8 lines
drivers/infiniband/hw/bnxt_re/qplib_res.c int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev, · line 976
Quoted 5 lines
drivers/infiniband/hw/bnxt_re/qplib_res.c +5
-0+return 0 ;/* Success */ +pcie_capability_set_word (dev,PCI_EXP_DEVCTL2 , +PCI_EXP_DEVCTL2_ATOMIC_REQ ); +return 0 ;/* Success */ +}true on failure, 0 on success and the error code is thrown away?? Please return
-ENOTSUPPor something on error
make sense.
Quoted 2 lines
Jason
Signature · 2 lines
-Regards Devesh
Jason Gunthorpe
maintainerRe: [PATCH for-next V3 1/3] RDMA/bnxt_re: Enable global atomic ops if platform supports
Quoted 20 lines · Devesh Sharma
Quoted 11 lines · Jason Gunthorpe
Quoted 9 lines · Devesh Sharma
drivers/infiniband/hw/bnxt_re/qplib_res.c +9
-0+bool bnxt_qplib_determine_atomics (struct pci_dev *dev) +{ +u16 ctl2; + +if (pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP32 ) && +pci_enable_atomic_ops_to_root (dev,PCI_EXP_DEVCAP2_ATOMIC_COMP64 )) +return true;/* Failure */ +pcie_capability_read_word (dev,PCI_EXP_DEVCTL2 , &ctl2); +if (ctl2 &PCI_EXP_DEVCTL2_ATOMIC_REQ )Quoted 8 lines
drivers/infiniband/hw/bnxt_re/qplib_res.c int bnxt_qplib_alloc_res(struct bnxt_qplib_res *res, struct pci_dev *pdev, · line 976
Quoted 5 lines
drivers/infiniband/hw/bnxt_re/qplib_res.c +5
-0+return 0 ;/* Success */ +pcie_capability_set_word (dev,PCI_EXP_DEVCTL2 , +PCI_EXP_DEVCTL2_ATOMIC_REQ ); +return 0 ;/* Success */ +}true on failure, 0 on success and the error code is thrown away?? Please return
-ENOTSUPPor something on error
Quoted 1 line
make sense.
I just noticed another mixing of types with return bool/return 0 in the same function, please check them all
Jason
PATCH v3 2/3 bnxt_re: Update maintainers list
In reply to Devesh SharmaUpdated the maintainers list and removed
non-active members.
--- MAINTAINERS | 2 -- 1 file changed, 2 deletions(-)
MAINTAINERS +0 -2
@@ -3736,8 +3736,6 @@ F: drivers/gpio/gpio-bcm-kona.c BROADCOM NETXTREME-E ROCE DRIVER M: Selvin Xavier <[email protected]> M: Devesh Sharma <[email protected]> -M: Somnath Kotur <[email protected]> -M: Sriharsha Basavapatna <[email protected]> M: Naresh Kumar PBS <[email protected]> L: [email protected] S: Supported
Signature · 1 line
2.25.1
PATCH v3 3/3 RDMA/bnxt_re: update ABI to pass wqe-mode to user space
In reply to Devesh SharmaChanging ucontext ABI response structure to pass wqe_mode to user library.
A flag in comp_mask has been set to indicate presence of wqe_mode.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 3 +++ include/uapi/rdma/bnxt_re-abi.h | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 -0
@@ -3882,6 +3882,9 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata) resp.max_cqd = dev_attr->max_cq_wqes; resp.rsvd =0 ; + resp.comp_mask |=BNXT_RE_UCNTX_CMASK_HAVE_MODE ; + resp.mode = rdev->chip_ctx->modes.wqe_mode; + rc =ib_copy_to_udata (udata, &resp,min (udata->outlen,sizeof (resp)));if (rc) {ibdev_err (ibdev,"Failed to copy user context" );
include/uapi/rdma/bnxt_re-abi.h +4 -1
@@ -49,7 +49,8 @@#define BNXT_RE_CHIP_ID0_CHIP_MET_SFT 0x18enum { -BNXT_RE_UCNTX_CMASK_HAVE_CCTX =0x1ULL +BNXT_RE_UCNTX_CMASK_HAVE_CCTX =0x1ULL , +BNXT_RE_UCNTX_CMASK_HAVE_MODE =0x02ULL };struct bnxt_re_uctx_resp {
@@ -62,6 +63,8 @@ struct bnxt_re_uctx_resp {__aligned_u64 comp_mask;__u32 chip_id0;__u32 chip_id1; +__u32 mode; +__u32 rsvd1;/* padding */ };/*
Signature · 1 line
2.25.1