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 C364B45BA3; Tue, 22 Oct 2024 18:58:43 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id BFEAC40E2F; Tue, 22 Oct 2024 18:56:40 +0200 (CEST) Received: from egress-ip11b.ess.de.barracuda.com (egress-ip11b.ess.de.barracuda.com [18.185.115.215]) by mails.dpdk.org (Postfix) with ESMTP id 6A13840DD3 for ; Tue, 22 Oct 2024 18:56:27 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2112.outbound.protection.outlook.com [104.47.18.112]) by mx-outbound19-119.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:26 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=sdWTK33sXeOQcvMZ994d6DJS8dyLWlYk5Akcfc/0emFGQRE6gCvkCjHc5/O+Dw8gxTPKw6yeFzvJLYW02QnssCqxpn8R7Kx24oLWSkNdBFdOEfTg124mXf8p/32qjAXR9TZ/yMUFGxxhYegrZEkjojsfXX5BAMTPKadnSnUHJTotK7nSOgotnfRU5o8rEpPkae0ZwfMwzZWu+lgJATpF+qggjDCP8IWF3pYdEChstBc6SF+K1K5S/tpwSzRwcAYft3T2W2XDzUhMe9hWTWSWpQH4TIa1ZcFLJc9PmSPjwZmuqYPt9XWTGypLmfS4mXr8cs/bnV+Vz2E/3fqletMhvQ== 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=bo3cO9utiY5As4bM9LrP5sDx76WBU4gJ5Y/n5tQPWZaHlNZfKVOXrqawb5z9IEXE4dCthIsFolsU1FEalbVJ+qMeAmMqLP1Fc9c3q355YZutFYgM1JGhCfD9Mg6CegqYlTsty5Ap49/8TDD7CHIoxYEMpH0oogdZZTg5COH4cZS5BAgM2wThwsJ8D/D/gcY2DF8FqMhEltuXsaXyTHyt8axRiCFThnmorukSmCAYqBtId4AWEAjJKQQxaZnQ2OneaDYti3xm+EU8r7MigrfIv7ep8ar2xvd8EEJLb8VQz7LEhLn01+9wStKobLS0iLDjohBsFCe4hN2swCd5cZCW2g== 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=nfPBt7lu4b63+S26QcxCrOw5jj5XM4R4PTC/ZOOLSrWjrEVTFjHv5t8hOPqpNsQjzzdR2/Ip6QZyZ4HTN7VT0SdesY0c3h6rU26vfAmlZ0SixZ9vKdsuULG9aF4boKyJKuQic2SHKcqioHZR+UYQDbHNg8WmaboMRMV7ZvqyIvU= Received: from DB9PR06CA0007.eurprd06.prod.outlook.com (2603:10a6:10:1db::12) by GV1P190MB1900.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:53::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Tue, 22 Oct 2024 16:56:21 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::c1) by DB9PR06CA0007.outlook.office365.com (2603:10a6:10:1db::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:56:21 +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 DU2PEPF0001E9C2.mail.protection.outlook.com (10.167.8.71) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Tue, 22 Oct 2024 16:56:21 +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 v2 21/73] net/ntnic: add action VLAN Date: Tue, 22 Oct 2024 18:54:38 +0200 Message-ID: <20241022165541.3186140-22-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241022165541.3186140-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241022165541.3186140-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF0001E9C2:EE_|GV1P190MB1900:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 45f907a2-8cd3-4c33-c23e-08dcf2ba74ce X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3Ig/b6UdHwW0aDkLqMcS3q9nJqxfYeMDVnKwb8nY01gSoIfy2P6LNL3wxmUN?= =?us-ascii?Q?l+0Jbc7MKtnlOCI7qs7M2V8K1v83TFDKMwMLjFbFqjvktFE8pGc2uiwdt8Ov?= =?us-ascii?Q?FfAuzPdi9ue0Uw0n/Nwc7+UTfRXQAPxFlvKYWiTHyyb3TIPelY232s37P/kT?= =?us-ascii?Q?A+ptVQph9j6rIoVsMOYHX1YkQcr19KbHgfVDC6z2kOavt4Qq0svg+HWdUl9h?= =?us-ascii?Q?kVE9Hue1IpoQ8W9ULCEa+NUvaUlX88UHksIRoq0GRMrtCDWgdCqr7c8V0QGt?= =?us-ascii?Q?x5TBttkioOTH3lrmSXO/PnLTIHjRT2Na1FKWjE1tYYK6InlrVg86WlgW+iiU?= =?us-ascii?Q?ChJpVQYe5Aw2C69PSZLTgBsl/QXcLG4h68Xeh8y3aCJoFKQgl2WrCC1UeUF/?= =?us-ascii?Q?acAQ6Msxt+nK1WhHKqJ/F/4rg6Ia/tTFlrlJyIs5whgr9oA3QdlE1QlFuoVp?= =?us-ascii?Q?x+yYQZn2iyVG40S0ecQbYjF0jMdqLN7iiW0bEOTnGBpZAfFmc93n/rtvHB7G?= =?us-ascii?Q?Z9W3w1HLGJzueo2et78gfo4ZpPijj48otbGEaMP0lCwxM0jCKyNDtyLx6HcF?= =?us-ascii?Q?aj9wqYczO6rg+mcX7gANKLRVpLIdJgOAGh45obDkXfuI3x+2DFhX3EPwGRIj?= =?us-ascii?Q?oEz1LwtSByIFi082mikFhNgYECFrysSI88Ps2zQ1xDFzzgNY4jQUejHEgHS+?= =?us-ascii?Q?Y4Y3rgAhrCTJvuxYIkdqX7AYaRNjF6Exuyz70+GslELcA/4QJIyUghkcVYh8?= =?us-ascii?Q?F7mdQNFMO/U6mM1F9MwDgLWXSju+c71ybzmyAZ9G8dKIqoCmdC44/hcvdJay?= =?us-ascii?Q?kSGUCB60vlFtwPnCqzcqJfnMHnhI3MlTs+JgluE11Dm0DRyIGQ3SG/806kWu?= =?us-ascii?Q?JQfnYsyNh2MOzu602YnBc19NfLPOKQOwfJ83vQwI+AHaxdVFFRGglxTmlqeG?= =?us-ascii?Q?0wnOc5l3RiH/HawQecTCRpAVDS2j0/Wjq4Ny1hfbdJLGzr/tpgDfHaVritAn?= =?us-ascii?Q?+PeTz1rItf8Kvwym1TFmtDmWO3mHV6weaijcqrtaUUV0pikQjmNs/SGzF8Qr?= =?us-ascii?Q?2kNKKVej14XDRffIDv/0HtrDU45izp6loiXendOCznV1wxPM06SC12k5UcTu?= =?us-ascii?Q?jXKYmrIOOOOC/C2pENB4eMVhXP3vBw+U4y8IX4X4NwgetSX6RG+JBtBKj90j?= =?us-ascii?Q?CaHeVBfYAmqAvjUkesTV0U8A/rG7ontRv6ZTi2UkCyIQJoxpTGj45n+/t7fR?= =?us-ascii?Q?F42YMi4xwLkiKkr0VmrBgi3zWkv8DW585f3k5m2V7rdIpt4xhLrxNae2FUK0?= =?us-ascii?Q?ohJ8wQ6eXnpfQRsowbWRV54K1Pep+zVbgDMgRRTws8VIamE4q/a6C2Jh2tTu?= =?us-ascii?Q?4JBw0uaOf/lXcK66cuRORliaWvpeZcYAAMzJ2Yk+jfDi8vgbqg=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)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: nAUuXvATOHT+9s+T+pACniBlI2srCB/Lm1taKAr4bQLM5T7NGn3vKvNm8JI35TKffsrPISUQnoPcnJdCatPAqBk+LwoTfXQRIrv4NpyOTEeM2dQzoLPMIDPL7x3sdqp4vacvvf4wC2V8hVxnXGytXsC3d/VComZ+GiYNE9RZA4ogwYA+JBLYhTmZAInuftcb1OlIiFx5eXQrlu70NYJL0TLBwwEgX+/YiY5jo7hSXtNSV1tSUhm2fo9YsNeQlQGXEnoKfEtE8qTGO27ATS6rsi8R4RelVMSdAKcgoBm6f9CLVfuThSmLLS+3CFqRvqgsEh3TBbG7MKvMI10buX7a82RIWGd9fhw1hBkxNErzwfZES6T6VrFXJqRRSajegyX9T8wauiL0z6NnIuaJNZ5mdKUzh8KD4YHmAP0E59sYjgfP1uaFYW7nXqB8KFsWy9T+fs7KUv4xwoa+EjA+ipYqgFpx2gnkjgc4S2CGgScmYFeT0EHk8JALlDe3rBYZ8PYH6oNVjLbryz9HvHzbusU0NEqIIUfjrKg45itTv/YIj/jemvunUHwAXGAXHEv6W+d3GfcXVjubGbdsUDhOQg/DTfbDV27k8BUsNHCrOg7aqXJ768r7j6yzs3/qfkBioZZ0ylb18hN3dcouJgQblhtkc/O4oVKAbKe2/FVxVIB63NM= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:21.4188 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 45f907a2-8cd3-4c33-c23e-08dcf2ba74ce 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: DU2PEPF0001E9C2.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1P190MB1900 X-BESS-ID: 1729616186-304983-12656-14393-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.112 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.259902 [from cloudscan12-62.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