From patchwork Tue Mar 16 18:34:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaskar Upadhaya X-Patchwork-Id: 12143475 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C988C43381 for ; Tue, 16 Mar 2021 18:35:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E95C465139 for ; Tue, 16 Mar 2021 18:35:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240061AbhCPSfR (ORCPT ); Tue, 16 Mar 2021 14:35:17 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:63118 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240033AbhCPSee (ORCPT ); Tue, 16 Mar 2021 14:34:34 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12GIGx6B026702; Tue, 16 Mar 2021 11:34:30 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=yn4iPzpg32Epu/i/mGquC1QeI3MjfjIlAknIinXpfqo=; b=TpxlQeGckggFgfWhp0xTZEsjyEzMrhvMAaXRhZaLHquzjV1g0WS+hSBxG/t6ukEWHHaB Z41EqouDC8uiICGRyJ/dBcPnqjLdEMNAW9fq5Nmp4EPmYTnAD7aDewTKV9R8o0amYEyS lo2byINpKL6VMc6hFoy+dzXgeWTvIfIv4Ns7Fs5+Mwge5RUiRocsO0wvjeknWg1Deg8G FZa5M3q4gkonnYFxczsqHVhbJgytlRBvk65fVEmQEsYlwqAwvCXUoPvs/wXj0lDYreCa 1c8jEMH+j0DdgVCnZlb7lORmbKLEWngNdDB0nMCW94v1wOLmlZeuNgu9JF/B68QJO9UC BA== Received: from dc6wp-exch01.marvell.com ([4.21.29.232]) by mx0b-0016f401.pphosted.com with ESMTP id 378wsqsg81-2 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 16 Mar 2021 11:34:30 -0700 Received: from DC6WP-EXCH01.marvell.com (10.76.176.21) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Mar 2021 14:34:28 -0400 Received: from maili.marvell.com (10.76.176.51) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 16 Mar 2021 14:34:28 -0400 Received: from dc5-eodlnx05.marvell.com (dc5-eodlnx05.marvell.com [10.69.113.147]) by maili.marvell.com (Postfix) with ESMTP id 0B22C3F7040; Tue, 16 Mar 2021 11:34:28 -0700 (PDT) From: Bhaskar Upadhaya To: , , , CC: , Subject: [PATCH net 1/2] qede: fix to disable start_xmit functionality during self adapter test Date: Tue, 16 Mar 2021 11:34:09 -0700 Message-ID: <1615919650-4262-2-git-send-email-bupadhaya@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615919650-4262-1-git-send-email-bupadhaya@marvell.com> References: <1615919650-4262-1-git-send-email-bupadhaya@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-16_06:2021-03-16,2021-03-16 signatures=0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org start_xmit function should not be called during the execution of self adapter test, netif_tx_disable() gives this guarantee, since it takes the transmit queue lock while marking the queue stopped. This will wait for the transmit function to complete before returning. Fixes: 16f46bf054f8 ("qede: add implementation for internal loopback test.") Signed-off-by: Bhaskar Upadhaya Signed-off-by: Igor Russkikh Signed-off-by: Ariel Elior --- drivers/net/ethernet/qlogic/qede/qede_ethtool.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c index 1560ad3d9290..f9702cc7bc55 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_ethtool.c +++ b/drivers/net/ethernet/qlogic/qede/qede_ethtool.c @@ -1611,7 +1611,7 @@ static int qede_selftest_run_loopback(struct qede_dev *edev, u32 loopback_mode) return -EINVAL; } - qede_netif_stop(edev); + netif_tx_disable(edev->ndev); /* Bring up the link in Loopback mode */ memset(&link_params, 0, sizeof(link_params)); @@ -1623,6 +1623,8 @@ static int qede_selftest_run_loopback(struct qede_dev *edev, u32 loopback_mode) /* Wait for loopback configuration to apply */ msleep_interruptible(500); + qede_netif_stop(edev); + /* Setting max packet size to 1.5K to avoid data being split over * multiple BDs in cases where MTU > PAGE_SIZE. */ From patchwork Tue Mar 16 18:34:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bhaskar Upadhaya X-Patchwork-Id: 12143471 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3EB52C433DB for ; Tue, 16 Mar 2021 18:35:35 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EEFD065127 for ; Tue, 16 Mar 2021 18:35:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240043AbhCPSfE (ORCPT ); Tue, 16 Mar 2021 14:35:04 -0400 Received: from mx0b-0016f401.pphosted.com ([67.231.156.173]:1044 "EHLO mx0b-0016f401.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240035AbhCPSee (ORCPT ); Tue, 16 Mar 2021 14:34:34 -0400 Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 12GIGx6A026702; Tue, 16 Mar 2021 11:34:29 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-type; s=pfpt0220; bh=e+zbY4od732AXWTaXqK6NEy9ir/8elZEaKsBmrscTik=; b=VoLhQ1cLMzh2na53Ewdk9yaT21wlFi4sv9yfS6godamLzornNn44Vn0q1yP14ufeqo+K /+0I/P7Js5t3pGVoW22iX12FBQokuv1HGbDpCMpSN//IoA5n1J0X5BqFAKZp0IwlPTEH Ryf6WOW7s+p7Ej1gzaIUkrK/Cif7TybrSBU48JDtQzSA/sjnSdr5/TsW21rpwjGXhm0O hnJrxgnO8zNnG+UZ+2llCK04Utpd8q1COawS7nlhAg427VRgGfsv0b3LKhX95dbWN43j wZK/1MdsK0q8sKQhfeY0fXRRNBbIOsEx6HGMZAuxfuxGFJKzaVyoXzwQ8an+bgFvloOn 4g== Received: from dc6wp-exch01.marvell.com ([4.21.29.232]) by mx0b-0016f401.pphosted.com with ESMTP id 378wsqsg81-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 16 Mar 2021 11:34:29 -0700 Received: from DC6WP-EXCH01.marvell.com (10.76.176.21) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 16 Mar 2021 14:34:28 -0400 Received: from maili.marvell.com (10.76.176.51) by DC6WP-EXCH01.marvell.com (10.76.176.21) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 16 Mar 2021 14:34:28 -0400 Received: from dc5-eodlnx05.marvell.com (dc5-eodlnx05.marvell.com [10.69.113.147]) by maili.marvell.com (Postfix) with ESMTP id 0D8DD3F7041; Tue, 16 Mar 2021 11:34:28 -0700 (PDT) From: Bhaskar Upadhaya To: , , , CC: , Subject: [PATCH net 2/2] qede: fix memory allocation failures under heavy load Date: Tue, 16 Mar 2021 11:34:10 -0700 Message-ID: <1615919650-4262-3-git-send-email-bupadhaya@marvell.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1615919650-4262-1-git-send-email-bupadhaya@marvell.com> References: <1615919650-4262-1-git-send-email-bupadhaya@marvell.com> MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.369,18.0.761 definitions=2021-03-16_06:2021-03-16,2021-03-16 signatures=0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org when the system is heavily stressed, kernel get lots of memory allocation failures which causes kernel panic, so enable proper error handling during skb allocation Fixes: 8a8633978b84 ("qede: Add build_skb() support.") Signed-off-by: Bhaskar Upadhaya Signed-off-by: Igor Russkikh Signed-off-by: Ariel Elior --- drivers/net/ethernet/qlogic/qede/qede_fp.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/drivers/net/ethernet/qlogic/qede/qede_fp.c b/drivers/net/ethernet/qlogic/qede/qede_fp.c index 8c47a9d2a965..f2d74b53e421 100644 --- a/drivers/net/ethernet/qlogic/qede/qede_fp.c +++ b/drivers/net/ethernet/qlogic/qede/qede_fp.c @@ -751,6 +751,8 @@ qede_build_skb(struct qede_rx_queue *rxq, buf = page_address(bd->data) + bd->page_offset; skb = build_skb(buf, rxq->rx_buf_seg_size); + if (unlikely(!skb)) + return NULL; skb_reserve(skb, pad); skb_put(skb, len); @@ -767,6 +769,9 @@ qede_tpa_rx_build_skb(struct qede_dev *edev, struct sk_buff *skb; skb = qede_build_skb(rxq, bd, len, pad); + if (unlikely(!skb)) + return NULL; + bd->page_offset += rxq->rx_buf_seg_size; if (bd->page_offset == PAGE_SIZE) { @@ -814,6 +819,8 @@ qede_rx_build_skb(struct qede_dev *edev, } skb = qede_build_skb(rxq, bd, len, pad); + if (unlikely(!skb)) + return NULL; if (unlikely(qede_realloc_rx_buffer(rxq, bd))) { /* Incr page ref count to reuse on allocation failure so @@ -851,11 +858,16 @@ static void qede_tpa_start(struct qede_dev *edev, if (unlikely(!tpa_info->skb)) { DP_NOTICE(edev, "Failed to allocate SKB for gro\n"); + /* Re-use the buffer instantly instead doing it at tpa_end + * as we are already going to throw away this aggregated packet + * (i.e CQEs till tpa_end) and then going to update the + * producer, so it's safe to pin the buffer here only. + */ + qede_reuse_page(rxq, sw_rx_data_cons); /* Consume from ring but do not produce since * this might be used by FW still, it will be re-used * at TPA end. */ - tpa_info->tpa_start_fail = true; qede_rx_bd_ring_consume(rxq); tpa_info->state = QEDE_AGG_STATE_ERROR; goto cons_buf; @@ -1025,11 +1037,6 @@ static int qede_tpa_end(struct qede_dev *edev, err: tpa_info->state = QEDE_AGG_STATE_NONE; - if (tpa_info->tpa_start_fail) { - qede_reuse_page(rxq, &tpa_info->buffer); - tpa_info->tpa_start_fail = false; - } - dev_kfree_skb_any(tpa_info->skb); tpa_info->skb = NULL; return 0;