RDMA/bnxt_re: Remove the sriov config callback

Remove the SRIOV config callback which the bnxt_en was calling
to reconfigure the chip resources for a PF device when VFs are
created. The code is now modified to provision the VF resources
based on the total VF count instead of the actual VF count.
This allows the SRIOV config callback to be removed from the
list of ulp_ops.

Suggested-by: Leon Romanovsky <leonro@nvidia.com>
Signed-off-by: Ajit Khaparde <ajit.khaparde@broadcom.com>
Reviewed-by: Leon Romanovsky <leonro@nvidia.com>
This commit is contained in:
Ajit Khaparde 2022-12-06 13:29:46 -08:00
parent 848dc857c8
commit a43c26fa2e
4 changed files with 8 additions and 40 deletions

View File

@ -221,13 +221,12 @@ static void bnxt_re_set_resource_limits(struct bnxt_re_dev *rdev)
bnxt_re_limit_vf_res(&rdev->qplib_ctx, num_vfs); bnxt_re_limit_vf_res(&rdev->qplib_ctx, num_vfs);
} }
static void bnxt_re_sriov_config(void *p, int num_vfs) static void bnxt_re_vf_res_config(struct bnxt_re_dev *rdev)
{ {
struct bnxt_re_dev *rdev = p;
if (test_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags)) if (test_bit(BNXT_RE_FLAG_ERR_DEVICE_DETACHED, &rdev->flags))
return; return;
rdev->num_vfs = num_vfs; rdev->num_vfs = pci_sriov_get_totalvfs(rdev->en_dev->pdev);
if (!bnxt_qplib_is_chip_gen_p5(rdev->chip_ctx)) { if (!bnxt_qplib_is_chip_gen_p5(rdev->chip_ctx)) {
bnxt_re_set_resource_limits(rdev); bnxt_re_set_resource_limits(rdev);
bnxt_qplib_set_func_resources(&rdev->qplib_res, &rdev->rcfw, bnxt_qplib_set_func_resources(&rdev->qplib_res, &rdev->rcfw,
@ -297,7 +296,6 @@ static void bnxt_re_start_irq(void *handle, struct bnxt_msix_entry *ent)
} }
static struct bnxt_ulp_ops bnxt_re_ulp_ops = { static struct bnxt_ulp_ops bnxt_re_ulp_ops = {
.ulp_sriov_config = bnxt_re_sriov_config,
.ulp_irq_stop = bnxt_re_stop_irq, .ulp_irq_stop = bnxt_re_stop_irq,
.ulp_irq_restart = bnxt_re_start_irq .ulp_irq_restart = bnxt_re_start_irq
}; };
@ -1369,6 +1367,11 @@ static int bnxt_re_dev_init(struct bnxt_re_dev *rdev, u8 wqe_mode)
INIT_DELAYED_WORK(&rdev->worker, bnxt_re_worker); INIT_DELAYED_WORK(&rdev->worker, bnxt_re_worker);
set_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags); set_bit(BNXT_RE_FLAG_QOS_WORK_REG, &rdev->flags);
schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000)); schedule_delayed_work(&rdev->worker, msecs_to_jiffies(30000));
/*
* Use the total VF count since the actual VF count may not be
* available at this point.
*/
bnxt_re_vf_res_config(rdev);
} }
return 0; return 0;

View File

@ -749,7 +749,6 @@ int bnxt_cfg_hw_sriov(struct bnxt *bp, int *num_vfs, bool reset)
*num_vfs = rc; *num_vfs = rc;
} }
bnxt_ulp_sriov_cfg(bp, *num_vfs);
return 0; return 0;
} }
@ -823,10 +822,8 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
goto err_out2; goto err_out2;
rc = pci_enable_sriov(bp->pdev, *num_vfs); rc = pci_enable_sriov(bp->pdev, *num_vfs);
if (rc) { if (rc)
bnxt_ulp_sriov_cfg(bp, 0);
goto err_out2; goto err_out2;
}
return 0; return 0;
@ -872,8 +869,6 @@ void bnxt_sriov_disable(struct bnxt *bp)
rtnl_lock(); rtnl_lock();
bnxt_restore_pf_fw_resources(bp); bnxt_restore_pf_fw_resources(bp);
rtnl_unlock(); rtnl_unlock();
bnxt_ulp_sriov_cfg(bp, 0);
} }
int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs) int bnxt_sriov_configure(struct pci_dev *pdev, int num_vfs)

View File

@ -259,16 +259,6 @@ int bnxt_send_msg(struct bnxt_en_dev *edev,
} }
EXPORT_SYMBOL(bnxt_send_msg); EXPORT_SYMBOL(bnxt_send_msg);
static void bnxt_ulp_get(struct bnxt_ulp *ulp)
{
atomic_inc(&ulp->ref_count);
}
static void bnxt_ulp_put(struct bnxt_ulp *ulp)
{
atomic_dec(&ulp->ref_count);
}
void bnxt_ulp_stop(struct bnxt *bp) void bnxt_ulp_stop(struct bnxt *bp)
{ {
struct bnxt_aux_priv *aux_priv = bp->aux_priv; struct bnxt_aux_priv *aux_priv = bp->aux_priv;
@ -321,25 +311,6 @@ void bnxt_ulp_start(struct bnxt *bp, int err)
} }
void bnxt_ulp_sriov_cfg(struct bnxt *bp, int num_vfs)
{
struct bnxt_en_dev *edev = bp->edev;
struct bnxt_ulp_ops *ops;
struct bnxt_ulp *ulp;
if (!edev)
return;
ulp = edev->ulp_tbl;
ops = rcu_dereference(ulp->ulp_ops);
if (!ops || !ops->ulp_sriov_config)
return;
bnxt_ulp_get(ulp);
ops->ulp_sriov_config(ulp->handle, num_vfs);
bnxt_ulp_put(ulp);
}
void bnxt_ulp_irq_stop(struct bnxt *bp) void bnxt_ulp_irq_stop(struct bnxt *bp)
{ {
struct bnxt_en_dev *edev = bp->edev; struct bnxt_en_dev *edev = bp->edev;

View File

@ -26,7 +26,6 @@ struct bnxt_msix_entry {
}; };
struct bnxt_ulp_ops { struct bnxt_ulp_ops {
void (*ulp_sriov_config)(void *, int);
void (*ulp_irq_stop)(void *); void (*ulp_irq_stop)(void *);
void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *); void (*ulp_irq_restart)(void *, struct bnxt_msix_entry *);
}; };