public inbox for netdev@vger.kernel.org
 help / color / mirror / Atom feed
From: Paolo Abeni <pabeni@redhat.com>
To: Jiawen Wu <jiawenwu@trustnetic.com>, netdev@vger.kernel.org
Cc: Mengyuan Lou <mengyuanlou@net-swift.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	Richard Cochran <richardcochran@gmail.com>,
	Russell King <linux@armlinux.org.uk>,
	Simon Horman <horms@kernel.org>, Kees Cook <kees@kernel.org>,
	Larysa Zaremba <larysa.zaremba@intel.com>,
	Breno Leitao <leitao@debian.org>, Joe Damato <joe@dama.to>,
	Jacob Keller <jacob.e.keller@intel.com>,
	Fabio Baltieri <fabio.baltieri@gmail.com>
Subject: Re: [PATCH net-next v1 4/5] net: wangxun: extract the close_suspend sequence
Date: Thu, 30 Apr 2026 10:29:02 +0200	[thread overview]
Message-ID: <1d10fa79-0b95-4045-a38e-ce73b5445de7@redhat.com> (raw)
In-Reply-To: <20260428021156.13564-5-jiawenwu@trustnetic.com>

On 4/28/26 4:11 AM, Jiawen Wu wrote:
> @@ -510,6 +511,16 @@ void ngbe_up(struct wx *wx)
>  	ngbe_up_complete(wx);
>  }
>  
> +void ngbe_close_suspend(struct wx *wx)
> +{
> +	wx_ptp_suspend(wx);

Sashiko says:

Does this introduce a redundant call to wx_ptp_suspend()?
Both ngbe_close() and txgbe_close() call wx_ptp_stop() immediately before
conditionally calling ngbe_close_suspend() or txgbe_close_suspend().
Looking at wx_ptp_stop(), it already executes wx_ptp_suspend() as its first
operation.
While test_and_clear_bit(WX_STATE_PTP_RUNNING, wx->state) makes the second
call safe, it seems to be redundant execution.

> +	ngbe_down(wx);
> +	wx_free_irq(wx);
> +	wx_free_isb_resources(wx);
> +	wx_free_resources(wx);
> +	phylink_disconnect_phy(wx->phylink);
> +}
> +
>  /**
>   * ngbe_close - Disables a network interface
>   * @netdev: network interface device structure
> @@ -526,11 +537,8 @@ static int ngbe_close(struct net_device *netdev)
>  	struct wx *wx = netdev_priv(netdev);
>  
>  	wx_ptp_stop(wx);
> -	ngbe_down(wx);
> -	wx_free_irq(wx);
> -	wx_free_isb_resources(wx);
> -	wx_free_resources(wx);
> -	phylink_disconnect_phy(wx->phylink);
> +	if (netif_device_present(netdev))
> +		ngbe_close_suspend(wx);

Sashiko says:

On the ngbe side, can this skip the teardown sequence entirely on the
suspend/shutdown paths?
ngbe_dev_shutdown() (shared by .suspend and .shutdown) does:
    static void ngbe_dev_shutdown(struct pci_dev *pdev, bool *enable_wake)
    {
            ...
            netif_device_detach(netdev);
            if (netif_running(netdev))
                    ngbe_close(netdev);
            wx_clear_interrupt_scheme(wx);
            ...
    }
netif_device_detach() clears __LINK_STATE_PRESENT, so by the time
ngbe_close() runs, netif_device_present(netdev) returns false and the new
guard
    if (netif_device_present(netdev))
            ngbe_close_suspend(wx);
skips ngbe_close_suspend() on the suspend and shutdown paths.  Before this
patch ngbe_close() unconditionally ran ngbe_down(), wx_free_irq(),
wx_free_isb_resources(), wx_free_resources() and
phylink_disconnect_phy() on those paths.
Does that mean after this patch, suspend and shutdown:
  - leave the requested MSI-X / legacy IRQ handlers registered while
    wx_clear_interrupt_scheme() subsequently frees the vector pool,
  - leak the coherent ISB DMA buffer (isb_mem / isb_dma) freed in
    wx_free_isb_resources(),
  - leak the TX/RX ring DMA allocations freed in wx_free_resources(),
  - leave phylink connected (no phylink_disconnect_phy()), so resume
    re-enters phylink_connect_phy on an already connected state, and
  - skip ngbe_down() / ngbe_reset(), so the MAC is not quiesced before
    pci_disable_device()?
The txgbe shutdown path avoids this because txgbe_dev_shutdown() calls
txgbe_close_suspend() directly rather than going through txgbe_close():
    static void txgbe_dev_shutdown(struct pci_dev *pdev)
    {
            ...
            netif_device_detach(netdev);
            rtnl_lock();
            if (netif_running(netdev))
                    txgbe_close_suspend(wx);
            rtnl_unlock();
            ...
    }
Would an equivalent change in ngbe_dev_shutdown() (call
ngbe_close_suspend() directly instead of ngbe_close()) be the intended
pairing for the new guard in ngbe_close()?

/P


  reply	other threads:[~2026-04-30  8:29 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-28  2:11 [PATCH net-next v1 0/5] net: wangxun: timeout and error Jiawen Wu
2026-04-28  2:11 ` [PATCH net-next v1 1/5] net: ngbe: implement libwx reset ops Jiawen Wu
2026-04-28  2:11 ` [PATCH net-next v1 2/5] net: wangxun: add Tx timeout process Jiawen Wu
2026-04-30  8:24   ` Paolo Abeni
2026-04-30  8:33     ` Jiawen Wu
2026-04-28  2:11 ` [PATCH net-next v1 3/5] net: wangxun: add reinit parameter to wx->do_reset callback Jiawen Wu
2026-04-28  2:11 ` [PATCH net-next v1 4/5] net: wangxun: extract the close_suspend sequence Jiawen Wu
2026-04-30  8:29   ` Paolo Abeni [this message]
2026-04-28  2:11 ` [PATCH net-next v1 5/5] net: wangxun: implement pci_error_handlers ops Jiawen Wu
2026-04-30  8:34   ` Paolo Abeni

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=1d10fa79-0b95-4045-a38e-ce73b5445de7@redhat.com \
    --to=pabeni@redhat.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=fabio.baltieri@gmail.com \
    --cc=horms@kernel.org \
    --cc=jacob.e.keller@intel.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=joe@dama.to \
    --cc=kees@kernel.org \
    --cc=kuba@kernel.org \
    --cc=larysa.zaremba@intel.com \
    --cc=leitao@debian.org \
    --cc=linux@armlinux.org.uk \
    --cc=mengyuanlou@net-swift.com \
    --cc=netdev@vger.kernel.org \
    --cc=richardcochran@gmail.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