From patchwork Wed Apr 19 06:20:09 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: 85204 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp148265vqo; Tue, 18 Apr 2023 23:25:24 -0700 (PDT) X-Google-Smtp-Source: AKy350Y3VEAgVQKeq6RoSfs71nrdLgAFDWhZUAThSwRrGWDxAPC9z0GfJzop3yklPd+Ms9lg8Rmf X-Received: by 2002:a05:6870:1358:b0:187:e6d1:daf with SMTP id 24-20020a056870135800b00187e6d10dafmr692789oac.3.1681885524084; Tue, 18 Apr 2023 23:25:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885524; cv=none; d=google.com; s=arc-20160816; b=lsvkY34o8aRCmpbaODkTE/Ka5gjL/dkvC0HqQM4W99X1FzdmNFg2uGvczDPiMY7atz QztFlk8huVRZM218gzem8PhdatX364gsCoXUIj5UKD7yhxIAh0RrLUomAP5sUE4DKfxS UYJiuqOTWa8aSOB/b7bdHTDVcUmILb6qBL6J2ZffOO3cy6k6tRZMdqzrcMH713hZ3Ygg 4ZIgq7Od5L/b/Kg3W6MwtaKgXRHZmAHuyNSKMH1Q6BN6k75w+/zH61amphwJpl/IStV4 bss9q/00b/zusaec53PtALpdGwrkIid/vvf0MmDw4sv4v0rP5luC9/XhpdMhvCrJpCKX e2nQ== 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=fRAj2n7fpPO4NwJ2yzsB/HPD25KmiFWUyXE50hisb7E=; b=LNLwMYjUtL02wLrczpi7YcqXzwNtJ736tbCFsxCatUwuGV37lvVhwKsJCN4GuyDTXz BRWr87nCboydLJWahphoLBDaT1qz+PqWIa0+fLRZzVdvR9a/yJx1SH8DqtnoCgm1yWLz FkiX4IdB2DXMhyUp/M41PJotSwJ5DjZ+Whi6B1qA4mYc3h7Yb5qM5A2zbAQHdVvptjgb nP/ioQyrRwkM+5FPCt9wvqZXp5hRbEAlufddvhhQT8qx8pqsRHpzfZO701migTJFO9sD INoanPwSUQ6Wmvxgb+0DxtYxDyvfgqBwZAfxSGItfbxq/eNPC/l+0oDnYXzKZUKbYM9A 6aag== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=HaSDLcwV; 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 w10-20020a056870430a00b00176a15dd28esi14128531oah.158.2023.04.18.23.25.10; Tue, 18 Apr 2023 23:25:24 -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=HaSDLcwV; 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 S231779AbjDSGUn (ORCPT + 99 others); Wed, 19 Apr 2023 02:20:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35064 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231600AbjDSGUl (ORCPT ); Wed, 19 Apr 2023 02:20:41 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 85D2B26A9; Tue, 18 Apr 2023 23:20:40 -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 33J4BvKs030775; Tue, 18 Apr 2023 23:20:33 -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=fRAj2n7fpPO4NwJ2yzsB/HPD25KmiFWUyXE50hisb7E=; b=HaSDLcwVCOxJ6UHAokW42EURCUeErCwQ+ZinNjg/n9V9+s8Bhj2QwtosfSwNpbd9ZZ8n Y2dqzyVXnb0HOvanSdjkU3Yazryhb4KNW/rrnb3Y2rIjfhSaWcSGyKN1AAw6AtIUu5gL mWvUNyqntxHdA3b1V9MA6OgDQqQ0ahXbG2rZtLYy5Ld1gLBfGQjzj7P1qmluoDavSdwj HMoWPtN+hJwEGpkYuNr5quhKkPJU2CacGXSSXLyCQSNydEBcWmWu5/NwcEKRdbNSz9h4 Nzmwbn33GcSSMk/9g67QKnAr9MJGJtXNsX7NWnpnC05b36e0hXge5s1JNwhw3uRFCGLV Fg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmf9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:20:33 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:20:31 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 18 Apr 2023 23:20:31 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id B9CA93F7058; Tue, 18 Apr 2023 23:20:26 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v3 01/10] octeontx2-af: Secure APR table update with the lock Date: Wed, 19 Apr 2023 11:50:09 +0530 Message-ID: <20230419062018.286136-2-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Oju6Zmi6bl8nexobfQH3Q7PY4905u3vJ X-Proofpoint-ORIG-GUID: Oju6Zmi6bl8nexobfQH3Q7PY4905u3vJ 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-19_02,2023-04-18_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?1763584795555544342?= X-GMAIL-MSGID: =?utf-8?q?1763584795555544342?= From: Geetha sowjanya APR table contains the lmtst base address of PF/VFs. These entries are updated by the PF/VF during the device probe. The lmtst address is fetched from HW using "TXN_REQ" and "ADDR_RSP_STS" registers. The lock tries to protect these registers from getting overwritten when multiple PFs invokes rvu_get_lmtaddr() simultaneously. For example, if PF1 submit the request and got permitted before it reads the response and PF2 got scheduled submit the request then the response of PF1 is overwritten by the PF2 response. Fixes: 893ae97214c3 ("octeontx2-af: cn10k: Support configurable LMTST regions") Signed-off-by: Geetha sowjanya Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna --- .../net/ethernet/marvell/octeontx2/af/rvu_cn10k.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c index 4ad9ff025c96..0e74c5a2231e 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_cn10k.c @@ -60,13 +60,14 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, u64 iova, u64 *lmt_addr) { u64 pa, val, pf; - int err; + int err = 0; if (!iova) { dev_err(rvu->dev, "%s Requested Null address for transulation\n", __func__); return -EINVAL; } + mutex_lock(&rvu->rsrc_lock); rvu_write64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_REQ, iova); pf = rvu_get_pf(pcifunc) & 0x1F; val = BIT_ULL(63) | BIT_ULL(14) | BIT_ULL(13) | pf << 8 | @@ -76,12 +77,13 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, err = rvu_poll_reg(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS, BIT_ULL(0), false); if (err) { dev_err(rvu->dev, "%s LMTLINE iova transulation failed\n", __func__); - return err; + goto exit; } val = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_ADDR_RSP_STS); if (val & ~0x1ULL) { dev_err(rvu->dev, "%s LMTLINE iova transulation failed err:%llx\n", __func__, val); - return -EIO; + err = -EIO; + goto exit; } /* PA[51:12] = RVU_AF_SMMU_TLN_FLIT0[57:18] * PA[11:0] = IOVA[11:0] @@ -89,8 +91,9 @@ static int rvu_get_lmtaddr(struct rvu *rvu, u16 pcifunc, pa = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_SMMU_TLN_FLIT0) >> 18; pa &= GENMASK_ULL(39, 0); *lmt_addr = (pa << 12) | (iova & 0xFFF); - - return 0; +exit: + mutex_unlock(&rvu->rsrc_lock); + return err; } static int rvu_update_lmtaddr(struct rvu *rvu, u16 pcifunc, u64 lmt_addr) From patchwork Wed Apr 19 06:20:10 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: 85200 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp146940vqo; Tue, 18 Apr 2023 23:22:19 -0700 (PDT) X-Google-Smtp-Source: AKy350ZJq83ViSkPd86mCvpH7wyar/mv55i7Fim34X53mbYEAkB69cscPRhqsJW0KGJi9it8/0rC X-Received: by 2002:a05:6808:189b:b0:387:2f12:e71a with SMTP id bi27-20020a056808189b00b003872f12e71amr2665930oib.34.1681885339521; Tue, 18 Apr 2023 23:22:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885339; cv=none; d=google.com; s=arc-20160816; b=czgKa5++2nrxMtVCxTdbca6/muYFwKivoPLAKjq6G6V1zTsmcxGjR47nr1Tw+4lnHg 5lCY83YgauVPfjQ6qxwqiElG+vcf6kEiyPVhDhI+dfxFWeVMoJSVu/EduZBKHWW76Jer y5DW3Di4xqUbSAFGeyqhnwAFmbL84SxHSS2SxOEkGT0imdnGGUiTxrGrfcAf251pzHLo O0J+Bq08+V0YwG2eyOSec9W63gjeAhPQJfSAs+0+ddqqa/gnK4/xos/t2NnywSfd6fwk cuhcHOfe4Nzg03Y3ZgX8/b6bB+vrbVwDFEYGh7Q6SpbGe44iL4N3yutuval/Ofc6uk6M 8u6w== 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=vZF+Ckk1yF654X/TsDitzXVCnh6PRkqBrDRqJewGbr4=; b=KKNEiPXhIS69cjKghRacckADMvGDSUMRauR/GRFwWIqwWEajoPX9hBx9abPtqugIOS oNr4Kodk8qt/R3/DSZntiZGGYdNWRkgLxCkzSEaZJK1l+Lig6qalEfEiPy5lO4qGIOAa 17NyORspmvzoXwRXqP72jalRPINMvfxjQw+aIxgvKoYwhBQ/V9hvMfmPkTm06YGbptwn nlEB7Kt2uNQnkJvJduQJ/vheuZqt6sQhUh8v9TW5F7Ao9zT9QWja03lngnKUo+0zBxCb aGfgZZlX80YyPKqzGO4iKCY2FPQv75uRTK+VwcWiphM5QNYX2aXQ8h8DBLbnmTryUMzH Faow== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=dat2cIIV; 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 q4-20020acaf204000000b0038e1f0375e5si4658826oih.139.2023.04.18.23.22.06; Tue, 18 Apr 2023 23:22:19 -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=dat2cIIV; 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 S231963AbjDSGUv (ORCPT + 99 others); Wed, 19 Apr 2023 02:20:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231844AbjDSGUp (ORCPT ); Wed, 19 Apr 2023 02:20:45 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id CF147619B; Tue, 18 Apr 2023 23:20:44 -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 33J3qnRH021480; Tue, 18 Apr 2023 23:20:38 -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=vZF+Ckk1yF654X/TsDitzXVCnh6PRkqBrDRqJewGbr4=; b=dat2cIIViHfDNg1QtbPjp3EPaEfu2pd09CWgPk0ORWxctmb6ceC9XXEOPZ9girDBqJnk dWeaTpNTaGNopld/spp+Z9uM2fxal9U8zFKh7ow7LjZQ6xfdM+/I/eTdM1PCzH4Cn967 UTcoK5xSlYgTkGCGaPXW3nGFUfEk3fbv9WypS5zS5TS/YKn9uL7z9W35q+BOH3i4wi8e OOd/LUQFVdYh5AGvmmzG+/R3RgsjSw4DSgYL05JPrmVvRCg3p6azvrzoLohjwU+VSQne IXLHcrLVHXEOcoW94hcMwTEFOSz8X3SXEE1sg9qeB4YJDDaD3FkCpT+i/AbuSnSSQ4uD 7g== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmfs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:20:38 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:20:36 -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; Tue, 18 Apr 2023 23:20:36 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 93F3C3F7055; Tue, 18 Apr 2023 23:20:31 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v3 02/10] octeontx2-af: Fix start and end bit for scan config Date: Wed, 19 Apr 2023 11:50:10 +0530 Message-ID: <20230419062018.286136-3-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: dQbLKw41CkNeyYa0-SGDfrW5fXEbAa-4 X-Proofpoint-ORIG-GUID: dQbLKw41CkNeyYa0-SGDfrW5fXEbAa-4 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-19_02,2023-04-18_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?1763584601505421997?= X-GMAIL-MSGID: =?utf-8?q?1763584601505421997?= From: Ratheesh Kannoth Fix the NPC nibble start and end positions in the bit map. for_each_set_bit_from() needs start bit as one bit prior and end bit as one bit post position in the bit map Fixes: b747923afff8 ("octeontx2-af: Exact match support") Signed-off-by: Ratheesh Kannoth Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c index 006beb5cf98d..27603078689a 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c @@ -593,9 +593,8 @@ static int npc_scan_kex(struct rvu *rvu, int blkaddr, u8 intf) * exact match code. */ masked_cfg = cfg & NPC_EXACT_NIBBLE; - bitnr = NPC_EXACT_NIBBLE_START; - for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg, - NPC_EXACT_NIBBLE_START) { + bitnr = NPC_EXACT_NIBBLE_START - 1; + for_each_set_bit_from(bitnr, (unsigned long *)&masked_cfg, NPC_EXACT_NIBBLE_END + 1) { npc_scan_exact_result(mcam, bitnr, key_nibble, intf); key_nibble++; } From patchwork Wed Apr 19 06:20:11 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: 85201 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp147064vqo; Tue, 18 Apr 2023 23:22:40 -0700 (PDT) X-Google-Smtp-Source: AKy350YG7vq2B3Vu66Cs4uWscPLMbvT5M7INK3m1oLHg0DBzSvJAi2oHc6SXe/L3YFmSWWZS3rHD X-Received: by 2002:a05:6871:729:b0:187:a6fd:f1c7 with SMTP id f41-20020a056871072900b00187a6fdf1c7mr2825854oap.5.1681885360540; Tue, 18 Apr 2023 23:22:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885360; cv=none; d=google.com; s=arc-20160816; b=TqvuavObxH7FqucwjEBPL8YW/AW1+a4PN36dHxYdiopBQhroObFy64pd8ZBD3ewAK7 gbLuI05F5gTLqush0zMuAP2klYnRiurFX6bmR8/GQkfybXXMfHe5GKiD+XV+oTc6y7Sq oLakoGSBGy+hlmQoI6Po3QUuUjNvtQbsX3uAvn8mKvUFe+a8hcW6uX/KhPWo/xy4d3jz zDjar+LkuvF4Q7KCv5EW6Agy6ZM84o+G+BAZkfw0FIkrdoc5oYEg+KEVAOnqvIT9n8R5 ASe1TYZG/kgqlg2JWJHWgZ9qYc53Ruk/2i4K5sEHPgHqAab9MZvsjdbzwcWHfcuAcEUf ZqKg== 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=rtczSxMem+OTMnZlDvgprdqaO1kDDqvW5wHAoU0pV9k=; b=BlYloVsgEImo9gPLLWuxjd0EziaITlGiPo3jCsxfIdgvfJY2vJSSSIStSqPNMX7k9M 04YypdfpIixKz8vip8adwkGIeSqDTZ/TT76WnNOjC58wr0dDzyAbHMTEuFV4Dcm6OFws N6JNNcCZSp6sfYEr+HipNsAeNejLun0+2MW/OmtIxBircH/umS6gQd/tkRNNG2j+cP4I y18/LWCCcDdH2Onxb+h568S/KROf33uWaVddu9MHgVxVXjCZUfWm6ztFik2cf1Jt4tZu 5LBBn7S6P2O5f5clvdjue0VXek7p4XYwUrG3YBi8BdviEt0V3JSlZoRRlNZdzx826mSa bDcw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=XBlQWmnL; 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 n40-20020a056870972800b001878c0c038esi14176055oaq.66.2023.04.18.23.22.27; Tue, 18 Apr 2023 23:22:40 -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=XBlQWmnL; 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 S230377AbjDSGVL (ORCPT + 99 others); Wed, 19 Apr 2023 02:21:11 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231975AbjDSGVF (ORCPT ); Wed, 19 Apr 2023 02:21:05 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6296F6592; Tue, 18 Apr 2023 23:20:51 -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 33J49Y5f013328; Tue, 18 Apr 2023 23:20:43 -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=rtczSxMem+OTMnZlDvgprdqaO1kDDqvW5wHAoU0pV9k=; b=XBlQWmnL1uBBg2tZV3JiCqdO84JyPwmWoTvCzxwFUkpzNgccZY6m30jx4N5mCN7NG/Bx Fbv74Hmkjaup+47Ey3sKxheddJUU9qH1QaSOJphjkamFs+POCdICWwAgj8g7pHhYH0fV oWKsdZRbms1Clm7XjvEwsWhOfVlZhumfKzPlfwm+7KvIgLr+zegFFTuLyKpmKcQy5Emd 3oabhHpyx6ZcLtfHDRFtrN+auiDx8WbHt3ACRiajXdh9G5AlFge0WMyDGVVwvcbGl+1Z cFfIT1SWwj157ePaOKh4O8IlOBJkrmD3X9zD5UEh5yg9H6cp2vSMm3El9KcT+HotvYi6 Vg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q2917rjrr-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:20:43 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:20:41 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 18 Apr 2023 23:20:41 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 9EDC03F7058; Tue, 18 Apr 2023 23:20:36 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v3 03/10] octeontx2-af: Fix depth of cam and mem table. Date: Wed, 19 Apr 2023 11:50:11 +0530 Message-ID: <20230419062018.286136-4-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: ZipDD7W97N3RjrMW38FhoeZ-gEoXXrmK X-Proofpoint-ORIG-GUID: ZipDD7W97N3RjrMW38FhoeZ-gEoXXrmK 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-19_02,2023-04-18_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?1763584623701575027?= X-GMAIL-MSGID: =?utf-8?q?1763584623701575027?= From: Ratheesh Kannoth Depth of CAM and MEM tables were wrongly configured. Fixed the same in NPC module. Fixes: b747923afff8 ("octeontx2-af: Exact match support") Signed-off-by: Ratheesh Kannoth Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna Reviewed-by: Simon Horman --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c index 20ebb9c95c73..6597af84aa36 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c @@ -1868,9 +1868,9 @@ int rvu_npc_exact_init(struct rvu *rvu) rvu->hw->table = table; /* Read table size, ways and depth */ - table->mem_table.depth = FIELD_GET(GENMASK_ULL(31, 24), npc_const3); table->mem_table.ways = FIELD_GET(GENMASK_ULL(19, 16), npc_const3); - table->cam_table.depth = FIELD_GET(GENMASK_ULL(15, 0), npc_const3); + table->mem_table.depth = FIELD_GET(GENMASK_ULL(15, 0), npc_const3); + table->cam_table.depth = FIELD_GET(GENMASK_ULL(31, 24), npc_const3); dev_dbg(rvu->dev, "%s: NPC exact match 4way_2k table(ways=%d, depth=%d)\n", __func__, table->mem_table.ways, table->cam_table.depth); From patchwork Wed Apr 19 06:20:12 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: 85206 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp149945vqo; Tue, 18 Apr 2023 23:29:27 -0700 (PDT) X-Google-Smtp-Source: AKy350Y10g4ieM8Q7lYdACZo5A5U1cQnVldzkJfnUZ19hHSxcvYtbgbBGBmt7eAKsJpoSzN9xy3M X-Received: by 2002:a17:90a:67c2:b0:247:ad6d:7250 with SMTP id g2-20020a17090a67c200b00247ad6d7250mr2202328pjm.12.1681885767377; Tue, 18 Apr 2023 23:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885767; cv=none; d=google.com; s=arc-20160816; b=Ale8QxZMWiu/0kffa2mZqu3e8ig+MBfo1dR+y0tjwrttneCi8Fq/7P6Ym2s7ZcTd5q WQun1dpltNBsnTNuDjBp4d+LsDsVuZnAPmlD2OYOoOSVvi6nYw8qTJiDYbvahRhK2BFk mtcIQ+w3/+cmb4eDYHIyeozxYkTjPbznfq+D8omp3gxUDNufcpRrGXp62T0f2cCB1U9P aVLH5VZTV3o8WUYpMRf0ecAMPLSE9vzj4xNHYDVtRPHhZU50fMLrx2sDumD3JG17cL1Q EoTTNQyDrz/R2baFnxhEaC8ivSCGzh5ACl9zrTjh/P/t1tNra/pOlz3GTxKCwjQTjgsi CEbA== 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=3fljCswxvEDoqXPnB4LDW6m2wkiXjfZywUkW2INDLqo=; b=NeVOGrmfzFrQrnJ/DCG5Di99FyGlssU+fvENd2ubmxe3gQnOMMe2lR2YR382YuOiHp fu7IT+Ygpt/Dg04FMYiv9dyfM/0cZTWKhuZY0qET/n6zc3gaTyp73jv0Q3deRtJew1oi MNbfVABYU6ozsfE/hrtGUpZPmAuKxsuKhmC2PY1RZ5UCFZHcPeL5ZbP4qOYZJ7FPM2f/ ZoeXiIDNztcemtjIcLPg6dSzCVRi3Z6mDSH42z3Tr/bnrQs40EqR1Vfvm3dxofCO5sbF TWinGg29MqslWb6dUefQYxXt6LdzDZavApOaXhTHGTawOhwXIGl360kOBeCTdf9nqIiu LIug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=OWthkRzb; 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 b7-20020a656687000000b0051b52bacc82si14596826pgw.243.2023.04.18.23.29.15; Tue, 18 Apr 2023 23:29:27 -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=OWthkRzb; 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 S231593AbjDSGVY (ORCPT + 99 others); Wed, 19 Apr 2023 02:21:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35978 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232054AbjDSGVK (ORCPT ); Wed, 19 Apr 2023 02:21:10 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EA02A5CE; Tue, 18 Apr 2023 23:20:57 -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 33J49X64013319; Tue, 18 Apr 2023 23:20:48 -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=3fljCswxvEDoqXPnB4LDW6m2wkiXjfZywUkW2INDLqo=; b=OWthkRzbrmgyFsjlCf3GQQsmX/qflk6EE6OWuxb+Y0IN7D/lYKVXLZEvCooFimrK3ZhS q4zbesmZ4uP3RrFjAZ20GsbpLm2Nnbt3i1n4NRpyE64WV1OdpmpIP6ImWo4N768G2DQz L6xEQINy8iq65RgYCJ0x0IxuoYWw3yWrrK9xi0kyrKNM5F5lbhxMZDJqh9TuyCns5N0f gYrZwHGMu23ctiCfYer1N4C8BWrDmID3DUN3SPWmrIZb/fnmAV7JxQRNYUzOM5vPQhfC +FXDpvxoI+FrLJIm9GF0is4rv6k6Ro6UxpfrgdwyLae70g+qY9PniD2SnnqOcRzRP/NA tg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q2917rjs7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:20:48 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:20:46 -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; Tue, 18 Apr 2023 23:20:46 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id A9E8D3F7055; Tue, 18 Apr 2023 23:20:41 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v3 04/10] octeontx2-pf: Increase the size of dmac filter flows Date: Wed, 19 Apr 2023 11:50:12 +0530 Message-ID: <20230419062018.286136-5-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: vdi8zDeMUeG8mT1OVpUxkWoi7cD3xXW0 X-Proofpoint-ORIG-GUID: vdi8zDeMUeG8mT1OVpUxkWoi7cD3xXW0 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-19_02,2023-04-18_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?1763585050599815340?= X-GMAIL-MSGID: =?utf-8?q?1763585050599815340?= From: Ratheesh Kannoth CN10kb supports large number of dmac filter flows to be inserted. Increase the field size to accommodate the same Fixes: b747923afff8 ("octeontx2-af: Exact match support") Signed-off-by: Ratheesh Kannoth Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna Reviewed-by: Simon Horman --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h index 3d22cc6a2804..99cdc871b59c 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_common.h @@ -335,11 +335,11 @@ struct otx2_flow_config { #define OTX2_PER_VF_VLAN_FLOWS 2 /* Rx + Tx per VF */ #define OTX2_VF_VLAN_RX_INDEX 0 #define OTX2_VF_VLAN_TX_INDEX 1 - u16 max_flows; - u8 dmacflt_max_flows; u32 *bmap_to_dmacindex; unsigned long *dmacflt_bmap; struct list_head flow_list; + u32 dmacflt_max_flows; + u16 max_flows; }; struct otx2_tc_info { From patchwork Wed Apr 19 06:20:13 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: 85208 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp150114vqo; Tue, 18 Apr 2023 23:29:50 -0700 (PDT) X-Google-Smtp-Source: AKy350ZJfSM2iz7oKsvKYBA4tk6wcC3mQiLA1ZwddS+QfWn+sqdc8l1JGJUU++dQqeyH2+QWlOMk X-Received: by 2002:a05:6a20:d398:b0:ee:aa9e:945a with SMTP id iq24-20020a056a20d39800b000eeaa9e945amr2342669pzb.26.1681885790653; Tue, 18 Apr 2023 23:29:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885790; cv=none; d=google.com; s=arc-20160816; b=vO9czTvpXnCAUGvrbOfKyrQQJv4eT+gEE6LGB0rBkfqjpO/zCh4Nrm5fFLB1T86x7x ERTgygvXRPHoOia54C9VsKI4JHBC0zck0EgtksY01DsAnE3nBeyOsFjd4f6m/bBNHPCi nm4lKmPIiVvkt9bn+/VTN6b5VgImUF0aHHXkw16PKFjCIKGzpQPz3W1wgGFvdEJyJPDk H8ULj4AuCLAl4UZVAqlnoH24C12cfnnYKKQlSzuLacNTZj4xdGiOCPrgWD35+GgjvZ51 s6vNlsiyVcVVgP3o9rlezUp/blq7hTSTwF1FSALbTRZr9cb5JXAqlYxytqEu+kCV+5K/ S0+A== 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=ZlSrOLdBRNFKeLr7Ip+8w0eprD3EHpIspAhBFP9tXz8=; b=dl/QrlHBHHSzP0i666x/Otw7887UJ5qVFvTuf7+NFze98hbtpXtGH5M6Hum5dk9FYp EVNU0SB0OjFyxw6NNZxBsQmnPuAsEAiYHQD+AiraYzOz0SH15H24PI1tl+kkb09a9r6a u3Fe4uz/ndzJ7pJg470iZU9HDTbFr7dX2hbqVAG7X+Y4BfvJwe+rw0BmegmkzJD3gG2d 8pNffUk35KUa6pRGlH0pbhlTj7dOQjAeR73xC5/br5E9LKQTqhJAmpyJklaaAhfoZyTl DT84jp81JILoSuABuNLnw/dXihZ39R5Eo6JPTwL7uu05CNZrRisvouLdeXccqibs8Bbl WHlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=Oa2Uuxlg; 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 b7-20020a656687000000b0051b52bacc82si14596826pgw.243.2023.04.18.23.29.38; Tue, 18 Apr 2023 23:29:50 -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=Oa2Uuxlg; 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 S231226AbjDSGV1 (ORCPT + 99 others); Wed, 19 Apr 2023 02:21:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36052 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232007AbjDSGVO (ORCPT ); Wed, 19 Apr 2023 02:21:14 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 077525FEA; Tue, 18 Apr 2023 23:20:59 -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 33J3rEGb023194; Tue, 18 Apr 2023 23:20:53 -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=ZlSrOLdBRNFKeLr7Ip+8w0eprD3EHpIspAhBFP9tXz8=; b=Oa2UuxlgKoKxhUQ+eiV8Oqe0lHGmuxnYfvntgab4w0p/t/9E+rYUefndp+3rWrQYPe7G gYPTmx6TTnOxFgX65xfrhqdTGe+ZYzc15L0cNh5iro2RTkiTB2q6D47N2SJiub0vYFWF VsKXy/ommzINNtdgxB8kMqo52HuhsTW3g60dQ27NVK04m721NcvCDcSGnprs9XtxkjIj sw1rNZGeVrjo52RK8WYL2Poicv7tHNAB84X+U8DHJq2tRSwF2ixRKNWx5AlEhibIG9JW Y2w/l9XbZ6dQiPqtZeb0m9iTh6qSZPsKZxZXfVUznuNVQt3RPTkuDu3Jr4/juJh38vjn gg== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmge-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:20:52 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:20:51 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 18 Apr 2023 23:20:51 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id B43D13F705C; Tue, 18 Apr 2023 23:20:46 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v3 05/10] octeontx2-af: Add validation for lmac type Date: Wed, 19 Apr 2023 11:50:13 +0530 Message-ID: <20230419062018.286136-6-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: qvfGANIWC7PoniY24ls-zSe9l8a4znw1 X-Proofpoint-ORIG-GUID: qvfGANIWC7PoniY24ls-zSe9l8a4znw1 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-19_02,2023-04-18_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?1763585074772344468?= X-GMAIL-MSGID: =?utf-8?q?1763585074772344468?= From: Hariprasad Kelam Upon physical link change, firmware reports to the kernel about the change along with the details like speed, lmac_type_id, etc. Kernel derives lmac_type based on lmac_type_id received from firmware. In a few scenarios, firmware returns an invalid lmac_type_id, which is resulting in below kernel panic. This patch adds the missing validation of the lmac_type_id field. Internal error: Oops: 96000005 [#1] PREEMPT SMP [ 35.321595] Modules linked in: [ 35.328982] CPU: 0 PID: 31 Comm: kworker/0:1 Not tainted 5.4.210-g2e3169d8e1bc-dirty #17 [ 35.337014] Hardware name: Marvell CN103XX board (DT) [ 35.344297] Workqueue: events work_for_cpu_fn [ 35.352730] pstate: 40400089 (nZcv daIf +PAN -UAO) [ 35.360267] pc : strncpy+0x10/0x30 [ 35.366595] lr : cgx_link_change_handler+0x90/0x180 Fixes: 61071a871ea6 ("octeontx2-af: Forward CGX link notifications to PFs") Signed-off-by: Hariprasad Kelam Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna Reviewed-by: Simon Horman --- drivers/net/ethernet/marvell/octeontx2/af/cgx.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c index 724df6398bbe..bd77152bb8d7 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/cgx.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/cgx.c @@ -1231,6 +1231,14 @@ static inline void link_status_user_format(u64 lstat, linfo->an = FIELD_GET(RESP_LINKSTAT_AN, lstat); linfo->fec = FIELD_GET(RESP_LINKSTAT_FEC, lstat); linfo->lmac_type_id = FIELD_GET(RESP_LINKSTAT_LMAC_TYPE, lstat); + + if (linfo->lmac_type_id >= LMAC_MODE_MAX) { + dev_err(&cgx->pdev->dev, "Unknown lmac_type_id %d reported by firmware on cgx port%d:%d", + linfo->lmac_type_id, cgx->cgx_id, lmac_id); + strncpy(linfo->lmac_type, "Unknown", LMACTYPE_STR_LEN - 1); + return; + } + lmac_string = cgx_lmactype_string[linfo->lmac_type_id]; strncpy(linfo->lmac_type, lmac_string, LMACTYPE_STR_LEN - 1); } From patchwork Wed Apr 19 06:20:14 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: 85205 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp149277vqo; Tue, 18 Apr 2023 23:27:54 -0700 (PDT) X-Google-Smtp-Source: AKy350YK5y9l7gkRh0mcLrgilsWH/re+0GSyIwk0P6C+nJjbxZxez85AJykCaQDIreJv7QHU0fjf X-Received: by 2002:a05:6a00:2d14:b0:63d:254a:3909 with SMTP id fa20-20020a056a002d1400b0063d254a3909mr2655014pfb.32.1681885673731; Tue, 18 Apr 2023 23:27:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885673; cv=none; d=google.com; s=arc-20160816; b=pQppFLqKlRmTiMBVBne3M+QkxCwS1jKwsNSRjcJJmMKd8616v9Qij4TarX8q75eue3 zeyQSvZ0Iysi7KJs4E7WJoKUoIkLRdIv0KJ1QCxWzHwlLwR7N4Y5989unB9c9PgXwkyy oGTgX9jIvYHIjfV6A0tdBy83kVP2Vjxrjj+5c57wqtBCSYnah+DPFbWGAPPUcJ4xF4fZ Ue28cO/lQiccUsgJAOtgDAViYTDoCuS8/zwayhpqV5dZgRsw7NoWHG2qGNQ7gR39B/lN m+S0HgcgLvM/+mrrqljWj9c418SpdXDsXinEz+X2IX4xaPGuAawPk3Lpb42xUcLq2Yrt A92g== 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=ULQ0BrR7wzq3hufaukTzQqwThQaxiFl+ufv1LiMejOQ=; b=ZJ7/bD9XDHnFS7PRCrkmAPpYSlT2/SbKtUML+avOqtWIr4SzolFy1I9rcV0lDyCoED rhlqwCAc3bTZjDHbPy9+h1D/azukCTu6UA8Cm+dMtQNMlXidkkHU1LofdLKrUUjUQz6r COAs2hZidrYc/ThnNqbQ8FNvTlHG5bUO6Cn3l55lLsCKmzC56hh26S/kcfmPn3oXCAf5 ZKcRIrB72z9ZJElrbDZWBAdFo3tVySVC9GqXIpkZ+i2Ar1sfpqF7lPUvyAJyPOJd+8uw cDOgy4D4Z/0PBTnGvsAX2P6FCCQTAbo62Ez4WWA6YElJQ1LHI4OASCn+xpds6DthcRuC JQOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=LKmlLBk2; 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 144-20020a621896000000b00633d39d7b09si15189134pfy.390.2023.04.18.23.27.40; Tue, 18 Apr 2023 23:27:53 -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=LKmlLBk2; 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 S232016AbjDSGVq (ORCPT + 99 others); Wed, 19 Apr 2023 02:21:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232163AbjDSGVj (ORCPT ); Wed, 19 Apr 2023 02:21:39 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 003346E8E; Tue, 18 Apr 2023 23:21:06 -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 33J49asc013387; Tue, 18 Apr 2023 23:20:58 -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=ULQ0BrR7wzq3hufaukTzQqwThQaxiFl+ufv1LiMejOQ=; b=LKmlLBk2ohuFAG0EwSC2kKscLz9TXbSVbKQuajD0VevIh55ni7laN/INHgk7AQ0SV8ZJ vvOIw1yNYsdhyHbFY1uc5R0kjG53leE3ouD3mJmWmT+RbAol1EImfeAQcN7f7N7mOica /5EA1fY/Orng6fA1yodgaKqo8o18tc+Ei7Okv178GDviKPn8wKaQkT0QPwlDbol8J3hi SKc9OWKj0fmPrJSHbGcLUlJ5iBm5sqm+G44f7kIRvakFHpb1LNhiqQVCLK8/cng6JCjx jMbgq/IVbocXLwdbnUE7PX1i9C1RYRNd4rZwoyqnlUrkWF/Y6tmsWK8C/Z/mvQH2XF+F 0g== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q2917rjt5-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:20:58 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:20:56 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 18 Apr 2023 23:20:56 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 7731E3F7055; Tue, 18 Apr 2023 23:20:51 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Suman Ghosh , Sai Krishna Subject: [net PATCH v3 06/10] octeontx2-af: Update correct mask to filter IPv4 fragments Date: Wed, 19 Apr 2023 11:50:14 +0530 Message-ID: <20230419062018.286136-7-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: EHK2-thx-_qVw4UfISoBy78ObPzNSIUl X-Proofpoint-ORIG-GUID: EHK2-thx-_qVw4UfISoBy78ObPzNSIUl 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-19_02,2023-04-18_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?1763584952466136017?= X-GMAIL-MSGID: =?utf-8?q?1763584952466136017?= From: Suman Ghosh During the initial design, the IPv4 ip_flag mask was set to 0xff. Which results to filter only fragmets with (fragment_offset == 0). As part of the fix, updated the mask to 0x20 to filter all the fragmented packets irrespective of the fragment_offset value. Fixes: c672e3727989 ("octeontx2-pf: Add support to filter packet based on IP fragment") Signed-off-by: Suman Ghosh Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna Reviewed-by: Simon Horman --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c index 044cc211424e..8392f63e433f 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_tc.c @@ -544,7 +544,7 @@ static int otx2_tc_prepare_flow(struct otx2_nic *nic, struct otx2_tc_flow *node, if (match.mask->flags & FLOW_DIS_IS_FRAGMENT) { if (ntohs(flow_spec->etype) == ETH_P_IP) { flow_spec->ip_flag = IPV4_FLAG_MORE; - flow_mask->ip_flag = 0xff; + flow_mask->ip_flag = IPV4_FLAG_MORE; req->features |= BIT_ULL(NPC_IPFRAG_IPV4); } else if (ntohs(flow_spec->etype) == ETH_P_IPV6) { flow_spec->next_header = IPPROTO_FRAGMENT; From patchwork Wed Apr 19 06:20:15 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: 85210 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp153390vqo; Tue, 18 Apr 2023 23:35:53 -0700 (PDT) X-Google-Smtp-Source: AKy350YKB5ngEBIeU2bWFfzts67+6q4YoNO/zqRoxCnS9O+UElCp/7uDS/Wa4w9wM/D/4LHyjTIR X-Received: by 2002:a05:6a00:198e:b0:636:e0fb:8c44 with SMTP id d14-20020a056a00198e00b00636e0fb8c44mr2704672pfl.12.1681886153460; Tue, 18 Apr 2023 23:35:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681886153; cv=none; d=google.com; s=arc-20160816; b=NlTsv5zgOpznqs72BhHR8qnf/Fuq9dS3P2rkU8qyVfzrxi5seAT7xotekQu+uLxUTC /qlbxckvJRoTVI3El5xR6Q6sRkmHzw/upc8mCudH0W8X/r/KFRS8FOB+BfgOUWek64U0 ZtAF3e8htTErYZscvbZ17v4rA3vmc0syzAOiJpxxjiNGtL4byf+bAhWoTWZgRnPNH1F4 EiHXgzZZu8M7SFLiPxD/zuJVnfL5GF1X8H4WO7kjnE4fdGM2UNor9T8gAyXYsnQwe2sI HftpJtm2HOoI370UW7eO71gEaWuGmdUjFACSnf6vrGrWOb/IZbGjMVAn1PeRI5nC0Y1v IjZQ== 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=2HyWB9sD5Eccru1im5o9+py4ovP+QoqvkohBGW3mbdU=; b=VBq87qsos6wOouWYJTD4YNDn2JYlsAqEQuvnjmtNlOjD5sNyGuRKZYwFO8+mdxpOvU hEgZlpGo0n39j4X7y7Rn8DqxiTxcWRmwH26/fJ74G0nudn06dfvHzRuiVq9TfpYCWisr 6AETtUcjgkYEfnBhFKiEGBzajkslKUr12k3wHXMEMmVxNbrlwzGiByUvOIUvoxEOA3wz jTU1VfyxkPjkzwZX8GbVb9kuoiczjXBkwh4EhOOO0MYPA7tOSmmgOw6lnhSxS1u6yYk6 7FbkVeYtARf32hCHUGIYWGHvAoSATi/QrnHRMHfPcs69XUDAsUsT28QxoJUEES9bH+gU l1Zg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=dOgJIbxh; 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 o4-20020a63e344000000b004fbb1ffaf6dsi16373473pgj.448.2023.04.18.23.35.40; Tue, 18 Apr 2023 23:35:53 -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=dOgJIbxh; 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 S231853AbjDSGWB (ORCPT + 99 others); Wed, 19 Apr 2023 02:22:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231262AbjDSGVs (ORCPT ); Wed, 19 Apr 2023 02:21:48 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DA9F57D9A; Tue, 18 Apr 2023 23:21:13 -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 33J3qncU021478; Tue, 18 Apr 2023 23:21:03 -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=2HyWB9sD5Eccru1im5o9+py4ovP+QoqvkohBGW3mbdU=; b=dOgJIbxhk+tNigZyngJOiCKroa7NleK90YFQ3mR+8fDqljHeRTAbUMznBppDD0VMckvZ ZjxLLEvtqEEQArOkmXfaUE9K3c3/EVb4h465Memoe4IVq0l6ylrbF9eWkCqV8W4hEJwA Tk1iE48NWOI4fOVMdthkfNWPrj1Ar3vOxFS/WMRI+nQsdDdTmZH7gI9eRaVakS7RhXrV IPEZRe4cJMte9U3LJzXqBQLV5UzwS4irL03d0nY78IUgn42i9/+yVn1BSu9F6b3kVBo4 ln36w8/r/SzrcqOX6qPA9MJmqTuk3cnvzSn2lUoDSjUt8FaaxlNDJrZsWziJyilH9ztN Cw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmh9-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:21:02 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:21:01 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Tue, 18 Apr 2023 23:21:01 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 79CC13F7058; Tue, 18 Apr 2023 23:20:56 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v3 07/10] octeontx2-af: Update/Fix NPC field hash extract feature Date: Wed, 19 Apr 2023 11:50:15 +0530 Message-ID: <20230419062018.286136-8-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: kavIDXJwt1zlHKZ1kavG8VGERk5QtFb- X-Proofpoint-ORIG-GUID: kavIDXJwt1zlHKZ1kavG8VGERk5QtFb- 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-19_02,2023-04-18_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?1763585455438599451?= X-GMAIL-MSGID: =?utf-8?q?1763585455438599451?= From: Ratheesh Kannoth 1. As per previous implementation, mask and control parameter to generate the field hash value was not passed to the caller program. Updated the secret key mbox to share that information as well, as a part of the fix. 2. Earlier implementation did not consider hash reduction of both source and destination IPv6 addresses. Only source IPv6 address was considered. This fix solves that and provides option to hash Fixes: 56d9f5fd2246 ("octeontx2-af: Use hashed field in MCAM key") Signed-off-by: Ratheesh Kannoth Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna Reviewed-by: Simon Horman --- .../net/ethernet/marvell/octeontx2/af/mbox.h | 16 +++++--- .../marvell/octeontx2/af/rvu_npc_hash.c | 37 ++++++++++++------- .../marvell/octeontx2/af/rvu_npc_hash.h | 6 +++ 3 files changed, 41 insertions(+), 18 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h index 5727d67e0259..0ce533848536 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h @@ -245,9 +245,9 @@ M(NPC_MCAM_READ_BASE_RULE, 0x6011, npc_read_base_steer_rule, \ M(NPC_MCAM_GET_STATS, 0x6012, npc_mcam_entry_stats, \ npc_mcam_get_stats_req, \ npc_mcam_get_stats_rsp) \ -M(NPC_GET_SECRET_KEY, 0x6013, npc_get_secret_key, \ - npc_get_secret_key_req, \ - npc_get_secret_key_rsp) \ +M(NPC_GET_FIELD_HASH_INFO, 0x6013, npc_get_field_hash_info, \ + npc_get_field_hash_info_req, \ + npc_get_field_hash_info_rsp) \ M(NPC_GET_FIELD_STATUS, 0x6014, npc_get_field_status, \ npc_get_field_status_req, \ npc_get_field_status_rsp) \ @@ -1524,14 +1524,20 @@ struct npc_mcam_get_stats_rsp { u8 stat_ena; /* enabled */ }; -struct npc_get_secret_key_req { +struct npc_get_field_hash_info_req { struct mbox_msghdr hdr; u8 intf; }; -struct npc_get_secret_key_rsp { +struct npc_get_field_hash_info_rsp { struct mbox_msghdr hdr; u64 secret_key[3]; +#define NPC_MAX_HASH 2 +#define NPC_MAX_HASH_MASK 2 + /* NPC_AF_INTF(0..1)_HASH(0..1)_MASK(0..1) */ + u64 hash_mask[NPC_MAX_INTF][NPC_MAX_HASH][NPC_MAX_HASH_MASK]; + /* NPC_AF_INTF(0..1)_HASH(0..1)_RESULT_CTRL */ + u64 hash_ctrl[NPC_MAX_INTF][NPC_MAX_HASH]; }; enum ptp_op { diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c index 6597af84aa36..68f813040363 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c @@ -110,8 +110,8 @@ static u64 npc_update_use_hash(int lt, int ld) * in KEX_LD_CFG */ cfg = KEX_LD_CFG_USE_HASH(0x1, 0x03, - ld ? 0x8 : 0x18, - 0x1, 0x0, 0x10); + ld ? 0x18 : 0x8, + 0x1, 0x0, ld ? 0x14 : 0x10); break; } @@ -134,7 +134,6 @@ static void npc_program_mkex_hash_rx(struct rvu *rvu, int blkaddr, if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { u64 cfg = npc_update_use_hash(lt, ld); - hash_cnt++; if (hash_cnt == NPC_MAX_HASH) return; @@ -149,6 +148,8 @@ static void npc_program_mkex_hash_rx(struct rvu *rvu, int blkaddr, mkex_hash->hash_mask[intf][ld][1]); SET_KEX_LD_HASH_CTRL(intf, ld, mkex_hash->hash_ctrl[intf][ld]); + + hash_cnt++; } } } @@ -171,7 +172,6 @@ static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr, if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { u64 cfg = npc_update_use_hash(lt, ld); - hash_cnt++; if (hash_cnt == NPC_MAX_HASH) return; @@ -187,8 +187,6 @@ static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr, SET_KEX_LD_HASH_CTRL(intf, ld, mkex_hash->hash_ctrl[intf][ld]); hash_cnt++; - if (hash_cnt == NPC_MAX_HASH) - return; } } } @@ -238,8 +236,8 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, struct flow_msg *omask) { struct npc_mcam_kex_hash *mkex_hash = rvu->kpu.mkex_hash; - struct npc_get_secret_key_req req; - struct npc_get_secret_key_rsp rsp; + struct npc_get_field_hash_info_req req; + struct npc_get_field_hash_info_rsp rsp; u64 ldata[2], cfg; u32 field_hash; u8 hash_idx; @@ -250,7 +248,7 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, } req.intf = intf; - rvu_mbox_handler_npc_get_secret_key(rvu, &req, &rsp); + rvu_mbox_handler_npc_get_field_hash_info(rvu, &req, &rsp); for (hash_idx = 0; hash_idx < NPC_MAX_HASH; hash_idx++) { cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_HASHX_CFG(intf, hash_idx)); @@ -311,13 +309,13 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, } } -int rvu_mbox_handler_npc_get_secret_key(struct rvu *rvu, - struct npc_get_secret_key_req *req, - struct npc_get_secret_key_rsp *rsp) +int rvu_mbox_handler_npc_get_field_hash_info(struct rvu *rvu, + struct npc_get_field_hash_info_req *req, + struct npc_get_field_hash_info_rsp *rsp) { u64 *secret_key = rsp->secret_key; u8 intf = req->intf; - int blkaddr; + int i, j, blkaddr; blkaddr = rvu_get_blkaddr(rvu, BLKTYPE_NPC, 0); if (blkaddr < 0) { @@ -329,6 +327,19 @@ int rvu_mbox_handler_npc_get_secret_key(struct rvu *rvu, secret_key[1] = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY1(intf)); secret_key[2] = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_SECRET_KEY2(intf)); + for (i = 0; i < NPC_MAX_HASH; i++) { + for (j = 0; j < NPC_MAX_HASH_MASK; j++) { + rsp->hash_mask[NIX_INTF_RX][i][j] = + GET_KEX_LD_HASH_MASK(NIX_INTF_RX, i, j); + rsp->hash_mask[NIX_INTF_TX][i][j] = + GET_KEX_LD_HASH_MASK(NIX_INTF_TX, i, j); + } + } + + for (i = 0; i < NPC_MAX_INTF; i++) + for (j = 0; j < NPC_MAX_HASH; j++) + rsp->hash_ctrl[i][j] = GET_KEX_LD_HASH_CTRL(i, j); + return 0; } diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h index 3efeb09c58de..65936f4aeaac 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h @@ -31,6 +31,12 @@ rvu_write64(rvu, blkaddr, \ NPC_AF_INTFX_HASHX_MASKX(intf, ld, mask_idx), cfg) +#define GET_KEX_LD_HASH_CTRL(intf, ld) \ + rvu_read64(rvu, blkaddr, NPC_AF_INTFX_HASHX_RESULT_CTRL(intf, ld)) + +#define GET_KEX_LD_HASH_MASK(intf, ld, mask_idx) \ + rvu_read64(rvu, blkaddr, NPC_AF_INTFX_HASHX_MASKX(intf, ld, mask_idx)) + #define SET_KEX_LD_HASH_CTRL(intf, ld, cfg) \ rvu_write64(rvu, blkaddr, \ NPC_AF_INTFX_HASHX_RESULT_CTRL(intf, ld), cfg) From patchwork Wed Apr 19 06:20:16 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: 85214 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp159070vqo; Tue, 18 Apr 2023 23:46:52 -0700 (PDT) X-Google-Smtp-Source: AKy350bHkW6JAJyuUpFG958p2/vhOdrrYHl65WJEXH2qYgxmCWoJUkFwsH7xejR35C1prvQanLvs X-Received: by 2002:a05:6a20:c193:b0:f0:1255:781b with SMTP id bg19-20020a056a20c19300b000f01255781bmr2803989pzb.29.1681886812676; Tue, 18 Apr 2023 23:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681886812; cv=none; d=google.com; s=arc-20160816; b=UqG5YmIrESuIvC9AhYkxo4FFKs3OwMn5woRQNGNcAIf5D+WzlDfMNRTxRIPBf4myXa 66prEsngboYsRiWahXJShsT9D6ZigzhKGon1Do8WyAeFo9Hc9ufGo/lG0jnz2FBBn67y BhB1SJ00m1GA8OKs75o0xID8AXZyzWLfHxkiBViX1l66cd3iDcXJ5qv4UBJezSf+2QTC OcIECQgyRNUxJlF9KkKu1gUUeyYs2Ky63nI4fA7JEAsKblbF07XsvolpyQqPbMNyHeNg rfwDB8pLpA0fN9jYDlUJm/SGgF1w+TsvBV5LI50U1ht/sOvOApe+A0ttrkgsa330WlMV 7uLg== 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=lfOp3wJpnqadEP0qVQvK7te4u5FBGBGOXqeBDSnYvzI=; b=b1qlieIXGtqR/giiOw9+qE6tO5px5rL4aTe8vXG8YcJom65Qz4+ZP0IKSgfi0ma2Dq 4jn45kvenMkKWrQ9AUdaNWPQe6whATxeOsMWfXZmCTUTNV9vb1FRq8ri4ceEtxnoMaqi 4QQaMG4ON0bQjBkslQWhFa5VybOqhoNUIQRWpL4jKTRLBGMIB1rxgI1HYQRfjIXzjOqA pEwmDkkBWEbNvaX57gubimGVaSVf6Kec//0WvVMHV+sMIuUCIkyzOCcVuao+MBc0u6BU OzYV3gNNB9g93TPxNR78/CeJ/pF2faGQMtE04NU5ewxaC2CiFSpt9w99UeHWvWKF28d1 DR2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=MC1mkcRr; 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 l8-20020a654c48000000b0051add13746dsi16046864pgr.22.2023.04.18.23.46.39; Tue, 18 Apr 2023 23:46:52 -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=MC1mkcRr; 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 S232054AbjDSGWG (ORCPT + 99 others); Wed, 19 Apr 2023 02:22:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35902 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231816AbjDSGV4 (ORCPT ); Wed, 19 Apr 2023 02:21:56 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 35DCE9EF6; Tue, 18 Apr 2023 23:21:22 -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 33J3rEGd023194; Tue, 18 Apr 2023 23:21:08 -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=lfOp3wJpnqadEP0qVQvK7te4u5FBGBGOXqeBDSnYvzI=; b=MC1mkcRrC4gRalC3SiVk1AtpswNpe3N4pZM+lg+LUyNKS3O16sUwuNp4ZjF+CVoXRPCB ReZRdE6f+JrcsBAUgrAZvXFo3GJtRGcuQLuLzgHdZ8QR7Oc6Ral1E6a+5GelHQF8CivE DxUaN2UXrNG5eMibGthNRC8NKr0Y6d1m0d5a+V+HDmtmq3qO6UVsjxMu7k2bvFiFdtMG rXKsrCTkg/HpSO645/vuwxzsg1jKgkD8XUfUDYNLREPVmEMRoyC2vAqjAuQ/8ceVykAo vEcDx/FFO0qzU3bNwuMohNtk1LOUolqMkPOm4r8r1FR3OeBdlZDn80JZyxJBMeF7cSRv Jg== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmhf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:21:08 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:21:06 -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; Tue, 18 Apr 2023 23:21:06 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 811A73F7091; Tue, 18 Apr 2023 23:21:01 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v3 08/10] octeontx2-af: Fix issues with NPC field hash extract Date: Wed, 19 Apr 2023 11:50:16 +0530 Message-ID: <20230419062018.286136-9-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: IXEnZh5JRZrpnz8TK3tlkKHnRSjs2rU_ X-Proofpoint-ORIG-GUID: IXEnZh5JRZrpnz8TK3tlkKHnRSjs2rU_ 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-19_02,2023-04-18_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?1763586146243600682?= X-GMAIL-MSGID: =?utf-8?q?1763586146243600682?= From: Ratheesh Kannoth 1. Allow field hash configuration for both source and destination IPv6. 2. Configure hardware parser based on hash extract feature enable flag for IPv6. 3. Fix IPv6 endianness issue while updating the source/destination IP address via ntuple rule. Fixes: 56d9f5fd2246 ("octeontx2-af: Use hashed field in MCAM key") Signed-off-by: Ratheesh Kannoth Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna Reviewed-by: Simon Horman --- .../marvell/octeontx2/af/rvu_npc_fs.c | 23 +++-- .../marvell/octeontx2/af/rvu_npc_fs.h | 4 + .../marvell/octeontx2/af/rvu_npc_hash.c | 88 ++++++++++--------- .../marvell/octeontx2/af/rvu_npc_hash.h | 4 +- 4 files changed, 69 insertions(+), 50 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c index 27603078689a..6d63a0ef6d9c 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c @@ -13,11 +13,6 @@ #include "rvu_npc_fs.h" #include "rvu_npc_hash.h" -#define NPC_BYTESM GENMASK_ULL(19, 16) -#define NPC_HDR_OFFSET GENMASK_ULL(15, 8) -#define NPC_KEY_OFFSET GENMASK_ULL(5, 0) -#define NPC_LDATA_EN BIT_ULL(7) - static const char * const npc_flow_names[] = { [NPC_DMAC] = "dmac", [NPC_SMAC] = "smac", @@ -442,6 +437,7 @@ static void npc_handle_multi_layer_fields(struct rvu *rvu, int blkaddr, u8 intf) static void npc_scan_ldata(struct rvu *rvu, int blkaddr, u8 lid, u8 lt, u64 cfg, u8 intf) { + struct npc_mcam_kex_hash *mkex_hash = rvu->kpu.mkex_hash; struct npc_mcam *mcam = &rvu->hw->mcam; u8 hdr, key, nr_bytes, bit_offset; u8 la_ltype, la_start; @@ -490,8 +486,21 @@ do { \ NPC_SCAN_HDR(NPC_SIP_IPV4, NPC_LID_LC, NPC_LT_LC_IP, 12, 4); NPC_SCAN_HDR(NPC_DIP_IPV4, NPC_LID_LC, NPC_LT_LC_IP, 16, 4); NPC_SCAN_HDR(NPC_IPFRAG_IPV6, NPC_LID_LC, NPC_LT_LC_IP6_EXT, 6, 1); - NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 16); - NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 16); + if (rvu->hw->cap.npc_hash_extract) { + if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][0]) + NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 4); + else + NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 16); + + if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][1]) + NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 4); + else + NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 16); + } else { + NPC_SCAN_HDR(NPC_SIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 8, 16); + NPC_SCAN_HDR(NPC_DIP_IPV6, NPC_LID_LC, NPC_LT_LC_IP6, 24, 16); + } + NPC_SCAN_HDR(NPC_SPORT_UDP, NPC_LID_LD, NPC_LT_LD_UDP, 0, 2); NPC_SCAN_HDR(NPC_DPORT_UDP, NPC_LID_LD, NPC_LT_LD_UDP, 2, 2); NPC_SCAN_HDR(NPC_SPORT_TCP, NPC_LID_LD, NPC_LT_LD_TCP, 0, 2); diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h index bdd65ce56a32..3f5c9042d10e 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.h @@ -9,6 +9,10 @@ #define __RVU_NPC_FS_H #define IPV6_WORDS 4 +#define NPC_BYTESM GENMASK_ULL(19, 16) +#define NPC_HDR_OFFSET GENMASK_ULL(15, 8) +#define NPC_KEY_OFFSET GENMASK_ULL(5, 0) +#define NPC_LDATA_EN BIT_ULL(7) void npc_update_entry(struct rvu *rvu, enum key_fields type, struct mcam_entry *entry, u64 val_lo, diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c index 68f813040363..51209119f0f2 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c @@ -78,42 +78,43 @@ static u32 rvu_npc_toeplitz_hash(const u64 *data, u64 *key, size_t data_bit_len, return hash_out; } -u32 npc_field_hash_calc(u64 *ldata, struct npc_mcam_kex_hash *mkex_hash, - u64 *secret_key, u8 intf, u8 hash_idx) +u32 npc_field_hash_calc(u64 *ldata, struct npc_get_field_hash_info_rsp rsp, + u8 intf, u8 hash_idx) { u64 hash_key[3]; u64 data_padded[2]; u32 field_hash; - hash_key[0] = secret_key[1] << 31; - hash_key[0] |= secret_key[2]; - hash_key[1] = secret_key[1] >> 33; - hash_key[1] |= secret_key[0] << 31; - hash_key[2] = secret_key[0] >> 33; + hash_key[0] = rsp.secret_key[1] << 31; + hash_key[0] |= rsp.secret_key[2]; + hash_key[1] = rsp.secret_key[1] >> 33; + hash_key[1] |= rsp.secret_key[0] << 31; + hash_key[2] = rsp.secret_key[0] >> 33; - data_padded[0] = mkex_hash->hash_mask[intf][hash_idx][0] & ldata[0]; - data_padded[1] = mkex_hash->hash_mask[intf][hash_idx][1] & ldata[1]; + data_padded[0] = rsp.hash_mask[intf][hash_idx][0] & ldata[0]; + data_padded[1] = rsp.hash_mask[intf][hash_idx][1] & ldata[1]; field_hash = rvu_npc_toeplitz_hash(data_padded, hash_key, 128, 159); - field_hash &= mkex_hash->hash_ctrl[intf][hash_idx] >> 32; - field_hash |= mkex_hash->hash_ctrl[intf][hash_idx]; + field_hash &= FIELD_GET(GENMASK(63, 32), rsp.hash_ctrl[intf][hash_idx]); + field_hash += FIELD_GET(GENMASK(31, 0), rsp.hash_ctrl[intf][hash_idx]); return field_hash; } -static u64 npc_update_use_hash(int lt, int ld) +static u64 npc_update_use_hash(struct rvu *rvu, int blkaddr, + u8 intf, int lid, int lt, int ld) { - u64 cfg = 0; - - switch (lt) { - case NPC_LT_LC_IP6: - /* Update use_hash(bit-20) and bytesm1 (bit-16:19) - * in KEX_LD_CFG - */ - cfg = KEX_LD_CFG_USE_HASH(0x1, 0x03, - ld ? 0x18 : 0x8, - 0x1, 0x0, ld ? 0x14 : 0x10); - break; - } + u8 hdr, key; + u64 cfg; + + cfg = rvu_read64(rvu, blkaddr, NPC_AF_INTFX_LIDX_LTX_LDX_CFG(intf, lid, lt, ld)); + hdr = FIELD_GET(NPC_HDR_OFFSET, cfg); + key = FIELD_GET(NPC_KEY_OFFSET, cfg); + + /* Update use_hash(bit-20) to 'true' and + * bytesm1(bit-16:19) to '0x3' in KEX_LD_CFG + */ + cfg = KEX_LD_CFG_USE_HASH(0x1, 0x03, + hdr, 0x1, 0x0, key); return cfg; } @@ -132,11 +133,13 @@ static void npc_program_mkex_hash_rx(struct rvu *rvu, int blkaddr, for (lt = 0; lt < NPC_MAX_LT; lt++) { for (ld = 0; ld < NPC_MAX_LD; ld++) { if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { - u64 cfg = npc_update_use_hash(lt, ld); + u64 cfg; if (hash_cnt == NPC_MAX_HASH) return; + cfg = npc_update_use_hash(rvu, blkaddr, + intf, lid, lt, ld); /* Set updated KEX configuration */ SET_KEX_LD(intf, lid, lt, ld, cfg); /* Set HASH configuration */ @@ -170,11 +173,13 @@ static void npc_program_mkex_hash_tx(struct rvu *rvu, int blkaddr, for (lt = 0; lt < NPC_MAX_LT; lt++) { for (ld = 0; ld < NPC_MAX_LD; ld++) if (mkex_hash->lid_lt_ld_hash_en[intf][lid][lt][ld]) { - u64 cfg = npc_update_use_hash(lt, ld); + u64 cfg; if (hash_cnt == NPC_MAX_HASH) return; + cfg = npc_update_use_hash(rvu, blkaddr, + intf, lid, lt, ld); /* Set updated KEX configuration */ SET_KEX_LD(intf, lid, lt, ld, cfg); /* Set HASH configuration */ @@ -264,44 +269,45 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, * is hashed to 32 bit value. */ case NPC_LT_LC_IP6: - if (features & BIT_ULL(NPC_SIP_IPV6)) { + /* ld[0] == hash_idx[0] == Source IPv6 + * ld[1] == hash_idx[1] == Destination IPv6 + */ + if ((features & BIT_ULL(NPC_SIP_IPV6)) && !hash_idx) { u32 src_ip[IPV6_WORDS]; be32_to_cpu_array(src_ip, pkt->ip6src, IPV6_WORDS); - ldata[0] = (u64)src_ip[0] << 32 | src_ip[1]; - ldata[1] = (u64)src_ip[2] << 32 | src_ip[3]; + ldata[1] = (u64)src_ip[0] << 32 | src_ip[1]; + ldata[0] = (u64)src_ip[2] << 32 | src_ip[3]; field_hash = npc_field_hash_calc(ldata, - mkex_hash, - rsp.secret_key, + rsp, intf, hash_idx); npc_update_entry(rvu, NPC_SIP_IPV6, entry, - field_hash, 0, 32, 0, intf); + field_hash, 0, + GENMASK(31, 0), 0, intf); memcpy(&opkt->ip6src, &pkt->ip6src, sizeof(pkt->ip6src)); memcpy(&omask->ip6src, &mask->ip6src, sizeof(mask->ip6src)); - break; - } - - if (features & BIT_ULL(NPC_DIP_IPV6)) { + } else if ((features & BIT_ULL(NPC_DIP_IPV6)) && hash_idx) { u32 dst_ip[IPV6_WORDS]; be32_to_cpu_array(dst_ip, pkt->ip6dst, IPV6_WORDS); - ldata[0] = (u64)dst_ip[0] << 32 | dst_ip[1]; - ldata[1] = (u64)dst_ip[2] << 32 | dst_ip[3]; + ldata[1] = (u64)dst_ip[0] << 32 | dst_ip[1]; + ldata[0] = (u64)dst_ip[2] << 32 | dst_ip[3]; field_hash = npc_field_hash_calc(ldata, - mkex_hash, - rsp.secret_key, + rsp, intf, hash_idx); npc_update_entry(rvu, NPC_DIP_IPV6, entry, - field_hash, 0, 32, 0, intf); + field_hash, 0, + GENMASK(31, 0), 0, intf); memcpy(&opkt->ip6dst, &pkt->ip6dst, sizeof(pkt->ip6dst)); memcpy(&omask->ip6dst, &mask->ip6dst, sizeof(mask->ip6dst)); } + break; } } diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h index 65936f4aeaac..a1c3d987b804 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.h @@ -62,8 +62,8 @@ void npc_update_field_hash(struct rvu *rvu, u8 intf, struct flow_msg *omask); void npc_config_secret_key(struct rvu *rvu, int blkaddr); void npc_program_mkex_hash(struct rvu *rvu, int blkaddr); -u32 npc_field_hash_calc(u64 *ldata, struct npc_mcam_kex_hash *mkex_hash, - u64 *secret_key, u8 intf, u8 hash_idx); +u32 npc_field_hash_calc(u64 *ldata, struct npc_get_field_hash_info_rsp rsp, + u8 intf, u8 hash_idx); static struct npc_mcam_kex_hash npc_mkex_hash_default __maybe_unused = { .lid_lt_ld_hash_en = { From patchwork Wed Apr 19 06:20:17 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: 85215 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp159069vqo; Tue, 18 Apr 2023 23:46:52 -0700 (PDT) X-Google-Smtp-Source: AKy350aNnY5xVZHuZX++jPopyaYcqRkXJ7Sggi546uiqPI7zDsr+pqwdpJCZiKBAJ9VK/Sneg6j+ X-Received: by 2002:a05:6a21:6d87:b0:ef:acca:9e19 with SMTP id wl7-20020a056a216d8700b000efacca9e19mr2860330pzb.14.1681886812657; Tue, 18 Apr 2023 23:46:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681886812; cv=none; d=google.com; s=arc-20160816; b=y2RXs3AbvE5LbXySqJ+IGgCdx4iploOw2ZV+JH9avQZbMUtOpT9RCCcAq5DPsdnOyj aBQpEV2MBO7I+DgrHxlIDc+dcs6tDlLbaTRiUI1pTMfwVm+GK5QvmXG9Tn7nGbp+XQny 3D6zLjB+JXUOSxLQZJnA7ZCi8cEmcj0hKrFmdK+4yQhSyx/pYDFeWbzHBgJRcH/SzZ42 0dxd4gNUOuunE5Bp5qgn/+XA4M6n/fDNPoQbcCU0iZUTwB9s/hKx19VAor5OEzdLuBbq MLpIv1ng2k/d3i9XdYauRGwH7ttl1rKKPmszxNaMrk37X/kU1PIPQhRRIEG3ti/meBzE KkfA== 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=CZ9r/k8Q5WgscKeIOIPc2oioLD49Mr5Rdggqk+k3F44=; b=k8zhkBOr7rHCeUjrFyD0xfldsp/7+eMpz/mrznUorv9P1QS5LqtPQd8QAinOuzt+yX iIh4SmYNwGrhx+73Z8YgzWrTc1dNTRvorGRB3JRmDEPtrCp6C44IJNKaHHMh8Sm4srcb Fmw9zbsE/ux4yf5uHD8OKmZ1j7D7FQATHgbwVQr+/yqNmFW6FpdF5ASLTOM9V7y8YfA1 Z8SqqSirut5W4y3UpyENZwgZCS+XEMdRD5+6wBgb8oPK8g3N+BjULWNMLArTEFNNNFUH RyWHw62nVCYgF3DfmXgjWFluHQJABel3WIaqDCnjKZuwAH52AR5Zi9CCQv90gs2xVUzb QeqQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=KkMLL6av; 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 143-20020a630095000000b0051b930ef848si10239798pga.142.2023.04.18.23.46.39; Tue, 18 Apr 2023 23:46:52 -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=KkMLL6av; 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 S231875AbjDSGWR (ORCPT + 99 others); Wed, 19 Apr 2023 02:22:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36890 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232141AbjDSGWB (ORCPT ); Wed, 19 Apr 2023 02:22:01 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 50017769F; Tue, 18 Apr 2023 23:21:27 -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 33J3qnIs021482; Tue, 18 Apr 2023 23:21:13 -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=CZ9r/k8Q5WgscKeIOIPc2oioLD49Mr5Rdggqk+k3F44=; b=KkMLL6avawwNfzj3Sb7W+vetoQPWTmoEqVL8QzulBtztnTjdmKN0MQKxWZTpP4xcnxZr GUo9ov94dIKd1BtGYhFKKiBiEvAJEMWWl5OB8B73ad/WZyJKnQBCCIVbERQ+RFfWm8l9 dIOSZzGHTFOBAUAyvI6OjE6vHeSQFKqzWb3WbZYP6A9yYfOVo5IEwE1fQDgZeVmI9i3M YBMvm7Ij9DHgXiHqhPLxsTfgQrGAA3jOeDOBplF+0oDtcIVCYpj1yNmZ8HoFFSbNwMvq U8VpY49BVPZg2FzwQhD4/QLWkbWHj1CHO9O0mtTOSBQvcLkFebil3wzXt0cKPZrfDRFp gw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmhs-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:21:13 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Tue, 18 Apr 2023 23:21:11 -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; Tue, 18 Apr 2023 23:21:11 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 850353F7055; Tue, 18 Apr 2023 23:21:06 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v3 09/10] octeontx2-af: Skip PFs if not enabled Date: Wed, 19 Apr 2023 11:50:17 +0530 Message-ID: <20230419062018.286136-10-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: LcLxkYSGXUCvb2IM7SQAwX-xBU5REjv8 X-Proofpoint-ORIG-GUID: LcLxkYSGXUCvb2IM7SQAwX-xBU5REjv8 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-19_02,2023-04-18_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?1763586146454405578?= X-GMAIL-MSGID: =?utf-8?q?1763586146454405578?= From: Ratheesh Kannoth Skip mbox initialization of disabled PFs. Firmware configures PFs and allocate mbox resources etc. Linux should configure particular PFs, which ever are enabled by firmware. Fixes: 9bdc47a6e328 ("octeontx2-af: Mbox communication support btw AF and it's VFs") Signed-off-by: Ratheesh Kannoth Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna --- .../net/ethernet/marvell/octeontx2/af/mbox.c | 5 ++- .../net/ethernet/marvell/octeontx2/af/mbox.h | 3 +- .../net/ethernet/marvell/octeontx2/af/rvu.c | 40 ++++++++++++++++--- 3 files changed, 41 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.c b/drivers/net/ethernet/marvell/octeontx2/af/mbox.c index 2898931d5260..9690ac01f02c 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.c @@ -157,7 +157,7 @@ EXPORT_SYMBOL(otx2_mbox_init); */ int otx2_mbox_regions_init(struct otx2_mbox *mbox, void **hwbase, struct pci_dev *pdev, void *reg_base, - int direction, int ndevs) + int direction, int ndevs, unsigned long *pf_bmap) { struct otx2_mbox_dev *mdev; int devid, err; @@ -169,6 +169,9 @@ int otx2_mbox_regions_init(struct otx2_mbox *mbox, void **hwbase, mbox->hwbase = hwbase[0]; for (devid = 0; devid < ndevs; devid++) { + if (!test_bit(devid, pf_bmap)) + continue; + mdev = &mbox->dev[devid]; mdev->mbase = hwbase[devid]; mdev->hwbase = hwbase[devid]; diff --git a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h index 0ce533848536..26636a4d7dcc 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/mbox.h +++ b/drivers/net/ethernet/marvell/octeontx2/af/mbox.h @@ -96,9 +96,10 @@ void otx2_mbox_destroy(struct otx2_mbox *mbox); int otx2_mbox_init(struct otx2_mbox *mbox, void __force *hwbase, struct pci_dev *pdev, void __force *reg_base, int direction, int ndevs); + int otx2_mbox_regions_init(struct otx2_mbox *mbox, void __force **hwbase, struct pci_dev *pdev, void __force *reg_base, - int direction, int ndevs); + int direction, int ndevs, unsigned long *bmap); void otx2_mbox_msg_send(struct otx2_mbox *mbox, int devid); int otx2_mbox_wait_for_rsp(struct otx2_mbox *mbox, int devid); int otx2_mbox_busy_poll_for_rsp(struct otx2_mbox *mbox, int devid); diff --git a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c index 8683ce57ed3f..7b54756902cf 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu.c @@ -2282,7 +2282,7 @@ static inline void rvu_afvf_mbox_up_handler(struct work_struct *work) } static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, - int num, int type) + int num, int type, unsigned long *pf_bmap) { struct rvu_hwinfo *hw = rvu->hw; int region; @@ -2294,6 +2294,9 @@ static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, */ if (type == TYPE_AFVF) { for (region = 0; region < num; region++) { + if (!test_bit(region, pf_bmap)) + continue; + if (hw->cap.per_pf_mbox_regs) { bar4 = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_PFX_BAR4_ADDR(0)) + @@ -2315,6 +2318,9 @@ static int rvu_get_mbox_regions(struct rvu *rvu, void **mbox_addr, * RVU_AF_PF_BAR4_ADDR register. */ for (region = 0; region < num; region++) { + if (!test_bit(region, pf_bmap)) + continue; + if (hw->cap.per_pf_mbox_regs) { bar4 = rvu_read64(rvu, BLKADDR_RVUM, RVU_AF_PFX_BAR4_ADDR(region)); @@ -2343,8 +2349,27 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, int err = -EINVAL, i, dir, dir_up; void __iomem *reg_base; struct rvu_work *mwork; + unsigned long *pf_bmap; void **mbox_regions; const char *name; + u64 cfg; + + pf_bmap = kcalloc(BITS_TO_LONGS(num), sizeof(long), GFP_KERNEL); + if (!pf_bmap) + return -ENOMEM; + + /* RVU VFs */ + if (type == TYPE_AFVF) + bitmap_set(pf_bmap, 0, num); + + if (type == TYPE_AFPF) { + /* Mark enabled PFs in bitmap */ + for (i = 0; i < num; i++) { + cfg = rvu_read64(rvu, BLKADDR_RVUM, RVU_PRIV_PFX_CFG(i)); + if (cfg & BIT_ULL(20)) + set_bit(i, pf_bmap); + } + } mbox_regions = kcalloc(num, sizeof(void *), GFP_KERNEL); if (!mbox_regions) @@ -2356,7 +2381,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, dir = MBOX_DIR_AFPF; dir_up = MBOX_DIR_AFPF_UP; reg_base = rvu->afreg_base; - err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFPF); + err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFPF, pf_bmap); if (err) goto free_regions; break; @@ -2365,7 +2390,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, dir = MBOX_DIR_PFVF; dir_up = MBOX_DIR_PFVF_UP; reg_base = rvu->pfreg_base; - err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFVF); + err = rvu_get_mbox_regions(rvu, mbox_regions, num, TYPE_AFVF, pf_bmap); if (err) goto free_regions; break; @@ -2396,16 +2421,19 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, } err = otx2_mbox_regions_init(&mw->mbox, mbox_regions, rvu->pdev, - reg_base, dir, num); + reg_base, dir, num, pf_bmap); if (err) goto exit; err = otx2_mbox_regions_init(&mw->mbox_up, mbox_regions, rvu->pdev, - reg_base, dir_up, num); + reg_base, dir_up, num, pf_bmap); if (err) goto exit; for (i = 0; i < num; i++) { + if (!test_bit(i, pf_bmap)) + continue; + mwork = &mw->mbox_wrk[i]; mwork->rvu = rvu; INIT_WORK(&mwork->work, mbox_handler); @@ -2415,6 +2443,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, INIT_WORK(&mwork->work, mbox_up_handler); } kfree(mbox_regions); + kfree(pf_bmap); return 0; exit: @@ -2424,6 +2453,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, iounmap((void __iomem *)mbox_regions[num]); free_regions: kfree(mbox_regions); + kfree(pf_bmap); return err; } From patchwork Wed Apr 19 06:20:18 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: 85207 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp150014vqo; Tue, 18 Apr 2023 23:29:36 -0700 (PDT) X-Google-Smtp-Source: AKy350b5OfYQRqyc3THkFRC5tI1+69Kt+644IfXDvb9nKzg1TD8XJQMe+DugIMrQHJJ1Sr4Xgs7h X-Received: by 2002:a05:6a20:7f83:b0:f0:f2d6:6dd with SMTP id d3-20020a056a207f8300b000f0f2d606ddmr2864641pzj.11.1681885776551; Tue, 18 Apr 2023 23:29:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681885776; cv=none; d=google.com; s=arc-20160816; b=v11ejrws78kvpJEhkzX1idwI+B/PvF0JRtxzB5CFJq8plUR3KezJzvnvkfq6gx4Nh4 IMqe3PqayU9edRqKP8V4ZBXUAAbVSGAcZyZx4vDjZEjAt85J6UAdkgQLkkYwQfwEatGj bsdSdZyLNa1lJNusWXa8HyWVdPCSQRngl6BPjaDhQKer6Z/i/6BvcIWHZY6FZ6ffAzuG 8qzWKIrHAprwh1swWT7GqqjDLdD00rVgKofGICHjlbn3b+NUP8DwlXLbPCYfRLllUwL2 7GvSvvsWhhP/X/0JsVnyBr1RNspMXrNjd1/jNz+sEoz7iD/IOc/4mdJb+Z50rhhtTb8L aPbw== 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=O8lzL1Lq/tPIhJSUbcUgX+MtiTah46PWgckuX8OkKz4=; b=uPsG2CmhbjCuRcSbRgxkLUzjQ5ZwUgeBp1bm2haEQ1jMn+PnZxt/K8cssy6lOw9GuD 5WItsAKdKpplCGvu59QEUm6845ibJeGfq8Oj+m7Qy4BMpfrPf8SYPhtZlPbQJiy3Tjo6 VD26pzrhL8/66Mq1TV86e2PRP+tpLCD7O1zuU+QX8eDyd/lE59TeYUKklxLRpLI5344J kr99ZI/tvk2cRdGAvbhAV/ljF5nm/QkfpeBRQTjvFYo/MSwUDCCTXjFU7AFBM6lQAte/ +oyrzRMFRzreqGN7+MHROidP+aPE5NZ0wAWcZiPnCZ2WgbJ5DNbzXNhPqownHpeexIt3 tZVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=EVtYCJJf; 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 125-20020a620583000000b00627f017391csi15339683pff.273.2023.04.18.23.29.24; Tue, 18 Apr 2023 23:29:36 -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=EVtYCJJf; 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 S232265AbjDSGWU (ORCPT + 99 others); Wed, 19 Apr 2023 02:22:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36432 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232081AbjDSGWE (ORCPT ); Wed, 19 Apr 2023 02:22:04 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB18EBBAA; Tue, 18 Apr 2023 23:21:32 -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 33J3qnRK021480; Tue, 18 Apr 2023 23:21:18 -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=O8lzL1Lq/tPIhJSUbcUgX+MtiTah46PWgckuX8OkKz4=; b=EVtYCJJfZ8JuOLAqAAmH8f5i/Fs2skrMLEHuyJrYUlIY8SMS12xfDs2Di1mu60mPDvJf suBdvPFVikW7O88kBah4uvHJL3CYcrxJqc8ClSItiOERvjg4+uHcoc3CInBrXwVmpQWE E9bRYD8hA5KuAGa07fIxPZE+SOYpMV0sMexOyzao31huhyz+2ATHQU0NKDxHPgtWOH8T STqfjejMvGBnn5W2x0nGGIZamVabTL+JH0yWuPvK2GdZHhCnJ/FYXWACC8xZMK9GWDEo jMniCwx5zjMxGhYudUb9GNDOyg42h522ixbpMZ54rPuQIOmCMkB3l+CjnGf7Pa7Qihd+ vA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q28s0gmj7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 18 Apr 2023 23:21:17 -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; Tue, 18 Apr 2023 23:21:16 -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; Tue, 18 Apr 2023 23:21:16 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 8730F3F708C; Tue, 18 Apr 2023 23:21:11 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v3 10/10] octeontx2-pf: Disable packet I/O for graceful exit Date: Wed, 19 Apr 2023 11:50:18 +0530 Message-ID: <20230419062018.286136-11-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230419062018.286136-1-saikrishnag@marvell.com> References: <20230419062018.286136-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: gInKFVf28W5q2XvoieqKgpPgVQaYqmh8 X-Proofpoint-ORIG-GUID: gInKFVf28W5q2XvoieqKgpPgVQaYqmh8 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-19_02,2023-04-18_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?1763585060390689910?= X-GMAIL-MSGID: =?utf-8?q?1763585060390689910?= 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 ++++++++++- 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)