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 6A4A145BC0; Tue, 29 Oct 2024 17:45:51 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E917D42F45; Tue, 29 Oct 2024 17:43:41 +0100 (CET) Received: from egress-ip42b.ess.de.barracuda.com (egress-ip42b.ess.de.barracuda.com [18.185.115.246]) by mails.dpdk.org (Postfix) with ESMTP id 3563442EE9 for ; Tue, 29 Oct 2024 17:43:15 +0100 (CET) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2171.outbound.protection.outlook.com [104.47.17.171]) by mx-outbound17-86.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 16:43:12 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=UtzNTe1GD2jg/MiKy9JHCi2h5HXNqE4L5Ojv7Ro58adTNko1Ad3jau3tdUQsxgGgxfFkD8s4CJeiBbw52TrNoabErzHrjdGqzgDP+a6UgsQe/3+i7CMIzm1p0ny3qYA7mWwS8PU64ZjVgOXMZDftJUy8G1tgnlR1PohBIdqSeY9SqXNqhLVN6UtGXUy7Mj12c1A9nMFBt84Fa1gh1D2ECuY+TJ0ACMkf5uHmAWXw7qHtd9JNKpaMz54UTgnnCtFgRZu+z2og6D3xCjj9C4utNEK2ou73+ay0DPHp52IchYhxa38SEQ9Lm7QgWDX5JsLctjhWtYTiGu0AdVeDHligsg== 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=2ORsmIbUs9+AreWbb4DUG9MMuXQUn2RoHJSsl2A0VlI=; b=jqKwX+97UPYJWrMxtt6qOzETzxIbXEUhp2ZXBZ3U8g8S1WtxwxXtKyEJIThxJ9e1pXS1WqkzylP5gl51S+01+tEl26qC4RfJn4IWtXCdelkdFBT7MYBPMkTOGntqXVSvZNAjzcOHz0A7zh+sAIy/XU4JtldvLMORRVBS+EX9HsN/iHQweMVx8sRHB6Onqvm9rN51fmAiHNs0rJ5fvxxlC70CbszOS8L4R5pKDgdVqp/BA8Jt+5lEmnRoP5uUPvo2dGdZLMMleCyIzKqFjUYXYxm4tzpEGrxODlPKMnJJ9dBUUkabd4O0a/16MPoH26AxyoBE63eLyrvsQsZgRbGNCA== 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=2ORsmIbUs9+AreWbb4DUG9MMuXQUn2RoHJSsl2A0VlI=; b=nrX/1z/i6n4eoNIC/oNahzlyyxjrbo65LTfFmElTf5wPz51ByqOE06JwLwLl9Fbu9GuNU46CHyqrXqqvcDvnm/KM3flBKZ2zQVaAogH8yDDVmW5D17DrBy7/Pz9phbX3rLHFkt5QpkjULusMUW2SgoDpamoMZIRIm0tsSNe0hBw= Received: from DUZPR01CA0204.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::25) by PAXP190MB1717.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:285::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:43:09 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::36) by DUZPR01CA0204.outlook.office365.com (2603:10a6:10:4b6::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:43:09 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:43:09 +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 v4 21/86] net/ntnic: add action VLAN Date: Tue, 29 Oct 2024 17:41:25 +0100 Message-ID: <20241029164243.1648775-22-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|PAXP190MB1717:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 73e92bbe-3fa7-464e-c508-08dcf838c58b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|1800799024|82310400026|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?8oAv7Sw3QOpIIgpt085lahPdYk180cUy/Opp8cnTMy2wv4O5TbFyMlaTE0ao?= =?us-ascii?Q?/ThY3N8v2pRE26J5JGwaHaqQCujqE5dDtkdqO0U3l/sznYxcQhOuipsLFecE?= =?us-ascii?Q?wk8mX1Amwmt3MSbMO1lRA+y6G+AlIfoA+Jpdv9pVKkZ9c/sOgV0g0DvLwagT?= =?us-ascii?Q?zk96lCx/QV/83/7hDi1xeJy5BC5DWeT/5CoD4ewv336/V8pEv4ZvMEvSKPS1?= =?us-ascii?Q?81IVvsG5VEHOWHzlUSZJS/O5zuMpT1oPg1qUhBTNNN8uo56TnSxkjkIIwl0X?= =?us-ascii?Q?scu0ssl3EGp65pMgWhKTcRBaQS1ZxBaMMZwcsje48uaFQPW2jF9W6gEPPe9V?= =?us-ascii?Q?06BKuj3LuWVCFCZpm5Uadq/CUqoZK17GUgUIBT//PoWqM6NOybRvtcJaA19q?= =?us-ascii?Q?bMOgb1XCku8G4ry/7IhnxIeLH60z1fEhz0Ndw84kzK529fjXzkAjnuvCZ5lM?= =?us-ascii?Q?Bowy+weGK1AhUQU7/CbhXXbwfntLWNlbeyU4/bu170d9bodH0b2AZ36NWUhh?= =?us-ascii?Q?XMj/R5DkDEZdwKJ++zJ543BBkJibZO9saf/6gDjSS1a8z2/biQD85KqQM4at?= =?us-ascii?Q?ECvctPGXUsJrZJ+KX8VtEgBwWg/jiyDv++ZHF9pc3FXuBB5IrtZptmMGISFe?= =?us-ascii?Q?bW5YGyGcBpVuO9EzMR/ljRIA0/RHbEWl63Q+tDxE+3vhpVVVv2JYsFi+Uesg?= =?us-ascii?Q?JyV1H9OJ0vlQG2g1+naUbkgeGBwc5qh6/CN4NUwNOS7qYh6ax3sEdxrBL8H+?= =?us-ascii?Q?F5jf79uIQOX4kpIePm1341l74RtsOC3T4nnyfsFTxgC33B3aKtQAd1g4IjWD?= =?us-ascii?Q?NEw/2puwSyVqxaklbJbEhiASb+fDBBhhp+KRi3MI8Hx23YPnOK2ceakkNYGE?= =?us-ascii?Q?+2v6RgofuvdFsNvOSIkmT3d4DZFCMjiYadK8RnMdBHxQPf9uyZ7X/ljism3f?= =?us-ascii?Q?CLWT+fSNrOQ1yA3UrujaB4g6U+Qca0cr2HEa1tUyCldAKWjdPnCu9A3sICka?= =?us-ascii?Q?30NzfR0Gc4E00xZrpRsLoAQpQbQ+yxziJy5dHqWYii2YvyBz5gmU9pyzBs25?= =?us-ascii?Q?YhBspnx+WYZiovwrAP285AU/3IOH56jw5h5et/PZkcyiSo0Kha+gfWld6Acf?= =?us-ascii?Q?v8PudIWxaWV2y944kFsWSfXTwnEL/lWTp6n8mk+YOpgBG0u4ehqsPwjM21E8?= =?us-ascii?Q?ifUk5MWUtrjtKq93HYnwe8cB2ZNK7jENWO6w9k3kPCzYwqIlG/EQr+q2PSFU?= =?us-ascii?Q?pcenajkNxo2uZJ7QVc8fLp0s1G5AQuuTByYMWPPlKqG9SRo33KHWObUwna3P?= =?us-ascii?Q?+fs404tqpjHiI04osecv+wkYHSmZzFyqse7/6FtgPz95+6TwfcgF1sU79ULz?= =?us-ascii?Q?zcGW2Y1dC1uIBz/gqBwIqMEZqKUl/zzdGmb8P8vSm9Fdi+T6eA=3D=3D?= 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)(36860700013)(1800799024)(82310400026)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: ACnL4wQYmauBbXU3/9/E9yMGHgvaLfvKgYVdPgn65MnhnoaWxd4xCYkBlZKoLx+jwdw4EWfONRFG9pKBKXR3LXc2DWwj/X4jkZqvnWjszD2rzsfyZ5w5TsOLYgXiaSxZ6DHqIZSudSGoJZtrqIRSEdDxi74mCTXwMyK/OIe34MrG1quDQEOwT76tcg6akXCavQHs3olOOJ0P+OA/xL8pACn47vO7PahF8Oe5U9N2S2K+XIQFYk6rMRbJfdDB3zn3PGVwjtVv8KePWSVNiiX57Fkd3cijWm7MWNOrqhpwsPeiK2EVjl3cxtOMbQfUYWr9/lZ3fVxn6RIHRKmqR4KIPPIjy2hU7wxz/6jk+wbliUOlwQZTeHgGztOMZfneQz4I6CBjYnOXYeTAPIzG/9xyELFNaRo43BkAmuOQsOcSvR4f/MtEYdGkr2r/AdwI65WLMHYGT4Z9k+P7+pTfrDGOb3fBxKTy0z4xDkb2SvT9QawHQj4JeVfXG7qv/D6MHTSw6yr/nbRXFhUhQykwvAQu7UuTOV/u4a/YNxp2ux7AABTpeVeVlLK+XdtzQrQQ+72T0ks2YHXFYnjxhVPb+gDZAwQptIhSaqehF/6X8UyX2T9HRYmDKzp2ZRh5kTP4ZP5yDBYvMutoNb0VT/t/BlzFD1CC4gA8DXziHOEXV+laJ6Q= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:09.2771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 73e92bbe-3fa7-464e-c508-08dcf838c58b 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PAXP190MB1717 X-BESS-ID: 1730220192-304438-12711-30021-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.171 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVibmBiZAVgZQ0MLYwMwyzTLVON E02dDCzMwyyTLRLAXENk5NMTZKVaqNBQCsBDODQQAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260063 [from cloudscan15-168.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 From: Danylo Vodopianov Add possibility to use RTE_FLOW_ITEM_TYPE_VLAN Signed-off-by: Danylo Vodopianov --- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 1 + .../profile_inline/flow_api_profile_inline.c | 94 +++++++++++++++++++ 3 files changed, 96 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index e3c3982895..8b4821d6d0 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -21,6 +21,7 @@ ipv4 = Y port_id = Y tcp = Y udp = Y +vlan = Y [rte_flow actions] drop = Y diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index a1aa74caf5..82ac3d0ff3 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -134,6 +134,7 @@ static inline int is_non_zero(const void *addr, size_t n) enum frame_offs_e { DYN_L2 = 1, + DYN_FIRST_VLAN = 2, DYN_L3 = 4, DYN_L4 = 7, DYN_L4_PAYLOAD = 8, 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 f24178a164..7c1b632dc0 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 @@ -504,6 +504,20 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, return -1; } + if (implicit_vlan_vid > 0) { + uint32_t *sw_data = &packet_data[1 - sw_counter]; + uint32_t *sw_mask = &packet_mask[1 - sw_counter]; + + sw_mask[0] = 0x0fff; + sw_data[0] = implicit_vlan_vid & sw_mask[0]; + + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1, DYN_FIRST_VLAN, 0); + set_key_def_sw(key_def, sw_counter, DYN_FIRST_VLAN, 0); + sw_counter += 1; + + fd->vlans += 1; + } + int qw_reserved_mac = 0; int qw_reserved_ipv6 = 0; @@ -664,6 +678,86 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_VLAN: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_VLAN", + dev->ndev->adapter_no, dev->port); + { + const struct rte_vlan_hdr *vlan_spec = + (const struct rte_vlan_hdr *)elem[eidx].spec; + const struct rte_vlan_hdr *vlan_mask = + (const struct rte_vlan_hdr *)elem[eidx].mask; + + if (vlan_spec == NULL || vlan_mask == NULL) { + fd->vlans += 1; + break; + } + + if (!vlan_mask->vlan_tci && !vlan_mask->eth_proto) + break; + + if (implicit_vlan_vid > 0) { + NT_LOG(ERR, FILTER, + "Multiple VLANs not supported for implicit VLAN patterns."); + flow_nic_set_error(ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM, + error); + return -1; + } + + if (sw_counter < 2) { + uint32_t *sw_data = &packet_data[1 - sw_counter]; + uint32_t *sw_mask = &packet_mask[1 - sw_counter]; + + sw_mask[0] = ntohs(vlan_mask->vlan_tci) << 16 | + ntohs(vlan_mask->eth_proto); + sw_data[0] = ntohs(vlan_spec->vlan_tci) << 16 | + ntohs(vlan_spec->eth_proto); + sw_data[0] &= sw_mask[0]; + + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1, + DYN_FIRST_VLAN, 2 + 4 * fd->vlans); + set_key_def_sw(key_def, sw_counter, DYN_FIRST_VLAN, + 2 + 4 * fd->vlans); + sw_counter += 1; + + } else if (qw_counter < 2 && qw_free > 0) { + uint32_t *qw_data = &packet_data[2 + 4 - qw_counter * 4]; + uint32_t *qw_mask = &packet_mask[2 + 4 - qw_counter * 4]; + + qw_data[0] = ntohs(vlan_spec->vlan_tci) << 16 | + ntohs(vlan_spec->eth_proto); + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = ntohs(vlan_mask->vlan_tci) << 16 | + ntohs(vlan_mask->eth_proto); + qw_mask[1] = 0; + qw_mask[2] = 0; + qw_mask[3] = 0; + + qw_data[0] &= qw_mask[0]; + qw_data[1] &= qw_mask[1]; + qw_data[2] &= qw_mask[2]; + qw_data[3] &= qw_mask[3]; + + km_add_match_elem(&fd->km, &qw_data[0], &qw_mask[0], 4, + DYN_FIRST_VLAN, 2 + 4 * fd->vlans); + set_key_def_qw(key_def, qw_counter, DYN_FIRST_VLAN, + 2 + 4 * fd->vlans); + qw_counter += 1; + qw_free -= 1; + + } else { + NT_LOG(ERR, FILTER, + "Key size too big. Out of SW-QW resources."); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + fd->vlans += 1; + } + + break; case RTE_FLOW_ITEM_TYPE_IPV4: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_IPV4", -- 2.45.0