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 1459245B96; Mon, 21 Oct 2024 23:08:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 938DF40E39; Mon, 21 Oct 2024 23:06:13 +0200 (CEST) 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 5638B40A89 for ; Mon, 21 Oct 2024 23:05:54 +0200 (CEST) Received: from EUR03-VI1-obe.outbound.protection.outlook.com (mail-vi1eur03lp2104.outbound.protection.outlook.com [104.47.30.104]) by mx-outbound8-87.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Mon, 21 Oct 2024 21:05:53 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=gg5k7Tsm3EN6a9lvcHNFH/JASUAZFsheiZaK5+V1qW+Up4dHljKnNeyWAJBx0eLHQGlMbKIeOOqsnlJs5ssSG1QVjcwrF4frKILeraRaoAbnKRt1zXZZ9vofwKer8L7mCySxFXOalIALwra62E/ubdSGZdc8ORHCvJkaPgxG7O6gy6Q4Qf8aHPYcpqHCijTh+6a/RIIvkhUvmKPhvupICY/kYAJFMQaayYs5dTuaqWU5IJVNhy9eY+6YIWnIx12QnzG0Yo7M7iJvbis+zI+VNPggYj3WNR94/DJLP69V+Qb26hGbPD5M5eUcj1KpHzFbaCXPAUivnKZLF7jGhSGRWw== 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=lnKHfDBcD1mEYHY7r4I8N3fdufTPQO5M2drKihk5cQE=; b=Ury4a/vOEXxlsuQhdd4+dhEby+/Umfu1ROOD1dqKKiMOycyT7JMR1vM52l4ZY9lcuK5TxRvNgTzpBwcu7R7v3w2j+10YcvT5z6arBLLPiR6t2h60G3xoDEPloUJpZjSlaEljEAVAydfMhLfluxLQwr4nj9M3Tzqvz81m9pixzPeTC45SdQ6T7N1/lxRu0bRhefPrxphwBpl7b60f+JdwJN3Bu1RC2SkMMwYl9Z9nGujERiM616UfDDQrIXRPu4G+UhRjG29IUPhvKfn8pTrz5XnMZPPjr5MuVbp2qtfWlfrLeuHIoF26kMw9b2VgbWLqI0zPZu/4ItJXR8xwQ4cr6A== 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=lnKHfDBcD1mEYHY7r4I8N3fdufTPQO5M2drKihk5cQE=; b=NYHbQoZghL/CXj/KLOhg/ZEIhwBTs57XKgyF1YbSF9CZkwtXcqvyjyTQNoysx3sWNeKN9scIowAJSCZQR8NZwc/OJfqLMmXkefMpnSOzz5awan0dUjAvjkLTN03vvdFKu7dOOAetU2J6diwlI5cxW5lrdvYZ5cvDY+6M0YbEbbg= Received: from AS9PR04CA0149.eurprd04.prod.outlook.com (2603:10a6:20b:48a::22) by DB8P190MB0762.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:125::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Mon, 21 Oct 2024 21:05:48 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::a) by AS9PR04CA0149.outlook.office365.com (2603:10a6:20b:48a::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Mon, 21 Oct 2024 21:05:48 +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 AMS0EPF000001A8.mail.protection.outlook.com (10.167.16.148) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Mon, 21 Oct 2024 21:05:48 +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 v1 21/73] net/ntnic: add action VLAN Date: Mon, 21 Oct 2024 23:04:23 +0200 Message-ID: <20241021210527.2075431-22-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241021210527.2075431-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AMS0EPF000001A8:EE_|DB8P190MB0762:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 4065f364-80fc-422c-0f02-08dcf2142328 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?EenojESfT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zmj4zmC5WvYkcJlRQCJNdMrLdpokc?= =?us-ascii?Q?sMmB3zl9Hr7+sMvOj/dqgSY0/3Ci+okNd0jCQKA8EE7hcoAZoTYgfRL3GQwO?= =?us-ascii?Q?WR7eCzmNOEnzmfe/gJOcL+3/HItvvmt4YaZHoqE41IuW56cbG/1zxTpuJC/F?= =?us-ascii?Q?8MeHjiPJyj/P3rCRg/fhCjw5n1h/zkZUx1XqrudsFW2rBROgPYqW62CX79UV?= =?us-ascii?Q?OS2dkbVtrx4YjbJxKggaQywOKvsY5Ogtc8MarpWADcOA4CwFBN49OZvfhqyR?= =?us-ascii?Q?sWoqeryTonR4n77b9sVH84wxKQ0FTQvL9xSh1IHwz5WvOQzA5E6mwNs60Ff/?= =?us-ascii?Q?06WQmWXuzgu46E19WsuWTeyUo+sb/HXuQU7bg+VrmTvBp32HSP6mzLeWPPao?= =?us-ascii?Q?g0ISEZF1hefO3nVbZ/pCZin2w545+Oqfw2iQMCYUBNgvVxUZi64mqbzPpUdM?= =?us-ascii?Q?ByLDozbcF+3FnWCAhOIriH+3pmY3MiuQcbMexHlThqAcFpMOu1I+Zj/69u45?= =?us-ascii?Q?WoXarw8d5opSbIO7q7hHf6VETnJVDmthuV1Mv1S0RHmHcMdA8Q=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)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: lAn9kQscuKZgxC4pdC1Tth/6DajRokhXYAVWeaki3l/Ctn4TsMfytL3tIAT35IGL1Ei4oAbi57Hs5RmzAf7sCpH6kG05BIU665QtAd5i2y7eYpt8sla6RnROecjTS0lmM1IhYJ2Kv5JiDDdMJOuCt740id8+iYOP2Wupjn7pFyprWgA8v9XEYnv5dYiyK48ZWQ1mRn5bD3jQYVnNCDXvxPYXfk1A6H9gZZCFFnCJqJDP9t94hZ1wSkWlSxcTiANdjYYKYVc0YUJ9YOsn59EHKFxqvxLsuYs7jVZ74wF0TC3tqdup3trRk81mCNscFzPmIMxvM/gqlvPVWmclZSSM7G5sv6e+3cGxAWnbo3esFJSLdXG7Rqw7GugFaS2xIUYOJJClJjHBpy59ff4wG7dYiB/JGSDe7S2vl9A/8kQgVltG5IF09EJqnITNQKABBiGFMU5mmoFar3VrPcirG4rVKcJzyjKRKdOpTukBA1ykq8jYPZmW0uhaJFNVdGy1ZnwhHW9eP9kCtaMt4fho36LaL/1IKxXvRXWk6hR3d8zkF5KE8hA4Hdd9aYUdOIk7r4Faq/LZZtynWi/5KqBWdGP5Jrhm2PjZj8Vzav5Xq/m4lsgYialtuJoyU1ORgghFIaYe1SO7p+k9ewXh3v+URGtz6NMXGm+ckLOKwh1nUAfWTCw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:48.0832 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4065f364-80fc-422c-0f02-08dcf2142328 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: AMS0EPF000001A8.eurprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB8P190MB0762 X-BESS-ID: 1729544750-302135-12923-43224-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.30.104 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViaWJkZAVgZQMDnNzDQlKdEgxc TAOMnIICXNItHCzMLcwtgyzSItMTlVqTYWANvubfpBAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan9-212.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 | 96 ++++++++++++++++++- 3 files changed, 96 insertions(+), 2 deletions(-) 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 1f076af959..cd5917ec42 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 @@ -486,8 +486,6 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, uint32_t *packet_mask, struct flm_flow_key_def_s *key_def) { - (void)fd; - (void)implicit_vlan_vid; uint32_t any_count = 0; @@ -506,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; @@ -666,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