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 2739B45BB4; Wed, 23 Oct 2024 19:03:57 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 32EDA42F97; Wed, 23 Oct 2024 19:01:32 +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 67F4B42F2F for ; Wed, 23 Oct 2024 19:01:07 +0200 (CEST) Received: from EUR02-AM0-obe.outbound.protection.outlook.com (mail-am0eur02lp2237.outbound.protection.outlook.com [104.47.11.237]) by mx-outbound21-18.eu-central-1b.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=EMg7BNv5U4Vp505rx4P0SAE6T6/mjtbFz3Zu3FDSldgXojiPS9OUwgnwaCeJFMmyJ7ksSa6lA5gtqX0nBHZt5QBJmt9L3xnFzq0SmDsfqBpfrW3hfhPwyHs5lGsjWk+JpLsDuGE9AOQR8+MaEpMHPBG72j+G4iq8H+vtCXY42Rp3v996UIl+4htUH8b3V7qfYdm553oMhtSwfYWbQn+m2QZBR/BrZEGhxMigSbOJ2WRDeyYh81te7pHQCcB5Rad68JWB4z3Si0Zp6wrNqNbk4b5GlgwNYmlL9djUp6E6BpaPE2ak4Ld3BlRh96vRFL6gxQRiShRYZaXEwgQlLmAJ0Q== 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=sgKavKocV7Q3ccCb9ZfjoAx94f6Hb6zX5ErhfRDT0ec=; b=thkJhODj8utpMgbJJ2qmqYqWNQvLkJ4NCL6z1tW1oDvAkCaowK114DU/Vvh1TtTvo4akjlJWOQqT1Cge6g/09y0FvGZx2BtT7HFDlijyVz3N0O/ET+kgejfO2ZFawQi7BJc3dwTsxa5i60OHyBr0HNxYcYqRnq39WWLy6aYk2oyTB8z6zXD6gPqM8qO2k2ACTQUWjRvMn3brwnDwwQoRTQZvJkK3kuiPA6xLe+dFeF6Lt33ceGwst4ydg5N1TMLSIppU5bPvICDzELu2xrYsQRIKNEXiK4iMZFK3rqhOAvtqDUgnIAAIX4zCtZ1LFl/6jg5VxBfiKeS3EPDf6n345A== 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=sgKavKocV7Q3ccCb9ZfjoAx94f6Hb6zX5ErhfRDT0ec=; b=h1fLfnl+USkreQl0qkpmB976oHWc/FhwBSWdiRdQ819LH/FXkxjUZP7C8InyT3qX1m+1SVXSygi03GrOgsa86y7Fe/YttGnBCT5hf2Q04Ynoqmtq2Ntc7L8IHNMjnEj8Y6pcCnwHVML40GLtcqkU82xmYwpLvgE/c6AdDK8kwY4= Received: from DU7PR01CA0017.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::19) by DB9P190MB1324.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:22b::15) 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:00:58 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::1f) by DU7PR01CA0017.outlook.office365.com (2603:10a6:10:50f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17 via Frontend Transport; Wed, 23 Oct 2024 17:00:58 +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:00:58 +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 19/73] net/ntnic: add item UDP Date: Wed, 23 Oct 2024 18:59:27 +0200 Message-ID: <20241023170032.314155-20-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_|DB9P190MB1324:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 24df5986-0079-4f5a-47b4-08dcf3844450 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|1800799024|36860700013|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?nfDFcdP+cAenlEOuoqaDDznDcryv1V5t4JsSy82sJ3thYA6rC2UYN+CBDBee?= =?us-ascii?Q?WcoI3dH6TCF/wP/hj3OgRZ/t75T4ZrzqjkixfNXtrFkywIv1Tmjf19FiJJbn?= =?us-ascii?Q?9A3QbSHTch40YAj7YUAz5bgrdVGHGXJvCi0SnL7KO1Q7GM8Rt+4+gqLDmdp0?= =?us-ascii?Q?yhl7RjrkaDtvNtJ7GoInjM98NiVOkbIY5B4rdMdkiW9uQIchqpy7eaQIYHmq?= =?us-ascii?Q?9E9nWRCal6ITC4HeEbcsTGWZq8AuYZpSEo9a1lVfffRBGrkAapGIk29Aj8FI?= =?us-ascii?Q?EXXLXtiBAwV0ObcyV6YAKlVRFC91w0iy8yV4ASZIsDtaxkH08U/DVGt5/Iut?= =?us-ascii?Q?CoHUzejH/qqmkAZbcVL0Ih8LtObGk2di0ipzK5OTmIWgL2HMTuBu9Auqn2j5?= =?us-ascii?Q?UOjCu6cC5dWH5wPzj4z9uksDdKhngWItfIpuS03VwW/836GyCDe+LkOUnpJ/?= =?us-ascii?Q?9l4OKEFJ8JyxoHN34OZjcU0K5gqnjeJXaiXPRTlk+DiOtPt3PfnOnBQq50pl?= =?us-ascii?Q?eLVqo/Sj4+9HgzwmcRhuUMBqGZkFXwFItexc579SuUdiAy7BHCjgGkOJmLB2?= =?us-ascii?Q?48eazDu+rdJYdPAGQBJ8AiK4QifI9BH8i2aMCnTdKOn5llgimdpqxyYRrsHA?= =?us-ascii?Q?mSa5TJv5NvWx2uo20I9XD06LxIxDH3GcQBp3GbiLXbzQW3v8JXdmnIcOFj/U?= =?us-ascii?Q?n9wvOQqsUoBayJbcjginfbymR34b9uE63JajFYpqvcSBhJo7EJgkEfSSjQJg?= =?us-ascii?Q?q4OlIab2Eq3n6/QhM/nEGrnUQIBZ8QqQsIbmlRgwA7S3mu5N7IuSlQ3kGQxr?= =?us-ascii?Q?oYeWQMr4RODexi/tJUviZu7mSA5FNf2YB3owcXMaCGE3yUIVuFGqTIH3GhUw?= =?us-ascii?Q?rUe8kq0W013RllDsqqj73aQlxZIMiBC66VVfw1AeEdiOtnt4799YgvIVtmXs?= =?us-ascii?Q?JSKbHC9lXggtXthjnJ3UOzT1MBaP/+bVqL1rFIj0lqZT5YLkT9BN1+qxAw/a?= =?us-ascii?Q?JxLTNviGPdMeA3eu2yDVgNjgK2TSVWn5VNzNs/b+TWUc7XzuJSkbdOA7fRZ4?= =?us-ascii?Q?ghF56ncrp+A83+cHzuSBzCSNf2X14ZpKM2zmP4A4ba6qMGMRYbPD1Jt2AbsN?= =?us-ascii?Q?2RKWGW1gGzOjZII0Ghehuu3rbZJ66BNRrw8bPnETWgpY088y+//PS6oq90AD?= =?us-ascii?Q?4y+VhqYMlZO8LM1bQrs8Upo2OZBjJv8aFAKbju3ilic20lj2LdmipdRX55sg?= =?us-ascii?Q?FaSV1gEGF9OmYf1jqGxlox64ioRrp9RJG8uQjcRsdDFj6aCAgUMQfBfOOOT7?= =?us-ascii?Q?odXgxspJ2O4IaM02cDw0JXxBfGPxogSY69p5qGyW1vpjJf/EknZ3TxMghwm2?= =?us-ascii?Q?rIZyso6Lp2sIt6pKP7TLVgJMa2SlxMSOtpSHXrmXF0b2FC2OzQ=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)(376014)(1800799024)(36860700013)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AN1sYNsUXCSgPX0ccYViHYCeQc5IkYng8XmZqiwYgMv106NHdWbKrALbC6xODbA1H220Q2ywWCJ5KliM5XTfw2dP4SSp3BhcBB8YzajZ3N/hilGer+TRKl6e3c4yzXXR28z6YUUo5eCGByYP4RM0v5KoAEiQ8LKkKjW6zaBC3feDbKR/RHXmuG9qcNhGTKEU+b3s2KKvUTRsC/esfdcnt0eWzqI8hEa1WWn1zkeDLvWDG3CS8axIqE1086HM39i46u5AEyjv65kOSPK5mJ0V5hwyyqal9vTkiBYc/aCZSyJEgD37IzvRz0/jls3HlIe38iyHyyxWLmhekr7iFKW/ZWdRikoX9B8SJVqDFtGznKQtWsjR5NwW1lnPJDcJkAhvky1ITMaAmBA0RICCWaZ+xfd17HT2w3GxwTQ7nUyxh6RHmcAlAGtjLyEdEW/1G1AaZtmXYw6888HUKCAP4i9SXc6LuPr4fJQvYveyciDnY75I3ZmYMDeORaHIgC8DNOnSkdq7AYyiNTIYtjNuPwkJW8jGET80qzNdcDxZbT1md/jNJ4guKuxAh9hVQqaCzRzLPw2e+Ib1pi/3GZ9WMwz/lQQgXN72T8aKje7ox3GF9RbdB2u1Mfe8FKER+siwFvPNB8nqMB1l3OGO4t9OEuVOmrWmu+FZNOW5EzrCy5PJQVI= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:00:58.4456 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24df5986-0079-4f5a-47b4-08dcf3844450 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: DB9P190MB1324 X-BESS-ID: 1729702861-305394-16202-13629-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.237 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqZGBsZAVgZQMNUsNTXZ1Cg1xS LJMDXVNNXCxDwpycgkyTDJKNXCwjBRqTYWAH777UZBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259925 [from cloudscan19-22.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 e47014615e..3d4bb6e1eb 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 @@ -828,6 +828,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); @@ -961,12 +1056,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