From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id DD4BC45BCC;
	Wed, 30 Oct 2024 22:41:39 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 62D7F43493;
	Wed, 30 Oct 2024 22:40:25 +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 53BA043365
 for <dev@dpdk.org>; Wed, 30 Oct 2024 22:40:11 +0100 (CET)
Received: from EUR02-DB5-obe.outbound.protection.outlook.com
 (mail-db5eur02lp2107.outbound.protection.outlook.com [104.47.11.107]) by
 mx-outbound47-144.eu-central-1c.ess.aws.cudaops.com (version=TLSv1.2
 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Wed, 30 Oct 2024 21:40:08 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=rkky9I4gBsRe8rjpXTkOeCQEK7hXhqKzERzYOHdUz4cwaBaUAAR0B0QH7HsVV5eMMjmoLcYk/Tqc/JNTqkeDEdaffrNxwIJYA+C/o1kuu5uvFNl95r19F2SbYWzYzKHC4pGe0Di9qjWhH3TXfJblaMHyXYzBwzmR6ZoJ8YhYD8V+rjQ0164y24bp4yJn7JAQ7feKQ6+kanBfpODgWOMbXhRrZ05vrP2G2tFZ6s7Ww5/8pzdqp+aqllWH+hqsLspxCmXD0TL3nSyjUl1j+vvlsr9Mq1urIVZ5OL+mkV0b7+f3Dbz18sZ4jOBYEgFhpifwVbwDa4nQYeMcdt4WmiwkqQ==
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=Lg8pLOyvxcZIivkMJyyRp/ZaU78QfHakfebecNjDhrE=;
 b=fqgCDn3HozSq56836Lm+D8sDZAvv+aiL7DkJqZAtIfOvFSHGTfRh5IaxqmzIBoMZF3e/LkA2/M7WvOgGhGdhgmCnCKPBjG+OmIa0IHV/tFuDEQIupicD3GTYSlp+w7nFbsym/8j4PcYYku1fD0ouKvLdxqedKVU9vsFmEiuWB2CE6qn5WhXxc7Al3zHNVNTqnTFO5QfyTx3qnjva1OCax5V9XjDqOdKGg51csJJts0+1CyMAcH+fmSlLYv+1AAtG49uqQtnC8ZRiEobt7WY3XMBAfNcNfMF7nC50WlgivkeDGOTEt6leVUBg3Yiws+ZtVrsV6DdJCkOaKK7TpJbn8Q==
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=Lg8pLOyvxcZIivkMJyyRp/ZaU78QfHakfebecNjDhrE=;
 b=juoGQcs+8cNvYwH/roOlBGUoDuZTcPnw5LYuJPS4KFZ37vUh3y3S9+4IRb9tcLETB1QSezSw+bYYI5TAREzURNk0eO1/qDOk2VUVLyjr0KBJi6uJQNJWUOKyPkbIPbyJUCMXpy//GiIwVVa2oZX4GDHqzC9URp9MW6al+TRRWTI=
Received: from DUZPR01CA0013.eurprd01.prod.exchangelabs.com
 (2603:10a6:10:3c3::6) by DB9P190MB1097.EURP190.PROD.OUTLOOK.COM
 (2603:10a6:10:1fc::20) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8093.32; Wed, 30 Oct
 2024 21:40:06 +0000
Received: from DU2PEPF00028D13.eurprd03.prod.outlook.com
 (2603:10a6:10:3c3:cafe::f1) by DUZPR01CA0013.outlook.office365.com
 (2603:10a6:10:3c3::6) 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:06 +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:06 +0000
From: Serhii Iliushyk <sil-plv@napatech.com>
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 v5 15/80] net/ntnic: add item IPv4
Date: Wed, 30 Oct 2024 22:38:22 +0100
Message-ID: <20241030213940.3470062-16-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_|DB9P190MB1097:EE_
Content-Type: text/plain
X-MS-Office365-Filtering-Correlation-Id: 7638c20c-ec6f-4104-98b5-08dcf92b6b95
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
 ARA:13230040|82310400026|376014|36860700013|1800799024; 
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?9k6zjH2h7qXKFMooMbelRAyqr2pDqmWCEcwDENwfaIcv/8JddyXrR0RW5EVg?=
 =?us-ascii?Q?we3NPOpavoJtNyM0zMtaIQrv0iJTiJP+P8diiVBlWuohszMF79Tkz+0TXSVS?=
 =?us-ascii?Q?OTk9alUMLBNEwaV5G0KUL727GD4r/tIwzqNaj3WjlJGO1CXXJj8NdV5/02sj?=
 =?us-ascii?Q?CV1A3Dt2b9rt0se/Fl2EhKkG1wBhIIitVdlMf7JyDjkO5gRrcqusaF/7Z+58?=
 =?us-ascii?Q?HI7oenxaO6mYzt/o4vmkE4ryceBKpqz/oqBQDRSWwQn/TKjZHbs+uuzar4bZ?=
 =?us-ascii?Q?a4E/K7RArBawkpdAP1BLp5HYW5NKvrljZUDAANjB4yS6XAfCOq+NsqK9Dtg7?=
 =?us-ascii?Q?0FBKir/lnFYARX1/2Wjy0tcPej7Eos4+EtR9l1jxjBzucTFtp3HXpXm3aK02?=
 =?us-ascii?Q?F/9Q94fqtiASBB9zqsDesXSdPKOASMiWq7Y/2F+ZKs+BgcNDyVJWYGqYIp7M?=
 =?us-ascii?Q?GtVnADFQv/4TOJNf59nJmQljO3ON+5C5zhUlMj/Ncjfx7QksJuxqK4pg6hGD?=
 =?us-ascii?Q?LPTLY/9SaRFOuB0fPXDXii7oc0oJupxunVtfKx7D6yoJhKwfW1EN1a6j3frR?=
 =?us-ascii?Q?wOcbV9XLK1bmgy8s4i6q+CCsKbKc113mucyhBOMsVxvDvAB0t5ZkLUhZm3jH?=
 =?us-ascii?Q?Ux4rlK2gr20lJ2N8PNEyhvb4ON44MKQfca59UpA6PxewAvz4GWAKx6dOB382?=
 =?us-ascii?Q?BU2qJ8Yl9W5sBWSpHO2CNDj7ur6WQC2pLQpKpKr3Uf8Nmlzt5ZY0MYkBft0f?=
 =?us-ascii?Q?A1K09eEQm3sScQbJm3mJ08oSnu9kjp5pg+ebBDmCcVShYmOrryBt68GWpcAe?=
 =?us-ascii?Q?r0kWlZT6CGmCcJ+ZNfqHbWVvfk6eLOD44mttvMVAnW2oVTHYzWs6N+o1o7iH?=
 =?us-ascii?Q?9kP0kp2vRABTWXRRa5Zv4qiYkFrPhK5KPReAXRi58JE3yce3Z6HtjMid8qAZ?=
 =?us-ascii?Q?gaSvjLmTxx0+piVpINP0BS2xmrAXBLojNnorKVtiajObilYa+WClQ2PoNC6q?=
 =?us-ascii?Q?aatvrshacmf64bsYPbYr7hlFRgY5wgKtwGIMZ6s2s4dWN2kG/qpoenDwmeOf?=
 =?us-ascii?Q?vt5V99p14GrMIt1yWC8Zn6XFAGRvkti5z92y7mcX28nNHEgdLesVBvDM1J8B?=
 =?us-ascii?Q?euSU2Wfa2u8J9dZWmm2GpyMgFFBq8mvc0SEvCMsz4zLkbgCXC8k1RvHNTPgz?=
 =?us-ascii?Q?ogLYPwnDD1VkmRHIWIqaDgTesaTISorjOoCCw4KmC4hwc9Ppyrcu0EKLRcdj?=
 =?us-ascii?Q?7L+h01294eCevjyGAy399Jog0uEDqmFJaEx+7A9zW3XcAJMdjzpBnY7mxJcj?=
 =?us-ascii?Q?KdLNPXMsfFzGMXZ7/J9LsDlscLX5P2e3Pocu+v91lxNsIO7Tk9KFxpvBNnVd?=
 =?us-ascii?Q?hirvFmnx8foDMqH6uqFG6qehWjE0ff0PuDBEtaCCDOQQgsv6zA=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)(376014)(36860700013)(1800799024);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: d0i0YBG6btj5YvYbu8dtKBjOsc2ShVtx8nnf8lRWJ4Cqpr7PlhEEPPwNkMsFT7FWzt7bOHEbDlnwihWZEWysdHSZyQTWtrJ1S1iJFMBG/r7h3cmo6NnAbIiidb6YmL7XIqNn/T9Oq/OOQUoU5HHt44sz+2edgmpv2LwGbkhXUffkCyaYzBIw2Gmt3/aUdCX3l0D4xJYeJbTN53G6SrAGT/8dz0TYRS2fgYoTY7/LC6mn3UFdkhoVDXbsrZoGMNNMIU53o3hd5YN82vJcYNTK5uuk9YRbca147gOW7aaK2n4zwMr4WvLrkhjr+6Tv2M16NfXyNdyiXRM8Vm3DusTv1sQCFz2msLyqtBJt65iY3sqIKDZfzBU0hNUxyGKuKBAb+m0v0F5jkg2ORHcKRk6qUn6j7pbxKwOLbTypKZ5WvFeJak34rFQqAEIXtMV4wtpWHRwZOY7oYDXv/rOTtolsbhNkTEsUlJuCuK9GxYRcsWhVsX3SfQzMH5cmWQFh8IU3Y932kTwAcOPvDB87F1V3SyeFhHRnYHl7Rq1/cooVbSJOGku9oC/oBybTXyX2gZ0np08/rVPQjtZ7ut60oZ79dv9NjUiCJkyQmbyVjW5yzyYOQEnoQdtMmi2D8A9l2zXQZgeEG64cDh+I7IrOAKlxiAPRNfC0dtIw8PEjUnzl+lA=
X-OriginatorOrg: napatech.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 30 Oct 2024 21:40:06.0674 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 7638c20c-ec6f-4104-98b5-08dcf92b6b95
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: DB9P190MB1097
X-BESS-ID: 1730324408-312176-12712-40680-1
X-BESS-VER: 2019.1_20241018.1852
X-BESS-Apparent-Source-IP: 104.47.11.107
X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVmbGxpZAVgZQMDE50cTQ0Mw0yS
 g5NTXJPMk42SAx2TzVIs3EyNAoKc1IqTYWAL9gtK1BAAAA
X-BESS-Outbound-Spam-Score: 0.00
X-BESS-Outbound-Spam-Report: Code version 3.2,
 rules version 3.2.2.260091 [from 
 cloudscan15-95.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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Add possibility to use RTE_FLOW_ITEM_TYPE_IPV4.

Signed-off-by: Serhii Iliushyk <sil-plv@napatech.com>
---
v5
* Remove redundant 'break'.
---
 doc/guides/nics/features/ntnic.ini            |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 163 ++++++++++++++++++
 2 files changed, 164 insertions(+)

diff --git a/doc/guides/nics/features/ntnic.ini b/doc/guides/nics/features/ntnic.ini
index 36b8212bae..bae25d2e2d 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
+ipv4                 = Y
 
 [rte_flow actions]
 drop                 = Y
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 8ac1165738..eb73e6ca22 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
@@ -664,6 +664,169 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_IPV4:
+			NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_IPV4",
+				dev->ndev->adapter_no, dev->port);
+			{
+				const struct rte_flow_item_ipv4 *ipv4_spec =
+					(const struct rte_flow_item_ipv4 *)elem[eidx].spec;
+				const struct rte_flow_item_ipv4 *ipv4_mask =
+					(const struct rte_flow_item_ipv4 *)elem[eidx].mask;
+
+				if (ipv4_spec == NULL || ipv4_mask == NULL) {
+					if (any_count > 0 || fd->l3_prot != -1)
+						fd->tunnel_l3_prot = PROT_TUN_L3_IPV4;
+					else
+						fd->l3_prot = PROT_L3_IPV4;
+					break;
+				}
+
+				if (ipv4_mask->hdr.version_ihl != 0 ||
+					ipv4_mask->hdr.type_of_service != 0 ||
+					ipv4_mask->hdr.total_length != 0 ||
+					ipv4_mask->hdr.packet_id != 0 ||
+					(ipv4_mask->hdr.fragment_offset != 0 &&
+					(ipv4_spec->hdr.fragment_offset != 0xffff ||
+					ipv4_mask->hdr.fragment_offset != 0xffff)) ||
+					ipv4_mask->hdr.time_to_live != 0 ||
+					ipv4_mask->hdr.hdr_checksum != 0) {
+					NT_LOG(ERR, FILTER,
+						"Requested IPv4 field not support by running SW version.");
+					flow_nic_set_error(ERR_FAILED, error);
+					return -1;
+				}
+
+				if (ipv4_spec->hdr.fragment_offset == 0xffff &&
+					ipv4_mask->hdr.fragment_offset == 0xffff) {
+					fd->fragmentation = 0xfe;
+				}
+
+				int match_cnt = (ipv4_mask->hdr.src_addr != 0) +
+					(ipv4_mask->hdr.dst_addr != 0) +
+					(ipv4_mask->hdr.next_proto_id != 0);
+
+				if (match_cnt <= 0) {
+					if (any_count > 0 || fd->l3_prot != -1)
+						fd->tunnel_l3_prot = PROT_TUN_L3_IPV4;
+					else
+						fd->l3_prot = PROT_L3_IPV4;
+					break;
+				}
+
+				if (qw_free > 0 &&
+					(match_cnt >= 2 ||
+					(match_cnt == 1 && sw_counter >= 2))) {
+					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];
+
+					qw_mask[0] = 0;
+					qw_data[0] = 0;
+
+					qw_mask[1] = ipv4_mask->hdr.next_proto_id << 16;
+					qw_data[1] = ipv4_spec->hdr.next_proto_id
+						<< 16 & qw_mask[1];
+
+					qw_mask[2] = ntohl(ipv4_mask->hdr.src_addr);
+					qw_mask[3] = ntohl(ipv4_mask->hdr.dst_addr);
+
+					qw_data[2] = ntohl(ipv4_spec->hdr.src_addr) & qw_mask[2];
+					qw_data[3] = ntohl(ipv4_spec->hdr.dst_addr) & qw_mask[3];
+
+					km_add_match_elem(&fd->km, &qw_data[0], &qw_mask[0], 4,
+						any_count > 0 ? DYN_TUN_L3 : DYN_L3, 4);
+					set_key_def_qw(key_def, qw_counter, any_count > 0
+						? DYN_TUN_L3 : DYN_L3, 4);
+					qw_counter += 1;
+					qw_free -= 1;
+
+					if (any_count > 0 || fd->l3_prot != -1)
+						fd->tunnel_l3_prot = PROT_TUN_L3_IPV4;
+					else
+						fd->l3_prot = PROT_L3_IPV4;
+					break;
+				}
+
+				if (ipv4_mask->hdr.src_addr) {
+					if (sw_counter >= 2) {
+						NT_LOG(ERR, FILTER,
+							"Key size too big. Out of SW resources.");
+						flow_nic_set_error(ERR_FAILED, error);
+						return -1;
+					}
+
+					uint32_t *sw_data = &packet_data[1 - sw_counter];
+					uint32_t *sw_mask = &packet_mask[1 - sw_counter];
+
+					sw_mask[0] = ntohl(ipv4_mask->hdr.src_addr);
+					sw_data[0] = ntohl(ipv4_spec->hdr.src_addr) & sw_mask[0];
+
+					km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1,
+						any_count > 0 ? DYN_TUN_L3 : DYN_L3, 12);
+					set_key_def_sw(key_def, sw_counter, any_count > 0
+						? DYN_TUN_L3 : DYN_L3, 12);
+					sw_counter += 1;
+				}
+
+				if (ipv4_mask->hdr.dst_addr) {
+					if (sw_counter >= 2) {
+						NT_LOG(ERR, FILTER,
+							"Key size too big. Out of SW resources.");
+						flow_nic_set_error(ERR_FAILED, error);
+						return -1;
+					}
+
+					uint32_t *sw_data = &packet_data[1 - sw_counter];
+					uint32_t *sw_mask = &packet_mask[1 - sw_counter];
+
+					sw_mask[0] = ntohl(ipv4_mask->hdr.dst_addr);
+					sw_data[0] = ntohl(ipv4_spec->hdr.dst_addr) & sw_mask[0];
+
+					km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1,
+						any_count > 0 ? DYN_TUN_L3 : DYN_L3, 16);
+					set_key_def_sw(key_def, sw_counter, any_count > 0
+						? DYN_TUN_L3 : DYN_L3, 16);
+					sw_counter += 1;
+				}
+
+				if (ipv4_mask->hdr.next_proto_id) {
+					if (sw_counter >= 2) {
+						NT_LOG(ERR, FILTER,
+							"Key size too big. Out of SW resources.");
+						flow_nic_set_error(ERR_FAILED, error);
+						return -1;
+					}
+
+					uint32_t *sw_data = &packet_data[1 - sw_counter];
+					uint32_t *sw_mask = &packet_mask[1 - sw_counter];
+
+					sw_mask[0] = ipv4_mask->hdr.next_proto_id << 16;
+					sw_data[0] = ipv4_spec->hdr.next_proto_id
+						<< 16 & sw_mask[0];
+
+					km_add_match_elem(&fd->km, &sw_data[0], &sw_mask[0], 1,
+						any_count > 0 ? DYN_TUN_L3 : DYN_L3, 8);
+					set_key_def_sw(key_def, sw_counter, any_count > 0
+						? DYN_TUN_L3 : DYN_L3, 8);
+					sw_counter += 1;
+				}
+
+				if (any_count > 0 || fd->l3_prot != -1)
+					fd->tunnel_l3_prot = PROT_TUN_L3_IPV4;
+
+				else
+					fd->l3_prot = PROT_L3_IPV4;
+			}
+
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow request: %d",
 				(int)elem[eidx].type);
-- 
2.45.0