mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 01:55:51 +02:00
net: enetc: add CBDR setup/teardown hooks to enetc_si_ops for VF support
The upcoming ENETC v4 VF will share the enetc-vf driver with the existing v1 VF. However, ENETC v4 uses a revised CBDR (command BD ring) setup/teardown API that differs from v1. To support both versions in the same driver, add setup_cbdr() and teardown_cbdr() function pointers to struct enetc_si_ops. This allows each hardware version to register its own CBDR implementation: - ENETC v1 VF registers enetc_setup_cbdr/enetc_teardown_cbdr (existing) - ENETC v4 VF will register enetc4_setup_cbdr/enetc4_teardown_cbdr Update the enetc-vf driver to call CBDR operations through si->ops instead of directly invoking the v1 functions. This enables runtime selection of the correct CBDR backend based on hardware version. Changes: - Add setup_cbdr() and teardown_cbdr() hooks to struct enetc_si_ops - Register v1 CBDR functions in enetc_vsi_ops - Replace direct calls with si->ops->setup_cbdr() and si->ops->teardown_cbdr() in enetc_vf.c No functional changes to existing v1 VF behavior. Signed-off-by: Wei Fang <wei.fang@nxp.com> Link: https://patch.msgid.link/20260522092438.1264020-10-wei.fang@nxp.com Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
parent
4f46f1accd
commit
6bdc3144c0
|
|
@ -297,6 +297,8 @@ struct enetc_si;
|
|||
struct enetc_si_ops {
|
||||
int (*get_rss_table)(struct enetc_si *si, u32 *table, int count);
|
||||
int (*set_rss_table)(struct enetc_si *si, const u32 *table, int count);
|
||||
int (*setup_cbdr)(struct enetc_si *si);
|
||||
void (*teardown_cbdr)(struct enetc_si *si);
|
||||
};
|
||||
|
||||
/* PCI IEP device data */
|
||||
|
|
|
|||
|
|
@ -288,6 +288,8 @@ static void enetc_vf_netdev_setup(struct enetc_si *si, struct net_device *ndev,
|
|||
static const struct enetc_si_ops enetc_vsi_ops = {
|
||||
.get_rss_table = enetc_get_rss_table,
|
||||
.set_rss_table = enetc_set_rss_table,
|
||||
.setup_cbdr = enetc_setup_cbdr,
|
||||
.teardown_cbdr = enetc_teardown_cbdr,
|
||||
};
|
||||
|
||||
static int enetc_vf_probe(struct pci_dev *pdev,
|
||||
|
|
@ -328,7 +330,7 @@ static int enetc_vf_probe(struct pci_dev *pdev,
|
|||
|
||||
enetc_init_si_rings_params(priv);
|
||||
|
||||
err = enetc_setup_cbdr(si);
|
||||
err = si->ops->setup_cbdr(si);
|
||||
if (err)
|
||||
goto err_setup_cbdr;
|
||||
|
||||
|
|
@ -364,7 +366,7 @@ static int enetc_vf_probe(struct pci_dev *pdev,
|
|||
err_alloc_msix:
|
||||
enetc_free_si_resources(priv);
|
||||
err_alloc_si_res:
|
||||
enetc_teardown_cbdr(si);
|
||||
si->ops->teardown_cbdr(si);
|
||||
err_setup_cbdr:
|
||||
si->ndev = NULL;
|
||||
free_netdev(ndev);
|
||||
|
|
@ -389,7 +391,7 @@ static void enetc_vf_remove(struct pci_dev *pdev)
|
|||
enetc_free_msix(priv);
|
||||
|
||||
enetc_free_si_resources(priv);
|
||||
enetc_teardown_cbdr(si);
|
||||
si->ops->teardown_cbdr(si);
|
||||
|
||||
free_netdev(si->ndev);
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user