Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp38190473rwd; Wed, 12 Jul 2023 04:31:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlHhSRqVfFtqPJnKikDxI20d05iQWLrQEk7rUSfDZrPWcOrtMzXleNW6o/No7c0W7edlZ/UR X-Received: by 2002:a05:6a21:999f:b0:12f:d812:6a0 with SMTP id ve31-20020a056a21999f00b0012fd81206a0mr24213590pzb.49.1689161497283; Wed, 12 Jul 2023 04:31:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689161497; cv=none; d=google.com; s=arc-20160816; b=H3NOwnuZq7vmRzP8KeOS/tPi9D3r5Qh5I6OpDFlOMc0Gdn+tVu78APcst9sJV4gmf0 MBNEWVQB/VCXlIKFjCmf7D8sDXVfRvAJo5ihsX3l9BElGdXuCZiAKMQn/7caPq5N3bmG CFRV7IwrWVZQlt52Ba+5tHvSfAKcOFNKyZ3v2APLKydscH9UgiM3LXkjaCmIhGPJOK0n Vvg8xQvtXK2zJlhQP17X9F/7nMXjsfsKosJejoHXRriqokxLKUdHazCkQzu0ElKyW8l+ gNNNjbwxBDFQttCQehoKs1KNzL/JC9ea/tio2sopEguUSqnnHpOc604R6W9NGN5YDl94 lI7g== 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=xUKnx6fN161jpLFot1e+fBvz0wDK4Bch2yaHPEnIcBg=; fh=P++xfw691riK3V71V+oOPM9ByOJXBDKRnR1He1Iagmo=; b=QUgQX4BWi/PjR8dEt9jxQborRvrmmO8/Go9NyksWKMAeHyWHCKzqoakxgMnpFJVLfi 7yegkgTZe5O5Ps6E0QP0w4Ne5NIO5DMRPLESPCFWYjO/htPY1HEe2K+ZDQMlXopL8fd5 sPRXvH731ZyKgzAh8oDsKKmiYH8Fx3JtuoWNMhc/FNTV5rIMDtb8I407nOg3l1jaMzXc xIwID1XIzge5SwopTdQPVk/wysF1Buurkt7SuSHRR6HsMHFQ+2hCJtfUGoDH5OpGAwsF sWXLVcbfJNATU2sBJlqctNQiL20hPL3CvsAlB+/MStxg+0R3fI/jTUWRer3c6g6VFMoP EqVQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@marvell.com header.s=pfpt0220 header.b=AIAMG8r5; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=REJECT dis=NONE) header.from=marvell.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p7-20020a637407000000b0055bda24a17fsi3059140pgc.541.2023.07.12.04.31.25; Wed, 12 Jul 2023 04:31:37 -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=AIAMG8r5; 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 S233185AbjGLLQ6 (ORCPT + 99 others); Wed, 12 Jul 2023 07:16:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46092 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233100AbjGLLQi (ORCPT ); Wed, 12 Jul 2023 07:16:38 -0400 Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6F2861BD4; Wed, 12 Jul 2023 04:16:34 -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 36C7dgeW018088; Wed, 12 Jul 2023 04:16: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=xUKnx6fN161jpLFot1e+fBvz0wDK4Bch2yaHPEnIcBg=; b=AIAMG8r5B2a6nbsirut8vhpYkkL6IqE/jI9sDKlz+HhSZGHSQgYbC4SyMOpNQP77oUXl kJiPq4XQ3y/tq8k62RmvLls02CaWcdFc8HGxhCS7Q8SuUnYYASwNkZz7k8jmlAtCu7bR fxkZ2w+ExZB1aK3SWod56w9XFxTb8fuYLwO+oIWHv1No5AFciaNEbrD13/+9PIJkPC9/ tohpfRvzvDbUSxQ3lhagLDqJHvC4Pc/5qQZzZR+tjEEKYt5mUK1qsAWMKnyxOPYdujgg vpUl8ik8MOVoev1unzabSEHFdlh8DGvg3kZIPv48kKvjaz6LZDL2lz0VZtES8R+86uLz UQ== Received: from dc5-exch02.marvell.com ([199.233.59.182]) by mx0b-0016f401.pphosted.com (PPS) with ESMTPS id 3rsb9ajs3q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Wed, 12 Jul 2023 04:16:28 -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, 12 Jul 2023 04:16: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, 12 Jul 2023 04:16:26 -0700 Received: from localhost.localdomain (unknown [10.28.36.166]) by maili.marvell.com (Postfix) with ESMTP id 6D3C33F7048; Wed, 12 Jul 2023 04:16:23 -0700 (PDT) From: Suman Ghosh To: , , , , , , , , , CC: Suman Ghosh Subject: [net PATCH 3/3] octeontx2-af: Fix hash configuration for both source and destination IPv6 Date: Wed, 12 Jul 2023 16:46:04 +0530 Message-ID: <20230712111604.2290974-4-sumang@marvell.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230712111604.2290974-1-sumang@marvell.com> References: <20230712111604.2290974-1-sumang@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: MB3GgW_nao3SPoxUZ2CUwREYB9pnWm0F X-Proofpoint-ORIG-GUID: MB3GgW_nao3SPoxUZ2CUwREYB9pnWm0F X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.957,Hydra:6.0.591,FMLib:17.11.176.26 definitions=2023-07-12_06,2023-07-11_01,2023-05-22_02 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,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 As of today, hash reduction was supported only for source IPv6 address. This patch fixes that and adds supports for both source and destination IPv6 address. Fixes: a95ab93550d3 ("octeontx2-af: Use hashed field in MCAM key") Signed-off-by: Suman Ghosh --- .../marvell/octeontx2/af/rvu_npc_hash.c | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 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 76553e0c216f..e7b71f2f3ad3 100644 --- a/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c +++ b/drivers/net/ethernet/marvell/octeontx2/af/rvu_npc_hash.c @@ -100,20 +100,20 @@ u32 npc_field_hash_calc(u64 *ldata, struct npc_get_field_hash_info_rsp rsp, 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 ? 0x8 : 0x18, - 0x1, 0x0, 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,12 +132,12 @@ 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; - hash_cnt++; 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 */ @@ -149,6 +149,7 @@ 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++; } } } @@ -169,12 +170,12 @@ 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; - hash_cnt++; 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 */ @@ -187,8 +188,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; } } } -- 2.25.1