Broadcom's user library update
v3 cover Broadcom's user library update
The focus of this patch series is to move SQ and RQ wqe posting indices from 128B fixed stride to 16B aligned stride. This allows more flexibility in choosing wqe size.
v2 -> V3
- Split the ABI change into separate patch
- committed ABI patch using standard rdma-core script.
Devesh Sharma (5):
Update kernel headers
bnxt_re/lib: Read wqe mode from the driver bnxt_re/lib: add a function to initialize software queue bnxt_re/lib: Use separate indices for shadow queue bnxt_re/lib: Move hardware queue to 16B aligned indices
kernel-headers/rdma/bnxt_re-abi.h | 5 +- providers/bnxt_re/bnxt_re-abi.h | 5 + providers/bnxt_re/db.c | 10 +- providers/bnxt_re/main.c | 4 + providers/bnxt_re/main.h | 26 ++ providers/bnxt_re/memory.h | 37 ++- providers/bnxt_re/verbs.c | 522 ++++++++++++++++++++---------- 7 files changed, 431 insertions(+), 178 deletions(-)
Signature · 1 line
2.25.1
PATCH v3 1/5 Update kernel headers
To commit ?? ("RDMA/bnxt_re: update ABI to pass wqe-mode to user space").
--- kernel-headers/rdma/bnxt_re-abi.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
kernel-headers/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
PATCH v3 2/5 bnxt_re/lib: Read wqe mode from the driver
In reply to Devesh SharmaDuring bnxt_re device context creation, read the wqe mode and store it in context structure and in the QP context structure. wqe mode would be required to change between fixed size wqe and non-fixed sized wqe modes of SQ/RQ in gen-p5 or newer devices.
--- providers/bnxt_re/bnxt_re-abi.h | 5 +++++ providers/bnxt_re/main.c | 4 ++++ providers/bnxt_re/main.h | 2 ++ providers/bnxt_re/verbs.c | 1 + 4 files changed, 12 insertions(+)
providers/bnxt_re/bnxt_re-abi.h +5 -0
@@ -196,6 +196,11 @@ enum bnxt_re_ud_cqe_mask {BNXT_RE_UD_CQE_SRCQPLO_SHIFT =0x30 }; +enum bnxt_re_modes { +BNXT_RE_WQE_MODE_STATIC =0x00 , +BNXT_RE_WQE_MODE_VARIABLE =0x01 +}; +struct bnxt_re_db_hdr {__le32 indx;__le32 typ_qid;/* typ: 4, qid:20*/
providers/bnxt_re/main.c +4 -0
@@ -158,6 +158,10 @@ static struct verbs_context *bnxt_re_alloc_context(struct ibv_device *vdev, BNXT_RE_CHIP_ID0_CHIP_MET_SFT) &0xFF ; } + +if (resp.comp_mask &BNXT_RE_UCNTX_CMASK_HAVE_MODE ) + cntx->wqe_mode = resp.mode; +pthread_spin_init (&cntx->fqlock,PTHREAD_PROCESS_PRIVATE );/* mmap shared page. */ cntx->shpg = mmap(NULL, rdev->pg_size, PROT_READ | PROT_WRITE,
providers/bnxt_re/main.h +2 -0
@@ -146,6 +146,7 @@ struct bnxt_re_qp {uint64_t wqe_cnt;uint16_t mtu;uint16_t qpst; +uint32_t qpmode;uint8_t qptyp;/* irdord? */ };
@@ -178,6 +179,7 @@ struct bnxt_re_context {uint32_t max_srq;struct bnxt_re_dpi udpi;void *shpg; +uint32_t wqe_mode;pthread_mutex_t shlock;pthread_spinlock_t fqlock; };
providers/bnxt_re/verbs.c +1 -0
@@ -952,6 +952,7 @@ struct ibv_qp *bnxt_re_create_qp(struct ibv_pd *ibvpd, goto fail;/* alloc queues */ qp->cctx = &cntx->cctx; + qp->qpmode = cntx->wqe_mode &BNXT_RE_WQE_MODE_VARIABLE ;if (bnxt_re_alloc_queues (qp, attr, dev->pg_size)) goto failq;/* Fill ibv_cmd */
Signature · 1 line
2.25.1
PATCH v3 3/5 bnxt_re/lib: add a function to initialize software queue
In reply to Devesh SharmaSplitting the shadow software queue initialization into a separate function. Same is being called for both RQ and SQ during create QP.
--- providers/bnxt_re/main.h | 3 ++ providers/bnxt_re/verbs.c | 62 ++++++++++++++++++++++++--------------- 2 files changed, 42 insertions(+), 23 deletions(-)
providers/bnxt_re/main.h +3 -0
@@ -96,7 +96,10 @@ struct bnxt_re_wrid {uint64_t wrid;uint32_t bytes;int next_idx; +uint32_t st_slot_idx; +uint8_t slots;uint8_t sig; + };struct bnxt_re_qpcap {
providers/bnxt_re/verbs.c +39 -23
111 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 4/5 bnxt_re/lib: Use separate indices for shadow queue
In reply to Devesh SharmaThe shadow queue is used for wrid and flush wqe management. The indices used in this queue are independent to what is actually used by hardware. Thus, detaching the shadow queue indices from hardware queue indices. This even more useful when the hardware queue indices has alignment other than wqe boundary.
--- providers/bnxt_re/main.h | 20 ++++++ providers/bnxt_re/memory.h | 8 +-- providers/bnxt_re/verbs.c | 128 ++++++++++++++++++++++--------------- 3 files changed, 101 insertions(+), 55 deletions(-)
providers/bnxt_re/main.h +20 -0
@@ -437,4 +437,24 @@ static inline void bnxt_re_change_cq_phase(struct bnxt_re_cq *cq)if (!cq->cqq.head) cq->phase = (~cq->phase & BNXT_RE_BCQE_PH_MASK); } + +static inline void *bnxt_re_get_swqe (struct bnxt_re_joint_queue *jqq, +uint32_t *wqe_idx) +{ +if (wqe_idx) + *wqe_idx = jqq->start_idx; +return &jqq->swque[jqq->start_idx]; +} + +static inline void bnxt_re_jqq_mod_start (struct bnxt_re_joint_queue *jqq, +uint32_t idx) +{ + jqq->start_idx = jqq->swque[idx].next_idx; +} + +static inline void bnxt_re_jqq_mod_last (struct bnxt_re_joint_queue *jqq, +uint32_t idx) +{ + jqq->last_idx = jqq->swque[idx].next_idx; +}#endif
providers/bnxt_re/memory.h +4 -4
@@ -97,14 +97,14 @@ static inline uint32_t bnxt_re_incr(uint32_t val, uint32_t max) return (++val & (max - 1)); } -static inline void bnxt_re_incr_tail (struct bnxt_re_queue *que) +static inline void bnxt_re_incr_tail (struct bnxt_re_queue *que,uint8_t cnt) { - que->tail =bnxt_re_incr (que->tail, que->depth); + que->tail = (que->tail + cnt) & (que->depth -1 ); } -static inline void bnxt_re_incr_head (struct bnxt_re_queue *que) +static inline void bnxt_re_incr_head (struct bnxt_re_queue *que,uint8_t cnt) { - que->head =bnxt_re_incr (que->head, que->depth); + que->head = (que->head + cnt) & (que->depth -1 ); }#endif
providers/bnxt_re/verbs.c +77 -51
325 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH v3 5/5 bnxt_re/lib: Move hardware queue to 16B aligned indices
In reply to Devesh SharmaMove SQ and RQ indices from WQE boundary to
16B boundary alignment. Changing the SQ-wqe posting algorithm accordingly. The new alignment needs to pull a 16B slot from the hardware queue and initialize the current 16B into the hardware buffer. Depending on the max possible wqe size supported by hardware, the number of 16B slots are calculated and pulled for initialization. Currently 128B wqe is supported and it requires 8 slots.
--- providers/bnxt_re/db.c | 10 +- providers/bnxt_re/main.h | 1 + providers/bnxt_re/memory.h | 33 +++- providers/bnxt_re/verbs.c | 371 ++++++++++++++++++++++++++----------- 4 files changed, 294 insertions(+), 121 deletions(-)
providers/bnxt_re/db.c +6 -4
@@ -62,18 +62,20 @@ static void bnxt_re_init_db_hdr(struct bnxt_re_db_hdr *hdr, uint32_t indx,void bnxt_re_ring_rq_db (struct bnxt_re_qp *qp) {struct bnxt_re_db_hdr hdr; +uint32_t tail; -bnxt_re_init_db_hdr (&hdr, qp->jrqq->hwque->tail, - qp->qpid,BNXT_RE_QUE_TYPE_RQ ); + tail = qp->jrqq->hwque->tail / qp->jrqq->hwque->max_slots; +bnxt_re_init_db_hdr (&hdr, tail, qp->qpid,BNXT_RE_QUE_TYPE_RQ );bnxt_re_ring_db (qp->udpi, &hdr); }void bnxt_re_ring_sq_db (struct bnxt_re_qp *qp) {struct bnxt_re_db_hdr hdr; +uint32_t tail; -bnxt_re_init_db_hdr (&hdr, qp->jsqq->hwque->tail, - qp->qpid,BNXT_RE_QUE_TYPE_SQ ); + tail = qp->jsqq->hwque->tail / qp->jsqq->hwque->max_slots; +bnxt_re_init_db_hdr (&hdr, tail, qp->qpid,BNXT_RE_QUE_TYPE_SQ );bnxt_re_ring_db (qp->udpi, &hdr); }
providers/bnxt_re/main.h +1 -0
@@ -44,6 +44,7 @@#include <stddef.h> #include <endian.h> #include <pthread.h> +#include <sys/param.h> #include <infiniband/driver.h> #include <util/udma_barrier.h>
providers/bnxt_re/memory.h +25 -8
@@ -57,6 +57,8 @@ struct bnxt_re_queue {* and the consumer indices in the queue */ uint32_t diff; +uint32_t esize; +uint32_t max_slots;pthread_spinlock_t qlock; };
@@ -82,29 +84,44 @@ int bnxt_re_alloc_aligned(struct bnxt_re_queue *que, uint32_t pg_size);void bnxt_re_free_aligned (struct bnxt_re_queue *que);/* Basic queue operation */ -static inline uint32_t bnxt_re_is_que_full (struct bnxt_re_queue *que) +static inline void *bnxt_re_get_hwqe (struct bnxt_re_queue *que,uint32_t idx) { -return (((que->diff + que->tail) & (que->depth -1 )) == que->head); + idx += que->tail; +if (idx >= que->depth) + idx -= que->depth; +return (void *)(que->va + (idx <<4 )); } -static inline uint32_t bnxt_re_is_que_empty (struct bnxt_re_queue *que) +static inline uint32_t bnxt_re_is_que_full (struct bnxt_re_queue *que, +uint32_t slots) { -return que->tail == que->head; +int32_t avail, head, tail; + + head = que->head; + tail = que->tail; + avail = head - tail; +if (head <= tail) + avail += que->depth; +return avail <= (slots + que->diff); } -static inline uint32_t bnxt_re_incr (uint32_t val,uint32_t max) +static inline uint32_t bnxt_re_is_que_empty (struct bnxt_re_queue *que) { -return (++val & (max -1 )); +return que->tail == que->head; }static inline void bnxt_re_incr_tail (struct bnxt_re_queue *que,uint8_t cnt) { - que->tail = (que->tail + cnt) & (que->depth -1 ); + que->tail += cnt; +if (que->tail >= que->depth) + que->tail %= que->depth; }static inline void bnxt_re_incr_head (struct bnxt_re_queue *que,uint8_t cnt) { - que->head = (que->head + cnt) & (que->depth -1 ); + que->head += cnt; +if (que->head >= que->depth) + que->head %= que->depth; }#endif
providers/bnxt_re/verbs.c +262 -109
615 lines not on this page · raw message
Signature · 1 line
2.25.1
Quoted 26 lines · Devesh Sharma
The focus of this patch series is to move SQ and RQ wqe posting indices from 128B fixed stride to 16B aligned stride. This allows more flexibility in choosing wqe size.
v2 -> V3
- Split the ABI change into separate patch
- committed ABI patch using standard rdma-core script.Devesh Sharma (5):
Update kernel headers
bnxt_re/lib: Read wqe mode from the driver bnxt_re/lib: add a function to initialize software queue bnxt_re/lib: Use separate indices for shadow queue bnxt_re/lib: Move hardware queue to 16B aligned indiceskernel-headers/rdma/bnxt_re-abi.h | 5 +- providers/bnxt_re/bnxt_re-abi.h | 5 + providers/bnxt_re/db.c | 10 +- providers/bnxt_re/main.c | 4 + providers/bnxt_re/main.h | 26 ++ providers/bnxt_re/memory.h | 37 ++- providers/bnxt_re/verbs.c | 522 ++++++++++++++++++++---------- 7 files changed, 431 insertions(+), 178 deletions(-)
Quoted 3 lines
--
2.25.1
Jason/Leon,
Both user and kernel components related to these changes have been posted quite a while ago. Could you please take these in if there are further comments.
Signature · 2 lines
-Regards Devesh
Quoted 29 lines · Devesh Sharma
Quoted 17 lines · Devesh Sharma
The focus of this patch series is to move SQ and RQ wqe posting indices from 128B fixed stride to 16B aligned stride. This allows more flexibility in choosing wqe size.
v2 -> V3
- Split the ABI change into separate patch
- committed ABI patch using standard rdma-core script.Devesh Sharma (5):
Update kernel headers
bnxt_re/lib: Read wqe mode from the driver bnxt_re/lib: add a function to initialize software queue bnxt_re/lib: Use separate indices for shadow queue bnxt_re/lib: Move hardware queue to 16B aligned indicesQuoted 10 lines
kernel-headers/rdma/bnxt_re-abi.h | 5 +- providers/bnxt_re/bnxt_re-abi.h | 5 + providers/bnxt_re/db.c | 10 +- providers/bnxt_re/main.c | 4 + providers/bnxt_re/main.h | 26 ++ providers/bnxt_re/memory.h | 37 ++- providers/bnxt_re/verbs.c | 522 ++++++++++++++++++++---------- 7 files changed, 431 insertions(+), 178 deletions(-)
Quoted 5 lines
Jason/Leon,
Both user and kernel components related to these changes have been posted quite a while ago. Could you please take these in if there are further comments.
Where is the kernel part here:
https://patchwork.kernel.org/project/linux-rdma/list/
?
Jason
Quoted 33 lines · Jason Gunthorpe
Quoted 31 lines · Devesh Sharma
Quoted 17 lines · Devesh Sharma
The focus of this patch series is to move SQ and RQ wqe posting indices from 128B fixed stride to 16B aligned stride. This allows more flexibility in choosing wqe size.
v2 -> V3
- Split the ABI change into separate patch
- committed ABI patch using standard rdma-core script.Devesh Sharma (5):
Update kernel headers
bnxt_re/lib: Read wqe mode from the driver bnxt_re/lib: add a function to initialize software queue bnxt_re/lib: Use separate indices for shadow queue bnxt_re/lib: Move hardware queue to 16B aligned indicesQuoted 10 lines
kernel-headers/rdma/bnxt_re-abi.h | 5 +- providers/bnxt_re/bnxt_re-abi.h | 5 + providers/bnxt_re/db.c | 10 +- providers/bnxt_re/main.c | 4 + providers/bnxt_re/main.h | 26 ++ providers/bnxt_re/memory.h | 37 ++- providers/bnxt_re/verbs.c | 522 ++++++++++++++++++++---------- 7 files changed, 431 insertions(+), 178 deletions(-)Jason/Leon,
Quoted 7 lines
Quoted 3 lines
Both user and kernel components related to these changes have been posted quite a while ago. Could you please take these in if there are further comments.
Where is the kernel part here:
Yes it is there:
"[for-next,V3,3/3] RDMA/bnxt_re: update ABI to pass wqe-mode to user space"
https://patchwork.kernel.org/project/linux-rdma/patch/[email protected]
Quoted 4 lines
?
Jason
Signature · 2 lines
-Regards Devesh