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 6B52B45BA3; Tue, 22 Oct 2024 18:58:31 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2267B40E22; Tue, 22 Oct 2024 18:56:38 +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 6B1B740C35 for ; Tue, 22 Oct 2024 18:56:25 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2111.outbound.protection.outlook.com [104.47.17.111]) by mx-outbound15-54.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:24 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=adhqo1rnnFKafL6Bd9S/nMjUo6ptQfSN56GfzRLr9RhLVm++RttR2I4MQ5e8/DMNP8KCgNajFNzmpUudSpm8KT8oWtIHAzSzBp4JC1qvu/RqmrO3Nq2B5sp8DhDntYd1cMWhlxKQaI0Q8yxHaIDuqYvBs0qGmGhcA5tux1HobAN208UuIuleKk8FOLC66lDHcZotxyE4/AnzJkO4S3gJ7zCaJiT5V24TFrq0eEGPRypJ+uehxUB9jr/qSR0srX5vF76YXi2Q6AVjd+slSIbzBIuBTJFeOKqEK+eVVKIvayggw4Jb00zPxFhgQou+CGz3XaoxJ5iM3dQd9ttLTnlTVw== 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=fiZdlqHoaitCytOBI8R5uHdcFd19mF0FHwsVuSqESxm//TtHPfUtn13vC2F3QXTAH4il4GYAdMRmU8DYk6Ccdadndz8BiROScJJhdGeInQFGy/lovl+o7lkbg2FTkiPXIbtx91ZiHcVQwl/Lnb1VMKg3uSaHJ4PvbUpUgb8jj4lXyTUaro2rDy0vTbVkAneTLg8GK4EbFrGqW17dQZcUmuy1nmcS2Q1H+UkNMDIJoWRJIygppZaV6xbfIyTShUXCNFvJrDko6EE6RdBznPYixiwd4J6DVGwn1elz07c954oC5mTemZtBUtzeJ2Dve5B6BQmHgzG2NX/1r964rjKcZw== 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=TzXTTNAEF3QLlpmnFxzPI2nUCtxgF40Ug1MfKJKR60QLSCz74vmI6pNVMyMI4rhl9SFLjMWeFoVuf8aDWR5W1rndcnAYMmpWCrJEXjgR0OYuujMA4Z4RODgVj2/TP/I9xtme0o0qp2qR27j9r40nQOSI+Xvh4k6Hf0mvC3lnozc= Received: from DB9PR06CA0003.eurprd06.prod.outlook.com (2603:10a6:10:1db::8) by AS8P190MB1320.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2b6::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28; Tue, 22 Oct 2024 16:56:20 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::4d) by DB9PR06CA0003.outlook.office365.com (2603:10a6:10:1db::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Tue, 22 Oct 2024 16:56:20 +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:19 +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 19/73] net/ntnic: add item UDP Date: Tue, 22 Oct 2024 18:54:36 +0200 Message-ID: <20241022165541.3186140-20-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_|AS8P190MB1320:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 4f0dc770-8646-4b9d-a5c1-08dcf2ba73cf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?3568zod1bIFPmvrXeDrZtKq0pv3KZN4aM8b6sMsZX+U0EYsEkilRU0TdbB/j?= =?us-ascii?Q?MtwnqrAx01liJ43h42YZx6lzn9e+Xkf5TXHTZKmA/9AVS1oEDmXgo/lCY9GW?= =?us-ascii?Q?qwcCdBJqKTTfjCW/0n1d/ESoRCdHj+2OLPQeAPYNNTRPbxVX7ELrSfCtS2Ec?= =?us-ascii?Q?xteUQoduwyzQa819ohHOF5uBve9u+QQQ0dvVuUbE5w8SzkzszY01gEuMgb8W?= =?us-ascii?Q?I5atz4DC25QoEPbhbboZhz4X5jV/HjRiPDspTQYortE0p+6fkqoj5NUW0JxL?= =?us-ascii?Q?OREvkWwU3iqn+iERC7/fP8pFT7bWcIWz3OODUxwCJjI9GR5cpI4k20iBjYd4?= =?us-ascii?Q?lORp4Xl26E09Y3c/3dTLC6KyaewhwrVw1Qa8hVPTS2rHSWYVhpg+O9O5kRTP?= =?us-ascii?Q?xWhto/vid10amY2T8s1Wan9e0JELXyd8PxwlERrpQiz+DYE5QOJnCRPhXn2n?= =?us-ascii?Q?ZHobwTIg5AA7DZX5x820eTzz2ZkGD3Q5RPO/vP2+D2JDptw0Nh15Fi0J1Hm0?= =?us-ascii?Q?apNBeSKKiHXXz3ncWlEm91FC8lf776j5fSxwOn6RzydIWwTWYe7qyHhh75El?= =?us-ascii?Q?JTQXCTThdccup/YTRytP7jreALnaJZitTI56DEJ9y/OOI90ltr90XnFJKwTU?= =?us-ascii?Q?WrZwSC7SeHFAIBLjclfOijaJv44GjypmWNF2mRz1lXv4MaaKleX69DHxvYMs?= =?us-ascii?Q?zRrcDKD3UEhEKGRP+dWl0PvQ4sLTuOWmFBGQeFO9YkLoEwMjkpwhx4ieUjfz?= =?us-ascii?Q?ElKcW+O0XLADwfGyhJGNgymZN0geWZz4Cq6j6ULmjMqQoxggePUkMyKU5Wrz?= =?us-ascii?Q?Z57esB1yn+tGgtw+QgGYFL2bUJiyYPk4Q/44HLPxeocc8ZnYV1PVIAbHy+cZ?= =?us-ascii?Q?fx0D5Yud7JxjAg706vh+BEaytqMLodJb4BQ3fjvIFGWc3D22ye0xepjjCMdq?= =?us-ascii?Q?DrKQyL9fwvHjcwhGAU8Fc/GcpNNYLp+xBrZJw8EZVkDMsnm0JUyJrIP1Uqgg?= =?us-ascii?Q?+03fS6HNEsS4hiXtuO1PHTsz3NHBuCGEek8z6lA9SGtr9nYOirxieGsk6MIF?= =?us-ascii?Q?d1SjTyyrqFFafQnIUnrsV5F7RAQsGtfXaGsWx5jn1itx1EOkZLZAOOD/BFYt?= =?us-ascii?Q?3OzbotKITeuKUZBU93XiKMjlucDDu8gBQHLSufwGgq0PBk3mCwEJO3+nC2wl?= =?us-ascii?Q?6PdcRbkFte8E61TodUo5PH4BGm+KSge+wmRebNMsHTocj+7GfNAcdfVd4Onj?= =?us-ascii?Q?+yLvO8p5MkzXuUXRcJ3s7WKZks57mwAZmzDekUFQ5OePOgJfyfwG/ol58Z5f?= =?us-ascii?Q?lpN0jlPFpM9ketLcUNcKl2fkIEgxNOGBGU93X65cDXylq4JsSbsWP5UpP3J2?= =?us-ascii?Q?gulxBPnvhhrRLGUKHmf2i062+9eWw3zF58H8gcyZZXXRM1aA9g=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)(36860700013)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: mz2oDB4+6H9bJ+VL8NTeQ8vy20j+Gd+GEkzyHhffzYoLlEkH8NjDL6Gwmfd3BcXKLVRiFLlVNoTYNiWxmJZxUIkkmrG+m1msTRG4RlvuNJTfhvveeFjS7kQ4Um3byO+aY012JLqhdE0qxzPORZSfv57H/Duyxnzb7lEKowtCRdX4cvUtF4eEUEfywb5Px9KAcVVPAeHrA7ZD2MgB/gjMx6EcwaOEzo8YdfUgqpg+nyjHYFV+FRWNF8CniSwEMe/wh94O0SSvcIVQH/OVPY9pq3/68znD/eD24co3CYT6x/cQ/pzxyeahprQgpg9na1Ejy4HNWxB/mEeminYyam5+8TIIGeOrsKbTADUi5Lg3+byACsYmkSw+eMN8H4Kh5ryGaVNL18PZ/zIS4/XQKY+K4RYxg8YgymnEB+yuD822SDCaYF3WLJOi+Z+ODzYDmjQiUVHABTC8fuk7VWYaH+Zrh85aLN/MRUkUuEre9Upu1OYFazz+BWWdZOjiak66fw3Y475ruKdNEyk7IvdsH6VHmKsq/qnxSVq1H0DOAgLGVtqdzu3d7zNLStxvbtRMMrJa9VAsD22fMTfmwXdOaFYi6niYvNYZy9ijpQ60P7AhDrxxSUUpz7+37FMIY3GHobb+BbfrWqZSgLmD3iAlVWqOjb68ZyjHRyFUckUQPNbZ8vU= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:19.4969 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 4f0dc770-8646-4b9d-a5c1-08dcf2ba73cf 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: AS8P190MB1320 X-BESS-ID: 1729616182-303894-12662-13511-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.111 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.259902 [from cloudscan15-37.eu-central-1a.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