Netdev List
 help / color / mirror / Atom feed
From: "Jiawen Wu" <jiawenwu@trustnetic.com>
To: "'Simon Horman'" <horms@kernel.org>
Cc: <netdev@vger.kernel.org>, <mengyuanlou@net-swift.com>,
	<andrew+netdev@lunn.ch>, <davem@davemloft.net>,
	<edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>,
	<kees@kernel.org>, <larysa.zaremba@intel.com>,
	<jacob.e.keller@intel.com>, <netdev@vger.kernel.org>,
	<mengyuanlou@net-swift.com>, <andrew+netdev@lunn.ch>,
	<davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>,
	<pabeni@redhat.com>, <kees@kernel.org>,
	<larysa.zaremba@intel.com>, <jacob.e.keller@intel.com>
Subject: RE: [PATCH net-next v1 3/3] net: txgbe: rework service event handling
Date: Mon, 25 May 2026 09:55:38 +0800	[thread overview]
Message-ID: <03b301dcebe9$959576a0$c0c063e0$@trustnetic.com> (raw)
In-Reply-To: <20260522073456.2032440-1-horms@kernel.org>

On Fri, May 22, 2026 3:35 PM, Simon Horman wrote:
> From: 'Simon Horman' <horms@kernel.org>
> 
> This is an AI-generated review of your patch. The human sending this
> email has considered the AI review valid, or at least plausible.
> Full review at: https://sashiko.dev
> ---
> net: txgbe: rework service event handling
> 
> This commit converts the link event subtasks to use test_and_clear_bit()
> and changes how module detection retries are handled. It also explicitly
> cancels the service task during device teardown.
> 
> > diff --git a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > index 6755464b46371..ce82e13aa8ae0 100644
> > --- a/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > +++ b/drivers/net/ethernet/wangxun/txgbe/txgbe_main.c
> > @@ -93,31 +93,23 @@ static void txgbe_module_detection_subtask(struct wx *wx)
> >  {
> >  	int err;
> >
> > -	if (!test_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags))
> > +	if (!test_and_clear_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags))
> >  		return;
> >
> >  	/* wait for SFF module ready */
> >  	msleep(200);
> >
> >  	err = txgbe_identify_module(wx);
> > -	if (err)
> > -		return;
> > -
> > -	clear_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags);
> > +	if (err == -ENODEV)
> > +		set_bit(WX_FLAG_NEED_MODULE_RESET, wx->flags);
> >  }
> 
> Does this change prevent the driver from retrying transient firmware errors?
> 
> Since txgbe_identify_module() communicates with firmware via
> txgbe_identify_module_hostif(), it can fail with transient errors like
> -EIO or -ETIMEDOUT.

Once the firmware interaction returns an error, it should not continue trying.
We believe this will keep printing errors. So just clear it.

> 
> Before this patch, the WX_FLAG_NEED_MODULE_RESET flag was only cleared upon
> successful completion, ensuring the periodic timer would retry on any error.
> 
> Because the flag is now cleared immediately and only re-armed on -ENODEV,
> could a single transient timeout cause the driver to permanently abandon
> module setup?
> 
> >  static void txgbe_link_config_subtask(struct wx *wx)
> >  {
> > -	int err;
> > -
> > -	if (!test_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags))
> > +	if (!test_and_clear_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags))
> >  		return;
> >
> > -	err = txgbe_set_phy_link(wx);
> > -	if (err)
> > -		return;
> > -
> > -	clear_bit(WX_FLAG_NEED_LINK_CONFIG, wx->flags);
> > +	txgbe_set_phy_link(wx);
> >  }
> 
> Similarly, does this silently drop link configuration on failure?
> 
> Without a way to re-arm WX_FLAG_NEED_LINK_CONFIG, any transient failure
> in txgbe_set_phy_link() will result in the driver no longer retrying link
> configuration.
> 
> [ ... ]
> 
> > @@ -233,6 +225,7 @@ static void txgbe_disable_device(struct wx *wx)
> >  	wx_napi_disable_all(wx);
> >
> >  	timer_delete_sync(&wx->service_timer);
> > +	cancel_work_sync(&wx->service_task);
> >
> >  	if (wx->bus.func < 2)
> >  		wr32m(wx, TXGBE_MIS_PRB_CTL, TXGBE_MIS_PRB_CTL_LAN_UP(wx->bus.func), 0);
> 
> Will canceling the service_task here leave the WX_STATE_SERVICE_SCHED bit
> permanently set if the work is pending?

When will the work be pending? Could it be overthinking?

> 
> The wx_service_event_schedule() function sets WX_STATE_SERVICE_SCHED before
> queuing the task, and this bit is normally cleared exclusively at the end
> of the work function.
> 
> If cancel_work_sync() dequeues the work without running it, the bit is never
> cleared. When the device is later brought back up, attempts to schedule the
> service task will fail, which seems like it would permanently break module
> detection, link configuration, and stats collection until the driver is
> reloaded.
> 


      reply	other threads:[~2026-05-25  1:56 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-19  8:00 [PATCH net-next v1 0/3] wangxun: improve service task synchronization Jiawen Wu
2026-05-19  8:00 ` [PATCH net-next v1 1/3] net: wangxun: introduce WX_STATE_DOWN to serialize device shutdown state Jiawen Wu
2026-05-22  7:34   ` Simon Horman
2026-05-25  1:44     ` Jiawen Wu
2026-05-19  8:00 ` [PATCH net-next v1 2/3] net: wangxun: avoid statistics updates during device teardown Jiawen Wu
2026-05-19  8:00 ` [PATCH net-next v1 3/3] net: txgbe: rework service event handling Jiawen Wu
2026-05-22  7:34   ` Simon Horman
2026-05-25  1:55     ` Jiawen Wu [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='03b301dcebe9$959576a0$c0c063e0$@trustnetic.com' \
    --to=jiawenwu@trustnetic.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.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