Received: by 2002:a05:6a10:f3d0:0:0:0:0 with SMTP id a16csp2836577pxv; Mon, 12 Jul 2021 03:09:17 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSy16jHMThwmxvvT8Fso7LWrXAqbgl++0ohL1NXe9K673/mrnOx58evm7v83CpNTFOogCN X-Received: by 2002:a5e:a816:: with SMTP id c22mr14652471ioa.94.1626084557076; Mon, 12 Jul 2021 03:09:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1626084557; cv=none; d=google.com; s=arc-20160816; b=B6vyMK0rkYlcaVPH6Tbff/sw9NVMnFovAdKa2pRSATsZFVmm3gW+jJ4VLnleiWKXsd yhxPVbUF2uUxRU/lShEg69RGlFAM4R+7lR0C3uCMkaFunLndFITGPP2qtiutGkVo2l+7 V7vQAHz+QsBzLREEXBCkdFwSF3mQ+ekUAnZ0I4mwbYPWSnlEu17Xi4uxae1mzW/BM4b5 Tt/nqAUwe9OdVCMTP5TUf8ZObnFn+SocctnPIHI03FyQoD5aJjPQYQYX9b26k3LSaYSz d1VK6TZehxozdKq7bk8EsHQfE/WILfkqzvODtx6T360VPjbIvrxcjxPExDa1gJfoY/GN XasQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=pxgznlZfoVBaXSdvil/b/G2Bjm3V33/6vXAsKyV7PVs=; b=KRLsgAS6nN48bvzJ2C4cVq2bIFUUHtXTv97DnskDwhh6CNR5y2bLVOiKF5UzVOWaVd u3ySSBMFtb72FT5KXcFh/ba6c7YTBR6kpvN+mzKkMBUVRW0t4pJ80yDPAlDYLDHcSkyQ y9By8GzryoQy3twcqkpMz/f8zpCFgmVliOiyIAJvOWkMRopPzdYFtbHwrwnSVG104SrE zwKvfOWmS1UGq+zpcDu4pxxvRZ3wzuKgjwMzwkbTWB/78QY53tHc+nZqF4MYhpETSZ/6 JgHSLDN5Lim1tYnYRCwwHS9ksksDBGwHFvvwRZB9afSqBdPm8O5PT9ygLaQRVNgCBK+2 5Qng== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZk6wnUD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u12si18886892ilm.99.2021.07.12.03.09.04; Mon, 12 Jul 2021 03:09:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=gZk6wnUD; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349088AbhGLH43 (ORCPT + 99 others); Mon, 12 Jul 2021 03:56:29 -0400 Received: from mail.kernel.org ([198.145.29.99]:57238 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S243475AbhGLHS6 (ORCPT ); Mon, 12 Jul 2021 03:18:58 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 6939A613D2; Mon, 12 Jul 2021 07:16:00 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1626074160; bh=A2AcG5QgopCrnCJ5POhV9x2cLeJLvUhxn+VFrTO8cJ0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gZk6wnUDTzFxd1bDX87PeewAf0oxGsfP18avvNCG+aUoau/hxFUHGiSSmt+X9rM0h xfm0TlaEj0ePlqL7f7b03tHT4YX/sKLzn/q9GaIZP9ulNB1mQKo1dXwD5vot0uerKY JjspJGy+VyHJ9OnB+jpezcIA4DehDK1dcM5rBUOc= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Sukadev Bhattiprolu , "David S. Miller" , Sasha Levin Subject: [PATCH 5.12 483/700] ibmvnic: clean pending indirect buffs during reset Date: Mon, 12 Jul 2021 08:09:26 +0200 Message-Id: <20210712061027.975706353@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210712060924.797321836@linuxfoundation.org> References: <20210712060924.797321836@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sukadev Bhattiprolu [ Upstream commit 65d6470d139a6c1655fccb5cbacbeaba8e8ad2f8 ] 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- 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 b2f5250f77a9..e8f4bdb1079c 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]; @@ -668,6 +670,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; @@ -1592,7 +1595,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); @@ -1685,7 +1689,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; } @@ -3123,6 +3126,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.30.2