Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp437963rwr; Wed, 3 May 2023 00:25:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5PAJHUD2pIwB5cNMwVY/OqmPQlKebWMy5uvG3Vx5YcPgYdnWdDOqtU5GACI/r+u1aQISTE X-Received: by 2002:a17:90b:384f:b0:247:2437:d5c4 with SMTP id nl15-20020a17090b384f00b002472437d5c4mr20891193pjb.13.1683098729024; Wed, 03 May 2023 00:25:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1683098729; cv=none; d=google.com; s=arc-20160816; b=et+pL9v1L4RQZroSAhyp+5QiFXcMVcH3M88zaoeFpbZTIlYSf4JfYCkXTLT54GfKB3 OwMPV3v6b+qXrSSKh7j3iIPGGhwnJPNd2wR2dCaPjHK2TudUFJ7ExKjJwgAaaGkBolf3 we2cbuoBaJ/TxWOBCGN462XKLqM4bh8S1zYB+f9KpPWss2bJP2Oxskz0l8BJLfogmY8F 0if1c4R28E+1qXOfBbWgjSLvHSb+blyV+X41x4lugtkQb9AQ1PGG7oTCp4r6ZZZVbuyf donLGAk/149VmutOO8hqKimikDdvgYZwXN7goaWkUT/BA0HeYgDzOCSeOeqpDy6uh+wQ nk0A== 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=twsPib4scJxgTJGR3BfshOH9AmiqKYWWC6vegve+jxE=; b=NePFLitjYAH8+yP7JOCuhUtD6XenJDpptaPrAf3rJc2F9Kdp8L2sSnoREe2u01l3PN PcU8iTNYMTEnOAEF3v3am0lt0UU6KN1v8y/duwB1+BiLDk1NUOd6H2E0u3l4yos94OUI hrhjYlvYUM32AI3DUCcqcGJUWdhi51mx+fi2aRafDVGub/EClmTPYB6XYqDu99NRcM9y 9WHxrW9bRkrAcqKpMq+atk6mt7YhwWA03Iff4qLTSxucNDhZuj1sOyiqBExceVZF1o4g IsBTmT0QkMhfx0AOds5OaenxbKXuv+3EQP0kubRT/qO6ItjqLgAXhE+4SuCwUHo9dpHK Mr/Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=PCv1IGAP; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id b3-20020a17090a990300b00246799bf0c2si12800083pjp.187.2023.05.03.00.25.15; Wed, 03 May 2023 00:25:29 -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=PCv1IGAP; 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 S229741AbjECHMB (ORCPT + 99 others); Wed, 3 May 2023 03:12:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55476 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229573AbjECHL7 (ORCPT ); Wed, 3 May 2023 03:11:59 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 860CA46A8; Wed, 3 May 2023 00:11:27 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 3436ACT0003519; Wed, 3 May 2023 00:10:41 -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=twsPib4scJxgTJGR3BfshOH9AmiqKYWWC6vegve+jxE=; b=PCv1IGAPYRSra/Ya78e2yJTN5rnAyMYT5qPWwAcS+25JFKrNfbPvZWBAvdy9+0js7Fbh jeH9IBmFuB9/s12z5Q0XqAfyf0oPSfJnNB+He34i9ghYdKuwspIizYtzlrVwvErujaTj 7ORqhGc9NDs1zQr0vnq+3qIfOTSrarBWN0iyjShwRuV8WHgoyQGx3ImQVh9wRDKTJavV eqUcPpiDnhga+VcIDTR+ZpCOb0ijdsABNPsj61JBVmsNYdeSUNHGjKmWoW33mPromi87 Zv8BIuOpXtlJbepzROC2ygVjoph1TwZdWSkd7WCKZK0rvVdt3t2Lnq1L7CbP4jzy/rvq eA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q92rp3m9p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 03 May 2023 00:10:41 -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, 3 May 2023 00:10:39 -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, 3 May 2023 00:10:39 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 855583F7075; Wed, 3 May 2023 00:10:35 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v5 10/11] octeontx2-pf: Disable packet I/O for graceful exit Date: Wed, 3 May 2023 12:39:43 +0530 Message-ID: <20230503070944.960190-11-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230503070944.960190-1-saikrishnag@marvell.com> References: <20230503070944.960190-1-saikrishnag@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 3uLSDk6Ny9uxY9ZHzgQWmTRROiJZ0rpz X-Proofpoint-GUID: 3uLSDk6Ny9uxY9ZHzgQWmTRROiJZ0rpz 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-05-03_04,2023-04-27_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 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. 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 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index a75c944cc739..18284ad75157 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); -- 2.25.1