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 E389E45BA3; Tue, 22 Oct 2024 18:59:35 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 218A840A75; Tue, 22 Oct 2024 18:56:51 +0200 (CEST) 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 C53464029B for ; Tue, 22 Oct 2024 18:56:34 +0200 (CEST) Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02lp2041.outbound.protection.outlook.com [104.47.11.41]) 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:33 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=TPUoyUZvFCHaATWXV92HMYQEGafmdbYMg1MHDgIgnwsCknzF39xln6RQJvv9g2BXQlZCjfN7kumFtVDGpePHwybIF+5OFN3oo1Q2IPnEjTFsMv3ecj5Zxnt7rd8E41R7brY9cx3n6BUqi4qTa4yhIqzp+vytX9beJ7hcZ0ARtQB6PXX0w4lxQU2RPRJcBFBokB3DwjMAtrXCxO2QI/sLOnrz/8dlwZOK+sRgirxCNvD9hHKxDRjK+9QBWvcQF9uu2GAZ/3mQq0qGafzlirtb9FEk5GcqSDflAjznRewvemycOBzmvnqsXzMielcbmcBSTY7W2D1J+vcw8XFWQuIaQA== 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=LzpK0vaI/9R5ZRaoqjeAUqNeKxkWsPW9NcKBJ10a4iw=; b=ICPjGb9jWY+VXdK8/syijK2OX0tyI2quspG+UDzbgBkp4sni2vYG5Lfs0BYBopRA+ITCK2F1AUBCYkrNJZazVjfqONUiZ34XJoBcQJZDLssut/+Al+buKwfZz/fSSji+U5EsTLEGD30Un9wLygtLWC0sFeIx4N0F0j8wWeypNc84dhpV5WNcyk5RD70iyBEyj2Kk1zGbwydf8Ml2JA9nEXq4QuoYUSRtoTivEfI5auFzKiciFrDWOj8O4ALgdb6YiqI1Wa+LSzAmbwPPqAElxypur/TrKHW8hSaU/UybMMFpMbX45JLPWvE6PW7eOFoKrOUJLh5tz4a7n6dAPXPBdw== 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=LzpK0vaI/9R5ZRaoqjeAUqNeKxkWsPW9NcKBJ10a4iw=; b=MT8pFYQ9wxO5CwpGX8rQf4yagESCSAQsjcu+wcCiJZUnBJLgzL0pG+UIEdBNw8hWnd2XsVy8WYUN0W9+sZdBG5Ad33pPRLm5r6tbkEB68BVnsSqDWiTJwh/LKzHm9KD7UoEfxLtbRU3abe/kydAo2CDyliGZ7+8v9A+FXBtuH+w= Received: from DB9PR06CA0023.eurprd06.prod.outlook.com (2603:10a6:10:1db::28) by VI1P190MB0719.EURP190.PROD.OUTLOOK.COM (2603:10a6:800:12b::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16; Tue, 22 Oct 2024 16:56:26 +0000 Received: from DU2PEPF0001E9C2.eurprd03.prod.outlook.com (2603:10a6:10:1db:cafe::64) by DB9PR06CA0023.outlook.office365.com (2603:10a6:10:1db::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.16 via Frontend Transport; Tue, 22 Oct 2024 16:56:25 +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:25 +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, Danylo Vodopianov Subject: [PATCH v2 23/73] net/ntnic: add items IPv6 and ICMPv6 Date: Tue, 22 Oct 2024 18:54:40 +0200 Message-ID: <20241022165541.3186140-24-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_|VI1P190MB0719:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: cc624034-eb67-4c10-095f-08dcf2ba773d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|82310400026|36860700013|376014|1800799024; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?688ox1UTyx74jwyZvWB3iiPHary8+cO9CvvGl6MvNtByir1xYderzxz27Qmt?= =?us-ascii?Q?bVSjexAF1e0YULRBIU+/l1D6lWMoGnmWiqpADXlS/YcCGN7nSRPi2737mVO7?= =?us-ascii?Q?KtlenQnvoqKWr0AOJkuEqLGOnUaTicoS+LVLgqPP9ryjXRETSj6N609ECVGr?= =?us-ascii?Q?QvAxZO92MBOJHuT5tiirwmZ4jSxzYK9vXMZun/LyPWnaZD+eaBglDRhy0hpP?= =?us-ascii?Q?6Blzeqre7EgPI0C0KvYQczF0xsJVVWJFjX/dKBfXoU3eqzTBTwXlH5sd/s3T?= =?us-ascii?Q?RJPEt0RCssTcMbFkj5nfZWxv4HWzk3Szdeb876xcrp3XvMPIRip0TuThm3dy?= =?us-ascii?Q?7c3um/9laQGsGqedWWcOLixMa3v9imiEYYMRYTgfOVIhQataXbahxKrZ5UMI?= =?us-ascii?Q?+E8e79kqHhQ5qOf5g5RNNdnYJdrW76/8S2D7g1qrO9tmq9K/sHnSZtXqS2B1?= =?us-ascii?Q?eEO6e+nKKGEAMHN00MDEo2iqlUPApDZzFH7QDdsYyXMFyatWugrmvWkT99wY?= =?us-ascii?Q?ZDcdZcPJarM2VYmQ7OFnJauNb+XcFxy/87Wfh4ykj7/XSYYByQBSKMN83kdt?= =?us-ascii?Q?/hHmM7u1R3ihC6jexNi20dOtwtIfk02IwnoZntwZOvmHW8v6ZxtvXPZADNVT?= =?us-ascii?Q?T0dki+fLDdT+95vaUD9yPhaSdc8TgSw8HW8oWkm4pM18V32s4TqXfD+NfZqQ?= =?us-ascii?Q?2pnRPy2VKs1C1Se8pZXothGq7tNNuyn9FpPQafKhWClvgo30ODhydtzJpQus?= =?us-ascii?Q?hApCjAaoVg3RP0BLzwGr7BfMAHnnPIg8Q4ZK1lYkbybhnGtvN9N/xBirzP04?= =?us-ascii?Q?OYKRPl7cpwxHAdJODmYLdKPVBreFUHjCT+qoNupMBRct3Sda3dWoSaGDDUFY?= =?us-ascii?Q?z8N6NKSFh8UFyLxHgoaT4lt6Vqalgpr28tLO6omgYZDRn8Zv8TxMC5AAHLXY?= =?us-ascii?Q?p8NqlhPOWccDYsez3h4qIbxUGluw77QTGAwAptREaIEVyJu5va+4HqdqjPnV?= =?us-ascii?Q?AKE99Ef/VeQJO+UM4F9VLEwBKQTlxmSfvJIqeRDAooIDKQIUNfvbjNl4/Nek?= =?us-ascii?Q?Chq90WRTZLjJC/z4/aXNzGHmrhNx2uVs7zdGgBF/eIS+geklcQNR3Pvo2kQP?= =?us-ascii?Q?S5UZ926VcCWuAsU8voO6b/kg2ZxNoY7rNdzEC4F1/SwV0HAFDEt8hBTdGtyq?= =?us-ascii?Q?Lz3kJsVmaAPs691nvQS6C7RfBmcY5xyn7it4leyGNjpir0jBuK2y60fIAEbW?= =?us-ascii?Q?jsvXmtT5lgpCe6X6seRuA/PXWr/MSmmLmv39XK721eE7khV+aZWmFlbzavtZ?= =?us-ascii?Q?FFe0WaceoF7q5iG/k16PxOKVRXZ7zhcqHBW/iaIRVxOrHC1vDTwC/rmUmo3m?= =?us-ascii?Q?QUPDcBWuoNnGlY7f7wkmF761hpCvr2fjHsWXJVIzPBndVjN39w=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)(36860700013)(376014)(1800799024); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: VVg2EbbBju6y4+Op9WFs/aUaePTKXPi0tY8mjjK0mVA6qiTaYicLjeYqceDYBRfrlEMjusPcHQHeo/xTkjsUIpoGdY9nrei8jXl/7l9upm3fBjvjBJDQF0iyHdQBtnEKqmXGP0Y9RtQmHtIsYK77jAeUfJxrlDdrejx35wIabol6oMW1TTjZ6BsYuw7udlxlEnbVzCqlcNQogFLMvFeElhGAWlUx0p01ktiAJ8l+mPPOLGvUytDu+vIaMs240L/QqRwiLmPPzlVVOM1kycd8Ck2mQcty2f+o/YMWFqiW7KgTal+faVwHmoLLE0e+FgWNZ5BI73f14+xxPnxvZYHCH+AsnniPKaKNH8w9a0Q5JeBPHSwlI3/P7pLs5ILnp0ykRfkk/AfshmlcepQlI9sL+2icnCylIfqHWK4xIDnRUzkkJ+zK89lS2AVpnwTaqhuJBRnnSY6dvMMmxITWNRlCR/AVfuS1yDa+g4xGdIDwjYztT8juqBD/WyG96HOWHtOuNT9fe9k4DBk0l0bMGUdRBEcRC3aIQdEoYQd4s5gZGOjyxNBqy+Q7GYvwoLcNibKzXa+KUwZb+sNiVF4FmitmIeagZtRH9UUt0jXgPP0UqAvJABMowhGclpPlHeVJMN5WLxQoLbOiNEz71xs1Wv+KvCHGOSMPP3UfpIzFr5Pf2PE= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Oct 2024 16:56:25.4970 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: cc624034-eb67-4c10-095f-08dcf2ba773d 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: VI1P190MB0719 X-BESS-ID: 1729616190-304983-12651-14395-2 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.11.41 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGZmamQGYGUNTYIC3R1Cwx0T DJ3DQxzcQy2SLF0NwiOdk01SLNzDTVTKk2FgAvSChZQgAAAA== X-BESS-Outbound-Spam-Score: 0.50 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.259902 [from cloudscan23-178.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 From: Danylo Vodopianov Add possibility to use * RTE_FLOW_ITEM_TYPE_IPV6 * RTE_FLOW_ITEM_TYPE_ICMP6 Signed-off-by: Danylo Vodopianov --- doc/guides/nics/features/ntnic.ini | 2 + drivers/net/ntnic/include/hw_mod_backend.h | 2 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 27 ++ .../profile_inline/flow_api_profile_inline.c | 273 ++++++++++++++++++ 4 files changed, 304 insertions(+) diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini index 6691b6dce2..320d3c7e0b 100644 --- a/doc/guides/nics/features/ntnic.ini +++ b/doc/guides/nics/features/ntnic.ini @@ -17,7 +17,9 @@ x86-64 = Y any = Y eth = Y icmp = Y +icmp6 = Y ipv4 = Y +ipv6 = Y port_id = Y sctp = Y tcp = Y diff --git a/drivers/net/ntnic/include/hw_mod_backend.h b/drivers/net/ntnic/include/hw_mod_backend.h index f1c57fa9fc..4f381bc0ef 100644 --- a/drivers/net/ntnic/include/hw_mod_backend.h +++ b/drivers/net/ntnic/include/hw_mod_backend.h @@ -164,6 +164,7 @@ enum { enum { PROT_L3_IPV4 = 1, + PROT_L3_IPV6 = 2 }; enum { @@ -176,6 +177,7 @@ enum { enum { PROT_TUN_L3_OTHER = 0, PROT_TUN_L3_IPV4 = 1, + PROT_TUN_L3_IPV6 = 2 }; enum { diff --git a/drivers/net/ntnic/nthw/flow_api/flow_api.c b/drivers/net/ntnic/nthw/flow_api/flow_api.c index 6800a8d834..2aee2ee973 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -47,6 +47,33 @@ static const struct { } err_msg[] = { /* 00 */ { "Operation successfully completed" }, /* 01 */ { "Operation failed" }, + /* 02 */ { "Memory allocation failed" }, + /* 03 */ { "Too many output destinations" }, + /* 04 */ { "Too many output queues for RSS" }, + /* 05 */ { "The VLAN TPID specified is not supported" }, + /* 06 */ { "The VxLan Push header specified is not accepted" }, + /* 07 */ { "While interpreting VxLan Pop action, could not find a destination port" }, + /* 08 */ { "Failed in creating a HW-internal VTEP port" }, + /* 09 */ { "Too many VLAN tag matches" }, + /* 10 */ { "IPv6 invalid header specified" }, + /* 11 */ { "Too many tunnel ports. HW limit reached" }, + /* 12 */ { "Unknown or unsupported flow match element received" }, + /* 13 */ { "Match failed because of HW limitations" }, + /* 14 */ { "Match failed because of HW resource limitations" }, + /* 15 */ { "Match failed because of too complex element definitions" }, + /* 16 */ { "Action failed. To too many output destinations" }, + /* 17 */ { "Action Output failed, due to HW resource exhaustion" }, + /* 18 */ { "Push Tunnel Header action cannot output to multiple destination queues" }, + /* 19 */ { "Inline action HW resource exhaustion" }, + /* 20 */ { "Action retransmit/recirculate HW resource exhaustion" }, + /* 21 */ { "Flow counter HW resource exhaustion" }, + /* 22 */ { "Internal HW resource exhaustion to handle Actions" }, + /* 23 */ { "Internal HW QSL compare failed" }, + /* 24 */ { "Internal CAT CFN reuse failed" }, + /* 25 */ { "Match variations too complex" }, + /* 26 */ { "Match failed because of CAM/TCAM full" }, + /* 27 */ { "Internal creation of a tunnel end point port failed" }, + /* 28 */ { "Unknown or unsupported flow action received" }, /* 29 */ { "Removing flow failed" }, }; 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 9460325cf6..0b0b9f2033 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 @@ -538,6 +538,22 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, } break; + case RTE_FLOW_ITEM_TYPE_IPV6: { + const struct rte_flow_item_ipv6 *ipv6_spec = + (const struct rte_flow_item_ipv6 *)elem[eidx].spec; + const struct rte_flow_item_ipv6 *ipv6_mask = + (const struct rte_flow_item_ipv6 *)elem[eidx].mask; + + if (ipv6_spec != NULL && ipv6_mask != NULL) { + if (is_non_zero(&ipv6_spec->hdr.src_addr, 16)) + qw_reserved_ipv6 += 1; + + if (is_non_zero(&ipv6_spec->hdr.dst_addr, 16)) + qw_reserved_ipv6 += 1; + } + } + break; + default: break; } @@ -922,6 +938,164 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_IPV6: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_IPV6", + dev->ndev->adapter_no, dev->port); + { + const struct rte_flow_item_ipv6 *ipv6_spec = + (const struct rte_flow_item_ipv6 *)elem[eidx].spec; + const struct rte_flow_item_ipv6 *ipv6_mask = + (const struct rte_flow_item_ipv6 *)elem[eidx].mask; + + if (ipv6_spec == NULL || ipv6_mask == NULL) { + if (any_count > 0 || fd->l3_prot != -1) + fd->tunnel_l3_prot = PROT_TUN_L3_IPV6; + else + fd->l3_prot = PROT_L3_IPV6; + break; + } + + fd->l3_prot = PROT_L3_IPV6; + if (ipv6_mask->hdr.vtc_flow != 0 || + ipv6_mask->hdr.payload_len != 0 || + ipv6_mask->hdr.hop_limits != 0) { + NT_LOG(ERR, FILTER, + "Requested IPv6 field not support by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (is_non_zero(&ipv6_spec->hdr.src_addr, 16)) { + if (qw_counter >= 2) { + NT_LOG(ERR, FILTER, + "Key size too big. Out of QW resources."); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + uint32_t *qw_data = &packet_data[2 + 4 - qw_counter * 4]; + uint32_t *qw_mask = &packet_mask[2 + 4 - qw_counter * 4]; + + memcpy(&qw_data[0], &ipv6_spec->hdr.src_addr, 16); + memcpy(&qw_mask[0], &ipv6_mask->hdr.src_addr, 16); + + qw_data[0] = ntohl(qw_data[0]); + qw_data[1] = ntohl(qw_data[1]); + qw_data[2] = ntohl(qw_data[2]); + qw_data[3] = ntohl(qw_data[3]); + + qw_mask[0] = ntohl(qw_mask[0]); + qw_mask[1] = ntohl(qw_mask[1]); + qw_mask[2] = ntohl(qw_mask[2]); + qw_mask[3] = ntohl(qw_mask[3]); + + 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_L3 : DYN_L3, 8); + set_key_def_qw(key_def, qw_counter, any_count > 0 + ? DYN_TUN_L3 : DYN_L3, 8); + qw_counter += 1; + } + + if (is_non_zero(&ipv6_spec->hdr.dst_addr, 16)) { + if (qw_counter >= 2) { + NT_LOG(ERR, FILTER, + "Key size too big. Out of QW resources."); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + uint32_t *qw_data = &packet_data[2 + 4 - qw_counter * 4]; + uint32_t *qw_mask = &packet_mask[2 + 4 - qw_counter * 4]; + + memcpy(&qw_data[0], &ipv6_spec->hdr.dst_addr, 16); + memcpy(&qw_mask[0], &ipv6_mask->hdr.dst_addr, 16); + + qw_data[0] = ntohl(qw_data[0]); + qw_data[1] = ntohl(qw_data[1]); + qw_data[2] = ntohl(qw_data[2]); + qw_data[3] = ntohl(qw_data[3]); + + qw_mask[0] = ntohl(qw_mask[0]); + qw_mask[1] = ntohl(qw_mask[1]); + qw_mask[2] = ntohl(qw_mask[2]); + qw_mask[3] = ntohl(qw_mask[3]); + + 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_L3 : DYN_L3, 24); + set_key_def_qw(key_def, qw_counter, any_count > 0 + ? DYN_TUN_L3 : DYN_L3, 24); + qw_counter += 1; + } + + if (ipv6_mask->hdr.proto != 0) { + 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] = ipv6_mask->hdr.proto << 8; + sw_data[0] = ipv6_spec->hdr.proto << 8 & sw_mask[0]; + + km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], + 1, any_count > 0 ? DYN_TUN_L3 : DYN_L3, 4); + set_key_def_sw(key_def, sw_counter, any_count > 0 + ? DYN_TUN_L3 : DYN_L3, 4); + 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] = 0; + qw_data[1] = ipv6_mask->hdr.proto << 8; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = 0; + qw_mask[1] = ipv6_spec->hdr.proto << 8; + 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_L3 : DYN_L3, 0); + set_key_def_qw(key_def, qw_counter, any_count > 0 + ? DYN_TUN_L3 : DYN_L3, 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->l3_prot != -1) + fd->tunnel_l3_prot = PROT_TUN_L3_IPV6; + + else + fd->l3_prot = PROT_L3_IPV6; + } + + break; + case RTE_FLOW_ITEM_TYPE_UDP: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_UDP", dev->ndev->adapter_no, dev->port); @@ -1212,6 +1386,105 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, break; + case RTE_FLOW_ITEM_TYPE_ICMP6: + NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_ICMP6", + dev->ndev->adapter_no, dev->port); + { + const struct rte_flow_item_icmp6 *icmp_spec = + (const struct rte_flow_item_icmp6 *)elem[eidx].spec; + const struct rte_flow_item_icmp6 *icmp_mask = + (const struct rte_flow_item_icmp6 *)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 = 58; + key_def->inner_proto = 1; + } else { + fd->l4_prot = PROT_L4_ICMP; + fd->ip_prot = 58; + key_def->outer_proto = 1; + } + break; + } + + if (icmp_mask->checksum != 0) { + NT_LOG(ERR, FILTER, + "Requested ICMP6 field not supported by running SW version"); + flow_nic_set_error(ERR_FAILED, error); + return -1; + } + + if (icmp_mask->type || icmp_mask->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->type << 24 | + icmp_mask->code << 16; + sw_data[0] = icmp_spec->type << 24 | + icmp_spec->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->type << 24 | + icmp_spec->code << 16; + qw_data[1] = 0; + qw_data[2] = 0; + qw_data[3] = 0; + + qw_mask[0] = icmp_mask->type << 24 | + icmp_mask->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 = 58; + key_def->inner_proto = 1; + + } else { + fd->l4_prot = PROT_L4_ICMP; + fd->ip_prot = 58; + key_def->outer_proto = 1; + } + } + + break; + case RTE_FLOW_ITEM_TYPE_TCP: NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_TCP", dev->ndev->adapter_no, dev->port); -- 2.45.0