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 92B1E45BCC; Wed, 30 Oct 2024 22:42:25 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id DE8DA434C3; Wed, 30 Oct 2024 22:40:33 +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 4944543401 for ; Wed, 30 Oct 2024 22:40:14 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2110.outbound.protection.outlook.com [104.47.17.110]) by mx-outbound17-81.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:11 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=vAhlwk+45nj0R1e/UYKAIfCSL+bsC/WN66dyEZPYMkg5NCHkLNNz2u+48L/XVow3XiyQCcb1cUNzuTIIcY8jNI9PfcJdIXLw7wYGvitHJlkt4FKZHnzdfHd/yLz/G1apbovhk7OGGgvMul2I8VxsPTIKoFIg/PMT13sVA4p9FKPmNGIIfCmKpOI1JCRo4+lwDaAs6OO23bHhHa8XFzZWWg1GqfeLSs3ZNEaAhWgOb7cK8eCCYHTcNnZSIuxYSL7T4ZSxEbtXCVov/YYZ16e8iOmRw45SN/t8OS03V5w6yBGJwKY34zRmwcncdJY4tOH5Osb9vfUPY0CBTOOLrEBIRw== 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=3vodIAVuC81q1X+0qpZ07i/pFB1AY8ePB0e/bpFEwOM=; b=hczLZHz9tvVznpe+DwdV+NklTkMcSS+/KfbvO6kML8WqpckITt0xlc3WuyVXPfq+Pxs86vpiMHLfovPC7T/Wz3gqR44jLjF/LzoIvCPf1zqz/82pami8jyuFF53BiQihW4Gt3tkrVFqEhU+sXZYZgKVRJQQ8kM7B6Lz43OpCXZ8/Lv4LlOe2atOc/kCL6SMdBEgxXueLIxSXyPCoVd3AdaYvDqZiBbenaCe5SbXS5WkcyB5egEnJukUz0t46u+z5YDQ6WstCQ9gAq64ge1YPrjC0qty3NPkVQgiKX8vwjfKh9kXPArj3ZlruMuCIjm88qzZ4+bUBjHCzVNvQGaOjOw== 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=3vodIAVuC81q1X+0qpZ07i/pFB1AY8ePB0e/bpFEwOM=; b=PbNdLNORy6UtC3N4xmHCJS/dpLlLdM1QuUX19Ps/z79lpY+8ZZ/90M/0qLWKQtNblNYHnikymO3Z5HyL7MJ7d/NvDN2jyVMD4+dkmtdHn2Hrl4EfXyY7zthPJGAN/Vc7mosxq3/eQc42qJ7VrW7n35SMXQIxheYs72+JR3e+Nxs= Received: from DUZPR01CA0003.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::15) by DB9P190MB2011.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:39b::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.27; Wed, 30 Oct 2024 21:40:09 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::16) by DUZPR01CA0003.outlook.office365.com (2603:10a6:10:3c3::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:40: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 DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:40: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 v5 19/80] net/ntnic: add item UDP Date: Wed, 30 Oct 2024 22:38:26 +0100 Message-ID: <20241030213940.3470062-20-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|DB9P190MB2011:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 11d94c9c-5a4c-4c67-6f5b-08dcf92b6d72 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?62h57TL4rjfk0fdhkE6ydF8wbq/M+rfouWTUm2SLhkHf6NBNy5mS/SnSmyuy?= =?us-ascii?Q?mabEEaznMzo+OdunctRJ5zKZWkN19YCWxMwzCceMtqB800gME2ceM3oA7nQW?= =?us-ascii?Q?uhqSbACVZmtFPL1KcbfpyAiOcpLO1573Ko3muWIx9jf8cW/j6534zMO4Ao6l?= =?us-ascii?Q?NdfGzzcXNCNwgZ+1WGvwMkxeU9yoaZ2bTTRmvhI1tc4eKr2/g77MlfXsZ/Ix?= =?us-ascii?Q?vVDE2MRH8YB5xPibrZRbarK6mCHA621GSyEyYN2scfPZKBKqov1OtJQNcD1w?= =?us-ascii?Q?tMR2c5Cd26xFHJee9Necc+AbQztyJzwG4pdcJgCxQ5/XRN/BEpgXHPB/PciO?= =?us-ascii?Q?DRLlAA1amBVfw1ugTht+Ud1NRQwgnhaWSAFtepk1EboHEH5UhNE69jfKcXGW?= =?us-ascii?Q?z0spyJtvCH0lDduKgWCR4hwdAFyaXSusAYfAEfB6Yp2KNxKS0W9tcl2TuCvn?= =?us-ascii?Q?R7pB9CjJGTpbQ6ZA48W5ktCCB1IeWzfCR5jQkT3+nK51At0TT7Ky3cnviTMR?= =?us-ascii?Q?cn3zOKpu/kFOt/y9rRpxjZhu3ezkgaEE++CJE4B/+zaWrvJL5sKuKrx+3F07?= =?us-ascii?Q?e80XeYU+7yh8D6iddfvQGjXgNGkYBL/SOP3Pf9hwQKPSzGD5olicrHVoJetD?= =?us-ascii?Q?LyyCOepAv5d9qyzmrSCLRZRH8CGZK+mNEC81hnl18vTMqoom8xhxRaHk/DuS?= =?us-ascii?Q?P9grNlGBzGUCHbnOQgGq2Vt7tIgxyiWZrcJyPCqEbTrQnrMWBjz5pbdAEKQG?= =?us-ascii?Q?LhM2JXPNqeXAvLyOxkR1KBlwM30ezCrYnKJmyNwEpE7YvaM/yzINwOjWt2xt?= =?us-ascii?Q?dfNu5mwM2MpjJtxZPfL2ol5/WhoFzrLK4itRzjtpsr2eMyPTEtu/YOkeMlB2?= =?us-ascii?Q?RbBo8UO3v+99F/FRZeeFv9oYX3M7/hGC1JSEEKnZe8uzhUAxzmAjjcgvqdHO?= =?us-ascii?Q?gv3CmyIF11ICBth+a0VKsXSykxRYQjm51SGRkbTP/hx2v0JzcWm6CIEpOTW0?= =?us-ascii?Q?XVAiYcnwUuJ5edWx51iNDbXtPywzrIGJLSTHUIViKfYJz4eYNzKN6ks89pDP?= =?us-ascii?Q?snBuR0gCXyxbViLmrTBybn3oRh/MePng18yKjhCyBykZU/ZvvQ/pztVO3uCv?= =?us-ascii?Q?H8uWt+XxZEZm5UdV7mMaW3+CNFYm1JOt7MlUuCcXuI9o1M84UyuxjWSpBXOX?= =?us-ascii?Q?86LSfEyUwrWvIw9GCsyIh8mrj1apR3RZJvqHnQ4hOeiaOWxCk+aFXaSuC4+n?= =?us-ascii?Q?Vv/YNvoZZbHqkD09lgfdg2udu7loBFdgu03zD0NaWdY+pkAKugcjGnvoJiCJ?= =?us-ascii?Q?Z94wWs9H5ZpxrIj/ovmdA51haQYmS9vv/9KR2idGRxk1fALYz7zT30j4DbDP?= =?us-ascii?Q?+BGV/+uRbun3wyJm4HkOR6BeC4UrGIo3z8pNN9FfLD74pjE/Ow=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)(1800799024)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: EOYmr2tJI4j05lda/tqHAwS2YlkJZnw6tW4szYeeIx5uxihY5sVn8AgmkfH5mjSLOb4BQHwvECvP5l78cavHDiG8yxMAzO+KkZGW/EMebeRmMVizJbrsKOoGrmYjWHJrPJflgNKNF91jIB5HMCP5utnRZ2DxvoK/OYOTUaIM4PbEnY+Y2Exoh/ferw4dD3Ky47ccoU3FK9MM41/mA9ElacjlMJIs6mqR02LDJbkDru4GhQ9mKCYYbmb1QsptvUMUH71c8LiposEJBf79Io+Lg1HCnqqR7uArn28pKmyBxeVcuOB/YzMOppHRY3TaiA6fPgb0agbb7ASpBTcp6czL6M3B9+pUMm4DAt4lba/CcDnsy+C9mJpjLzh/+Z1VIZpTYsaejjqOAO+vs/e96sGKVALwZydWuCkoxcmBjnvAwy3HKjYor0BHqhzBW1es5SayVkuyjSDkeXZIU6edOTL5li9HJAAM0rA/b/f0rMaVlLho3039Wfj4Wy5Wdk89lv9FQ1xDlpEVSb6jfgNcdcIUeu/cdBwJoB81egX/UjAFSjYcF9iw/bbbI5umlYPv5tDRbMwBxTwxv9MRCgla0bYRfLYSvo9cy5HYRzYZGbOTsyxMcxUORUR/rdNkBpGDnGIm9jARIyqstOzkJ6qRQpfrNngzKcowR7GB61UdVA9Qtm4= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:09.1925 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 11d94c9c-5a4c-4c67-6f5b-08dcf92b6d72 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: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB2011 X-BESS-ID: 1730324411-304433-12634-44614-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.110 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqZGBiZAVgZQMMnS2NA02dg81d LcItHMwMDSLMnQwDg50dA80cIy2dxcqTYWAKHdxNxBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan16-249.eu-central-1b.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 From: Danylo Vodopianov Add possibility to use RTE_FLOW_ITEM_TYPE_UDP. Signed-off-by: Danylo Vodopianov --- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + .../profile_inline/flow_api_profile_inline.c | 103 ++++++++++++++++++ 3 files changed, 106 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index cdf119c4ae..61a3d87909 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -19,6 +19,7 @@ eth = Y icmp = Y ipv4 = Y port_id = Y +udp = 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 0c22129fb4..a95fb69870 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -166,6 +166,7 @@ enum { }; enum { + PROT_L4_UDP = 2, PROT_L4_ICMP = 4 }; @@ -176,6 +177,7 @@ enum { enum { PROT_TUN_L4_OTHER = 0, + PROT_TUN_L4_UDP = 2, PROT_TUN_L4_ICMP = 4 }; 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 29fe0c4b2f..1a92de92bc 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 @@ -827,6 +827,101 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_UDP: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_UDP", + dev->ndev->adapter_no, dev->port); + { + const struct rte_flow_item_udp *udp_spec = + (const struct rte_flow_item_udp *)elem[eidx].spec; + const struct rte_flow_item_udp *udp_mask = + (const struct rte_flow_item_udp *)elem[eidx].mask; + + if (udp_spec == NULL || udp_mask == NULL) { + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_UDP; + key_def->inner_proto = 1; + } else { + fd->l4_prot = PROT_L4_UDP; + key_def->outer_proto = 1; + } + break; + } + + if (udp_mask->hdr.dgram_len != 0 || + udp_mask->hdr.dgram_cksum != 0) { + NT_LOG(ERR, FILTER, + "Requested UDP field not support by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (udp_mask->hdr.src_port || udp_mask->hdr.dst_port) { + 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(udp_mask->hdr.src_port) << 16) | + ntohs(udp_mask->hdr.dst_port); + sw_data[0] = ((ntohs(udp_spec->hdr.src_port) + << 16) | ntohs(udp_spec->hdr.dst_port)) & + sw_mask[0]; + + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], + 1, any_count > 0 ? DYN_TUN_L4 : DYN_L4, 0); + set_key_def_sw(key_def, sw_counter, any_count > 0 + ? DYN_TUN_L4 : DYN_L4, 0); + 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(udp_spec->hdr.src_port) + << 16) | ntohs(udp_spec->hdr.dst_port); + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = (ntohs(udp_mask->hdr.src_port) + << 16) | ntohs(udp_mask->hdr.dst_port); + 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, any_count > 0 ? DYN_TUN_L4 : DYN_L4, 0); + set_key_def_qw(key_def, qw_counter, any_count > 0 + ? DYN_TUN_L4 : DYN_L4, 0); + 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; + } + } + + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_UDP; + key_def->inner_proto = 1; + + } else { + fd->l4_prot = PROT_L4_UDP; + key_def->outer_proto = 1; + } + } + + break; + case RTE_FLOW_ITEM_TYPE_ICMP: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_ICMP", dev->ndev->adapter_no, dev->port); @@ -960,12 +1055,20 @@ static void copy_fd_to_fh_flm(struct flow_handle *fh, const struct nic_flow_def uint16_t rpl_ext_ptr, uint32_t flm_scrub __rte_unused, uint32_t priority) { switch (fd->l4_prot) { + case PROT_L4_UDP: + fh->flm_prot = 17; + break; + case PROT_L4_ICMP: fh->flm_prot = fd->ip_prot; break; default: switch (fd->tunnel_l4_prot) { + case PROT_TUN_L4_UDP: + fh->flm_prot = 17; + break; + case PROT_TUN_L4_ICMP: fh->flm_prot = fd->tunnel_ip_prot; break; -- 2.45.0