RDMA/bnxt_re: driver update for supporting low latency push
Subsystems (2)
Selvin Xavier
maintainercover RDMA/bnxt_re: driver update for supporting low latency push
The series aims to add support for Low latency push path in some of the bnxt devices. The low latency implementation is supported only for the user applications. Also, the code is modified to use common mmap helper functions exported by IB core.
User library changes are added in the pull request
https://github.com/linux-rdma/rdma-core/pull/1321
Please review.
Thanks,
Selvin Xavier
Selvin Xavier (6):
RDMA/bnxt_re: Use the common mmap helper functions RDMA/bnxt_re: Add disassociate ucontext support RDMA/bnxt_re: Query function capabilities from firmware RDMA/bnxt_re: Move the interface version to chip context structure RDMA/bnxt_re: Reorg the bar mapping
RDMA/bnxt_re: Enable low latency push
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 160 +++++++++++++++++++++--- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 17 +++ drivers/infiniband/hw/bnxt_re/main.c | 123 +++++++++++++++++- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 14 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_res.c | 192 +++++++++++++++++++---------- drivers/infiniband/hw/bnxt_re/qplib_res.h | 33 +++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 + drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 + include/uapi/rdma/bnxt_re-abi.h | 9 ++ 11 files changed, 449 insertions(+), 106 deletions(-)
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 1/6 RDMA/bnxt_re: Use the common mmap helper functions
Replace the mmap handling function with common code in IB core. Create rdma_user_mmap_entry for each mmap resource and add to the ib_core mmap list. Add mmap_free verb support. Also, use rdma_user_mmap_io while mapping Doorbell pages.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 110 ++++++++++++++++++++++++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 15 ++++ drivers/infiniband/hw/bnxt_re/main.c | 1 + drivers/infiniband/hw/bnxt_re/qplib_fp.c | 10 +-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 2 +- 5 files changed, 115 insertions(+), 23 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +95 -15
@@ -533,12 +533,42 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd)return rc; } +static struct rdma_user_mmap_entry * +bnxt_re_mmap_entry_insert (struct bnxt_re_ucontext *uctx,u64 mem_offset, +enum bnxt_re_mmap_flag mmap_flag,u64 *offset) +{ +struct bnxt_re_user_mmap_entry *entry =kzalloc (sizeof (*entry),GFP_KERNEL ); +int ret; + +if (!entry) +return NULL ; + + entry->mem_offset = mem_offset; + entry->mmap_flag = mmap_flag; + + ret =rdma_user_mmap_entry_insert (&uctx->ib_uctx, + &entry->rdma_entry,PAGE_SIZE ); +if (ret) { +kfree (entry); +return NULL ; + } +if (offset) + *offset =rdma_user_mmap_get_offset (&entry->rdma_entry); + +return &entry->rdma_entry; +} +/* Protection Domains */ int bnxt_re_dealloc_pd (struct ib_pd *ib_pd,struct ib_udata *udata) { struct bnxt_re_pd *pd = container_of(ib_pd, struct bnxt_re_pd, ib_pd);struct bnxt_re_dev *rdev = pd->rdev; +if (udata) { +rdma_user_mmap_entry_remove (pd->pd_db_mmap); + pd->pd_db_mmap =NULL ; + } +bnxt_re_destroy_fence_mr (pd);if (pd->qplib_pd.id) {
@@ -557,7 +587,7 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)struct bnxt_re_ucontext *ucntx =rdma_udata_to_drv_context ( udata, struct bnxt_re_ucontext, ib_uctx); struct bnxt_re_pd *pd = container_of(ibpd, struct bnxt_re_pd, ib_pd); -int rc; +int rc =0 ; pd->rdev = rdev;if (bnxt_qplib_alloc_pd (&rdev->qplib_res.pd_tbl, &pd->qplib_pd)) {
@@ -567,7 +597,7 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) }if (udata) { -struct bnxt_re_pd_resp resp; +struct bnxt_re_pd_resp resp = {};if (!ucntx->dpi.dbr) {/* Allocate DPI in alloc_pd to avoid failing of
@@ -584,12 +614,23 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) resp.pdid = pd->qplib_pd.id;/* Still allow mapping this DBR to the new user PD. */ resp.dpi = ucntx->dpi.dpi; - resp.dbr = (u64 )ucntx->dpi.umdbr; - rc =ib_copy_to_udata (udata, &resp,sizeof (resp)); + pd->pd_db_mmap =bnxt_re_mmap_entry_insert (ucntx, (u64 )ucntx->dpi.umdbr, +BNXT_RE_MMAP_UC_DB , &resp.dbr); + +if (!pd->pd_db_mmap) { +ibdev_err (&rdev->ibdev, +"Failed to insert mmap entry\n" ); + rc = -ENOMEM ; + goto dbfail; + } + + rc =ib_copy_to_udata (udata, &resp,min (sizeof (resp), udata->outlen));if (rc) {ibdev_err (&rdev->ibdev,"Failed to copy user response\n" ); +rdma_user_mmap_entry_remove (pd->pd_db_mmap); + rc = -EFAULT ; goto dbfail; } }
@@ -3994,6 +4035,13 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata) resp.comp_mask |=BNXT_RE_UCNTX_CMASK_HAVE_MODE ; resp.mode = rdev->chip_ctx->modes.wqe_mode; + uctx->shpage_mmap =bnxt_re_mmap_entry_insert (uctx,0 ,BNXT_RE_MMAP_SH_PAGE ,NULL ); +if (!uctx->shpage_mmap) { +ibdev_err (ibdev,"Failed to create mmap entry for shared page\n" ); + rc = -ENOMEM ; + goto cfail; + } + rc =ib_copy_to_udata (udata, &resp,min (udata->outlen,sizeof (resp)));if (rc) {ibdev_err (ibdev,"Failed to copy user context" );
@@ -4017,6 +4065,8 @@ void bnxt_re_dealloc_ucontext(struct ib_ucontext *ib_uctx)struct bnxt_re_dev *rdev = uctx->rdev; +rdma_user_mmap_entry_remove (uctx->shpage_mmap); + uctx->shpage_mmap =NULL ;if (uctx->shpg)free_page ((unsigned long )uctx->shpg);
@@ -4036,27 +4086,57 @@ int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma)struct bnxt_re_ucontext *uctx =container_of (ib_uctx, struct bnxt_re_ucontext, ib_uctx); +struct bnxt_re_user_mmap_entry *bnxt_entry; +struct rdma_user_mmap_entry *rdma_entry;struct bnxt_re_dev *rdev = uctx->rdev; +int ret =0 ;u64 pfn; -if (vma->vm_end - vma->vm_start !=PAGE_SIZE ) + rdma_entry =rdma_user_mmap_entry_get (&uctx->ib_uctx, vma); +if (!rdma_entry) { +ibdev_err (&rdev->ibdev, +"%s: No valid rdma_entry pgoffset = 0x%lx\n" , + __func__, vma->vm_pgoff);return -EINVAL ; + } -if (vma->vm_pgoff) { - vma->vm_page_prot =pgprot_noncached (vma->vm_page_prot); -if (io_remap_pfn_range (vma, vma->vm_start, vma->vm_pgoff, -PAGE_SIZE , vma->vm_page_prot)) { -ibdev_err (&rdev->ibdev,"Failed to map DPI" ); -return -EAGAIN ; - } - }else { + bnxt_entry = container_of(rdma_entry, struct bnxt_re_user_mmap_entry, + rdma_entry); + +switch (bnxt_entry->mmap_flag) { +case BNXT_RE_MMAP_UC_DB : + pfn = bnxt_entry->mem_offset >>PAGE_SHIFT ; + ret =rdma_user_mmap_io (ib_uctx, vma, pfn,PAGE_SIZE , +pgprot_noncached (vma->vm_page_prot), + rdma_entry); +if (ret) +ibdev_err (&rdev->ibdev,"Failed to map shared page" ); +break ; +case BNXT_RE_MMAP_SH_PAGE : pfn =virt_to_phys (uctx->shpg) >>PAGE_SHIFT ;if (remap_pfn_range (vma, vma->vm_start, pfn,PAGE_SIZE , vma->vm_page_prot)) {ibdev_err (&rdev->ibdev,"Failed to map shared page" ); -return -EAGAIN ; + ret = -EAGAIN ; } +break ; +default : +ibdev_err (&rdev->ibdev, +"%s: invalid mmap flag = 0x%x\n" , __func__, bnxt_entry->mmap_flag); + ret = -EINVAL ; +break ; } -return 0 ; +rdma_user_mmap_entry_put (rdma_entry); +return ret; +} + +void bnxt_re_mmap_free (struct rdma_user_mmap_entry *rdma_entry) +{ +struct bnxt_re_user_mmap_entry *bnxt_entry; + + bnxt_entry = container_of(rdma_entry, struct bnxt_re_user_mmap_entry, + rdma_entry); + +kfree (bnxt_entry); }
drivers/infiniband/hw/bnxt_re/ib_verbs.h +15 -0
@@ -60,6 +60,7 @@ struct bnxt_re_pd {struct bnxt_re_dev *rdev;struct bnxt_qplib_pd qplib_pd;struct bnxt_re_fence_data fence; +struct rdma_user_mmap_entry *pd_db_mmap; };struct bnxt_re_ah {
@@ -136,6 +137,18 @@ struct bnxt_re_ucontext {struct bnxt_qplib_dpi dpi;void *shpg;spinlock_t sh_lock;/* protect shpg */ +struct rdma_user_mmap_entry *shpage_mmap; +}; + +enum bnxt_re_mmap_flag { +BNXT_RE_MMAP_SH_PAGE , +BNXT_RE_MMAP_UC_DB , +}; + +struct bnxt_re_user_mmap_entry { +struct rdma_user_mmap_entry rdma_entry; +u64 mem_offset; +u8 mmap_flag; };static inline u16 bnxt_re_get_swqe_size (int nsge)
@@ -213,6 +226,8 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *pd, u64 start, u64 length,int bnxt_re_alloc_ucontext (struct ib_ucontext *ctx,struct ib_udata *udata);void bnxt_re_dealloc_ucontext (struct ib_ucontext *context);int bnxt_re_mmap (struct ib_ucontext *context,struct vm_area_struct *vma); +void bnxt_re_mmap_free (struct rdma_user_mmap_entry *rdma_entry); +unsigned long bnxt_re_lock_cqs (struct bnxt_re_qp *qp);void bnxt_re_unlock_cqs (struct bnxt_re_qp *qp,unsigned long flags);
drivers/infiniband/hw/bnxt_re/main.c +1 -0
@@ -539,6 +539,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = { .get_port_immutable = bnxt_re_get_port_immutable, .map_mr_sg = bnxt_re_map_mr_sg, .mmap = bnxt_re_mmap, + .mmap_free = bnxt_re_mmap_free, .modify_qp = bnxt_re_modify_qp, .modify_srq = bnxt_re_modify_srq, .poll_cq = bnxt_re_poll_cq,
drivers/infiniband/hw/bnxt_re/qplib_fp.c +3 -7
@@ -471,7 +471,6 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt)resource_size_t reg_base;struct bnxt_qplib_nq_db *nq_db;struct pci_dev *pdev; -int rc =0 ; pdev = nq->pdev; nq_db = &nq->nq_db;
@@ -481,8 +480,7 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt)if (!nq_db->reg.bar_base) {dev_err (&pdev->dev,"QPLIB: NQ BAR region %d resc start is 0!" , nq_db->reg.bar_id); - rc = -ENOMEM ; - goto fail; +return -ENOMEM ; } reg_base = nq_db->reg.bar_base + reg_offt;
@@ -492,15 +490,13 @@ static int bnxt_qplib_map_nq_db(struct bnxt_qplib_nq *nq, u32 reg_offt)if (!nq_db->reg.bar_reg) {dev_err (&pdev->dev,"QPLIB: NQ BAR region %d mapping failed" , nq_db->reg.bar_id); - rc = -ENOMEM ; - goto fail; +return -ENOMEM ; } nq_db->dbinfo.db = nq_db->reg.bar_reg; nq_db->dbinfo.hwq = &nq->hwq; nq_db->dbinfo.xid = nq->ring_id; -fail: -return rc; +return 0 ; } int bnxt_qplib_enable_nq(struct pci_dev *pdev, struct bnxt_qplib_nq *nq,
drivers/infiniband/hw/bnxt_re/qplib_res.c +1 -1
@@ -813,7 +813,7 @@ static int bnxt_qplib_alloc_dpi_tbl(struct bnxt_qplib_res *res,return 0 ; unmap_io: -pci_iounmap (res->pdev, dpit->dbr_bar_reg_iomem); +iounmap (dpit->dbr_bar_reg_iomem); dpit->dbr_bar_reg_iomem =NULL ;return -ENOMEM ; }
Signature · 1 line
2.5.5
Re: [PATCH for-next 1/6] RDMA/bnxt_re: Use the common mmap helper functions
Quoted 20 lines · Selvin Xavier
Replace the mmap handling function with common code in IB core. Create
rdma_user_mmap_entryfor each mmap resource and add to theib_coremmap list. Addmmap_freeverb support. Also, userdma_user_mmap_iowhile mapping Doorbell pages.Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 110 ++++++++++++++++++++++++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 15 ++++ drivers/infiniband/hw/bnxt_re/main.c | 1 + drivers/infiniband/hw/bnxt_re/qplib_fp.c | 10 +-- drivers/infiniband/hw/bnxt_re/qplib_res.c | 2 +- 5 files changed, 115 insertions(+), 23 deletions(-)drivers/infiniband/hw/bnxt_re/ib_verbs.c +0
-0
drivers/infiniband/hw/bnxt_re/ib_verbs.c static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd) · line 540
Quoted 8 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +5
-0@@ -533,12 +533,42 @@ static int bnxt_re_create_fence_mr(struct bnxt_re_pd *pd)return rc; } +static struct rdma_user_mmap_entry * +bnxt_re_mmap_entry_insert (struct bnxt_re_ucontext *uctx,u64 mem_offset, +enum bnxt_re_mmap_flag mmap_flag,u64 *offset) +{ +struct bnxt_re_user_mmap_entry *entry =kzalloc (sizeof (*entry),GFP_KERNEL );
Please separate calls to kzalloc() and variable initialization.
Thanks
Re: [PATCH for-next 1/6] RDMA/bnxt_re: Use the common mmap helper functions
In reply to Selvin Xavierdrivers/infiniband/hw/bnxt_re/ib_verbs.c int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) · line 623
Quoted 7 lines · Selvin Xavier
drivers/infiniband/hw/bnxt_re/ib_verbs.c +6
-1- rc =ib_copy_to_udata (udata, &resp,sizeof (resp)); + pd->pd_db_mmap =bnxt_re_mmap_entry_insert (ucntx, (u64 )ucntx->dpi.umdbr, +BNXT_RE_MMAP_UC_DB , &resp.dbr); + +if (!pd->pd_db_mmap) { +ibdev_err (&rdev->ibdev, +"Failed to insert mmap entry\n" );
No prints from drivers on failure paths. dbg at worst.
Quoted 8 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +8
-0+switch (bnxt_entry->mmap_flag) { +case BNXT_RE_MMAP_UC_DB : + pfn = bnxt_entry->mem_offset >>PAGE_SHIFT ; + ret =rdma_user_mmap_io (ib_uctx, vma, pfn,PAGE_SIZE , +pgprot_noncached (vma->vm_page_prot), + rdma_entry); +if (ret) +ibdev_err (&rdev->ibdev,"Failed to map shared page" );
drivers/infiniband/hw/bnxt_re/ib_verbs.c int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma) · line 4122
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4
-1+break ; +case BNXT_RE_MMAP_SH_PAGE : pfn =virt_to_phys (uctx->shpg) >>PAGE_SHIFT ;if (remap_pfn_range (vma, vma->vm_start, pfn,PAGE_SIZE , vma->vm_page_prot)) {ibdev_err (&rdev->ibdev,"Failed to map shared page" ); -return -EAGAIN ; + ret = -EAGAIN ; } +break ;
What is this? You can't enable disassociate support until all the mmap's in the driver have been fixed.
Jason
Selvin Xavier
maintainerRe: [PATCH for-next 1/6] RDMA/bnxt_re: Use the common mmap helper functions
Quoted 31 lines · Jason Gunthorpe
drivers/infiniband/hw/bnxt_re/ib_verbs.c int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) · line 623
Quoted 7 lines · Selvin Xavier
drivers/infiniband/hw/bnxt_re/ib_verbs.c +6
-1- rc =ib_copy_to_udata (udata, &resp,sizeof (resp)); + pd->pd_db_mmap =bnxt_re_mmap_entry_insert (ucntx, (u64 )ucntx->dpi.umdbr, +BNXT_RE_MMAP_UC_DB , &resp.dbr); + +if (!pd->pd_db_mmap) { +ibdev_err (&rdev->ibdev, +"Failed to insert mmap entry\n" );No prints from drivers on failure paths. dbg at worst.
Quoted 8 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +8
-0+switch (bnxt_entry->mmap_flag) { +case BNXT_RE_MMAP_UC_DB : + pfn = bnxt_entry->mem_offset >>PAGE_SHIFT ; + ret =rdma_user_mmap_io (ib_uctx, vma, pfn,PAGE_SIZE , +pgprot_noncached (vma->vm_page_prot), + rdma_entry); +if (ret) +ibdev_err (&rdev->ibdev,"Failed to map shared page" );drivers/infiniband/hw/bnxt_re/ib_verbs.c int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma) · line 4122
Quoted 10 lines
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4
-1+break ; +case BNXT_RE_MMAP_SH_PAGE : pfn =virt_to_phys (uctx->shpg) >>PAGE_SHIFT ;if (remap_pfn_range (vma, vma->vm_start, pfn,PAGE_SIZE , vma->vm_page_prot)) {ibdev_err (&rdev->ibdev,"Failed to map shared page" ); -return -EAGAIN ; + ret = -EAGAIN ; } +break ;
Quoted 2 lines
What is this? You can't enable disassociate support until all the mmap's in the driver have been fixed.
Noted. Will modify this also to use rdma mmap apis.
Quoted 3 lines
Jason
Selvin Xavier
maintainerPATCH 2/6 RDMA/bnxt_re: Add disassociate ucontext support
In reply to Selvin XavierAdd empty stub for disassociate ucontext as done in other vendor drivers.
--- drivers/infiniband/hw/bnxt_re/main.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/infiniband/hw/bnxt_re/main.c +5 -0
@@ -466,6 +466,10 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,return rc; } +static void bnxt_re_disassociate_ucontext (struct ib_ucontext *ibcontext) +{ +} +/* Device */ static struct bnxt_re_dev *bnxt_re_from_netdev (struct net_device *netdev)
@@ -532,6 +536,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = { .destroy_qp = bnxt_re_destroy_qp, .destroy_srq = bnxt_re_destroy_srq, .device_group = &bnxt_re_dev_attr_group, + .disassociate_ucontext = bnxt_re_disassociate_ucontext, .get_dev_fw_str = bnxt_re_query_fw_str, .get_dma_mr = bnxt_re_get_dma_mr, .get_hw_stats = bnxt_re_ib_get_hw_stats,
Signature · 1 line
2.5.5
Re: [PATCH for-next 2/6] RDMA/bnxt_re: Add disassociate ucontext support
Quoted 2 lines · Selvin Xavier
Add empty stub for disassociate ucontext as done in other vendor drivers.
It will be great to mention in commit message that the reason to this stub is because you use rdma_user_mmap_io().
Thanks
Quoted 32 lines
Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/main.c | 5 +++++ 1 file changed, 5 insertions(+)drivers/infiniband/hw/bnxt_re/main.c +5
-0@@ -466,6 +466,10 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,return rc; } +static void bnxt_re_disassociate_ucontext (struct ib_ucontext *ibcontext) +{ +} +/* Device */ static struct bnxt_re_dev *bnxt_re_from_netdev (struct net_device *netdev)@@ -532,6 +536,7 @@ static const struct ib_device_ops bnxt_re_dev_ops = { .destroy_qp = bnxt_re_destroy_qp, .destroy_srq = bnxt_re_destroy_srq, .device_group = &bnxt_re_dev_attr_group, + .disassociate_ucontext = bnxt_re_disassociate_ucontext, .get_dev_fw_str = bnxt_re_query_fw_str, .get_dma_mr = bnxt_re_get_dma_mr, .get_hw_stats = bnxt_re_ib_get_hw_stats,Signature · 1 line
2.5.5
Re: [PATCH for-next 2/6] RDMA/bnxt_re: Add disassociate ucontext support
Quoted 6 lines · Leon Romanovsky
Quoted 2 lines · Selvin Xavier
Add empty stub for disassociate ucontext as done in other vendor drivers.
It will be great to mention in commit message that the reason to this stub is because you use
rdma_user_mmap_io().
That isn't the reason to do this stub..
It is some yet-to-be-cleaned-up way for the driver to indicate it *fully* supports driver disassociation.
rdma_user_mmap_io() is part of that support, but the whole functionality should be tested before setting this.
Jason
Selvin Xavier
maintainerPATCH 3/6 RDMA/bnxt_re: Query function capabilities from firmware
In reply to Selvin XavierQuery Function capabilities to enable advanced features.
--- drivers/infiniband/hw/bnxt_re/main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)
drivers/infiniband/hw/bnxt_re/main.c +30 -0
@@ -83,6 +83,7 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier, unsigned long event, void *ptr);static struct bnxt_re_dev *bnxt_re_from_netdev (struct net_device *netdev);static void bnxt_re_dev_uninit (struct bnxt_re_dev *rdev); +static int bnxt_re_hwrm_qcaps (struct bnxt_re_dev *rdev);static void bnxt_re_set_drv_mode (struct bnxt_re_dev *rdev,u8 mode) {
@@ -91,6 +92,9 @@ static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode) cctx = rdev->chip_ctx; cctx->modes.wqe_mode =bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx) ? mode :BNXT_QPLIB_WQE_MODE_STATIC ; +if (bnxt_re_hwrm_qcaps (rdev)) +dev_err (rdev_to_dev (rdev), +"Failed to query hwrm qcaps\n" ); }static void bnxt_re_destroy_chip_ctx (struct bnxt_re_dev *rdev)
@@ -334,6 +338,32 @@ static void bnxt_re_fill_fw_msg(struct bnxt_fw_msg *fw_msg, void *msg, fw_msg->timeout = timeout; } +/* Query function capabilities using common hwrm */ +int bnxt_re_hwrm_qcaps (struct bnxt_re_dev *rdev) +{ +struct bnxt_en_dev *en_dev = rdev->en_dev; +struct hwrm_func_qcaps_output resp = {0 }; +struct hwrm_func_qcaps_input req = {0 }; +struct bnxt_qplib_chip_ctx *cctx; +struct bnxt_fw_msg fw_msg; +int rc; + + cctx = rdev->chip_ctx; +memset (&fw_msg,0 ,sizeof (fw_msg)); +bnxt_re_init_hwrm_hdr (rdev, (void *)&req, +HWRM_FUNC_QCAPS ,-1 ,-1 ); + req.fid =cpu_to_le16 (0xffff ); +bnxt_re_fill_fw_msg (&fw_msg, (void *)&req,sizeof (req), (void *)&resp, +sizeof (resp),DFLT_HWRM_CMD_TIMEOUT ); + rc =bnxt_send_msg (en_dev, &fw_msg); +if (rc) { +dev_err (rdev_to_dev (rdev), +"Failed to query capabilities, rc = %#x" , rc); +return rc; + } +return 0 ; +} +static int bnxt_re_net_ring_free (struct bnxt_re_dev *rdev,u16 fw_ring_id,int type) {
Signature · 1 line
2.5.5
Re: [PATCH for-next 3/6] RDMA/bnxt_re: Query function capabilities from firmware
Quoted 20 lines · Selvin Xavier
Query Function capabilities to enable advanced features.
Signed-off-by Selvin Xavier <[email protected]>--- drivers/infiniband/hw/bnxt_re/main.c | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+)drivers/infiniband/hw/bnxt_re/main.c +1
-0@@ -83,6 +83,7 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier, unsigned long event, void *ptr);static struct bnxt_re_dev *bnxt_re_from_netdev (struct net_device *netdev);static void bnxt_re_dev_uninit (struct bnxt_re_dev *rdev); +static int bnxt_re_hwrm_qcaps (struct bnxt_re_dev *rdev);static void bnxt_re_set_drv_mode (struct bnxt_re_dev *rdev,u8 mode) {
drivers/infiniband/hw/bnxt_re/main.c static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode) · line 97
Quoted 6 lines
drivers/infiniband/hw/bnxt_re/main.c +3
-0@@ -91,6 +92,9 @@ static void bnxt_re_set_drv_mode(struct bnxt_re_dev *rdev, u8 mode) cctx = rdev->chip_ctx; cctx->modes.wqe_mode =bnxt_qplib_is_chip_gen_p5 (rdev->chip_ctx) ? mode :BNXT_QPLIB_WQE_MODE_STATIC ; +if (bnxt_re_hwrm_qcaps (rdev)) +dev_err (rdev_to_dev (rdev), +"Failed to query hwrm qcaps\n" );
You already print error in bnxt_re_hwrm_qcaps()
Quoted 1 line
drivers/infiniband/hw/bnxt_re/main.c +0
-0}
<...>
Quoted 2 lines
drivers/infiniband/hw/bnxt_re/main.c +2
-0+/* Query function capabilities using common hwrm */ +int bnxt_re_hwrm_qcaps (struct bnxt_re_dev *rdev)
<...>
Quoted 14 lines
drivers/infiniband/hw/bnxt_re/main.c +8
-0+if (rc) { +dev_err (rdev_to_dev (rdev), +"Failed to query capabilities, rc = %#x" , rc); +return rc; + } +return 0 ; +} +static int bnxt_re_net_ring_free (struct bnxt_re_dev *rdev,u16 fw_ring_id,int type) {Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 4/6 RDMA/bnxt_re: Move the interface version to chip context structure
In reply to Selvin XavierFW interface version check is required for multiple features. Moving the interface version to chip context structure.
--- drivers/infiniband/hw/bnxt_re/main.c | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +1 -1
@@ -1094,7 +1094,7 @@ static void bnxt_re_query_hwrm_intf_version(struct bnxt_re_dev *rdev) rc);return ; } - rdev->qplib_ctx.hwrm_intf_ver = + rdev->chip_ctx->hwrm_intf_ver = (u64 )le16_to_cpu (resp.hwrm_intf_major) <<48 | (u64 )le16_to_cpu (resp.hwrm_intf_minor) <<32 | (u64)le16_to_cpu(resp.hwrm_intf_build) << 16 |
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +1 -1
@@ -593,7 +593,7 @@ int bnxt_qplib_alloc_rcfw_channel(struct bnxt_qplib_res *res, "HW channel CREQ allocation failed\n"); goto fail; } -if (ctx->hwrm_intf_ver <HWRM_VERSION_RCFW_CMDQ_DEPTH_CHECK ) +if (res->cctx->hwrm_intf_ver <HWRM_VERSION_RCFW_CMDQ_DEPTH_CHECK ) rcfw->cmdq_depth =BNXT_QPLIB_CMDQE_MAX_CNT_256 ;else rcfw->cmdq_depth =BNXT_QPLIB_CMDQE_MAX_CNT_8192 ;
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 5/6 RDMA/bnxt_re: Reorg the bar mapping
In reply to Selvin XavierReorganize the code for allocation and mapping of Doorbell pages. Implements new HW command to get the BAR length used by L2 driver. These changes are used by the future patch which maps the WC Doorbell pages.
Also, introduced a new lock dpi_tbl_lock for synchronize the DB page allocation between differnt users.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 7 +- drivers/infiniband/hw/bnxt_re/main.c | 75 +++++++++++- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 4 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_res.c | 189 +++++++++++++++++++---------- drivers/infiniband/hw/bnxt_re/qplib_res.h | 30 +++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 + drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 + 8 files changed, 229 insertions(+), 81 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 -4
@@ -604,8 +604,8 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)* ibv_devinfo and family of application when DPIs * are depleted. */ -if (bnxt_qplib_alloc_dpi (&rdev->qplib_res.dpi_tbl, - &ucntx->dpi, ucntx)) { +if (bnxt_qplib_alloc_dpi (&rdev->qplib_res, + &ucntx->dpi, ucntx,BNXT_QPLIB_DPI_TYPE_UC )) { rc = -ENOMEM ; goto dbfail; }
@@ -4074,8 +4074,7 @@ void bnxt_re_dealloc_ucontext(struct ib_ucontext *ib_uctx)/* Free DPI only if this is the first PD allocated by the * application and mark the context dpi as NULL */ -bnxt_qplib_dealloc_dpi (&rdev->qplib_res, - &rdev->qplib_res.dpi_tbl, &uctx->dpi); +bnxt_qplib_dealloc_dpi (&rdev->qplib_res, &uctx->dpi); uctx->dpi.dbr =NULL ; } }
drivers/infiniband/hw/bnxt_re/main.c +71 -4
118 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_fp.c +2 -2
@@ -655,7 +655,7 @@ int bnxt_qplib_create_srq(struct bnxt_qplib_res *res, srq->dbinfo.xid = srq->id; srq->dbinfo.db = srq->dpi->dbr; srq->dbinfo.max_slot =1 ; - srq->dbinfo.priv_db = res->dpi_tbl.dbr_bar_reg_iomem; + srq->dbinfo.priv_db = res->dpi_tbl.priv_db;if (srq->threshold)bnxt_qplib_armen_db (&srq->dbinfo,DBC_DBC_TYPE_SRQ_ARMENA ); srq->arm_req = false;
@@ -2099,7 +2099,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq) cq->dbinfo.hwq = &cq->hwq; cq->dbinfo.xid = cq->id; cq->dbinfo.db = cq->dpi->dbr; - cq->dbinfo.priv_db = res->dpi_tbl.dbr_bar_reg_iomem; + cq->dbinfo.priv_db = res->dpi_tbl.priv_db;bnxt_qplib_armen_db (&cq->dbinfo,DBC_DBC_TYPE_CQ_ARMENA );
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +1 -0
@@ -111,6 +111,7 @@ static inline u32 bnxt_qplib_set_cmd_slots(struct cmdq_base *req)#define RCFW_BLOCKED_CMD_WAIT_COUNT 20000000UL/* 20 sec */ #define HWRM_VERSION_RCFW_CMDQ_DEPTH_CHECK 0x1000900020011ULL +#define HWRM_VERSION_DEV_ATTR_MAX_DPI 0x1000A0000000DULL/* Crsq buf is 1024-Byte */ struct bnxt_qplib_crsbe {
drivers/infiniband/hw/bnxt_re/qplib_res.c +125 -64
253 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_res.h +23 -7
@@ -56,8 +56,12 @@ struct bnxt_qplib_chip_ctx {u8 chip_metal;u16 hw_stats_size;struct bnxt_qplib_drv_modes modes; +u64 hwrm_intf_ver; }; +#define BNXT_QPLIB_DBR_PF_DB_OFFSET 0x10000 +#define BNXT_QPLIB_DBR_VF_DB_OFFSET 0x4000 +#define PTR_CNT_PER_PG (PAGE_SIZE / sizeof(void *))#define PTR_MAX_IDX_PER_PG (PTR_CNT_PER_PG - 1)#define PTR_PG (x) (((x) & ~PTR_MAX_IDX_PER_PG) / PTR_CNT_PER_PG)
@@ -109,6 +113,7 @@ enum bnxt_qplib_hwrm_pg_size {struct bnxt_qplib_reg_desc {u8 bar_id;resource_size_t bar_base; +unsigned long offset;void __iomem *bar_reg;size_t len; };
@@ -185,18 +190,26 @@ struct bnxt_qplib_sgid_tbl {u8 *vlan; }; +enum { +BNXT_QPLIB_DPI_TYPE_KERNEL =0 , +BNXT_QPLIB_DPI_TYPE_UC =1 , +}; +struct bnxt_qplib_dpi {u32 dpi; +u32 bit;void __iomem *dbr;u64 umdbr; +u8 type; };struct bnxt_qplib_dpi_tbl {void **app_tbl;unsigned long *tbl;u16 max; -void __iomem *dbr_bar_reg_iomem; -u64 unmapped_dbr; +struct bnxt_qplib_reg_desc ucreg;/* Hold entire DB bar. */ +struct bnxt_qplib_reg_desc wcreg; +void __iomem *priv_db; };struct bnxt_qplib_stats {
@@ -241,7 +254,6 @@ struct bnxt_qplib_ctx {struct bnxt_qplib_tqm_ctx tqm_ctx;struct bnxt_qplib_stats stats;struct bnxt_qplib_vf_res vf_res; -u64 hwrm_intf_ver; };struct bnxt_qplib_res {
@@ -253,6 +265,8 @@ struct bnxt_qplib_res {struct bnxt_qplib_pd_tbl pd_tbl;struct bnxt_qplib_sgid_tbl sgid_tbl;struct bnxt_qplib_dpi_tbl dpi_tbl; +/* To protect the dpi table bit map */ +struct mutex dpi_tbl_lock;bool prio;bool is_vf; };
@@ -344,11 +358,10 @@ int bnxt_qplib_alloc_pd(struct bnxt_qplib_pd_tbl *pd_tbl,int bnxt_qplib_dealloc_pd (struct bnxt_qplib_res *res,struct bnxt_qplib_pd_tbl *pd_tbl,struct bnxt_qplib_pd *pd); -int bnxt_qplib_alloc_dpi (struct bnxt_qplib_dpi_tbl *dpit, -struct bnxt_qplib_dpi *dpi, -void *app); +int bnxt_qplib_alloc_dpi (struct bnxt_qplib_res *res, +struct bnxt_qplib_dpi *dpi, +void *app,u8 type);int bnxt_qplib_dealloc_dpi (struct bnxt_qplib_res *res, -struct bnxt_qplib_dpi_tbl *dpi_tbl,struct bnxt_qplib_dpi *dpi);void bnxt_qplib_cleanup_res (struct bnxt_qplib_res *res);int bnxt_qplib_init_res (struct bnxt_qplib_res *res);
@@ -361,6 +374,9 @@ 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); +int bnxt_qplib_map_db_bar (struct bnxt_qplib_res *res); +void bnxt_qplib_unmap_db_bar (struct bnxt_qplib_res *res); +int 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 +3 -0
@@ -170,6 +170,9 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, attr->tqm_alloc_reqs[i *4 +3 ] = *(++tqm_alloc); } +if (rcfw->res->cctx->hwrm_intf_ver >=HWRM_VERSION_DEV_ATTR_MAX_DPI ) + attr->max_dpi =le32_to_cpu (sb->max_dpi); + attr->is_atomic =bnxt_qplib_is_atomic_cap (rcfw); bail:bnxt_qplib_rcfw_free_sbuf (rcfw, sbuf);
drivers/infiniband/hw/bnxt_re/qplib_sp.h +1 -0
@@ -72,6 +72,7 @@ struct bnxt_qplib_dev_attr {u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ ];bool is_atomic;u16 dev_cap_flags; +u32 max_dpi; };struct bnxt_qplib_pd {
Signature · 1 line
2.5.5
Selvin Xavier
maintainerPATCH 6/6 RDMA/bnxt_re: Enable low latency push
In reply to Selvin XavierEnabling the low latency push in Gen P5 adapters for small packets. This is supported only for the user space QPs. Introduce new mmap flag for write combine buffers. Allocate separate Write Combine pages from BAR when Low latency push mode is enabled in HW.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 43 +++++++++++++++++++++++++++++++ drivers/infiniband/hw/bnxt_re/ib_verbs.h | 4 ++- drivers/infiniband/hw/bnxt_re/main.c | 10 +++++++ drivers/infiniband/hw/bnxt_re/qplib_res.c | 3 +++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 3 ++- include/uapi/rdma/bnxt_re-abi.h | 9 +++++++ 6 files changed, 70 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +43 -0
@@ -566,6 +566,9 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd, struct ib_udata *udata)if (udata) {rdma_user_mmap_entry_remove (pd->pd_db_mmap); +if (pd->pd_wcdb_mmap) +rdma_user_mmap_entry_remove (pd->pd_wcdb_mmap); + pd->pd_wcdb_mmap =NULL ; pd->pd_db_mmap =NULL ; }
@@ -597,6 +600,7 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) }if (udata) { +struct bnxt_qplib_chip_ctx *cctx = rdev->chip_ctx;struct bnxt_re_pd_resp resp = {};if (!ucntx->dpi.dbr) {
@@ -606,9 +610,23 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata)*/ if (bnxt_qplib_alloc_dpi (&rdev->qplib_res, &ucntx->dpi, ucntx,BNXT_QPLIB_DPI_TYPE_UC )) { +dev_err (rdev_to_dev (rdev),"DP alloc failed" ); rc = -ENOMEM ; goto dbfail; } +if (cctx->modes.db_push) { + rc =bnxt_qplib_alloc_dpi (&rdev->qplib_res, &ucntx->wcdpi, + ucntx,BNXT_QPLIB_DPI_TYPE_WC ); +if (rc) { +dev_err (rdev_to_dev (rdev),"push dp alloc failed" ); +bnxt_qplib_dealloc_dpi (&rdev->qplib_res, &ucntx->dpi); + ucntx->dpi.dbr =NULL ; + rc = -ENOMEM ; + goto dbfail; + } + resp.wcdpi = ucntx->wcdpi.dpi; + resp.comp_mask =BNXT_RE_COMP_MASK_PD_HAS_WC_DPI ; + } } resp.pdid = pd->qplib_pd.id;
@@ -625,6 +643,16 @@ int bnxt_re_alloc_pd(struct ib_pd *ibpd, struct ib_udata *udata) goto dbfail; } + pd->pd_wcdb_mmap =bnxt_re_mmap_entry_insert (ucntx, (u64 )ucntx->wcdpi.umdbr, +BNXT_RE_MMAP_WC_DB , &resp.wcdbr); + +if (!pd->pd_wcdb_mmap) { +ibdev_err (&rdev->ibdev, +"Failed to insert mmap entry\n" ); + rc = -ENOMEM ; + goto dbfail; + } + rc =ib_copy_to_udata (udata, &resp,min (sizeof (resp), udata->outlen));if (rc) { ibdev_err(&rdev->ibdev,
@@ -4035,6 +4063,9 @@ int bnxt_re_alloc_ucontext(struct ib_ucontext *ctx, struct ib_udata *udata) resp.comp_mask |=BNXT_RE_UCNTX_CMASK_HAVE_MODE ; resp.mode = rdev->chip_ctx->modes.wqe_mode; +if (rdev->chip_ctx->modes.db_push) + resp.comp_mask |=BNXT_RE_UCNTX_CMASK_WC_DPI_ENABLED ; + uctx->shpage_mmap =bnxt_re_mmap_entry_insert (uctx,0 ,BNXT_RE_MMAP_SH_PAGE ,NULL );if (!uctx->shpage_mmap) {ibdev_err (ibdev,"Failed to create mmap entry for shared page\n" );
@@ -4074,6 +4105,10 @@ void bnxt_re_dealloc_ucontext(struct ib_ucontext *ib_uctx)/* Free DPI only if this is the first PD allocated by the * application and mark the context dpi as NULL */ +if (uctx->wcdpi.dbr) { +bnxt_qplib_dealloc_dpi (&rdev->qplib_res, &uctx->wcdpi); + uctx->wcdpi.dbr =NULL ; + }bnxt_qplib_dealloc_dpi (&rdev->qplib_res, &uctx->dpi); uctx->dpi.dbr =NULL ; }
@@ -4103,6 +4138,14 @@ int bnxt_re_mmap(struct ib_ucontext *ib_uctx, struct vm_area_struct *vma) rdma_entry);switch (bnxt_entry->mmap_flag) { +case BNXT_RE_MMAP_WC_DB : + pfn = bnxt_entry->mem_offset >>PAGE_SHIFT ; + ret =rdma_user_mmap_io (ib_uctx, vma, pfn,PAGE_SIZE , +pgprot_writecombine (vma->vm_page_prot), + rdma_entry); +if (ret) +ibdev_err (&rdev->ibdev,"Failed to map WC DB" ); +break ;case BNXT_RE_MMAP_UC_DB : pfn = bnxt_entry->mem_offset >>PAGE_SHIFT ; ret = rdma_user_mmap_io(ib_uctx, vma, pfn, PAGE_SIZE,
drivers/infiniband/hw/bnxt_re/ib_verbs.h +3 -1
@@ -61,6 +61,7 @@ struct bnxt_re_pd {struct bnxt_qplib_pd qplib_pd;struct bnxt_re_fence_data fence;struct rdma_user_mmap_entry *pd_db_mmap; +struct rdma_user_mmap_entry *pd_wcdb_mmap; };struct bnxt_re_ah {
@@ -135,6 +136,7 @@ struct bnxt_re_ucontext {struct ib_ucontext ib_uctx;struct bnxt_re_dev *rdev;struct bnxt_qplib_dpi dpi; +struct bnxt_qplib_dpi wcdpi;void *shpg;spinlock_t sh_lock;/* protect shpg */ struct rdma_user_mmap_entry *shpage_mmap;
@@ -143,6 +145,7 @@ struct bnxt_re_ucontext {enum bnxt_re_mmap_flag {BNXT_RE_MMAP_SH_PAGE ,BNXT_RE_MMAP_UC_DB , +BNXT_RE_MMAP_WC_DB , };struct bnxt_re_user_mmap_entry {
@@ -228,7 +231,6 @@ void bnxt_re_dealloc_ucontext(struct ib_ucontext *context);int bnxt_re_mmap (struct ib_ucontext *context,struct vm_area_struct *vma);void bnxt_re_mmap_free (struct rdma_user_mmap_entry *rdma_entry); -unsigned long bnxt_re_lock_cqs (struct bnxt_re_qp *qp);void bnxt_re_unlock_cqs (struct bnxt_re_qp *qp,unsigned long flags);#endif /* __BNXT_RE_IB_VERBS_H__ */
drivers/infiniband/hw/bnxt_re/main.c +10 -0
@@ -117,6 +117,11 @@ static void bnxt_re_set_db_offset(struct bnxt_re_dev *rdev)* in such cases and DB-push will be disabled. */ barlen =pci_resource_len (res->pdev,RCFW_DBR_PCI_BAR_REGION ); +if (cctx->modes.db_push && l2db_len && en_dev->l2_db_size != barlen) { + res->dpi_tbl.wcreg.offset = en_dev->l2_db_size; +dev_info (rdev_to_dev (rdev), +"Low latency framework is enabled\n" ); + } }static void bnxt_re_set_drv_mode (struct bnxt_re_dev *rdev,u8 mode)
@@ -430,6 +435,11 @@ int bnxt_re_hwrm_qcaps(struct bnxt_re_dev *rdev) "Failed to query capabilities, rc = %#x", rc);return rc; } + cctx->modes.db_push =le32_to_cpu (resp.flags) &FUNC_QCAPS_RESP_FLAGS_WCB_PUSH_MODE ; + +if (cctx->modes.db_push) +ibdev_dbg (&rdev->ibdev,"DB push enabled" ); +return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_res.c +3 -0
@@ -741,6 +741,9 @@ int bnxt_qplib_alloc_dpi(struct bnxt_qplib_res *res, dpi->dbr = dpit->priv_db; dpi->dpi = dpi->bit;break ; +case BNXT_QPLIB_DPI_TYPE_WC : + dpi->dbr =ioremap_wc (umaddr,PAGE_SIZE ); +break ;default : dpi->dbr =ioremap (umaddr,PAGE_SIZE );break ;
drivers/infiniband/hw/bnxt_re/qplib_res.h +2 -1
@@ -47,7 +47,7 @@ extern const struct bnxt_qplib_gid bnxt_qplib_gid_zero;struct bnxt_qplib_drv_modes {u8 wqe_mode; -/* Other modes to follow here */ +bool db_push; };struct bnxt_qplib_chip_ctx {
@@ -193,6 +193,7 @@ struct bnxt_qplib_sgid_tbl {enum {BNXT_QPLIB_DPI_TYPE_KERNEL =0 ,BNXT_QPLIB_DPI_TYPE_UC =1 , +BNXT_QPLIB_DPI_TYPE_WC =2 };struct bnxt_qplib_dpi {
include/uapi/rdma/bnxt_re-abi.h +9 -0
@@ -51,6 +51,7 @@enum {BNXT_RE_UCNTX_CMASK_HAVE_CCTX =0x1ULL ,BNXT_RE_UCNTX_CMASK_HAVE_MODE =0x02ULL , +BNXT_RE_UCNTX_CMASK_WC_DPI_ENABLED =0x04ULL , };enum bnxt_re_wqe_mode {
@@ -78,10 +79,18 @@ struct bnxt_re_uctx_resp {* not 8 byted aligned. To avoid undesired padding in various cases we have to * set this struct to packed. */ +enum { +BNXT_RE_COMP_MASK_PD_HAS_WC_DPI =0x01 , +}; +struct bnxt_re_pd_resp {__u32 pdid;__u32 dpi;__u64 dbr; +__u64 comp_mask; +__u32 rsvd; +__u32 wcdpi; +__u64 wcdbr; } __attribute__((packed,aligned (4 )));struct bnxt_re_cq_req {
Signature · 1 line
2.5.5
Re: [PATCH for-next 6/6] RDMA/bnxt_re: Enable low latency push
Quoted 5 lines · Selvin Xavier
Enabling the low latency push in Gen P5 adapters for small packets. This is supported only for the user space QPs. Introduce new mmap flag for write combine buffers. Allocate separate Write Combine pages from BAR when Low latency push mode is enabled in HW.
No new mmap flags.
This looks like it is basically the same as mlx5, I expect you'll run into all the same issues and needs as mlx5 did.
Follow the modern mlx5 design, add a new API to allocate one of these pages and have it return back the mmap cookie to use. Let userspace allocate as many as it needs.
Jason
Selvin Xavier
maintainerRe: [PATCH for-next 6/6] RDMA/bnxt_re: Enable low latency push
Quoted 8 lines · Jason Gunthorpe
Quoted 5 lines · Selvin Xavier
Enabling the low latency push in Gen P5 adapters for small packets. This is supported only for the user space QPs. Introduce new mmap flag for write combine buffers. Allocate separate Write Combine pages from BAR when Low latency push mode is enabled in HW.
Quoted 8 lines
No new mmap flags.
This looks like it is basically the same as mlx5, I expect you'll run into all the same issues and needs as mlx5 did.
Follow the modern mlx5 design, add a new API to allocate one of these pages and have it return back the mmap cookie to use. Let userspace allocate as many as it needs.
Thanks Jason for the pointers. Will review this and rework on the patch
Quoted 2 lines
Jason
Quoted 5 lines · Selvin Xavier
The series aims to add support for Low latency push path in some of the bnxt devices. The low latency implementation is supported only for the user applications. Also, the code is modified to use common mmap helper functions exported by IB core.
What does it mean "low latency push"?
Thanks
Quoted 33 lines
User library changes are added in the pull request
https://github.com/linux-rdma/rdma-core/pull/1321Please review.
Thanks,
Selvin XavierSelvin Xavier (6):
RDMA/bnxt_re: Use the common mmap helper functions RDMA/bnxt_re: Add disassociate ucontext support RDMA/bnxt_re: Query function capabilities from firmware RDMA/bnxt_re: Move the interface version to chip context structure RDMA/bnxt_re: Reorg the bar mapping
RDMA/bnxt_re: Enable low latency pushdrivers/infiniband/hw/bnxt_re/ib_verbs.c | 160 +++++++++++++++++++++--- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 17 +++ drivers/infiniband/hw/bnxt_re/main.c | 123 +++++++++++++++++- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 14 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_res.c | 192 +++++++++++++++++++---------- drivers/infiniband/hw/bnxt_re/qplib_res.h | 33 +++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 + drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 + include/uapi/rdma/bnxt_re-abi.h | 9 ++ 11 files changed, 449 insertions(+), 106 deletions(-)Signature · 1 line
2.5.5
Selvin Xavier
maintainerQuoted 9 lines · Leon Romanovsky
Quoted 5 lines · Selvin Xavier
The series aims to add support for Low latency push path in some of the bnxt devices. The low latency implementation is supported only for the user applications. Also, the code is modified to use common mmap helper functions exported by IB core.
What does it mean "low latency push"?
It is a hardware channel that can be used for transmitting smaller buffers (<=96 bytes) with lower latency. This is by pushing the data to HW buffers directly from the host (instead of DMA by the HW to get the data to be transmitted). Hence the name "low latency push".
Quoted 38 lines
Thanks
Quoted 33 lines
User library changes are added in the pull request
https://github.com/linux-rdma/rdma-core/pull/1321Please review.
Thanks,
Selvin XavierSelvin Xavier (6):
RDMA/bnxt_re: Use the common mmap helper functions RDMA/bnxt_re: Add disassociate ucontext support RDMA/bnxt_re: Query function capabilities from firmware RDMA/bnxt_re: Move the interface version to chip context structure RDMA/bnxt_re: Reorg the bar mapping
RDMA/bnxt_re: Enable low latency pushdrivers/infiniband/hw/bnxt_re/ib_verbs.c | 160 +++++++++++++++++++++--- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 17 +++ drivers/infiniband/hw/bnxt_re/main.c | 123 +++++++++++++++++- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 14 +-- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 2 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 1 + drivers/infiniband/hw/bnxt_re/qplib_res.c | 192 +++++++++++++++++++---------- drivers/infiniband/hw/bnxt_re/qplib_res.h | 33 +++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 3 + drivers/infiniband/hw/bnxt_re/qplib_sp.h | 1 + include/uapi/rdma/bnxt_re-abi.h | 9 ++ 11 files changed, 449 insertions(+), 106 deletions(-)--
2.5.5