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 B012145B96; Mon, 21 Oct 2024 23:07:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0CB1C40E15; Mon, 21 Oct 2024 23:06:05 +0200 (CEST) Received: from egress-ip42a.ess.de.barracuda.com (egress-ip42a.ess.de.barracuda.com [18.185.115.201]) by mails.dpdk.org (Postfix) with ESMTP id 189A340B91 for ; Mon, 21 Oct 2024 23:05:52 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2112.outbound.protection.outlook.com [104.47.17.112]) 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:51 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QL2kxkV7RTRGsPC0QuQ4YRdnKwCMBmUKnlVWxZQWUyoNUV5clfAQ2yw94Bp1JC0GtWJSrENC1vbOKz080TH0yfwuUe4naGGr23hSIgVFccjR3hijQhWq7/6wfXdLnZH925aXdLPRzfkzu/6dzV8TVxSF16Hu4YIgsbm/tYshEUALvk3s8WUXenJ/PZ7uOsIG1u925AHWhBVaBNcSRCx/dXoucqOKlTldpM8yVugsn8e80Geh8k34ngxe49mn8c8OgCafLSUbarMuhuvbg9BZJJNJQSWLj5xNsthEx44nxzfzr+DrC9Qn0IaxYGiQyp0DOjxL3oLMKaypd9l7bojblg== 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=CQL8mN1MG2lpwZ5+kQ/7ZM1EvJrHNgRMjaukpXC18DA=; b=qFnbPFVqIB3JFUQwW6T/e/SSoPrKdZzFAPl6s/qhA81fsh/g7ObOonN1RhMtnNKUjuRAbWroKszAllJxyt/dN8wox9FNeupEml97bee/Wn/8yrim8UPS+OmeFJA83h+3UOJSbcU0Zc/h78OSEhLlLzD3/nJmWv+3UfteOCTEhggePXZOIZy7VByHvwVVfKhNxgvlk2TjtNTIIR17U9WBHaEEUMvbNYZfARUUYfwwTGHuRscnjBjT4c8Err3F/HZYr2rkyyKkxDRn5w3vyyMP/V71tEVH4/lBsJdXIU7eLsWB1FgsVZLZ7UJcbA6SkA28n6eVUyDPkVtWgvOgqkEJTw== 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=CQL8mN1MG2lpwZ5+kQ/7ZM1EvJrHNgRMjaukpXC18DA=; b=AYiV2EML+aFM8jwtgjMM2tDu7jWcJgF36L9PkuU97j2REMQDouXykPqHOaRcU1GL8YayXQLrbX8OlNv5gsDGMH0uHjC6qkHp8H6DveIOGOv0VnsXvHjO65n7zNRZ8AhotImwNCS3feWuN6zzdoWjBALXieeAQfrEeL1fzAaJx4Y= Received: from AS9PR04CA0137.eurprd04.prod.outlook.com (2603:10a6:20b:48a::12) by GVXP190MB2232.EURP190.PROD.OUTLOOK.COM (2603:10a6:150:219::7) 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:43 +0000 Received: from AMS0EPF000001A8.eurprd05.prod.outlook.com (2603:10a6:20b:48a:cafe::31) by AS9PR04CA0137.outlook.office365.com (2603:10a6:20b:48a::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.28 via Frontend Transport; Mon, 21 Oct 2024 21:05:43 +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:43 +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 Subject: [PATCH v1 16/73] net/ntnic: add item ICMP Date: Mon, 21 Oct 2024 23:04:18 +0200 Message-ID: <20241021210527.2075431-17-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_|GVXP190MB2232:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 6a80d1ed-28d3-4deb-4477-08dcf2142034 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|1800799024|36860700013|376014; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?Ygsj7MpN2t32uc8/I15X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Q?Ps1IMPrVsQhbYhV341mzOLJ5uaPsAF41YEU0iTyopjbSeLJFD+U484MC2XDb?= =?us-ascii?Q?NkK2JgfxH6p56HbZmk6IdRRvqNMR93hNzAsXOiiR77JseHzHDVFMMCfeZFQl?= =?us-ascii?Q?YrojGpiX1Zp6wXmNPO+io512gL8Gm70clxTOYPBpwd7D2GVOcLOtk/vbB3uU?= =?us-ascii?Q?1lyPJQAfUwqc1VW65j6fEppaXrSsROBNou4a+JedKmnnSVjiUuL9UD/KGKAV?= =?us-ascii?Q?T5mz5GaWatdHAI1Ld7sUm3frH0DGsqXjsi5Wp2s/S89x3WYpUPVwAc7GNCmu?= =?us-ascii?Q?4xvQebU60IfrSM84TOQZs/BPGDA82MgZEo3OjReyIRacrPISrrxXhyfV5+gl?= =?us-ascii?Q?d/ogSApdJ3beJilv4hJyP//j5cVmnqDftD439zsKyvmDNpNqVJFHCl4+lKNN?= =?us-ascii?Q?fPZDrAj+jJX7VJ/7zoJCagguirY37RS9RCbqk2lO5aHPoud8fAszY1IiMEju?= =?us-ascii?Q?idkDaCNCyw2kdTjTNQMMQnsscEcSCUjdKlQGXtrkGKwr9qJQDQ=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)(82310400026)(1800799024)(36860700013)(376014); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: CGkYJrT+HAXA8ErTHjDxBwJb3/GNSTRxBBvB/LKkXPyoZAbNM258zl7bc/a87iKsWPU1xTTkc2wQSppeiDxpXL1JMGKxn3xmR4VxM4lUhEoVuIfUpcQHxsbeaDCf0TxJVnLF/cilMp99xP3p7Epb0ExBP5mMVoVKJMNk94AL0TCbo+m4GP9f/izUwLh/H+uT0n6t4dbh3Q+vcqEeqnbW8LdN+DBTfavJLN6ko9B2aXlOl8Sk4H9tIFzBLLg2J7nbpKIxSiwpozRG/wU0cNwv/xLkoD4Wyabg9QFwSspOXmxZc+6VP97Cp6DH11HmAjHJKsb+2OOn+98MNXEVHkmhz3LZ+vMJst6XxyhUM0wp7j586tiWTlV7sxATCT9v2NnlNuZyWFIv4Dn9+4GVXzBP/gwuJqVsLqwMhFek7m5df+hnKymlAdpPg+1TFEo1ZMj+pigd+GDiBjkscdNYcgL1p4vbvBXLP2SBUMUnVhDDVPHQcxkO8kF1JIKMY7AgYPx0pAwrzkZd0z6R/ylr6ybqpFsUC4YRLb8RkA1K1kYkrhMjmNbMbPN8zNbgeARLN3QWrgm1ScEv8kPReZecxa0MVP4V6W9kizILfJGHQARFj5lcCnCAP0p8QmNljk7u+xwNQnzABH62PLt7oaaxL5XG4KjGPGi5nsKCggzrxHkhdlc= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Oct 2024 21:05:43.1925 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a80d1ed-28d3-4deb-4477-08dcf2142034 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: GVXP190MB2232 X-BESS-ID: 1729544747-302135-12910-43224-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZGBiZAVgZQ0CQxKcXU0jA5LT HV2NLEPM0wLcXc0iLZzDgpJTk1ycJCqTYWAHbJjgtBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259883 [from cloudscan17-111.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 Add possibility to use RTE_FLOW_ITEM_TYPE_ICMP Signed-off-by: Serhii Iliushyk --- doc/guides/nics/features/ntnic.ini | 1 + .../profile_inline/flow_api_profile_inline.c | 101 ++++++++++++++++++ 2 files changed, 102 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index bae25d2e2d..d403ea01f3 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -16,6 +16,7 @@ x86-64 = Y [rte_flow items] any = Y eth = Y +icmp = Y ipv4 = Y [rte_flow actions] 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 aa1b5cf15d..8862ac2a0e 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 @@ -829,6 +829,107 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, } 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); + { + const struct rte_flow_item_icmp *icmp_spec = + (const struct rte_flow_item_icmp *)elem[eidx].spec; + const struct rte_flow_item_icmp *icmp_mask = + (const struct rte_flow_item_icmp *)elem[eidx].mask; + + if (icmp_spec == NULL || icmp_mask == NULL) { + if (any_count > 0 || fd->l4_prot != -1) { + fd->tunnel_l4_prot = PROT_TUN_L4_ICMP; + fd->tunnel_ip_prot = 1; + key_def->inner_proto = 1; + } else { + fd->l4_prot = PROT_L4_ICMP; + fd->ip_prot = 1; + key_def->outer_proto = 1; + } + break; + } + + if (icmp_mask->hdr.icmp_cksum != 0 || + icmp_mask->hdr.icmp_ident != 0 || + icmp_mask->hdr.icmp_seq_nb != 0) { + NT_LOG(ERR, FILTER, + "Requested ICMP field not supported by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (icmp_mask->hdr.icmp_type || icmp_mask->hdr.icmp_code) { + 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] = icmp_mask->hdr.icmp_type << 24 | + icmp_mask->hdr.icmp_code << 16; + sw_data[0] = icmp_spec->hdr.icmp_type << 24 | + icmp_spec->hdr.icmp_code << 16; + sw_data[0] &= 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] = icmp_spec->hdr.icmp_type << 24 | + icmp_spec->hdr.icmp_code << 16; + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = icmp_mask->hdr.icmp_type << 24 | + icmp_mask->hdr.icmp_code << 16; + 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_ICMP; + fd->tunnel_ip_prot = 1; + key_def->inner_proto = 1; + + } else { + fd->l4_prot = PROT_L4_ICMP; + fd->ip_prot = 1; + key_def->outer_proto = 1; + } + } + + break; break; default: -- 2.45.0