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 2034B45BB4; Wed, 23 Oct 2024 19:03:51 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0EC0942F8F; Wed, 23 Oct 2024 19:01:31 +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 82C3742F2F for ; Wed, 23 Oct 2024 19:01:05 +0200 (CEST) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05lp2113.outbound.protection.outlook.com [104.47.17.113]) by mx-outbound21-18.eu-central-1b.ess.aws.cudaops.com (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 23 Oct 2024 17:01:04 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=HhOp8WMAdmo500xpNUebkpg42lIL2esCCgwn7HCTpnRP+i88il1M8EBCz+18HIssStMCg1M7RkGc4B9NJFc3WBuTO0Wc2SfA7tbuMiRi9/8AAchjpp3y8FFPwYcgmS0vle3DhOvjj77iP5nDpwA28IQj7VkgdEXnMvqsSNK61JdE9uj/EBTJNMiqjT8fDQnvak06v4pnA83nVt3PbOq0AMaGFSv6NFJWOlW0o89KRq3o59l0K1ZGEt+IXNuO+BMvcaUUmCuPdODUykUfs03weZDZ+nUvipSUdtUISNDUpZySY1ziJiorFvOVVbHVcs5CHgOMK1SMrRtdNu2pp8b5EQ== 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=p4o5duhPGG1NZjktAmn5znCzutnQsON0mwniDMmoVGwd6zOeB89cyhUH3lvUybgzWnkg37siWOFKWqdN5vlPncPUxTYpZtQbr6zGi6RgQnmbmrl56iRPflCSlGwG5D7jY2yEgRWvBCTr2yG/fwLP83eAlkeV/XhenYpnABga6/B0sXsv64/fA+7p+erACRzAcRrKUb36EfU3dto1qAXXsFub4VPfF8ptcIT5pLSDr66GCHwkz1Bk6B1XybINmi9xd/OaaKpvILlbfwETBDG6/4Rxpd12jBic8RETVSRNSoVUkw07haBTUIO+0a7JWq4j4Cs4AnbKygr8V0cO20j1iw== 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=FjAqVfkQZRYkco3Y/ur9Z4jS+bSEyO9cNaUcJQEh29by7W0qJoatMEoRsazTRjwREnT203hKiOl5i+1MDfExyQGEx2d0lHIfLvElZrH3oZQ9LgkdpVoW4+obBXq42f0oByrzhvcWJuFRaMqdtbXpQ/t3ObySa35wYG/BftDN6Go= Received: from DU7PR01CA0013.eurprd01.prod.exchangelabs.com (2603:10a6:10:50f::8) by DB9P190MB1148.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:220::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18; Wed, 23 Oct 2024 17:01:02 +0000 Received: from DB5PEPF00014B9E.eurprd02.prod.outlook.com (2603:10a6:10:50f:cafe::4f) by DU7PR01CA0013.outlook.office365.com (2603:10a6:10:50f::8) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.18 via Frontend Transport; Wed, 23 Oct 2024 17:01:02 +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:01:01 +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, Danylo Vodopianov Subject: [PATCH v3 23/73] net/ntnic: add items IPv6 and ICMPv6 Date: Wed, 23 Oct 2024 18:59:31 +0200 Message-ID: <20241023170032.314155-24-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_|DB9P190MB1148:EE_ Content-Type: text/plain X-MS-Office365-Filtering-Correlation-Id: e04bdb9f-07c6-46a2-e224-08dcf3844650 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|376014|36860700013|1800799024|82310400026; X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?rtS9UR9USJd/ME0++hVKHgDWvs00SyOAgbMwHPn8W/CR2tLwfK+Z3TD+JtNL?= =?us-ascii?Q?e3klK2/7qOELgrBJC9Ne0AqMqhslQLHE1CHvDxprMd8K7bXFcvsEudT9UJPq?= =?us-ascii?Q?50Dzy4Ekfi6BGmxLVt0rQW+dvN3BSfzrD7DtCXEC7xNLWLPy04T/0+5ByPXx?= =?us-ascii?Q?qC1KZa4lP4I0UcQXuVPgzJpgTAyv593I3Uq61L5jkmYw4mV3nAZ3bqcSw89m?= =?us-ascii?Q?JnEdwc1MWI7gLTC6HLc54xB3P9n8qz/FRV1r9VFCcq+fP4hzchq9i+uHMCV9?= =?us-ascii?Q?FxpJQjcYkEb85wXjdzrV54oPnBK6169B4+kVI0vaOghCTIzlU5UplF7xVv1g?= =?us-ascii?Q?1DDvl8kk2aHXufcDzoh4qeHeamN/OJALZPHFB5oXD6Z3Z4ksf+dMxiVadDrQ?= =?us-ascii?Q?rrWUo7Y54EH0+UFM/sTMFyUEblJRPBwz1/BYwgQEhwU/xs2M1Fw81USM1jGh?= =?us-ascii?Q?iMGqrIC0zv62RbBnvyRwGX6JPOU4lfZrCgCzpYdrMKN8F0DM1Ymsc+Slr9x+?= =?us-ascii?Q?k0YstagWpw8PYMF5QZvgGQ8JQjLj0QnnRhJyxA2XQo7L2GBOdx9O4lMmTQVT?= =?us-ascii?Q?IXASiCRDNBrEQuYGJBAwfLdvGRhtbcPkq9PlLYLvDdWYYnIGmAMwjS50FQGp?= =?us-ascii?Q?pTJe6k3wiSjW0sOFIBA4+CFXwm/cPBA54W9Qww77ZHjc3A/BnWU7BBtZKxCt?= =?us-ascii?Q?Fh7QxwAWLr63ZhFNXDDVarDoHDLoj0v+x4ijdY4BM5OsOYgVhsEmWUGcaWJd?= =?us-ascii?Q?RQTSg4BW6cSGyy5H4c+d25xzLDxeFTMlviRMu03QiVk1FSK3fCdCcN21Gt2d?= =?us-ascii?Q?slNGBwLyRCeXSmbU3SWUecUveT5D/3EHGpBmB78cS82znnigdmEXxxufNP6g?= =?us-ascii?Q?vJQ4xM7h4OejS9tmk/0cuzYR98aDO/uQ0DtYswZa59kmSe3Ys6zufZNCIgmH?= =?us-ascii?Q?s1tZwa7DI+4Rjer05yu/TGI65Un73L/uNLol8sArewA0I6gBEPneU/E21xsV?= =?us-ascii?Q?R+5RT4uLyxHvpXrspQNvjLudAt4BP+lBRBzMMw4IdarnHz2G3MH+FuI7QxSU?= =?us-ascii?Q?799UkTGN6wP5x0V+kozG647kwOHJ8RNqrbkvG5Yhjj5WrHwCHmlNPJmjo/D+?= =?us-ascii?Q?gyFP5OTbEFeNbOv9EmEQSv2rkzLmFg0NLmZqTOJqUxqiQK1MZLBfBoHg6z8E?= =?us-ascii?Q?nZCvWqgUoClINhB/OGn0LcBfpaTHymY8Vg7bKeZbrnu2Ohel4nRrcmBrZ4+u?= =?us-ascii?Q?MGWuRKK3FdryzTODWv5Sm8JuHhbapXzR8HZNrok9CZQacD7LtE3mT75UktSX?= =?us-ascii?Q?dK05pT/funo4Dgk/BHbhmFQ1ik6Cg5vFOyY+Xd1NQ8qeKy+65nSzZQQ8BZnt?= =?us-ascii?Q?S/x81R4AE3eDHSpyw26nmQmKm2kBt0DIZ5x3yp+gl005F8dPXw=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)(376014)(36860700013)(1800799024)(82310400026); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: 5EFcTULSYAYssuTsebZaT5RHqHM6fewZ98enPN9Yvf5L5dzkd2WsjcmgmTgbRYJcKDaG4Uy3Qo9Dm6G3PDkyBRTvHv6QlmVj6XiAHKOkOpWWCYGuV3ie2Tga2rXeV3WxB+jhAKJLFXnP/82+sFf5HYay4OCRrr6Ye+BB0lXF5HYfB0yprL7onsgsPLyuDVHKz3HCT5mWK7ovTgi9lxMQuEwp4VfEqeD5KSOXMQvEG4EP3CwGtHA5hPbkuruejAMcb1BmlulYkIqe9LMJmRAz6NKjmtTJXzaW4/rYJFLmM0IadkKomG+Uam8n7h8ez9RgphFYDUb6stnsJKSfsOqqf5y5JwgrJceervV5A8lGCOa2v0fi0iTJmFBukg2XPeV8J3zrKP2Q6M0+oPRzUEraJhIRtpQJPFo05hWDwTlEGeqaNZFBveDDz0km/mCLpwSbl6GpqztRvSu/f3I8wO18+VaLvF1XhLgidCrlpObeSfeee5F54GZwIRyj97QlBf8fH6+II3+aQXlXRbDtSoMKJ8Wi3SRUksbMcJtij09xWAUOWrAMg+1jpJ/B+UUN0NnbHyP7eij0aBtrKAAJn2RuBW08KV92w2tqDYu26m7WHlOcxr7kzt5Zdb36kd1w+Y0qwlS7zHfrEM+bXzN8T6mOtz2BxB0JmJPBAWwRebm2S5o= X-OriginatorOrg: napatech.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2024 17:01:01.8050 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e04bdb9f-07c6-46a2-e224-08dcf3844650 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: DB9P190MB1148 X-BESS-ID: 1729702864-305394-16203-13643-1 X-BESS-VER: 2019.1_20241018.1852 X-BESS-Apparent-Source-IP: 104.47.17.113 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.259925 [from cloudscan12-179.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 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