[PATCH net-next V2 6/7] octeontx2-pf: Register devlink after SR-IOV state init

From: Mark Bloch

Date: Wed Jun 03 2026 - 15:42:40 EST


A later patch makes devlink registration the point where devlink core may
call eswitch_mode_set() to apply a boot-time default eswitch mode.

Move octeontx2 PF devlink registration after PF SR-IOV configuration state
is initialized, so representor creation has the state it needs.

Add a separate unwind label so failures after devlink registration
unregister devlink before cleaning up SR-IOV state.

Signed-off-by: Mark Bloch <mbloch@xxxxxxxxxx>
---
.../ethernet/marvell/octeontx2/nic/otx2_pf.c | 17 +++++++++--------
1 file changed, 9 insertions(+), 8 deletions(-)

diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
index ee623476e5ff..9afe6cf0ea01 100644
--- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
+++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c
@@ -3278,14 +3278,14 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
if (err)
goto err_mcam_flow_del;

- err = otx2_register_dl(pf);
- if (err)
- goto err_mcam_flow_del;
-
/* Initialize SR-IOV resources */
err = otx2_sriov_vfcfg_init(pf);
if (err)
- goto err_pf_sriov_init;
+ goto err_shutdown_tc;
+
+ err = otx2_register_dl(pf);
+ if (err)
+ goto err_sriov_cleannup;

/* Enable link notifications */
otx2_cgx_config_linkevents(pf, true);
@@ -3293,7 +3293,7 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
pf->af_xdp_zc_qidx = bitmap_zalloc(qcount, GFP_KERNEL);
if (!pf->af_xdp_zc_qidx) {
err = -ENOMEM;
- goto err_sriov_cleannup;
+ goto err_dl_unregister;
}

#ifdef CONFIG_DCB
@@ -3310,10 +3310,11 @@ static int otx2_probe(struct pci_dev *pdev, const struct pci_device_id *id)
err_free_zc_bmap:
bitmap_free(pf->af_xdp_zc_qidx);
#endif
+err_dl_unregister:
+ otx2_unregister_dl(pf);
err_sriov_cleannup:
otx2_sriov_vfcfg_cleanup(pf);
-err_pf_sriov_init:
- otx2_unregister_dl(pf);
+err_shutdown_tc:
otx2_shutdown_tc(pf);
err_mcam_flow_del:
otx2_mcam_flow_del(pf);
--
2.34.1