From patchwork Wed Apr 26 07:43:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Krishna Gajula X-Patchwork-Id: 87698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp73751vqo; Wed, 26 Apr 2023 00:57:58 -0700 (PDT) X-Google-Smtp-Source: AKy350a4AuKyfyQBL2XJzImXOc1pmqjHLo0tJp/DQwYGSIGmRp4D/n8tPjq1hvAk7O7l8jyhaLS9 X-Received: by 2002:a05:6a21:3981:b0:ef:4c65:a58f with SMTP id ad1-20020a056a21398100b000ef4c65a58fmr21143308pzc.47.1682495878537; Wed, 26 Apr 2023 00:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682495878; cv=none; d=google.com; s=arc-20160816; b=u2C/zgggmRJsPjf94r8eYijn6hrnDbj4KMnMlxljgDgWiU5K2jpKf591JsumyvULzX GRbjGWqV2BfneIihTWp0ZjMGPM+0aAZnNMwtIZKhSL4AiddsY24PP7vrfLhaCWFMwXly kz8W4gKWSGSG+uo5sazx7ZM0dtxHjhaZy/NAx/la4bfmlDIDw6TfhjYypqg+6eSo4QXg 6T6qwvFI6KKFDVmu0daivvv3//uhvyuE0o8RCa0QcYUSyh17hQ+oHpU9ZHszQPEh8/SH L8UX2VMJunh3cXzdytDJWhge5/n5nIa/prTjhRo2g2uRfdIV0cBhq6wPmEW86xvMR8/h bDDw== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/OSKb3SKDtB9cUTdDUWXgHxcUbuNAUOnTVSGX+DHPvY=; b=ucbX+Qx/weAd9WaPg+S8+CJrNQ2E7wVpfBCYVLICM2aige6BqWWY2fjGo1cZr5/dUx Pq0xINLSWZx+oGE/laBEO5oCLlFYZ0Lk4PQRnx4jtpNZin4qczb+Zjtt40RSXrbmLUkJ VLc4SMOjxif92B0vwOgOOle22xBZZx4gzgPjjM5mL4ubzzP3MX1w6rkPCHTPNg8xnFq1 ZBIZ5n/XcuLI2ZQPnpqFthXW9FCN0aR8Uxw+XZiSQnla1280GK9xlBDqaDCKe6HCe4a2 rL5/BYSNKyajnzFj7gEPP7CcbRFLCIIjWPqcIlaiq4F712BPvrIvEEDkmwJBzA9n8b2V zgvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UrYfGMNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g29-20020a63565d000000b0051b36b15cbesi15177926pgm.214.2023.04.26.00.57.43; Wed, 26 Apr 2023 00:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UrYfGMNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240095AbjDZHqF (ORCPT + 99 others); Wed, 26 Apr 2023 03:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240113AbjDZHpQ (ORCPT ); Wed, 26 Apr 2023 03:45:16 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 037DB4209; Wed, 26 Apr 2023 00:44:48 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33Q6wV47013403; Wed, 26 Apr 2023 00:44:42 -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-transfer-encoding : content-type; s=pfpt0220; bh=/OSKb3SKDtB9cUTdDUWXgHxcUbuNAUOnTVSGX+DHPvY=; b=UrYfGMNInbeN6u/460CTsEEmm7irlg9N/4rRbD+61kauIkiRxslz+xoFx6kazehlsmRh xqjz8wE0CrPRzgyiMD6wF6GwpJBRV47JchNyGxxzIIrdlOdWcUduCTlBxI7b5XUbsKvf wf5ka6ytUlG7UaD8ytNlpTrkeBRhO3hP1l4QJARMtkwRRE7+ZAOpP7pncRSGLi7cS1u2 n7nXqnXAOJPQaQgKb55k/dV8xxkeGLpLa2sAKfaUbRL1iNDb8EBP2k7Z+vaBD7Xm+EgY PInYp6WEtCtMCeYP5EXiMxvaDV7PVOm9xUctfcVxohQhtpE9elIBIecTN0puAShaUHwm Bw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:42 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 26 Apr 2023 00:44:40 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:44:40 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id ADBBE3F7069; Wed, 26 Apr 2023 00:44:36 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v4 10/10] octeontx2-pf: Disable packet I/O for graceful exit Date: Wed, 26 Apr 2023 13:13:45 +0530 Message-ID: <20230426074345.750135-11-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: GvYrQf01OeKtEyhVDRk2FHAL1h1G8aol X-Proofpoint-ORIG-GUID: GvYrQf01OeKtEyhVDRk2FHAL1h1G8aol X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224798267285956?= X-GMAIL-MSGID: =?utf-8?q?1764224798267285956?= From: Subbaraya Sundeep At the stage of enabling packet I/O in otx2_open, If mailbox timeout occurs then interface ends up in down state where as hardware packet I/O is enabled. Hence disable packet I/O also before bailing out. As per earlier implementation, when the VF device probe fails due to error in MSIX vector allocation, the LF resources, NIX and NPA LF were not detached. This patch fixes in releasing these resources, when ever this MSIX vector allocation/VF probe fails. Fixes: 1ea0166da050 ("octeontx2-pf: Fix the device state on error") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++- drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index 179433d0a54a..52a57d2493dc 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1835,13 +1835,22 @@ int otx2_open(struct net_device *netdev) otx2_dmacflt_reinstall_flows(pf); err = otx2_rxtx_enable(pf, true); - if (err) + /* If a mbox communication error happens at this point then interface + * will end up in a state such that it is in down state but hardware + * mcam entries are enabled to receive the packets. Hence disable the + * packet I/O. + */ + if (err == EIO) + goto err_disable_rxtx; + else if (err) goto err_tx_stop_queues; otx2_do_set_rx_mode(pf); return 0; +err_disable_rxtx: + otx2_rxtx_enable(pf, false); err_tx_stop_queues: netif_tx_stop_all_queues(netdev); netif_carrier_off(netdev); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index ab126f8706c7..53366dbfbf27 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -621,7 +621,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) err = otx2vf_realloc_msix_vectors(vf); if (err) - goto err_mbox_destroy; + goto err_detach_rsrc; err = otx2_set_real_num_queues(netdev, qcount, qcount); if (err)