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 3923945BA3; Tue, 22 Oct 2024 18:58:10 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 606AB40E1F; Tue, 22 Oct 2024 18:56:34 +0200 (CEST) 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 34F2D40B9D for ; Tue, 22 Oct 2024 18:56:22 +0200 (CEST) Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2107.outbound.protection.outlook.com [104.47.18.107]) by mx-outbound19-119.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Tue, 22 Oct 2024 16:56:21 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=PviwTzplCZoCN/ySCF0MpY/IJgqhRRk42enj9qOcLrlEpIzRP5t5sdT6W/fmQcf5gssEkCs3PNtV9eKMLHnDucsqTqi/bXr7EH6QlltAt/PQ9ONJuE+vwTlnv0154KFSuwMt/5AS1Cs1CMDy6uNsEVHQkYcHRP210RcYdbkDM2bSg3+w0AT3j5wWArO59r+Uzm8PRWL+VUBQOCTgtC3zIZ0U3zExhYDJLPgDcPMIgC6MIf7HRK/v8pnPjHzgbNyZSzkzKXrjTyZy5M94vqyE6M7ghaVDfXlHd4pHkL2cOCfMawaiMvK+RsUiHThYa45l0l8fWpztEzpOT4cQO4nAFA== 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=kXm5CnEB5C3YP2t7jZLknuCmlDlMqHzYhOnxomZzE468JM8fy20Dg/wMFnC5fPpFcQasFZKWhvZIEXe77AzVxoWM5l3rOIEfEgDsJ9JBk9EygNdLJgtPtySsXlyldXUtRrT+k5dGZ2sVEyz825JsL2y1FJMTaUtCPY5csHcb5ZZRG4JfIvVdjI/VYBayh76Q0DCPJPtWZ4BOWcUxrFYgSmtD4KFU3lL9k0pXSiFNcKuDaysAEb5RfxdxWmqhxKV6capG0BvaCl+IdUtz5/W8m9bw2HFySIPe7gcIU5NT7vYq/LJPswpRGb/0SdoRnBHP4IsBtd9W+zdJ0OTax+Y17A== 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=XEwO1QtOKb6gh+t9qwdWp28cX3ykb3TwmbEoZvaikUdrHHWBD8xXPmCAm6OWUoqPaPcUuWT9Y2QN9e2OBX793Gv+TxZBnKMR/xcFeiGG7RxL2RwR+AGiV6cduqdTWgRaBGIDBYCAwDyqD0xGvV1B/YO8LRfLXijJccuhhhgUXm0= Received: from DB9PR06CA0004.eurprd06.prod.outlook.com (2603:10a6:10:1db::9) by DU0P190MB1730.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:342::21) 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:17 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::61) by DB9PR06CA0004.outlook.office365.com (2603:10a6:10:1db::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8069.29 via Frontend Transport; Tue, 22 Oct 2024 16:56:17 +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:16 +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 v2 16/73] net/ntnic: add item ICMP Date: Tue, 22 Oct 2024 18:54:33 +0200 Message-ID: <20241022165541.3186140-17-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_|DU0P190MB1730:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 6a5af119-9b3d-4ce7-91b0-08dcf2ba7216 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|36860700013|376014|82310400026|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?zRXJtsP5NXs0RvFa6RhOnL21Rpw2AmETs/YycYME3ySJszyRd8CtRe/712lr?= =?us-ascii?Q?coSU/HdRkV8/kRCejyNf0bjWcBsrbzOdDKkzR6j16jSTstAOsyfvMn8d6qB1?= =?us-ascii?Q?VYveArWYZFRjCcsfVcEwSR8uDk4jUKC+euVNFZHx9CT+faQAsD7AxgkUCOe8?= =?us-ascii?Q?Im/Np6WZ2QiEQc0BvDs7FwjXdbqvealS3+6DvhL38Cyymbyk3M10vqMj1ZQE?= =?us-ascii?Q?xsKJYhAl5zivcd8fMi1QD3s3OhujsiHsYqp1vpFIUM2GFeyyo+6YMOSTfS5W?= =?us-ascii?Q?KXGCDMost1ae7nZD8KXYF/PtP9HucALJ+9DdhDHmeCkwuMk+jeVCRglZTP1L?= =?us-ascii?Q?TSJTmcwjkk4bUfah1SX3bCUmh0888zfhan4XJdnpNeZNkiBkWMRWJoqhNnTU?= =?us-ascii?Q?rkkws/aqhtTMNvQlt+8fk4yGr0c7lyjRMl2wqUMcVPNBRrp5Fd8pQ/K/jSq7?= =?us-ascii?Q?ReT3d+BJJZKtM7MteWzdnbVHoJtL93d2V7k3umZBuubst4Keu6l2R3geBTMJ?= =?us-ascii?Q?ZFTZLfyAc5LdEjIoJBik09U3bV42DxdHRYOXE2NpxobbxLADnk+PPD6mJGXC?= =?us-ascii?Q?yqCczdpXOeYIqPOeaLFffVKP/BE7wexffWGea0TMfppjPsmwRERR5XhtWbeg?= =?us-ascii?Q?V4AhfF8ox6UGBqUA5qMz7LNVhuAL51bBGQJk+u+5gC4WXAO06tPB7y7ImavY?= =?us-ascii?Q?DSaB+Vol/hkKBhzLd1JRp7zNYFDE5Vb0wCypcb7C3g4CWfm16BdadUO/1UF/?= =?us-ascii?Q?LBrnJkjNCfYRbnRpvMpnwlY6xdesekWg0hRZurGC8d7jplEs9Rp6o1/hoC1B?= =?us-ascii?Q?PlGOd8ju4Rs0vxGJpiJuuhRXMx/+4m22HJ2ncByV3DRtRB+VpmJo6W2TPEUu?= =?us-ascii?Q?85X8ICUitGGADuomazqazO0gmI6YMAixAi9COvr0NsR9Lntlnrh+WJ8Xh/rZ?= =?us-ascii?Q?jjrrLsJrCscQi8arCXlbNOgweIU9GqbRS4+lgXQjCkZDwtfFFCO4hvUZ73La?= =?us-ascii?Q?6U18uwTmvSTmAZOut5xYv+eOJIRPf8CegKPG50iIkCrreQ66lTsN+fta/ZAU?= =?us-ascii?Q?pTL8U4gcPykF+5tFA5X6yR21UJVzIMwVGRrbLQVUw8qYAjCu6C3Klnz9hhTV?= =?us-ascii?Q?Pg+0ZKB0lDSPwSaj10vk2d611P8VOIiYQHPpE/bA2J+KKGPgVpjEqvt124O/?= =?us-ascii?Q?6FPwS1k5ODl99sJ59X9RDwxzo1mpX5rOW7hNQ+tPvL7LRnpFURZkpv8RwPA4?= =?us-ascii?Q?IV77t1u8t5R0ztTvF3btWB4m9GQ0y8W77PfsM/vvg7tgD24WVUo4VfF3t30r?= =?us-ascii?Q?0x/EpKOFyXTcAy76V92103S+rAOmZIgbxHUX9wmMp0YLN0zOkiXMg58hD9Xh?= =?us-ascii?Q?gEN81gUnz74v7S67Df7/t8apfKUSYgA1q6xiXcI+Dg6XovWQVg=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)(36860700013)(376014)(82310400026)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: AauL1Yl9dJfaf+E9CSSi7If0GULNq+aqJDy7XZN9JylRKXIxsfDgDjz6aRTrnVphjNjZIOHf7QXmagzq4vydUddjxPPt3SJV85Oqi5WguvYviX0GPr4CCdzgjHnzMSwt9Ow6a5Ad9Uu7SdcHkQr/q/waBj9N9LEEG6ZXmXtgR1FAdUEyIJ2Tvwf/Vc8uwUiX3cuPGX5fizjEdjkej81gVpx1NUKFYd+da8S0JnXwnYvI4ntn974UN4JQw8BcyBx9SDiyClxgDZExnCDwobkd3w7sux0oLFmt1984HFRp71LoFFW5yV5rYgbV1b7iKTk/mm1XN2j2zJvES6wUyi1RaeNxTl6LEa1zFezpXHTx5AIxrnKMT0WEowm9kWeMmYFSBczBEqx1QlHCsXfQiHO/lYpT0V1zOHLhGZYrhrAfyMYK5dX7qbUVpCTf7JjBrOUaLSSYeKXdwGASDTSt23gipQF3gkFzdutYA5NWG06ZJRKSiRbKfV388qYXBDYlUxYwPVXjFN5Z8xYYvXhQpD3wFZfWRE+BZkhifI5lqeU7r+Vj6HHqc8UXT2Ldbi0LzfVIYqi98j3EJbehYQReCYDyF0Z4WQ9ZUlwRQK1QKt/SATexL3uTyPZK4pN0tora2XEfzOFNgXeJ9SNWYxkCQwSxMX+hXhd1XDJjmIlZt7rrPBw= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:16.8875 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6a5af119-9b3d-4ce7-91b0-08dcf2ba7216 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: DU0P190MB1730 X-BESS-ID: 1729616179-304983-12651-14386-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.18.107 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.259902 [from cloudscan10-0.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