ice: move devlink port creation/deletion
Subsystems (2)
PATCH v2 1/1 ice: move devlink port creation/deletion
Commit a286ba738714 ("ice: reorder PF/representor devlink port register/unregister flows") moved the code to create and destroy the devlink PF port. This was fine, but created a corner case issue in the case of ice_register_netdev() failing. In that case, the driver would end up calling ice_devlink_destroy_pf_port() twice.
Additionally, it makes no sense to tie creation of the devlink PF port to the creation of the netdev so separate out the code to create/destroy the devlink PF port from the netdev code. This makes it a cleaner interface.
--- drivers/net/ethernet/intel/ice/ice_main.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-)
drivers/net/ethernet/intel/ice/ice_main.c +7 -6
@@ -4599,10 +4599,6 @@ static int ice_register_netdev(struct ice_pf *pf)if (!vsi || !vsi->netdev)return -EIO ; - err =ice_devlink_create_pf_port (pf); -if (err) - goto err_devlink_create; - err =register_netdev (vsi->netdev);if (err) goto err_register_netdev;
@@ -4615,8 +4611,6 @@ static int ice_register_netdev(struct ice_pf *pf)return 0 ; err_register_netdev: -ice_devlink_destroy_pf_port (pf); -err_devlink_create:free_netdev (vsi->netdev); vsi->netdev =NULL ;clear_bit (ICE_VSI_NETDEV_ALLOCD , vsi->state);
@@ -4909,6 +4903,10 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent)pcie_print_link_status (pf->pdev); probe_done: + err =ice_devlink_create_pf_port (pf); +if (err) + goto err_create_pf_port; + err =ice_register_netdev (pf);if (err) goto err_netdev_reg;
@@ -4946,6 +4944,8 @@ ice_probe(struct pci_dev *pdev, const struct pci_device_id __always_unused *ent) err_devlink_reg_param:ice_devlink_unregister_params (pf); err_netdev_reg: +ice_devlink_destroy_pf_port (pf); +err_create_pf_port: err_send_version_unroll:ice_vsi_release_all (pf); err_alloc_sw_unroll:
@@ -5071,6 +5071,7 @@ static void ice_remove(struct pci_dev *pdev)ice_setup_mc_magic_wake (pf);ice_vsi_release_all (pf);mutex_destroy (&(&pf->hw)->fdir_fltr_lock); +ice_devlink_destroy_pf_port (pf);ice_set_wake (pf);ice_free_irq_msix_misc (pf);ice_for_each_vsi (pf, i) {
Signature · 6 lines
2.35.1 _______________________________________________ Intel-wired-lan mailing list [email protected] https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Tony Nguyen
maintainerQuoted 11 lines · Paul M Stillwell Jr
Commit
a286ba738714("ice: reorder PF/representor devlink port register/unregister flows") moved the code to create and destroy the devlink PF port. This was fine, but created a corner case issue in the case ofice_register_netdev()failing. In that case, the driver would end up callingice_devlink_destroy_pf_port()twice.Additionally, it makes no sense to tie creation of the devlink PF port to the creation of the netdev so separate out the code to create/destroy the devlink PF port from the netdev code. This makes it a cleaner interface.
This has conflicts now due to changes recently accepted into net-next [1]. Can you please update and resend.
Also, as you're moving devlink registration out, this kdoc should get updated as well [2]
Quoted 2 lines
Fixes a286ba738714 ("ice: reorder PF/representor devlink port register/unregister flows")Signed-off-by Paul M Stillwell Jr <[email protected]>
[1] https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net-next.git/commit/?id=ac73d4bf2cdaf2cb8a43df8ee4a5c066d2c5d7b4
[2] https://elixir.bootlin.com/linux/v6.1-rc3/source/drivers/net/ethernet/intel/ice/ice_main.c#L4590
_______________________________________________
Intel-wired-lan mailing list
[email protected]
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan