Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 65d6470

Browse files
sukadevdavem330
authored andcommitted
ibmvnic: clean pending indirect buffs during reset
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: 0d97338 ("ibmvnic: Introduce xmit_more support using batched subCRQ hcalls") Signed-off-by: Sukadev Bhattiprolu <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2ca220f commit 65d6470

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

drivers/net/ethernet/ibm/ibmvnic.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,8 @@ static void release_crq_queue(struct ibmvnic_adapter *);
106106
static int __ibmvnic_set_mac(struct net_device *, u8 *);
107107
static int init_crq_queue(struct ibmvnic_adapter *adapter);
108108
static int send_query_phys_parms(struct ibmvnic_adapter *adapter);
109+
static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter,
110+
struct ibmvnic_sub_crq_queue *tx_scrq);
109111

110112
struct ibmvnic_stat {
111113
char name[ETH_GSTRING_LEN];
@@ -668,6 +670,7 @@ static int reset_tx_pools(struct ibmvnic_adapter *adapter)
668670

669671
tx_scrqs = adapter->num_active_tx_pools;
670672
for (i = 0; i < tx_scrqs; i++) {
673+
ibmvnic_tx_scrq_clean_buffer(adapter, adapter->tx_scrq[i]);
671674
rc = reset_one_tx_pool(adapter, &adapter->tso_pool[i]);
672675
if (rc)
673676
return rc;
@@ -1618,7 +1621,8 @@ static void ibmvnic_tx_scrq_clean_buffer(struct ibmvnic_adapter *adapter,
16181621
ind_bufp->index = 0;
16191622
if (atomic_sub_return(entries, &tx_scrq->used) <=
16201623
(adapter->req_tx_entries_per_subcrq / 2) &&
1621-
__netif_subqueue_stopped(adapter->netdev, queue_num)) {
1624+
__netif_subqueue_stopped(adapter->netdev, queue_num) &&
1625+
!test_bit(0, &adapter->resetting)) {
16221626
netif_wake_subqueue(adapter->netdev, queue_num);
16231627
netdev_dbg(adapter->netdev, "Started queue %d\n",
16241628
queue_num);
@@ -1711,7 +1715,6 @@ static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
17111715
tx_send_failed++;
17121716
tx_dropped++;
17131717
ret = NETDEV_TX_OK;
1714-
ibmvnic_tx_scrq_flush(adapter, tx_scrq);
17151718
goto out;
17161719
}
17171720

@@ -3175,6 +3178,7 @@ static void release_sub_crqs(struct ibmvnic_adapter *adapter, bool do_h_free)
31753178

31763179
netdev_dbg(adapter->netdev, "Releasing tx_scrq[%d]\n",
31773180
i);
3181+
ibmvnic_tx_scrq_clean_buffer(adapter, adapter->tx_scrq[i]);
31783182
if (adapter->tx_scrq[i]->irq) {
31793183
free_irq(adapter->tx_scrq[i]->irq,
31803184
adapter->tx_scrq[i]);

0 commit comments

Comments
 (0)