netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Nick Child <nnac123@linux.ibm.com>
To: netdev@vger.kernel.org
Cc: nick.child@ibm.com, haren@linux.ibm.com, ricklind@us.ibm.com,
	Nick Child <nnac123@linux.ibm.com>
Subject: [PATCH net 2/2] ibmvnic: Free any outstanding tx skbs during scrq reset
Date: Thu, 20 Jun 2024 10:23:12 -0500	[thread overview]
Message-ID: <20240620152312.1032323-3-nnac123@linux.ibm.com> (raw)
In-Reply-To: <20240620152312.1032323-1-nnac123@linux.ibm.com>

There are 2 types of outstanding tx skb's:
Type 1: Packets that are sitting in the drivers ind_buff that are
waiting to be batch sent to the NIC. During a device reset, these are
freed with a call to ibmvnic_tx_scrq_clean_buffer()
Type 2: Packets that have been sent to the NIC and are awaiting a TX
completion IRQ. These are free'd during a reset with a call to
clean_tx_pools()

During any reset which requires us to free the tx irq, ensure that the
Type 2 skb references are freed. Since the irq is released, it is
impossible for the NIC to inform of any completions.

Furthermore, later in the reset process is a call to init_tx_pools()
which marks every entry in the tx pool as free (ie not outstanding).
So if the driver is to make a call to init_tx_pools(), it must first
be sure that the tx pool is empty of skb references.

This issue was discovered by observing the following in the logs during
EEH testing:
	TX free map points to untracked skb (tso_pool 0 idx=4)
	TX free map points to untracked skb (tso_pool 0 idx=5)
	TX free map points to untracked skb (tso_pool 1 idx=36)

Fixes: 65d6470d139a ("ibmvnic: clean pending indirect buffs during reset")
Signed-off-by: Nick Child <nnac123@linux.ibm.com>
---
 drivers/net/ethernet/ibm/ibmvnic.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 887d92a88403..23ebeb143987 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -4073,6 +4073,12 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter, bool do_h_free)
 		adapter->num_active_tx_scrqs = 0;
 	}
 
+	/* Clean any remaining outstanding SKBs
+	 * we freed the irq so we won't be hearing
+	 * from them
+	 */
+	clean_tx_pools(adapter);
+
 	if (adapter->rx_scrq) {
 		for (i = 0; i < adapter->num_active_rx_scrqs; i++) {
 			if (!adapter->rx_scrq[i])
-- 
2.39.3


  parent reply	other threads:[~2024-06-20 15:27 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-20 15:23 [PATCH net 0/2] ibmvnic: Fix TX skb leak after device reset Nick Child
2024-06-20 15:23 ` [PATCH net 1/2] ibmvnic: Add tx check to prevent skb leak Nick Child
2024-06-25  8:58   ` Paolo Abeni
2024-06-20 15:23 ` Nick Child [this message]
2024-06-22 10:40 ` [PATCH net 0/2] ibmvnic: Fix TX skb leak after device reset patchwork-bot+netdevbpf
2024-06-25  9:10 ` patchwork-bot+netdevbpf

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=20240620152312.1032323-3-nnac123@linux.ibm.com \
    --to=nnac123@linux.ibm.com \
    --cc=haren@linux.ibm.com \
    --cc=netdev@vger.kernel.org \
    --cc=nick.child@ibm.com \
    --cc=ricklind@us.ibm.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).