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 160B145BCC; Wed, 30 Oct 2024 22:42:45 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9010E434D8; Wed, 30 Oct 2024 22:40:37 +0100 (CET) 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 375924343E for ; Wed, 30 Oct 2024 22:40:18 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2112.outbound.protection.outlook.com [104.47.17.112]) by mx-outbound11-85.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 30 Oct 2024 21:40:15 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=XiopGD0MBSZe0PmflzSucB3Kx0m2Y79+xDKVdZzdw9PKVuYf3XEaY6I6cZC936HvCoWLYTDO8zm8REW0/M7cpe+Twpe9yKpOqnXXdBKSnYrIJytMrLJ8a+i5TluZ+0mHzn7RQHyRt7ZE6ROIlVN+UnKUx6JmJ+4jxure1uCTuyxH4h+wY4afMQxAp+Ke1/18nradIZzO3n72w0bt5PPtvfWgzccPMDXhvvM64RHplDaFboLJ3N+05FL4bx88bqh0Hru36+wH2YJwt9Wy4ME5VnGPxSttjryLidbR/+eltyB2LMtkLWuZ+PGBmaNJ6Zbs4Mkr40YcvBuY2d638y1ByQ== 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=hghca1A0hmH3wQt9XQd/GRGc53/mPen0XOyRhU16PXI=; b=PI8o2yMR48zW55YE1xuTwBVx8ihTX81UE61njHWqr6BiORLWE1NdQbIF4WCeHPHI3/U7epgk+JpN4F9EXoyELouYGEtls11/qdTKaIHpWCibbdz357ySu22LeqZb+6/toB71/k7fdMkKdsW2xxUkX9RKgW1xkWp+aAYDy+DNig97qDFTe1v7jXP+4AISObfRC0fNNaBW6KJo17qXYDTWbFdqOXfPHPnSqSc6GCnpOu5iX4SzZDsJ0m/fLnIGq8ZreYfTrlf9hLdiTzV+T93i/EH3Q/yqKKE/GxEJqtC3qtIh0XuifZUVaTukaKvgKsXYQJPwVAIsIeY+NhjYze/edQ== 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=hghca1A0hmH3wQt9XQd/GRGc53/mPen0XOyRhU16PXI=; b=atJTQITG2G9UTVC3ClipBGxu7z2ljqOTfJmdPHA6G/Z7vN523ZUXH8R1eiv0P+65tA5pVB7OkGQpKG2JeJj+N72ibbHCIgD5adTRDefv5T3/yYeCeS/V9QGt/q0pM67kFOqEdKshQj/YD6MOQd+rgJF86Db4v8UOXKKpOnZfzUA= Received: from DUZPR01CA0011.eurprd01.prod.exchangelabs.com (2603:10a6:10:3c3::19) by DBBP190MB2036.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:52f::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.25; Wed, 30 Oct 2024 21:40:13 +0000 Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com (2603:10a6:10:3c3:cafe::86) by DUZPR01CA0011.outlook.office365.com (2603:10a6:10:3c3::19) 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:13 +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:13 +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 v5 23/80] net/ntnic: add items IPv6 and ICMPv6 Date: Wed, 30 Oct 2024 22:38:30 +0100 Message-ID: <20241030213940.3470062-24-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_|DBBP190MB2036:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: 44532845-629b-429b-5557-08dcf92b6fbf X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|1800799024|376014|82310400026|36860700013; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?4XuGLM9nrecl5u5araS3ZwIUki2yNvuR6B83zl5TcPV/TUsH8GFIjkYxBl+C?= =?us-ascii?Q?5xB8kCqcdzArddnAu3YgezKrkpjyTPBEflQdxhELNNfJESeblSUGRus09+O7?= =?us-ascii?Q?MnommEMCWS/yfsVfUqBWpyIT9F0ghV7RDCNoE5qy+vxLKpgXgwhZPVtpefpe?= =?us-ascii?Q?X8tWXfBvkjFu3JQfNZT2oDsFc1jOZgYWK1G7Cq1VZ5tCv1c7R74zh763/j3V?= =?us-ascii?Q?7gbyTjPUyBw0QiRknaI3Lc/6CWqX+EF8AE/1TwnBnlwMyd0eAxhKSmR1bCdY?= =?us-ascii?Q?A/y7PQwXdS3OLNY5HtyAsPf0ALpVhZT2RGvY9UnQ/CY3rHzRCHggCQc86VDw?= =?us-ascii?Q?lgfNGfINFydjfFPEd1WHZ6+ZuHdby+CpAPCLApKdnaO/EXgax204Dj9idwac?= =?us-ascii?Q?vR35957JgeCVQhw/qFK3Zjz5zul9FOrNPVnG34faEeEHIA4ppikznA8EOe56?= =?us-ascii?Q?xzmhn4XNmdit8hN8yxiDrcLvMhw5L9rzrY5F3/8xK8AIBeZ4NgsppZ+V/2tx?= =?us-ascii?Q?THkgFPsmdb8I71rLOW+7GOlJVDe4AR3tAxJkdHJUumphERmC38gpbdpcfD24?= =?us-ascii?Q?QZ4+EITcHZk7gDFqhEKfzXuRVzdsdsdlMOYLbgC7mBwOedleOWqfnV28i6hi?= =?us-ascii?Q?60awPC0w5vwQzt8x6vGHuezanSrh8EcmfhFY055GjCXuscvXhFTC3QVGXzvK?= =?us-ascii?Q?XSju1jU/VqA+t64AcZOSTZgCFCYf0LUr89DOc4F41CLjtw8c86nP9zf359Ll?= =?us-ascii?Q?bDtyP+++TtVkN1RdFaISzpIPvUoTbeyPnRQh1a6XsMg5ThjUc+0F9d51EpTd?= =?us-ascii?Q?zJQCUxX2HOjuHt1WfspK8lgU9gIipK4ILtevCA0GyeaosSetJsPkcflEWcVA?= =?us-ascii?Q?gZrzpp5fQh1JXT9TneHd/st+Bsw+j/veXUoRC25OAH4y+E2z2o8QKkEAaiPf?= =?us-ascii?Q?wjs9zP5yzxy0rfuC5Iua9XjWpnUwuYunsNcj/fuvDJQFLmi6/QviGQg8prI0?= =?us-ascii?Q?jSctOvEQxJ2GctIlXphRqtn5kjVY5mfcSr/Z8cSOPT/dVZalTaS76LWCiw+j?= =?us-ascii?Q?koE50J0d5twwaFuSDWW06hTlSAbgmcrMNElKMyQ06CXzvWtccgqiEQBuYnNs?= =?us-ascii?Q?IyroVzi+EfcidgFknj5fH48eHkTAdVQgQmCGsfdo1ZJg1PFi2fHOXmJePJlX?= =?us-ascii?Q?oTxFY920hNlFTtdPxxioe+iKlDHq9LCFoxg/HKw0sBVvqjHM/chSyrpwMjoU?= =?us-ascii?Q?9ObIv6IA4dkg+egVLwgqidirMM7JQYjYimfotaB4wA3umyAie3o3+OW1Kp2b?= =?us-ascii?Q?hZSw0bl2Xp//Skwra3sZIGG7PSV33QCyDbb6vLQh0txDFJdfBBghqeWzDln7?= =?us-ascii?Q?iKSGW6bs7cuZlbZul+UD3yfBFIxsL0uH7v5AGuVu14RMmDj6Qg=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)(376014)(82310400026)(36860700013); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: U7qMPWvRjuwL182kkoGwHnXugZ9jHv8nzh65a3MHSZcfH0nbkhJsSkqnahzcCkouXa7/Zz83Fs93/6T44gHIinrUJVW05yOGl/zG38qigKBw/VKyMUeEEzRPYVOafIa4twbZ9BdiilQu7GaqAmARhUIgLIjOIPxr09ETsCceDl6TpbFRql0+F0hXMiHG/FxqZIFD/Ywjzwvjfe3PmYJ34oQnB3+ckZgBmtiyNoOC0jQ1RSW1WWOFfGmPoepUkAoKbQ08dGJnuRFscT+URnvn1zSgK3CdWZ/lCUXCjlVnfVA02GeO+x/b37Mb20RDQQK6DA01XkpWo7jKwQjMxUX2mMg5STfqz0jvVQtgJzY7TVNh0cccBdnbwf2kt190OwdrqOSDPBEbjQRFm3p7BZc0SxmNmZctH9rJ83/CDyAt2H18OKph5GCHNjiMNmem1lDKl3ItRTFsqZir8gxE9gLcZAjgGrgxWMwkZxf8Tzi8JWE5LM428apnw8nf4LmVEhEAamUur/oJxTGqXwEECtEs4St0CaRHvSAXj4PPsjWPCiVOTLqKasPm7G+zd3To7KHvoLw/FZqvuqOSgmwgGYGjw0Zn/JpZ4rZF/m0oMEv7xg+vziRENgGGQMN0NhLZr+bZld0XfOQb1ZhGcXE+plIkRvsyPL+FdtKN989zuQSOmvU= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:13.0519 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 44532845-629b-429b-5557-08dcf92b6fbf 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: DBBP190MB2036 X-BESS-ID: 1730324415-302901-12793-43460-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.112 X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVoZGZsZGQGYGUDTN3CTFzMggzS TV1MwyOc3cNMUwxdjQyMLAzMA82TLNRKk2FgCRLGlUQgAAAA== X-BESS-Outbound-Spam-Score: 0.00 X-BESS-Outbound-Spam-Report: Code version 3.2, rules version 3.2.2.260091 [from cloudscan15-25.eu-central-1a.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 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 | 272 ++++++++++++++++++ 4 files changed, 303 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 a9016238d0..4bd68c572b 100644 --- a/drivers/net/ntnic/nthw/flow_api/flow_api.c +++ b/drivers/net/ntnic/nthw/flow_api/flow_api.c @@ -45,6 +45,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 26e6ee430c..f7a5d42912 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,163 @@ 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; + } + + 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 +1385,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