From: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
To: netdev@vger.kernel.org
Cc: Dany Madden <drt@linux.ibm.com>,
Rick Lindsley <ricklind@linux.ibm.com>,
sukadev@linux.ibm.com, Brian King <brking@linux.ibm.com>,
cforno12@linux.ibm.com
Subject: [PATCH net 3/7] ibmvnic: clean pending indirect buffs during reset
Date: Wed, 23 Jun 2021 21:13:12 -0700 [thread overview]
Message-ID: <20210624041316.567622-4-sukadev@linux.ibm.com> (raw)
In-Reply-To: <20210624041316.567622-1-sukadev@linux.ibm.com>
We batch subordinate command response queue (scrq) descriptors that we
need to send to the VIOS using an "indirect" buffer. If after we queue
one or more scrqs in the indirect buffer encounter an error (say fail
to allocate an skb), we leave the queued scrq descriptors in the
indirect buffer until the next call to ibmvnic_xmit().
On the next call to ibmvnic_xmit(), it is possible that the adapter is
going through a reset and it is possible that the long term buffers
have been unmapped on the VIOS side. If we proceed to flush (send) the
packets that are in the indirect buffer, we will end up using the old
map ids and this can cause the VIOS to trigger an unnecessary FATAL
error reset.
Instead of flushing packets remaining on the indirect_buff, discard
(clean) them instead.
Fixes: 0d973388185d4 ("ibmvnic: Introduce xmit_more support using batched subCRQ hcalls")
Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.ibm.com>
---
drivers/net/ethernet/ibm/ibmvnic.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index fe1627ea9762..fa402e20c137 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -106,6 +106,8 @@ static void release_crq_queue(struct ibmvnic_adapter *);
static int __ibmvnic_set_mac(struct net_device *, u8 *);
static int init_crq_queue(struct ibmvnic_adapter *adapter);
static int send_query_phys_parms(struct ibmvnic_adapter *adapter);
+static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter,
+ struct ibmvnic_sub_crq_queue *tx_scrq);
struct ibmvnic_stat {
char name[ETH_GSTRING_LEN];
@@ -691,6 +693,7 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter)
tx_scrqs = adapter->num_active_tx_pools;
for (i = 0; i < tx_scrqs; i++) {
+ ibmvnic_tx_scrq_clean_buffer(adapter, adapter->tx_scrq[i]);
rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]);
if (rc)
return rc;
@@ -1643,7 +1646,8 @@ static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter,
ind_bufp->index = 0;
if (atomic_sub_return(entries, &tx_scrq->used) <=
(adapter->req_tx_entries_per_subcrq / 2) &&
- __netif_subqueue_stopped(adapter->netdev, queue_num)) {
+ __netif_subqueue_stopped(adapter->netdev, queue_num) &&
+ !test_bit(0, &adapter->resetting)) {
netif_wake_subqueue(adapter->netdev, queue_num);
netdev_dbg(adapter->netdev, "Started queue %d\n",
queue_num);
@@ -1713,7 +1717,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
tx_send_failed++;
tx_dropped++;
ret = NETDEV_TX_OK;
- ibmvnic_tx_scrq_flush(adapter, tx_scrq);
goto out;
}
@@ -3276,6 +3279,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter, bool do_h_free)
netdev_dbg(adapter->netdev, "Releasing tx_scrq[%d]\n",
i);
+ ibmvnic_tx_scrq_clean_buffer(adapter, adapter->tx_scrq[i]);
if (adapter->tx_scrq[i]->irq) {
free_irq(adapter->tx_scrq[i]->irq,
adapter->tx_scrq[i]);
--
2.31.1
next prev parent reply other threads:[~2021-06-24 4:14 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-24 4:13 [PATCH net 0/7] ibmvnic: Assorted bug fixes Sukadev Bhattiprolu
2021-06-24 4:13 ` [PATCH net 1/7] Revert "ibmvnic: simplify reset_long_term_buff function" Sukadev Bhattiprolu
2021-06-24 6:07 ` Lijun Pan
2021-06-24 16:07 ` Sukadev Bhattiprolu
2021-06-24 4:13 ` [PATCH net 2/7] Revert "ibmvnic: remove duplicate napi_schedule call in open function" Sukadev Bhattiprolu
2021-06-24 6:20 ` Lijun Pan
2021-06-24 6:42 ` Rick Lindsley
2021-06-24 7:07 ` Rick Lindsley
2021-06-24 7:02 ` Johaan Smith
2021-06-24 7:28 ` Rick Lindsley
2021-06-24 17:05 ` Lijun Pan
2021-06-24 18:18 ` Dany Madden
2021-06-24 23:33 ` Rick Lindsley
2021-06-24 16:53 ` Lijun Pan
2021-06-24 4:13 ` Sukadev Bhattiprolu [this message]
2021-06-24 4:13 ` [PATCH net 4/7] ibmvnic: account for bufs already saved in indir_buf Sukadev Bhattiprolu
2021-06-24 4:13 ` [PATCH net 5/7] ibmvnic: set ltb->buff to NULL after freeing Sukadev Bhattiprolu
2021-06-24 4:13 ` [PATCH net 6/7] ibmvnic: free tx_pool if tso_pool alloc fails Sukadev Bhattiprolu
2021-06-24 4:13 ` [PATCH net 7/7] ibmvnic: parenthesize a check Sukadev Bhattiprolu
2021-06-24 5:50 ` Lijun Pan
2021-06-24 18:30 ` [PATCH net 0/7] ibmvnic: Assorted bug fixes 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=20210624041316.567622-4-sukadev@linux.ibm.com \
--to=sukadev@linux.ibm.com \
--cc=brking@linux.ibm.com \
--cc=cforno12@linux.ibm.com \
--cc=drt@linux.ibm.com \
--cc=netdev@vger.kernel.org \
--cc=ricklind@linux.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).