From: "Nelson, Shannon" <shannon.nelson@amd.com>
To: Dmitrii Ermakov <demonihin@gmail.com>, davem@davemloft.net
Cc: edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
przemyslaw.kitszel@intel.com, anthony.l.nguyen@intel.com,
netdev@vger.kernel.org, intel-wired-lan@lists.osuosl.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] e1000e: makes e1000_watchdog_task use queue_delayed_work
Date: Tue, 17 Sep 2024 16:54:13 -0700 [thread overview]
Message-ID: <49131e14-fb4c-4176-9e55-f50d69bc9bdf@amd.com> (raw)
In-Reply-To: <20240915070334.1267-1-demonihin@gmail.com>
On 9/15/2024 12:03 AM, Dmitrii Ermakov wrote:
>
> Replaces watchdog timer with delayed_work as advised
> in the driver's TODO comment.
>
> Signed-off-by: Dmitrii Ermakov <demonihin@gmail.com>
The Subject should identify which tree to go to, net or net-next. This
should be for net-next, e.g. [PATCH net-next].
But be aware that net-next tree is closed during the merge window, so
you'll need to wait a week or two before reposting.
> ---
> drivers/net/ethernet/intel/e1000e/e1000.h | 4 +-
> drivers/net/ethernet/intel/e1000e/netdev.c | 43 ++++++++--------------
> 2 files changed, 18 insertions(+), 29 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/e1000e/e1000.h b/drivers/net/ethernet/intel/e1000e/e1000.h
> index ba9c19e6994c..5a60372d2158 100644
> --- a/drivers/net/ethernet/intel/e1000e/e1000.h
> +++ b/drivers/net/ethernet/intel/e1000e/e1000.h
> @@ -189,12 +189,12 @@ struct e1000_phy_regs {
>
> /* board specific private data structure */
> struct e1000_adapter {
> - struct timer_list watchdog_timer;
> struct timer_list phy_info_timer;
> struct timer_list blink_timer;
>
> + struct delayed_work watchdog_work;
> +
> struct work_struct reset_task;
> - struct work_struct watchdog_task;
>
> const struct e1000_info *ei;
>
> diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c
> index 360ee26557f7..5b7a3a1423ed 100644
> --- a/drivers/net/ethernet/intel/e1000e/netdev.c
> +++ b/drivers/net/ethernet/intel/e1000e/netdev.c
> @@ -1778,7 +1778,8 @@ static irqreturn_t e1000_intr_msi(int __always_unused irq, void *data)
> }
> /* guard against interrupt when we're going down */
> if (!test_bit(__E1000_DOWN, &adapter->state))
> - mod_timer(&adapter->watchdog_timer, jiffies + 1);
> + queue_delayed_work(system_wq, &adapter->watchdog_work,
> + 1);
This is not worth the line wrap, keep it one line.
> }
>
> /* Reset on uncorrectable ECC error */
> @@ -1857,7 +1858,8 @@ static irqreturn_t e1000_intr(int __always_unused irq, void *data)
> }
> /* guard against interrupt when we're going down */
> if (!test_bit(__E1000_DOWN, &adapter->state))
> - mod_timer(&adapter->watchdog_timer, jiffies + 1);
> + queue_delayed_work(system_wq, &adapter->watchdog_work,
> + 1);
ditto
> }
>
> /* Reset on uncorrectable ECC error */
> @@ -1901,7 +1903,8 @@ static irqreturn_t e1000_msix_other(int __always_unused irq, void *data)
> hw->mac.get_link_status = true;
> /* guard against interrupt when we're going down */
> if (!test_bit(__E1000_DOWN, &adapter->state))
> - mod_timer(&adapter->watchdog_timer, jiffies + 1);
> + queue_delayed_work(system_wq, &adapter->watchdog_work,
> + 1);
ditto
> }
>
> if (!test_bit(__E1000_DOWN, &adapter->state))
> @@ -4293,7 +4296,8 @@ void e1000e_down(struct e1000_adapter *adapter, bool reset)
>
> napi_synchronize(&adapter->napi);
>
> - del_timer_sync(&adapter->watchdog_timer);
> + cancel_delayed_work_sync(&adapter->watchdog_work);
> +
> del_timer_sync(&adapter->phy_info_timer);
>
> spin_lock(&adapter->stats64_lock);
> @@ -5164,25 +5168,12 @@ static void e1000e_check_82574_phy_workaround(struct e1000_adapter *adapter)
> }
> }
>
> -/**
> - * e1000_watchdog - Timer Call-back
> - * @t: pointer to timer_list containing private info adapter
> - **/
> -static void e1000_watchdog(struct timer_list *t)
> -{
> - struct e1000_adapter *adapter = from_timer(adapter, t, watchdog_timer);
> -
> - /* Do the rest outside of interrupt context */
> - schedule_work(&adapter->watchdog_task);
> -
> - /* TODO: make this use queue_delayed_work() */
> -}
> -
> static void e1000_watchdog_task(struct work_struct *work)
In keeping with the theme, this could be changed to e1000_watchdog_work()
> {
> - struct e1000_adapter *adapter = container_of(work,
> - struct e1000_adapter,
> - watchdog_task);
> + struct delayed_work *dwork =
> + container_of(work, struct delayed_work, work);
> + struct e1000_adapter *adapter =
> + container_of(dwork, struct e1000_adapter, watchdog_work);
> struct net_device *netdev = adapter->netdev;
> struct e1000_mac_info *mac = &adapter->hw.mac;
> struct e1000_phy_info *phy = &adapter->hw.phy;
> @@ -5411,8 +5402,8 @@ static void e1000_watchdog_task(struct work_struct *work)
>
> /* Reset the timer */
> if (!test_bit(__E1000_DOWN, &adapter->state))
> - mod_timer(&adapter->watchdog_timer,
> - round_jiffies(jiffies + 2 * HZ));
> + queue_delayed_work(system_wq, &adapter->watchdog_work,
> + round_jiffies(2 * HZ));
> }
>
> #define E1000_TX_FLAGS_CSUM 0x00000001
> @@ -7588,11 +7579,10 @@ static int e1000_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
> goto err_eeprom;
> }
>
> - timer_setup(&adapter->watchdog_timer, e1000_watchdog, 0);
> timer_setup(&adapter->phy_info_timer, e1000_update_phy_info, 0);
> + INIT_DELAYED_WORK(&adapter->watchdog_work, e1000_watchdog_task);
>
> INIT_WORK(&adapter->reset_task, e1000_reset_task);
> - INIT_WORK(&adapter->watchdog_task, e1000_watchdog_task);
> INIT_WORK(&adapter->downshift_task, e1000e_downshift_workaround);
> INIT_WORK(&adapter->update_phy_task, e1000e_update_phy_task);
> INIT_WORK(&adapter->print_hang_task, e1000_print_hw_hang);
> @@ -7733,11 +7723,10 @@ static void e1000_remove(struct pci_dev *pdev)
> * from being rescheduled.
> */
> set_bit(__E1000_DOWN, &adapter->state);
> - del_timer_sync(&adapter->watchdog_timer);
> + cancel_delayed_work_sync(&adapter->watchdog_work);
> del_timer_sync(&adapter->phy_info_timer);
>
> cancel_work_sync(&adapter->reset_task);
> - cancel_work_sync(&adapter->watchdog_task);
> cancel_work_sync(&adapter->downshift_task);
> cancel_work_sync(&adapter->update_phy_task);
> cancel_work_sync(&adapter->print_hang_task);
> --
> 2.45.2
>
>
prev parent reply other threads:[~2024-09-17 23:54 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-09-15 7:03 [PATCH] e1000e: makes e1000_watchdog_task use queue_delayed_work Dmitrii Ermakov
2024-09-17 23:54 ` Nelson, Shannon [this message]
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=49131e14-fb4c-4176-9e55-f50d69bc9bdf@amd.com \
--to=shannon.nelson@amd.com \
--cc=anthony.l.nguyen@intel.com \
--cc=davem@davemloft.net \
--cc=demonihin@gmail.com \
--cc=edumazet@google.com \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
/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;
as well as URLs for NNTP newsgroup(s).