From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id D9D4E45D7C; Fri, 22 Nov 2024 17:50:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 222354340D; Fri, 22 Nov 2024 17:50:39 +0100 (CET) Received: from egress-ip11a.ess.de.barracuda.com (egress-ip11a.ess.de.barracuda.com [18.184.203.234]) by mails.dpdk.org (Postfix) with ESMTP id DEC06433FE for ; Fri, 22 Nov 2024 17:50:36 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2174.outbound.protection.outlook.com [104.47.17.174]) by mx-outbound11-137.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 22 Nov 2024 16:50:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=b0DEEUcdIIx0O1aCSxfryow0x7ds1o8PbDsIWoD58ahDKY+N7HusVIqQ85Et9jPPpKUYt2LOgOP2FsvkR8+efniZJsWL/hlQedPdlmSmF+gQK9vcbQJKtIhTM0Tp2gy2uAlluuZ9qHwcZRtpcu93jfyNXBRZDm49GDGtpbiPla2ehlL0qtQmwQ1/kH8GyMo5gZKfK+nuBg2BbF+iWxz7hQ5gx+ccrEyZYXIUp/iXeVrtu4bSi6nDXkRcLvV4vRInTcD6LbesJed9eeu6R9VGhFSz5yEqMyhkexixCocACo/P91brd0pW91im5hiViWWRHSm4NvTzWEQ4iwYygFXkUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=31s73bMX0IpWAUApEqE0B/JsGOjyyr4mJbYNgYQhQ7U=; b=erW6VvixdILEmPjyE6i29ws5EFzGfaouRuk3kMJE5QsWQk45GSgE+vzVRdVjZHsifwHnhtuTW+jGOsRrWuxgs+DarhxiEJFGtyESixECbSu50CAN8bBBzlJdQu2EpSqlxE37HyAae8szhj1FG3CQxy3KYeNdewXzSDoFMvCDeKmXKwGau3XQmCdKJgxrYV+9MkIZNh1F6zWFq6eYGCxFR/jCQ+mX9lfmr8WAoPOeuNphunbyAGPG/p+uKWu8YsXZy6FcB97Jt4EiPjQPyWxx9r2s5MzVb8kpLzc+bFiApCy31w2w+7WacNqj8nkGbhyWgzkCa6+EiRa8Pmy39hGc0Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=fail (sender ip is 178.72.21.4) smtp.rcpttodomain=dpdk.org smtp.mailfrom=napatech.com; dmarc=fail (p=reject sp=reject pct=100) action=oreject header.from=napatech.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=napatech.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=31s73bMX0IpWAUApEqE0B/JsGOjyyr4mJbYNgYQhQ7U=; b=W7ProRtBSmPyeBxdvjDY9h6y/3sjtXxgICkKnWzWG7YcZjBYvSbUah9fReItBw4iUOLbKOtcq+FYe4NehF9UtKuM+aHd76+orYypCg3ak4DIAshLb/sAjnt8N1ITe4IaHWDahnt5Z8LI4CmGli7D7K5VThRPIVx7ahvZl+pOe/M= Received: from AS9PR05CA0034.eurprd05.prod.outlook.com (2603:10a6:20b:489::7) by GV1P190MB2112.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:17b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.16; Fri, 22 Nov 2024 16:50:29 +0000 Received: from AMS0EPF000001AC.eurprd05.prod.outlook.com (2603:10a6:20b:489:cafe::80) by AS9PR05CA0034.outlook.office365.com (2603:10a6:20b:489::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8182.16 via Frontend Transport; Fri, 22 Nov 2024 16:50:29 +0000 X-MS-Exchange-Authentication-Results: spf=fail (sender IP is 178.72.21.4) smtp.mailfrom=napatech.com; dkim=none (message not signed) header.d=none;dmarc=fail action=oreject header.from=napatech.com; Received-SPF: Fail (protection.outlook.com: domain of napatech.com does not designate 178.72.21.4 as permitted sender) receiver=protection.outlook.com; client-ip=178.72.21.4; helo=localhost.localdomain; Received: from localhost.localdomain (178.72.21.4) by AMS0EPF000001AC.mail.protection.outlook.com (10.167.16.152) with Microsoft SMTP Server id 15.20.8182.16 via Frontend Transport; Fri, 22 Nov 2024 16:50:29 +0000 From: Serhii Iliushyk To: dev@dpdk.org Cc: mko-plv@napatech.com, sil-plv@napatech.com, ckm@napatech.com, andrew.rybchenko@oktetlabs.ru, ferruh.yigit@amd.com, stephen@networkplumber.org, Danylo Vodopianov Subject: [PATCH v1 2/2] net/ntnic: fix of Toeplitz key and log with mask Date: Fri, 22 Nov 2024 17:50:22 +0100 Message-ID: <20241122165023.387393-3-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241122165023.387393-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241122165023.387393-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001AC:EE_|GV1P190MB2112:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1bab40e9-3e27-4346-9e55-08dd0b15c5a2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024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rJaCXokilDpZOQspbeBfteUbAXsNHJkptkRt1FtCFQ7sMg0EnO9zpOxf?= =?us-ascii?Q?R5H7O2jjFSCf9+lJVswziXgAek+6SVN5t7kREKbguRlQdxaE/u9O2UczvT6o?= =?us-ascii?Q?fTaBNqfuPCk8H5mZuVfvEjE7sCmKJc7zcQa6iDWB9w0lGf11xfbsJdVnmG5+?= =?us-ascii?Q?bOOd+ltvKS6QOz7LIEfpG7RkSJ0mptPt1obzMjQRl5d+zmBKFv/p1DjSrpjM?= =?us-ascii?Q?nE4Hdc4uEabXtr5xqYdS2g1AfpfqaBILaQhBZ89pFF9NCM6MamB2BK5+8x0X?= =?us-ascii?Q?c1OQFvo+4VkKMyTl1EiuGlGKhXVEZgiVxdS5XvtTrxWikRRXC7qADOBgD8tb?= =?us-ascii?Q?IUqyN1dcnP0B2b3e+5ZjWr3R1FrdJQJaThTkrh+hDi+EfsoW+8HCd7Emg5UN?= =?us-ascii?Q?mXO8yba51dAhjPeFt5zv1TSnyZC8csIXr1wPKasv0UFS5rOWK+Z9iIuAJMOC?= =?us-ascii?Q?nIVvvIMbruD4UGxVYUWK/GM1nouUPAmhvnSwISPQdaLWpvcA651sTrISDIrn?= =?us-ascii?Q?1MPoWWX5xauztxEE+qKC7roh1EbRDjjo2rO9d56wddRlDIP9rZp1f8O5DX22?= =?us-ascii?Q?jHffQQWXmiVXKmt16cDrgFxTPBhDZOfR?= X-Forefront-Antispam-Report: CIP:178.72.21.4; CTRY:DK; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:localhost.localdomain; PTR:InfoDomainNonexistent; CAT:NONE; SFS:(13230040)(82310400026)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: +oZbPJ5RVy4aQvjQ+9vyodHcNZkqxuiX8MBIF99EjTqzOYKaM7r2WtlJWdyEeF1QF5tgG257j2mZGyOk3hMqIoqGJpAA8Gd6XNg868EhyGIIaafbqQ+gVbO+H8bfZoYdoy9m/UruQo09s6MGTEbms5ca7rFnPS85J33fMW26KmuSyTGapJxcYzECLovsmffcuSVk7AhbQhrtEd4qkKDOpr0v6JLdfviqnMrM83cs+dNL2yHz3606R1iRGlkocGCQDgAoe6WdnkdjpWCQXu3slMvLai90JVHAcIshC8BU7I/FiE60aJJv830MVrkx6/BS/2+pu82UIA6g5nxFeR5q+xh3KTrlT3BFuLSPPqmhAVvlwFqz4LDOcUx9pet18IGqXiVHyL2fAicu1hmSE6J/qI4qbcenJ6k13ibM4tsxQ0J94k/LEYiBbQ+D0PFe67Yry0I7JuOUBe98gaRv39HXljkd9Q4SvYttX4Pwfjt9MkY7pHNi6qwreYOl1PoFz+bNaVf1FjDfwsOousl9pjaz1Oz1yDHcsMnP94Q3K1bwKi1CiM6cQ1zLQvjcGCgFz/788HjZ7nKtfUl7OUlu/Ils1sOOwW+j8iuYo/8ZCnTN6txgP0QGdaSkuV8mEwBvAh4Fd+eQk6uY/2KJQWkRI7ou9sL27D43DIGm9HVCRqEN6vg= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Nov 2024 16:50:29.2278 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1bab40e9-3e27-4346-9e55-08dd0b15c5a2 X-MS-Exchange-CrossTenant-Id: c4540d0b-728a-4233-9da5-9ea30c7ec3ed X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=c4540d0b-728a-4233-9da5-9ea30c7ec3ed; Ip=[178.72.21.4]; Helo=[localhost.localdomain] X-MS-Exchange-CrossTenant-AuthSource: AMS0EPF000001AC.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P190MB2112 X-BESS-ID: 1732294233-302953-13358-42463-1 X-BESS-VER: 2019.1_20241121.1615 X-BESS-Apparent-Source-IP: 104.47.17.174 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmaGlgZAVgZQ0Ngg0cLMwtIiyS zNJNXELM0gNdHEOCXZ2NTAPDXRKMlCqTYWAGzai2lBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260604 [from cloudscan9-78.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.00 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_BESS_OUTBOUND X-BESS-BRTS-Status: 1 X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Toeplitz secret key word order was reversed during programming into FPGA, which lead to unexpected rss hash values. Fixes: 7fa0bf29e667 ("net/ntnic: add hash module") Signed-off-by: Serhii Iliushyk --- .../profile_inline/flow_api_profile_inline.c | 61 +++++++------------ 1 file changed, 21 insertions(+), 40 deletions(-) diff --git a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c index a34839e00c..fbe8ee2795 100644 --- a/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +++ b/drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c @@ -3825,7 +3825,6 @@ struct hsh_words { * is used for hash mask calculation */ uint8_t index; - uint8_t toeplitz_index; /* offset in Bytes of given [Q]W inside Toeplitz RSS key */ enum hw_hsh_e pe; /* offset to header part, e.g. beginning of L4 */ enum hw_hsh_e ofs; /* relative offset in BYTES to 'pe' header offset above */ uint16_t bit_len; /* max length of header part in bits to fit into QW/W */ @@ -3874,7 +3873,6 @@ static int flow_nic_set_hasher_part_inline(struct flow_nic_dev *ndev, int hsh_id /* set HW_HSH_RCP_WORD_MASK based on used QW/W and given 'bit_len' */ int mask_bit_len = bit_len; uint32_t mask = 0x0; - uint32_t mask_be = 0x0; uint32_t toeplitz_mask[9] = { 0x0 }; /* iterate through all words of QW */ uint16_t words_count = words[word].bit_len / 32; @@ -3883,27 +3881,23 @@ static int flow_nic_set_hasher_part_inline(struct flow_nic_dev *ndev, int hsh_id if (mask_bit_len >= 32) { mask_bit_len -= 32; mask = 0xffffffff; - mask_be = mask; } else if (mask_bit_len > 0) { - /* keep bits from left to right, i.e. little to big endian */ - mask_be = 0xffffffff >> (32 - mask_bit_len); - mask = mask_be << (32 - mask_bit_len); + mask = 0xffffffff >> (32 - mask_bit_len) << (32 - mask_bit_len); mask_bit_len = 0; } else { mask = 0x0; - mask_be = 0x0; } /* reorder QW words mask from little to big endian */ res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_WORD_MASK, hsh_idx, words[word].index + words_count - mask_off, mask); - NT_LOG(DBG, FILTER, - "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_WORD_MASK, %d, %d, 0x%" PRIX32 + NT_LOG_DBGX(DBG, FILTER, + "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_WORD_MASK, %d, %d, 0x%08" PRIX32 ")", hsh_idx, words[word].index + words_count - mask_off, mask); - toeplitz_mask[words[word].toeplitz_index + mask_off - 1] = mask_be; + toeplitz_mask[words[word].index + mask_off - 1] = mask; } if (toeplitz) { @@ -3911,9 +3905,9 @@ static int flow_nic_set_hasher_part_inline(struct flow_nic_dev *ndev, int hsh_id "Partial Toeplitz RSS key mask: %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 " %08" PRIX32 "", - toeplitz_mask[8], toeplitz_mask[7], toeplitz_mask[6], toeplitz_mask[5], - toeplitz_mask[4], toeplitz_mask[3], toeplitz_mask[2], toeplitz_mask[1], - toeplitz_mask[0]); + toeplitz_mask[0], toeplitz_mask[1], toeplitz_mask[2], toeplitz_mask[3], + toeplitz_mask[4], toeplitz_mask[5], toeplitz_mask[6], toeplitz_mask[7], + toeplitz_mask[8]); NT_LOG(DBG, FILTER, " MSB LSB"); } @@ -4632,11 +4626,11 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev, int hsh_idx, * word | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | */ struct hsh_words words[HSH_WORDS_SIZE] = { - { 0, 5, HW_HSH_RCP_QW0_PE, HW_HSH_RCP_QW0_OFS, 128, true }, - { 4, 1, HW_HSH_RCP_QW4_PE, HW_HSH_RCP_QW4_OFS, 128, true }, - { 8, 0, HW_HSH_RCP_W8_PE, HW_HSH_RCP_W8_OFS, 32, true }, + { 0, HW_HSH_RCP_QW0_PE, HW_HSH_RCP_QW0_OFS, 128, true }, + { 4, HW_HSH_RCP_QW4_PE, HW_HSH_RCP_QW4_OFS, 128, true }, + { 8, HW_HSH_RCP_W8_PE, HW_HSH_RCP_W8_OFS, 32, true }, { - 9, 255, HW_HSH_RCP_W9_PE, HW_HSH_RCP_W9_OFS, 32, + 9, HW_HSH_RCP_W9_PE, HW_HSH_RCP_W9_OFS, 32, true }, /* not supported for Toeplitz */ }; @@ -4664,34 +4658,21 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev, int hsh_idx, res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_TOEPLITZ, hsh_idx, 0, 1); uint8_t empty_key = 0; - /* Toeplitz key (always 40B) must be encoded from little to big endian */ - for (uint8_t i = 0; i <= (MAX_RSS_KEY_LEN - 8); i += 8) { - res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, hsh_idx, i / 4, - rss_conf.rss_key[i + 4] << 24 | - rss_conf.rss_key[i + 5] << 16 | - rss_conf.rss_key[i + 6] << 8 | - rss_conf.rss_key[i + 7]); - NT_LOG(DBG, FILTER, - "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, %d, %d, 0x%" PRIX32 - ")", - hsh_idx, i / 4, - rss_conf.rss_key[i + 4] << 24 | rss_conf.rss_key[i + 5] << 16 | - rss_conf.rss_key[i + 6] << 8 | rss_conf.rss_key[i + 7]); - res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, hsh_idx, i / 4 + 1, - rss_conf.rss_key[i] << 24 | - rss_conf.rss_key[i + 1] << 16 | - rss_conf.rss_key[i + 2] << 8 | - rss_conf.rss_key[i + 3]); - NT_LOG(DBG, FILTER, + /* Toeplitz key (always 40B) words have to be programmed in reverse order */ + for (uint8_t i = 0; i <= (MAX_RSS_KEY_LEN - 4); i += 4) { + res |= hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, hsh_idx, 9 - i / 4, + rss_conf.rss_key[i] << 24 | + rss_conf.rss_key[i + 1] << 16 | + rss_conf.rss_key[i + 2] << 8 | + rss_conf.rss_key[i + 3]); + NT_LOG_DBG(DBG, FILTER, "hw_mod_hsh_rcp_set(&ndev->be, HW_HSH_RCP_K, %d, %d, 0x%" PRIX32 ")", - hsh_idx, i / 4 + 1, + hsh_idx, 9 - i / 4, rss_conf.rss_key[i] << 24 | rss_conf.rss_key[i + 1] << 16 | rss_conf.rss_key[i + 2] << 8 | rss_conf.rss_key[i + 3]); empty_key |= rss_conf.rss_key[i] | rss_conf.rss_key[i + 1] | - rss_conf.rss_key[i + 2] | rss_conf.rss_key[i + 3] | - rss_conf.rss_key[i + 4] | rss_conf.rss_key[i + 5] | - rss_conf.rss_key[i + 6] | rss_conf.rss_key[i + 7]; + rss_conf.rss_key[i + 2] | rss_conf.rss_key[i + 3]; } if (empty_key == 0) { -- 2.45.0