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 1E21945BB4; Wed, 23 Oct 2024 19:03:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A8A6742F7F; Wed, 23 Oct 2024 19:01:28 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 0ACD142F11 for ; Wed, 23 Oct 2024 19:01:05 +0200 (CEST) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05lp2170.outbound.protection.outlook.com [104.47.17.170]) by mx-outbound42-14.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=U/6aNclb6tnO4+2Y8ol+1yH+kOSxyZMyFvoyfW3kANUtLikkxcrWRh0sacmNJYwfsZBvdCW/wO5A9vgo/aJ0Q6dXDy0OXnGLxZs8bLApqInCFgphxBWw+VZqeddsIr52/+nlLSJ3rYuKKnmcJpPVCvzgIAiC8Qiorp33g+uUdU6tk7paGSbwBGBvkrb0HlpUrRk1Y+vOKOVFRiMdMpATq0QUJjouit4MYFtnPBSuam3VOkiHAxezLBAKKZ6jYsNegLFao39hQWRYMVfADDVo/x+56+SQb310spsypmQ3+7f7P/jKmTKMtcBtUr4uwjMfFsAhanrBe0Pvo3NTKhb2dQ== 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=yBlJMOegYiGV1zQ6dj/3q0fAEcmDwxGZwnrQVPb2Mp3rRwZCppTp+2U9ymX00Rlo2vG/HsrH7WO3D/2fedoaDU4aBZvndMxkVIZdgrqcukgsgyuI8ID4/ELleoIrUroayWQhmgTyV1GDhWMq0helO4wU1guYcdTLbPY6JJs3p0T2ZCOVzzzEPrkR4x4YECqV3o42s/oVaMD90gp6T+zYr88Njey1kOHR0kmIM5AZMSDbZ2Mm7QBj6IM+AN2IS8auXBLQ6xTo9YkneKkJYSZ6OhhRlYRL9x2DCGHIwH0tzg7npiUBxNunge/9Ja8x09LayQCV3bVj/oj8t+IMkmUOZg== 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=GCVQd0o+jZq6gqWh0cQac//Hyk8SYnly0fnGE4DsBtfPfX1GKYQQunADN63m+BH/CVKZzW2zAMQBpaSaYGdmXnQnFQO1Udtrfx0Tk4wX/1bXdnRR3degLmFsJzZlVBiTQTWqJ12QhyGtnV1D7mHfpTNpzvrL1NXfzV7YHW7EmKk= Received: from DU7PR01CA0008.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::29) by DB8P190MB0730.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:12f::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Wed, 23 Oct 2024 17:01:00 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::5c) by DU7PR01CA0008.outlook.office365.com (2603:10a6:10:50f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Wed, 23 Oct 2024 17:01:00 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:01:00 +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, Danylo Vodopianov Subject: [PATCH v3 21/73] net/ntnic: add action VLAN Date: Wed, 23 Oct 2024 18:59:29 +0200 Message-ID: <20241023170032.314155-22-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|DB8P190MB0730:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 43d8e992-2447-465a-4f89-08dcf384455b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?6g3M9sj36s18cESeK8Vv4L3mjqksnQq+vxzdaqgXxlFSQ5qYhe5narZHhXBG?= =?us-ascii?Q?cdf5oTQ7S4WfaW19wKG9VycMkwYdt+A5J9UMsVwkUJvmd/4kEgzb3W1++l0U?= =?us-ascii?Q?fE9rGwMudaaU+To5PUjsTGMdgah9dBIbLzKtSItgzUanY8xTM8uq5mJ7UboH?= =?us-ascii?Q?6pbloH0bSrMZEEosocSnzI3zNz/LB/DGa8A3p3sBkJNDJO5cbvehk4HaBSxS?= =?us-ascii?Q?Q229nS92xute3g2O48kStuI/54n1aB0CtseFlU2zMC15caAJra/ew9Ny93Fk?= =?us-ascii?Q?JhE6MTlj/F9a3CW4KQSE2zxLCu62kkShW743tvPPCp7R+AtbGyCbOpwVM0P2?= =?us-ascii?Q?z69xaje5rinp7sxF9gAvnbme0MeY1U4z6PmXab1RvtLsrdt8uJXcbC6BkNyS?= =?us-ascii?Q?fZX8t4PpC6KFowjg6W/fLex7JKksHtRlptYV++6nFa1ntmFD6QxvtT4RuGmp?= =?us-ascii?Q?uuwsK6UyqDT8V+hHxZ814FRPCYIfSgrW3SFouw0IZSzORHQJXpI+wt3K2SAh?= =?us-ascii?Q?dNDwPvFmBkzMFat/zgN19xbHNqxjfCAQvkKFqy6xtNSNhvoJpsIgzueBHQMg?= =?us-ascii?Q?wrAZQpU3CdiI4c00f5L76Kwh3TSaXan57oSIuAEx1eC75q2beXyLDyG7WT5O?= =?us-ascii?Q?F1vR3Ek9xRH5uyMAWDxKTFO6p89iSyYc5CTwlpcS4uS+qHCVzjr4tWkP0qkU?= =?us-ascii?Q?yCVT6f8UnhLFziKjB0ouq8tcHcCMj1ZheOsr0P/ZfXEhEyKC+qvq0zhBcFzD?= =?us-ascii?Q?e4erO0r/+/WRLzkiEUNujoUX7dlkk6uA/my/w2v5xYMKzFfyyePY7AhMakPg?= =?us-ascii?Q?N3b23Inv3O9e4QfYEhA9zxXYYtukEBEznzhIGYIpLISqLiDVFNQuWSKd93Ou?= =?us-ascii?Q?1xWCynshhUv413tqSLHNVs7rCQtU/WbgwSYoPbQiDSKVqJVz1X8kH36031rF?= =?us-ascii?Q?49rSk4YX0zoliv8+rT8iX1hmqkTIZ21PDqZL6v1Q5N7CcT+B6Cgpff4r1L5/?= =?us-ascii?Q?SlNa7y2JWn5/r549BI/aAG4s3ZfPIKZNNtjdWXwjAI0IgaxT/zxnbyBNs4Vb?= =?us-ascii?Q?bx/xNGbYNf+dIbrrnvDMp0LIyHRk2uF8yHRFP8uMxmFlRgPqMk7lN3jlPL3c?= =?us-ascii?Q?LCoDj+T9gcFKJ1N7BxpZMd7OfLDOucVhV7DZb8TvKuX1wSw6WIz4TCLSnVB/?= =?us-ascii?Q?lOG34bAarWvdL1vAyLDHbDa5ixRpksS/6tEmHmdtdWNl/2EXfCmtdBUe0BSq?= =?us-ascii?Q?LFk6nOHpyhb8H9cW6xryBZsCMMnWVj+8miR2NKT2CDiH+MvyePj+YSU0Gb91?= =?us-ascii?Q?niSNRV0J4ISenzueleG8hVI9PhkD22/AY+eYzqnWmNuXcKrdZ7abEw/gTsSu?= =?us-ascii?Q?/YRdzSox836O92rFRrH1xC0rkD48N22UCysraYgLmx+6x1wT1Q=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)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: sTaNYwBaDoQnAuDb3Y9lQYonQZLQ2vU0wiGOhXCEc1r3QsvmZni0R9M0jkpcmCw18CmpenPFzacKyJTn4pTa9hlC3izbd+7pjVchBEO15j9ER1CcGhLLTkwlBNELQvv6qPoOto/QkQvMQsNz4Ipg/qeBeXXRDUlyE4s8xKVuOxGTTQfEh/5TmbaTRkZ+akpeWh9CTRJVzxFv5TY9qdI/vd5BzcBVu3C+OKWgVEGDjvWezKlWdtGfb6aevRx3SghEuGEKT/YNAIHyfnelT+K97r0tVUVrYv9rNhTw0NP3C2+IuvyrjXhJqts0YB8SCX81mw/Y49UHtfSXsORn2u4RX7+fzLWeZXFwb1bb+ihTj0ZyN8Oghs+aaZ2KFqojaTEkZDq1carOEz+pj3874H0IfCFvhEwhhqIZqJ/oIdiiLIaXXP79HWaZFquXYf0GroMSAV8UjS5Ys0DfoCoZyVWvKl5VxUY8Iwl+psi/sMxdrMomh69fNrg1k7lJJQy+uGVWIlg0aKDQlTuvfHUfCYbwXaKslUhXILn7Pyu0bgm6/q8nFlsLYoCmjm3weG3jjcDrrOhUGNO5/vLpF3ddhU/pnfPuW7OjMGGKOcM+AYUnkylWCOp1sRqNbdAoxZ6I11RDPGw3JDe5/T8aSAO+7qzFDvOec/o69ngNkwHVPIMuQtk= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:00.1018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 43d8e992-2447-465a-4f89-08dcf384455b 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0730 X-BESS-ID: 1729702862-310766-12807-42087-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.170 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.259925 [from cloudscan21-4.eu-central-1b.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