Skip to content

Commit

Permalink
iavf: rely on netdev's own registered state
Browse files Browse the repository at this point in the history
The information whether a netdev has been registered is already present
in the netdev itself. There's no need for a driver flag with the same
meaning.

Signed-off-by: Michal Schmidt <[email protected]>
Reviewed-by: Wojciech Drewek <[email protected]>
Reviewed-by: Jacob Keller <[email protected]>
Signed-off-by: Jacob Keller <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
michich authored and kuba-moo committed Oct 27, 2023
1 parent 54584b1 commit 34ad34b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion drivers/net/ethernet/intel/iavf/iavf.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,7 +377,6 @@ struct iavf_adapter {
unsigned long crit_section;

struct delayed_work watchdog_task;
bool netdev_registered;
bool link_up;
enum virtchnl_link_speed link_speed;
/* This is only populated if the VIRTCHNL_VF_CAP_ADV_LINK_SPEED is set
Expand Down
9 changes: 3 additions & 6 deletions drivers/net/ethernet/intel/iavf/iavf_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -2021,15 +2021,15 @@ static void iavf_finish_config(struct work_struct *work)
mutex_lock(&adapter->crit_lock);

if ((adapter->flags & IAVF_FLAG_SETUP_NETDEV_FEATURES) &&
adapter->netdev_registered &&
adapter->netdev->reg_state == NETREG_REGISTERED &&
!test_bit(__IAVF_IN_REMOVE_TASK, &adapter->crit_section)) {
netdev_update_features(adapter->netdev);
adapter->flags &= ~IAVF_FLAG_SETUP_NETDEV_FEATURES;
}

switch (adapter->state) {
case __IAVF_DOWN:
if (!adapter->netdev_registered) {
if (adapter->netdev->reg_state != NETREG_REGISTERED) {
err = register_netdevice(adapter->netdev);
if (err) {
dev_err(&adapter->pdev->dev, "Unable to register netdev (%d)\n",
Expand All @@ -2043,7 +2043,6 @@ static void iavf_finish_config(struct work_struct *work)
__IAVF_INIT_CONFIG_ADAPTER);
goto out;
}
adapter->netdev_registered = true;
}

/* Set the real number of queues when reset occurs while
Expand Down Expand Up @@ -5169,10 +5168,8 @@ static void iavf_remove(struct pci_dev *pdev)
cancel_work_sync(&adapter->finish_config);

rtnl_lock();
if (adapter->netdev_registered) {
if (netdev->reg_state == NETREG_REGISTERED)
unregister_netdevice(netdev);
adapter->netdev_registered = false;
}
rtnl_unlock();

if (CLIENT_ALLOWED(adapter)) {
Expand Down

0 comments on commit 34ad34b

Please sign in to comment.