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 A90E945BC0; Tue, 29 Oct 2024 17:45:21 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 73A0142F21; Tue, 29 Oct 2024 17:43:37 +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 D3B8942EDC for ; Tue, 29 Oct 2024 17:43:07 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2109.outbound.protection.outlook.com [104.47.17.109]) 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:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ImdCYrbvYHyYUKeaSYwSPZ70bNC9YGZhbuWM5B5Y3Ema8KSPwmMbWN98mhevcukJtzA3XcFWcGE1OXxs+ZJVfIHwUccH1RDjEK6N5s3auMO6xICXlNurQapqMxjlJurZGZVfHICSlf32jh569G+quKUzXGAxM8iABViMg0Vme3RYfDAiSChBtwVwH2FkHiJoo1rPbZW3e3SeVBXQETW5dGJ0YMEy1VaGY2OsE6dskbFVdwwIpyud6Mr5yZOIf85+iBOsO0rq6lyy+nFVM0RFant4fHih85/85gvCb++SlVLDVXO70imS0Pr9ggG+FnL7TishJCVJ7aYYeYAdulU29Q== 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=pPN9eumyEk/ovJ4HmzmQrta4bZY5JZ/WnHI64XwQ1VA=; b=n/wmpu6Oc/WpTrymMCjJWoAISyN3bu7EJ3cC42f0P675N1Dhd9/E6QzhCpEHqpCy73M4sh3wHCh6aXyCReLq8RBeE+75dDIwJvad6Tjfo3w8SIH9gP89V5LP8f6dhNQa06AVr24RqFiamy5TYXDP2NPlbc8zdEl/BLW36KubzsxZOw1bi9Sx8APECFRB27MuGCxkzJpZpx6JSoE9sDE/j1xk9LlRTjdG6SPQsJV6E7C24+bzUVR8YeKp9ufm/7RrxSwQ2peRZXSPtBkRbZ5vZpdGSZM0vsMs2GF+v5ikBJOBG8mOiq2EYpDrmbth+6NZhxx7ouKlIMPesOqswz+7nQ== 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=pPN9eumyEk/ovJ4HmzmQrta4bZY5JZ/WnHI64XwQ1VA=; b=K01YFUAkstLzwDNTugfrJhYSAzvAIvqIfKUQ4qRYk8dq94zZzix73doZbpqVT00fNVz2QmOYfQmo23nWMYX966MCycpIiZt7I5rpeWkJPjYrFgE/yjQWCnduu8kcHoTdeNpNydh4k9G7n7jLBAomV//ykD+SPiJB8L5V8a9K/2w= Received: from DUZPR01CA0202.eurprd01.prod.exchangelabs.com (2603:10a6:10:4b6::13) by PA4P190MB1214.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:be::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Tue, 29 Oct 2024 16:43:02 +0000 Received: from DU2PEPF00028D06.eurprd03.prod.outlook.com (2603:10a6:10:4b6:cafe::1e) by DUZPR01CA0202.outlook.office365.com (2603:10a6:10:4b6::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.17 via Frontend Transport; Tue, 29 Oct 2024 16:43:02 +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:02 +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 Subject: [PATCH v4 16/86] net/ntnic: add item ICMP Date: Tue, 29 Oct 2024 17:41:20 +0100 Message-ID: <20241029164243.1648775-17-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_|PA4P190MB1214:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 1ae883cf-990f-4702-7ffc-08dcf838c158 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|376014|36860700013|1800799024; X-Microsoft-Antispam-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y6sk9jgw2Pz94vhO87JbIaBvPEf+rIDmgInA?= =?us-ascii?Q?g9F4oNJAbVfuEZMBwNs8M7Gk3JFRPtJIw02rki9nVmZ9MGvh+CQfV9Xsjt2n?= =?us-ascii?Q?cPo//aRiRkA37TB+fH2gRdfXI/c5Pfn2ToalCYnLD0p7UaJe1iRVBIn38KGD?= =?us-ascii?Q?1//mW+EfwfV8l1WaX8C99pgLE2AxKFcfDkD463XThsX4hmoPqpH/yrXF+hXE?= =?us-ascii?Q?yfr6Nj4ch6JTPdVi9/TvMDqaI8FSXzxPLxp1ka78StQbBZVLwC4hKv5To/Qq?= =?us-ascii?Q?LP3ID6i8KeXsBOh8l0C3Q7LE5pNEaHjBbUjT51zIjbhcZNCLCAVmJXAWY4GZ?= =?us-ascii?Q?iQNDrtLiEzY/uF0PPUzPt1r/ewEYf78IT8mCt2mrXTp1vulT6N2yD66b0yn5?= =?us-ascii?Q?j5+8TnfGGBBa7+MrHGDkMlqoZy4MnPaZbxFMxoP7/9kG4GRT4o/tRu5kPWNr?= =?us-ascii?Q?HL0LdN74bWgCK5J1Vg+q4+Giy9rpIIcFZ6Y3tNfl6gQ2dLhUXNJ9wc63cYqp?= =?us-ascii?Q?uHK8LYLQJSeDoL7OlHDN0zq09vO3a3ZJ4Yh/x6Q0XLQOmyOb2w=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)(376014)(36860700013)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: FPbUBFpkwvxEkhwPtUc9y0HFLKp8hk309lo2XUcBh+XJ3NtbYgGpBcz3HSBxzkx2nDJzAJuOCJ+i2m48z/vvJWGqyUoxoMWQ8CsqBrB8rtuuKjbzkiQFRp3rdDbH92Q+JWAXhxpq6lsNx/FGnTfdgFbOcCK+bDF1iRjSIwO24z+ssG118PxHYBvNTOiWvAanmuNThhMUEKR66asb6b7iss4/LZ92vv18bOOV2m+v8kDgxsyBffZTq8+ZDLO+PFfC7bXzZcLRAPMWhkzvLpjJebP5oLjJBjLRLvHWdNQir9rn57mSlhUSc3HjABidBCiuXO3zaGVdSd7i105E7aR0Jp7VUXkZZSslC/KcvoiR1R4tJdud0nqmyyRf0WRB4T+4YgJ2iPcZL7EwU42eremBu2+i4PxN923ND3hoxodJSuvseWJnzNEIi4UwMfDvOOsKXvScvH8+g9OLgGt9/BQgN9zxCxffyjcvh3Gqrfd9bk0VAolon9Opqx6k44WhFCORY59pUwjRa8KR9C+7FBkn1bVlpdPIBOFntJONsE7j0j4J7RZyTBkHKcwYXnDfMj0D4Y4XO8uKchtrEbmyCW/Ky6xoBtM37q4OtQJnB6HOkbF8eJ0nuudvE7Id432+EQMZQrzkMUItEOW3rEXs/di+RNl3zURcZBh4RqoR4uKvScs= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Oct 2024 16:43:02.2771 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 1ae883cf-990f-4702-7ffc-08dcf838c158 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: PA4P190MB1214 X-BESS-ID: 1730220184-304438-12712-30011-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.109 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZGBiZAVgZQMMXE3CIlJc3YwN TEwNLSPMnYzNzAyCzJwMw82dzUyDhJqTYWABfv/F5BAAAA X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260063 [from cloudscan12-135.eu-central-1a.ess.aws.cudaops.com] Rule breakdown below pts rule name description ---- ---------------------- -------------------------------- 0.50 BSF_RULE7568M META: Custom Rule 7568M 0.00 BSF_BESS_OUTBOUND META: BESS Outbound X-BESS-Outbound-Spam-Status: SCORE=0.50 using account:ESS113687 scores of KILL_LEVEL=7.0 tests=BSF_RULE7568M, 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 d5d853351e..6bf0ff8821 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,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