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 C397945BCC; Wed, 30 Oct 2024 22:41:49 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 25985434A3; Wed, 30 Oct 2024 22:40:27 +0100 (CET) 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 AD99B43365 for ; Wed, 30 Oct 2024 22:40:11 +0100 (CET) Received: from EUR03-DBA-obe.outbound.protection.outlook.com (mail-dbaeur03lp2177.outbound.protection.outlook.com [104.47.51.177]) by mx-outbound17-81.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:08 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=o20QT2lzEb9rEUM1V/ZPlzPkn/mzkHVsETYcT28u4wh+kOtCmmnsyFyuikssgI8immOxHTmqMO0rsfMibWey7q/elk7pxej2+fQIH84ZcRiUPKlB5ubdMDguvJunvm4LI77vZZ2Qaa8F1u1zTLI5wTDkRcLwx3u/yOAyBcVn2SHbBebXHjJftIuXy0oin40IVgfcAmMHMyqmVPrlKickK5S/aupz8ARnxXf2n4rNDBZSwHKjS7z3nVHdlzrCK0ODONO59crokM9KvUsOOSIJ9Is78OSgMBN+PR4f5nWBRC8v1kz6HidOIt7uwwTvDHhDjSjn0DFDtlNhucHT2DHr1Q== 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=csGPe1VbP/F8RRH8CoyBTXSKtwGQHzy8R87/AxFIRsc=; b=REooW8Ut0NzPtYKieKrYH9LQSgASrR+vWNi7vIj1jHcFeNa8bfrb35Ua0qO0/AMmnGpR/xd8UJzEAUj94fFdn8Ft4lRDSE0RN6FLA7eg4BoUj5nqmPO0Dm6QV7/uqI4QSBDWDIA69Z1JTfYESQ4nUvGeZPD1oYHDRqgvD64LrlZNOMCR6FHLf0b9AbCMStHbuOAatcFJpAWnx0JCnR/rzNszXla5A7G/dvjUa2mZ4p4fovNSItmb9Yif49kG3fYIkf5onkjyf82SNnUFkHn/i97H1eEXCknKyU2L8zsgA8MtDWIgQ8pK7yIYoPexOpB8S5JFBIto6LSB+PktBo6Xpw== 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=csGPe1VbP/F8RRH8CoyBTXSKtwGQHzy8R87/AxFIRsc=; b=SfVyw8Cxvc4yjbAS5N11vRZeBdsS70KfaFchzmB1gqFw2AdWJ3wApPC0ereBlrzv7hwwJD/244jJPCRC/mXK6aO1uLp/wjEck/XDrIiNjaqxxIz5izQLY0MUqHCEpKzJTDd2A8z3cSgVdS0+IAwxUSWJBsQwybVgJnux8ZhFCqk= Received: from DUZPR01CA0002.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::8) by AS8P190MB1238.EURP190.PROD.OUTLOOK.COM (2603:10a6:20b:2b4::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20; Wed, 30 Oct 2024 21:40:07 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::b5) by DUZPR01CA0002.outlook.office365.com (2603:10a6:10:3c3::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8114.20 via Frontend Transport; Wed, 30 Oct 2024 21:40:07 +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 DU2PEPF00028D13.mail.protection.outlook.com (10.167.242.27) with Microsoft SMTP Server id 15.20.8114.16 via Frontend Transport; Wed, 30 Oct 2024 21:40:06 +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 v5 16/80] net/ntnic: add item ICMP Date: Wed, 30 Oct 2024 22:38:23 +0100 Message-ID: <20241030213940.3470062-17-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241030213940.3470062-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241030213940.3470062-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DU2PEPF00028D13:EE_|AS8P190MB1238:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 24cdeba7-0451-470a-e1f8-08dcf92b6c00 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|36860700013|376014|82310400026; X-Micro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6pjkgmeggNDnxNZOUpUKm+dWK5+yiWVi8/Jxl5cUrm?= =?us-ascii?Q?AXcGgIk2U5hc9cPpP7KenRPcbk5FB7e0tD9pg26VrYhgHKcnFbUD98tRVRkf?= =?us-ascii?Q?kkWe8bYT2vtFlnQ9DgFA/0ROclvW2EtVcI1YkWu14P1iLcP0I1seNjAFAp96?= =?us-ascii?Q?xHJghqGLvWH4CechptETqAs/bJUDbcqNfXikg43bLwwtk9iaOeI4KWg4+ezQ?= =?us-ascii?Q?syfcw+OS+q8DQD8ql0sQLbQbY06zy5JwVJc8syZPeupGzXpvljR0d3FuIHvx?= =?us-ascii?Q?knvZ5cKsjesbdsrmJpliehVLL3LlopIzbBNHaS4z+mG0gQrC2PAFHvKcKu3d?= =?us-ascii?Q?b4O3PmVA/Y/RiVQDtVzAorg09y3N4OAf64oK+6IuqmIJs8LCNHD1ufxwm94v?= =?us-ascii?Q?eyVPM3TtN3nN5Emhz/wr5qVTY5LFlV7TThcUKHlKxHQwgCAVt9plw8Q/G3zF?= =?us-ascii?Q?iKOnyNj8peCLvLF8TTGYz2Z1ui3UI2C48BkuqiqhXWnbX8r8WjLCAH8/3tql?= =?us-ascii?Q?K29mWclhOP+bCXhQrONfKefNwm3Mr81L3rZ+8Emjvt6mtWh+3Q=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: q7X1cQcS9PbJLNvGvUlCsjOmH3ZRRatUub213/jXFpWB+Vc1G3AG99Ll4BB72JHkRt/+4Vcr5p74ANzbmMNcF+gAmFIgnWopTYZBh5m2bAt8ltIFpxjHAIwkD4VGAgpdk+91W759XdzPPfSF1EVZ6DbnbErfvtKrAbn8nCLG4op9smnFX2TmE/vsKpb03F6DpzITtpwDv7hkyMb25yYmXVZGEMuE1li7mKClz+7KDH0gdQzIv2m07cGv8Gilp/OqZxiiOsUaqB5BbV5IhYhfUpAxViUPdvxyTruqP7yj/IIEMVo8lcugJGIPOSaWo+BJcclXDudCqqLqRur9tIVmmihJK8LBHrzhzwBTrtwS54e36q/ZYu7QOW9Ihzj+HH9HLgWg0FruRbSOmu9/39HGbshOV68dBnomL5dEGChrnt+ZOxgQOgfQGIb+ujUTata1+/eFJ1PVzZn5F2ZL9lqt4vd/PxR9sbofJfvV5/bVGpOZ6qASOjeV871Ysg4PSRQDVdtAurOYuuTzO+cWAVuXmOh5i2yII+46V8oVQQo9Gq6ifGKL6athWtHudyTSS1PnlJQ8Nij4C7Jfm/wYN+FzIxvaCP24sYYd6fedmkwFdnWSrBp57xv+vTteSuEBBVSGpBIyvd6KczshLVihn/3HOYcJ4OJTpa5gBTKp0BFTNlw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:06.8018 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 24cdeba7-0451-470a-e1f8-08dcf92b6c00 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: DU2PEPF00028D13.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8P190MB1238 X-BESS-ID: 1730324408-304433-12638-44613-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.51.177 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKViZGFsZAVgZQMNHYKNEoJcnA3D LJxDzNwsIiLc04LcXU2MLMKMnS3MxSqTYWABwQfSpBAAAA X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan16-249.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 eb73e6ca22..88665dbf15 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; + default: NT_LOG(ERR, FILTER, "Invalid or unsupported flow request: %d", (int)elem[eidx].type); -- 2.45.0