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 47B7045B04;
	Thu, 10 Oct 2024 16:15:15 +0200 (CEST)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id 8BDA540A6C;
	Thu, 10 Oct 2024 16:14:44 +0200 (CEST)
Received: from egress-ip11a.ess.de.barracuda.com
 (egress-ip11a.ess.de.barracuda.com [18.184.203.234])
 by mails.dpdk.org (Postfix) with ESMTP id EBEC54064F
 for <dev@dpdk.org>; Thu, 10 Oct 2024 16:14:34 +0200 (CEST)
Received: from EUR05-VI1-obe.outbound.protection.outlook.com
 (mail-vi1eur05lp2176.outbound.protection.outlook.com [104.47.17.176]) by
 mx-outbound11-198.eu-central-1a.ess.aws.cudaops.com (version=TLSv1.2
 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO);
 Thu, 10 Oct 2024 14:14:34 +0000
ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none;
 b=E/xOfvmF5uV9uBY5TTAonEy6CK9i542s1T48e/itbsG5XgO8/ReQM6PBP85FxzqIIXA7+72MSRCK8DO2Z4ddFENK3oNAGUSg9Q3vhAAg0s3rm35OFCOfDnv/YAZd4h6dGSsyk+C8BDmgEDjXnzr2t2nKRbdrLPWkEFMgT7cdNuc4KCZHxZ+tT4aYgOtm1WrwIottUITKwKvKPkazj+R/O9rZeTMCcYFgrLQNxv+ly/2a+YK9sKer9a49xAwMaIuswZRfLt72AZb40q1Y9F4Yaf2tvS8YR8Uo5n6yHfCbepkRZmE2kENhX0hkOqdIsvvhqaqTedDc/A32tPjnkJXwgw==
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=dNCLw+HfZ3CmvJzvFAD6j1Y/JvqmSp7sm6KrnqScCz0=;
 b=ay39vZT4tvk7u+jLDvJG3nkB28/XudIvuzerjs8kpNZgbRKeZWZLQkWa3i8N7j8vM9MaaH/+UeKciOh3Jzu5/8FpuEbdct8IH6RXoVytpxtBVQwL3D31T3JwgYjOlzjoQiLuR4unAO9iFyMPJa1Fq/9JekF/j+DN4RcPgz7EDGNJa4D8fUKuq/DC7jzYyeCX15nztrP1tE2rvyKatWsSPWMeB3bxfZx85y4DQwsF+457YreYjQSN9BS0DH+kyhBsXs9p7XspBdLHsUHUkCx3dsVR6YEKEllC7U7zmAgzKtY66BcmgOa6gXZX+ezhtMdAslVF9qXbHVAy6yiFJHiyCA==
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=dNCLw+HfZ3CmvJzvFAD6j1Y/JvqmSp7sm6KrnqScCz0=;
 b=mqPO60GEH+onGdKSl5VrmcMq0ZkRQ9ow6pTbxU6hWZHIyLBuYq7QE63jYj0p8U5E0F6DHG147wNIQ292aCDp/4zoORkwtCeftI1x/aEwgoq6ct5oymwkajw36nKvbd9/O6j5VDWom+OVINq5ckxKNw+l/EpmPDN9oKATbunkj/o=
Received: from DU2PR04CA0079.eurprd04.prod.outlook.com (2603:10a6:10:232::24)
 by DB9P190MB1867.EURP190.PROD.OUTLOOK.COM (2603:10a6:10:37e::17) with
 Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8026.22; Thu, 10 Oct
 2024 14:14:28 +0000
Received: from DU6PEPF0000B61B.eurprd02.prod.outlook.com
 (2603:10a6:10:232:cafe::3c) by DU2PR04CA0079.outlook.office365.com
 (2603:10a6:10:232::24) with Microsoft SMTP Server (version=TLS1_2,
 cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8048.17 via Frontend
 Transport; Thu, 10 Oct 2024 14:14:28 +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
 DU6PEPF0000B61B.mail.protection.outlook.com (10.167.8.132) with Microsoft
 SMTP Server id 15.20.8048.13 via Frontend Transport; Thu, 10 Oct 2024
 14:14:27 +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,
 Oleksandr Kolomeiets <okl-plv@napatech.com>
Subject: [PATCH v3 06/50] net/ntnic: add flow filter init API
Date: Thu, 10 Oct 2024 16:13:21 +0200
Message-ID: <20241010141416.4063591-7-sil-plv@napatech.com>
X-Mailer: git-send-email 2.45.0
In-Reply-To: <20241010141416.4063591-1-sil-plv@napatech.com>
References: <20241006203728.330792-2-sil-plv@napatech.com>
 <20241010141416.4063591-1-sil-plv@napatech.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-EOPAttributedMessage: 0
X-MS-PublicTrafficType: Email
X-MS-TrafficTypeDiagnostic: DU6PEPF0000B61B:EE_|DB9P190MB1867:EE_
Content-Type: text/plain
X-MS-Office365-Filtering-Correlation-Id: 92a29d76-76d6-43a0-44d2-08dce935da0d
X-MS-Exchange-SenderADCheck: 1
X-MS-Exchange-AntiSpam-Relay: 0
X-Microsoft-Antispam: BCL:0;
 ARA:13230040|36860700013|82310400026|1800799024|376014; 
X-Microsoft-Antispam-Message-Info: =?us-ascii?Q?NYBS6qdjZ58NsrDfmO70o3WX+lUKha1JndXkBwP5A9UQxzczZUx/SgTNUS9x?=
 =?us-ascii?Q?x9nDQn+sPU+z7VYsvYEIyJa2UOyPMdVvv8eCEIosp4XVcX5xvwGayplyoC28?=
 =?us-ascii?Q?XLPYD2rjyLBBqta9unY4giwZcMD2xUhj0jZZGcMCMTw1LbNnXduL+yXOAlxJ?=
 =?us-ascii?Q?XIJVTkiO2em5PlUadvNOutB1Gk1kt3/1OBwOWeDPSaec8EkIId/vIKYuyBXA?=
 =?us-ascii?Q?M4/lCr70SA1jb5KYFvtM0XCCetjqEC/cVe5NDhliYkXJ7j0VLelkKeLiKU8O?=
 =?us-ascii?Q?ERFHjN2oFBM0TiFJ0SHvSEDOPMiJEvL5R4KBU8xWROTRuSTqxa7bfzu0AxVS?=
 =?us-ascii?Q?EXwismsJ7/B9qoMkI/miHwo3E6pP/jz8oukFKveImqazd3ZmBg662ghZTsS7?=
 =?us-ascii?Q?HgETTLP2HZ1PHR7TijXWRFq8c44pRnMaTqDq/fQpIhx+FN+dPDnq3aLFZkjq?=
 =?us-ascii?Q?pQda9E0eoG+llw98zz+1xVUCBBd8c80AeyWZaLCK10f8s7mhsToqj68xrwds?=
 =?us-ascii?Q?HhLDOaXRVBxiuLGYoZiLfv+6L2NOO7dGKYq8nnPtNHlMV0zawScY+c89PtXc?=
 =?us-ascii?Q?bvfQ15Efgv3nGa4zzY7OLo8eiI4mtn6JeZN107L7GV9UwRaWxqeftdtfB0En?=
 =?us-ascii?Q?m3sauy9JjazqHsgLRHcHpUoPwPCR+M3vCIRM12JunObROho+QWBYzIi95lK8?=
 =?us-ascii?Q?lJ8YAVsjJpnqfmYX0asqgyIUT8UOgY/u1eyNyzJTSKBzt43i0Y22WuEahDwv?=
 =?us-ascii?Q?3AeAb3TKpWlFbaYxa9xuwhM5GFPdiLROObXNqs8haWmytUbCpYhLoSgeFXuK?=
 =?us-ascii?Q?qeRo5tmq/e+5B/j2FPl2GHtNuyjEaBs+Tak+0evUP180e9+jmBXEt9briCpe?=
 =?us-ascii?Q?gFvYFYnwfng/9taPPosstu9dVng8IP944S9VIOcSWaNLDLVd2AzVk7k8nII8?=
 =?us-ascii?Q?hpwxvm4K5nXAKs9F59F10zehVAnZjkfjMUdFzMFhAaFa9zVvccyv8MKiXKu8?=
 =?us-ascii?Q?JlK8FZjRjgXvOy9kceJbU6OFXORaVjNY/7U3WRJdcW0IoT3F2EGT053+AlvT?=
 =?us-ascii?Q?W9mw00c5LQg6VRqXYPy8bcXTQoLZJiMhp0gQ9GCbgGNeX0ZvhZLGOj2zSRo1?=
 =?us-ascii?Q?7yZRRHMUBVP/73Bt1HLNr/ElworNOKcPxt71d35IJRJ4BM1fPW/bKH+CwG/1?=
 =?us-ascii?Q?QSEkIZWx9AFnFk8Nrr6Kk2/gTbrzirKf1Yq7PODRLPoZzdjpsWz67CVPXIm7?=
 =?us-ascii?Q?UMPzigPqvXk9McG5xo16bDblfa4HWRB/CeDl3qqm1SQcK66mn8D7j9zB50qn?=
 =?us-ascii?Q?x357c/Iq2aO9+sXFGtsiClDt8o7rHuHRRZK4sY/ftF3tIoCBzIPaAZ4Px8bp?=
 =?us-ascii?Q?dLD09hY=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)(82310400026)(1800799024)(376014);
 DIR:OUT; SFP:1102; 
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-ChunkCount: 1
X-MS-Exchange-AntiSpam-ExternalHop-MessageData-0: g6fwYvAfmE+QIm73e7sSqvj6HrPVmnKcMBHdHFP+ffaQmCDe2Yl+TEtW6e/lhdu+ksvyfeYk+18PEvieJ6GNCoefeXlj5GaUwQc92EBQ0d9bRF4bAa3Y1rVgsRQTP4cSZ2FKWaKWsXK35KZ7SnD/scq63+ZbsIts6wqNUqkZ9wq83/BArVJ3oK0FUlWoZuPvViYFBBLK20cHKBgHrk6zl4lXlTBzezda6rAFqoEsX/avkfyy4rOdLq10P9DurBZ0wv2CvN/FfqN0Eqicd72wE0Y9XnkyeTqnAwr2FEvj2T8CIaCweurwMHvt+qEelQUrV4qKcytFamU46OMisXgsX9fnkzP/8fxdTzNYkkcCD1nLqWKSmbgzDEm0bFJc3T9udJv84s0spNZKtBXkt6yE3qaFmaesFDRttB2N+D3qE5BLPka/MKCROUTsAeF6eyu39It5+E+B4oRky6FyAd0nwhYVAAGR231mes7H5SIBoUkazzSOTfLdf2acNp2DY0H/GmVmsqKktooU7kXWMHYjgoZQh6T+PtMqdhh3YuVb+Rf3ckdD+0p7V/OhhCbFygaa2aOEl4dF9fpUlXq5kVCHRpcahTDbVdYXA9OFxsF8nq8yWJwS/3HtzK2r/yTp+MobnPbUtq2kuTqQaX1UBbzmGzoXiA/QAUq8DzOsa9EYgBs=
X-OriginatorOrg: napatech.com
X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Oct 2024 14:14:27.7171 (UTC)
X-MS-Exchange-CrossTenant-Network-Message-Id: 92a29d76-76d6-43a0-44d2-08dce935da0d
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: DU6PEPF0000B61B.eurprd02.prod.outlook.com
X-MS-Exchange-CrossTenant-AuthAs: Anonymous
X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem
X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB9P190MB1867
X-BESS-ID: 1728569672-303014-12758-25600-2
X-BESS-VER: 2019.1_20241004.2057
X-BESS-Apparent-Source-IP: 104.47.17.176
X-BESS-Parts: H4sIAAAAAAACA4uuVkqtKFGyUioBkjpK+cVKVqZGBuZAVgZQ0MDE0tzYwjQ5xc
 LCLMU80czYMNHEPNHIxMTMKC0l2dJYqTYWAEHcq3ZBAAAA
X-BESS-Outbound-Spam-Score: 0.50
X-BESS-Outbound-Spam-Report: Code version 3.2,
 rules version 3.2.2.259630 [from 
 cloudscan10-34.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 <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

From: Oleksandr Kolomeiets <okl-plv@napatech.com>

Add high-level interfaces for the initialization of the flow filter.

Signed-off-by: Oleksandr Kolomeiets <okl-plv@napatech.com>
---
v2
* Update release notes
v3
* Remove new line characters from logs
---
 doc/guides/rel_notes/release_24_11.rst    |  1 +
 drivers/net/ntnic/adapter/nt4ga_adapter.c | 18 ++++++++++++++++++
 drivers/net/ntnic/include/flow_api.h      | 12 ++++++++++++
 drivers/net/ntnic/include/nt4ga_adapter.h |  6 ++++++
 drivers/net/ntnic/include/nt4ga_filter.h  | 13 +++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.c         |  7 +++++++
 drivers/net/ntnic/ntnic_mod_reg.h         |  8 ++++++++
 7 files changed, 65 insertions(+)
 create mode 100644 drivers/net/ntnic/include/flow_api.h
 create mode 100644 drivers/net/ntnic/include/nt4ga_filter.h

diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst
index a126dcfcb9..ee848d5a3d 100644
--- a/doc/guides/rel_notes/release_24_11.rst
+++ b/doc/guides/rel_notes/release_24_11.rst
@@ -104,6 +104,7 @@ New Features
   * Fix Coverity issues
   * Fix issues related to release 24.07
   * Extended and fixed the implementation of the logging
+  * Added NT flow filter init API
 
 Removed Items
 -------------
diff --git a/drivers/net/ntnic/adapter/nt4ga_adapter.c b/drivers/net/ntnic/adapter/nt4ga_adapter.c
index b6043d9f0f..53c4d41a35 100644
--- a/drivers/net/ntnic/adapter/nt4ga_adapter.c
+++ b/drivers/net/ntnic/adapter/nt4ga_adapter.c
@@ -75,6 +75,11 @@ static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE *
 
 static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)
 {
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL)
+		NT_LOG(ERR, NTNIC, "%s: flow_filter module uninitialized", __func__);
+
 	char *const p_dev_name = malloc(24);
 	char *const p_adapter_id_str = malloc(24);
 	fpga_info_t *fpga_info = &p_adapter_info->fpga_info;
@@ -155,6 +160,19 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)
 	n_nim_ports = fpga_info->n_nims;
 	assert(n_nim_ports >= 1);
 
+	/* Nt4ga Init Filter */
+	nt4ga_filter_t *p_filter = &p_adapter_info->nt4ga_filter;
+
+	if (flow_filter_ops != NULL) {
+		res = flow_filter_ops->flow_filter_init(p_fpga, &p_filter->mp_flow_device,
+				p_adapter_info->adapter_no);
+
+		if (res != 0) {
+			NT_LOG(ERR, NTNIC, "%s: Cannot initialize filter", p_adapter_id_str);
+			return res;
+		}
+	}
+
 	{
 		int i;
 		const struct link_ops_s *link_ops = NULL;
diff --git a/drivers/net/ntnic/include/flow_api.h b/drivers/net/ntnic/include/flow_api.h
new file mode 100644
index 0000000000..036e652b76
--- /dev/null
+++ b/drivers/net/ntnic/include/flow_api.h
@@ -0,0 +1,12 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_API_H_
+#define _FLOW_API_H_
+
+/* registered NIC backends */
+struct flow_nic_dev;
+
+#endif
diff --git a/drivers/net/ntnic/include/nt4ga_adapter.h b/drivers/net/ntnic/include/nt4ga_adapter.h
index 4b204742a2..93218fd45b 100644
--- a/drivers/net/ntnic/include/nt4ga_adapter.h
+++ b/drivers/net/ntnic/include/nt4ga_adapter.h
@@ -23,7 +23,13 @@ typedef struct hw_info_s {
 	int hw_reserved1;
 } hw_info_t;
 
+/*
+ * Services provided by the adapter module
+ */
+#include "nt4ga_filter.h"
+
 typedef struct adapter_info_s {
+	struct nt4ga_filter_s nt4ga_filter;
 	struct nt4ga_link_s nt4ga_link;
 
 	struct hw_info_s hw_info;
diff --git a/drivers/net/ntnic/include/nt4ga_filter.h b/drivers/net/ntnic/include/nt4ga_filter.h
new file mode 100644
index 0000000000..2024b500f3
--- /dev/null
+++ b/drivers/net/ntnic/include/nt4ga_filter.h
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NT4GA_FILTER_H_
+#define NT4GA_FILTER_H_
+
+typedef struct nt4ga_filter_s {
+	struct flow_nic_dev *mp_flow_device;
+} nt4ga_filter_t;
+
+#endif  /* NT4GA_FILTER_H_ */
diff --git a/drivers/net/ntnic/ntnic_mod_reg.c b/drivers/net/ntnic/ntnic_mod_reg.c
index 40e22c60fa..45cc767c90 100644
--- a/drivers/net/ntnic/ntnic_mod_reg.c
+++ b/drivers/net/ntnic/ntnic_mod_reg.c
@@ -88,3 +88,10 @@ struct rst9563_ops *get_rst9563_ops(void)
 		rst9563_ops_init();
 	return rst9563_ops;
 }
+
+static const struct flow_filter_ops *flow_filter_ops;
+
+const struct flow_filter_ops *get_flow_filter_ops(void)
+{
+	return flow_filter_ops;
+}
diff --git a/drivers/net/ntnic/ntnic_mod_reg.h b/drivers/net/ntnic/ntnic_mod_reg.h
index 3189b04f33..6dd6240c6f 100644
--- a/drivers/net/ntnic/ntnic_mod_reg.h
+++ b/drivers/net/ntnic/ntnic_mod_reg.h
@@ -7,6 +7,7 @@
 #define __NTNIC_MOD_REG_H__
 
 #include <stdint.h>
+#include "flow_api.h"
 #include "nthw_fpga_model.h"
 #include "nthw_platform_drv.h"
 #include "nthw_drv.h"
@@ -117,4 +118,11 @@ void register_rst9563_ops(struct rst9563_ops *ops);
 struct rst9563_ops *get_rst9563_ops(void);
 void rst9563_ops_init(void);
 
+struct flow_filter_ops {
+	int (*flow_filter_init)(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device,
+		int adapter_no);
+};
+
+const struct flow_filter_ops *get_flow_filter_ops(void);
+
 #endif	/* __NTNIC_MOD_REG_H__ */
-- 
2.45.0