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 AAA4245BC0; Tue, 29 Oct 2024 17:48:09 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 66CC442FA9; Tue, 29 Oct 2024 17:44:24 +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 2772F42EFF for ; Tue, 29 Oct 2024 17:43:34 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2105.outbound.protection.outlook.com [104.47.17.105]) by mx-outbound17-86.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 29 Oct 2024 16:43:31 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=lUYO8styfG7qsL1E9ji+hvSjfhrIHmhED7fEhjBjJnf92nahZVZCUSdNVLWV/mn2bgXghObJUMtKpvMF5uMX1GzolUL3mh6qQdJ1RXYiQ/WKYMa1mg/2NTVc5N39mQAPb2mK5lPlS5VMpfjqBzZI/gx1bJyUK9T8AFQgBph1/8DKO+eR5BNxkelpOIVzT2ikzCSN5nmBXR8v7u0mU/85s+JmRRT9N493hx+YAR17N/LNEbc+qErQrBWbdl5RSdYtcCv5lFQKrL5/p8NeQGIToSSGMYWifqaMWIm/5EdsNBO6MtoJWHwKBHpJFFfONlgpiXUt8bK0OvD1f7taWiyxXw== 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=PQk563e8QDfstzF8xYwvMHV7NhYsrvin4TjIdO0/Ze57imb0jClzPoRfV+wCSWJuHFIYFnHWjoLcjVc3YMMtYh1hRPYVdju0s8BfZ7nF5JnKB423OZKSHIKm8mT6fjqufQKH6cUbr3PZA8rGsmp3cHtqL2ZfXdYVNk1Vhqy1NZM+b2VtRqlHXAh5NCHgB01lWxrcH3HUYZXudsjfYLKP18/1Mucc0C1/8EIhO7hdcl+MhcPn5JQVTHmIjhHQgbUcC6+xVialWKUDmFIn9153GRRUlfYl2V8QBFv4z6vkoPMVW4EFMF6W39VEmFJ+xHBiZmuCl2W0ZlyrPmvGeYoeAg== 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=VlfsHQp1mccDyHKK9sH9OWxPzRzh/3nQRe++C/Cram4urSu3HEb4wfOBht2FoZUzg9O/nudkx/nfVZmoZP4vGt4Qn4VWXVzg3kLUFUEqKdMAc8hlxyxbKmDPC6wcqHmlMLpoAGMt/KRpF3aPVAf3H10n2pFZ3K71xQO+hSyTSko= Received: from DUZPR01CA0204.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::25) by DU4P190MB2224.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:571::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Tue, 29 Oct 2024 16:43:05 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::36) by DUZPR01CA0204.outlook.office365.com (2603:10a6:10:4b6::25) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.29 via Frontend Transport; Tue, 29 Oct 2024 16:43:05 +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 DU2PEPF00028D06.mail.protection.outlook.com (10.167.242.166) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Tue, 29 Oct 2024 16:43:05 +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 v4 19/86] net/ntnic: add item UDP Date: Tue, 29 Oct 2024 17:41:23 +0100 Message-ID: <20241029164243.1648775-20-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241029164243.1648775-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241029164243.1648775-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D06:EE_|DU4P190MB2224:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 2e784270-9ec9-43ec-f408-08dcf838c332 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?ryDBZmE99QuSvRWlogBkFsquBM2gFAOlrGhQrZZuxsT1ig+eZnzeUEip5xxZ?= =?us-ascii?Q?5rKZXr48/dXmZnbwF8TKJq7KmQy0itMmKl6/ztPTrMF7QXh/sXL/w9fwZmsl?= =?us-ascii?Q?whQs8VkdJMggkGAlnVY9qcIbueDp+VEkVw26icyBS78SeMd/SXlKl7qTLdMM?= =?us-ascii?Q?/kT0MfiI3doDKiUxsM39YUfIVdq2Wy40Ihy1mzqNllyiF5cEyPTk5pikUzO2?= =?us-ascii?Q?qWax8hD+Qp6w5ixtSac6liEdQFF/W8DhtP4Ilwt7HwPw6TYsvxVtovMVsVGu?= =?us-ascii?Q?LUQBk41kgZp+Z4uy5EgvDSRpJF02TWlKmQ/tCmXq6mYQCK/P246WRsEC//o5?= =?us-ascii?Q?ZrYSYgNKK6ktyKMY7r4PTEg4HYuA5O7UfUBF+6TdC95OTN+/eYJa97IlL5jv?= =?us-ascii?Q?hh64v26va+dCsSiBvtuHSbQNZvgnmr620cB8Vk7J+YOJ2580Wk/fjzBMFoAx?= =?us-ascii?Q?o870x/CqUzUnfpl2seqL6FTTkzJwRTPfJFgI4viZwUkgfw7q3lHvMmMACUl7?= =?us-ascii?Q?DQubm6qXHvnmsi0z3VZVnZ/WwpxpZ3Vf5D0N+U3ABW1AblYs7BqwSQuEAX5m?= =?us-ascii?Q?17dX/YasMxe165Yoj8tP6eWHzQDH33uaGGko1UH2CVMfjiUG+lqnQZFmxmeH?= =?us-ascii?Q?cnBWdUHJfmI6TzCyVN/TCXBoHAWyjouxNV+ue+4cErEPq9wexp/IGLVoOIbf?= =?us-ascii?Q?6dIRtJD5ygp+1aYRiov63c5a3hmdzgY4RgjuAL3+TRYdDFVsFF9HbFvXq+Jg?= =?us-ascii?Q?Kl2fciH1HzbWD617Ycb5TxB+G5MdEw2x2aNFLtC8CKBVqnvajBcqbrWqM1e7?= =?us-ascii?Q?CVjdbaWZsDJwVBIux/9lGYhJI4ui7hG44exWM9nzDkmRpHFnV+wyFMUW4cNb?= =?us-ascii?Q?U9b/3X8z1dOD9Fe6Dbth3RUp6g1J2A0Vid8R2+9Ynf+2IEkJgjpsTVmUmwlC?= =?us-ascii?Q?Mvdiifmf3Jizu/Mgg8sDgfnZlPcfeHq82sJh9yg+xeNJVxgw59TtJeFRdfRm?= =?us-ascii?Q?V8svzZOO4HRF1aeICUUE2gMIIdiFjiP7t7R9BkeFIOkKSqdT9ttKlFpCVhYR?= =?us-ascii?Q?eCLYAy61qAV+YcXY8XioKummZlkXUiDGI/GnDOvGoUqr301E3zk2b/4AcEv1?= =?us-ascii?Q?gUlnCj3/X27Kyb/iPoA/9tdm1K1WcU7YaWpRe+a/h0etNhitBDLzMjXBcLZJ?= =?us-ascii?Q?xycPsEWD+V7nvIRVAjJ97pBHuinq9HXVqennN1uI0FVBuu5q6UlUOcSFYzpQ?= =?us-ascii?Q?GKsvc2o/OuyG9qhHdiSFKL9uR/I/HkE5I1Q4En9BNHEGzeuSR/03Fpp7Atj4?= =?us-ascii?Q?EKsQ+4zZFZ5G/jFp4ZNN0VRSFdutG8+ciMWuvGtqf7KMAhU8e8ffBt17eRz4?= =?us-ascii?Q?xMf9G80nyGnPb3GTT/U7AgUHB9+lnAtpqAVWZ5DsyWakcJSOyQ=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)(36860700013)(376014)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 7y2RxzFt7b+n1aE2krtVUUGaDwO0SAsNcKg5hhzVU93/2gmUVYlcRY2UqtpMmmX2M+v3K60ey5qyjrwpnTSTxaE2dkmI/4IHTCqii0ZojhBHuFfpwnELoBSBbQPH2odEMDzOP1c33HUDv7my1arkyFmcHepQgHzd1cWTGzZg64NyHhTyw81zoQiB7LVIkCLA8H7TXXP9iK1cB86IC3Rjqvh+Tz8ge5z5v0ABGP4gqRoRuKBXwP4SmfAghVAfH24NRfdh14xqJ6TwbTgtOI999S+Ou72uiH13HxkOwoE+bZrZwGBm+VhV+mhqEuQIepNSrkvBdDcUivK5+yN1KgBddskc7Vt1gQGRedQ4wlUblUOBL0jJuyhHviIp7p8jxpqjOVgXyOk7p1MMrx6Ftiw7peRc4x5PXawrZWyoe6geI5kQIANmwTJ+tXkDolYqb7Tkk+g4mj+lgV/AecMxNCh4XJxhXCS4FJRCAZwH+K4pLegSDymMWLJILTk2YldXi+yemeuZDNEHZbPtRTxeLIn5aIc43+FdrWsuyENIr6VHmub55BYO/wA0/0dRafufMgKQ8uUas10gmNDWzGHtDSs6xtcy1wKpg2XGetqC9vVU0YvF3TA5oIGFAG/Gi6r80z6daKf7AsVIWd1WBK85EW8plSSOcHTJzfZwaeGCaXfTi8I= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:05.2927 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 2e784270-9ec9-43ec-f408-08dcf838c332 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: DU2PEPF00028D06.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU4P190MB2224 X-BESS-ID: 1730220211-304438-12711-30041-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.105 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.260063 [from cloudscan19-218.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