From patchwork Wed Apr 26 07:43:36 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: 87700 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp74570vqo; Wed, 26 Apr 2023 01:00:15 -0700 (PDT) X-Google-Smtp-Source: AKy350b0J3/3TTS2dz/qz+8Nqcw2e2Th6Vqoh84rtmmgYBSfUUNgcN9XwI/Zk2cSl9RlFTX40ls7 X-Received: by 2002:a05:6a00:2d05:b0:63d:2f13:200 with SMTP id fa5-20020a056a002d0500b0063d2f130200mr26186946pfb.16.1682496015173; Wed, 26 Apr 2023 01:00:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496015; cv=none; d=google.com; s=arc-20160816; b=ZzsWJCxCUJLbFIylcoogsFsuUg3OXEC+ghaaLoAf3eOr9iEHagdzKmC6RczCiVfS5L V6zVu3Sgj/lYKLbpReBrUDkTfeCU2LZqDUbj7AEHcom3sp1V7eBPugppTKMBJdAvLgQf h4LT9DuSNop/3X7cfdXzVXEwvtLVOo4p4N2jtHMV/po/EDQjcBrODD51H4GqbrMzukfd BrOFGt6uGoZhl2cH29q5/qYey8eRNbnZrygoYsTCSEzLtUiMOH+aWyYOjRly59Qa9rEX qQJv04Xiir2IQNz7R7zwmrWrxu5YhEM34XjQF97PpAxNR7XEt13MGFO+O+YpCZdZ1D+o yo9w== 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=jw7FfDLMGTKpgSF5ca1sdut6Rpkx65gv2wVX/lQRlLQ=; b=TKyZS7l9j4DcNjRTF48UhbQwxCa4nWx18HfMe5EtntOLfgZcp7uC+HlKLcgA3hI2bT 6TjerMQH6qFixD9DftTi5jVceio7uWAV6SVt+x2JGlcVN082Qemj5yNOuUKm8Z2yt/X3 6eDC6HRjiqboEySV4onDeMydv/rekt+6QYXd6XRxmDzEfnvDLYsbd2ylHiQVWdVbCh1a X5Dxaz06xUfA1d07BXcLeKBJmfKcg68PNy/4iZmV8fGa6aejDlZ/CwqA5Rp6kH7J6aHg dqPKZitrhWd7m5+m3m3fxJiNNnwuo0qWZ/cw0cSzu34k1ipA03+8QZNJvFRouzfzBbae R23A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=La41dtws; 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 h22-20020aa796d6000000b0063b6e71d1fbsi15637079pfq.319.2023.04.26.01.00.00; Wed, 26 Apr 2023 01:00:15 -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=La41dtws; 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 S240007AbjDZHoN (ORCPT + 99 others); Wed, 26 Apr 2023 03:44:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239976AbjDZHoG (ORCPT ); Wed, 26 Apr 2023 03:44:06 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 41326A7; Wed, 26 Apr 2023 00:44:05 -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 33Q6oZhi013107; Wed, 26 Apr 2023 00:43:59 -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=jw7FfDLMGTKpgSF5ca1sdut6Rpkx65gv2wVX/lQRlLQ=; b=La41dtws6EQapyAm/oxnb253lbLkX2IHMzgm8Qcsc7tE+Idj+SRjqQSnFUwUvsBBs5XU fp8PwzDeVwu5I3qJ2xYNrhrfAzUfKHvtACSqVK2W0kG+uJEIS8k3eTY+5f0qhZD3SrYU LHhuZIPMlXIi95cxwtZzd44ao/yiHO3/Vd/1Xlnp7IuahRg2c0MN1TDm2XznAfh6RPhx 1da/Nx9xzK4qrRTC/WEUtdW3rSHJh1adiO1srXK0EUgDqyFZnRubDE0rBoOo+27XMc4G Lkptt9BnJx3wbfUAPokU4YFUC+7VdPvRdpoGTG9GddYyCeJcfx+MLfPbCy56pSQeOhtJ RA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd30-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:43:58 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 26 Apr 2023 00:43:57 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:43:57 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id E9C985B692D; Wed, 26 Apr 2023 00:43:52 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v4 01/10] octeontx2-af: Secure APR table update with the lock Date: Wed, 26 Apr 2023 13:13:36 +0530 Message-ID: <20230426074345.750135-2-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: deks-t5Nr-z0ktb_WJkNRraPbXxaDLAe X-Proofpoint-ORIG-GUID: deks-t5Nr-z0ktb_WJkNRraPbXxaDLAe X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224941686685174?= X-GMAIL-MSGID: =?utf-8?q?1764224941686685174?= 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 Reviewed-by: Simon Horman --- .../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 26 07:43:37 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: 87697 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp73648vqo; Wed, 26 Apr 2023 00:57:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4wqeoSLmj4VkkXZ9Jn3XO/XECP4x8+skozcag+M32qZA6gIvB9aR/bBZadfspLpSwRRwPf X-Received: by 2002:a17:902:fb8d:b0:1a9:7cb3:70cb with SMTP id lg13-20020a170902fb8d00b001a97cb370cbmr7730142plb.67.1682495862034; Wed, 26 Apr 2023 00:57:42 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682495862; cv=none; d=google.com; s=arc-20160816; b=KUp9ylIk6bxrE+SeVZ8wD2LGtyerlCwg1h9OVwqRaH3FdLRHszez/qP7TF7lU1/0Gk X5+INyRj9edQgLU2jnLvYhsx3fZe6vzDwoguDh0gCqaERfuJteb60maYkZa+i23+z1xp k8DFWmIWmAfIPAZnCweBVivPEwfcEAvKERStJqzDzzTQbg/WhaVECkX+RvkxoR+PxXdQ xXnQ/GFrqFftHPmLyih6QjW/3Ll4WqON/4vLnsldhBFCRfsw6trmoN2QQea3AfgT5SIu n/8jcokdQMUNULgr6/qpWrSZcNyF/Ud0IiZ61ATmCQHabQoyDF4xf69LAx5kJ7K4D43A xZ7g== 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=z6k/sUirye6gC9Hi9CvYYgb4LzEDa09KdOIf49LemB4=; b=wkKfxEbENhwpmhVEb6N7xvJfc5XvIVsOUBsGmMRQx2ONDenLWZk/obeYoA6MVDTLMh CuDPYA2RniHkCINSOKNtGkCN9RjXDEmbWRuZo+O/qLyd8kowuurF8SG/IoZBZqBYG0rx LJRDFJuOBLUwUR3lF2i6xES07D4nLcsgqLdYi5Rh4FUcbzlVq2ruwPjV6MmlDUX+Ople bxnEhD9N6wPj88U+Vp0b6Cmpk2RPHh/qxYGSm7vlQ09+4z6R5xI4o0tjxCK/ro8N/S8r a9kjT6d7uYnVlR2C3+mWi3ITjtfOe7l6sjq7+vjluJut2KcYjMPPpqTnhUHYJY8Zx2St GK1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=FA0gSQ9L; 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 c4-20020a170902d48400b001a51bb4ad79si14076023plg.42.2023.04.26.00.57.27; Wed, 26 Apr 2023 00:57:42 -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=FA0gSQ9L; 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 S239980AbjDZHod (ORCPT + 99 others); Wed, 26 Apr 2023 03:44:33 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240002AbjDZHo1 (ORCPT ); Wed, 26 Apr 2023 03:44:27 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9020540E7; Wed, 26 Apr 2023 00:44:10 -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 33Q75YDm012965; Wed, 26 Apr 2023 00:44:04 -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=z6k/sUirye6gC9Hi9CvYYgb4LzEDa09KdOIf49LemB4=; b=FA0gSQ9L30scXvPzm4sxw6Uh0gE1WA373de2AFkRYZs8oJB/bPCGpwa5Kmdu31mRGvMF X5L4BGQ+4ZbPyqXXoN0omp3Bd+hgdvwWvsyQliFI3Zw3esWMbYrfennY/+lL6do1P7G9 h9TNfkx9VPSEiA3+iP5RuLUALJgvmbvDy8OCl+Ju8fr3kUe2L8Nob9AjozqLQJ2KAppj DXawQgl88whDKX1mC/P9VDQxF7eBfXb0sQLZoZ2tfgCiLrZEefB8Vk44rgvWJ2ad3JQw EY4SJljaUnEGUvlilitAyI5aTs01tv2XLIkq9RZhrfJgF6v4MXUW8F8bcUHrmT38aM4R 6w== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd3b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:03 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 26 Apr 2023 00:44:02 -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; Wed, 26 Apr 2023 00:44:02 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 987513F7083; Wed, 26 Apr 2023 00:43:57 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v4 02/10] octeontx2-af: Fix start and end bit for scan config Date: Wed, 26 Apr 2023 13:13:37 +0530 Message-ID: <20230426074345.750135-3-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 7n2mrKzNTQGhf3NQRlcJ53INW1fAYT9n X-Proofpoint-ORIG-GUID: 7n2mrKzNTQGhf3NQRlcJ53INW1fAYT9n X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224781192836223?= X-GMAIL-MSGID: =?utf-8?q?1764224781192836223?= From: Ratheesh Kannoth In the current driver, NPC exact match feature was not getting enabled as configured bit was not read properly. for_each_set_bit_from() need end bit as one bit post position in the bit map to read NPC exact nibble enable bits properly. This patch fixes 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 --- drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c | 3 +-- 1 file changed, 1 insertion(+), 2 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..f15efd41972e 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_fs.c @@ -594,8 +594,7 @@ static int npc_scan_kex(struct rvu *rvu, int blkaddr, u8 intf) */ 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) { + 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 26 07:43:38 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: 87695 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp73466vqo; Wed, 26 Apr 2023 00:57:14 -0700 (PDT) X-Google-Smtp-Source: AKy350aw8w82f6IEipEfedXT3AyX7rsS03QvzWziCbGdqECD6lAlU9ju2ueX0q+iL6DZqv+WLQcx X-Received: by 2002:a17:902:ea07:b0:1a9:7707:80c7 with SMTP id s7-20020a170902ea0700b001a9770780c7mr12001495plg.32.1682495834426; Wed, 26 Apr 2023 00:57:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682495834; cv=none; d=google.com; s=arc-20160816; b=c9fQ3SC7Oom36A+JMJG7rCPWTz6MS34sa0b0aacBa3nqSsbNIsUxFRuc42phz57Arg fKTha/QJr1fMHBMakaBgR3Mv4xCzqYGZPavhTyIal7hwvQ85YdQhPWycLdTZVI3YYcG3 STMV3G6JQjWKzxh4GGFpfs1qLmdnFh0zhvd0bS+88MZX717VxOozRZPh5Hu9p+mBcRPa l6hb8d7b1Kjm5k6LdJKGctRLv1kT3W6ASVKJA+a34BNLORGN9tij9JhSrLv359YJPZ0G YTeoM+nFgNKyxo7SHAvUeq9DFl8xvR72h26y72wLANiuQEomGzIK3olmleUs8url3dJs FBxw== 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=oeASTIACqjLqjgo40S/3synelPRRKm5Hez+ARr3FyuI=; b=D/GSHRJ5ph4FX6iSDJ/Bib19d927l+eRNSu0+9+NYOq3W+5xMdc9Z2I5+5EvYsb0/Z nDzqQGggo0gCp+upcxtV2hxL87oCy2GTMy3aReBfxk2kgtWEm5CyPZ+0CU9XQM48uCCF CWpYwvI2rkQY6xHGKcV5JMc1MGT4Lz6HnKlIEbWeUtEiTf7JBb1R4d9ULGmD+TozcbPs QGuYWyahWVEJ3wREZhR0PfiFvxaHCJ+RAiZG3mOSzTOJwC/p112CH+xo3JExinYHnoSe vXDy5N9YdONd4K6bdNY3mVbWUnUM5YhnGiXhwBl6DjI7IdK846aYllRtslU/ymXZBiN7 lk7Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=BK5lVq3w; 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 b16-20020a170902e95000b001a93e74c8b6si14760312pll.595.2023.04.26.00.56.58; Wed, 26 Apr 2023 00:57:14 -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=BK5lVq3w; 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 S240059AbjDZHop (ORCPT + 99 others); Wed, 26 Apr 2023 03:44:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240051AbjDZHob (ORCPT ); Wed, 26 Apr 2023 03:44:31 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F9C144A3; Wed, 26 Apr 2023 00:44:17 -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 33Q6rMgL001960; Wed, 26 Apr 2023 00:44:09 -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=oeASTIACqjLqjgo40S/3synelPRRKm5Hez+ARr3FyuI=; b=BK5lVq3wHhT4NP9KvHF4LdhUlj9KQBaRT4SAQG9y/CpSiwjfdNCIcIqtFpOBub43jr89 4FDbjjEKu/oRHXxpsGwcrYSt7NW5GQq0mTm8nDxsRxOj9MXQHNnDKeJzYkdyeFv2lNVq WQd4lj1ifEIIZ3cMZuQj39NLQdzFuD6roeyfEKKeXSjDUjxkdnaPz7N0GnalAb1R4ICX zhXgEdVeqiv+DOPqFEZqvL9Ut/qwD6Am8LPMVWGw+6lUtl0BKuAOGfTqBR7xoSDbUMr/ BWllfLfKvHk2bGN+GKboRB2dtm+PIoxLKJWklx6MPh0vcHA9cBc6Vh90VbVwKkeOzB/V XQ== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3pdm8p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:09 -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; Wed, 26 Apr 2023 00:44:07 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:44:07 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 8F0C95B693A; Wed, 26 Apr 2023 00:44:02 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v4 03/10] octeontx2-af: Fix depth of cam and mem table. Date: Wed, 26 Apr 2023 13:13:38 +0530 Message-ID: <20230426074345.750135-4-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: UN1FoLhxF_AhTSUDX0VRye8CBweSb5EC X-Proofpoint-GUID: UN1FoLhxF_AhTSUDX0VRye8CBweSb5EC X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224752024845103?= X-GMAIL-MSGID: =?utf-8?q?1764224752024845103?= From: Ratheesh Kannoth In current driver, NPC cam and mem table sizes are read from wrong register offset. This patch fixes the register offset so that correct values are populated on read. 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 26 07:43:39 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: 87699 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp73812vqo; Wed, 26 Apr 2023 00:58:09 -0700 (PDT) X-Google-Smtp-Source: AKy350ZQQS+yxgpTnV4F36TCV9RCglNghUgsyEZNlS5q2/wlibrgOg1/1BvN0Ox5ufmCFck4/OCx X-Received: by 2002:a05:6a00:1914:b0:63b:e4:554 with SMTP id y20-20020a056a00191400b0063b00e40554mr27639667pfi.4.1682495889184; Wed, 26 Apr 2023 00:58:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682495889; cv=none; d=google.com; s=arc-20160816; b=rRUw2XXUErfLMsj0+jHfSVBLG6aE9T9hlPPVWVfBtloQ4Ca2OKVcVdE5ibK4Mxeh6c 3maXqbokpwU3kdJplyXDl40+YRdl0DKpYWyhY66K86OSITWfbSO6+i0l9tFXOre58vuH sKaUccXyFOy2jBcMWdnyheA7vr5tNxvO5AwDLNvLlMI5kpn5AKAvO7dQx3I13BK5mtJO UiK6FOwFgG4c0o98awDofs9ree2hkn4Wy9F/eFC7G33AfU6JlSabRDB+/9c2aQGyEDts 4ZwTONK7P3644KS4DBFb1uavb8YKrcGVEWCcBFvGKRZgwqJi1YQmHSevQlh3K2Dn/dAX VAAg== 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=yI7HG+JOiOS+JDrb/R95t7A8DFfH5EsInJosfBwdR30=; b=pqx3D0Fa2RrmrJz1cdF5jRb/sKCdS64NmbM7j3igwD/CSMQulPn/ehb7DdGfvzA0dw DBQXaNRd0ib5qweXBx91KILk+Er5/VpNF8UCe7t7Y9vlCcIC6SQvuwm5bA0jpUTctRpU p7IW6J+VtCmeVi/dy6/F9EaMU5YuENrpQR4GwT+s8ehFJfz31l6bOx4/ALuuxZ8NQvgx ww7v0UHynMFxw0OvSmQi5IU8vsYPBq8tsON8vGapcCNVShH7YNZURKCvcaRbdZVI6f22 FJeCcd0yvOEMrtanAQZ01dLZD+NAEod5XVvbFcohdcHs2ODF+vSm7TM3X7l6ox9d965g GIxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=k9zzOkcg; 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 k28-20020aa7973c000000b0063d39484021si15849061pfg.81.2023.04.26.00.57.55; Wed, 26 Apr 2023 00:58:09 -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=k9zzOkcg; 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 S240075AbjDZHo5 (ORCPT + 99 others); Wed, 26 Apr 2023 03:44:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47542 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240021AbjDZHof (ORCPT ); Wed, 26 Apr 2023 03:44:35 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94A2144AC; Wed, 26 Apr 2023 00:44:20 -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 33Q6qLYc013102; Wed, 26 Apr 2023 00:44:14 -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=yI7HG+JOiOS+JDrb/R95t7A8DFfH5EsInJosfBwdR30=; b=k9zzOkcgu8cK74IJtl1ey86xQlT6r2uznMTbNiNoYTkc2LHytlleAPiPBkkBsup7x128 lMKKYTtBzu2pFSkptsVhpUhovAciEOuNajH8ylxb18nSJZcjuf1b6XYcJHeeFfbj23AR M8dBR+bdNFh1t4zvTKHzn5uLlTEJutyu2apLypF0R9Pl/q9alf66XdKBJZwfkaYlYgcM Emzu6IjgOUbvnAqB0FksMvaFqZrdjq7roo9Cgiuo5raPeK+CBnViTBHi3RPY3eV4UPq/ JtVRcw3U9lpNHybzjBpouPqRdTZiAjPQ7wt9VSQiIJXnH1ptVHeyGUBpFf6vkmw07jGg lw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd3y-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:13 -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; Wed, 26 Apr 2023 00:44:12 -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; Wed, 26 Apr 2023 00:44:12 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 824315B692A; Wed, 26 Apr 2023 00:44:07 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v4 04/10] octeontx2-pf: Increase the size of dmac filter flows Date: Wed, 26 Apr 2023 13:13:39 +0530 Message-ID: <20230426074345.750135-5-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: Kb2ljLuusynSal7FY-CrA3xPYxQk8qu4 X-Proofpoint-ORIG-GUID: Kb2ljLuusynSal7FY-CrA3xPYxQk8qu4 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224809277955493?= X-GMAIL-MSGID: =?utf-8?q?1764224809277955493?= 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 26 07:43:40 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: 87703 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp77105vqo; Wed, 26 Apr 2023 01:04:18 -0700 (PDT) X-Google-Smtp-Source: AKy350aotdBKYH/qJ8NA0CiIa9JQLRHOwVo7j9ueBc9g29DX8DMyE/I/e4JcnZw87aGv+NRSK/IP X-Received: by 2002:a05:6a20:43a8:b0:ef:7d7b:433a with SMTP id i40-20020a056a2043a800b000ef7d7b433amr21157009pzl.47.1682496257683; Wed, 26 Apr 2023 01:04:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496257; cv=none; d=google.com; s=arc-20160816; b=GyOt04oH90pxOygGTh28s5OeX0MGGnCMMxrb2P9orsevJgPpmuyOpxLXSP/4GYuEZT wBvw91zpUVWt35djZk7v/VpLBi7My3aWwXpHd4Fun2qf2l8fXsE7rqFgZUSIWO3D7FCr ud3Iv8r97uXSFRa2T+3r03/XN4ihut8/OtICGjHgRyAYWiXq5UYRBcvH/X1rH9gsTybs iZOAGyFQ0EWnD+M2Kc6yijf/ZCK6O8fv/sU+VOFth8lHsAJPzi88gDRf7Ia7nTcoupen zxU02S2A+UDCJt1m27c5esQs4qQPSYwH3laMoKahtn0eFWWEkXg2bvgM/h80i9IVVgGM 8Oeg== 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=sjai+vUqw9ybhTvEpsnxGWh6E5NzLYqXg0jM6syJA3IqSHEVLFXYBe+8KObkESCoPk fvoQ1hFyqNTXv0ZYOaQh6pTj/k8oKfRyAeJtV6vRBvDQfiCWIjQjnJdrDPIIkFXAC8IT IACVVRJbxXYTmM9pTpHCIiVBlBhvLHuK7yWAHyNFWp8STatuxZiydTjw/ox9MBVcJxf/ EVqraK1FbGJ5WuQOzkhzgjm2YufIapz2StaN3+TmN7jh4dAqr17KFJoTiK39kxdx3Pez H1ni3hM7nlUn5GQcAtEcvxe5Sv7SRqjau50xZfKY3235qKLHkERE13PptnzFR0taMmUf CsYw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=bt92kZVL; 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 u71-20020a62794a000000b0063601bd1cc9si15712244pfc.321.2023.04.26.01.04.05; Wed, 26 Apr 2023 01:04:17 -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=bt92kZVL; 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 S240088AbjDZHpO (ORCPT + 99 others); Wed, 26 Apr 2023 03:45:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48030 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240066AbjDZHor (ORCPT ); Wed, 26 Apr 2023 03:44:47 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 04B633C1B; Wed, 26 Apr 2023 00:44:27 -0700 (PDT) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33Q6dCGb010011; Wed, 26 Apr 2023 00:44:20 -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=bt92kZVLyGECuQdyM2WzNz9BgPtaSJyDCQ3sjDBMcU2KtHxxm1Uj/UtKOdd7I5MZVPEC LWc50wjwxfmVnhSP7GSdj2g/vdm4oOaYPVn1oai5S+cAueeRUTIA9Qklrj5WDyK+ZxN2 qOL9kH53CvTH+566QKxfM99TarvfCOXJMghc0e0tSNL5aFp/be3fPTiPqTcYwoCdb2m4 YiqGY0g6LhzkCSHHb2YkB9vbqe9UaZ6hpHUTEOt8eTlt40ZVTvIKxcuSjr42f2Ur51mK jZ/YmTr3Mgj+ZX0cE9149Dn1xAW8jYkDYjMq018kmUPmRLnzhW+CYMsfB2bLMhYvBdH7 wA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3pdm9q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:20 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 26 Apr 2023 00:44:18 -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; Wed, 26 Apr 2023 00:44:18 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 74E7F3F709F; Wed, 26 Apr 2023 00:44:12 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v4 05/10] octeontx2-af: Add validation for lmac type Date: Wed, 26 Apr 2023 13:13:40 +0530 Message-ID: <20230426074345.750135-6-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: 9wtrOEdNaYavy27z7Q4RGyBkY77NqSC6 X-Proofpoint-GUID: 9wtrOEdNaYavy27z7Q4RGyBkY77NqSC6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764225196170651464?= X-GMAIL-MSGID: =?utf-8?q?1764225196170651464?= 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 26 07:43:41 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: 87696 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp73562vqo; Wed, 26 Apr 2023 00:57:29 -0700 (PDT) X-Google-Smtp-Source: AKy350bVJ0l6ApGMdz7uqPQwfehiLlG97G7aPkhOeaDSVjK+tn6mv1nsK1O5hXcHgLGGlYuGVKTO X-Received: by 2002:a05:6a00:1681:b0:63f:3aac:78a6 with SMTP id k1-20020a056a00168100b0063f3aac78a6mr17930279pfc.9.1682495849233; Wed, 26 Apr 2023 00:57:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682495849; cv=none; d=google.com; s=arc-20160816; b=SGD0LcPsyMcfZQpVGreX1wPWRhw3JARtDMj+cf662i8sacboDGUJVhEM+BSlwgMI48 HT4AfwH5To/xFDpuRvdquiEal6i0JALBAEW4FEBIn74peQLMNUsS7cmttpu4p9IZdt+i J10pXxAhzxytp27sbnnerSAraciG4vKjydnXOY/0TfrTwzKSioqgWX+BeCKLJ2cxd+jW IWHFlxZLzGXyLT/znl7Ae7IJjZZixj40mp9zi31EutQziO7/VCw8yq3Ln51POZy0Mkdq lPGohq72R3HSNsJTRHDaaEVWlUM4RYlEKb8obl43IsWMg/jP1DZGuVXTVeX2paLbNH7i XAjQ== 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=y7BqRfxAGON2uQRPNSUHRPPchooa/NNy2VHCO8FFsmW0cEvmYmFtASS0Xzv+0hB460 s7MR6lJL2FFGdQsoV+J8sdJ8iWYRBSaQ6Bfmn3hJCZ4TYnemJ9sW7WrxaLn9MFEoSfZF eSocwoyqi47vtwKxSsRgmPjntcz/maQ/LPC1NUQfpWthgqQaxidK1buE8MabgDRNfFCv kIHtTHncXwobhju7ZbWL7ZJEKxog/uZYt8mIQ+5u4GGsdBnX55mdpQYPj28/oDEsIjye vZK/hQarwbcAnMW+1dKGUi/tNX7G/QmF+GyNBpwHpNm85qovkzAny8138VtHOVI5TJyD EGSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=CYW4UEhK; 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 p10-20020aa79e8a000000b0063b7ab0b1aasi15984676pfq.242.2023.04.26.00.57.14; Wed, 26 Apr 2023 00:57:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=CYW4UEhK; 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 S240125AbjDZHpS (ORCPT + 99 others); Wed, 26 Apr 2023 03:45:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240093AbjDZHou (ORCPT ); Wed, 26 Apr 2023 03:44:50 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E94D13AAB; Wed, 26 Apr 2023 00:44:29 -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 33Q75YDp012965; Wed, 26 Apr 2023 00:44:23 -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=CYW4UEhKR1tyYydOiw8f29CDcJjPYLdr2z32PlfjHRJR1Qg0IfHK+IAwfgn8ewBPQiN2 QvE7y5LRLIVI8pmZptgS9Af0dcCW3xrIuDmXbB6rXRRSjsTrnB7SwfL/FXUObdhIP0ts 0Bby6z5NIuywpH+GaBYQnkbHr5muPA8+UfzWmSbj1VtJ2etcRww6tvDdTgmBWX5rnZvA YDqbC6xkYdUQH6B/OT1MMutWZs5d9ehP3b4RWR6Fsq8OnTy8r3uj28RodH6xqtwpRx1X We4b6NPqqsPhdNRoKReW2emCeaxwwrK6SOy/z07C0se65pTBpsgV2eXVAPCUqRSPKBov IA== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd4f-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:23 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 26 Apr 2023 00:44:21 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:44:21 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 235455B692A; Wed, 26 Apr 2023 00:44:16 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Suman Ghosh , Sai Krishna Subject: [net PATCH v4 06/10] octeontx2-af: Update correct mask to filter IPv4 fragments Date: Wed, 26 Apr 2023 13:13:41 +0530 Message-ID: <20230426074345.750135-7-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 1JXJAv1ZH1Ck31ZKlhiSvcgWjlE7kbqL X-Proofpoint-ORIG-GUID: 1JXJAv1ZH1Ck31ZKlhiSvcgWjlE7kbqL X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224767647646011?= X-GMAIL-MSGID: =?utf-8?q?1764224767647646011?= 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 26 07:43:42 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: 87710 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp79955vqo; Wed, 26 Apr 2023 01:10:46 -0700 (PDT) X-Google-Smtp-Source: AKy350YtgzqTG3bOd0N643cstOGfTmQjZzd6uh1GJZx53snqkVTqp2vcPS21+Z41hbLy6/dhr3Va X-Received: by 2002:a17:90a:3487:b0:240:9ccf:41ff with SMTP id p7-20020a17090a348700b002409ccf41ffmr17426199pjb.49.1682496645940; Wed, 26 Apr 2023 01:10:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496645; cv=none; d=google.com; s=arc-20160816; b=qAp0zNu65aUinswm4MBrM7s2LndvSyp5EflyL105KpFbBApLawpcAzcUjMM7MQYLhC +gXwbZVBpeZ9eKYBmE8LVwgYZa16eLw4879TGa9lt2BKbePOSgaAXo52j39jV08mgVPB ihEYaoDkMyrfuoiBMzzj2ZmDQxhbJpeFnL34z5oqcMiT1ipBJj2P9NsRxVfRv0XH91G2 N3AuuX1kX8SdOi4G6H5pmCkywEpl2ge8cf471ULWQsfh2wWKsYfcNIfqEE2uUJUPoBvG IYAXOGqmjEAf2vOexXWrixz0s1fQYJUqiz4BWpSu6ujl8ffEy7gGTMK5/620vix4iFUE eAwg== 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=O1V9lezV7kH9mhYDlZwG3qcnJe2KQArGF4x9iHZuphs=; b=WJNvJvWie9VO5E+96+jetrGGoOAtl9M9Aw6bXpwMTMU72n7QFjeOYWymcAJVKG2tWI jJVRhJj1NYeSGZ8rkf8CtnvqEEr92L38hekkvlW0mLzuqlrvdrtbKDEyBFVh/UXokbry Zc+TbKujFJOAj42Urd9iM6aRIJMItEzVlp2LMZsJ0h5dL5ioxeIJvQdumbtNkAyToLic /qwCtqD7ImHH1ADvhywUUIEJXzk7cAGSoHLLOpyXcpAapmgregUT6mRdNTzfyCeeGr6b zt/4rNsE5qmBrHUGwR0U/2jCJRbhVWjJ60nQBx+9WM/uccvIjLn0G9gnAtawe8Uq8OKL +pfg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=R89IIF17; 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 c36-20020a631c24000000b00513af3211cfsi16058887pgc.453.2023.04.26.01.10.30; Wed, 26 Apr 2023 01:10:45 -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=R89IIF17; 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 S240139AbjDZHpf (ORCPT + 99 others); Wed, 26 Apr 2023 03:45:35 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47558 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240031AbjDZHo5 (ORCPT ); Wed, 26 Apr 2023 03:44:57 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56D6D422F; Wed, 26 Apr 2023 00:44:34 -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 33Q6qLYg013102; Wed, 26 Apr 2023 00:44:28 -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=O1V9lezV7kH9mhYDlZwG3qcnJe2KQArGF4x9iHZuphs=; b=R89IIF17iUj3YFKN9uhzy5hVNM05LTNne95eYxvbiQm+yLpPSZt1XZKR9kvfgyPrEuzs jHkGp4W4bx6s6AHf/7DC0eQqrRoc9oG3/VxmD5lW6D7FWuigoF+9o+uynQue4ziilcLf nQyUDyMTUG+KdiZJ9AhImWQv6FPLe4w+9UemSg12tETc9D/V5kYnhhONr72WUQ6JICtx M9VkspxqKuXDptcI3faY/ioyi93Xm0V4oiWQ+/8+iwtAK7SH84v6LRErx/2EHLLjc7gR Acc5Zrt3m33BdseSfYZSXQ9vROTvNdprPtuVH4vLiLGLHP1skhb/Bphx/tATd2J888a7 fA== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd4p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:27 -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; Wed, 26 Apr 2023 00:44:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:44:26 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id 0739E5B692D; Wed, 26 Apr 2023 00:44:21 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v4 07/10] octeontx2-af: Update/Fix NPC field hash extract feature Date: Wed, 26 Apr 2023 13:13:42 +0530 Message-ID: <20230426074345.750135-8-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: 0S_utFBx1-5y1rp4cvp5rGWflCx9lK7i X-Proofpoint-ORIG-GUID: 0S_utFBx1-5y1rp4cvp5rGWflCx9lK7i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764225603034307809?= X-GMAIL-MSGID: =?utf-8?q?1764225603034307809?= 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 26 07:43:43 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: 87702 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp76622vqo; Wed, 26 Apr 2023 01:03:24 -0700 (PDT) X-Google-Smtp-Source: AKy350ZRUoZhI9ALgHPaDygLaTwcjfBGvRcysE81APCsyY+HrdPHL4AwCU63BZxGJqweuPa7w0PD X-Received: by 2002:a17:903:41c6:b0:1a6:74f6:fa92 with SMTP id u6-20020a17090341c600b001a674f6fa92mr25211252ple.19.1682496204105; Wed, 26 Apr 2023 01:03:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496204; cv=none; d=google.com; s=arc-20160816; b=k6ZrYSb8LWtCcz0a9g/DSXoGQ7IkpTzDv/IIQ84MHBcXpixenxm5l8LjSoyU7Ok1XX DrYbPE94jDj7n7LUnyE+6NQFWpKphepfO0YAhQpxNMJ7K3mQbnOxDl9b7A4gl3DXDgTm lM/uSzKmK0dRFrugFoOqSIuwIrF4znO1bV/uVYrL1PdCt6PltMnyKEWZDxs1uJ1mfbrd RDsRo++GWhLiWFHQG4dDTt8eUqVkJ7S2OBNCwedLE9IGlx6wsT0Cu6YCj5zjaFmUk7Cp DeTAy6xpy4aoH3f+bBBlea9INskEkNY6VsCAl+X5Y+l4BZo4xCciutbQgIevG3nQIshC F55Q== 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=OsrEqUhvjSXhCe4JLbW2Ai9IhBGYHEXxlGPlVSn4gL0=; b=OAGS9rZVmsa1LyViDjr0v+sMl1zNtrUiAvNBclKdyWfL1Ye/0vpdt6LS5V0KUyvhsU ZPN51TxuaBWEhIKg5SxYIyfIWwIEZkw8tbvAyAi2gUVVE2Yv1ezEo+B6Q15tpAMs7guh kEUfUiI6IjsgDtznceLSJeDIijcroGj5t/kyXksrJ0Bt3tczatYeZJEi1d5d1in8niEM /P+kyVYGAR6uSJ4EQ+MNuNQ1fT9hIlsVAqb6CunU9ADacDd08J1nQamoKjJnIuKERXmn RoaWV9yCW6HiRvDnLhQ3i8z6CMfjPVSgoz8Bm/keWd/ffhBJcIfM6FGUbjihCWsBJxEB 1cNQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=QnRPrqqc; 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 t14-20020a1709027fce00b0019a730571dfsi15598706plb.394.2023.04.26.01.03.11; Wed, 26 Apr 2023 01:03: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=QnRPrqqc; 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 S240043AbjDZHpp (ORCPT + 99 others); Wed, 26 Apr 2023 03:45:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240098AbjDZHpG (ORCPT ); Wed, 26 Apr 2023 03:45:06 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB6633AA2; Wed, 26 Apr 2023 00:44:40 -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 33Q6nnsY028636; Wed, 26 Apr 2023 00:44: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=OsrEqUhvjSXhCe4JLbW2Ai9IhBGYHEXxlGPlVSn4gL0=; b=QnRPrqqcI4bkuFmoYxkKjQQTxjYIWrMG1MmTVetspLof/4o1FEPPzeE6KEihiZC9y1PM k6okn2yS9iaowK9BcAwv7nSi64UOlX2rJO3jN4fXbRXK1cWfMo5Q6kRnHbPQ1IeRkw1y e0QxhY37rL4ybZywuBbTEGhCyqWxIMDTlz4uQBJP7X83b9r+yU4S4qmT7DtRoI/8JnS8 98kfDV+IXbmoBFLFWhsaiwzVkBIWge7BfmZt88CzQOVUoDMkpAdoDenAHyJwrA4fuwX9 oUgUD3FPQ3jhFnFM49umFdVoQjAfIPFmGS0S+6FkOgmg8VGj8n18fsBPsleTHP09oNS7 hw== Received: from dc5-exch01.marvell.com ([199.233.59.181]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3q4f3pdmad-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:33 -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; Wed, 26 Apr 2023 00:44:31 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:44:31 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id E0F893F7068; Wed, 26 Apr 2023 00:44:26 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v4 08/10] octeontx2-af: Fix issues with NPC field hash extract Date: Wed, 26 Apr 2023 13:13:43 +0530 Message-ID: <20230426074345.750135-9-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-ORIG-GUID: vx-EKqnvIa-dFdjnWZy0cNng4i5_thCf X-Proofpoint-GUID: vx-EKqnvIa-dFdjnWZy0cNng4i5_thCf X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764225139525769011?= X-GMAIL-MSGID: =?utf-8?q?1764225139525769011?= 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 f15efd41972e..952319453701 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 26 07:43:44 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: 87712 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp79981vqo; Wed, 26 Apr 2023 01:10:51 -0700 (PDT) X-Google-Smtp-Source: AKy350YmBEIBcims2jSn8mfb3WfwFd7Qig/rex7j+WQF3MIYKGvBbTm3G11DchTjS0A4BuntbGYK X-Received: by 2002:a17:90a:6447:b0:23f:a4da:1208 with SMTP id y7-20020a17090a644700b0023fa4da1208mr19362709pjm.39.1682496651229; Wed, 26 Apr 2023 01:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682496651; cv=none; d=google.com; s=arc-20160816; b=WW7iaidEW5jLc9HXc6TRMeBDF1gfUE1AugQpRNzlr2xmHTw/sF4n7l/AQsOKRawguo /kxCrMgGeRwOM1ode1dNdejfeie3JVuXpAnhkfhYg0xletKNh6N1GQmafSomsKrCLE/f 61y+AEBI0/4lzFn8cnBPbPuN8kGN+jsnjwkF4h1nM6ixEItm5HvWdCPgiI/wxFMF39H3 AF1vbvNabpV7tBw2kornOxETt710A7/+dpuM0RLRCd/fQRUwNJerHhE/xPzGwBqJspKx 1rpndxvmkvHY/I3vNoyTfHxlp+3BVhr6V3IqKAVaxOhfaQ6Jt7t8rQmJ/t4xkR7FQjx5 xtRQ== 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=xKgGYL5KkxCtvOyFZdXDawIBtMlQrhDYmS6la3p2gVI=; b=sJQ6YzooB7yQPxrTj9JQ0Yv1Qt0n/pEugst6E73reDhxo2HxlGPEW8SrvKD0b/ZkKb aFL4NG0oWkVVNceZo4Rlnd8a4XcwZW7fpy31LmlNjPamdV7e82jZVP1bknAafaLg5NSt j1fBTG9/KXQYh4Y07G/qijtrFz7lSVJpPBzGTsJ5gFiOiiboDkUS7SV5AaPVRhFf8pQW 5chlxsfbOZnD2Ayl6qdK1EF1JCbd71kuSGuZM+dmrBUM1wlU1BzgT/zho9GHeyP5o5Lz Dl5WqI4k3IvaSpszhzr2zIFJHr/GYuGIsAJKEjw8wfA6oTHiWZORYH67PnUIZF2YhzA0 Xv5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=TChv5F+K; 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 p13-20020a63c14d000000b0050c0305bcc3si15510289pgi.872.2023.04.26.01.10.36; Wed, 26 Apr 2023 01:10:51 -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=TChv5F+K; 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 S239752AbjDZHp6 (ORCPT + 99 others); Wed, 26 Apr 2023 03:45:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47618 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240042AbjDZHpL (ORCPT ); Wed, 26 Apr 2023 03:45:11 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BED594499; Wed, 26 Apr 2023 00:44: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 33Q75YDr012965; Wed, 26 Apr 2023 00:44: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=xKgGYL5KkxCtvOyFZdXDawIBtMlQrhDYmS6la3p2gVI=; b=TChv5F+KPifaEGHpR/4jkc+VBYDdqfwJ23PM+pldf4OPPRXMBYwXfLMr3YdpXY6Punww 684fScaRyq5/DVzZi+HSy5VfjwEkn7vlhmsk7fsYh+sZ9jEt7ti7xicVke571qutAvVT dKuJQ2XYj/MFaXfUcdkA/Cjn5EvkVg2m3ztzuLZlR0ihS4UbK1jI69/RDhphn8FOh2zX Lci6sHE5+pG7ZJ0cS7XFyyToj++5VXuRC3JVCc2YcV+m85f5NOc3veDioED84nS5P8vB ADyksoZQ4uU7a2uSUGob9coiivAh9Xgmn2gLBJs7Su9mUYQIyv3nIlslOLLrmAVt0Q2V mQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd59-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:37 -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; Wed, 26 Apr 2023 00:44:36 -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; Wed, 26 Apr 2023 00:44:36 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id C76B45B692B; Wed, 26 Apr 2023 00:44:31 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Ratheesh Kannoth , Sai Krishna Subject: [net PATCH v4 09/10] octeontx2-af: Skip PFs if not enabled Date: Wed, 26 Apr 2023 13:13:44 +0530 Message-ID: <20230426074345.750135-10-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: ovf8VffQH8M66mcovGBFZe4BkVTPmgK9 X-Proofpoint-ORIG-GUID: ovf8VffQH8M66mcovGBFZe4BkVTPmgK9 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764225608148696703?= X-GMAIL-MSGID: =?utf-8?q?1764225608148696703?= From: Ratheesh Kannoth Fiwmware enables set of PFs and allocate mbox resources based on the number of enabled PFs. Current driver tries to initialize the mbox resources even for disabled PFs, which may waste the resources. This patch fixes the issue by skipping the mbox initialization of disabled PFs. 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 | 44 ++++++++++++++++--- 3 files changed, 44 insertions(+), 8 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..242089b6f199 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,12 +2349,33 @@ 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 = bitmap_zalloc(num, 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) + if (!mbox_regions) { + bitmap_free(pf_bmap); return -ENOMEM; + } switch (type) { case TYPE_AFPF: @@ -2356,7 +2383,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 +2392,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 +2423,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 +2445,7 @@ static int rvu_mbox_init(struct rvu *rvu, struct mbox_wq_info *mw, INIT_WORK(&mwork->work, mbox_up_handler); } kfree(mbox_regions); + bitmap_free(pf_bmap); return 0; exit: @@ -2424,6 +2455,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); + bitmap_free(pf_bmap); return err; } From patchwork Wed Apr 26 07:43:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sai Krishna Gajula X-Patchwork-Id: 87698 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp73751vqo; Wed, 26 Apr 2023 00:57:58 -0700 (PDT) X-Google-Smtp-Source: AKy350a4AuKyfyQBL2XJzImXOc1pmqjHLo0tJp/DQwYGSIGmRp4D/n8tPjq1hvAk7O7l8jyhaLS9 X-Received: by 2002:a05:6a21:3981:b0:ef:4c65:a58f with SMTP id ad1-20020a056a21398100b000ef4c65a58fmr21143308pzc.47.1682495878537; Wed, 26 Apr 2023 00:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1682495878; cv=none; d=google.com; s=arc-20160816; b=u2C/zgggmRJsPjf94r8eYijn6hrnDbj4KMnMlxljgDgWiU5K2jpKf591JsumyvULzX GRbjGWqV2BfneIihTWp0ZjMGPM+0aAZnNMwtIZKhSL4AiddsY24PP7vrfLhaCWFMwXly kz8W4gKWSGSG+uo5sazx7ZM0dtxHjhaZy/NAx/la4bfmlDIDw6TfhjYypqg+6eSo4QXg 6T6qwvFI6KKFDVmu0daivvv3//uhvyuE0o8RCa0QcYUSyh17hQ+oHpU9ZHszQPEh8/SH L8UX2VMJunh3cXzdytDJWhge5/n5nIa/prTjhRo2g2uRfdIV0cBhq6wPmEW86xvMR8/h bDDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/OSKb3SKDtB9cUTdDUWXgHxcUbuNAUOnTVSGX+DHPvY=; b=ucbX+Qx/weAd9WaPg+S8+CJrNQ2E7wVpfBCYVLICM2aige6BqWWY2fjGo1cZr5/dUx Pq0xINLSWZx+oGE/laBEO5oCLlFYZ0Lk4PQRnx4jtpNZin4qczb+Zjtt40RSXrbmLUkJ VLc4SMOjxif92B0vwOgOOle22xBZZx4gzgPjjM5mL4ubzzP3MX1w6rkPCHTPNg8xnFq1 ZBIZ5n/XcuLI2ZQPnpqFthXW9FCN0aR8Uxw+XZiSQnla1280GK9xlBDqaDCKe6HCe4a2 rL5/BYSNKyajnzFj7gEPP7CcbRFLCIIjWPqcIlaiq4F712BPvrIvEEDkmwJBzA9n8b2V zgvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UrYfGMNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id g29-20020a63565d000000b0051b36b15cbesi15177926pgm.214.2023.04.26.00.57.43; Wed, 26 Apr 2023 00:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=UrYfGMNI; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240095AbjDZHqF (ORCPT + 99 others); Wed, 26 Apr 2023 03:46:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240113AbjDZHpQ (ORCPT ); Wed, 26 Apr 2023 03:45:16 -0400 Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 037DB4209; Wed, 26 Apr 2023 00:44:48 -0700 (PDT) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 33Q6wV47013403; Wed, 26 Apr 2023 00:44:42 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0220; bh=/OSKb3SKDtB9cUTdDUWXgHxcUbuNAUOnTVSGX+DHPvY=; b=UrYfGMNInbeN6u/460CTsEEmm7irlg9N/4rRbD+61kauIkiRxslz+xoFx6kazehlsmRh xqjz8wE0CrPRzgyiMD6wF6GwpJBRV47JchNyGxxzIIrdlOdWcUduCTlBxI7b5XUbsKvf wf5ka6ytUlG7UaD8ytNlpTrkeBRhO3hP1l4QJARMtkwRRE7+ZAOpP7pncRSGLi7cS1u2 n7nXqnXAOJPQaQgKb55k/dV8xxkeGLpLa2sAKfaUbRL1iNDb8EBP2k7Z+vaBD7Xm+EgY PInYp6WEtCtMCeYP5EXiMxvaDV7PVOm9xUctfcVxohQhtpE9elIBIecTN0puAShaUHwm Bw== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 3q6c2fdd5h-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 26 Apr 2023 00:44:42 -0700 Received: from DC5-EXCH01.marvell.com (10.69.176.38) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server (TLS) id 15.0.1497.48; Wed, 26 Apr 2023 00:44:40 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH01.marvell.com (10.69.176.38) with Microsoft SMTP Server id 15.0.1497.48 via Frontend Transport; Wed, 26 Apr 2023 00:44:40 -0700 Received: from hyd1425.marvell.com (unknown [10.29.37.83]) by maili.marvell.com (Postfix) with ESMTP id ADBBE3F7069; Wed, 26 Apr 2023 00:44:36 -0700 (PDT) From: Sai Krishna To: , , , , , , , , , , , , , CC: Sai Krishna Subject: [net PATCH v4 10/10] octeontx2-pf: Disable packet I/O for graceful exit Date: Wed, 26 Apr 2023 13:13:45 +0530 Message-ID: <20230426074345.750135-11-saikrishnag@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230426074345.750135-1-saikrishnag@marvell.com> References: <20230426074345.750135-1-saikrishnag@marvell.com> MIME-Version: 1.0 X-Proofpoint-GUID: GvYrQf01OeKtEyhVDRk2FHAL1h1G8aol X-Proofpoint-ORIG-GUID: GvYrQf01OeKtEyhVDRk2FHAL1h1G8aol X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-04-26_02,2023-04-26_01,2023-02-09_01 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1764224798267285956?= X-GMAIL-MSGID: =?utf-8?q?1764224798267285956?= From: Subbaraya Sundeep At the stage of enabling packet I/O in otx2_open, If mailbox timeout occurs then interface ends up in down state where as hardware packet I/O is enabled. Hence disable packet I/O also before bailing out. As per earlier implementation, when the VF device probe fails due to error in MSIX vector allocation, the LF resources, NIX and NPA LF were not detached. This patch fixes in releasing these resources, when ever this MSIX vector allocation/VF probe fails. Fixes: 1ea0166da050 ("octeontx2-pf: Fix the device state on error") Signed-off-by: Subbaraya Sundeep Signed-off-by: Sunil Kovvuri Goutham Signed-off-by: Sai Krishna --- drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c | 11 ++++++++++- drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c index 179433d0a54a..52a57d2493dc 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_pf.c @@ -1835,13 +1835,22 @@ int otx2_open(struct net_device *netdev) otx2_dmacflt_reinstall_flows(pf); err = otx2_rxtx_enable(pf, true); - if (err) + /* If a mbox communication error happens at this point then interface + * will end up in a state such that it is in down state but hardware + * mcam entries are enabled to receive the packets. Hence disable the + * packet I/O. + */ + if (err == EIO) + goto err_disable_rxtx; + else if (err) goto err_tx_stop_queues; otx2_do_set_rx_mode(pf); return 0; +err_disable_rxtx: + otx2_rxtx_enable(pf, false); err_tx_stop_queues: netif_tx_stop_all_queues(netdev); netif_carrier_off(netdev); diff --git a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c index ab126f8706c7..53366dbfbf27 100644 --- a/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c +++ b/drivers/net/ethernet/marvell/octeontx2/nic/otx2_vf.c @@ -621,7 +621,7 @@ static int otx2vf_probe(struct pci_dev *pdev, const struct pci_device_id *id) err = otx2vf_realloc_msix_vectors(vf); if (err) - goto err_mbox_destroy; + goto err_detach_rsrc; err = otx2_set_real_num_queues(netdev, qcount, qcount); if (err)