From: Michal Schmidt <mschmidt@redhat.com>
To: intel-wired-lan@lists.osuosl.org
Cc: netdev@vger.kernel.org, Tony Nguyen <anthony.l.nguyen@intel.com>,
Jesse Brandeburg <jesse.brandeburg@intel.com>
Subject: [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state
Date: Mon, 16 Oct 2023 18:48:46 +0200 [thread overview]
Message-ID: <20231016164849.45691-2-mschmidt@redhat.com> (raw)
In-Reply-To: <20231016164849.45691-1-mschmidt@redhat.com>
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 <mschmidt@redhat.com>
---
drivers/net/ethernet/intel/iavf/iavf.h | 1 -
drivers/net/ethernet/intel/iavf/iavf_main.c | 9 +++------
2 files changed, 3 insertions(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/intel/iavf/iavf.h b/drivers/net/ethernet/intel/iavf/iavf.h
index 44daf335e8c5..f026d0670338 100644
--- a/drivers/net/ethernet/intel/iavf/iavf.h
+++ b/drivers/net/ethernet/intel/iavf/iavf.h
@@ -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
diff --git a/drivers/net/ethernet/intel/iavf/iavf_main.c b/drivers/net/ethernet/intel/iavf/iavf_main.c
index f35d74566faa..d2f4648a6156 100644
--- a/drivers/net/ethernet/intel/iavf/iavf_main.c
+++ b/drivers/net/ethernet/intel/iavf/iavf_main.c
@@ -2021,7 +2021,7 @@ 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;
@@ -2029,7 +2029,7 @@ static void iavf_finish_config(struct work_struct *work)
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",
@@ -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
@@ -5173,10 +5172,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)) {
--
2.41.0
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-10-16 16:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 16:48 [Intel-wired-lan] [PATCH iwl-next 0/4] iavf: cleanups, dead code removal Michal Schmidt
2023-10-16 16:48 ` Michal Schmidt [this message]
2023-10-17 8:01 ` [Intel-wired-lan] [PATCH iwl-next 1/4] iavf: rely on netdev's own registered state Drewek, Wojciech
2023-10-17 17:30 ` Jacob Keller
2023-10-24 9:09 ` Romanowski, Rafal
2023-10-16 16:48 ` [Intel-wired-lan] [PATCH iwl-next 2/4] iavf: use unregister_netdev Michal Schmidt
2023-10-17 8:06 ` Drewek, Wojciech
2023-10-24 9:11 ` Romanowski, Rafal
2023-10-17 17:33 ` Jacob Keller
2023-10-17 18:43 ` Jacob Keller
2023-10-16 16:48 ` [Intel-wired-lan] [PATCH iwl-next 3/4] iavf: add a common function for undoing the interrupt scheme Michal Schmidt
2023-10-17 8:58 ` Drewek, Wojciech
2023-10-17 17:35 ` Jacob Keller
2023-10-24 9:12 ` Romanowski, Rafal
2023-10-16 16:48 ` [Intel-wired-lan] [PATCH iwl-next 4/4] iavf: delete the iavf client interface Michal Schmidt
2023-10-17 17:46 ` Jacob Keller
2023-10-24 9:12 ` Romanowski, Rafal
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231016164849.45691-2-mschmidt@redhat.com \
--to=mschmidt@redhat.com \
--cc=anthony.l.nguyen@intel.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=jesse.brandeburg@intel.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox