Broadcom's rdma provider lib update
v2 cover Broadcom's rdma provider lib update
This patch series is a part of bigger feature submission which changes the wqe posting logic. The current series adds the ground work in the direction to change the wqe posting algorithm.
v1->v2
- added Fixes tag
- updated patch description
- dropped if() check before free.
Devesh Sharma (4):
bnxt_re/lib: Check AH handler validity before use bnxt_re/lib: align base sq entry structure to 16B boundary bnxt_re/lib: consolidate hwque and swque in common structure bnxt_re/lib: query device attributes only once and store
providers/bnxt_re/bnxt_re-abi.h | 24 ++--- providers/bnxt_re/db.c | 6 +- providers/bnxt_re/main.c | 31 +++--- providers/bnxt_re/main.h | 15 ++- providers/bnxt_re/verbs.c | 182 +++++++++++++++++--------------- 5 files changed, 138 insertions(+), 120 deletions(-)
Signature · 1 line
2.25.1
PATCH v2 1/4 bnxt_re/lib: Check AH handler validity before use
Provider library should check the validity of AH
handler before referencing it.
Fixing the AH validity check when initializing the UD SQE from AH.
--- providers/bnxt_re/verbs.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
providers/bnxt_re/verbs.c +2 -2
@@ -1193,13 +1193,13 @@ static int bnxt_re_build_ud_sqe(struct bnxt_re_qp *qp, void *wqe,int len; len =bnxt_re_build_send_sqe (qp, wqe, wr, is_inline); - sqe->qkey =htole32 (wr->wr.ud.remote_qkey); - sqe->dst_qp =htole32 (wr->wr.ud.remote_qpn);if (!wr->wr.ud.ah) { len = -EINVAL ; goto bail; } ah =to_bnxt_re_ah (wr->wr.ud.ah); + sqe->qkey =htole32 (wr->wr.ud.remote_qkey); + sqe->dst_qp =htole32 (wr->wr.ud.remote_qpn); sqe->avid =htole32 (ah->avid &0xFFFFF ); bail:return len;
Signature · 1 line
2.25.1
PATCH v2 2/4 bnxt_re/lib: align base sq entry structure to 16B boundary
In reply to Devesh SharmaBreaking the send_wqe and recv_wqe hardware specific interface into smaller chunk size instead of fixed 128B chunks. This make both post-send and post-recv flexible.
--- providers/bnxt_re/bnxt_re-abi.h | 24 ++++++++++-------------- providers/bnxt_re/verbs.c | 26 ++++++++++++-------------- 2 files changed, 22 insertions(+), 28 deletions(-)
providers/bnxt_re/bnxt_re-abi.h +10 -14
@@ -234,9 +234,16 @@ struct bnxt_re_term_cqe {__le64 rsvd1; }; +union lower_shdr { +__le64 qkey_len; +__le64 lkey_plkey; +__le64 rva; +}; +struct bnxt_re_bsqe {__le32 rsv_ws_fl_wt;__le32 key_immd; +union lower_shdr lhdr; };struct bnxt_re_psns {
@@ -262,42 +269,33 @@ struct bnxt_re_sge {#define BNXT_RE_MAX_INLINE_SIZE 0x60struct bnxt_re_send { -__le32 length; -__le32 qkey;__le32 dst_qp;__le32 avid;__le64 rsvd; };struct bnxt_re_raw { -__le32 length; -__le32 rsvd1;__le32 cfa_meta;__le32 rsvd2;__le64 rsvd3; };struct bnxt_re_rdma { -__le32 length; -__le32 rsvd1;__le64 rva;__le32 rkey;__le32 rsvd2; };struct bnxt_re_atomic { -__le64 rva;__le64 swp_dt;__le64 cmp_dt; };struct bnxt_re_inval { -__le64 rsvd[3 ]; +__le64 rsvd[2 ]; };struct bnxt_re_bind { -__le32 plkey; -__le32 lkey;__le64 va;__le64 len;/* only 40 bits are valid */ };
@@ -305,17 +303,15 @@ struct bnxt_re_bind {struct bnxt_re_brqe {__le32 rsv_ws_fl_wt;__le32 rsvd; +__le32 wrid; +__le32 rsvd1; };struct bnxt_re_rqe { -__le32 wrid; -__le32 rsvd1;__le64 rsvd[2 ]; };struct bnxt_re_srqe { -__le32 srq_tag;/* 20 bits are valid */ -__le32 rsvd1;__le64 rsvd[2 ]; };#endif
providers/bnxt_re/verbs.c +12 -14
@@ -1150,17 +1150,16 @@ static void bnxt_re_fill_wrid(struct bnxt_re_wrid *wrid, struct ibv_send_wr *wr,static int bnxt_re_build_send_sqe (struct bnxt_re_qp *qp,void *wqe,struct ibv_send_wr *wr,uint8_t is_inline) { -struct bnxt_re_bsqe *hdr = wqe; -struct bnxt_re_send *sqe = ((void *)wqe +sizeof (struct bnxt_re_bsqe ));struct bnxt_re_sge *sge = ((void *)wqe +bnxt_re_get_sqe_hdr_sz ()); +struct bnxt_re_bsqe *hdr = wqe;uint32_t wrlen, hdrval =0 ; -int len;uint8_t opcode, qesize; +int len; len =bnxt_re_build_sge (sge, wr->sg_list, wr->num_sge, is_inline);if (len <0 )return len; - sqe->length =htole32 (len); + hdr->lhdr.qkey_len =htole64 ((uint64_t )len);/* Fill Header */ opcode =bnxt_re_ibv_to_bnxt_wr_opcd (wr->opcode);
@@ -1189,7 +1188,9 @@ static int bnxt_re_build_ud_sqe(struct bnxt_re_qp *qp, void *wqe, struct ibv_send_wr *wr, uint8_t is_inline) {struct bnxt_re_send *sqe = ((void *)wqe +sizeof (struct bnxt_re_bsqe )); +struct bnxt_re_bsqe *hdr = wqe;struct bnxt_re_ah *ah; +uint64_t qkey;int len; len =bnxt_re_build_send_sqe (qp, wqe, wr, is_inline);
@@ -1198,7 +1199,8 @@ static int bnxt_re_build_ud_sqe(struct bnxt_re_qp *qp, void *wqe, goto bail; } ah =to_bnxt_re_ah (wr->wr.ud.ah); - sqe->qkey =htole32 (wr->wr.ud.remote_qkey); + qkey = wr->wr.ud.remote_qkey; + hdr->lhdr.qkey_len |=htole64 (qkey <<32 ); sqe->dst_qp =htole32 (wr->wr.ud.remote_qpn); sqe->avid =htole32 (ah->avid &0xFFFFF ); bail:
@@ -1228,7 +1230,7 @@ static int bnxt_re_build_cns_sqe(struct bnxt_re_qp *qp, void *wqe, len =bnxt_re_build_send_sqe (qp, wqe, wr, false); hdr->key_immd =htole32 (wr->wr.atomic.rkey); - sqe->rva =htole64 (wr->wr.atomic.remote_addr); + hdr->lhdr.rva =htole64 (wr->wr.atomic.remote_addr); sqe->cmp_dt =htole64 (wr->wr.atomic.compare_add); sqe->swp_dt =htole64 (wr->wr.atomic.swap);
@@ -1245,7 +1247,7 @@ static int bnxt_re_build_fna_sqe(struct bnxt_re_qp *qp, void *wqe, len =bnxt_re_build_send_sqe (qp, wqe, wr, false); hdr->key_immd =htole32 (wr->wr.atomic.rkey); - sqe->rva =htole64 (wr->wr.atomic.remote_addr); + hdr->lhdr.rva =htole64 (wr->wr.atomic.remote_addr); sqe->cmp_dt =htole64 (wr->wr.atomic.compare_add);return len;
@@ -1368,13 +1370,11 @@ static int bnxt_re_build_rqe(struct bnxt_re_qp *qp, struct ibv_recv_wr *wr, void *rqe) {struct bnxt_re_brqe *hdr = rqe; -struct bnxt_re_rqe *rwr; -struct bnxt_re_sge *sge;struct bnxt_re_wrid *wrid; +struct bnxt_re_sge *sge;int wqe_sz, len;uint32_t hdrval; - rwr = (rqe +sizeof (struct bnxt_re_brqe )); sge = (rqe +bnxt_re_get_rqe_hdr_sz ()); wrid = &qp->rwrid[qp->rqq->tail];
@@ -1388,7 +1388,7 @@ static int bnxt_re_build_rqe(struct bnxt_re_qp *qp, struct ibv_recv_wr *wr, hdrval =BNXT_RE_WR_OPCD_RECV ; hdrval |= ((wqe_sz &BNXT_RE_HDR_WS_MASK ) <<BNXT_RE_HDR_WS_SHIFT ); hdr->rsv_ws_fl_wt =htole32 (hdrval); - rwr->wrid =htole32 (qp->rqq->tail); + hdr->wrid =htole32 (qp->rqq->tail);/* Fill wrid */ wrid->wrid = wr->wr_id;
@@ -1586,13 +1586,11 @@ static int bnxt_re_build_srqe(struct bnxt_re_srq *srq, struct ibv_recv_wr *wr, void *srqe) { struct bnxt_re_brqe *hdr = srqe; -struct bnxt_re_rqe *rwr;struct bnxt_re_sge *sge;struct bnxt_re_wrid *wrid;int wqe_sz, len, next;uint32_t hdrval =0 ; - rwr = (srqe +sizeof (struct bnxt_re_brqe )); sge = (srqe +bnxt_re_get_srqe_hdr_sz ()); next = srq->start_idx; wrid = &srq->srwrid[next];
@@ -1602,7 +1600,7 @@ static int bnxt_re_build_srqe(struct bnxt_re_srq *srq, wqe_sz = wr->num_sge + (bnxt_re_get_srqe_hdr_sz () >>4 );/* 16B align */ hdrval |= ((wqe_sz &BNXT_RE_HDR_WS_MASK ) <<BNXT_RE_HDR_WS_SHIFT ); hdr->rsv_ws_fl_wt =htole32 (hdrval); - rwr->wrid =htole32 ((uint32_t )next); + hdr->wrid =htole32 ((uint32_t )next);/* Fill wrid */ wrid->wrid = wr->wr_id;
Signature · 1 line
2.25.1
PATCH v2 3/4 bnxt_re/lib: consolidate hwque and swque in common structure
In reply to Devesh SharmaConsolidating hardware queue (hwque) and software queue (swque) under a single bookkeeping data structure bnxt_re_joint_queue.
This is to ease the hardware and software queue management. Further reduces the size of bnxt_re_qp structure.
--- providers/bnxt_re/db.c | 6 +- providers/bnxt_re/main.h | 13 ++-- providers/bnxt_re/verbs.c | 131 +++++++++++++++++++++----------------- 3 files changed, 85 insertions(+), 65 deletions(-)
providers/bnxt_re/db.c +4 -2
@@ -63,7 +63,8 @@ void bnxt_re_ring_rq_db(struct bnxt_re_qp *qp) {struct bnxt_re_db_hdr hdr; -bnxt_re_init_db_hdr (&hdr, qp->rqq->tail, qp->qpid,BNXT_RE_QUE_TYPE_RQ ); +bnxt_re_init_db_hdr (&hdr, qp->jrqq->hwque->tail, + qp->qpid,BNXT_RE_QUE_TYPE_RQ );bnxt_re_ring_db (qp->udpi, &hdr); }
@@ -71,7 +72,8 @@ void bnxt_re_ring_sq_db(struct bnxt_re_qp *qp) {struct bnxt_re_db_hdr hdr; -bnxt_re_init_db_hdr (&hdr, qp->sqq->tail, qp->qpid,BNXT_RE_QUE_TYPE_SQ ); +bnxt_re_init_db_hdr (&hdr, qp->jsqq->hwque->tail, + qp->qpid,BNXT_RE_QUE_TYPE_SQ );bnxt_re_ring_db (qp->udpi, &hdr); }
providers/bnxt_re/main.h +9 -4
@@ -120,13 +120,18 @@ struct bnxt_re_srq {bool arm_req; }; +struct bnxt_re_joint_queue { +struct bnxt_re_queue *hwque; +struct bnxt_re_wrid *swque; +uint32_t start_idx; +uint32_t last_idx; +}; +struct bnxt_re_qp {struct ibv_qp ibvqp;struct bnxt_re_chip_ctx *cctx; -struct bnxt_re_queue *sqq; -struct bnxt_re_wrid *swrid; -struct bnxt_re_queue *rqq; -struct bnxt_re_wrid *rwrid; +struct bnxt_re_joint_queue *jsqq; +struct bnxt_re_joint_queue *jrqq;struct bnxt_re_srq *srq;struct bnxt_re_cq *scq;struct bnxt_re_cq *rcq;
providers/bnxt_re/verbs.c +72 -59
288 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v2 4/4 bnxt_re/lib: query device attributes only once and store
In reply to Devesh SharmaMaking a change to query device attributes only once during context initialization. Context structure would store the attributes for future reference. This avoids multiple user to kernel context switch during QP creation.
--- providers/bnxt_re/main.c | 31 ++++++++++++++++++------------- providers/bnxt_re/main.h | 2 ++ providers/bnxt_re/verbs.c | 25 +++++++++++-------------- 3 files changed, 31 insertions(+), 27 deletions(-)
providers/bnxt_re/main.c +18 -13
@@ -129,10 +129,11 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev,int cmd_fd, void *private_data) { - struct ibv_get_context cmd; + struct bnxt_re_dev *rdev = to_bnxt_re_dev(vdev);struct ubnxt_re_cntx_resp resp; -struct bnxt_re_dev *dev =to_bnxt_re_dev (vdev);struct bnxt_re_context *cntx; +struct ibv_get_context cmd; +int ret; cntx =verbs_init_and_alloc_context (vdev, cmd_fd, cntx, ibvctx,RDMA_DRIVER_BNXT_RE );
@@ -146,9 +147,9 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev, cntx->dev_id = resp.dev_id; cntx->max_qp = resp.max_qp; - dev->pg_size = resp.pg_size; - dev->cqe_size = resp.cqe_sz; - dev->max_cq_depth = resp.max_cqd; + rdev->pg_size = resp.pg_size; + rdev->cqe_size = resp.cqe_sz; + rdev->max_cq_depth = resp.max_cqd;if (resp.comp_mask &BNXT_RE_UCNTX_CMASK_HAVE_CCTX ) { cntx->cctx.chip_num = resp.chip_id0 &0xFFFF ; cntx->cctx.chip_rev = (resp.chip_id0 >>
@@ -159,7 +160,7 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev, }pthread_spin_init (&cntx->fqlock,PTHREAD_PROCESS_PRIVATE );/* mmap shared page. */ - cntx->shpg =mmap (NULL , dev->pg_size,PROT_READ |PROT_WRITE , + cntx->shpg =mmap (NULL , rdev->pg_size,PROT_READ |PROT_WRITE ,MAP_SHARED , cmd_fd,0 );if (cntx->shpg ==MAP_FAILED ) { cntx->shpg =NULL ;
@@ -168,6 +169,10 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev,pthread_mutex_init (&cntx->shlock,NULL );verbs_set_ops (&cntx->ibvctx, &bnxt_re_cntx_ops); + cntx->rdev = rdev; + ret =ibv_query_device (&cntx->ibvctx.context, &rdev->devattr); +if (ret) + goto failed;return &cntx->ibvctx;
@@ -180,19 +185,19 @@ failed:static void bnxt_re_free_context (struct ibv_context *ibvctx) {struct bnxt_re_context *cntx =to_bnxt_re_context (ibvctx); -struct bnxt_re_dev *dev =to_bnxt_re_dev (ibvctx->device); +struct bnxt_re_dev *rdev =to_bnxt_re_dev (ibvctx->device);/* Unmap if anything device specific was mapped in init_context. */ pthread_mutex_destroy (&cntx->shlock);if (cntx->shpg) -munmap (cntx->shpg, dev->pg_size); +munmap (cntx->shpg, rdev->pg_size);pthread_spin_destroy (&cntx->fqlock);/* Un-map DPI only for the first PD that was * allocated in this context. */ if (cntx->udpi.dbpage && cntx->udpi.dbpage !=MAP_FAILED ) { -munmap (cntx->udpi.dbpage, dev->pg_size); +munmap (cntx->udpi.dbpage, rdev->pg_size); cntx->udpi.dbpage =NULL ; }
@@ -203,13 +208,13 @@ static void bnxt_re_free_context(struct ibv_context *ibvctx)static struct verbs_device *bnxt_re_device_alloc (struct verbs_sysfs_dev *sysfs_dev) { -struct bnxt_re_dev *dev; +struct bnxt_re_dev *rdev; - dev =calloc (1 ,sizeof (*dev)); -if (!dev) + rdev =calloc (1 ,sizeof (*rdev)); +if (!rdev)return NULL ; -return &dev->vdev; +return &rdev->vdev; }static const struct verbs_device_ops bnxt_re_dev_ops = {
providers/bnxt_re/main.h +2 -0
@@ -166,10 +166,12 @@ struct bnxt_re_dev {uint32_t cqe_size;uint32_t max_cq_depth; +struct ibv_device_attr devattr; };struct bnxt_re_context {struct verbs_context ibvctx; +struct bnxt_re_dev *rdev;uint32_t dev_id;uint32_t max_qp;struct bnxt_re_chip_ctx cctx;
providers/bnxt_re/verbs.c +11 -14
@@ -777,25 +777,22 @@ int bnxt_re_arm_cq(struct ibv_cq *ibvcq, int flags)static int bnxt_re_check_qp_limits (struct bnxt_re_context *cntx,struct ibv_qp_init_attr *attr) { -struct ibv_device_attr devattr; -int ret; +struct ibv_device_attr *devattr; +struct bnxt_re_dev *rdev; - ret =bnxt_re_query_device ( - &cntx->ibvctx.context,NULL , - container_of(&devattr, struct ibv_device_attr_ex, orig_attr), -sizeof (devattr)); -if (ret) -return ret; -if (attr->cap.max_send_sge > devattr.max_sge) + rdev = cntx->rdev; + devattr = &rdev->devattr; + +if (attr->cap.max_send_sge > devattr->max_sge)return EINVAL ; -if (attr->cap.max_recv_sge > devattr.max_sge) +if (attr->cap.max_recv_sge > devattr->max_sge)return EINVAL ;if (attr->cap.max_inline_data >BNXT_RE_MAX_INLINE_SIZE )return EINVAL ; -if (attr->cap.max_send_wr > devattr.max_qp_wr) - attr->cap.max_send_wr = devattr.max_qp_wr; -if (attr->cap.max_recv_wr > devattr.max_qp_wr) - attr->cap.max_recv_wr = devattr.max_qp_wr; +if (attr->cap.max_send_wr > devattr->max_qp_wr) + attr->cap.max_send_wr = devattr->max_qp_wr; +if (attr->cap.max_recv_wr > devattr->max_qp_wr) + attr->cap.max_recv_wr = devattr->max_qp_wr;return 0 ; }
Signature · 1 line
2.25.1
Quoted 23 lines · Devesh Sharma
This patch series is a part of bigger feature submission which changes the wqe posting logic. The current series adds the ground work in the direction to change the wqe posting algorithm.
v1->v2
- added Fixes tag
- updated patch description
- droppedif()check before free.Devesh Sharma (4):
bnxt_re/lib: Check AH handler validity before use bnxt_re/lib: align base sq entry structure to 16B boundary bnxt_re/lib: consolidate hwque and swque in common structure bnxt_re/lib: query device attributes only once and storeproviders/bnxt_re/bnxt_re-abi.h | 24 ++--- providers/bnxt_re/db.c | 6 +- providers/bnxt_re/main.c | 31 +++--- providers/bnxt_re/main.h | 15 ++- providers/bnxt_re/verbs.c | 182 +++++++++++++++++--------------- 5 files changed, 138 insertions(+), 120 deletions(-)
Quoted 3 lines
--
2.25.1
Hello Maintainers, Could you bless the V2 if there are no more comments/suggestions...
Signature · 2 lines
-Regards Devesh
Quoted 25 lines · Devesh Sharma
Quoted 23 lines · Devesh Sharma
This patch series is a part of bigger feature submission which changes the wqe posting logic. The current series adds the ground work in the direction to change the wqe posting algorithm.
v1->v2
- added Fixes tag
- updated patch description
- droppedif()check before free.Devesh Sharma (4):
bnxt_re/lib: Check AH handler validity before use bnxt_re/lib: align base sq entry structure to 16B boundary bnxt_re/lib: consolidate hwque and swque in common structure bnxt_re/lib: query device attributes only once and storeproviders/bnxt_re/bnxt_re-abi.h | 24 ++--- providers/bnxt_re/db.c | 6 +- providers/bnxt_re/main.c | 31 +++--- providers/bnxt_re/main.h | 15 ++- providers/bnxt_re/verbs.c | 182 +++++++++++++++++--------------- 5 files changed, 138 insertions(+), 120 deletions(-)
Quoted 5 lines
Quoted 3 lines
--
2.25.1Hello Maintainers, Could you bless the V2 if there are no more comments/suggestions...
I planned to take it after rdma-core release (today/tomorrow).
Thanks
Quoted 4 lines
Signature · 3 lines
-- -Regards Devesh
Quoted 30 lines · Leon Romanovsky
Quoted 28 lines · Devesh Sharma
Quoted 26 lines · Devesh Sharma
This patch series is a part of bigger feature submission which changes the wqe posting logic. The current series adds the ground work in the direction to change the wqe posting algorithm.
v1->v2
- added Fixes tag
- updated patch description
- droppedif()check before free.Devesh Sharma (4):
bnxt_re/lib: Check AH handler validity before use bnxt_re/lib: align base sq entry structure to 16B boundary bnxt_re/lib: consolidate hwque and swque in common structure bnxt_re/lib: query device attributes only once and storeproviders/bnxt_re/bnxt_re-abi.h | 24 ++--- providers/bnxt_re/db.c | 6 +- providers/bnxt_re/main.c | 31 +++--- providers/bnxt_re/main.h | 15 ++- providers/bnxt_re/verbs.c | 182 +++++++++++++++++--------------- 5 files changed, 138 insertions(+), 120 deletions(-)--
2.25.1
Quoted 6 lines
Quoted 2 lines
Hello Maintainers, Could you bless the V2 if there are no more comments/suggestions...
I planned to take it after rdma-core release (today/tomorrow).
Thanks
Sure, Thanks.
Quoted 7 lines
Quoted 5 lines
--
-Regards
Devesh
Leon Romanovsky
AppliedQuoted 31 lines · Devesh Sharma
Quoted 30 lines · Leon Romanovsky
Quoted 28 lines · Devesh Sharma
Quoted 26 lines · Devesh Sharma
This patch series is a part of bigger feature submission which changes the wqe posting logic. The current series adds the ground work in the direction to change the wqe posting algorithm.
v1->v2
- added Fixes tag
- updated patch description
- droppedif()check before free.Devesh Sharma (4):
bnxt_re/lib: Check AH handler validity before use bnxt_re/lib: align base sq entry structure to 16B boundary bnxt_re/lib: consolidate hwque and swque in common structure bnxt_re/lib: query device attributes only once and storeproviders/bnxt_re/bnxt_re-abi.h | 24 ++--- providers/bnxt_re/db.c | 6 +- providers/bnxt_re/main.c | 31 +++--- providers/bnxt_re/main.h | 15 ++- providers/bnxt_re/verbs.c | 182 +++++++++++++++++--------------- 5 files changed, 138 insertions(+), 120 deletions(-)--
2.25.1
Quoted 7 lines
Quoted 6 lines
Quoted 2 lines
Hello Maintainers, Could you bless the V2 if there are no more comments/suggestions...
I planned to take it after rdma-core release (today/tomorrow).
Thanks
Sure, Thanks.
Applied, thanks
Quoted 7 lines
Quoted 7 lines
Quoted 5 lines
--
-Regards
Devesh