RDMA/bnxt_re: Misc fixes for bnxt_re
Subsystems (2)
v2 cover RDMA/bnxt_re: Misc fixes for bnxt_re
This patch series includes the bug fixes for bnxt_re.
Patches 1 - 8 in this series are the backlog from the previously submitted series -
https://www.spinics.net/lists/linux-rdma/msg50984.htm (6 out of the the 14 patches from the above series got merged into 4.12-rc). Theise patches are already reviewed by the community.
Patches 9-13 are new patches posted for review.
Doug,
Please review this and consider applying all 13 patches in the 4.13 merge cycle.
Thanks,
Selvin Xavier
v1 -> v2:
Reworked on the locking for handling QPs in flushed state. Removes the flush_lock and uses the cq->hwq.lock for handling the flush state
Devesh Sharma (3):
RDMA/bnxt_re: Free doorbell page index (DPI) during dealloc ucontext RDMA/bnxt_re: Enable atomics only if host bios supports RDMA/bnxt_re: Fix return value of poll routine
Eddie Wai (1):
RDMA/bnxt_re: Fixed the max_rd_atomic support for initiator and
destination QP
Kalesh AP (1):
RDMA/bnxt_re: Add vlan tag for untagged RoCE traffic when PFC is
configured
Selvin Xavier (5):
RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails RDMA/bnxt_re: Report supported value to IB stack in query_device RDMA/bnxt_re: Allow posting when QPs are in error RDMA/bnxt_re: Report MISSED_EVENTS in req_notify_cq RDMA/bnxt_re: Fix the value reported for local ack delay
Somnath Kotur (3):
RDMA/bnxt_re: Fix race between netdev register and unregister events RDMA/bnxt_re: Fix WQE Size posted to HW to prevent it from throwing
error
RDMA/bnxt_re: Specify RDMA component when allocating stats context
drivers/infiniband/hw/bnxt_re/bnxt_re.h | 22 +- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 158 +++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 3 +- drivers/infiniband/hw/bnxt_re/main.c | 96 +++++- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 494 ++++++++++++++++++++++++----- drivers/infiniband/hw/bnxt_re/qplib_fp.h | 26 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 26 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 10 +- drivers/infiniband/hw/bnxt_re/qplib_res.c | 10 + drivers/infiniband/hw/bnxt_re/qplib_res.h | 2 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 93 +++++- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 5 + drivers/infiniband/hw/bnxt_re/roce_hsi.h | 4 +- 13 files changed, 766 insertions(+), 183 deletions(-)
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
A message that is not in the archive (sent off-list or not yet received): 1498764499-24157-1-git-send-email-selvin.xavier-dY08KVG/lbpWk0Htik3J/[email protected]
PATCH v2 1/13 RDMA/bnxt_re: Fix race between netdev register and unregister events
From: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
Upon receipt of the NETDEV_REGISTER event from the netdev notifier chain, the IB stack registration is spawned off to a workqueue since that also requires an rtnl lock.
There could be 2 kinds of races between the NETDEV_REGISTER and the NETDEV_UNREGISTER event handling.
a)The NETDEV_UNREGISTER event is received in rapid succession after the NETDEV_REGISTER event even before the work queue got a chance to run
b)The NETDEV_UNREGISTER event is received while the workqueue that handles registration with the IB stack is still in progress. Handle both the races with a bit flag that is set as part of the NETDEV_REGISTER event just before the work item is queued and cleared in the workqueue after the registration with the IB stack is complete. Use a barrier to ensure the bit is cleared only after the IB stack registration code is completed.
Removes the link speed query from the query_port as it causes deadlock while trying to acquire rtnl_lock. Now querying the speed from the nedev event itself.
Also, added a code to wait for resources(like CQ) to be freed by the ULPs, during driver unload
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 13 +++++++---- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 21 +++-------------- drivers/infiniband/hw/bnxt_re/main.c | 39 ++++++++++++++++++++++++++++++++ 3 files changed, 50 insertions(+), 23 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +8 -5
@@ -84,11 +84,13 @@ struct bnxt_re_dev {struct ib_device ibdev;struct list_head list;unsigned long flags; -#define BNXT_RE_FLAG_NETDEV_REGISTERED 0 -#define BNXT_RE_FLAG_IBDEV_REGISTERED 1 -#define BNXT_RE_FLAG_GOT_MSIX 2 -#define BNXT_RE_FLAG_RCFW_CHANNEL_EN 8 -#define BNXT_RE_FLAG_QOS_WORK_REG 16 +#define BNXT_RE_FLAG_NETDEV_REGISTERED 0 +#define BNXT_RE_FLAG_IBDEV_REGISTERED 1 +#define BNXT_RE_FLAG_GOT_MSIX 2 +#define BNXT_RE_FLAG_RCFW_CHANNEL_EN 4 +#define BNXT_RE_FLAG_QOS_WORK_REG 5 +#define BNXT_RE_FLAG_NETDEV_REG_IN_PROG 6 +struct net_device *netdev;unsigned int version, major, minor;struct bnxt_en_dev *en_dev;
@@ -131,6 +133,7 @@ struct bnxt_re_dev {struct bnxt_re_qp *qp1_sqp;struct bnxt_re_ah *sqp_ah;struct bnxt_re_sqp_entries sqp_tbl[1024 ]; +u32 espeed; };#define to_bnxt_re_dev (ptr, member) \
drivers/infiniband/hw/bnxt_re/ib_verbs.c +3 -18
@@ -223,20 +223,8 @@ int bnxt_re_modify_device(struct ib_device *ibdev,return 0 ; } -static void __to_ib_speed_width (struct net_device *netdev,u8 *speed,u8 *width) +static void __to_ib_speed_width (u32 espeed,u8 *speed,u8 *width) { -struct ethtool_link_ksettings lksettings; -u32 espeed; - -if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { -memset (&lksettings,0 ,sizeof (lksettings)); -rtnl_lock (); - netdev->ethtool_ops->get_link_ksettings (netdev, &lksettings); -rtnl_unlock (); - espeed = lksettings.base.speed; - }else { - espeed =SPEED_UNKNOWN ; - }switch (espeed) {case SPEED_1000 : *speed =IB_SPEED_SDR ;
@@ -303,12 +291,9 @@ int bnxt_re_query_port(struct ib_device *ibdev, u8 port_num, port_attr->sm_sl =0 ; port_attr->subnet_timeout =0 ; port_attr->init_type_reply =0 ; -/* call the underlying netdev's ethtool hooks to query speed settings -* for which we acquire rtnl_lock _only_ if it's registered with -* IB stack to avoid race in the NETDEV_UNREG path -*/ +if (test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) -__to_ib_speed_width (rdev->netdev, &port_attr->active_speed, +__to_ib_speed_width (rdev->espeed, &port_attr->active_speed, &port_attr->active_width);return 0 ; }
drivers/infiniband/hw/bnxt_re/main.c +39 -0
@@ -48,6 +48,8 @@#include <net/ipv6.h> #include <net/addrconf.h> #include <linux/if_ether.h> +#include <linux/atomic.h> +#include <asm/barrier.h> #include <rdma/ib_verbs.h> #include <rdma/ib_user_verbs.h>
@@ -922,6 +924,10 @@ static void bnxt_re_ib_unreg(struct bnxt_re_dev *rdev, bool lock_wait)if (test_and_clear_bit (BNXT_RE_FLAG_QOS_WORK_REG , &rdev->flags))cancel_delayed_work (&rdev->worker); +/* Wait for ULPs to release references */ +while (atomic_read (&rdev->cq_count)) +usleep_range (500 ,1000 ); +bnxt_re_cleanup_res (rdev);bnxt_re_free_res (rdev, lock_wait);
@@ -1148,6 +1154,22 @@ static void bnxt_re_remove_one(struct bnxt_re_dev *rdev)pci_dev_put (rdev->en_dev->pdev); } +static void bnxt_re_get_link_speed (struct bnxt_re_dev *rdev) +{ +struct ethtool_link_ksettings lksettings; +struct net_device *netdev = rdev->netdev; + +if (netdev->ethtool_ops && netdev->ethtool_ops->get_link_ksettings) { +memset (&lksettings,0 ,sizeof (lksettings)); +if (rtnl_trylock ()) { + netdev->ethtool_ops->get_link_ksettings (netdev, + &lksettings); + rdev->espeed = lksettings.base.speed; +rtnl_unlock (); + } + } +} +/* Handle all deferred netevents tasks */ static void bnxt_re_task (struct work_struct *work) {
@@ -1165,6 +1187,10 @@ static void bnxt_re_task(struct work_struct *work)switch (re_work->event) {case NETDEV_REGISTER : rc =bnxt_re_ib_reg (rdev); +/* Use memory barrier to sync the rdev->flags */ +smp_mb (); +clear_bit (BNXT_RE_FLAG_NETDEV_REG_IN_PROG , + &rdev->flags);if (rc)dev_err (rdev_to_dev (rdev),"Failed to register with IB: %#x" , rc);
@@ -1182,6 +1208,7 @@ static void bnxt_re_task(struct work_struct *work)else if (netif_carrier_ok (rdev->netdev))bnxt_re_dispatch_event (&rdev->ibdev,NULL ,1 ,IB_EVENT_PORT_ACTIVE ); +bnxt_re_get_link_speed (rdev);break ;default :break ;
@@ -1240,10 +1267,22 @@ static int bnxt_re_netdev_event(struct notifier_block *notifier,break ; }bnxt_re_init_one (rdev); +/* +* Query the link speed at the time of registration. +* Already in rtnl_lock context +*/ +bnxt_re_get_link_speed (rdev); + +set_bit (BNXT_RE_FLAG_NETDEV_REG_IN_PROG , &rdev->flags); sch_work = true;break ;case NETDEV_UNREGISTER : +/* netdev notifier will call NETDEV_UNREGISTER again later since +* we are still holding the reference to the netdev +*/ +if (test_bit (BNXT_RE_FLAG_NETDEV_REG_IN_PROG , &rdev->flags)) + goto exit;bnxt_re_ib_unreg (rdev, false);bnxt_re_remove_one (rdev);bnxt_re_dev_unreg (rdev);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 2/13 RDMA/bnxt_re: Free doorbell page index (DPI) during dealloc ucontext
In reply to a message not in the archiveFrom: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]>
The driver must free the DPI during the dealloc_ucontext instead of freeing it during dealloc_pd. However, the DPI allocation scheme remains unchanged.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 58 ++++++++++++++++---------------- drivers/infiniband/hw/bnxt_re/ib_verbs.h | 3 +- 2 files changed, 30 insertions(+), 31 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +29 -29
@@ -597,30 +597,13 @@ int bnxt_re_dealloc_pd(struct ib_pd *ib_pd)int rc;bnxt_re_destroy_fence_mr (pd); -if (ib_pd->uobject && pd->dpi.dbr) { -struct ib_ucontext *ib_uctx = ib_pd->uobject->context; -struct bnxt_re_ucontext *ucntx; -/* Free DPI only if this is the first PD allocated by the -* application and mark the context dpi as NULL -*/ - ucntx = container_of(ib_uctx, struct bnxt_re_ucontext, ib_uctx); - - rc =bnxt_qplib_dealloc_dpi (&rdev->qplib_res, - &rdev->qplib_res.dpi_tbl, - &pd->dpi); +if (pd->qplib_pd.id) { + rc =bnxt_qplib_dealloc_pd (&rdev->qplib_res, + &rdev->qplib_res.pd_tbl, + &pd->qplib_pd);if (rc) -dev_err (rdev_to_dev (rdev),"Failed to deallocate HW DPI" ); -/* Don't fail, continue*/ - ucntx->dpi =NULL ; - } - - rc =bnxt_qplib_dealloc_pd (&rdev->qplib_res, - &rdev->qplib_res.pd_tbl, - &pd->qplib_pd); -if (rc) { -dev_err (rdev_to_dev (rdev),"Failed to deallocate HW PD" ); -return rc; +dev_err (rdev_to_dev (rdev),"Failed to deallocate HW PD" ); }kfree (pd);
@@ -652,23 +635,22 @@ struct ib_pd *bnxt_re_alloc_pd(struct ib_device *ibdev,if (udata) {struct bnxt_re_pd_resp resp; -if (!ucntx->dpi) { +if (!ucntx->dpi.dbr) {/* Allocate DPI in alloc_pd to avoid failing of * ibv_devinfo and family of application when DPIs * are depleted. */ if (bnxt_qplib_alloc_dpi (&rdev->qplib_res.dpi_tbl, - &pd->dpi, ucntx)) { + &ucntx->dpi, ucntx)) { rc = -ENOMEM ; goto dbfail; } - ucntx->dpi = &pd->dpi; } 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; + resp.dpi = ucntx->dpi.dpi; + resp.dbr = (u64 )ucntx->dpi.umdbr; rc =ib_copy_to_udata (udata, &resp,sizeof (resp));if (rc) {
@@ -945,7 +927,7 @@ static int bnxt_re_init_user_qp(struct bnxt_re_dev *rdev, struct bnxt_re_pd *pd, qplib_qp->rq.nmap = umem->nmap; } - qplib_qp->dpi = cntx->dpi; + qplib_qp->dpi = &cntx->dpi;return 0 ; rqfail:ib_umem_release (qp->sumem);
@@ -2388,7 +2370,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev, } cq->qplib_cq.sghead = cq->umem->sg_head.sgl; cq->qplib_cq.nmap = cq->umem->nmap; - cq->qplib_cq.dpi = uctx->dpi; + cq->qplib_cq.dpi = &uctx->dpi; }else { cq->max_cql =min_t (u32, entries,MAX_CQL_PER_POLL ); cq->cql = kcalloc(cq->max_cql, sizeof(struct bnxt_qplib_cqe),
@@ -3373,8 +3355,26 @@ int bnxt_re_dealloc_ucontext(struct ib_ucontext *ib_uctx)struct bnxt_re_ucontext *uctx =container_of (ib_uctx, struct bnxt_re_ucontext, ib_uctx); + +struct bnxt_re_dev *rdev = uctx->rdev; +int rc =0 ; +if (uctx->shpg)free_page ((unsigned long )uctx->shpg); + +if (uctx->dpi.dbr) { +/* Free DPI only if this is the first PD allocated by the +* application and mark the context dpi as NULL +*/ + rc =bnxt_qplib_dealloc_dpi (&rdev->qplib_res, + &rdev->qplib_res.dpi_tbl, + &uctx->dpi); +if (rc) +dev_err (rdev_to_dev (rdev),"Deallocte HW DPI failed!" ); +/* Don't fail, continue*/ + uctx->dpi.dbr =NULL ; + } +kfree (uctx);return 0 ; }
drivers/infiniband/hw/bnxt_re/ib_verbs.h +1 -2
@@ -59,7 +59,6 @@ struct bnxt_re_pd {struct bnxt_re_dev *rdev;struct ib_pd ib_pd;struct bnxt_qplib_pd qplib_pd; -struct bnxt_qplib_dpi dpi;struct bnxt_re_fence_data fence; };
@@ -127,7 +126,7 @@ struct bnxt_re_mw {struct bnxt_re_ucontext {struct bnxt_re_dev *rdev;struct ib_ucontext ib_uctx; -struct bnxt_qplib_dpi *dpi; +struct bnxt_qplib_dpi dpi;void *shpg;spinlock_t sh_lock;/* protect shpg */ };
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 3/13 RDMA/bnxt_re: Fix WQE Size posted to HW to prevent it from throwing error
In reply to a message not in the archiveFrom: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
Posting WQE size of 2 results in a WQE_FORMAT_ERROR thrown by the HW as it requires host to supply WQE Size with room for atleast one SGE so that the resulting WQE size be atleast 3.
--- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/infiniband/hw/bnxt_re/qplib_fp.c +10 -0
@@ -1128,6 +1128,11 @@ int bnxt_qplib_post_send(struct bnxt_qplib_qp *qp, }/* Each SGE entry = 1 WQE size16 */ wqe_size16 = wqe->num_sge; +/* HW requires wqe size has room for atleast one SGE even if +* none was supplied by ULP +*/ +if (!wqe->num_sge) + wqe_size16++; }/* Specifics */
@@ -1364,6 +1369,11 @@ int bnxt_qplib_post_recv(struct bnxt_qplib_qp *qp, rqe->flags = wqe->flags; rqe->wqe_size = wqe->num_sge + ((offsetof(typeof(*rqe), data) + 15) >> 4); +/* HW requires wqe size has room for atleast one SGE even if none +* was supplied by ULP +*/ +if (!wqe->num_sge) + rqe->wqe_size++;/* Supply the rqe->wr_id index to the wr_id_tbl for now */ rqe->wr_id[0 ] =cpu_to_le32 (sw_prod);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/13 RDMA/bnxt_re: Add vlan tag for untagged RoCE traffic when PFC is configured
In reply to a message not in the archiveFrom: Kalesh AP <kalesh-anakkur.purayil-dY08KVG/lbpWk0Htik3J/[email protected]>
Current implementation does not program vlan header insertion in RoCE packet if no vlan is configured. Firmware does not add prority when there is no vlan tag in the packet. Modify the code to insert vlan header when PFC is enabled on the interface.
--- drivers/infiniband/hw/bnxt_re/main.c | 53 ++++++++++++++++++--- drivers/infiniband/hw/bnxt_re/qplib_res.c | 10 ++++ drivers/infiniband/hw/bnxt_re/qplib_res.h | 2 + drivers/infiniband/hw/bnxt_re/qplib_sp.c | 77 ++++++++++++++++++++++++------- drivers/infiniband/hw/bnxt_re/qplib_sp.h | 2 + drivers/infiniband/hw/bnxt_re/roce_hsi.h | 4 +- 6 files changed, 124 insertions(+), 24 deletions(-)
drivers/infiniband/hw/bnxt_re/main.c +47 -6
@@ -836,6 +836,42 @@ static void bnxt_re_dev_stop(struct bnxt_re_dev *rdev)mutex_unlock (&rdev->qp_lock); } +static int bnxt_re_update_gid (struct bnxt_re_dev *rdev) +{ +struct bnxt_qplib_sgid_tbl *sgid_tbl = &rdev->qplib_res.sgid_tbl; +struct bnxt_qplib_gid gid; +u16 gid_idx, index; +int rc =0 ; + +if (!test_bit (BNXT_RE_FLAG_IBDEV_REGISTERED , &rdev->flags)) +return 0 ; + +if (!sgid_tbl) { +dev_err (rdev_to_dev (rdev),"QPLIB: SGID table not allocated" ); +return -EINVAL ; + } + +for (index =0 ; index < sgid_tbl->active; index++) { + gid_idx = sgid_tbl->hw_id[index]; + +if (!memcmp (&sgid_tbl->tbl[index], &bnxt_qplib_gid_zero, +sizeof (bnxt_qplib_gid_zero))) +continue ; +/* need to modify the VLAN enable setting of non VLAN GID only +* as setting is done for VLAN GID while adding GID +*/ +if (sgid_tbl->vlan[index]) +continue ; + +memcpy (&gid, &sgid_tbl->tbl[index],sizeof (gid)); + + rc =bnxt_qplib_update_sgid (sgid_tbl, &gid, gid_idx, + rdev->qplib_res.netdev->dev_addr); + } + +return rc; +} +static u32 bnxt_re_get_priority_mask (struct bnxt_re_dev *rdev) {u32 prio_map =0 , tmp_map =0 ;
@@ -855,8 +891,6 @@ static u32 bnxt_re_get_priority_mask(struct bnxt_re_dev *rdev) tmp_map =dcb_ieee_getapp_mask (netdev, &app); prio_map |= tmp_map; -if (!prio_map) - prio_map = -EFAULT ;return prio_map; }
@@ -882,10 +916,7 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)int rc;/* Get priority for roce */ - rc =bnxt_re_get_priority_mask (rdev); -if (rc <0 ) -return rc; - prio_map = (u8 )rc; + prio_map =bnxt_re_get_priority_mask (rdev);if (prio_map == rdev->cur_prio_map)return 0 ;
@@ -907,6 +938,16 @@ static int bnxt_re_setup_qos(struct bnxt_re_dev *rdev)return rc; } +/* Actual priorities are not programmed as they are already +* done by L2 driver; just enable or disable priority vlan tagging +*/ +if ((prio_map ==0 && rdev->qplib_res.prio) || + (prio_map !=0 && !rdev->qplib_res.prio)) { + rdev->qplib_res.prio = prio_map ? true : false; + +bnxt_re_update_gid (rdev); + } +return 0 ; }
drivers/infiniband/hw/bnxt_re/qplib_res.c +10 -0
@@ -468,9 +468,11 @@ static void bnxt_qplib_free_sgid_tbl(struct bnxt_qplib_res *res,kfree (sgid_tbl->tbl);kfree (sgid_tbl->hw_id);kfree (sgid_tbl->ctx); +kfree (sgid_tbl->vlan); sgid_tbl->tbl =NULL ; sgid_tbl->hw_id =NULL ; sgid_tbl->ctx =NULL ; + sgid_tbl->vlan =NULL ; sgid_tbl->max =0 ; sgid_tbl->active =0 ; }
@@ -491,8 +493,15 @@ static int bnxt_qplib_alloc_sgid_tbl(struct bnxt_qplib_res *res,if (!sgid_tbl->ctx) goto out_free2; + sgid_tbl->vlan =kcalloc (max,sizeof (u8),GFP_KERNEL ); +if (!sgid_tbl->vlan) + goto out_free3; + sgid_tbl->max = max;return 0 ; +out_free3: +kfree (sgid_tbl->ctx); + sgid_tbl->ctx =NULL ; out_free2:kfree (sgid_tbl->hw_id); sgid_tbl->hw_id =NULL ;
@@ -514,6 +523,7 @@ static void bnxt_qplib_cleanup_sgid_tbl(struct bnxt_qplib_res *res, }memset (sgid_tbl->tbl,0 ,sizeof (struct bnxt_qplib_gid ) * sgid_tbl->max);memset (sgid_tbl->hw_id,-1 ,sizeof (u16) * sgid_tbl->max); +memset (sgid_tbl->vlan,0 ,sizeof (u8) * sgid_tbl->max); sgid_tbl->active =0 ; }
drivers/infiniband/hw/bnxt_re/qplib_res.h +2 -0
@@ -116,6 +116,7 @@ struct bnxt_qplib_sgid_tbl {u16 max;u16 active;void *ctx; +u8 *vlan; };struct bnxt_qplib_pkey_tbl {
@@ -188,6 +189,7 @@ struct bnxt_qplib_res {struct bnxt_qplib_sgid_tbl sgid_tbl;struct bnxt_qplib_pkey_tbl pkey_tbl;struct bnxt_qplib_dpi_tbl dpi_tbl; +bool prio; };#define to_bnxt_qplib (ptr, type, member) \
drivers/infiniband/hw/bnxt_re/qplib_sp.c +61 -16
107 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_sp.h +2 -0
@@ -132,6 +132,8 @@ int bnxt_qplib_del_sgid(struct bnxt_qplib_sgid_tbl *sgid_tbl,int bnxt_qplib_add_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl,struct bnxt_qplib_gid *gid,u8 *mac,u16 vlan_id,bool update,u32 *index); +int bnxt_qplib_update_sgid (struct bnxt_qplib_sgid_tbl *sgid_tbl, +struct bnxt_qplib_gid *gid,u16 gid_idx,u8 *smac);int bnxt_qplib_get_pkey (struct bnxt_qplib_res *res,struct bnxt_qplib_pkey_tbl *pkey_tbl,u16 index,u16 *pkey);
drivers/infiniband/hw/bnxt_re/roce_hsi.h +2 -2
@@ -1473,8 +1473,8 @@ struct cmdq_modify_gid {u8 resp_size;u8 reserved8;__le64 resp_addr; -__le32 gid[4 ]; -__le16 src_mac[3 ]; +__be32 gid[4 ]; +__be16 src_mac[3 ];__le16 vlan;#define CMDQ_MODIFY_GID_VLAN_VLAN_ID_MASK 0xfffUL#define CMDQ_MODIFY_GID_VLAN_VLAN_ID_SFT 0
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 5/13 RDMA/bnxt_re: Do not free the ctx_tbl entry if delete GID fails
In reply to a message not in the archiveThis fix is added only to avoid system crash in some a specific scenario. When bnxt_re driver is loaded and if user tries to change interface mac address, delete GID fails because QP1 is still associated with existing MAC (default GID). If the above command fails GID tables are not modified in the h/w or driver, but the GID context memory is freed. Now, if the user changes the mac back to the original value, another add_gid comes to the driver where the driver reports that the GID is already present in its table and tries to access the context which was already freed.
So, in this case, in order to avoid NULL pointer de-reference, this patch removes the context memory free if delete_gid fails and the same context memory is re-used in new add_gid. Memory cleanup will be taken care during driver unload, while deleting the GID table.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +9 -7
@@ -375,15 +375,17 @@ int bnxt_re_del_gid(struct ib_device *ibdev, u8 port_num,return -EINVAL ; ctx->refcnt--;if (!ctx->refcnt) { - rc =bnxt_qplib_del_sgid - (sgid_tbl, - &sgid_tbl->tbl[ctx->idx], true); -if (rc) + rc =bnxt_qplib_del_sgid (sgid_tbl, + &sgid_tbl->tbl[ctx->idx], + true); +if (rc) {dev_err (rdev_to_dev (rdev),"Failed to remove GID: %#x" , rc); - ctx_tbl = sgid_tbl->ctx; - ctx_tbl[ctx->idx] =NULL ; -kfree (ctx); + }else { + ctx_tbl = sgid_tbl->ctx; + ctx_tbl[ctx->idx] =NULL ; +kfree (ctx); + } } }else {return -EINVAL ;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 6/13 RDMA/bnxt_re: Report supported value to IB stack in query_device
In reply to a message not in the archive - Report supported value for max_mr_size to IB stack in query_device. Also, check and log if MR size requested by application in reg_user_mr() is greater than value currently supported by driver.
- Report only 4K page size support for now
- Fix Max_QP value returned by ibv_devinfo -vv.
In case of PF, FW reserves 129 QPs for creating QP1s of VFs and PF. So the max_qp value reported by FW for PF doesn'tt include the QP1. Fixing this issue by adding 1 with the value reported by FW.
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 2 ++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 12 ++++++++---- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 2 ++ 3 files changed, 12 insertions(+), 4 deletions(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +2 -0
@@ -51,6 +51,8 @@#define BNXT_RE_PAGE_SIZE_8M BIT(23)#define BNXT_RE_PAGE_SIZE_1G BIT(30) +#define BNXT_RE_MAX_MR_SIZE BIT(30) +#define BNXT_RE_MAX_QPC_COUNT (64 * 1024)#define BNXT_RE_MAX_MRW_COUNT (64 * 1024)#define BNXT_RE_MAX_SRQC_COUNT (64 * 1024)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +8 -4
@@ -145,10 +145,8 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->fw_ver = (u64 )(unsigned long )(dev_attr->fw_ver);bnxt_qplib_get_guid (rdev->netdev->dev_addr, (u8 *)&ib_attr->sys_image_guid); - ib_attr->max_mr_size = ~0ull ; - ib_attr->page_size_cap =BNXT_RE_PAGE_SIZE_4K |BNXT_RE_PAGE_SIZE_8K | -BNXT_RE_PAGE_SIZE_64K |BNXT_RE_PAGE_SIZE_2M | -BNXT_RE_PAGE_SIZE_8M |BNXT_RE_PAGE_SIZE_1G ; + ib_attr->max_mr_size =BNXT_RE_MAX_MR_SIZE ; + ib_attr->page_size_cap =BNXT_RE_PAGE_SIZE_4K ; ib_attr->vendor_id = rdev->en_dev->pdev->vendor; ib_attr->vendor_part_id = rdev->en_dev->pdev->device;
@@ -3214,6 +3212,12 @@ struct ib_mr *bnxt_re_reg_user_mr(struct ib_pd *ib_pd, u64 start, u64 length,struct scatterlist *sg;int entry; +if (length >BNXT_RE_MAX_MR_SIZE ) { +dev_err (rdev_to_dev (rdev),"MR Size: %lld > Max supported:%ld\n" , + length,BNXT_RE_MAX_MR_SIZE ); +return ERR_PTR (-ENOMEM ); + } + mr =kzalloc (sizeof (*mr),GFP_KERNEL );if (!mr)return ERR_PTR (-ENOMEM );
drivers/infiniband/hw/bnxt_re/qplib_sp.c +2 -0
@@ -81,6 +81,8 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw,/* Extract the context from the side buffer */ attr->max_qp =le32_to_cpu (sb->max_qp); +/* max_qp value reported by FW for PF doesn't include the QP1 for PF */ + attr->max_qp +=1 ; attr->max_qp_rd_atom = sb->max_qp_rd_atom >BNXT_QPLIB_MAX_OUT_RD_ATOM ?BNXT_QPLIB_MAX_OUT_RD_ATOM : sb->max_qp_rd_atom;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 7/13 RDMA/bnxt_re: Fixed the max_rd_atomic support for initiator and destination QP
In reply to a message not in the archiveFrom: Eddie Wai <eddie.wai-dY08KVG/lbpWk0Htik3J/[email protected]>
There's a couple of bugs in the support of max_rd_atomic and max_dest_rd_atomic. In the modify_qp, if the requested max_rd_atomic, which is the ORRQ size, is greater than what the chip can support, then we have to cap the request to chip max as we can't have the HW overflow the ORRQ. Capping the max_rd_atomic support internally is okay to do as the remaining read/atomic WRs will still be sitting in the SQ. However, for the max_dest_rd_atomic, the driver has to error out as this dictates the IRRQ size and we can't control what the remote side sends.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +13 -2
@@ -172,7 +172,7 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->max_mr = dev_attr->max_mr; ib_attr->max_pd = dev_attr->max_pd; ib_attr->max_qp_rd_atom = dev_attr->max_qp_rd_atom; - ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_rd_atom; + ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom; ib_attr->atomic_cap =IB_ATOMIC_HCA ; ib_attr->masked_atomic_cap =IB_ATOMIC_HCA ;
@@ -1497,13 +1497,24 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr,if (qp_attr_mask &IB_QP_MAX_QP_RD_ATOMIC ) { qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_MAX_RD_ATOMIC ; - qp->qplib_qp.max_rd_atomic = qp_attr->max_rd_atomic; +/* Cap the max_rd_atomic to device max */ + qp->qplib_qp.max_rd_atomic =min_t (u32, qp_attr->max_rd_atomic, + dev_attr->max_qp_rd_atom); }if (qp_attr_mask &IB_QP_SQ_PSN ) { qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_SQ_PSN ; qp->qplib_qp.sq.psn = qp_attr->sq_psn; }if (qp_attr_mask &IB_QP_MAX_DEST_RD_ATOMIC ) { +if (qp_attr->max_dest_rd_atomic > + dev_attr->max_qp_init_rd_atom) { +dev_err (rdev_to_dev (rdev), +"max_dest_rd_atomic requested%d is > dev_max%d" , + qp_attr->max_dest_rd_atomic, + dev_attr->max_qp_init_rd_atom); +return -EINVAL ; + } + qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_MAX_DEST_RD_ATOMIC ; qp->qplib_qp.max_dest_rd_atomic = qp_attr->max_dest_rd_atomic;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 8/13 RDMA/bnxt_re: Specify RDMA component when allocating stats context
In reply to a message not in the archiveFrom: Somnath Kotur <somnath.kotur-dY08KVG/lbpWk0Htik3J/[email protected]>
Starting FW version 20.6.47, firmware is keeping separate statistics for L2 and RDMA. However, driver needs to specify RDMA or not when allocating stat_ctx.
--- drivers/infiniband/hw/bnxt_re/main.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/main.c +1 -0
@@ -335,6 +335,7 @@ static int bnxt_re_net_stats_ctx_alloc(struct bnxt_re_dev *rdev,bnxt_re_init_hwrm_hdr (rdev, (void *)&req,HWRM_STAT_CTX_ALLOC ,-1 ,-1 ); req.update_period_ms =cpu_to_le32 (1000 ); req.stats_dma_addr =cpu_to_le64 (dma_map); + req.stat_ctx_flags =STAT_CTX_ALLOC_REQ_STAT_CTX_FLAGS_ROCE ;bnxt_re_fill_fw_msg (&fw_msg, (void *)&req,sizeof (req), (void *)&resp,sizeof (resp),DFLT_HWRM_CMD_TIMEOUT ); rc = en_dev->en_ops->bnxt_send_fw_msg (en_dev,BNXT_ROCE_ULP , &fw_msg);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 9/13 RDMA/bnxt_re: Allow posting when QPs are in error
In reply to a message not in the archiveThis patch allows driver to post send and receive requests on QPs which are in error state.
Instead of flushing the QP in the context of polling error CQEs, the QPs will be added to a flush list maintained per CQ. QP state is moved to error.
QP is added to flush list if the user moves it
to error state using modify_qp also. After polling the HW CQ in poll_cq routine, this flush list is traversed and driver completes work requests on each QP in the flush list, till the budget expires. The QP is moved out of flush list during QP destroy or during modify_QP to RESET.
When ULPs post Work Requests while QP is in error state, driver will store the ULP data and then increment the QP producer s/w index, without ringing doorbell. It then schedules a worker to invoke the CQ handler since the interrupts wont be generated from the HW for this request.
---
v1 -> v2:
Reworked on the locking for handling QPs in flushed state. Removes the flush_lock and uses the cq->hwq.lock for handling the flush state
drivers/infiniband/hw/bnxt_re/ib_verbs.c | 22 ++ drivers/infiniband/hw/bnxt_re/main.c | 3 +- drivers/infiniband/hw/bnxt_re/qplib_fp.c | 465 +++++++++++++++++++++++------ drivers/infiniband/hw/bnxt_re/qplib_fp.h | 25 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.c | 26 +- drivers/infiniband/hw/bnxt_re/qplib_rcfw.h | 10 +- 6 files changed, 462 insertions(+), 89 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +22 -0
@@ -829,6 +829,7 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp)struct bnxt_re_dev *rdev = qp->rdev;int rc; +bnxt_qplib_del_flush_qp (&qp->qplib_qp); rc =bnxt_qplib_destroy_qp (&rdev->qplib_res, &qp->qplib_qp);if (rc) {dev_err (rdev_to_dev (rdev),"Failed to destroy HW QP" );
@@ -843,6 +844,7 @@ int bnxt_re_destroy_qp(struct ib_qp *ib_qp)return rc; } +bnxt_qplib_del_flush_qp (&qp->qplib_qp); rc =bnxt_qplib_destroy_qp (&rdev->qplib_res, &rdev->qp1_sqp->qplib_qp);if (rc) {
@@ -1387,6 +1389,21 @@ int bnxt_re_modify_qp(struct ib_qp *ib_qp, struct ib_qp_attr *qp_attr, } qp->qplib_qp.modify_flags |=CMDQ_MODIFY_QP_MODIFY_MASK_STATE ; qp->qplib_qp.state =__from_ib_qp_state (qp_attr->qp_state); + +if (!qp->sumem && + qp->qplib_qp.state ==CMDQ_MODIFY_QP_NEW_STATE_ERR ) { +dev_dbg (rdev_to_dev (rdev), +"Move QP = %p to flush list\n" , + qp); +bnxt_qplib_add_flush_qp (&qp->qplib_qp); + } +if (!qp->sumem && + qp->qplib_qp.state ==CMDQ_MODIFY_QP_NEW_STATE_RESET ) { +dev_dbg (rdev_to_dev (rdev), +"Move QP = %p out of flush list\n" , + qp); +bnxt_qplib_del_flush_qp (&qp->qplib_qp); + } }if (qp_attr_mask &IB_QP_EN_SQD_ASYNC_NOTIFY ) { qp->qplib_qp.modify_flags |=
@@ -2397,6 +2414,7 @@ struct ib_cq *bnxt_re_create_cq(struct ib_device *ibdev, } cq->qplib_cq.max_wqe = entries; cq->qplib_cq.cnq_hw_ring_id = rdev->nq.ring_id; + cq->qplib_cq.nq = &rdev->nq; rc =bnxt_qplib_create_cq (&rdev->qplib_res, &cq->qplib_cq);if (rc) {
@@ -2903,6 +2921,10 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc) sq->send_phantom = false; } } +if (ncqe < budget) + ncqe +=bnxt_qplib_process_flush_list (&cq->qplib_cq, + cqe + ncqe, + budget - ncqe);if (!ncqe)break ;
drivers/infiniband/hw/bnxt_re/main.c +2 -1
@@ -1045,7 +1045,8 @@ static int bnxt_re_ib_reg(struct bnxt_re_dev *rdev)/* Establish RCFW Communication Channel to initialize the context * memory for the function and all child VFs */ - rc =bnxt_qplib_alloc_rcfw_channel (rdev->en_dev->pdev, &rdev->rcfw); + rc =bnxt_qplib_alloc_rcfw_channel (rdev->en_dev->pdev, &rdev->rcfw, +BNXT_RE_MAX_QPC_COUNT );if (rc) goto fail;
drivers/infiniband/hw/bnxt_re/qplib_fp.c +380 -85
727 lines not on this page · raw message
drivers/infiniband/hw/bnxt_re/qplib_fp.h +24 -1
@@ -220,19 +220,20 @@ struct bnxt_qplib_q {u16 q_full_delta;u16 max_sge;u32 psn; -bool flush_in_progress;bool condition;bool single;bool send_phantom;u32 phantom_wqe_cnt;u32 phantom_cqe_cnt;u32 next_cq_cons; +bool flushed; };struct bnxt_qplib_qp {struct bnxt_qplib_pd *pd;struct bnxt_qplib_dpi *dpi;u64 qp_handle; +#define BNXT_QPLIB_QP_ID_INVALID 0xFFFFFFFFu32 id;u8 type;u8 sig_type;
@@ -296,6 +297,8 @@ struct bnxt_qplib_qp {dma_addr_t sq_hdr_buf_map;void *rq_hdr_buf;dma_addr_t rq_hdr_buf_map; +struct list_head sq_flush; +struct list_head rq_flush; };#define BNXT_QPLIB_MAX_CQE_ENTRY_SIZE sizeof(struct cq_base)
@@ -351,6 +354,7 @@ struct bnxt_qplib_cq {u16 period;struct bnxt_qplib_hwq hwq;u32 cnq_hw_ring_id; +struct bnxt_qplib_nq *nq;bool resize_in_progress;struct scatterlist *sghead;u32 nmap;
@@ -360,6 +364,9 @@ struct bnxt_qplib_cq {unsigned long flags;#define CQ_FLAGS_RESIZE_IN_PROG 1wait_queue_head_t waitq; +struct list_head sqf_head, rqf_head; +atomic_t arm_state; +spinlock_t compl_lock;/* synch CQ handlers */ };#define BNXT_QPLIB_MAX_IRRQE_ENTRY_SIZE sizeof(struct xrrq_irrq)
@@ -417,6 +424,13 @@ struct bnxt_qplib_nq { (struct bnxt_qplib_nq *nq, void *srq, u8 event); +struct workqueue_struct *cqn_wq; +}; + +struct bnxt_qplib_nq_work { +struct work_struct work; +struct bnxt_qplib_nq *nq; +struct bnxt_qplib_cq *cq; };void bnxt_qplib_disable_nq (struct bnxt_qplib_nq *nq);
@@ -452,4 +466,13 @@ int bnxt_qplib_poll_cq(struct bnxt_qplib_cq *cq, struct bnxt_qplib_cqe *cqe,void bnxt_qplib_req_notify_cq (struct bnxt_qplib_cq *cq,u32 arm_type);void bnxt_qplib_free_nq (struct bnxt_qplib_nq *nq);int bnxt_qplib_alloc_nq (struct pci_dev *pdev,struct bnxt_qplib_nq *nq); +void bnxt_qplib_add_flush_qp (struct bnxt_qplib_qp *qp); +void bnxt_qplib_del_flush_qp (struct bnxt_qplib_qp *qp); +void bnxt_qplib_acquire_cq_locks (struct bnxt_qplib_qp *qp, +unsigned long *flags); +void bnxt_qplib_release_cq_locks (struct bnxt_qplib_qp *qp, +unsigned long *flags); +int bnxt_qplib_process_flush_list (struct bnxt_qplib_cq *cq, +struct bnxt_qplib_cqe *cqe, +int num_cqes);#endif /* __BNXT_QPLIB_FP_H__ */
drivers/infiniband/hw/bnxt_re/qplib_rcfw.c +25 -1
@@ -44,6 +44,9 @@#include "roce_hsi.h" #include "qplib_res.h" #include "qplib_rcfw.h" +#include "qplib_sp.h" +#include "qplib_fp.h" +static void bnxt_qplib_service_creq (unsigned long data);/* Hardware communication channel */
@@ -279,16 +282,29 @@ static int bnxt_qplib_process_qp_event(struct bnxt_qplib_rcfw *rcfw, struct creq_qp_event *qp_event) {struct bnxt_qplib_hwq *cmdq = &rcfw->cmdq; +struct creq_qp_error_notification *err_event;struct bnxt_qplib_crsq *crsqe;unsigned long flags; +struct bnxt_qplib_qp *qp;u16 cbit, blocked =0 ;u16 cookie;__le16 mcookie; +u32 qp_id;switch (qp_event->event) {case CREQ_QP_EVENT_EVENT_QP_ERROR_NOTIFICATION : + err_event = (struct creq_qp_error_notification *)qp_event; + qp_id =le32_to_cpu (err_event->xid); + qp = rcfw->qp_tbl[qp_id].qp_handle;dev_dbg (&rcfw->pdev->dev,"QPLIB: Received QP error notification" ); +dev_dbg (&rcfw->pdev->dev, +"QPLIB: qpid 0x%x, req_err=0x%x, resp_err=0x%x\n" , + qp_id, err_event->req_err_state_reason, + err_event->res_err_state_reason); +bnxt_qplib_acquire_cq_locks (qp, &flags); +bnxt_qplib_mark_qp_error (qp); +bnxt_qplib_release_cq_locks (qp, &flags);break ;default :/* Command Response */
@@ -507,6 +523,7 @@ int bnxt_qplib_init_rcfw(struct bnxt_qplib_rcfw *rcfw,void bnxt_qplib_free_rcfw_channel (struct bnxt_qplib_rcfw *rcfw) { +kfree (rcfw->qp_tbl);kfree (rcfw->crsqe_tbl);bnxt_qplib_free_hwq (rcfw->pdev, &rcfw->cmdq);bnxt_qplib_free_hwq (rcfw->pdev, &rcfw->creq);
@@ -514,7 +531,8 @@ void bnxt_qplib_free_rcfw_channel(struct bnxt_qplib_rcfw *rcfw) }int bnxt_qplib_alloc_rcfw_channel (struct pci_dev *pdev, -struct bnxt_qplib_rcfw *rcfw) +struct bnxt_qplib_rcfw *rcfw, +int qp_tbl_sz) { rcfw->pdev = pdev; rcfw->creq.max_elements =BNXT_QPLIB_CREQE_MAX_CNT ;
@@ -541,6 +559,12 @@ int bnxt_qplib_alloc_rcfw_channel(struct pci_dev *pdev,if (!rcfw->crsqe_tbl) goto fail; + rcfw->qp_tbl_size = qp_tbl_sz; + rcfw->qp_tbl =kcalloc (qp_tbl_sz,sizeof (struct bnxt_qplib_qp_node ), +GFP_KERNEL ); +if (!rcfw->qp_tbl) + goto fail; +return 0 ; fail:
drivers/infiniband/hw/bnxt_re/qplib_rcfw.h +9 -1
@@ -148,6 +148,11 @@ struct bnxt_qplib_rcfw_sbuf {u32 size; }; +struct bnxt_qplib_qp_node { +u32 qp_id;/* QP id */ +void *qp_handle;/* ptr to qplib_qp */ +}; +/* RCFW Communication Channels */ struct bnxt_qplib_rcfw {struct pci_dev *pdev;
@@ -181,11 +186,13 @@ struct bnxt_qplib_rcfw {/* Actual Cmd and Resp Queues */ struct bnxt_qplib_hwq cmdq;struct bnxt_qplib_crsq *crsqe_tbl; +int qp_tbl_size; +struct bnxt_qplib_qp_node *qp_tbl; };void bnxt_qplib_free_rcfw_channel (struct bnxt_qplib_rcfw *rcfw);int bnxt_qplib_alloc_rcfw_channel (struct pci_dev *pdev, -struct bnxt_qplib_rcfw *rcfw); +struct bnxt_qplib_rcfw *rcfw,int qp_tbl_sz);void bnxt_qplib_disable_rcfw_channel (struct bnxt_qplib_rcfw *rcfw); int bnxt_qplib_enable_rcfw_channel(struct pci_dev *pdev, struct bnxt_qplib_rcfw *rcfw,
@@ -207,4 +214,5 @@ int bnxt_qplib_rcfw_send_message(struct bnxt_qplib_rcfw *rcfw,int bnxt_qplib_deinit_rcfw (struct bnxt_qplib_rcfw *rcfw);int bnxt_qplib_init_rcfw (struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_ctx *ctx,int is_virtfn); +void bnxt_qplib_mark_qp_error (void *qp_handle);#endif /* __BNXT_QPLIB_RCFW_H__ */
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 10/13 RDMA/bnxt_re: Enable atomics only if host bios supports
In reply to a message not in the archiveFrom: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]>
Driver shall check if the host system bios has enabled Atomic operations capability in PCI Device Control 2 register of the pci-device. Expose the ATOMIC_HCA flag only if the Atomic operations capability is set.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 6 ++++-- drivers/infiniband/hw/bnxt_re/qplib_sp.c | 14 ++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_sp.h | 3 +++ 3 files changed, 21 insertions(+), 2 deletions(-)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +4 -2
@@ -173,8 +173,10 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->max_pd = dev_attr->max_pd; ib_attr->max_qp_rd_atom = dev_attr->max_qp_rd_atom; ib_attr->max_qp_init_rd_atom = dev_attr->max_qp_init_rd_atom; - ib_attr->atomic_cap =IB_ATOMIC_HCA ; - ib_attr->masked_atomic_cap =IB_ATOMIC_HCA ; +if (dev_attr->is_atomic) { + ib_attr->atomic_cap =IB_ATOMIC_HCA ; + ib_attr->masked_atomic_cap =IB_ATOMIC_HCA ; + } ib_attr->max_ee_rd_atom =0 ; ib_attr->max_res_rd_atom =0 ;
drivers/infiniband/hw/bnxt_re/qplib_sp.c +14 -0
@@ -51,6 +51,19 @@ const struct bnxt_qplib_gid bnxt_qplib_gid_zero = {{ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } };/* Device */ + +static bool bnxt_qplib_is_atomic_cap (struct bnxt_qplib_rcfw *rcfw) +{ +int rc; +u16 pcie_ctl2; + + rc =pcie_capability_read_word (rcfw->pdev,PCI_EXP_DEVCTL2 , + &pcie_ctl2); +if (rc) +return false; +return !!(pcie_ctl2 &PCI_EXP_DEVCTL2_ATOMIC_REQ ); +} +int bnxt_qplib_get_dev_attr (struct bnxt_qplib_rcfw *rcfw,struct bnxt_qplib_dev_attr *attr) {
@@ -131,6 +144,7 @@ int bnxt_qplib_get_dev_attr(struct bnxt_qplib_rcfw *rcfw, attr->tqm_alloc_reqs[i *4 +3 ] = *(++tqm_alloc); } + 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 +3 -0
@@ -42,6 +42,8 @@#define BNXT_QPLIB_RESERVED_QP_WRS 128 +#define PCI_EXP_DEVCTL2_ATOMIC_REQ 0x0040 +struct bnxt_qplib_dev_attr {char fw_ver[32 ];u16 max_sgid;
@@ -70,6 +72,7 @@ struct bnxt_qplib_dev_attr {u32 max_inline_data;u32 l2_db_size;u8 tqm_alloc_reqs[MAX_TQM_ALLOC_REQ ]; +bool is_atomic; };struct bnxt_qplib_pd {
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 11/13 RDMA/bnxt_re: Fix return value of poll routine
In reply to a message not in the archiveFrom: Devesh Sharma <devesh.sharma-dY08KVG/lbpWk0Htik3J/[email protected]>
Fix the incorrect reporting of number of polled
entries by taking into account the max CQ depth
in the driver.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 1 + 1 file changed, 1 insertion(+)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -0
@@ -2903,6 +2903,7 @@ int bnxt_re_poll_cq(struct ib_cq *ib_cq, int num_entries, struct ib_wc *wc)spin_lock_irqsave (&cq->cq_lock, flags); budget =min_t (u32, num_entries, cq->max_cql); + num_entries = budget;if (!cq->cql) {dev_err (rdev_to_dev (cq->rdev),"POLL CQ : no CQL to use" ); goto exit;
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 12/13 RDMA/bnxt_re: Report MISSED_EVENTS in req_notify_cq
In reply to a message not in the archiveWhile invoking the req_notify_cq hook, ULPs can request whether the CQs have any CQEs pending. If CQEs are pending, drivers can indicate it by returning 1 for req_notify_cq. The stack will poll CQ again till CQ is empty.
This patch peeks the CQ for any valid entries and return accordingly.
--- drivers/infiniband/hw/bnxt_re/ib_verbs.c | 5 +++++ drivers/infiniband/hw/bnxt_re/qplib_fp.c | 19 +++++++++++++++++++ drivers/infiniband/hw/bnxt_re/qplib_fp.h | 1 + 3 files changed, 25 insertions(+)
drivers/infiniband/hw/bnxt_re/ib_verbs.c +5 -0
@@ -3034,6 +3034,11 @@ int bnxt_re_req_notify_cq(struct ib_cq *ib_cq,else if (ib_cqn_flags &IB_CQ_SOLICITED ) type =DBR_DBR_TYPE_CQ_ARMSE ; +/* Poll to see if there are missed events */ +if ((ib_cqn_flags &IB_CQ_REPORT_MISSED_EVENTS ) && + !(bnxt_qplib_is_cq_empty (&cq->qplib_cq))) +return 1 ; +bnxt_qplib_req_notify_cq (&cq->qplib_cq, type);return 0 ;
drivers/infiniband/hw/bnxt_re/qplib_fp.c +19 -0
@@ -2164,6 +2164,25 @@ static int bnxt_qplib_cq_process_res_ud(struct bnxt_qplib_cq *cq,return rc; } +bool bnxt_qplib_is_cq_empty (struct bnxt_qplib_cq *cq) +{ +struct cq_base *hw_cqe, **hw_cqe_ptr; +unsigned long flags; +u32 sw_cons, raw_cons; +bool rc = true; + +spin_lock_irqsave (&cq->hwq.lock, flags); + raw_cons = cq->hwq.cons; + sw_cons =HWQ_CMP (raw_cons, &cq->hwq); + hw_cqe_ptr = (struct cq_base **)cq->hwq.pbl_ptr; + hw_cqe = &hw_cqe_ptr[CQE_PG (sw_cons)][CQE_IDX (sw_cons)]; + +/* Check for Valid bit. If the CQE is valid, return false */ + rc = !CQE_CMP_VALID (hw_cqe, raw_cons, cq->hwq.max_elements); +spin_unlock_irqrestore (&cq->hwq.lock, flags); +return rc; +} + static int bnxt_qplib_cq_process_res_raweth_qp1(struct bnxt_qplib_cq *cq, struct cq_res_raweth_qp1 *hwcqe, struct bnxt_qplib_cqe **pcqe,
drivers/infiniband/hw/bnxt_re/qplib_fp.h +1 -0
@@ -463,6 +463,7 @@ int bnxt_qplib_create_cq(struct bnxt_qplib_res *res, struct bnxt_qplib_cq *cq);int bnxt_qplib_destroy_cq (struct bnxt_qplib_res *res,struct bnxt_qplib_cq *cq);int bnxt_qplib_poll_cq (struct bnxt_qplib_cq *cq,struct bnxt_qplib_cqe *cqe,int num,struct bnxt_qplib_qp **qp); +bool bnxt_qplib_is_cq_empty (struct bnxt_qplib_cq *cq);void bnxt_qplib_req_notify_cq (struct bnxt_qplib_cq *cq,u32 arm_type);void bnxt_qplib_free_nq (struct bnxt_qplib_nq *nq);int bnxt_qplib_alloc_nq (struct pci_dev *pdev,struct bnxt_qplib_nq *nq);
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 13/13 RDMA/bnxt_re: Fix the value reported for local ack delay
In reply to a message not in the archiveLocal ack delay exposed by the driver is 0 which means infinite QP timeout. Reporting the default value to 16 (approx 260ms)
--- drivers/infiniband/hw/bnxt_re/bnxt_re.h | 7 +++++++ drivers/infiniband/hw/bnxt_re/ib_verbs.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-)
drivers/infiniband/hw/bnxt_re/bnxt_re.h +7 -0
@@ -62,6 +62,13 @@#define BNXT_RE_RQ_WQE_THRESHOLD 32 +/* +* Setting the default ack delay value to 16, which means +* the default timeout is approx. 260ms(4 usec * 2 ^(timeout)) +*/ + +#define BNXT_RE_DEFAULT_ACK_DELAY 16 +struct bnxt_re_work {struct work_struct work;unsigned long event;
drivers/infiniband/hw/bnxt_re/ib_verbs.c +1 -1
@@ -201,7 +201,7 @@ int bnxt_re_query_device(struct ib_device *ibdev, ib_attr->max_fast_reg_page_list_len =MAX_PBL_LVL_1_PGS ; ib_attr->max_pkeys =1 ; - ib_attr->local_ca_ack_delay =0 ; + ib_attr->local_ca_ack_delay =BNXT_RE_DEFAULT_ACK_DELAY ;return 0 ; }
Signature · 6 lines
2.5.5 -- To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Quoted 8 lines · Selvin Xavier
This patch series includes the bug fixes for
bnxt_re.Patches 1 - 8 in this series are the backlog from the previously submitted series -
https://www.spinics.net/lists/linux-rdma/msg50984.htm (6 out of the the 14 patches from the above series got merged into 4.12-rc). Theise patches are already reviewed by the community.
Quoted 8 lines
Patches 9-13 are new patches posted for review.
Doug,
Please review this and consider applying all 13 patches in the 4.13 merge cycle.Thanks,
Selvin Xavier
Hi Selvin,
I dropped patch #1 because it conflicts with other patches already applied.
Then, because I'm only taking -rc candidate fixes this cycle, I took patches 2, 3, 5, 6, 7, 8, 10, 11, 12, and 13. I left out 4 because it is rather large, and because this represents something that is arguably a feature implementation and not a strict bug fix that has a workaround (just use vlans with egress mappings and the issue is resolved). I left out 9 because of its size and the non-urgent nature of the fix. Thanks.
Signature · 3 lines
Doug Ledford <[email protected]> GPG Key ID: B826A3330E572FDD Key fingerprint = AE6B 1BDA 122B 23B4 265B 1274 B826 A333 0E57 2FDD