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 69E1E45BB4; Wed, 23 Oct 2024 19:03:20 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 26B5C42F09; Wed, 23 Oct 2024 19:01:25 +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 79B3742F00 for ; Wed, 23 Oct 2024 19:01:01 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2044.outbound.protection.outlook.com [104.47.11.44]) by mx-outbound15-83.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:00 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=ZMmfUDWba94MD0WG/BmUhm8okZKga4j+hxfG+kdHPgu2eCczs4qxGwLafwzZL8xTTbf70cYAQm2hPnNKGk14xBRNKskTQ0zgQP35Pu8cFGumcZktimZsl0OhdRv9h15ApBa/v2EZRf5uQhisphiMClaF8KW3TbVSlcfTjwT787KKob/jsIhqyISV9Ioc+/8nbhZm3QpNwuXUl660EXjSh7jQQNb+wKgO162Xcml2dWBtE7aOfo9JEDOfZ74pSQPjAT/5aLVeeeAxxpIijo5QqkVSwinra3LUcMsfiwjcX+Hm9wO6icVSFQoIWu/UTp9vd9Ch+syWrL4+gVcFMXlsJA== 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=FdVHtWSs/t9v04SyOtdv+fB0o2o1x6JkDklKzxSkliL0IXz+uAe29B6+KAh6MclUoNiLQQMXwFtUOjETMRMLvR2aOIqxBa7qUhvqBkO5ojouKndLYCebSZRyuXpt+Ptmf6XuKMEQnzQHmQ0vWvTgYQWo/xQuUaXRPZ3aXikN+6VKInZD4ZOJQ/6ZeutnxC5OYjT9a3hwBhaoWa3XC71I6gDEs5XHRCyA0HC4H4XYTp3w7g+nAN8ccgbnLVwfS++DV8T3W2bRFIC/Wp6diAefuoUAQhmHLh1gYnwORX0wCOahbHIgBZ1pgD6pdX0WUEIVsx8fsMSo45pivTVocgZG+w== 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=ZMvZkVbxvxqXRhR+fzBT89KGpAoZaFbrNvsy9WbeWNje3iLoCliq1VTlhFh5OlvqwYXyYaiawqNgze/yPZdcHJX2kXHem6kzEb1LppAvw0rRuSVxwAIbkb5W8G5WfsfV+mPv0Y50CAC6uDOY6ctbFF3ihR0/8bZlShKfcfCGNT0= Received: from DU7PR01CA0018.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::12) by PR3P190MB0905.EURP190.PROD.OUTLOOK.COM (2603:10a6:102:89::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.17; Wed, 23 Oct 2024 17:00:56 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::62) by DU7PR01CA0018.outlook.office365.com (2603:10a6:10:50f::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Wed, 23 Oct 2024 17:00:56 +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 DB5PEPF00014B9E.mail.protection.outlook.com (10.167.8.171) with Microsoft SMTP Server id 15.20.8093.14 via Frontend Transport; Wed, 23 Oct 2024 17:00:55 +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 v3 16/73] net/ntnic: add item ICMP Date: Wed, 23 Oct 2024 18:59:24 +0200 Message-ID: <20241023170032.314155-17-sil-plv@napatech.com> X-Mailer: git-send-email 2.45.0 In-Reply-To: <20241023170032.314155-1-sil-plv@napatech.com> References: <20241021210527.2075431-1-sil-plv@napatech.com> <20241023170032.314155-1-sil-plv@napatech.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB5PEPF00014B9E:EE_|PR3P190MB0905:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 9132891f-2ad7-4e2f-9342-08dcf38442d7 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?8B7VNF560y2Oj8jUmGwVOCIKaqbdsQzDzR4wfcPS9/6KajJFY51rADPTvunO?= =?us-ascii?Q?/uDnD2iKCCjL6yzyk1SJrMLq2aManiDVcf622yI6uNvJIM1nZsp6LYQhJSPA?= =?us-ascii?Q?HsCNcbp/BKRTt86xoGaTHSY2jYFDAiv/5+4R13tFOL4Oyyqi5/lGobbszYV8?= =?us-ascii?Q?cn3A6zkdMytvURLWpJkPLHcNnk/DEG2NtnLK7yydyxVT4zBFpiRkGftKs5hi?= =?us-ascii?Q?j5jrtXPl7vi9N6+9fJGtjvhp5nn313a/wzwcbjuW3ZMZHPzen04ITIk/oz6A?= =?us-ascii?Q?w+XJF/9NjlEo0Ljv1fVeafR1zvxH0DwnJ9Ff3uEPTfg1TmC1aNsF5NQD83bc?= =?us-ascii?Q?B7TNCl9EOUs08RnRpQNbEsRrqMYxTVEcNvy81TCRwHpG8XomtszrIKPGzXk9?= =?us-ascii?Q?hvdV0PkzokSyV2BtLp3JDJiAnVCIKuqjNf00yIaqSaMzR1cImPLMqNYeD36G?= =?us-ascii?Q?Z38syQ7xBqXityjRtW5pLTdBLLx1EJ9yLX85keOPriqYXGkGeNaR9k36JpuB?= =?us-ascii?Q?PHsno+XFv+Sc5EaDupb4MqZIg1joQ4tzmO/ChJixQAFHH1rpOVgSw+5tzr4Q?= =?us-ascii?Q?eq5TFegiv86WC/cl5NWYPbtBk6seeJbo9OViICja2i+dR5+7zaXFF8bEaMQZ?= =?us-ascii?Q?1vq/tnSbeV12AQTLWyVwx0W1djT4iGoFNYOSNw2PfOhs1wr279l783r4wBtx?= =?us-ascii?Q?/IYU+2cP1/CCiSalixSCGYY42BctQgVc/u9GcaRBpgEhXFiAMFhpwC+hoPEW?= =?us-ascii?Q?AYzY41zpBrFz81i8uUoxgwv1z8/ow+aHObvJgqgciMLNtu2bV49p5Jbbbg4u?= =?us-ascii?Q?4mYymmwnmSuQHIr6sP4xVqXFTKYr8EmWb9lPvgHFslrKfBuX7dIS/9sjfEUR?= =?us-ascii?Q?S8EIjWPhu4FSIhZvFPdrmXp/etY4upgb8xW2lVj7n/sE6SZ3UavfoFJx8k0Q?= =?us-ascii?Q?syvHADX2xbFSgVpBh1/NRN7iO5KXefa4U844a76YrzCl3jTJ6GVfjiawTQ48?= =?us-ascii?Q?wB1AU6qhBtH2EidDMyM7HXRXOxG0w0h3XuAkxNzqe7+4ziF5yBseG4muoA7k?= =?us-ascii?Q?BoS6UVqdSN352vej+7zl7HIER2xeJ8yIAuhHS2LpuAgLai8CZJ4RJxY0cIPB?= =?us-ascii?Q?GfKJ5OB5lkt7ZrfwdfTse4t7dHF3+8ci8ZMoxkpvcUr72WUXWDXGyhPbyqjM?= =?us-ascii?Q?IO6QnfVLkj9ntVEh7HuefQc/KwTntIJZ4tgR73xXxHdH3t6WGIKd7ptKPk4G?= =?us-ascii?Q?z+Wm9W8Sr39e+k9L7tt74tsSGqJkhcEMA/W6wpYhswGyQ5RYFOXRwPK8Hjwi?= =?us-ascii?Q?PUA0DK/+3tboopt7vzZ1T/iU/m+kfrgniWWRHR2YBuNDupubovpU01NOnyc7?= =?us-ascii?Q?RPDNIu7tVYaZeR2KCPRvFbJoNG7zdL6ZVlV9QhtWbRwgSpo1Lw=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: CKYzrIgstYkSHVG4pHVbUZBXYVGrBTrkTmR0Pk8I99/kIUtyGQYAPFqcvnCTXw+ABAo/uZ/q8BdPzKWqBlOWfVYA+ZpsVvhymsCQaqslYTAIH6+6wyAKuO7g6tuP6SWRL0zgsxIKB6sz/id2YwFfOaP9DKSj2MmBYqRi5YppMaJqAzd7p9T/bwDaqp0RrUsHvMAHX7msryb9eD+63peq0hVFkf9cZSbbm+iL1n327wyBERrXOC3QyVWaA76R/PlSFXzcRBWsbtyLlYKDPsAx1QeQV91J2TRIzfH3Zu/P/WUz2yuD9soj27nofYvAtziOxa30Y08u3xLwOvLz/W/QMsOF9KDL/TyRK7F6d/UoW6yMBUSTXpYfFZqw/6jgpnuSkqr940eEfpVeyv0TeLPslobHL15RH/9hqmGL9a0e1DUMTv5Q0KEVlHACJF92NwNuJe4Y5wEwT7mpBa9WjwUHuxygTjzYr9G6w5Yw++u3xDqv2s7t/49KD2JaxcobHL4S77ZmGgDRF48eJK3VJ2DrYCfFQnLjgbt2oLsoBeS4mcYESFpENOhxlEobxji/LUxHmezsVBqUi3RgJF6KTePAC0YXY0tNlAZYGwZxjgm8eRbDKZu50Xyb5f7+Zl8Q9Z5w0AYD5k4fhU3psHKzzrFNT7t7qb/WS0RrH1mUG2CBe10= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:00:55.9924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 9132891f-2ad7-4e2f-9342-08dcf38442d7 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: DB5PEPF00014B9E.eurprd02.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: PR3P190MB0905 X-BESS-ID: 1729702858-303923-12646-43788-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.44 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.259925 [from cloudscan22-219.eu-central-1b.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