Skip to contentSkip to conversation

Provide flow filter API and statistics

PATCH Superseded Serhii Iliushyk 3 participants 412 messages Oct 21, 2024 – Nov 22, 2024 Page 5 of 6

Subsystems (2)
lore
Share & tools
lore
#327 lore raw

PATCH v5 2/80 net/ntnic: add flow filter support

In reply to Serhii Iliushyk

Enable flow ops getter.

---
v2
* Change cast to void with __rte_unused

---
 drivers/net/ntnic/include/create_elements.h   | 13 +++++++
 .../ntnic/include/stream_binary_flow_api.h    |  2 +
 drivers/net/ntnic/meson.build                 |  1 +
 drivers/net/ntnic/ntnic_ethdev.c              |  7 ++++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 37 +++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.c             | 15 ++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  5 +++
 7 files changed, 80 insertions(+)
 create mode 100644 drivers/net/ntnic/include/create_elements.h
 create mode 100644 drivers/net/ntnic/ntnic_filter/ntnic_filter.c
drivers/net/ntnic/include/create_elements.h new file +13 -0
new file mode 100644
index 0000000000..802e6dcbe1
@@ -0,0 +1,13 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __CREATE_ELEMENTS_H__
+#define __CREATE_ELEMENTS_H__
+
+
+#include "stream_binary_flow_api.h"
+#include <rte_flow.h>
+
+#endif	/* __CREATE_ELEMENTS_H__ */
drivers/net/ntnic/include/stream_binary_flow_api.h +2 -0
index 47e5353344..a6244d4082 100644
@@ -6,6 +6,8 @@
 #ifndef _STREAM_BINARY_FLOW_API_H_
 #define _STREAM_BINARY_FLOW_API_H_
 
+#include "rte_flow.h"
+#include "rte_flow_driver.h"
 /*
  * Flow frontend for binary programming interface
  */
drivers/net/ntnic/meson.build +1 -0
index 3d9566a52e..d272c73c62 100644
@@ -79,6 +79,7 @@ sources = files(
         'nthw/nthw_platform.c',
         'nthw/nthw_rac.c',
         'ntlog/ntlog.c',
+        'ntnic_filter/ntnic_filter.c',
         'ntutil/nt_util.c',
         'ntnic_mod_reg.c',
         'ntnic_vfio.c',
drivers/net/ntnic/ntnic_ethdev.c +7 -0
index 510c0e5d23..a509a8eb51 100644
@@ -1321,6 +1321,12 @@ eth_fw_version_get(struct rte_eth_dev *eth_dev, char *fw_version, size_t fw_size
 	}
 }
 
+static int dev_flow_ops_get(struct rte_eth_dev *dev __rte_unused, const struct rte_flow_ops **ops)
+{
+	*ops = get_dev_flow_ops();
+	return 0;
+}
+
 static int
 promiscuous_enable(struct rte_eth_dev __rte_unused(*dev))
 {
@@ -1349,6 +1355,7 @@ static const struct eth_dev_ops nthw_eth_dev_ops = {
 	.mac_addr_add = eth_mac_addr_add,
 	.mac_addr_set = eth_mac_addr_set,
 	.set_mc_addr_list = eth_set_mc_addr_list,
+	.flow_ops_get = dev_flow_ops_get,
 	.promiscuous_enable = promiscuous_enable,
 };
 
drivers/net/ntnic/ntnic_filter/ntnic_filter.c new file +37 -0
new file mode 100644
index 0000000000..445139abc9
@@ -0,0 +1,37 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <rte_flow_driver.h>
+#include "ntnic_mod_reg.h"
+
+static int
+eth_flow_destroy(struct rte_eth_dev *eth_dev __rte_unused, struct rte_flow *flow __rte_unused,
+	struct rte_flow_error *error __rte_unused)
+{
+	int res = 0;
+
+	return res;
+}
+
+static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev __rte_unused,
+	const struct rte_flow_attr *attr __rte_unused,
+	const struct rte_flow_item items[] __rte_unused,
+	const struct rte_flow_action actions[] __rte_unused,
+	struct rte_flow_error *error __rte_unused)
+{
+	struct rte_flow *flow = NULL;
+
+	return flow;
+}
+
+static const struct rte_flow_ops dev_flow_ops = {
+	.create = eth_flow_create,
+	.destroy = eth_flow_destroy,
+};
+
+void dev_flow_init(void)
+{
+	register_dev_flow_ops(&dev_flow_ops);
+}
drivers/net/ntnic/ntnic_mod_reg.c +15 -0
index ac8afdef6a..ad2266116f 100644
@@ -137,3 +137,18 @@ const struct flow_filter_ops *get_flow_filter_ops(void)
 
 	return flow_filter_ops;
 }
+
+static const struct rte_flow_ops *dev_flow_ops;
+
+void register_dev_flow_ops(const struct rte_flow_ops *ops)
+{
+	dev_flow_ops = ops;
+}
+
+const struct rte_flow_ops *get_dev_flow_ops(void)
+{
+	if (dev_flow_ops == NULL)
+		dev_flow_init();
+
+	return dev_flow_ops;
+}
drivers/net/ntnic/ntnic_mod_reg.h +5 -0
index 017d15d7bc..457dc58794 100644
@@ -15,6 +15,7 @@
 #include "nt4ga_adapter.h"
 #include "ntnic_nthw_fpga_rst_nt200a0x.h"
 #include "ntnic_virt_queue.h"
+#include "create_elements.h"
 
 /* sg ops section */
 struct sg_ops_s {
@@ -243,6 +244,10 @@ struct flow_filter_ops {
 		uint32_t exception_path);
 };
 
+void register_dev_flow_ops(const struct rte_flow_ops *ops);
+const struct rte_flow_ops *get_dev_flow_ops(void);
+void dev_flow_init(void);
+
 void register_flow_filter_ops(const struct flow_filter_ops *ops);
 const struct flow_filter_ops *get_flow_filter_ops(void);
 void init_flow_filter(void);
Signature · 1 line
2.45.0
#328 lore raw

PATCH v5 3/80 net/ntnic: add minimal create/destroy flow operations

In reply to Serhii Iliushyk

Add high-level API flow create/destroy implementation

---
v2
* Change cast to void with __rte_unused

---
 drivers/net/ntnic/include/create_elements.h   |  51 ++++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 227 +++++++++++++++++-
 drivers/net/ntnic/ntutil/nt_util.h            |   3 +
 3 files changed, 274 insertions(+), 7 deletions(-)
drivers/net/ntnic/include/create_elements.h +51 -0
index 802e6dcbe1..179542d2b2 100644
@@ -6,8 +6,59 @@
 #ifndef __CREATE_ELEMENTS_H__
 #define __CREATE_ELEMENTS_H__
 
+#include "stdint.h"
 
 #include "stream_binary_flow_api.h"
 #include <rte_flow.h>
 
+#define MAX_ELEMENTS 64
+#define MAX_ACTIONS 32
+
+struct cnv_match_s {
+	struct rte_flow_item rte_flow_item[MAX_ELEMENTS];
+};
+
+struct cnv_attr_s {
+	struct cnv_match_s match;
+	struct rte_flow_attr attr;
+	uint16_t forced_vlan_vid;
+	uint16_t caller_id;
+};
+
+struct cnv_action_s {
+	struct rte_flow_action flow_actions[MAX_ACTIONS];
+	struct rte_flow_action_queue queue;
+};
+
+/*
+ * Only needed because it eases the use of statistics through NTAPI
+ * for faster integration into NTAPI version of driver
+ * Therefore, this is only a good idea when running on a temporary NTAPI
+ * The query() functionality must go to flow engine, when moved to Open Source driver
+ */
+
+struct rte_flow {
+	void *flw_hdl;
+	int used;
+
+	uint32_t flow_stat_id;
+
+	uint16_t caller_id;
+};
+
+enum nt_rte_flow_item_type {
+	NT_RTE_FLOW_ITEM_TYPE_END = INT_MIN,
+	NT_RTE_FLOW_ITEM_TYPE_TUNNEL,
+};
+
+extern rte_spinlock_t flow_lock;
+int convert_error(struct rte_flow_error *error, struct rte_flow_error *rte_flow_error);
+int create_attr(struct cnv_attr_s *attribute, const struct rte_flow_attr *attr);
+int create_match_elements(struct cnv_match_s *match, const struct rte_flow_item items[],
+	int max_elem);
+int create_action_elements_inline(struct cnv_action_s *action,
+	const struct rte_flow_action actions[],
+	int max_elem,
+	uint32_t queue_offset);
+
 #endif	/* __CREATE_ELEMENTS_H__ */
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +220 -7

244 lines not on this page · raw message

drivers/net/ntnic/ntutil/nt_util.h +3 -0
index 64947f5fbf..71ecd6c68c 100644
@@ -9,6 +9,9 @@
 #include <stdint.h>
 #include "nt4ga_link.h"
 
+/* Total max VDPA ports */
+#define MAX_VDPA_PORTS 128UL
+
 #ifndef ARRAY_SIZE
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 #endif
Signature · 1 line
2.45.0
#329 lore raw

PATCH v5 4/80 net/ntnic: add internal functions for create/destroy

In reply to Serhii Iliushyk

NT-specific functions for creating/destroying a flow

---
v2
* Change cast to void with __rte_unused

---
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 39 +++++++++++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 66 ++++++++++++++++++-
 drivers/net/ntnic/ntnic_mod_reg.h             | 14 ++++
 3 files changed, 116 insertions(+), 3 deletions(-)
drivers/net/ntnic/nthw/flow_api/flow_api.c +39 -0
index 7716a9fc82..acfcad2064 100644
@@ -117,6 +117,40 @@ static struct flow_nic_dev *get_nic_dev_from_adapter_no(uint8_t adapter_no)
 
 	return ndev;
 }
+/*
+ * Flow API
+ */
+
+static struct flow_handle *flow_create(struct flow_eth_dev *dev __rte_unused,
+	const struct rte_flow_attr *attr __rte_unused,
+	uint16_t forced_vlan_vid __rte_unused,
+	uint16_t caller_id __rte_unused,
+	const struct rte_flow_item item[] __rte_unused,
+	const struct rte_flow_action action[] __rte_unused,
+	struct rte_flow_error *error __rte_unused)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__);
+		return NULL;
+	}
+
+	return NULL;
+}
+
+static int flow_destroy(struct flow_eth_dev *dev __rte_unused,
+	struct flow_handle *flow __rte_unused,	struct rte_flow_error *error __rte_unused)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__);
+		return -1;
+	}
+
+	return -1;
+}
 
 /*
  * Device Management API
@@ -572,6 +606,11 @@ static const struct flow_filter_ops ops = {
 	 * Device Management API
 	 */
 	.flow_get_eth_dev = flow_get_eth_dev,
+	/*
+	 * NT Flow API
+	 */
+	.flow_create = flow_create,
+	.flow_destroy = flow_destroy,
 };
 
 void init_flow_filter(void)
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +63 -3

104 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +14 -0
index 457dc58794..ec8c1612d1 100644
@@ -242,6 +242,20 @@ struct flow_filter_ops {
 		int *rss_target_id,
 		enum flow_eth_dev_profile flow_profile,
 		uint32_t exception_path);
+	/*
+	 * NT Flow API
+	 */
+	struct flow_handle *(*flow_create)(struct flow_eth_dev *dev,
+		const struct rte_flow_attr *attr,
+		uint16_t forced_vlan_vid,
+		uint16_t caller_id,
+		const struct rte_flow_item item[],
+		const struct rte_flow_action action[],
+		struct rte_flow_error *error);
+
+	int (*flow_destroy)(struct flow_eth_dev *dev,
+		struct flow_handle *flow,
+		struct rte_flow_error *error);
 };
 
 void register_dev_flow_ops(const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
#330 lore raw

PATCH v5 5/80 net/ntnic: add minimal NT flow inline profile

In reply to Serhii Iliushyk

The flow profile implements all flow-related operations

---
 drivers/net/ntnic/include/flow_api.h          | 15 +++++
 drivers/net/ntnic/meson.build                 |  1 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 28 +++++++-
 .../profile_inline/flow_api_profile_inline.c  | 65 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.h  | 33 ++++++++++
 drivers/net/ntnic/ntnic_mod_reg.c             | 12 +++-
 drivers/net/ntnic/ntnic_mod_reg.h             | 23 +++++++
 7 files changed, 174 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h
drivers/net/ntnic/include/flow_api.h +15 -0
index c80906ec50..3bdfdd4f94 100644
@@ -74,6 +74,21 @@ struct flow_nic_dev {
 	struct flow_nic_dev *next;
 };
 
+enum flow_nic_err_msg_e {
+	ERR_SUCCESS = 0,
+	ERR_FAILED = 1,
+	ERR_OUTPUT_TOO_MANY = 3,
+	ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM = 12,
+	ERR_MATCH_RESOURCE_EXHAUSTION = 14,
+	ERR_ACTION_UNSUPPORTED = 28,
+	ERR_REMOVE_FLOW_FAILED = 29,
+	ERR_OUTPUT_INVALID = 33,
+	ERR_ACTION_MULTIPLE_PORT_ID_UNSUPPORTED = 40,
+	ERR_MSG_NO_MSG
+};
+
+void flow_nic_set_error(enum flow_nic_err_msg_e msg, struct rte_flow_error *error);
+
 /*
  * Resources
  */
drivers/net/ntnic/meson.build +1 -0
index d272c73c62..f5605e81cb 100644
@@ -47,6 +47,7 @@ sources = files(
         'nthw/core/nthw_sdc.c',
         'nthw/core/nthw_si5340.c',
         'nthw/flow_api/flow_api.c',
+        'nthw/flow_api/profile_inline/flow_api_profile_inline.c',
         'nthw/flow_api/flow_backend/flow_backend.c',
         'nthw/flow_api/flow_filter.c',
         'nthw/flow_api/flow_kcc.c',
drivers/net/ntnic/nthw/flow_api/flow_api.c +26 -2
index acfcad2064..5c5bd147d1 100644
@@ -36,6 +36,29 @@ const char *dbg_res_descr[] = {
 static struct flow_nic_dev *dev_base;
 static pthread_mutex_t base_mtx = PTHREAD_MUTEX_INITIALIZER;
 
+/*
+ * Error handling
+ */
+
+static const struct {
+	const char *message;
+} err_msg[] = {
+	/* 00 */ { "Operation successfully completed" },
+	/* 01 */ { "Operation failed" },
+	/* 29 */ { "Removing flow failed" },
+};
+
+void flow_nic_set_error(enum flow_nic_err_msg_e msg, struct rte_flow_error *error)
+{
+	assert(msg < ERR_MSG_NO_MSG);
+
+	if (error) {
+		error->message = err_msg[msg].message;
+		error->type = (msg == ERR_SUCCESS) ? RTE_FLOW_ERROR_TYPE_NONE :
+			RTE_FLOW_ERROR_TYPE_UNSPECIFIED;
+	}
+}
+
 /*
  * Resources
  */
@@ -136,7 +159,8 @@ static struct flow_handle *flow_create(struct flow_eth_dev *dev __rte_unused,
 		return NULL;
 	}
 
-	return NULL;
+	return profile_inline_ops->flow_create_profile_inline(dev, attr,
+		forced_vlan_vid, caller_id,  item, action, error);
 }
 
 static int flow_destroy(struct flow_eth_dev *dev __rte_unused,
@@ -149,7 +173,7 @@ static int flow_destroy(struct flow_eth_dev *dev __rte_unused,
 		return -1;
 	}
 
-	return -1;
+	return profile_inline_ops->flow_destroy_profile_inline(dev, flow, error);
 }
 
 /*
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c new file +65 -0

65 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h new file +33 -0
new file mode 100644
index 0000000000..a83cc299b4
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_API_PROFILE_INLINE_H_
+#define _FLOW_API_PROFILE_INLINE_H_
+
+#include <stdint.h>
+
+#include "flow_api.h"
+#include "stream_binary_flow_api.h"
+
+/*
+ * Flow functionality
+ */
+int flow_destroy_locked_profile_inline(struct flow_eth_dev *dev,
+	struct flow_handle *fh,
+	struct rte_flow_error *error);
+
+struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev,
+	const struct rte_flow_attr *attr,
+	uint16_t forced_vlan_vid,
+	uint16_t caller_id,
+	const struct rte_flow_item elem[],
+	const struct rte_flow_action action[],
+	struct rte_flow_error *error);
+
+int flow_destroy_profile_inline(struct flow_eth_dev *dev,
+	struct flow_handle *flow,
+	struct rte_flow_error *error);
+
+#endif	/* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/ntnic_mod_reg.c +11 -1
index ad2266116f..593b56bf5b 100644
@@ -118,9 +118,19 @@ const struct flow_backend_ops *get_flow_backend_ops(void)
 	return flow_backend_ops;
 }
 
+static const struct profile_inline_ops *profile_inline_ops;
+
+void register_profile_inline_ops(const struct profile_inline_ops *ops)
+{
+	profile_inline_ops = ops;
+}
+
 const struct profile_inline_ops *get_profile_inline_ops(void)
 {
-	return NULL;
+	if (profile_inline_ops == NULL)
+		profile_inline_init();
+
+	return profile_inline_ops;
 }
 
 static const struct flow_filter_ops *flow_filter_ops;
drivers/net/ntnic/ntnic_mod_reg.h +23 -0
index ec8c1612d1..d133336fad 100644
@@ -225,7 +225,30 @@ void register_flow_backend_ops(const struct flow_backend_ops *ops);
 const struct flow_backend_ops *get_flow_backend_ops(void);
 void flow_backend_init(void);
 
+struct profile_inline_ops {
+	/*
+	 * Flow functionality
+	 */
+	int (*flow_destroy_locked_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_handle *fh,
+		struct rte_flow_error *error);
+
+	struct flow_handle *(*flow_create_profile_inline)(struct flow_eth_dev *dev,
+		const struct rte_flow_attr *attr,
+		uint16_t forced_vlan_vid,
+		uint16_t caller_id,
+		const struct rte_flow_item elem[],
+		const struct rte_flow_action action[],
+		struct rte_flow_error *error);
+
+	int (*flow_destroy_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_handle *flow,
+		struct rte_flow_error *error);
+};
+
+void register_profile_inline_ops(const struct profile_inline_ops *ops);
 const struct profile_inline_ops *get_profile_inline_ops(void);
+void profile_inline_init(void);
 
 struct flow_filter_ops {
 	int (*flow_filter_init)(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device,
Signature · 1 line
2.45.0
#331 lore raw

PATCH v5 6/80 net/ntnic: add management functions for NT flow profile

In reply to Serhii Iliushyk

Management functions implements (re)setting of the NT flow dev.

---
v5
* Remove unnecessaty SCATTER_GATHER definition

---
 drivers/net/ntnic/include/flow_api.h          |  1 +
 drivers/net/ntnic/include/flow_api_engine.h   |  5 ++
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 58 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.c  | 20 +++++++
 .../profile_inline/flow_api_profile_inline.h  |  8 +++
 drivers/net/ntnic/ntnic_mod_reg.h             |  8 +++
 6 files changed, 100 insertions(+)
drivers/net/ntnic/include/flow_api.h +1 -0
index 3bdfdd4f94..790b2f6b03 100644
@@ -55,6 +55,7 @@ struct flow_nic_dev {
 	uint16_t ports; /* number of in-ports addressable on this NIC */
 	/* flow profile this NIC is initially prepared for */
 	enum flow_eth_dev_profile flow_profile;
+	int flow_mgnt_prepared;
 
 	struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */
 	void *km_res_handle;
drivers/net/ntnic/include/flow_api_engine.h +5 -0
index d025677e25..52ff3cb865 100644
@@ -46,6 +46,11 @@ enum res_type_e {
  */
 #define MAX_OUTPUT_DEST (128)
 
+struct flow_handle {
+	struct flow_eth_dev *dev;
+	struct flow_handle *next;
+};
+
 void km_free_ndev_resource_management(void **handle);
 
 void kcc_free_ndev_resource_management(void **handle);
drivers/net/ntnic/nthw/flow_api/flow_api.c +58 -0

86 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +20 -0
index 34e01c5839..0400527197 100644
@@ -8,6 +8,20 @@
 #include "flow_api_profile_inline.h"
 #include "ntnic_mod_reg.h"
 
+/*
+ * Public functions
+ */
+
+int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev __rte_unused)
+{
+	return -1;
+}
+
+int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev __rte_unused)
+{
+	return 0;
+}
+
 struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev __rte_unused,
 	const struct rte_flow_attr *attr __rte_unused,
 	uint16_t forced_vlan_vid __rte_unused,
@@ -51,6 +65,12 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev, struct flow_handle *fl
 }
 
 static const struct profile_inline_ops ops = {
+	/*
+	 * Management
+	 */
+	.done_flow_management_of_ndev_profile_inline = done_flow_management_of_ndev_profile_inline,
+	.initialize_flow_management_of_ndev_profile_inline =
+		initialize_flow_management_of_ndev_profile_inline,
 	/*
 	 * Flow functionality
 	 */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +8 -0
index a83cc299b4..b87f8542ac 100644
@@ -11,6 +11,14 @@
 #include "flow_api.h"
 #include "stream_binary_flow_api.h"
 
+/*
+ * Management
+ */
+
+int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev);
+
+int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev);
+
 /*
  * Flow functionality
  */
drivers/net/ntnic/ntnic_mod_reg.h +8 -0
index d133336fad..149c549112 100644
@@ -226,6 +226,14 @@ const struct flow_backend_ops *get_flow_backend_ops(void);
 void flow_backend_init(void);
 
 struct profile_inline_ops {
+	/*
+	 * Management
+	 */
+
+	int (*done_flow_management_of_ndev_profile_inline)(struct flow_nic_dev *ndev);
+
+	int (*initialize_flow_management_of_ndev_profile_inline)(struct flow_nic_dev *ndev);
+
 	/*
 	 * Flow functionality
 	 */
Signature · 1 line
2.45.0
#332 lore raw

PATCH v5 7/80 net/ntnic: add NT flow profile management implementation

In reply to Serhii Iliushyk

Implements functions required for (re)set NT flow dev

---
 drivers/net/ntnic/include/flow_api.h          |  4 ++
 drivers/net/ntnic/include/flow_api_engine.h   | 10 ++++
 drivers/net/ntnic/meson.build                 |  4 ++
 drivers/net/ntnic/nthw/flow_api/flow_group.c  | 55 +++++++++++++++++
 .../net/ntnic/nthw/flow_api/flow_id_table.c   | 52 ++++++++++++++++
 .../net/ntnic/nthw/flow_api/flow_id_table.h   | 19 ++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 59 +++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    | 23 ++++++++
 .../profile_inline/flow_api_profile_inline.c  | 56 +++++++++++++++++-
 9 files changed, 280 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_group.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_id_table.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_id_table.h
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h
drivers/net/ntnic/include/flow_api.h +4 -0
index 790b2f6b03..748da89262 100644
@@ -61,6 +61,10 @@ struct flow_nic_dev {
 	void *km_res_handle;
 	void *kcc_res_handle;
 
+	void *group_handle;
+	void *hw_db_handle;
+	void *id_table_handle;
+
 	uint32_t flow_unique_id_counter;
 	/* linked list of all flows created on this NIC */
 	struct flow_handle *flow_base;
drivers/net/ntnic/include/flow_api_engine.h +10 -0
index 52ff3cb865..2497c31a08 100644
@@ -6,6 +6,8 @@
 #ifndef _FLOW_API_ENGINE_H_
 #define _FLOW_API_ENGINE_H_
 
+#include <stdint.h>
+
 /*
  * Resource management
  */
@@ -46,6 +48,9 @@ enum res_type_e {
  */
 #define MAX_OUTPUT_DEST (128)
 
+#define MAX_CPY_WRITERS_SUPPORTED 8
+
+
 struct flow_handle {
 	struct flow_eth_dev *dev;
 	struct flow_handle *next;
@@ -55,4 +60,9 @@ void km_free_ndev_resource_management(void **handle);
 
 void kcc_free_ndev_resource_management(void **handle);
 
+/*
+ * Group management
+ */
+int flow_group_handle_create(void **handle, uint32_t group_count);
+int flow_group_handle_destroy(void **handle);
 #endif  /* _FLOW_API_ENGINE_H_ */
drivers/net/ntnic/meson.build +4 -0
index f5605e81cb..f7292144ac 100644
@@ -18,6 +18,7 @@ includes = [
         include_directories('nthw/supported'),
         include_directories('nthw/model'),
         include_directories('nthw/flow_filter'),
+        include_directories('nthw/flow_api'),
         include_directories('nim/'),
 ]
 
@@ -47,7 +48,10 @@ sources = files(
         'nthw/core/nthw_sdc.c',
         'nthw/core/nthw_si5340.c',
         'nthw/flow_api/flow_api.c',
+        'nthw/flow_api/flow_group.c',
+        'nthw/flow_api/flow_id_table.c',
         'nthw/flow_api/profile_inline/flow_api_profile_inline.c',
+        'nthw/flow_api/profile_inline/flow_api_hw_db_inline.c',
         'nthw/flow_api/flow_backend/flow_backend.c',
         'nthw/flow_api/flow_filter.c',
         'nthw/flow_api/flow_kcc.c',
drivers/net/ntnic/nthw/flow_api/flow_group.c new file +55 -0

55 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_id_table.c new file +52 -0

52 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_id_table.h new file +19 -0
new file mode 100644
index 0000000000..13455f1165
@@ -0,0 +1,19 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _FLOW_ID_TABLE_H_
+#define _FLOW_ID_TABLE_H_
+
+#include <stdint.h>
+
+union flm_handles {
+	uint64_t idx;
+	void *p;
+};
+
+void *ntnic_id_table_create(void);
+void ntnic_id_table_destroy(void *id_table);
+
+#endif	/* FLOW_ID_TABLE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c new file +59 -0

59 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h new file +23 -0
new file mode 100644
index 0000000000..23caf73cf3
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_API_HW_DB_INLINE_H_
+#define _FLOW_API_HW_DB_INLINE_H_
+
+#include <stdint.h>
+
+#include "flow_api.h"
+
+struct hw_db_inline_cot_data {
+	uint32_t matcher_color_contrib : 4;
+	uint32_t frag_rcp : 4;
+	uint32_t padding : 24;
+};
+
+/**/
+
+int hw_db_inline_create(struct flow_nic_dev *ndev, void **db_handle);
+void hw_db_inline_destroy(void *db_handle);
+
+#endif	/* _FLOW_API_HW_DB_INLINE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +54 -2

73 lines not on this page · raw message

Signature · 1 line
2.45.0
#333 lore raw

PATCH v5 8/80 net/ntnic: add create/destroy implementation for NT flows

In reply to Serhii Iliushyk

Implements flow create/destroy functions with minimal capabilities item any
action port id

---
 doc/guides/nics/features/ntnic.ini            |   6 +
 doc/guides/nics/ntnic.rst                     |   2 +
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 drivers/net/ntnic/include/flow_api.h          |   3 +
 drivers/net/ntnic/include/flow_api_engine.h   | 105 +++
 .../ntnic/include/stream_binary_flow_api.h    |   4 +
 drivers/net/ntnic/meson.build                 |   2 +
 drivers/net/ntnic/nthw/flow_api/flow_group.c  |  44 ++
 .../net/ntnic/nthw/flow_api/flow_id_table.c   |  79 +++
 .../net/ntnic/nthw/flow_api/flow_id_table.h   |   4 +
 .../flow_api/profile_inline/flm_lrn_queue.c   |  28 +
 .../flow_api/profile_inline/flm_lrn_queue.h   |  14 +
 .../profile_inline/flow_api_hw_db_inline.c    |  93 +++
 .../profile_inline/flow_api_hw_db_inline.h    |  64 ++
 .../profile_inline/flow_api_profile_inline.c  | 657 ++++++++++++++++++
 15 files changed, 1106 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h
doc/guides/nics/features/ntnic.ini +6 -0
index 8b9b87bdfe..1c653fd5a0 100644
@@ -12,3 +12,9 @@ Unicast MAC filter   = Y
 Multicast MAC filter = Y
 Linux                = Y
 x86-64               = Y
+
+[rte_flow items]
+any                  = Y
+
+[rte_flow actions]
+port_id              = Y
doc/guides/nics/ntnic.rst +2 -0
index 2c160ae592..a6568cba4e 100644
@@ -40,6 +40,8 @@ Features
 - Unicast MAC filter
 - Multicast MAC filter
 - Promiscuous mode (Enable only. The device always run promiscuous mode)
+- Flow API support.
+- Support for multiple rte_flow groups.
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index 15b64a1829..a235ce59d1 100644
@@ -161,6 +161,7 @@ New Features
   * Added NT flow backend initialization.
   * Added initialization of FPGA modules related to flow HW offload.
   * Added basic handling of the virtual queues.
+  * Added flow handling support
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/include/flow_api.h +3 -0
index 748da89262..667dad6d5f 100644
@@ -68,6 +68,9 @@ struct flow_nic_dev {
 	uint32_t flow_unique_id_counter;
 	/* linked list of all flows created on this NIC */
 	struct flow_handle *flow_base;
+	/* linked list of all FLM flows created on this NIC */
+	struct flow_handle *flow_base_flm;
+	pthread_mutex_t flow_mtx;
 
 	/* NIC backend API */
 	struct flow_api_backend_s be;
drivers/net/ntnic/include/flow_api_engine.h +105 -0

125 lines not on this page · raw message

drivers/net/ntnic/include/stream_binary_flow_api.h +4 -0
index a6244d4082..d878b848c2 100644
@@ -8,6 +8,10 @@
 
 #include "rte_flow.h"
 #include "rte_flow_driver.h"
+
+/* Max RSS hash key length in bytes */
+#define MAX_RSS_KEY_LEN 40
+
 /*
  * Flow frontend for binary programming interface
  */
drivers/net/ntnic/meson.build +2 -0
index f7292144ac..e1fef37ccb 100644
@@ -50,6 +50,8 @@ sources = files(
         'nthw/flow_api/flow_api.c',
         'nthw/flow_api/flow_group.c',
         'nthw/flow_api/flow_id_table.c',
+        'nthw/flow_api/hw_mod/hw_mod_backend.c',
+        'nthw/flow_api/profile_inline/flm_lrn_queue.c',
         'nthw/flow_api/profile_inline/flow_api_profile_inline.c',
         'nthw/flow_api/profile_inline/flow_api_hw_db_inline.c',
         'nthw/flow_api/flow_backend/flow_backend.c',
drivers/net/ntnic/nthw/flow_api/flow_group.c +44 -0

47 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_id_table.c +79 -0

100 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_id_table.h +4 -0
index 13455f1165..e190fe4a11 100644
@@ -16,4 +16,8 @@ union flm_handles {
 void *ntnic_id_table_create(void);
 void ntnic_id_table_destroy(void *id_table);
 
+uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t caller_id,
+	uint8_t type);
+void ntnic_id_table_free_id(void *id_table, uint32_t id);
+
 #endif	/* FLOW_ID_TABLE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c new file +28 -0
new file mode 100644
index 0000000000..ad7efafe08
@@ -0,0 +1,28 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#include <assert.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include <rte_ring.h>
+
+#include "hw_mod_flm_v25.h"
+
+#include "flm_lrn_queue.h"
+
+#define ELEM_SIZE sizeof(struct flm_v25_lrn_data_s)
+
+uint32_t *flm_lrn_queue_get_write_buffer(void *q)
+{
+	struct rte_ring_zc_data zcd;
+	unsigned int n = rte_ring_enqueue_zc_burst_elem_start(q, ELEM_SIZE, 1, &zcd, NULL);
+	return (n == 0) ? NULL : zcd.ptr1;
+}
+
+void flm_lrn_queue_release_write_buffer(void *q)
+{
+	rte_ring_enqueue_zc_elem_finish(q, 1);
+}
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h new file +14 -0
new file mode 100644
index 0000000000..8cee0c8e78
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _FLM_LRN_QUEUE_H_
+#define _FLM_LRN_QUEUE_H_
+
+#include <stdint.h>
+
+uint32_t *flm_lrn_queue_get_write_buffer(void *q);
+void flm_lrn_queue_release_write_buffer(void *q);
+
+#endif	/* _FLM_LRN_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +93 -0

103 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +64 -0

79 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +657 -0

681 lines not on this page · raw message

Signature · 1 line
2.45.0
#334 lore raw

PATCH v5 9/80 net/ntnic: add infrastructure for for flow actions and items

In reply to Serhii Iliushyk

Add etities(utilities, structures, etc) required for flow support

---
v2
* Change cast to void with __rte_unused

---
 drivers/net/ntnic/include/flow_api.h          | 34 ++++++++
 drivers/net/ntnic/include/flow_api_engine.h   | 46 +++++++++++
 drivers/net/ntnic/include/hw_mod_backend.h    | 44 ++++++++++
 drivers/net/ntnic/nthw/flow_api/flow_km.c     | 81 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.c  | 68 +++++++++++++++-
 5 files changed, 269 insertions(+), 4 deletions(-)
drivers/net/ntnic/include/flow_api.h +34 -0
index 667dad6d5f..7f031ccda8 100644
@@ -85,13 +85,47 @@ struct flow_nic_dev {
 enum flow_nic_err_msg_e {
 	ERR_SUCCESS = 0,
 	ERR_FAILED = 1,
+	ERR_MEMORY = 2,
 	ERR_OUTPUT_TOO_MANY = 3,
+	ERR_RSS_TOO_MANY_QUEUES = 4,
+	ERR_VLAN_TYPE_NOT_SUPPORTED = 5,
+	ERR_VXLAN_HEADER_NOT_ACCEPTED = 6,
+	ERR_VXLAN_POP_INVALID_RECIRC_PORT = 7,
+	ERR_VXLAN_POP_FAILED_CREATING_VTEP = 8,
+	ERR_MATCH_VLAN_TOO_MANY = 9,
+	ERR_MATCH_INVALID_IPV6_HDR = 10,
+	ERR_MATCH_TOO_MANY_TUNNEL_PORTS = 11,
 	ERR_MATCH_INVALID_OR_UNSUPPORTED_ELEM = 12,
+	ERR_MATCH_FAILED_BY_HW_LIMITS = 13,
 	ERR_MATCH_RESOURCE_EXHAUSTION = 14,
+	ERR_MATCH_FAILED_TOO_COMPLEX = 15,
+	ERR_ACTION_REPLICATION_FAILED = 16,
+	ERR_ACTION_OUTPUT_RESOURCE_EXHAUSTION = 17,
+	ERR_ACTION_TUNNEL_HEADER_PUSH_OUTPUT_LIMIT = 18,
+	ERR_ACTION_INLINE_MOD_RESOURCE_EXHAUSTION = 19,
+	ERR_ACTION_RETRANSMIT_RESOURCE_EXHAUSTION = 20,
+	ERR_ACTION_FLOW_COUNTER_EXHAUSTION = 21,
+	ERR_ACTION_INTERNAL_RESOURCE_EXHAUSTION = 22,
+	ERR_INTERNAL_QSL_COMPARE_FAILED = 23,
+	ERR_INTERNAL_CAT_FUNC_REUSE_FAILED = 24,
+	ERR_MATCH_ENTROPHY_FAILED = 25,
+	ERR_MATCH_CAM_EXHAUSTED = 26,
+	ERR_INTERNAL_VIRTUAL_PORT_CREATION_FAILED = 27,
 	ERR_ACTION_UNSUPPORTED = 28,
 	ERR_REMOVE_FLOW_FAILED = 29,
+	ERR_ACTION_NO_OUTPUT_DEFINED_USE_DEFAULT = 30,
+	ERR_ACTION_NO_OUTPUT_QUEUE_FOUND = 31,
+	ERR_MATCH_UNSUPPORTED_ETHER_TYPE = 32,
 	ERR_OUTPUT_INVALID = 33,
+	ERR_MATCH_PARTIAL_OFFLOAD_NOT_SUPPORTED = 34,
+	ERR_MATCH_CAT_CAM_EXHAUSTED = 35,
+	ERR_MATCH_KCC_KEY_CLASH = 36,
+	ERR_MATCH_CAT_CAM_FAILED = 37,
+	ERR_PARTIAL_FLOW_MARK_TOO_BIG = 38,
+	ERR_FLOW_PRIORITY_VALUE_INVALID = 39,
 	ERR_ACTION_MULTIPLE_PORT_ID_UNSUPPORTED = 40,
+	ERR_RSS_TOO_LONG_KEY = 41,
+	ERR_ACTION_AGE_UNSUPPORTED_GROUP_0 = 42,
 	ERR_MSG_NO_MSG
 };
 
drivers/net/ntnic/include/flow_api_engine.h +46 -0

64 lines not on this page · raw message

drivers/net/ntnic/include/hw_mod_backend.h +44 -0

56 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_km.c +81 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +64 -4

80 lines not on this page · raw message

Signature · 1 line
2.45.0
#335 lore raw

PATCH v5 10/80 net/ntnic: add action queue

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ACTION_TYPE_QUEUE.

---
 doc/guides/nics/features/ntnic.ini            |  1 +
 doc/guides/nics/ntnic.rst                     |  4 ++
 doc/guides/rel_notes/release_24_11.rst        |  1 +
 .../profile_inline/flow_api_profile_inline.c  | 37 +++++++++++++++++++
 4 files changed, 43 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 1c653fd5a0..5b3c26da05 100644
@@ -18,3 +18,4 @@ any                  = Y
 
 [rte_flow actions]
 port_id              = Y
+queue                = Y
doc/guides/nics/ntnic.rst +4 -0
index a6568cba4e..d43706b2ee 100644
@@ -42,6 +42,10 @@ Features
 - Promiscuous mode (Enable only. The device always run promiscuous mode)
 - Flow API support.
 - Support for multiple rte_flow groups.
+- Multiple TX and RX queues.
+- Scattered and gather for TX and RX.
+- Jumbo frame support.
+- Traffic mirroring.
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index a235ce59d1..2cace179b3 100644
@@ -162,6 +162,7 @@ New Features
   * Added initialization of FPGA modules related to flow HW offload.
   * Added basic handling of the virtual queues.
   * Added flow handling support
+  * Enable virtual queues
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +37 -0
index 1b6a01a7d4..f4d4c25176 100644
@@ -23,6 +23,15 @@
 
 static void *flm_lrn_queue_arr;
 
+static int rx_queue_idx_to_hw_id(const struct flow_eth_dev *dev, int id)
+{
+	for (int i = 0; i < dev->num_queues; ++i)
+		if (dev->rx_queue[i].id == id)
+			return dev->rx_queue[i].hw_id;
+
+	return -1;
+}
+
 struct flm_flow_key_def_s {
 	union {
 		struct {
@@ -349,6 +358,34 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_QUEUE:
+			NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_QUEUE", dev);
+
+			if (action[aidx].conf) {
+				struct rte_flow_action_queue queue_tmp;
+				const struct rte_flow_action_queue *queue =
+					memcpy_mask_if(&queue_tmp, action[aidx].conf,
+					action_mask ? action_mask[aidx].conf : NULL,
+					sizeof(struct rte_flow_action_queue));
+
+				int hw_id = rx_queue_idx_to_hw_id(dev, queue->index);
+
+				fd->dst_id[fd->dst_num_avail].owning_port_id = dev->port;
+				fd->dst_id[fd->dst_num_avail].id = hw_id;
+				fd->dst_id[fd->dst_num_avail].type = PORT_VIRT;
+				fd->dst_id[fd->dst_num_avail].active = 1;
+				fd->dst_num_avail++;
+
+				NT_LOG(DBG, FILTER,
+					"Dev:%p: RTE_FLOW_ACTION_TYPE_QUEUE port %u, queue index: %u, hw id %u",
+					dev, dev->port, queue->index, hw_id);
+
+				fd->full_offload = 0;
+				*num_queues += 1;
+			}
+
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow action received - %i",
 				action[aidx].type);
Signature · 1 line
2.45.0
#336 lore raw

PATCH v5 11/80 net/ntnic: add action mark

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ACTION_TYPE_MARK.

---
 doc/guides/nics/features/ntnic.ini               |  1 +
 .../profile_inline/flow_api_profile_inline.c     | 16 ++++++++++++++++
 2 files changed, 17 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 5b3c26da05..42ac9f9c31 100644
@@ -17,5 +17,6 @@ x86-64               = Y
 any                  = Y
 
 [rte_flow actions]
+mark                 = Y
 port_id              = Y
 queue                = Y
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +16 -0
index f4d4c25176..e8b31dbdd2 100644
@@ -386,6 +386,22 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_MARK:
+			NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_MARK", dev);
+
+			if (action[aidx].conf) {
+				struct rte_flow_action_mark mark_tmp;
+				const struct rte_flow_action_mark *mark =
+					memcpy_mask_if(&mark_tmp, action[aidx].conf,
+					action_mask ? action_mask[aidx].conf : NULL,
+					sizeof(struct rte_flow_action_mark));
+
+				fd->mark = mark->id;
+				NT_LOG(DBG, FILTER, "Mark: %i", mark->id);
+			}
+
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow action received - %i",
 				action[aidx].type);
Signature · 1 line
2.45.0
#337 lore raw

PATCH v5 12/80 net/ntnic: add ation jump

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ACTION_TYPE_JUMP.

---
 doc/guides/nics/features/ntnic.ini              |  1 +
 .../profile_inline/flow_api_profile_inline.c    | 17 +++++++++++++++++
 2 files changed, 18 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 42ac9f9c31..f3334fc86d 100644
@@ -17,6 +17,7 @@ x86-64               = Y
 any                  = Y
 
 [rte_flow actions]
+jump                 = Y
 mark                 = Y
 port_id              = Y
 queue                = Y
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +17 -0
index e8b31dbdd2..9dfa211095 100644
@@ -402,6 +402,23 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_JUMP:
+			NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_JUMP", dev);
+
+			if (action[aidx].conf) {
+				struct rte_flow_action_jump jump_tmp;
+				const struct rte_flow_action_jump *jump =
+					memcpy_mask_if(&jump_tmp, action[aidx].conf,
+					action_mask ? action_mask[aidx].conf : NULL,
+					sizeof(struct rte_flow_action_jump));
+
+				fd->jump_to_group = jump->group;
+				NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_JUMP: group %u",
+					dev, jump->group);
+			}
+
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow action received - %i",
 				action[aidx].type);
Signature · 1 line
2.45.0
#338 lore raw

PATCH v5 13/80 net/ntnic: add action drop

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ACTION_TYPE_DROP.

---
 doc/guides/nics/features/ntnic.ini                   |  1 +
 .../profile_inline/flow_api_profile_inline.c         | 12 ++++++++++++
 2 files changed, 13 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index f3334fc86d..372653695d 100644
@@ -17,6 +17,7 @@ x86-64               = Y
 any                  = Y
 
 [rte_flow actions]
+drop                 = Y
 jump                 = Y
 mark                 = Y
 port_id              = Y
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +12 -0
index 9dfa211095..1d949b3b91 100644
@@ -419,6 +419,18 @@ static int interpret_flow_actions(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ACTION_TYPE_DROP:
+			NT_LOG(DBG, FILTER, "Dev:%p: RTE_FLOW_ACTION_TYPE_DROP", dev);
+
+			if (action[aidx].conf) {
+				fd->dst_id[fd->dst_num_avail].owning_port_id = 0;
+				fd->dst_id[fd->dst_num_avail].id = 0;
+				fd->dst_id[fd->dst_num_avail].type = PORT_NONE;
+				fd->dst_num_avail++;
+			}
+
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow action received - %i",
 				action[aidx].type);
Signature · 1 line
2.45.0
#339 lore raw

PATCH v5 14/80 net/ntnic: add item eth

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ITEM_TYPE_ETH.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  12 ++
 .../profile_inline/flow_api_profile_inline.c  | 177 ++++++++++++++++++
 3 files changed, 190 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 372653695d..36b8212bae 100644
@@ -15,6 +15,7 @@ x86-64               = Y
 
 [rte_flow items]
 any                  = Y
+eth                  = Y
 
 [rte_flow actions]
 drop                 = Y
drivers/net/ntnic/include/hw_mod_backend.h +12 -0
index 22430bb3db..0c22129fb4 100644
@@ -120,6 +120,18 @@ enum {
 		}                                                                                 \
 	} while (0)
 
+static inline int is_non_zero(const void *addr, size_t n)
+{
+	size_t i = 0;
+	const uint8_t *p = (const uint8_t *)addr;
+
+	for (i = 0; i < n; i++)
+		if (p[i] != 0)
+			return 1;
+
+	return 0;
+}
+
 enum frame_offs_e {
 	DYN_L2 = 1,
 	DYN_L3 = 4,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +177 -0

201 lines not on this page · raw message

Signature · 1 line
2.45.0
#340 lore raw

PATCH v5 15/80 net/ntnic: add item IPv4

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ITEM_TYPE_IPV4.

---
v5
* Remove redundant 'break'.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 163 ++++++++++++++++++
 2 files changed, 164 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 36b8212bae..bae25d2e2d 100644
@@ -16,6 +16,7 @@ x86-64               = Y
 [rte_flow items]
 any                  = Y
 eth                  = Y
+ipv4                 = Y
 
 [rte_flow actions]
 drop                 = Y
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +163 -0

169 lines not on this page · raw message

Signature · 1 line
2.45.0
#341 lore raw

PATCH v5 16/80 net/ntnic: add item ICMP

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ITEM_TYPE_ICMP.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 101 ++++++++++++++++++
 2 files changed, 102 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index bae25d2e2d..d403ea01f3 100644
@@ -16,6 +16,7 @@ x86-64               = Y
 [rte_flow items]
 any                  = Y
 eth                  = Y
+icmp                 = Y
 ipv4                 = Y
 
 [rte_flow actions]
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +101 -0

107 lines not on this page · raw message

Signature · 1 line
2.45.0
#342 lore raw

PATCH v5 17/80 net/ntnic: add item port ID

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ITEM_TYPE_PORT_ID.

---
 doc/guides/nics/features/ntnic.ini                    |  1 +
 .../flow_api/profile_inline/flow_api_profile_inline.c | 11 +++++++++++
 2 files changed, 12 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index d403ea01f3..cdf119c4ae 100644
@@ -18,6 +18,7 @@ any                  = Y
 eth                  = Y
 icmp                 = Y
 ipv4                 = Y
+port_id              = Y
 
 [rte_flow actions]
 drop                 = Y
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +11 -0
index 88665dbf15..4fc5afcdaa 100644
@@ -928,6 +928,17 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_PORT_ID:
+			NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_PORT_ID",
+				dev->ndev->adapter_no, dev->port);
+
+			if (elem[eidx].spec) {
+				*in_port_id =
+					((const struct rte_flow_item_port_id *)elem[eidx].spec)->id;
+			}
+
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow request: %d",
 				(int)elem[eidx].type);
Signature · 1 line
2.45.0
#343 lore raw

PATCH v5 18/80 net/ntnic: add item void

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ITEM_TYPE_VOID.

---
 .../nthw/flow_api/profile_inline/flow_api_profile_inline.c   | 5 +++++
 1 file changed, 5 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +5 -0
index 4fc5afcdaa..29fe0c4b2f 100644
@@ -939,6 +939,11 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,
 
 			break;
 
+		case RTE_FLOW_ITEM_TYPE_VOID:
+			NT_LOG(DBG, FILTER, "Adap %i, Port %i: RTE_FLOW_ITEM_TYPE_VOID",
+				dev->ndev->adapter_no, dev->port);
+			break;
+
 		default:
 			NT_LOG(ERR, FILTER, "Invalid or unsupported flow request: %d",
 				(int)elem[eidx].type);
Signature · 1 line
2.45.0
#344 lore raw

PATCH v5 19/80 net/ntnic: add item UDP

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use RTE_FLOW_ITEM_TYPE_UDP.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 drivers/net/ntnic/include/hw_mod_backend.h    |   2 +
 .../profile_inline/flow_api_profile_inline.c  | 103 ++++++++++++++++++
 3 files changed, 106 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index cdf119c4ae..61a3d87909 100644
@@ -19,6 +19,7 @@ eth                  = Y
 icmp                 = Y
 ipv4                 = Y
 port_id              = Y
+udp                  = Y
 
 [rte_flow actions]
 drop                 = Y
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
index 0c22129fb4..a95fb69870 100644
@@ -166,6 +166,7 @@ enum {
 };
 
 enum {
+	PROT_L4_UDP = 2,
 	PROT_L4_ICMP = 4
 };
 
@@ -176,6 +177,7 @@ enum {
 
 enum {
 	PROT_TUN_L4_OTHER = 0,
+	PROT_TUN_L4_UDP = 2,
 	PROT_TUN_L4_ICMP = 4
 };
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +103 -0

121 lines not on this page · raw message

Signature · 1 line
2.45.0
#345 lore raw

PATCH v5 20/80 net/ntnic: add action TCP

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use RTE_FLOW_ITEM_TYPE_TCP.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 drivers/net/ntnic/include/hw_mod_backend.h    |   2 +
 .../profile_inline/flow_api_profile_inline.c  | 108 ++++++++++++++++++
 3 files changed, 111 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 61a3d87909..e3c3982895 100644
@@ -19,6 +19,7 @@ eth                  = Y
 icmp                 = Y
 ipv4                 = Y
 port_id              = Y
+tcp                  = Y
 udp                  = Y
 
 [rte_flow actions]
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
index a95fb69870..a1aa74caf5 100644
@@ -166,6 +166,7 @@ enum {
 };
 
 enum {
+	PROT_L4_TCP = 1,
 	PROT_L4_UDP = 2,
 	PROT_L4_ICMP = 4
 };
@@ -177,6 +178,7 @@ enum {
 
 enum {
 	PROT_TUN_L4_OTHER = 0,
+	PROT_TUN_L4_TCP = 1,
 	PROT_TUN_L4_UDP = 2,
 	PROT_TUN_L4_ICMP = 4
 };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +108 -0

126 lines not on this page · raw message

Signature · 1 line
2.45.0
#346 lore raw

PATCH v5 21/80 net/ntnic: add action VLAN

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use RTE_FLOW_ITEM_TYPE_VLAN.

---
 doc/guides/nics/features/ntnic.ini            |  1 +
 doc/guides/nics/ntnic.rst                     |  1 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  1 +
 .../profile_inline/flow_api_profile_inline.c  | 95 +++++++++++++++++++
 4 files changed, 98 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index e3c3982895..8b4821d6d0 100644
@@ -21,6 +21,7 @@ ipv4                 = Y
 port_id              = Y
 tcp                  = Y
 udp                  = Y
+vlan                 = Y
 
 [rte_flow actions]
 drop                 = Y
doc/guides/nics/ntnic.rst +1 -0
index d43706b2ee..f2ce941fe9 100644
@@ -46,6 +46,7 @@ Features
 - Scattered and gather for TX and RX.
 - Jumbo frame support.
 - Traffic mirroring.
+- VLAN filtering.
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/hw_mod_backend.h +1 -0
index a1aa74caf5..82ac3d0ff3 100644
@@ -134,6 +134,7 @@ static inline int is_non_zero(const void *addr, size_t n)
 
 enum frame_offs_e {
 	DYN_L2 = 1,
+	DYN_FIRST_VLAN = 2,
 	DYN_L3 = 4,
 	DYN_L4 = 7,
 	DYN_L4_PAYLOAD = 8,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +95 -0

107 lines not on this page · raw message

Signature · 1 line
2.45.0
#347 lore raw

PATCH v5 22/80 net/ntnic: add item SCTP

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use RTE_FLOW_ITEM_TYPE_SCTP.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 drivers/net/ntnic/include/hw_mod_backend.h    |   2 +
 .../profile_inline/flow_api_profile_inline.c  | 102 ++++++++++++++++++
 3 files changed, 105 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 8b4821d6d0..6691b6dce2 100644
@@ -19,6 +19,7 @@ eth                  = Y
 icmp                 = Y
 ipv4                 = Y
 port_id              = Y
+sctp                 = Y
 tcp                  = Y
 udp                  = Y
 vlan                 = Y
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
index 82ac3d0ff3..f1c57fa9fc 100644
@@ -169,6 +169,7 @@ enum {
 enum {
 	PROT_L4_TCP = 1,
 	PROT_L4_UDP = 2,
+	PROT_L4_SCTP = 3,
 	PROT_L4_ICMP = 4
 };
 
@@ -181,6 +182,7 @@ enum {
 	PROT_TUN_L4_OTHER = 0,
 	PROT_TUN_L4_TCP = 1,
 	PROT_TUN_L4_UDP = 2,
+	PROT_TUN_L4_SCTP = 3,
 	PROT_TUN_L4_ICMP = 4
 };
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +102 -0

120 lines not on this page · raw message

Signature · 1 line
2.45.0
#348 lore raw

PATCH v5 23/80 net/ntnic: add items IPv6 and ICMPv6

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use
* RTE_FLOW_ITEM_TYPE_IPV6
* RTE_FLOW_ITEM_TYPE_ICMP6

---
 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(+)
doc/guides/nics/features/ntnic.ini +2 -0
index 6691b6dce2..320d3c7e0b 100644
@@ -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
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
index f1c57fa9fc..4f381bc0ef 100644
@@ -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 {
drivers/net/ntnic/nthw/flow_api/flow_api.c +27 -0
index a9016238d0..4bd68c572b 100644
@@ -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" },
 };
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +272 -0

290 lines not on this page · raw message

Signature · 1 line
2.45.0
#349 lore raw

PATCH v5 24/80 net/ntnic: add action modify filed

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use RTE_FLOW_ACTION_TYPE_MODIFY_FIELD.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 doc/guides/nics/ntnic.rst                     |   1 +
 drivers/net/ntnic/include/flow_api_engine.h   |   7 +
 drivers/net/ntnic/include/hw_mod_backend.h    |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 181 ++++++++++++++++++
 5 files changed, 191 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index 320d3c7e0b..4201c8e8b9 100644
@@ -30,5 +30,6 @@ vlan                 = Y
 drop                 = Y
 jump                 = Y
 mark                 = Y
+modify_field         = Y
 port_id              = Y
 queue                = Y
doc/guides/nics/ntnic.rst +1 -0
index f2ce941fe9..63ad4d95f5 100644
@@ -47,6 +47,7 @@ Features
 - Jumbo frame support.
 - Traffic mirroring.
 - VLAN filtering.
+- Packet modification: NAT, TTL decrement, DSCP tagging
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/flow_api_engine.h +7 -0
index 13fad2760a..f6557d0d20 100644
@@ -129,6 +129,10 @@ struct nic_flow_def {
 	 */
 	struct {
 		uint32_t select;
+		uint32_t dyn;
+		uint32_t ofs;
+		uint32_t len;
+		uint32_t level;
 		union {
 			uint8_t value8[16];
 			uint16_t value16[8];
@@ -137,6 +141,9 @@ struct nic_flow_def {
 	} modify_field[MAX_CPY_WRITERS_SUPPORTED];
 
 	uint32_t modify_field_count;
+	uint8_t ttl_sub_enable;
+	uint8_t ttl_sub_ipv4;
+	uint8_t ttl_sub_outer;
 
 	/*
 	 * Key Matcher flow definitions
drivers/net/ntnic/include/hw_mod_backend.h +1 -0
index 4f381bc0ef..6a8a38636f 100644
@@ -140,6 +140,7 @@ enum frame_offs_e {
 	DYN_L4_PAYLOAD = 8,
 	DYN_TUN_L3 = 13,
 	DYN_TUN_L4 = 16,
+	DYN_TUN_L4_PAYLOAD = 17,
 };
 
 /* Sideband info bit indicator */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +181 -0

193 lines not on this page · raw message

Signature · 1 line
2.45.0
#350 lore raw

PATCH v5 25/80 net/ntnic: add items gtp and actions raw encap/decap

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add possibility to use
* RTE_FLOW_ITEM_TYPE_GTP
* RTE_FLOW_ITEM_TYPE_GTP_PSC
* RTE_FLOW_ACTION_TYPE_RAW_ENCAP
* RTE_FLOW_ACTION_TYPE_RAW_DECAP

---
 doc/guides/nics/features/ntnic.ini            |   4 +
 doc/guides/nics/ntnic.rst                     |   4 +
 drivers/net/ntnic/include/create_elements.h   |   4 +
 drivers/net/ntnic/include/flow_api_engine.h   |  40 ++
 drivers/net/ntnic/include/hw_mod_backend.h    |   4 +
 .../ntnic/include/stream_binary_flow_api.h    |  22 ++
 .../profile_inline/flow_api_profile_inline.c  | 366 +++++++++++++++++-
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 291 +++++++++++++-
 8 files changed, 730 insertions(+), 5 deletions(-)
doc/guides/nics/features/ntnic.ini +4 -0
index 4201c8e8b9..4cb9509742 100644
@@ -16,6 +16,8 @@ x86-64               = Y
 [rte_flow items]
 any                  = Y
 eth                  = Y
+gtp                  = Y
+gtp_psc              = Y
 icmp                 = Y
 icmp6                = Y
 ipv4                 = Y
@@ -33,3 +35,5 @@ mark                 = Y
 modify_field         = Y
 port_id              = Y
 queue                = Y
+raw_decap            = Y
+raw_encap            = Y
doc/guides/nics/ntnic.rst +4 -0
index 63ad4d95f5..cd7d315456 100644
@@ -48,6 +48,10 @@ Features
 - Traffic mirroring.
 - VLAN filtering.
 - Packet modification: NAT, TTL decrement, DSCP tagging
+- Tunnel types: GTP.
+- Encapsulation and decapsulation of GTP data.
+- RX VLAN stripping via raw decap.
+- TX VLAN insertion via raw encap.
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/create_elements.h +4 -0
index 179542d2b2..70e6cad195 100644
@@ -27,6 +27,8 @@ struct cnv_attr_s {
 
 struct cnv_action_s {
 	struct rte_flow_action flow_actions[MAX_ACTIONS];
+	struct flow_action_raw_encap encap;
+	struct flow_action_raw_decap decap;
 	struct rte_flow_action_queue queue;
 };
 
@@ -52,6 +54,8 @@ enum nt_rte_flow_item_type {
 };
 
 extern rte_spinlock_t flow_lock;
+
+int interpret_raw_data(uint8_t *data, uint8_t *preserve, int size, struct rte_flow_item *out);
 int convert_error(struct rte_flow_error *error, struct rte_flow_error *rte_flow_error);
 int create_attr(struct cnv_attr_s *attribute, const struct rte_flow_attr *attr);
 int create_match_elements(struct cnv_match_s *match, const struct rte_flow_item items[],
drivers/net/ntnic/include/flow_api_engine.h +40 -0
index f6557d0d20..b1d39b919b 100644
@@ -56,6 +56,29 @@ enum res_type_e {
 
 #define MAX_MATCH_FIELDS 16
 
+/*
+ * Tunnel encapsulation header definition
+ */
+#define MAX_TUN_HDR_SIZE 128
+struct tunnel_header_s {
+	union {
+		uint8_t hdr8[MAX_TUN_HDR_SIZE];
+		uint32_t hdr32[(MAX_TUN_HDR_SIZE + 3) / 4];
+	} d;
+	uint32_t user_port_id;
+	uint8_t len;
+
+	uint8_t nb_vlans;
+
+	uint8_t ip_version;	/* 4: v4, 6: v6 */
+	uint16_t ip_csum_precalc;
+
+	uint8_t new_outer;
+	uint8_t l2_len;
+	uint8_t l3_len;
+	uint8_t l4_len;
+};
+
 struct match_elem_s {
 	int masked_for_tcam;	/* if potentially selected for TCAM */
 	uint32_t e_word[4];
@@ -124,6 +147,23 @@ struct nic_flow_def {
 
 	int full_offload;
 
+	/*
+	 * Action push tunnel
+	 */
+	struct tunnel_header_s tun_hdr;
+
+	/*
+	 * If DPDK RTE tunnel helper API used
+	 * this holds the tunnel if used in flow
+	 */
+	struct tunnel_s *tnl;
+
+	/*
+	 * Header Stripper
+	 */
+	int header_strip_end_dyn;
+	int header_strip_end_ofs;
+
 	/*
 	 * Modify field
 	 */
drivers/net/ntnic/include/hw_mod_backend.h +4 -0
index 6a8a38636f..1b45ea4296 100644
@@ -175,6 +175,10 @@ enum {
 	PROT_L4_ICMP = 4
 };
 
+enum {
+	PROT_TUN_GTPV1U = 6,
+};
+
 enum {
 	PROT_TUN_L3_OTHER = 0,
 	PROT_TUN_L3_IPV4 = 1,
drivers/net/ntnic/include/stream_binary_flow_api.h +22 -0
index d878b848c2..8097518d61 100644
@@ -18,6 +18,7 @@
 
 #define FLOW_MAX_QUEUES 128
 
+#define RAW_ENCAP_DECAP_ELEMS_MAX 16
 /*
  * Flow eth dev profile determines how the FPGA module resources are
  * managed and what features are available
@@ -31,6 +32,27 @@ struct flow_queue_id_s {
 	int hw_id;
 };
 
+/*
+ * RTE_FLOW_ACTION_TYPE_RAW_ENCAP
+ */
+struct flow_action_raw_encap {
+	uint8_t *data;
+	uint8_t *preserve;
+	size_t size;
+	struct rte_flow_item items[RAW_ENCAP_DECAP_ELEMS_MAX];
+	int item_count;
+};
+
+/*
+ * RTE_FLOW_ACTION_TYPE_RAW_DECAP
+ */
+struct flow_action_raw_decap {
+	uint8_t *data;
+	size_t size;
+	struct rte_flow_item items[RAW_ENCAP_DECAP_ELEMS_MAX];
+	int item_count;
+};
+
 struct flow_eth_dev;             /* port device */
 struct flow_handle;
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +365 -1

384 lines not on this page · raw message

drivers/net/ntnic/ntnic_filter/ntnic_filter.c +287 -4

306 lines not on this page · raw message

Signature · 1 line
2.45.0
#351 lore raw

PATCH v5 26/80 net/ntnic: add cat module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Categorizer module’s main purpose is to is select the behavior of other modules in the FPGA pipeline depending on a protocol check.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |  24 ++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c   | 267 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 165 +++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  47 +++
 .../profile_inline/flow_api_profile_inline.c  |  83 ++++++
 5 files changed, 586 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +24 -0
index 1b45ea4296..87fc16ecb4 100644
@@ -315,11 +315,35 @@ int hw_mod_cat_reset(struct flow_api_backend_s *be);
 int hw_mod_cat_cfn_flush(struct flow_api_backend_s *be, int start_idx, int count);
 int hw_mod_cat_cfn_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index, int word_off,
 	uint32_t value);
+/* KCE/KCS/FTE KM */
+int hw_mod_cat_fte_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+	int start_idx, int count);
+int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_fte_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t *value);
+/* KCE/KCS/FTE FLM */
+int hw_mod_cat_fte_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+	int start_idx, int count);
+int hw_mod_cat_fte_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_fte_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t *value);
 
 int hw_mod_cat_cte_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_cat_cte_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+	uint32_t value);
+
 int hw_mod_cat_cts_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_cat_cts_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+	uint32_t value);
+
 int hw_mod_cat_cot_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_cat_cot_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+	uint32_t value);
+
 int hw_mod_cat_cct_flush(struct flow_api_backend_s *be, int start_idx, int count);
+
 int hw_mod_cat_kcc_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
 int hw_mod_cat_exo_flush(struct flow_api_backend_s *be, int start_idx, int count);
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c +267 -0

291 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +165 -0

198 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +47 -0

69 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +83 -0

107 lines not on this page · raw message

Signature · 1 line
2.45.0
#352 lore raw

PATCH v5 27/80 net/ntnic: add SLC LR module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Slicer for Local Retransmit module can cut of the head a packet before the packet leaves the FPGA RX pipeline.
This is used when the TX pipeline is configured
to add a new head in the packet.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |   2 +
 .../nthw/flow_api/hw_mod/hw_mod_slc_lr.c      | 100 +++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 104 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  19 ++++
 .../profile_inline/flow_api_profile_inline.c  |  37 ++++++-
 5 files changed, 257 insertions(+), 5 deletions(-)
drivers/net/ntnic/include/hw_mod_backend.h +2 -0
index 87fc16ecb4..2711f44083 100644
@@ -697,6 +697,8 @@ int hw_mod_slc_lr_alloc(struct flow_api_backend_s *be);
 void hw_mod_slc_lr_free(struct flow_api_backend_s *be);
 int hw_mod_slc_lr_reset(struct flow_api_backend_s *be);
 int hw_mod_slc_lr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_slc_lr_rcp_set(struct flow_api_backend_s *be, enum hw_slc_lr_e field, uint32_t index,
+	uint32_t value);
 
 struct pdb_func_s {
 	COMMON_FUNC_INFO_S;
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_slc_lr.c +100 -0

103 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +104 -0

135 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +19 -0
index 38502ac1ec..ef63336b1c 100644
@@ -40,10 +40,15 @@ struct hw_db_cat_idx {
 	HW_DB_IDX;
 };
 
+struct hw_db_slc_lr_idx {
+	HW_DB_IDX;
+};
+
 enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_NONE = 0,
 	HW_DB_IDX_TYPE_COT,
 	HW_DB_IDX_TYPE_CAT,
+	HW_DB_IDX_TYPE_SLC_LR,
 };
 
 /* Functionality data types */
@@ -89,6 +94,13 @@ struct hw_db_inline_cot_data {
 	uint32_t padding : 24;
 };
 
+struct hw_db_inline_slc_lr_data {
+	uint32_t head_slice_en : 1;
+	uint32_t head_slice_dyn : 5;
+	uint32_t head_slice_ofs : 8;
+	uint32_t padding : 18;
+};
+
 struct hw_db_inline_hsh_data {
 	uint32_t func;
 	uint64_t hash_mask;
@@ -119,6 +131,13 @@ struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_ha
 void hw_db_inline_cot_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_cot_idx idx);
 void hw_db_inline_cot_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_cot_idx idx);
 
+struct hw_db_slc_lr_idx hw_db_inline_slc_lr_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_slc_lr_data *data);
+void hw_db_inline_slc_lr_ref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_slc_lr_idx idx);
+void hw_db_inline_slc_lr_deref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_slc_lr_idx idx);
+
 /**/
 
 struct hw_db_cat_idx hw_db_inline_cat_add(struct flow_nic_dev *ndev, void *db_handle,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +32 -5
index 3cfeee2c25..4a5bcc04cf 100644
@@ -2276,18 +2276,38 @@ static int convert_fh_to_fh_flm(struct flow_handle *fh, const uint32_t *packet_d
 	return 0;
 }
 
-static int setup_flow_flm_actions(struct flow_eth_dev *dev __rte_unused,
-	const struct nic_flow_def *fd __rte_unused,
+static int setup_flow_flm_actions(struct flow_eth_dev *dev,
+	const struct nic_flow_def *fd,
 	const struct hw_db_inline_qsl_data *qsl_data __rte_unused,
 	const struct hw_db_inline_hsh_data *hsh_data __rte_unused,
 	uint32_t group __rte_unused,
-	uint32_t local_idxs[] __rte_unused,
-	uint32_t *local_idx_counter __rte_unused,
+	uint32_t local_idxs[],
+	uint32_t *local_idx_counter,
 	uint16_t *flm_rpl_ext_ptr __rte_unused,
 	uint32_t *flm_ft __rte_unused,
 	uint32_t *flm_scrub __rte_unused,
-	struct rte_flow_error *error __rte_unused)
+	struct rte_flow_error *error)
 {
+	/* Setup SLC LR */
+	struct hw_db_slc_lr_idx slc_lr_idx = { .raw = 0 };
+
+	if (fd->header_strip_end_dyn != 0 || fd->header_strip_end_ofs != 0) {
+		struct hw_db_inline_slc_lr_data slc_lr_data = {
+			.head_slice_en = 1,
+			.head_slice_dyn = fd->header_strip_end_dyn,
+			.head_slice_ofs = fd->header_strip_end_ofs,
+		};
+		slc_lr_idx =
+			hw_db_inline_slc_lr_add(dev->ndev, dev->ndev->hw_db_handle, &slc_lr_data);
+		local_idxs[(*local_idx_counter)++] = slc_lr_idx.raw;
+
+		if (slc_lr_idx.error) {
+			NT_LOG(ERR, FILTER, "Could not reference SLC LR resource");
+			flow_nic_set_error(ERR_MATCH_RESOURCE_EXHAUSTION, error);
+			return -1;
+		}
+	}
+
 	return 0;
 }
 
@@ -2449,6 +2469,9 @@ int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
 		if (hw_mod_cat_cot_flush(&ndev->be, 0, 1) < 0)
 			goto err_exit0;
 
+		/* SLC LR index 0 is reserved */
+		flow_nic_mark_resource_used(ndev, RES_SLC_LR_RCP, 0);
+
 		/* Setup filter using matching all packets violating traffic policing parameters */
 		flow_nic_mark_resource_used(ndev, RES_CAT_CFN, NT_VIOLATING_MBR_CFN);
 
@@ -2497,6 +2520,10 @@ int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
 		hw_mod_cat_cot_flush(&ndev->be, 0, 1);
 		flow_nic_free_resource(ndev, RES_CAT_CFN, 0);
 
+		hw_mod_slc_lr_rcp_set(&ndev->be, HW_SLC_LR_RCP_PRESET_ALL, 0, 0);
+		hw_mod_slc_lr_rcp_flush(&ndev->be, 0, 1);
+		flow_nic_free_resource(ndev, RES_SLC_LR_RCP, 0);
+
 		hw_mod_tpe_reset(&ndev->be);
 		flow_nic_free_resource(ndev, RES_TPE_RCP, 0);
 		flow_nic_free_resource(ndev, RES_TPE_EXT, 0);
Signature · 1 line
2.45.0
#353 lore raw

PATCH v5 28/80 net/ntnic: add PDB module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Packet Description Builder module creates packet meta-data for example virtio-net headers.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |   3 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c   | 144 ++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.c  |  17 +++
 3 files changed, 164 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +3 -0
index 2711f44083..7f1449d8ee 100644
@@ -740,6 +740,9 @@ int hw_mod_pdb_alloc(struct flow_api_backend_s *be);
 void hw_mod_pdb_free(struct flow_api_backend_s *be);
 int hw_mod_pdb_reset(struct flow_api_backend_s *be);
 int hw_mod_pdb_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_pdb_rcp_set(struct flow_api_backend_s *be, enum hw_pdb_e field, uint32_t index,
+	uint32_t value);
+
 int hw_mod_pdb_config_flush(struct flow_api_backend_s *be);
 
 struct tpe_func_s {
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c +144 -0

150 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +17 -0
index 4a5bcc04cf..7033674270 100644
@@ -2472,6 +2472,19 @@ int initialize_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
 		/* SLC LR index 0 is reserved */
 		flow_nic_mark_resource_used(ndev, RES_SLC_LR_RCP, 0);
 
+		/* PDB setup Direct Virtio Scatter-Gather descriptor of 12 bytes for its recipe 0
+		 */
+		if (hw_mod_pdb_rcp_set(&ndev->be, HW_PDB_RCP_DESCRIPTOR, 0, 7) < 0)
+			goto err_exit0;
+
+		if (hw_mod_pdb_rcp_set(&ndev->be, HW_PDB_RCP_DESC_LEN, 0, 6) < 0)
+			goto err_exit0;
+
+		if (hw_mod_pdb_rcp_flush(&ndev->be, 0, 1) < 0)
+			goto err_exit0;
+
+		flow_nic_mark_resource_used(ndev, RES_PDB_RCP, 0);
+
 		/* Setup filter using matching all packets violating traffic policing parameters */
 		flow_nic_mark_resource_used(ndev, RES_CAT_CFN, NT_VIOLATING_MBR_CFN);
 
@@ -2529,6 +2542,10 @@ int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
 		flow_nic_free_resource(ndev, RES_TPE_EXT, 0);
 		flow_nic_free_resource(ndev, RES_TPE_RPL, 0);
 
+		hw_mod_pdb_rcp_set(&ndev->be, HW_PDB_RCP_PRESET_ALL, 0, 0);
+		hw_mod_pdb_rcp_flush(&ndev->be, 0, 1);
+		flow_nic_free_resource(ndev, RES_PDB_RCP, 0);
+
 		hw_db_inline_destroy(ndev->hw_db_handle);
 
 #ifdef FLOW_DEBUG
Signature · 1 line
2.45.0
#354 lore raw

PATCH v5 29/80 net/ntnic: add QSL module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Queue Selector module directs packets to a given destination which includes host queues, physical ports, exceptions paths, and discard.

---
 drivers/net/ntnic/include/flow_api.h          |   3 +
 drivers/net/ntnic/include/hw_mod_backend.h    |   8 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  65 ++++++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c   | 218 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 195 ++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  11 +
 .../profile_inline/flow_api_profile_inline.c  |  96 +++++++-
 7 files changed, 595 insertions(+), 1 deletion(-)
drivers/net/ntnic/include/flow_api.h +3 -0
index 7f031ccda8..edffd0a57a 100644
@@ -184,8 +184,11 @@ extern const char *dbg_res_descr[];
 int flow_nic_alloc_resource(struct flow_nic_dev *ndev, enum res_type_e res_type,
 	uint32_t alignment);
 
+int flow_nic_alloc_resource_config(struct flow_nic_dev *ndev, enum res_type_e res_type,
+	unsigned int num, uint32_t alignment);
 void flow_nic_free_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int idx);
 
+int flow_nic_ref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index);
 int flow_nic_deref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index);
 
 #endif
drivers/net/ntnic/include/hw_mod_backend.h +8 -0
index 7f1449d8ee..6fa2a3d94f 100644
@@ -666,8 +666,16 @@ int hw_mod_qsl_alloc(struct flow_api_backend_s *be);
 void hw_mod_qsl_free(struct flow_api_backend_s *be);
 int hw_mod_qsl_reset(struct flow_api_backend_s *be);
 int hw_mod_qsl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_qsl_rcp_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index,
+	uint32_t value);
 int hw_mod_qsl_qst_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_qsl_qst_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index,
+	uint32_t value);
 int hw_mod_qsl_qen_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_qsl_qen_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index,
+	uint32_t value);
+int hw_mod_qsl_qen_get(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index,
+	uint32_t *value);
 int hw_mod_qsl_unmq_flush(struct flow_api_backend_s *be, int start_idx, int count);
 int hw_mod_qsl_unmq_set(struct flow_api_backend_s *be, enum hw_qsl_e field, uint32_t index,
 	uint32_t value);
drivers/net/ntnic/nthw/flow_api/flow_api.c +65 -0

88 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c +218 -0

236 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +195 -0

237 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +11 -0
index ef63336b1c..d0435acaef 100644
@@ -36,6 +36,10 @@ struct hw_db_cot_idx {
 	HW_DB_IDX;
 };
 
+struct hw_db_qsl_idx {
+	HW_DB_IDX;
+};
+
 struct hw_db_cat_idx {
 	HW_DB_IDX;
 };
@@ -48,6 +52,7 @@ enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_NONE = 0,
 	HW_DB_IDX_TYPE_COT,
 	HW_DB_IDX_TYPE_CAT,
+	HW_DB_IDX_TYPE_QSL,
 	HW_DB_IDX_TYPE_SLC_LR,
 };
 
@@ -113,6 +118,7 @@ struct hw_db_inline_action_set_data {
 		int jump;
 		struct {
 			struct hw_db_cot_idx cot;
+			struct hw_db_qsl_idx qsl;
 		};
 	};
 };
@@ -131,6 +137,11 @@ struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_ha
 void hw_db_inline_cot_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_cot_idx idx);
 void hw_db_inline_cot_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_cot_idx idx);
 
+struct hw_db_qsl_idx hw_db_inline_qsl_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_qsl_data *data);
+void hw_db_inline_qsl_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_qsl_idx idx);
+void hw_db_inline_qsl_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_qsl_idx idx);
+
 struct hw_db_slc_lr_idx hw_db_inline_slc_lr_add(struct flow_nic_dev *ndev, void *db_handle,
 	const struct hw_db_inline_slc_lr_data *data);
 void hw_db_inline_slc_lr_ref(struct flow_nic_dev *ndev, void *db_handle,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +95 -1

140 lines not on this page · raw message

Signature · 1 line
2.45.0
#355 lore raw

PATCH v5 30/80 net/ntnic: add KM module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Key Matcher module checks the values of individual fields of a packet. It supports both exact match which is implemented with a CAM, and wildcards which is implemented with a TCAM.

---
 doc/guides/nics/ntnic.rst                     |    2 +
 drivers/net/ntnic/include/flow_api_engine.h   |  110 +-
 drivers/net/ntnic/include/hw_mod_backend.h    |   64 +-
 drivers/net/ntnic/nthw/flow_api/flow_km.c     | 1065 +++++++++++++++++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_km.c    |  380 ++++++
 .../profile_inline/flow_api_hw_db_inline.c    |  234 ++++
 .../profile_inline/flow_api_hw_db_inline.h    |   38 +
 .../profile_inline/flow_api_profile_inline.c  |  162 +++
 8 files changed, 2026 insertions(+), 29 deletions(-)
doc/guides/nics/ntnic.rst +2 -0
index cd7d315456..ed306e05b5 100644
@@ -52,6 +52,8 @@ Features
 - Encapsulation and decapsulation of GTP data.
 - RX VLAN stripping via raw decap.
 - TX VLAN insertion via raw encap.
+- CAM and TCAM based matching.
+- Exact match of 140 million flows and policies.
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/flow_api_engine.h +91 -19

152 lines not on this page · raw message

drivers/net/ntnic/include/hw_mod_backend.h +54 -10

95 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_km.c +1065 -0

1,082 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_km.c +380 -0

404 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +234 -0

268 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +38 -0
index d0435acaef..e104ba7327 100644
@@ -32,6 +32,10 @@ struct hw_db_idx {
 	HW_DB_IDX;
 };
 
+struct hw_db_action_set_idx {
+	HW_DB_IDX;
+};
+
 struct hw_db_cot_idx {
 	HW_DB_IDX;
 };
@@ -48,12 +52,22 @@ struct hw_db_slc_lr_idx {
 	HW_DB_IDX;
 };
 
+struct hw_db_km_idx {
+	HW_DB_IDX;
+};
+
+struct hw_db_km_ft {
+	HW_DB_IDX;
+};
+
 enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_NONE = 0,
 	HW_DB_IDX_TYPE_COT,
 	HW_DB_IDX_TYPE_CAT,
 	HW_DB_IDX_TYPE_QSL,
 	HW_DB_IDX_TYPE_SLC_LR,
+	HW_DB_IDX_TYPE_KM_RCP,
+	HW_DB_IDX_TYPE_KM_FT,
 };
 
 /* Functionality data types */
@@ -123,6 +137,16 @@ struct hw_db_inline_action_set_data {
 	};
 };
 
+struct hw_db_inline_km_rcp_data {
+	uint32_t rcp;
+};
+
+struct hw_db_inline_km_ft_data {
+	struct hw_db_cat_idx cat;
+	struct hw_db_km_idx km;
+	struct hw_db_action_set_idx action_set;
+};
+
 /**/
 
 int hw_db_inline_create(struct flow_nic_dev *ndev, void **db_handle);
@@ -130,6 +154,8 @@ void hw_db_inline_destroy(void *db_handle);
 
 void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_idx *idxs,
 	uint32_t size);
+const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
+	enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size);
 
 /**/
 struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_handle,
@@ -158,6 +184,18 @@ void hw_db_inline_cat_deref(struct flow_nic_dev *ndev, void *db_handle, struct h
 
 /**/
 
+struct hw_db_km_idx hw_db_inline_km_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_km_rcp_data *data);
+void hw_db_inline_km_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_km_idx idx);
+void hw_db_inline_km_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_km_idx idx);
+
+struct hw_db_km_ft hw_db_inline_km_ft_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_km_ft_data *data);
+void hw_db_inline_km_ft_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_km_ft idx);
+void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_km_ft idx);
+
+/**/
+
 int hw_db_inline_setup_mbr_filter(struct flow_nic_dev *ndev, uint32_t cat_hw_id, uint32_t ft,
 	uint32_t qsl_hw_id);
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +162 -0

186 lines not on this page · raw message

Signature · 1 line
2.45.0
#356 lore raw

PATCH v5 31/80 net/ntnic: add hash API

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Hasher module calculates a configurable hash value to be used internally by the FPGA.
The module support both Toeplitz and NT-hash.

---
 doc/guides/nics/ntnic.rst                     |   2 +
 drivers/net/ntnic/include/flow_api.h          |  40 +
 drivers/net/ntnic/include/flow_api_engine.h   |  17 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  20 +
 .../ntnic/include/stream_binary_flow_api.h    |  25 +
 drivers/net/ntnic/meson.build                 |   1 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 212 +++++
 drivers/net/ntnic/nthw/flow_api/flow_hasher.c | 156 ++++
 drivers/net/ntnic/nthw/flow_api/flow_hasher.h |  21 +
 drivers/net/ntnic/nthw/flow_api/flow_km.c     |  25 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c   | 179 ++++
 .../profile_inline/flow_api_hw_db_inline.c    | 142 +++
 .../profile_inline/flow_api_hw_db_inline.h    |  11 +
 .../profile_inline/flow_api_profile_inline.c  | 846 +++++++++++++++++-
 .../profile_inline/flow_api_profile_inline.h  |   4 +
 drivers/net/ntnic/ntnic_mod_reg.h             |   4 +
 16 files changed, 1704 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.h
doc/guides/nics/ntnic.rst +2 -0
index ed306e05b5..f2cb7a362a 100644
@@ -54,6 +54,8 @@ Features
 - TX VLAN insertion via raw encap.
 - CAM and TCAM based matching.
 - Exact match of 140 million flows and policies.
+- Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum
+   verification.
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/flow_api.h +40 -0
index edffd0a57a..2e96fa5bed 100644
@@ -29,6 +29,37 @@ struct hw_mod_resource_s {
  */
 int flow_delete_eth_dev(struct flow_eth_dev *eth_dev);
 
+/**
+ * A structure used to configure the Receive Side Scaling (RSS) feature
+ * of an Ethernet port.
+ */
+struct nt_eth_rss_conf {
+	/**
+	 * In rte_eth_dev_rss_hash_conf_get(), the *rss_key_len* should be
+	 * greater than or equal to the *hash_key_size* which get from
+	 * rte_eth_dev_info_get() API. And the *rss_key* should contain at least
+	 * *hash_key_size* bytes. If not meet these requirements, the query
+	 * result is unreliable even if the operation returns success.
+	 *
+	 * In rte_eth_dev_rss_hash_update() or rte_eth_dev_configure(), if
+	 * *rss_key* is not NULL, the *rss_key_len* indicates the length of the
+	 * *rss_key* in bytes and it should be equal to *hash_key_size*.
+	 * If *rss_key* is NULL, drivers are free to use a random or a default key.
+	 */
+	uint8_t rss_key[MAX_RSS_KEY_LEN];
+	/**
+	 * Indicates the type of packets or the specific part of packets to
+	 * which RSS hashing is to be applied.
+	 */
+	uint64_t rss_hf;
+	/**
+	 * Hash algorithm.
+	 */
+	enum rte_eth_hash_function algorithm;
+};
+
+int sprint_nt_rss_mask(char *str, uint16_t str_len, const char *prefix, uint64_t hash_mask);
+
 struct flow_eth_dev {
 	/* NIC that owns this port device */
 	struct flow_nic_dev *ndev;
@@ -49,6 +80,11 @@ struct flow_eth_dev {
 	struct flow_eth_dev *next;
 };
 
+enum flow_nic_hash_e {
+	HASH_ALGO_ROUND_ROBIN = 0,
+	HASH_ALGO_5TUPLE,
+};
+
 /* registered NIC backends */
 struct flow_nic_dev {
 	uint8_t adapter_no;     /* physical adapter no in the host system */
@@ -191,4 +227,8 @@ void flow_nic_free_resource(struct flow_nic_dev *ndev, enum res_type_e res_type,
 int flow_nic_ref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index);
 int flow_nic_deref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index);
 
+int flow_nic_set_hasher(struct flow_nic_dev *ndev, int hsh_idx, enum flow_nic_hash_e algorithm);
+int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,
+	struct nt_eth_rss_conf rss_conf);
+
 #endif
drivers/net/ntnic/include/flow_api_engine.h +17 -0
index a0f02f4e8a..e52363f04e 100644
@@ -129,6 +129,7 @@ struct km_flow_def_s {
 	int bank_used;
 	uint32_t *cuckoo_moves;	/* for CAM statistics only */
 	struct cam_distrib_s *cam_dist;
+	struct hasher_s *hsh;
 
 	/* TCAM specific bank management */
 	struct tcam_distrib_s *tcam_dist;
@@ -136,6 +137,17 @@ struct km_flow_def_s {
 	int tcam_record;
 };
 
+/*
+ * RSS configuration, see struct rte_flow_action_rss
+ */
+struct hsh_def_s {
+	enum rte_eth_hash_function func;	/* RSS hash function to apply */
+	/* RSS hash types, see definition of RTE_ETH_RSS_* for hash calculation options */
+	uint64_t types;
+	uint32_t key_len;	/* Hash key length in bytes. */
+	const uint8_t *key;	/* Hash key. */
+};
+
 /*
  * Tunnel encapsulation header definition
  */
@@ -247,6 +259,11 @@ struct nic_flow_def {
 	 * Key Matcher flow definitions
 	 */
 	struct km_flow_def_s km;
+
+	/*
+	 * Hash module RSS definitions
+	 */
+	struct hsh_def_s hsh;
 };
 
 enum flow_handle_type {
drivers/net/ntnic/include/hw_mod_backend.h +20 -0
index 26903f2183..cee148807a 100644
@@ -149,14 +149,27 @@ enum km_flm_if_select_e {
 	int debug
 
 enum frame_offs_e {
+	DYN_SOF = 0,
 	DYN_L2 = 1,
 	DYN_FIRST_VLAN = 2,
+	DYN_MPLS = 3,
 	DYN_L3 = 4,
+	DYN_ID_IPV4_6 = 5,
+	DYN_FINAL_IP_DST = 6,
 	DYN_L4 = 7,
 	DYN_L4_PAYLOAD = 8,
+	DYN_TUN_PAYLOAD = 9,
+	DYN_TUN_L2 = 10,
+	DYN_TUN_VLAN = 11,
+	DYN_TUN_MPLS = 12,
 	DYN_TUN_L3 = 13,
+	DYN_TUN_ID_IPV4_6 = 14,
+	DYN_TUN_FINAL_IP_DST = 15,
 	DYN_TUN_L4 = 16,
 	DYN_TUN_L4_PAYLOAD = 17,
+	DYN_EOF = 18,
+	DYN_L3_PAYLOAD_END = 19,
+	DYN_TUN_L3_PAYLOAD_END = 20,
 	SB_VNI = SWX_INFO | 1,
 	SB_MAC_PORT = SWX_INFO | 2,
 	SB_KCC_ID = SWX_INFO | 3
@@ -227,6 +240,11 @@ enum {
 };
 
 
+enum {
+	HASH_HASH_NONE = 0,
+	HASH_5TUPLE = 8,
+};
+
 enum {
 	CPY_SELECT_DSCP_IPV4 = 0,
 	CPY_SELECT_DSCP_IPV6 = 1,
@@ -670,6 +688,8 @@ int hw_mod_hsh_alloc(struct flow_api_backend_s *be);
 void hw_mod_hsh_free(struct flow_api_backend_s *be);
 int hw_mod_hsh_reset(struct flow_api_backend_s *be);
 int hw_mod_hsh_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_hsh_rcp_set(struct flow_api_backend_s *be, enum hw_hsh_e field, uint32_t index,
+	uint32_t word_off, uint32_t value);
 
 struct qsl_func_s {
 	COMMON_FUNC_INFO_S;
drivers/net/ntnic/include/stream_binary_flow_api.h +25 -0
index 8097518d61..e5fe686d99 100644
@@ -12,6 +12,31 @@
 /* Max RSS hash key length in bytes */
 #define MAX_RSS_KEY_LEN 40
 
+/* NT specific MASKs for RSS configuration */
+/* NOTE: Masks are required for correct RSS configuration, do not modify them! */
+#define NT_ETH_RSS_IPV4_MASK                                                                      \
+	(RTE_ETH_RSS_IPV4 | RTE_ETH_RSS_FRAG_IPV4 | RTE_ETH_RSS_NONFRAG_IPV4_OTHER |              \
+	 RTE_ETH_RSS_NONFRAG_IPV4_SCTP | RTE_ETH_RSS_NONFRAG_IPV4_TCP |                           \
+	 RTE_ETH_RSS_NONFRAG_IPV4_UDP)
+
+#define NT_ETH_RSS_IPV6_MASK                                                                      \
+	(RTE_ETH_RSS_IPV6 | RTE_ETH_RSS_FRAG_IPV6 | RTE_ETH_RSS_IPV6_EX |                         \
+	 RTE_ETH_RSS_IPV6_TCP_EX | RTE_ETH_RSS_IPV6_UDP_EX | RTE_ETH_RSS_NONFRAG_IPV6_OTHER |     \
+	 RTE_ETH_RSS_NONFRAG_IPV6_SCTP | RTE_ETH_RSS_NONFRAG_IPV6_TCP |                           \
+	 RTE_ETH_RSS_NONFRAG_IPV6_UDP)
+
+#define NT_ETH_RSS_IP_MASK                                                                        \
+	(NT_ETH_RSS_IPV4_MASK | NT_ETH_RSS_IPV6_MASK | RTE_ETH_RSS_L3_SRC_ONLY |                  \
+	 RTE_ETH_RSS_L3_DST_ONLY)
+
+/* List of all RSS flags supported for RSS calculation offload */
+#define NT_ETH_RSS_OFFLOAD_MASK                                                                   \
+	(RTE_ETH_RSS_ETH | RTE_ETH_RSS_L2_PAYLOAD | RTE_ETH_RSS_IP | RTE_ETH_RSS_TCP |            \
+	 RTE_ETH_RSS_UDP | RTE_ETH_RSS_SCTP | RTE_ETH_RSS_L2_SRC_ONLY | RTE_ETH_RSS_L2_DST_ONLY | \
+	 RTE_ETH_RSS_L4_SRC_ONLY | RTE_ETH_RSS_L4_DST_ONLY | RTE_ETH_RSS_L3_SRC_ONLY |            \
+	 RTE_ETH_RSS_L3_DST_ONLY | RTE_ETH_RSS_VLAN | RTE_ETH_RSS_LEVEL_MASK |                    \
+	 RTE_ETH_RSS_IPV4_CHKSUM | RTE_ETH_RSS_L4_CHKSUM | RTE_ETH_RSS_PORT | RTE_ETH_RSS_GTPU)
+
 /*
  * Flow frontend for binary programming interface
  */
drivers/net/ntnic/meson.build +1 -0
index e1fef37ccb..d7e6d05556 100644
@@ -56,6 +56,7 @@ sources = files(
         'nthw/flow_api/profile_inline/flow_api_hw_db_inline.c',
         'nthw/flow_api/flow_backend/flow_backend.c',
         'nthw/flow_api/flow_filter.c',
+        'nthw/flow_api/flow_hasher.c',
         'nthw/flow_api/flow_kcc.c',
         'nthw/flow_api/flow_km.c',
         'nthw/flow_api/hw_mod/hw_mod_backend.c',
drivers/net/ntnic/nthw/flow_api/flow_api.c +212 -0

230 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_hasher.c new file +156 -0

156 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_hasher.h new file +21 -0
new file mode 100644
index 0000000000..15de8e9933
@@ -0,0 +1,21 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _FLOW_HASHER_H_
+#define _FLOW_HASHER_H_
+
+#include <stdint.h>
+
+struct hasher_s {
+	int banks;
+	int cam_records_bw;
+	uint32_t cam_records_bw_mask;
+	int cam_bw;
+};
+
+int init_hasher(struct hasher_s *hsh, int _banks, int nb_records);
+uint32_t gethash(struct hasher_s *hsh, const uint32_t key[16], int *result);
+
+#endif	/* _FLOW_HASHER_H_ */
drivers/net/ntnic/nthw/flow_api/flow_km.c +25 -0
index 30d6ea728e..f79919cb81 100644
@@ -9,6 +9,7 @@
 #include "hw_mod_backend.h"
 #include "flow_api_engine.h"
 #include "nt_util.h"
+#include "flow_hasher.h"
 
 #define MAX_QWORDS 2
 #define MAX_SWORDS 2
@@ -75,10 +76,25 @@ static int tcam_find_mapping(struct km_flow_def_s *km);
 
 void km_attach_ndev_resource_management(struct km_flow_def_s *km, void **handle)
 {
+	/*
+	 * KM entries occupied in CAM - to manage the cuckoo shuffling
+	 * and manage CAM population and usage
+	 * KM entries occupied in TCAM - to manage population and usage
+	 */
+	if (!*handle) {
+		*handle = calloc(1,
+			(size_t)CAM_ENTRIES + sizeof(uint32_t) + (size_t)TCAM_ENTRIES +
+			sizeof(struct hasher_s));
+		NT_LOG(DBG, FILTER, "Allocate NIC DEV CAM and TCAM record manager");
+	}
+
 	km->cam_dist = (struct cam_distrib_s *)*handle;
 	km->cuckoo_moves = (uint32_t *)((char *)km->cam_dist + CAM_ENTRIES);
 	km->tcam_dist =
 		(struct tcam_distrib_s *)((char *)km->cam_dist + CAM_ENTRIES + sizeof(uint32_t));
+
+	km->hsh = (struct hasher_s *)((char *)km->tcam_dist + TCAM_ENTRIES);
+	init_hasher(km->hsh, km->be->km.nb_cam_banks, km->be->km.nb_cam_records);
 }
 
 void km_free_ndev_resource_management(void **handle)
@@ -839,9 +855,18 @@ static int move_cuckoo_index_level(struct km_flow_def_s *km_parent, int bank_idx
 static int km_write_data_to_cam(struct km_flow_def_s *km)
 {
 	int res = 0;
+	int val[MAX_BANKS];
 	assert(km->be->km.nb_cam_banks <= MAX_BANKS);
 	assert(km->cam_dist);
 
+	/* word list without info set */
+	gethash(km->hsh, km->entry_word, val);
+
+	for (uint32_t i = 0; i < km->be->km.nb_cam_banks; i++) {
+		/* if paired we start always on an even address - reset bit 0 */
+		km->record_indexes[i] = (km->cam_paired) ? val[i] & ~1 : val[i];
+	}
+
 	NT_LOG(DBG, FILTER, "KM HASH [%03X, %03X, %03X]", km->record_indexes[0],
 		km->record_indexes[1], km->record_indexes[2]);
 
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c +179 -0

182 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +142 -0

184 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +11 -0
index e104ba7327..c97bdef1b7 100644
@@ -60,6 +60,10 @@ struct hw_db_km_ft {
 	HW_DB_IDX;
 };
 
+struct hw_db_hsh_idx {
+	HW_DB_IDX;
+};
+
 enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_NONE = 0,
 	HW_DB_IDX_TYPE_COT,
@@ -68,6 +72,7 @@ enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_SLC_LR,
 	HW_DB_IDX_TYPE_KM_RCP,
 	HW_DB_IDX_TYPE_KM_FT,
+	HW_DB_IDX_TYPE_HSH,
 };
 
 /* Functionality data types */
@@ -133,6 +138,7 @@ struct hw_db_inline_action_set_data {
 		struct {
 			struct hw_db_cot_idx cot;
 			struct hw_db_qsl_idx qsl;
+			struct hw_db_hsh_idx hsh;
 		};
 	};
 };
@@ -175,6 +181,11 @@ void hw_db_inline_slc_lr_ref(struct flow_nic_dev *ndev, void *db_handle,
 void hw_db_inline_slc_lr_deref(struct flow_nic_dev *ndev, void *db_handle,
 	struct hw_db_slc_lr_idx idx);
 
+struct hw_db_hsh_idx hw_db_inline_hsh_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_hsh_data *data);
+void hw_db_inline_hsh_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_hsh_idx idx);
+void hw_db_inline_hsh_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_hsh_idx idx);
+
 /**/
 
 struct hw_db_cat_idx hw_db_inline_cat_add(struct flow_nic_dev *ndev, void *db_handle,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +845 -1

909 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +4 -0
index b87f8542ac..e623bb2352 100644
@@ -38,4 +38,8 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev,
 	struct flow_handle *flow,
 	struct rte_flow_error *error);
 
+int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,
+	int hsh_idx,
+	struct nt_eth_rss_conf rss_conf);
+
 #endif	/* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/ntnic_mod_reg.h +4 -0
index 149c549112..1069be2f85 100644
@@ -252,6 +252,10 @@ struct profile_inline_ops {
 	int (*flow_destroy_profile_inline)(struct flow_eth_dev *dev,
 		struct flow_handle *flow,
 		struct rte_flow_error *error);
+
+	int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,
+		int hsh_idx,
+		struct nt_eth_rss_conf rss_conf);
 };
 
 void register_profile_inline_ops(const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
#357 lore raw

PATCH v5 32/80 net/ntnic: add TPE module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The TX Packet Editor is a software abstraction module, that keeps track of the handful of FPGA modules that are used to edit packets in the TX pipeline.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |  16 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c   | 757 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 373 +++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  70 ++
 .../profile_inline/flow_api_profile_inline.c  | 127 ++-
 5 files changed, 1342 insertions(+), 1 deletion(-)
drivers/net/ntnic/include/hw_mod_backend.h +16 -0
index cee148807a..e16dcd478f 100644
@@ -889,24 +889,40 @@ void hw_mod_tpe_free(struct flow_api_backend_s *be);
 int hw_mod_tpe_reset(struct flow_api_backend_s *be);
 
 int hw_mod_tpe_rpp_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_rpp_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 int hw_mod_tpe_rpp_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
 int hw_mod_tpe_ifr_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
 int hw_mod_tpe_ins_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_ins_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 int hw_mod_tpe_rpl_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_rpl_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 int hw_mod_tpe_rpl_ext_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_rpl_ext_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 int hw_mod_tpe_rpl_rpl_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_rpl_rpl_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t *value);
 
 int hw_mod_tpe_cpy_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_cpy_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 int hw_mod_tpe_hfu_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_hfu_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 int hw_mod_tpe_csu_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_tpe_csu_rcp_set(struct flow_api_backend_s *be, enum hw_tpe_e field, int index,
+	uint32_t value);
 
 enum debug_mode_e {
 	FLOW_BACKEND_DEBUG_MODE_NONE = 0x0000,
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c +757 -0

802 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +373 -0

415 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +70 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +126 -1

158 lines not on this page · raw message

Signature · 1 line
2.45.0
#358 lore raw

PATCH v5 33/80 net/ntnic: add FLM module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |  42 +++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c   | 190 +++++++++++++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c   | 257 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 234 ++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  33 +++
 .../profile_inline/flow_api_profile_inline.c  | 224 ++++++++++++++-
 .../flow_api_profile_inline_config.h          |  58 ++++
 drivers/net/ntnic/ntutil/nt_util.h            |   8 +
 8 files changed, 1042 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h
drivers/net/ntnic/include/hw_mod_backend.h +42 -0
index e16dcd478f..de662c4ed1 100644
@@ -367,6 +367,18 @@ int hw_mod_cat_cfn_flush(struct flow_api_backend_s *be, int start_idx, int count
 int hw_mod_cat_cfn_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index, int word_off,
 	uint32_t value);
 /* KCE/KCS/FTE KM */
+int hw_mod_cat_kce_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+	int start_idx, int count);
+int hw_mod_cat_kce_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kce_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t *value);
+int hw_mod_cat_kcs_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+	int start_idx, int count);
+int hw_mod_cat_kcs_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kcs_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t *value);
 int hw_mod_cat_fte_km_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
 	int start_idx, int count);
 int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
@@ -374,6 +386,18 @@ int hw_mod_cat_fte_km_set(struct flow_api_backend_s *be, enum hw_cat_e field,
 int hw_mod_cat_fte_km_get(struct flow_api_backend_s *be, enum hw_cat_e field,
 	enum km_flm_if_select_e if_num, int index, uint32_t *value);
 /* KCE/KCS/FTE FLM */
+int hw_mod_cat_kce_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+	int start_idx, int count);
+int hw_mod_cat_kce_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kce_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t *value);
+int hw_mod_cat_kcs_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
+	int start_idx, int count);
+int hw_mod_cat_kcs_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t value);
+int hw_mod_cat_kcs_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
+	enum km_flm_if_select_e if_num, int index, uint32_t *value);
 int hw_mod_cat_fte_flm_flush(struct flow_api_backend_s *be, enum km_flm_if_select_e if_num,
 	int start_idx, int count);
 int hw_mod_cat_fte_flm_set(struct flow_api_backend_s *be, enum hw_cat_e field,
@@ -384,10 +408,14 @@ int hw_mod_cat_fte_flm_get(struct flow_api_backend_s *be, enum hw_cat_e field,
 int hw_mod_cat_cte_flush(struct flow_api_backend_s *be, int start_idx, int count);
 int hw_mod_cat_cte_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
 	uint32_t value);
+int hw_mod_cat_cte_get(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+	uint32_t *value);
 
 int hw_mod_cat_cts_flush(struct flow_api_backend_s *be, int start_idx, int count);
 int hw_mod_cat_cts_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
 	uint32_t value);
+int hw_mod_cat_cts_get(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
+	uint32_t *value);
 
 int hw_mod_cat_cot_flush(struct flow_api_backend_s *be, int start_idx, int count);
 int hw_mod_cat_cot_set(struct flow_api_backend_s *be, enum hw_cat_e field, int index,
@@ -638,7 +666,21 @@ int hw_mod_flm_reset(struct flow_api_backend_s *be);
 int hw_mod_flm_control_flush(struct flow_api_backend_s *be);
 int hw_mod_flm_control_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
 
+int hw_mod_flm_status_update(struct flow_api_backend_s *be);
+int hw_mod_flm_status_get(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value);
+
 int hw_mod_flm_scan_flush(struct flow_api_backend_s *be);
+int hw_mod_flm_scan_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+
+int hw_mod_flm_load_bin_flush(struct flow_api_backend_s *be);
+int hw_mod_flm_load_bin_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+
+int hw_mod_flm_prio_flush(struct flow_api_backend_s *be);
+int hw_mod_flm_prio_set(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t value);
+
+int hw_mod_flm_pst_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_flm_pst_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+	uint32_t value);
 
 int hw_mod_flm_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c +190 -0

214 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +257 -0

268 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +234 -0

288 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +33 -0
index 18d959307e..a520ae1769 100644
@@ -32,6 +32,10 @@ struct hw_db_idx {
 	HW_DB_IDX;
 };
 
+struct hw_db_match_set_idx {
+	HW_DB_IDX;
+};
+
 struct hw_db_action_set_idx {
 	HW_DB_IDX;
 };
@@ -106,6 +110,13 @@ struct hw_db_tpe_ext_idx {
 	HW_DB_IDX;
 };
 
+struct hw_db_flm_idx {
+	HW_DB_IDX;
+};
+struct hw_db_flm_ft {
+	HW_DB_IDX;
+};
+
 struct hw_db_km_idx {
 	HW_DB_IDX;
 };
@@ -128,6 +139,7 @@ enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_TPE_EXT,
 
 	HW_DB_IDX_TYPE_KM_RCP,
+	HW_DB_IDX_TYPE_FLM_FT,
 	HW_DB_IDX_TYPE_KM_FT,
 	HW_DB_IDX_TYPE_HSH,
 };
@@ -211,6 +223,17 @@ struct hw_db_inline_km_ft_data {
 	struct hw_db_action_set_idx action_set;
 };
 
+struct hw_db_inline_flm_ft_data {
+	/* Group zero flows should set jump. */
+	/* Group nonzero flows should set group. */
+	int is_group_zero;
+	union {
+		int jump;
+		int group;
+	};
+	struct hw_db_action_set_idx action_set;
+};
+
 /**/
 
 int hw_db_inline_create(struct flow_nic_dev *ndev, void **db_handle);
@@ -277,6 +300,16 @@ void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct
 
 /**/
 
+void hw_db_inline_flm_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_idx idx);
+
+struct hw_db_flm_ft hw_db_inline_flm_ft_default(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_flm_ft_data *data);
+struct hw_db_flm_ft hw_db_inline_flm_ft_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_flm_ft_data *data);
+void hw_db_inline_flm_ft_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_ft idx);
+void hw_db_inline_flm_ft_deref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_flm_ft idx);
+
 int hw_db_inline_setup_mbr_filter(struct flow_nic_dev *ndev, uint32_t cat_hw_id, uint32_t ft,
 	uint32_t qsl_hw_id);
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +220 -4

274 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h new file +58 -0

58 lines not on this page · raw message

drivers/net/ntnic/ntutil/nt_util.h +8 -0
index 71ecd6c68c..a482fb43ad 100644
@@ -16,6 +16,14 @@
 #define ARRAY_SIZE(arr) RTE_DIM(arr)
 #endif
 
+/*
+ * Windows size in seconds for measuring FLM load
+ * and Port load.
+ * The windows size must max be 3 min in order to
+ * prevent overflow.
+ */
+#define FLM_LOAD_WINDOWS_SIZE 2ULL
+
 #define PCIIDENT_TO_DOMAIN(pci_ident) ((uint16_t)(((unsigned int)(pci_ident) >> 16) & 0xFFFFU))
 #define PCIIDENT_TO_BUSNR(pci_ident) ((uint8_t)(((unsigned int)(pci_ident) >> 8) & 0xFFU))
 #define PCIIDENT_TO_DEVNR(pci_ident) ((uint8_t)(((unsigned int)(pci_ident) >> 3) & 0x1FU))
Signature · 1 line
2.45.0
#359 lore raw

PATCH v5 34/80 net/ntnic: add FLM RCP module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |   4 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c   | 133 ++++++++++++
 .../profile_inline/flow_api_hw_db_inline.c    | 195 +++++++++++++++++-
 .../profile_inline/flow_api_hw_db_inline.h    |  20 ++
 .../profile_inline/flow_api_profile_inline.c  |  42 +++-
 5 files changed, 390 insertions(+), 4 deletions(-)
drivers/net/ntnic/include/hw_mod_backend.h +4 -0
index de662c4ed1..13722c30a9 100644
@@ -683,6 +683,10 @@ int hw_mod_flm_pst_set(struct flow_api_backend_s *be, enum hw_flm_e field, int i
 	uint32_t value);
 
 int hw_mod_flm_rcp_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+	uint32_t *value);
+int hw_mod_flm_rcp_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+	uint32_t value);
 
 int hw_mod_flm_scrub_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +133 -0

136 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +194 -1

252 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +20 -0
index a520ae1769..9820225ffa 100644
@@ -138,6 +138,7 @@ enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_TPE,
 	HW_DB_IDX_TYPE_TPE_EXT,
 
+	HW_DB_IDX_TYPE_FLM_RCP,
 	HW_DB_IDX_TYPE_KM_RCP,
 	HW_DB_IDX_TYPE_FLM_FT,
 	HW_DB_IDX_TYPE_KM_FT,
@@ -165,6 +166,22 @@ struct hw_db_inline_cat_data {
 	uint8_t ip_prot_tunnel;
 };
 
+struct hw_db_inline_flm_rcp_data {
+	uint64_t qw0_dyn : 5;
+	uint64_t qw0_ofs : 8;
+	uint64_t qw4_dyn : 5;
+	uint64_t qw4_ofs : 8;
+	uint64_t sw8_dyn : 5;
+	uint64_t sw8_ofs : 8;
+	uint64_t sw9_dyn : 5;
+	uint64_t sw9_ofs : 8;
+	uint64_t outer_prot : 1;
+	uint64_t inner_prot : 1;
+	uint64_t padding : 10;
+
+	uint32_t mask[10];
+};
+
 struct hw_db_inline_qsl_data {
 	uint32_t discard : 1;
 	uint32_t drop : 1;
@@ -300,7 +317,10 @@ void hw_db_inline_km_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struct
 
 /**/
 
+struct hw_db_flm_idx hw_db_inline_flm_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_flm_rcp_data *data, int group);
 void hw_db_inline_flm_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_idx idx);
+void hw_db_inline_flm_deref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_flm_idx idx);
 
 struct hw_db_flm_ft hw_db_inline_flm_ft_default(struct flow_nic_dev *ndev, void *db_handle,
 	const struct hw_db_inline_flm_ft_data *data);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +39 -3

72 lines not on this page · raw message

Signature · 1 line
2.45.0
#360 lore raw

PATCH v5 35/80 net/ntnic: add learn flow queue handling

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Implements thread for handling flow learn queue

---
 drivers/net/ntnic/include/hw_mod_backend.h    |  5 +
 drivers/net/ntnic/include/ntdrv_4ga.h         |  1 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c   | 33 +++++++
 .../flow_api/profile_inline/flm_lrn_queue.c   | 42 +++++++++
 .../flow_api/profile_inline/flm_lrn_queue.h   | 11 +++
 .../profile_inline/flow_api_profile_inline.c  | 48 ++++++++++
 drivers/net/ntnic/ntnic_ethdev.c              | 94 +++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  7 ++
 8 files changed, 241 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +5 -0
index 13722c30a9..17d5755634 100644
@@ -688,6 +688,11 @@ int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field,
 int hw_mod_flm_rcp_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
 	uint32_t value);
 
+int hw_mod_flm_lrn_data_set_flush(struct flow_api_backend_s *be, enum hw_flm_e field,
+	const uint32_t *value, uint32_t records,
+	uint32_t *handled_records, uint32_t *inf_word_cnt,
+	uint32_t *sta_word_cnt);
+
 int hw_mod_flm_scrub_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
 struct hsh_func_s {
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
index 8017aa4fc3..8ebdd98db0 100644
@@ -14,6 +14,7 @@ typedef struct ntdrv_4ga_s {
 	char *p_drv_name;
 
 	volatile bool b_shutdown;
+	rte_thread_t flm_thread;
 } ntdrv_4ga_t;
 
 #endif	/* __NTDRV_4GA_H__ */
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +33 -0
index 0a7e90c04f..f4c29b8bde 100644
@@ -712,3 +712,36 @@ int hw_mod_flm_rcp_set(struct flow_api_backend_s *be, enum hw_flm_e field, int i
 
 	return hw_mod_flm_rcp_mod(be, field, index, &value, 0);
 }
+
+int hw_mod_flm_lrn_data_set_flush(struct flow_api_backend_s *be, enum hw_flm_e field,
+	const uint32_t *value, uint32_t records,
+	uint32_t *handled_records, uint32_t *inf_word_cnt,
+	uint32_t *sta_word_cnt)
+{
+	int ret = 0;
+
+	switch (_VER_) {
+	case 25:
+		switch (field) {
+		case HW_FLM_FLOW_LRN_DATA:
+			ret = be->iface->flm_lrn_data_flush(be->be_dev, &be->flm, value, records,
+					handled_records,
+					(sizeof(struct flm_v25_lrn_data_s) /
+						sizeof(uint32_t)),
+					inf_word_cnt, sta_word_cnt);
+			break;
+
+		default:
+			UNSUP_FIELD_LOG;
+			return UNSUP_FIELD;
+		}
+
+		break;
+
+	default:
+		UNSUP_VER_LOG;
+		return UNSUP_VER;
+	}
+
+	return ret;
+}
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.c +42 -0

53 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.h +11 -0
index 8cee0c8e78..40558f4201 100644
@@ -8,7 +8,18 @@
 
 #include <stdint.h>
 
+typedef struct read_record {
+	uint32_t *p;
+	uint32_t num;
+} read_record;
+
+void *flm_lrn_queue_create(void);
+void flm_lrn_queue_free(void *q);
+
 uint32_t *flm_lrn_queue_get_write_buffer(void *q);
 void flm_lrn_queue_release_write_buffer(void *q);
 
+read_record flm_lrn_queue_get_read_buffer(void *q);
+void flm_lrn_queue_release_read_buffer(void *q, uint32_t num);
+
 #endif	/* _FLM_LRN_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +48 -0

60 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +94 -0

136 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +7 -0
index 1069be2f85..27d6cbef01 100644
@@ -256,6 +256,13 @@ struct profile_inline_ops {
 	int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,
 		int hsh_idx,
 		struct nt_eth_rss_conf rss_conf);
+
+	/*
+	 * NT Flow FLM queue API
+	 */
+	void (*flm_setup_queues)(void);
+	void (*flm_free_queues)(void);
+	uint32_t (*flm_update)(struct flow_eth_dev *dev);
 };
 
 void register_profile_inline_ops(const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
#361 lore raw

PATCH v5 36/80 net/ntnic: match and action db attributes were added

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Implements match/action dereferencing

---
 .../profile_inline/flow_api_hw_db_inline.c    | 795 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  35 +
 .../profile_inline/flow_api_profile_inline.c  |  55 ++
 3 files changed, 885 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +795 -0
index 0ae058b91e..52f85b65af 100644
@@ -9,6 +9,9 @@
 #include "flow_api_hw_db_inline.h"
 #include "rte_common.h"
 
+#define HW_DB_INLINE_ACTION_SET_NB 512
+#define HW_DB_INLINE_MATCH_SET_NB 512
+
 #define HW_DB_FT_LOOKUP_KEY_A 0
 
 #define HW_DB_FT_TYPE_KM 1
@@ -110,6 +113,20 @@ struct hw_db_inline_resource_db {
 		int cfn_hw;
 		int ref;
 	} *cfn;
+
+	uint32_t cfn_priority_counter;
+	uint32_t set_priority_counter;
+
+	struct hw_db_inline_resource_db_action_set {
+		struct hw_db_inline_action_set_data data;
+		int ref;
+	} action_set[HW_DB_INLINE_ACTION_SET_NB];
+
+	struct hw_db_inline_resource_db_match_set {
+		struct hw_db_inline_match_set_data data;
+		int ref;
+		uint32_t set_priority;
+	} match_set[HW_DB_INLINE_MATCH_SET_NB];
 };
 
 int hw_db_inline_create(struct flow_nic_dev *ndev, void **db_handle)
@@ -292,6 +309,16 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct
 		case HW_DB_IDX_TYPE_NONE:
 			break;
 
+		case HW_DB_IDX_TYPE_MATCH_SET:
+			hw_db_inline_match_set_deref(ndev, db_handle,
+				*(struct hw_db_match_set_idx *)&idxs[i]);
+			break;
+
+		case HW_DB_IDX_TYPE_ACTION_SET:
+			hw_db_inline_action_set_deref(ndev, db_handle,
+				*(struct hw_db_action_set_idx *)&idxs[i]);
+			break;
+
 		case HW_DB_IDX_TYPE_CAT:
 			hw_db_inline_cat_deref(ndev, db_handle, *(struct hw_db_cat_idx *)&idxs[i]);
 			break;
@@ -360,6 +387,12 @@ const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
 		case HW_DB_IDX_TYPE_NONE:
 			return NULL;
 
+		case HW_DB_IDX_TYPE_MATCH_SET:
+			return &db->match_set[idxs[i].ids].data;
+
+		case HW_DB_IDX_TYPE_ACTION_SET:
+			return &db->action_set[idxs[i].ids].data;
+
 		case HW_DB_IDX_TYPE_CAT:
 			return &db->cat[idxs[i].ids].data;
 
@@ -552,6 +585,763 @@ static void hw_db_inline_setup_default_flm_rcp(struct flow_nic_dev *ndev, int fl
 }
 
 
+static void hw_db_copy_ft(struct flow_nic_dev *ndev, int type, int cfn_dst, int cfn_src,
+	int lookup, int flow_type)
+{
+	const int max_lookups = 4;
+	const int cat_funcs = (int)ndev->be.cat.nb_cat_funcs / 8;
+
+	int fte_index_dst = (8 * flow_type + cfn_dst / cat_funcs) * max_lookups + lookup;
+	int fte_field_dst = cfn_dst % cat_funcs;
+
+	int fte_index_src = (8 * flow_type + cfn_src / cat_funcs) * max_lookups + lookup;
+	int fte_field_src = cfn_src % cat_funcs;
+
+	uint32_t current_bm_dst = 0;
+	uint32_t current_bm_src = 0;
+	uint32_t fte_field_bm_dst = 1 << fte_field_dst;
+	uint32_t fte_field_bm_src = 1 << fte_field_src;
+
+	switch (type) {
+	case HW_DB_FT_TYPE_FLM:
+		hw_mod_cat_fte_flm_get(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+			fte_index_dst, &current_bm_dst);
+		hw_mod_cat_fte_flm_get(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+			fte_index_src, &current_bm_src);
+		break;
+
+	case HW_DB_FT_TYPE_KM:
+		hw_mod_cat_fte_km_get(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+			fte_index_dst, &current_bm_dst);
+		hw_mod_cat_fte_km_get(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+			fte_index_src, &current_bm_src);
+		break;
+
+	default:
+		break;
+	}
+
+	uint32_t enable = current_bm_src & fte_field_bm_src;
+	uint32_t final_bm_dst = enable ? (fte_field_bm_dst | current_bm_dst)
+		: (~fte_field_bm_dst & current_bm_dst);
+
+	if (current_bm_dst != final_bm_dst) {
+		switch (type) {
+		case HW_DB_FT_TYPE_FLM:
+			hw_mod_cat_fte_flm_set(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+				fte_index_dst, final_bm_dst);
+			hw_mod_cat_fte_flm_flush(&ndev->be, KM_FLM_IF_FIRST, fte_index_dst, 1);
+			break;
+
+		case HW_DB_FT_TYPE_KM:
+			hw_mod_cat_fte_km_set(&ndev->be, HW_CAT_FTE_ENABLE_BM, KM_FLM_IF_FIRST,
+				fte_index_dst, final_bm_dst);
+			hw_mod_cat_fte_km_flush(&ndev->be, KM_FLM_IF_FIRST, fte_index_dst, 1);
+			break;
+
+		default:
+			break;
+		}
+	}
+}
+
+
+static int hw_db_inline_filter_apply(struct flow_nic_dev *ndev,
+	struct hw_db_inline_resource_db *db,
+	int cat_hw_id,
+	struct hw_db_match_set_idx match_set_idx,
+	struct hw_db_flm_ft flm_ft_idx,
+	struct hw_db_action_set_idx action_set_idx)
+{
+	(void)match_set_idx;
+	(void)flm_ft_idx;
+
+	const struct hw_db_inline_match_set_data *match_set =
+			&db->match_set[match_set_idx.ids].data;
+	const struct hw_db_inline_cat_data *cat = &db->cat[match_set->cat.ids].data;
+
+	const int km_ft = match_set->km_ft.id1;
+	const int km_rcp = (int)db->km[match_set->km.id1].data.rcp;
+
+	const int flm_ft = flm_ft_idx.id1;
+	const int flm_rcp = flm_ft_idx.id2;
+
+	const struct hw_db_inline_action_set_data *action_set =
+			&db->action_set[action_set_idx.ids].data;
+	const struct hw_db_inline_cot_data *cot = &db->cot[action_set->cot.ids].data;
+
+	const int qsl_hw_id = action_set->qsl.ids;
+	const int slc_lr_hw_id = action_set->slc_lr.ids;
+	const int tpe_hw_id = action_set->tpe.ids;
+	const int hsh_hw_id = action_set->hsh.ids;
+
+	/* Setup default FLM RCP if needed */
+	if (flm_rcp > 0 && db->flm[flm_rcp].ref <= 0)
+		hw_db_inline_setup_default_flm_rcp(ndev, flm_rcp);
+
+	/* Setup CAT.CFN */
+	{
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_SET_ALL_DEFAULTS, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ENABLE, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_INV, cat_hw_id, 0, 0x0);
+
+		/* Protocol checks */
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_INV, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_ISL, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_CFP, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_MAC, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_L2, cat_hw_id, 0, cat->ptc_mask_l2);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_VNTAG, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_VLAN, cat_hw_id, 0, cat->vlan_mask);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_MPLS, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_L3, cat_hw_id, 0, cat->ptc_mask_l3);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_FRAG, cat_hw_id, 0,
+			cat->ptc_mask_frag);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_IP_PROT, cat_hw_id, 0, cat->ip_prot);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_L4, cat_hw_id, 0, cat->ptc_mask_l4);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TUNNEL, cat_hw_id, 0,
+			cat->ptc_mask_tunnel);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_L2, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_VLAN, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_MPLS, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_L3, cat_hw_id, 0,
+			cat->ptc_mask_l3_tunnel);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_FRAG, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_IP_PROT, cat_hw_id, 0,
+			cat->ip_prot_tunnel);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_L4, cat_hw_id, 0,
+			cat->ptc_mask_l4_tunnel);
+
+		/* Error checks */
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_INV, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_CV, cat_hw_id, 0, 0x1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_FCS, cat_hw_id, 0, 0x1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_TRUNC, cat_hw_id, 0, 0x1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_L3_CS, cat_hw_id, 0, 0x1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_L4_CS, cat_hw_id, 0, 0x1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_TNL_L3_CS, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_TNL_L4_CS, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_TTL_EXP, cat_hw_id, 0,
+			cat->err_mask_ttl);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ERR_TNL_TTL_EXP, cat_hw_id, 0,
+			cat->err_mask_ttl_tunnel);
+
+		/* MAC port check */
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_MAC_PORT, cat_hw_id, 0,
+			cat->mac_port_mask);
+
+		/* Pattern match checks */
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_CMP, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_DCT, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_EXT_INV, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_CMB, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_AND_INV, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_OR_INV, cat_hw_id, 0, -1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PM_INV, cat_hw_id, 0, -1);
+
+		/* Length checks */
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_LC, cat_hw_id, 0, 0x0);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_LC_INV, cat_hw_id, 0, -1);
+
+		/* KM and FLM */
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_KM0_OR, cat_hw_id, 0, 0x1);
+		hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_KM1_OR, cat_hw_id, 0, 0x3);
+
+		hw_mod_cat_cfn_flush(&ndev->be, cat_hw_id, 1);
+	}
+
+	/* Setup CAT.CTS */
+	{
+		const int offset = ((int)ndev->be.cat.cts_num + 1) / 2;
+
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + 0, cat_hw_id);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + 0, 0);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + 1, hsh_hw_id);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + 1, qsl_hw_id);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + 2, 0);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + 2,
+			slc_lr_hw_id);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + 3, 0);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + 3, 0);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + 4, 0);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + 4, 0);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + 5, tpe_hw_id);
+		hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + 5, 0);
+
+		hw_mod_cat_cts_flush(&ndev->be, offset * cat_hw_id, 6);
+	}
+
+	/* Setup CAT.CTE */
+	{
+		hw_mod_cat_cte_set(&ndev->be, HW_CAT_CTE_ENABLE_BM, cat_hw_id,
+			0x001 | 0x004 | (qsl_hw_id ? 0x008 : 0) |
+			(slc_lr_hw_id ? 0x020 : 0) | 0x040 |
+			(tpe_hw_id ? 0x400 : 0));
+		hw_mod_cat_cte_flush(&ndev->be, cat_hw_id, 1);
+	}
+
+	/* Setup CAT.KM */
+	{
+		uint32_t bm = 0;
+
+		hw_mod_cat_kcs_km_set(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cat_hw_id,
+			km_rcp);
+		hw_mod_cat_kcs_km_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id, 1);
+
+		hw_mod_cat_kce_km_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, &bm);
+		hw_mod_cat_kce_km_set(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, bm | (1 << (cat_hw_id % 8)));
+		hw_mod_cat_kce_km_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id / 8, 1);
+
+		hw_db_set_ft(ndev, HW_DB_FT_TYPE_KM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_A, km_ft, 1);
+	}
+
+	/* Setup CAT.FLM */
+	{
+		uint32_t bm = 0;
+
+		hw_mod_cat_kcs_flm_set(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cat_hw_id,
+			flm_rcp);
+		hw_mod_cat_kcs_flm_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id, 1);
+
+		hw_mod_cat_kce_flm_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, &bm);
+		hw_mod_cat_kce_flm_set(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, bm | (1 << (cat_hw_id % 8)));
+		hw_mod_cat_kce_flm_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id / 8, 1);
+
+		hw_db_set_ft(ndev, HW_DB_FT_TYPE_FLM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_A, km_ft, 1);
+		hw_db_set_ft(ndev, HW_DB_FT_TYPE_FLM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_C, flm_ft, 1);
+	}
+
+	/* Setup CAT.COT */
+	{
+		hw_mod_cat_cot_set(&ndev->be, HW_CAT_COT_PRESET_ALL, cat_hw_id, 0);
+		hw_mod_cat_cot_set(&ndev->be, HW_CAT_COT_COLOR, cat_hw_id, cot->frag_rcp << 10);
+		hw_mod_cat_cot_set(&ndev->be, HW_CAT_COT_KM, cat_hw_id,
+			cot->matcher_color_contrib);
+		hw_mod_cat_cot_flush(&ndev->be, cat_hw_id, 1);
+	}
+
+	hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ENABLE, cat_hw_id, 0, 0x1);
+	hw_mod_cat_cfn_flush(&ndev->be, cat_hw_id, 1);
+
+	return 0;
+}
+
+static void hw_db_inline_filter_clear(struct flow_nic_dev *ndev,
+	struct hw_db_inline_resource_db *db,
+	int cat_hw_id)
+{
+	/* Setup CAT.CFN */
+	hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_SET_ALL_DEFAULTS, cat_hw_id, 0, 0x0);
+	hw_mod_cat_cfn_flush(&ndev->be, cat_hw_id, 1);
+
+	/* Setup CAT.CTS */
+	{
+		const int offset = ((int)ndev->be.cat.cts_num + 1) / 2;
+
+		for (int i = 0; i < 6; ++i) {
+			hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cat_hw_id + i, 0);
+			hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cat_hw_id + i, 0);
+		}
+
+		hw_mod_cat_cts_flush(&ndev->be, offset * cat_hw_id, 6);
+	}
+
+	/* Setup CAT.CTE */
+	{
+		hw_mod_cat_cte_set(&ndev->be, HW_CAT_CTE_ENABLE_BM, cat_hw_id, 0);
+		hw_mod_cat_cte_flush(&ndev->be, cat_hw_id, 1);
+	}
+
+	/* Setup CAT.KM */
+	{
+		uint32_t bm = 0;
+
+		hw_mod_cat_kcs_km_set(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cat_hw_id,
+			0);
+		hw_mod_cat_kcs_km_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id, 1);
+
+		hw_mod_cat_kce_km_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, &bm);
+		hw_mod_cat_kce_km_set(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, bm & ~(1 << (cat_hw_id % 8)));
+		hw_mod_cat_kce_km_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id / 8, 1);
+
+		for (int ft = 0; ft < (int)db->nb_km_ft; ++ft) {
+			hw_db_set_ft(ndev, HW_DB_FT_TYPE_KM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_A, ft,
+				0);
+		}
+	}
+
+	/* Setup CAT.FLM */
+	{
+		uint32_t bm = 0;
+
+		hw_mod_cat_kcs_flm_set(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cat_hw_id,
+			0);
+		hw_mod_cat_kcs_flm_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id, 1);
+
+		hw_mod_cat_kce_flm_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, &bm);
+		hw_mod_cat_kce_flm_set(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cat_hw_id / 8, bm & ~(1 << (cat_hw_id % 8)));
+		hw_mod_cat_kce_flm_flush(&ndev->be, KM_FLM_IF_FIRST, cat_hw_id / 8, 1);
+
+		for (int ft = 0; ft < (int)db->nb_flm_ft; ++ft) {
+			hw_db_set_ft(ndev, HW_DB_FT_TYPE_FLM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_A, ft,
+				0);
+			hw_db_set_ft(ndev, HW_DB_FT_TYPE_FLM, cat_hw_id, HW_DB_FT_LOOKUP_KEY_C, ft,
+				0);
+		}
+	}
+
+	hw_mod_cat_cot_set(&ndev->be, HW_CAT_COT_PRESET_ALL, cat_hw_id, 0);
+	hw_mod_cat_cot_flush(&ndev->be, cat_hw_id, 1);
+}
+
+static void hw_db_inline_filter_copy(struct flow_nic_dev *ndev,
+	struct hw_db_inline_resource_db *db, int cfn_dst, int cfn_src)
+{
+	uint32_t val = 0;
+
+	hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_COPY_FROM, cfn_dst, 0, cfn_src);
+	hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ENABLE, cfn_dst, 0, 0x0);
+	hw_mod_cat_cfn_flush(&ndev->be, cfn_dst, 1);
+
+	/* Setup CAT.CTS */
+	{
+		const int offset = ((int)ndev->be.cat.cts_num + 1) / 2;
+
+		for (int i = 0; i < offset; ++i) {
+			hw_mod_cat_cts_get(&ndev->be, HW_CAT_CTS_CAT_A, offset * cfn_src + i,
+				&val);
+			hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_A, offset * cfn_dst + i, val);
+			hw_mod_cat_cts_get(&ndev->be, HW_CAT_CTS_CAT_B, offset * cfn_src + i,
+				&val);
+			hw_mod_cat_cts_set(&ndev->be, HW_CAT_CTS_CAT_B, offset * cfn_dst + i, val);
+		}
+
+		hw_mod_cat_cts_flush(&ndev->be, offset * cfn_dst, offset);
+	}
+
+	/* Setup CAT.CTE */
+	{
+		hw_mod_cat_cte_get(&ndev->be, HW_CAT_CTE_ENABLE_BM, cfn_src, &val);
+		hw_mod_cat_cte_set(&ndev->be, HW_CAT_CTE_ENABLE_BM, cfn_dst, val);
+		hw_mod_cat_cte_flush(&ndev->be, cfn_dst, 1);
+	}
+
+	/* Setup CAT.KM */
+	{
+		uint32_t bit_src = 0;
+
+		hw_mod_cat_kcs_km_get(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cfn_src,
+			&val);
+		hw_mod_cat_kcs_km_set(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cfn_dst,
+			val);
+		hw_mod_cat_kcs_km_flush(&ndev->be, KM_FLM_IF_FIRST, cfn_dst, 1);
+
+		hw_mod_cat_kce_km_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cfn_src / 8, &val);
+		bit_src = (val >> (cfn_src % 8)) & 0x1;
+
+		hw_mod_cat_kce_km_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cfn_dst / 8, &val);
+		val &= ~(1 << (cfn_dst % 8));
+
+		hw_mod_cat_kce_km_set(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cfn_dst / 8, val | (bit_src << (cfn_dst % 8)));
+		hw_mod_cat_kce_km_flush(&ndev->be, KM_FLM_IF_FIRST, cfn_dst / 8, 1);
+
+		for (int ft = 0; ft < (int)db->nb_km_ft; ++ft) {
+			hw_db_copy_ft(ndev, HW_DB_FT_TYPE_KM, cfn_dst, cfn_src,
+				HW_DB_FT_LOOKUP_KEY_A, ft);
+		}
+	}
+
+	/* Setup CAT.FLM */
+	{
+		uint32_t bit_src = 0;
+
+		hw_mod_cat_kcs_flm_get(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cfn_src,
+			&val);
+		hw_mod_cat_kcs_flm_set(&ndev->be, HW_CAT_KCS_CATEGORY, KM_FLM_IF_FIRST, cfn_dst,
+			val);
+		hw_mod_cat_kcs_flm_flush(&ndev->be, KM_FLM_IF_FIRST, cfn_dst, 1);
+
+		hw_mod_cat_kce_flm_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cfn_src / 8, &val);
+		bit_src = (val >> (cfn_src % 8)) & 0x1;
+
+		hw_mod_cat_kce_flm_get(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cfn_dst / 8, &val);
+		val &= ~(1 << (cfn_dst % 8));
+
+		hw_mod_cat_kce_flm_set(&ndev->be, HW_CAT_KCE_ENABLE_BM, KM_FLM_IF_FIRST,
+			cfn_dst / 8, val | (bit_src << (cfn_dst % 8)));
+		hw_mod_cat_kce_flm_flush(&ndev->be, KM_FLM_IF_FIRST, cfn_dst / 8, 1);
+
+		for (int ft = 0; ft < (int)db->nb_flm_ft; ++ft) {
+			hw_db_copy_ft(ndev, HW_DB_FT_TYPE_FLM, cfn_dst, cfn_src,
+				HW_DB_FT_LOOKUP_KEY_A, ft);
+			hw_db_copy_ft(ndev, HW_DB_FT_TYPE_FLM, cfn_dst, cfn_src,
+				HW_DB_FT_LOOKUP_KEY_C, ft);
+		}
+	}
+
+	/* Setup CAT.COT */
+	{
+		hw_mod_cat_cot_set(&ndev->be, HW_CAT_COT_COPY_FROM, cfn_dst, cfn_src);
+		hw_mod_cat_cot_flush(&ndev->be, cfn_dst, 1);
+	}
+
+	hw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_ENABLE, cfn_dst, 0, 0x1);
+	hw_mod_cat_cfn_flush(&ndev->be, cfn_dst, 1);
+}
+
+/*
+ * Algorithm for moving CFN entries to make space with respect of priority.
+ * The algorithm will make the fewest possible moves to fit a new CFN entry.
+ */
+static int hw_db_inline_alloc_prioritized_cfn(struct flow_nic_dev *ndev,
+	struct hw_db_inline_resource_db *db,
+	struct hw_db_match_set_idx match_set_idx)
+{
+	const struct hw_db_inline_resource_db_match_set *match_set =
+			&db->match_set[match_set_idx.ids];
+
+	uint64_t priority = ((uint64_t)(match_set->data.priority & 0xff) << 56) |
+		((uint64_t)(0xffffff - (match_set->set_priority & 0xffffff)) << 32) |
+		(0xffffffff - ++db->cfn_priority_counter);
+
+	int db_cfn_idx = -1;
+
+	struct {
+		uint64_t priority;
+		uint32_t idx;
+	} sorted_priority[db->nb_cat];
+
+	memset(sorted_priority, 0x0, sizeof(sorted_priority));
+
+	uint32_t in_use_count = 0;
+
+	for (uint32_t i = 1; i < db->nb_cat; ++i) {
+		if (db->cfn[i].ref > 0) {
+			sorted_priority[db->cfn[i].cfn_hw].priority = db->cfn[i].priority;
+			sorted_priority[db->cfn[i].cfn_hw].idx = i;
+			in_use_count += 1;
+
+		} else if (db_cfn_idx == -1) {
+			db_cfn_idx = (int)i;
+		}
+	}
+
+	if (in_use_count >= db->nb_cat - 1)
+		return -1;
+
+	if (in_use_count == 0) {
+		db->cfn[db_cfn_idx].ref = 1;
+		db->cfn[db_cfn_idx].cfn_hw = 1;
+		db->cfn[db_cfn_idx].priority = priority;
+		return db_cfn_idx;
+	}
+
+	int goal = 1;
+	int free_before = -1000000;
+	int free_after = 1000000;
+	int found_smaller = 0;
+
+	for (int i = 1; i < (int)db->nb_cat; ++i) {
+		if (sorted_priority[i].priority > priority) {	/* Bigger */
+			goal = i + 1;
+
+		} else if (sorted_priority[i].priority == 0) {	/* Not set */
+			if (found_smaller) {
+				if (free_after > i)
+					free_after = i;
+
+			} else {
+				free_before = i;
+			}
+
+		} else {/* Smaller */
+			found_smaller = 1;
+		}
+	}
+
+	int diff_before = goal - free_before - 1;
+	int diff_after = free_after - goal;
+
+	if (goal < (int)db->nb_cat && sorted_priority[goal].priority == 0) {
+		db->cfn[db_cfn_idx].ref = 1;
+		db->cfn[db_cfn_idx].cfn_hw = goal;
+		db->cfn[db_cfn_idx].priority = priority;
+		return db_cfn_idx;
+	}
+
+	if (diff_after <= diff_before) {
+		for (int i = free_after; i > goal; --i) {
+			int *cfn_hw = &db->cfn[sorted_priority[i - 1].idx].cfn_hw;
+			hw_db_inline_filter_copy(ndev, db, i, *cfn_hw);
+			hw_db_inline_filter_clear(ndev, db, *cfn_hw);
+			*cfn_hw = i;
+		}
+
+	} else {
+		goal -= 1;
+
+		for (int i = free_before; i < goal; ++i) {
+			int *cfn_hw = &db->cfn[sorted_priority[i + 1].idx].cfn_hw;
+			hw_db_inline_filter_copy(ndev, db, i, *cfn_hw);
+			hw_db_inline_filter_clear(ndev, db, *cfn_hw);
+			*cfn_hw = i;
+		}
+	}
+
+	db->cfn[db_cfn_idx].ref = 1;
+	db->cfn[db_cfn_idx].cfn_hw = goal;
+	db->cfn[db_cfn_idx].priority = priority;
+
+	return db_cfn_idx;
+}
+
+static void hw_db_inline_free_prioritized_cfn(struct hw_db_inline_resource_db *db, int cfn_hw)
+{
+	for (uint32_t i = 0; i < db->nb_cat; ++i) {
+		if (db->cfn[i].cfn_hw == cfn_hw) {
+			memset(&db->cfn[i], 0x0, sizeof(struct hw_db_inline_resource_db_cfn));
+			break;
+		}
+	}
+}
+
+static void hw_db_inline_update_active_filters(struct flow_nic_dev *ndev, void *db_handle,
+	int group)
+{
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+	struct hw_db_inline_resource_db_flm_rcp *flm_rcp = &db->flm[group];
+	struct hw_db_inline_resource_db_flm_cfn_map *cell;
+
+	for (uint32_t match_set_idx = 0; match_set_idx < db->nb_cat; ++match_set_idx) {
+		for (uint32_t ft_idx = 0; ft_idx < db->nb_flm_ft; ++ft_idx) {
+			int active = flm_rcp->ft[ft_idx].ref > 0 &&
+				flm_rcp->match_set[match_set_idx].ref > 0;
+			cell = &flm_rcp->cfn_map[match_set_idx * db->nb_flm_ft + ft_idx];
+
+			if (active && cell->cfn_idx == 0) {
+				/* Setup filter */
+				cell->cfn_idx = hw_db_inline_alloc_prioritized_cfn(ndev, db,
+					flm_rcp->match_set[match_set_idx].idx);
+				hw_db_inline_filter_apply(ndev, db, db->cfn[cell->cfn_idx].cfn_hw,
+					flm_rcp->match_set[match_set_idx].idx,
+					flm_rcp->ft[ft_idx].idx,
+					group == 0
+					? db->match_set[flm_rcp->match_set[match_set_idx]
+					.idx.ids]
+					.data.action_set
+					: flm_rcp->ft[ft_idx].data.action_set);
+			}
+
+			if (!active && cell->cfn_idx > 0) {
+				/* Teardown filter */
+				hw_db_inline_filter_clear(ndev, db, db->cfn[cell->cfn_idx].cfn_hw);
+				hw_db_inline_free_prioritized_cfn(db,
+					db->cfn[cell->cfn_idx].cfn_hw);
+				cell->cfn_idx = 0;
+			}
+		}
+	}
+}
+
+
+/******************************************************************************/
+/* Match set                                                                  */
+/******************************************************************************/
+
+static int hw_db_inline_match_set_compare(const struct hw_db_inline_match_set_data *data1,
+	const struct hw_db_inline_match_set_data *data2)
+{
+	return data1->cat.raw == data2->cat.raw && data1->km.raw == data2->km.raw &&
+		data1->km_ft.raw == data2->km_ft.raw && data1->jump == data2->jump;
+}
+
+struct hw_db_match_set_idx
+hw_db_inline_match_set_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_match_set_data *data)
+{
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+	struct hw_db_inline_resource_db_flm_rcp *flm_rcp = &db->flm[data->jump];
+	struct hw_db_match_set_idx idx = { .raw = 0 };
+	int found = 0;
+
+	idx.type = HW_DB_IDX_TYPE_MATCH_SET;
+
+	for (uint32_t i = 0; i < HW_DB_INLINE_MATCH_SET_NB; ++i) {
+		if (!found && db->match_set[i].ref <= 0) {
+			found = 1;
+			idx.ids = i;
+		}
+
+		if (db->match_set[i].ref > 0 &&
+			hw_db_inline_match_set_compare(data, &db->match_set[i].data)) {
+			idx.ids = i;
+			hw_db_inline_match_set_ref(ndev, db, idx);
+			return idx;
+		}
+	}
+
+	if (!found) {
+		idx.error = 1;
+		return idx;
+	}
+
+	found = 0;
+
+	for (uint32_t i = 0; i < db->nb_cat; ++i) {
+		if (flm_rcp->match_set[i].ref <= 0) {
+			found = 1;
+			flm_rcp->match_set[i].ref = 1;
+			flm_rcp->match_set[i].idx.raw = idx.raw;
+			break;
+		}
+	}
+
+	if (!found) {
+		idx.error = 1;
+		return idx;
+	}
+
+	memcpy(&db->match_set[idx.ids].data, data, sizeof(struct hw_db_inline_match_set_data));
+	db->match_set[idx.ids].ref = 1;
+	db->match_set[idx.ids].set_priority = ++db->set_priority_counter;
+
+	hw_db_inline_update_active_filters(ndev, db, data->jump);
+
+	return idx;
+}
+
+void hw_db_inline_match_set_ref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_match_set_idx idx)
+{
+	(void)ndev;
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+
+	if (!idx.error)
+		db->match_set[idx.ids].ref += 1;
+}
+
+void hw_db_inline_match_set_deref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_match_set_idx idx)
+{
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+	struct hw_db_inline_resource_db_flm_rcp *flm_rcp;
+	int jump;
+
+	if (idx.error)
+		return;
+
+	db->match_set[idx.ids].ref -= 1;
+
+	if (db->match_set[idx.ids].ref > 0)
+		return;
+
+	jump = db->match_set[idx.ids].data.jump;
+	flm_rcp = &db->flm[jump];
+
+	for (uint32_t i = 0; i < db->nb_cat; ++i) {
+		if (flm_rcp->match_set[i].idx.raw == idx.raw) {
+			flm_rcp->match_set[i].ref = 0;
+			hw_db_inline_update_active_filters(ndev, db, jump);
+			memset(&flm_rcp->match_set[i], 0x0,
+				sizeof(struct hw_db_inline_resource_db_flm_match_set));
+		}
+	}
+
+	memset(&db->match_set[idx.ids].data, 0x0, sizeof(struct hw_db_inline_match_set_data));
+	db->match_set[idx.ids].ref = 0;
+}
+
+/******************************************************************************/
+/* Action set                                                                 */
+/******************************************************************************/
+
+static int hw_db_inline_action_set_compare(const struct hw_db_inline_action_set_data *data1,
+	const struct hw_db_inline_action_set_data *data2)
+{
+	if (data1->contains_jump)
+		return data2->contains_jump && data1->jump == data2->jump;
+
+	return data1->cot.raw == data2->cot.raw && data1->qsl.raw == data2->qsl.raw &&
+		data1->slc_lr.raw == data2->slc_lr.raw && data1->tpe.raw == data2->tpe.raw &&
+		data1->hsh.raw == data2->hsh.raw;
+}
+
+struct hw_db_action_set_idx
+hw_db_inline_action_set_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_action_set_data *data)
+{
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+	struct hw_db_action_set_idx idx = { .raw = 0 };
+	int found = 0;
+
+	idx.type = HW_DB_IDX_TYPE_ACTION_SET;
+
+	for (uint32_t i = 0; i < HW_DB_INLINE_ACTION_SET_NB; ++i) {
+		if (!found && db->action_set[i].ref <= 0) {
+			found = 1;
+			idx.ids = i;
+		}
+
+		if (db->action_set[i].ref > 0 &&
+			hw_db_inline_action_set_compare(data, &db->action_set[i].data)) {
+			idx.ids = i;
+			hw_db_inline_action_set_ref(ndev, db, idx);
+			return idx;
+		}
+	}
+
+	if (!found) {
+		idx.error = 1;
+		return idx;
+	}
+
+	memcpy(&db->action_set[idx.ids].data, data, sizeof(struct hw_db_inline_action_set_data));
+	db->action_set[idx.ids].ref = 1;
+
+	return idx;
+}
+
+void hw_db_inline_action_set_ref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_action_set_idx idx)
+{
+	(void)ndev;
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+
+	if (!idx.error)
+		db->action_set[idx.ids].ref += 1;
+}
+
+void hw_db_inline_action_set_deref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_action_set_idx idx)
+{
+	(void)ndev;
+	struct hw_db_inline_resource_db *db = (struct hw_db_inline_resource_db *)db_handle;
+
+	if (idx.error)
+		return;
+
+	db->action_set[idx.ids].ref -= 1;
+
+	if (db->action_set[idx.ids].ref <= 0) {
+		memset(&db->action_set[idx.ids].data, 0x0,
+			sizeof(struct hw_db_inline_action_set_data));
+		db->action_set[idx.ids].ref = 0;
+	}
+}
+
 /******************************************************************************/
 /* COT                                                                        */
 /******************************************************************************/
@@ -1593,6 +2383,8 @@ struct hw_db_flm_ft hw_db_inline_flm_ft_default(struct flow_nic_dev *ndev, void
 	flm_rcp->ft[idx.id1].idx.raw = idx.raw;
 	flm_rcp->ft[idx.id1].ref = 1;
 
+	hw_db_inline_update_active_filters(ndev, db, data->jump);
+
 	return idx;
 }
 
@@ -1647,6 +2439,8 @@ struct hw_db_flm_ft hw_db_inline_flm_ft_add(struct flow_nic_dev *ndev, void *db_
 	flm_rcp->ft[idx.id1].idx.raw = idx.raw;
 	flm_rcp->ft[idx.id1].ref = 1;
 
+	hw_db_inline_update_active_filters(ndev, db, data->group);
+
 	return idx;
 }
 
@@ -1677,6 +2471,7 @@ void hw_db_inline_flm_ft_deref(struct flow_nic_dev *ndev, void *db_handle, struc
 		return;
 
 	flm_rcp->ft[idx.id1].ref = 0;
+	hw_db_inline_update_active_filters(ndev, db, idx.id2);
 	memset(&flm_rcp->ft[idx.id1], 0x0, sizeof(struct hw_db_inline_resource_db_flm_ft));
 }
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +35 -0
index 9820225ffa..33de674b72 100644
@@ -131,6 +131,10 @@ struct hw_db_hsh_idx {
 
 enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_NONE = 0,
+
+	HW_DB_IDX_TYPE_MATCH_SET,
+	HW_DB_IDX_TYPE_ACTION_SET,
+
 	HW_DB_IDX_TYPE_COT,
 	HW_DB_IDX_TYPE_CAT,
 	HW_DB_IDX_TYPE_QSL,
@@ -145,6 +149,17 @@ enum hw_db_idx_type {
 	HW_DB_IDX_TYPE_HSH,
 };
 
+/* Container types */
+struct hw_db_inline_match_set_data {
+	struct hw_db_cat_idx cat;
+	struct hw_db_km_idx km;
+	struct hw_db_km_ft km_ft;
+	struct hw_db_action_set_idx action_set;
+	int jump;
+
+	uint8_t priority;
+};
+
 /* Functionality data types */
 struct hw_db_inline_cat_data {
 	uint32_t vlan_mask : 4;
@@ -224,6 +239,7 @@ struct hw_db_inline_action_set_data {
 		struct {
 			struct hw_db_cot_idx cot;
 			struct hw_db_qsl_idx qsl;
+			struct hw_db_slc_lr_idx slc_lr;
 			struct hw_db_tpe_idx tpe;
 			struct hw_db_hsh_idx hsh;
 		};
@@ -262,6 +278,25 @@ const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
 	enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size);
 
 /**/
+
+struct hw_db_match_set_idx
+hw_db_inline_match_set_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_match_set_data *data);
+void hw_db_inline_match_set_ref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_match_set_idx idx);
+void hw_db_inline_match_set_deref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_match_set_idx idx);
+
+struct hw_db_action_set_idx
+hw_db_inline_action_set_add(struct flow_nic_dev *ndev, void *db_handle,
+	const struct hw_db_inline_action_set_data *data);
+void hw_db_inline_action_set_ref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_action_set_idx idx);
+void hw_db_inline_action_set_deref(struct flow_nic_dev *ndev, void *db_handle,
+	struct hw_db_action_set_idx idx);
+
+/**/
+
 struct hw_db_cot_idx hw_db_inline_cot_add(struct flow_nic_dev *ndev, void *db_handle,
 	const struct hw_db_inline_cot_data *data);
 void hw_db_inline_cot_ref(struct flow_nic_dev *ndev, void *db_handle, struct hw_db_cot_idx idx);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +55 -0

87 lines not on this page · raw message

Signature · 1 line
2.45.0
#362 lore raw

PATCH v5 37/80 net/ntnic: add flow dump feature

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

Add posibilyty to dump flow in human readable format

---
 drivers/net/ntnic/include/flow_api_engine.h   |   2 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  17 ++
 .../profile_inline/flow_api_hw_db_inline.c    | 264 ++++++++++++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |   3 +
 .../profile_inline/flow_api_profile_inline.c  |  81 ++++++
 .../profile_inline/flow_api_profile_inline.h  |   6 +
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |  29 ++
 drivers/net/ntnic/ntnic_mod_reg.h             |  11 +
 8 files changed, 413 insertions(+)
drivers/net/ntnic/include/flow_api_engine.h +2 -0
index e52363f04e..155a9e1fd6 100644
@@ -281,6 +281,8 @@ struct flow_handle {
 	struct flow_handle *next;
 	struct flow_handle *prev;
 
+	/* Flow specific pointer to application data stored during action creation. */
+	void *context;
 	void *user_data;
 
 	union {
drivers/net/ntnic/nthw/flow_api/flow_api.c +17 -0
index 577b1c83b5..ec91d08e27 100644
@@ -972,6 +972,22 @@ int flow_nic_set_hasher(struct flow_nic_dev *ndev, int hsh_idx, enum flow_nic_ha
 	return 0;
 }
 
+static int flow_dev_dump(struct flow_eth_dev *dev,
+	struct flow_handle *flow,
+	uint16_t caller_id,
+	FILE *file,
+	struct rte_flow_error *error)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG(ERR, FILTER, "%s: profile_inline module uninitialized", __func__);
+		return -1;
+	}
+
+	return profile_inline_ops->flow_dev_dump_profile_inline(dev, flow, caller_id, file, error);
+}
+
 int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,
 	struct nt_eth_rss_conf rss_conf)
 {
@@ -997,6 +1013,7 @@ static const struct flow_filter_ops ops = {
 	 */
 	.flow_create = flow_create,
 	.flow_destroy = flow_destroy,
+	.flow_dev_dump = flow_dev_dump,
 };
 
 void init_flow_filter(void)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +264 -0

270 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +3 -0
index 33de674b72..a9d31c86ea 100644
@@ -276,6 +276,9 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct
 	uint32_t size);
 const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
 	enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size);
+void hw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struct hw_db_idx *idxs,
+	uint32_t size, FILE *file);
+void hw_db_inline_dump_cfn(struct flow_nic_dev *ndev, void *db_handle, FILE *file);
 
 /**/
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +81 -0

93 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +6 -0
index e623bb2352..2c76a2c023 100644
@@ -38,6 +38,12 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev,
 	struct flow_handle *flow,
 	struct rte_flow_error *error);
 
+int flow_dev_dump_profile_inline(struct flow_eth_dev *dev,
+	struct flow_handle *flow,
+	uint16_t caller_id,
+	FILE *file,
+	struct rte_flow_error *error);
+
 int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,
 	int hsh_idx,
 	struct nt_eth_rss_conf rss_conf);
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +29 -0
index 20b5cb2835..67a24a00f1 100644
@@ -582,9 +582,38 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,
 	return flow;
 }
 
+static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,
+	struct rte_flow *flow,
+	FILE *file,
+	struct rte_flow_error *error)
+{
+	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__);
+		return -1;
+	}
+
+	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+
+	static struct rte_flow_error flow_error = {
+		.type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+
+	uint16_t caller_id = get_caller_id(eth_dev->data->port_id);
+
+	int res = flow_filter_ops->flow_dev_dump(internals->flw_dev,
+			is_flow_handle_typecast(flow) ? (void *)flow
+			: flow->flw_hdl,
+			caller_id, file, &flow_error);
+
+	convert_error(error, &flow_error);
+	return res;
+}
+
 static const struct rte_flow_ops dev_flow_ops = {
 	.create = eth_flow_create,
 	.destroy = eth_flow_destroy,
+	.dev_dump = eth_flow_dev_dump,
 };
 
 void dev_flow_init(void)
drivers/net/ntnic/ntnic_mod_reg.h +11 -0
index 27d6cbef01..cef655c5e0 100644
@@ -253,6 +253,12 @@ struct profile_inline_ops {
 		struct flow_handle *flow,
 		struct rte_flow_error *error);
 
+	int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_handle *flow,
+		uint16_t caller_id,
+		FILE *file,
+		struct rte_flow_error *error);
+
 	int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,
 		int hsh_idx,
 		struct nt_eth_rss_conf rss_conf);
@@ -284,6 +290,11 @@ struct flow_filter_ops {
 		int *rss_target_id,
 		enum flow_eth_dev_profile flow_profile,
 		uint32_t exception_path);
+	int (*flow_dev_dump)(struct flow_eth_dev *dev,
+		struct flow_handle *flow,
+		uint16_t caller_id,
+		FILE *file,
+		struct rte_flow_error *error);
 	/*
 	 * NT Flow API
 	 */
Signature · 1 line
2.45.0
#363 lore raw

PATCH v5 38/80 net/ntnic: add flow flush

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

Implements flow flush support

---
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 13 ++++++
 .../profile_inline/flow_api_profile_inline.c  | 43 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.h  |  4 ++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 38 ++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  7 +++
 5 files changed, 105 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +13 -0
index ec91d08e27..fc9c68ed1a 100644
@@ -251,6 +251,18 @@ static int flow_destroy(struct flow_eth_dev *dev __rte_unused,
 	return profile_inline_ops->flow_destroy_profile_inline(dev, flow, error);
 }
 
+static int flow_flush(struct flow_eth_dev *dev, uint16_t caller_id, struct rte_flow_error *error)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized");
+		return -1;
+	}
+
+	return profile_inline_ops->flow_flush_profile_inline(dev, caller_id, error);
+}
+
 /*
  * Device Management API
  */
@@ -1013,6 +1025,7 @@ static const struct flow_filter_ops ops = {
 	 */
 	.flow_create = flow_create,
 	.flow_destroy = flow_destroy,
+	.flow_flush = flow_flush,
 	.flow_dev_dump = flow_dev_dump,
 };
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +43 -0

55 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +4 -0
index 2c76a2c023..c695842077 100644
@@ -38,6 +38,10 @@ int flow_destroy_profile_inline(struct flow_eth_dev *dev,
 	struct flow_handle *flow,
 	struct rte_flow_error *error);
 
+int flow_flush_profile_inline(struct flow_eth_dev *dev,
+	uint16_t caller_id,
+	struct rte_flow_error *error);
+
 int flow_dev_dump_profile_inline(struct flow_eth_dev *dev,
 	struct flow_handle *flow,
 	uint16_t caller_id,
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +38 -0
index 67a24a00f1..93d89d59f3 100644
@@ -582,6 +582,43 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,
 	return flow;
 }
 
+static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized");
+		return -1;
+	}
+
+	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+
+	static struct rte_flow_error flow_error = {
+		.type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
+	int res = 0;
+	/* Main application caller_id is port_id shifted above VDPA ports */
+	uint16_t caller_id = get_caller_id(eth_dev->data->port_id);
+
+	if (internals->flw_dev) {
+		res = flow_filter_ops->flow_flush(internals->flw_dev, caller_id, &flow_error);
+		rte_spinlock_lock(&flow_lock);
+
+		for (int flow = 0; flow < MAX_RTE_FLOWS; flow++) {
+			if (nt_flows[flow].used && nt_flows[flow].caller_id == caller_id) {
+				/* Cleanup recorded flows */
+				nt_flows[flow].used = 0;
+				nt_flows[flow].caller_id = 0;
+			}
+		}
+
+		rte_spinlock_unlock(&flow_lock);
+	}
+
+	convert_error(error, &flow_error);
+
+	return res;
+}
+
 static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,
 	struct rte_flow *flow,
 	FILE *file,
@@ -613,6 +650,7 @@ static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,
 static const struct rte_flow_ops dev_flow_ops = {
 	.create = eth_flow_create,
 	.destroy = eth_flow_destroy,
+	.flush = eth_flow_flush,
 	.dev_dump = eth_flow_dev_dump,
 };
 
drivers/net/ntnic/ntnic_mod_reg.h +7 -0
index cef655c5e0..12baa13800 100644
@@ -253,6 +253,10 @@ struct profile_inline_ops {
 		struct flow_handle *flow,
 		struct rte_flow_error *error);
 
+	int (*flow_flush_profile_inline)(struct flow_eth_dev *dev,
+		uint16_t caller_id,
+		struct rte_flow_error *error);
+
 	int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev,
 		struct flow_handle *flow,
 		uint16_t caller_id,
@@ -309,6 +313,9 @@ struct flow_filter_ops {
 	int (*flow_destroy)(struct flow_eth_dev *dev,
 		struct flow_handle *flow,
 		struct rte_flow_error *error);
+
+	int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id,
+		struct rte_flow_error *error);
 };
 
 void register_dev_flow_ops(const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
#364 lore raw

PATCH v5 39/80 net/ntnic: add GMF (Generic MAC Feeder) module

In reply to Serhii Iliushyk

The Generic MAC Feeder module provides a way to feed data to the MAC modules directly from the FPGA,
rather than from host or physical ports.
The use case for this is as a test tool and is not used by NTNIC. This module is requireqd for correct initialization

---
 .../link_mgmt/link_100g/nt4ga_link_100g.c     |   8 ++
 drivers/net/ntnic/meson.build                 |   1 +
 .../net/ntnic/nthw/core/include/nthw_core.h   |   1 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |  64 +++++++++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        | 133 ++++++++++++++++++
 5 files changed, 207 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +8 -0
index 8964458b47..d8e0cad7cd 100644
@@ -404,6 +404,14 @@ static int _port_init(adapter_info_t *drv, nthw_fpga_t *fpga, int port)
 	_enable_tx(drv, mac_pcs);
 	_reset_rx(drv, mac_pcs);
 
+	/* 2.2) Nt4gaPort::setup() */
+	if (nthw_gmf_init(NULL, fpga, port) == 0) {
+		nthw_gmf_t gmf;
+
+		if (nthw_gmf_init(&gmf, fpga, port) == 0)
+			nthw_gmf_set_enable(&gmf, true);
+	}
+
 	/* Phase 3. Link state machine steps */
 
 	/* 3.1) Create NIM, ::createNim() */
drivers/net/ntnic/meson.build +1 -0
index d7e6d05556..92167d24e4 100644
@@ -38,6 +38,7 @@ sources = files(
         'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c',
         'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
         'nthw/core/nthw_fpga.c',
+        'nthw/core/nthw_gmf.c',
         'nthw/core/nthw_gpio_phy.c',
         'nthw/core/nthw_hif.c',
         'nthw/core/nthw_i2cm.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +1 -0
index fe32891712..4073f9632c 100644
@@ -17,6 +17,7 @@
 #include "nthw_iic.h"
 #include "nthw_i2cm.h"
 
+#include "nthw_gmf.h"
 #include "nthw_gpio_phy.h"
 #include "nthw_mac_pcs.h"
 #include "nthw_sdc.h"
drivers/net/ntnic/nthw/core/include/nthw_gmf.h new file +64 -0

64 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_gmf.c new file +133 -0

133 lines not on this page · raw message

Signature · 1 line
2.45.0
#365 lore raw

PATCH v5 40/80 net/ntnic: sort FPGA registers alphanumerically

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

Beatification commit. It is required for pretty supporting different FPGA

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 364 +++++++++---------
 1 file changed, 182 insertions(+), 182 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +182 -182
index 6df7208649..e076697a92 100644
@@ -270,6 +270,187 @@ static nthw_fpga_register_init_s cat_registers[] = {
 	{ CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields },
 };
 
+static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = {
+	{ DBS_RX_AM_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_am_data_fields[] = {
+	{ DBS_RX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_RX_AM_DATA_GPA, 64, 0, 0x0000 },
+	{ DBS_RX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_AM_DATA_INT, 1, 74, 0x0000 },
+	{ DBS_RX_AM_DATA_PCKED, 1, 73, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_control_fields[] = {
+	{ DBS_RX_CONTROL_AME, 1, 7, 0 }, { DBS_RX_CONTROL_AMS, 4, 8, 8 },
+	{ DBS_RX_CONTROL_LQ, 7, 0, 0 }, { DBS_RX_CONTROL_QE, 1, 17, 0 },
+	{ DBS_RX_CONTROL_UWE, 1, 12, 0 }, { DBS_RX_CONTROL_UWS, 4, 13, 5 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_dr_ctrl_fields[] = {
+	{ DBS_RX_DR_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_RX_DR_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_dr_data_fields[] = {
+	{ DBS_RX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_DR_DATA_HDR, 1, 88, 0x0000 },
+	{ DBS_RX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_DR_DATA_PCKED, 1, 87, 0x0000 },
+	{ DBS_RX_DR_DATA_QS, 15, 72, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_idle_fields[] = {
+	{ DBS_RX_IDLE_BUSY, 1, 8, 0 },
+	{ DBS_RX_IDLE_IDLE, 1, 0, 0x0000 },
+	{ DBS_RX_IDLE_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_init_fields[] = {
+	{ DBS_RX_INIT_BUSY, 1, 8, 0 },
+	{ DBS_RX_INIT_INIT, 1, 0, 0x0000 },
+	{ DBS_RX_INIT_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_init_val_fields[] = {
+	{ DBS_RX_INIT_VAL_IDX, 16, 0, 0x0000 },
+	{ DBS_RX_INIT_VAL_PTR, 15, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_ptr_fields[] = {
+	{ DBS_RX_PTR_PTR, 16, 0, 0x0000 },
+	{ DBS_RX_PTR_QUEUE, 7, 16, 0x0000 },
+	{ DBS_RX_PTR_VALID, 1, 23, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_uw_ctrl_fields[] = {
+	{ DBS_RX_UW_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_RX_UW_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_rx_uw_data_fields[] = {
+	{ DBS_RX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_UW_DATA_HID, 8, 64, 0x0000 },
+	{ DBS_RX_UW_DATA_INT, 1, 88, 0x0000 }, { DBS_RX_UW_DATA_ISTK, 1, 92, 0x0000 },
+	{ DBS_RX_UW_DATA_PCKED, 1, 87, 0x0000 }, { DBS_RX_UW_DATA_QS, 15, 72, 0x0000 },
+	{ DBS_RX_UW_DATA_VEC, 3, 89, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_am_ctrl_fields[] = {
+	{ DBS_TX_AM_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_AM_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_am_data_fields[] = {
+	{ DBS_TX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_TX_AM_DATA_GPA, 64, 0, 0x0000 },
+	{ DBS_TX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_AM_DATA_INT, 1, 74, 0x0000 },
+	{ DBS_TX_AM_DATA_PCKED, 1, 73, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_control_fields[] = {
+	{ DBS_TX_CONTROL_AME, 1, 7, 0 }, { DBS_TX_CONTROL_AMS, 4, 8, 5 },
+	{ DBS_TX_CONTROL_LQ, 7, 0, 0 }, { DBS_TX_CONTROL_QE, 1, 17, 0 },
+	{ DBS_TX_CONTROL_UWE, 1, 12, 0 }, { DBS_TX_CONTROL_UWS, 4, 13, 8 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_dr_ctrl_fields[] = {
+	{ DBS_TX_DR_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_DR_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_dr_data_fields[] = {
+	{ DBS_TX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_DR_DATA_HDR, 1, 88, 0x0000 },
+	{ DBS_TX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_DR_DATA_PCKED, 1, 87, 0x0000 },
+	{ DBS_TX_DR_DATA_PORT, 1, 89, 0x0000 }, { DBS_TX_DR_DATA_QS, 15, 72, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_idle_fields[] = {
+	{ DBS_TX_IDLE_BUSY, 1, 8, 0 },
+	{ DBS_TX_IDLE_IDLE, 1, 0, 0x0000 },
+	{ DBS_TX_IDLE_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_init_fields[] = {
+	{ DBS_TX_INIT_BUSY, 1, 8, 0 },
+	{ DBS_TX_INIT_INIT, 1, 0, 0x0000 },
+	{ DBS_TX_INIT_QUEUE, 7, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_init_val_fields[] = {
+	{ DBS_TX_INIT_VAL_IDX, 16, 0, 0x0000 },
+	{ DBS_TX_INIT_VAL_PTR, 15, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_ptr_fields[] = {
+	{ DBS_TX_PTR_PTR, 16, 0, 0x0000 },
+	{ DBS_TX_PTR_QUEUE, 7, 16, 0x0000 },
+	{ DBS_TX_PTR_VALID, 1, 23, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qos_ctrl_fields[] = {
+	{ DBS_TX_QOS_CTRL_ADR, 1, 0, 0x0000 },
+	{ DBS_TX_QOS_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qos_data_fields[] = {
+	{ DBS_TX_QOS_DATA_BS, 27, 17, 0x0000 },
+	{ DBS_TX_QOS_DATA_EN, 1, 0, 0x0000 },
+	{ DBS_TX_QOS_DATA_IR, 16, 1, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qos_rate_fields[] = {
+	{ DBS_TX_QOS_RATE_DIV, 19, 16, 2 },
+	{ DBS_TX_QOS_RATE_MUL, 16, 0, 1 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qp_ctrl_fields[] = {
+	{ DBS_TX_QP_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_QP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_qp_data_fields[] = {
+	{ DBS_TX_QP_DATA_VPORT, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_uw_ctrl_fields[] = {
+	{ DBS_TX_UW_CTRL_ADR, 7, 0, 0x0000 },
+	{ DBS_TX_UW_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s dbs_tx_uw_data_fields[] = {
+	{ DBS_TX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_UW_DATA_HID, 8, 64, 0x0000 },
+	{ DBS_TX_UW_DATA_INO, 1, 93, 0x0000 }, { DBS_TX_UW_DATA_INT, 1, 88, 0x0000 },
+	{ DBS_TX_UW_DATA_ISTK, 1, 92, 0x0000 }, { DBS_TX_UW_DATA_PCKED, 1, 87, 0x0000 },
+	{ DBS_TX_UW_DATA_QS, 15, 72, 0x0000 }, { DBS_TX_UW_DATA_VEC, 3, 89, 0x0000 },
+};
+
+static nthw_fpga_register_init_s dbs_registers[] = {
+	{ DBS_RX_AM_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_am_ctrl_fields },
+	{ DBS_RX_AM_DATA, 11, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_am_data_fields },
+	{ DBS_RX_CONTROL, 0, 18, NTHW_FPGA_REG_TYPE_RW, 43008, 6, dbs_rx_control_fields },
+	{ DBS_RX_DR_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_dr_ctrl_fields },
+	{ DBS_RX_DR_DATA, 19, 89, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_dr_data_fields },
+	{ DBS_RX_IDLE, 8, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_idle_fields },
+	{ DBS_RX_INIT, 2, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_init_fields },
+	{ DBS_RX_INIT_VAL, 3, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_init_val_fields },
+	{ DBS_RX_PTR, 4, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_ptr_fields },
+	{ DBS_RX_UW_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_uw_ctrl_fields },
+	{ DBS_RX_UW_DATA, 15, 93, NTHW_FPGA_REG_TYPE_WO, 0, 7, dbs_rx_uw_data_fields },
+	{ DBS_TX_AM_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_am_ctrl_fields },
+	{ DBS_TX_AM_DATA, 13, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_tx_am_data_fields },
+	{ DBS_TX_CONTROL, 1, 18, NTHW_FPGA_REG_TYPE_RW, 66816, 6, dbs_tx_control_fields },
+	{ DBS_TX_DR_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_dr_ctrl_fields },
+	{ DBS_TX_DR_DATA, 21, 90, NTHW_FPGA_REG_TYPE_WO, 0, 6, dbs_tx_dr_data_fields },
+	{ DBS_TX_IDLE, 9, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_idle_fields },
+	{ DBS_TX_INIT, 5, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_init_fields },
+	{ DBS_TX_INIT_VAL, 6, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_init_val_fields },
+	{ DBS_TX_PTR, 7, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_ptr_fields },
+	{ DBS_TX_QOS_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qos_ctrl_fields },
+	{ DBS_TX_QOS_DATA, 25, 44, NTHW_FPGA_REG_TYPE_WO, 0, 3, dbs_tx_qos_data_fields },
+	{ DBS_TX_QOS_RATE, 26, 35, NTHW_FPGA_REG_TYPE_RW, 131073, 2, dbs_tx_qos_rate_fields },
+	{ DBS_TX_QP_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qp_ctrl_fields },
+	{ DBS_TX_QP_DATA, 23, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, dbs_tx_qp_data_fields },
+	{ DBS_TX_UW_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_uw_ctrl_fields },
+	{ DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields },
+};
+
 static nthw_fpga_field_init_s gfg_burstsize0_fields[] = {
 	{ GFG_BURSTSIZE0_VAL, 24, 0, 0 },
 };
@@ -1541,192 +1722,11 @@ static nthw_fpga_register_init_s rst9563_registers[] = {
 	{ RST9563_STICKY, 3, 6, NTHW_FPGA_REG_TYPE_RC1, 0, 6, rst9563_sticky_fields },
 };
 
-static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = {
-	{ DBS_RX_AM_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_am_data_fields[] = {
-	{ DBS_RX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_RX_AM_DATA_GPA, 64, 0, 0x0000 },
-	{ DBS_RX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_AM_DATA_INT, 1, 74, 0x0000 },
-	{ DBS_RX_AM_DATA_PCKED, 1, 73, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_control_fields[] = {
-	{ DBS_RX_CONTROL_AME, 1, 7, 0 }, { DBS_RX_CONTROL_AMS, 4, 8, 8 },
-	{ DBS_RX_CONTROL_LQ, 7, 0, 0 }, { DBS_RX_CONTROL_QE, 1, 17, 0 },
-	{ DBS_RX_CONTROL_UWE, 1, 12, 0 }, { DBS_RX_CONTROL_UWS, 4, 13, 5 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_dr_ctrl_fields[] = {
-	{ DBS_RX_DR_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_RX_DR_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_dr_data_fields[] = {
-	{ DBS_RX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_DR_DATA_HDR, 1, 88, 0x0000 },
-	{ DBS_RX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_RX_DR_DATA_PCKED, 1, 87, 0x0000 },
-	{ DBS_RX_DR_DATA_QS, 15, 72, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_idle_fields[] = {
-	{ DBS_RX_IDLE_BUSY, 1, 8, 0 },
-	{ DBS_RX_IDLE_IDLE, 1, 0, 0x0000 },
-	{ DBS_RX_IDLE_QUEUE, 7, 1, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_init_fields[] = {
-	{ DBS_RX_INIT_BUSY, 1, 8, 0 },
-	{ DBS_RX_INIT_INIT, 1, 0, 0x0000 },
-	{ DBS_RX_INIT_QUEUE, 7, 1, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_init_val_fields[] = {
-	{ DBS_RX_INIT_VAL_IDX, 16, 0, 0x0000 },
-	{ DBS_RX_INIT_VAL_PTR, 15, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_ptr_fields[] = {
-	{ DBS_RX_PTR_PTR, 16, 0, 0x0000 },
-	{ DBS_RX_PTR_QUEUE, 7, 16, 0x0000 },
-	{ DBS_RX_PTR_VALID, 1, 23, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_uw_ctrl_fields[] = {
-	{ DBS_RX_UW_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_RX_UW_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_rx_uw_data_fields[] = {
-	{ DBS_RX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_RX_UW_DATA_HID, 8, 64, 0x0000 },
-	{ DBS_RX_UW_DATA_INT, 1, 88, 0x0000 }, { DBS_RX_UW_DATA_ISTK, 1, 92, 0x0000 },
-	{ DBS_RX_UW_DATA_PCKED, 1, 87, 0x0000 }, { DBS_RX_UW_DATA_QS, 15, 72, 0x0000 },
-	{ DBS_RX_UW_DATA_VEC, 3, 89, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_am_ctrl_fields[] = {
-	{ DBS_TX_AM_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_TX_AM_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_am_data_fields[] = {
-	{ DBS_TX_AM_DATA_ENABLE, 1, 72, 0x0000 }, { DBS_TX_AM_DATA_GPA, 64, 0, 0x0000 },
-	{ DBS_TX_AM_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_AM_DATA_INT, 1, 74, 0x0000 },
-	{ DBS_TX_AM_DATA_PCKED, 1, 73, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_control_fields[] = {
-	{ DBS_TX_CONTROL_AME, 1, 7, 0 }, { DBS_TX_CONTROL_AMS, 4, 8, 5 },
-	{ DBS_TX_CONTROL_LQ, 7, 0, 0 }, { DBS_TX_CONTROL_QE, 1, 17, 0 },
-	{ DBS_TX_CONTROL_UWE, 1, 12, 0 }, { DBS_TX_CONTROL_UWS, 4, 13, 8 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_dr_ctrl_fields[] = {
-	{ DBS_TX_DR_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_TX_DR_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_dr_data_fields[] = {
-	{ DBS_TX_DR_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_DR_DATA_HDR, 1, 88, 0x0000 },
-	{ DBS_TX_DR_DATA_HID, 8, 64, 0x0000 }, { DBS_TX_DR_DATA_PCKED, 1, 87, 0x0000 },
-	{ DBS_TX_DR_DATA_PORT, 1, 89, 0x0000 }, { DBS_TX_DR_DATA_QS, 15, 72, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_idle_fields[] = {
-	{ DBS_TX_IDLE_BUSY, 1, 8, 0 },
-	{ DBS_TX_IDLE_IDLE, 1, 0, 0x0000 },
-	{ DBS_TX_IDLE_QUEUE, 7, 1, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_init_fields[] = {
-	{ DBS_TX_INIT_BUSY, 1, 8, 0 },
-	{ DBS_TX_INIT_INIT, 1, 0, 0x0000 },
-	{ DBS_TX_INIT_QUEUE, 7, 1, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_init_val_fields[] = {
-	{ DBS_TX_INIT_VAL_IDX, 16, 0, 0x0000 },
-	{ DBS_TX_INIT_VAL_PTR, 15, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_ptr_fields[] = {
-	{ DBS_TX_PTR_PTR, 16, 0, 0x0000 },
-	{ DBS_TX_PTR_QUEUE, 7, 16, 0x0000 },
-	{ DBS_TX_PTR_VALID, 1, 23, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_qos_ctrl_fields[] = {
-	{ DBS_TX_QOS_CTRL_ADR, 1, 0, 0x0000 },
-	{ DBS_TX_QOS_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_qos_data_fields[] = {
-	{ DBS_TX_QOS_DATA_BS, 27, 17, 0x0000 },
-	{ DBS_TX_QOS_DATA_EN, 1, 0, 0x0000 },
-	{ DBS_TX_QOS_DATA_IR, 16, 1, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_qos_rate_fields[] = {
-	{ DBS_TX_QOS_RATE_DIV, 19, 16, 2 },
-	{ DBS_TX_QOS_RATE_MUL, 16, 0, 1 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_qp_ctrl_fields[] = {
-	{ DBS_TX_QP_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_TX_QP_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_qp_data_fields[] = {
-	{ DBS_TX_QP_DATA_VPORT, 1, 0, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_uw_ctrl_fields[] = {
-	{ DBS_TX_UW_CTRL_ADR, 7, 0, 0x0000 },
-	{ DBS_TX_UW_CTRL_CNT, 16, 16, 0x0000 },
-};
-
-static nthw_fpga_field_init_s dbs_tx_uw_data_fields[] = {
-	{ DBS_TX_UW_DATA_GPA, 64, 0, 0x0000 }, { DBS_TX_UW_DATA_HID, 8, 64, 0x0000 },
-	{ DBS_TX_UW_DATA_INO, 1, 93, 0x0000 }, { DBS_TX_UW_DATA_INT, 1, 88, 0x0000 },
-	{ DBS_TX_UW_DATA_ISTK, 1, 92, 0x0000 }, { DBS_TX_UW_DATA_PCKED, 1, 87, 0x0000 },
-	{ DBS_TX_UW_DATA_QS, 15, 72, 0x0000 }, { DBS_TX_UW_DATA_VEC, 3, 89, 0x0000 },
-};
-
-static nthw_fpga_register_init_s dbs_registers[] = {
-	{ DBS_RX_AM_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_am_ctrl_fields },
-	{ DBS_RX_AM_DATA, 11, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_am_data_fields },
-	{ DBS_RX_CONTROL, 0, 18, NTHW_FPGA_REG_TYPE_RW, 43008, 6, dbs_rx_control_fields },
-	{ DBS_RX_DR_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_dr_ctrl_fields },
-	{ DBS_RX_DR_DATA, 19, 89, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_rx_dr_data_fields },
-	{ DBS_RX_IDLE, 8, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_idle_fields },
-	{ DBS_RX_INIT, 2, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_init_fields },
-	{ DBS_RX_INIT_VAL, 3, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_init_val_fields },
-	{ DBS_RX_PTR, 4, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_rx_ptr_fields },
-	{ DBS_RX_UW_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_rx_uw_ctrl_fields },
-	{ DBS_RX_UW_DATA, 15, 93, NTHW_FPGA_REG_TYPE_WO, 0, 7, dbs_rx_uw_data_fields },
-	{ DBS_TX_AM_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_am_ctrl_fields },
-	{ DBS_TX_AM_DATA, 13, 75, NTHW_FPGA_REG_TYPE_WO, 0, 5, dbs_tx_am_data_fields },
-	{ DBS_TX_CONTROL, 1, 18, NTHW_FPGA_REG_TYPE_RW, 66816, 6, dbs_tx_control_fields },
-	{ DBS_TX_DR_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_dr_ctrl_fields },
-	{ DBS_TX_DR_DATA, 21, 90, NTHW_FPGA_REG_TYPE_WO, 0, 6, dbs_tx_dr_data_fields },
-	{ DBS_TX_IDLE, 9, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_idle_fields },
-	{ DBS_TX_INIT, 5, 9, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_init_fields },
-	{ DBS_TX_INIT_VAL, 6, 31, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_init_val_fields },
-	{ DBS_TX_PTR, 7, 24, NTHW_FPGA_REG_TYPE_MIXED, 0, 3, dbs_tx_ptr_fields },
-	{ DBS_TX_QOS_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qos_ctrl_fields },
-	{ DBS_TX_QOS_DATA, 25, 44, NTHW_FPGA_REG_TYPE_WO, 0, 3, dbs_tx_qos_data_fields },
-	{ DBS_TX_QOS_RATE, 26, 35, NTHW_FPGA_REG_TYPE_RW, 131073, 2, dbs_tx_qos_rate_fields },
-	{ DBS_TX_QP_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_qp_ctrl_fields },
-	{ DBS_TX_QP_DATA, 23, 1, NTHW_FPGA_REG_TYPE_WO, 0, 1, dbs_tx_qp_data_fields },
-	{ DBS_TX_UW_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, dbs_tx_uw_ctrl_fields },
-	{ DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields },
-};
-
 static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers },
+	{ MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers },
 	{ MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers },
 	{ MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers },
-	{ MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers},
 	{ MOD_GMF, 1, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9728, 12, gmf_registers },
 	{
 		MOD_GPIO_PHY, 0, MOD_GPIO_PHY, 1, 0, NTHW_FPGA_BUS_TYPE_RAB0, 16386, 2,
Signature · 1 line
2.45.0
#366 lore raw

PATCH v5 41/80 net/ntnic: add CSU module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The Checksum Update module updates the checksums of packets that has been modified in any way.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 20 ++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +19 -1
index e076697a92..efa7b306bc 100644
@@ -270,6 +270,23 @@ static nthw_fpga_register_init_s cat_registers[] = {
 	{ CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields },
 };
 
+static nthw_fpga_field_init_s csu_rcp_ctrl_fields[] = {
+	{ CSU_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ CSU_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s csu_rcp_data_fields[] = {
+	{ CSU_RCP_DATA_IL3_CMD, 2, 5, 0x0000 },
+	{ CSU_RCP_DATA_IL4_CMD, 3, 7, 0x0000 },
+	{ CSU_RCP_DATA_OL3_CMD, 2, 0, 0x0000 },
+	{ CSU_RCP_DATA_OL4_CMD, 3, 2, 0x0000 },
+};
+
+static nthw_fpga_register_init_s csu_registers[] = {
+	{ CSU_RCP_CTRL, 1, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, csu_rcp_ctrl_fields },
+	{ CSU_RCP_DATA, 2, 10, NTHW_FPGA_REG_TYPE_WO, 0, 4, csu_rcp_data_fields },
+};
+
 static nthw_fpga_field_init_s dbs_rx_am_ctrl_fields[] = {
 	{ DBS_RX_AM_CTRL_ADR, 7, 0, 0x0000 },
 	{ DBS_RX_AM_CTRL_CNT, 16, 16, 0x0000 },
@@ -1724,6 +1741,7 @@ static nthw_fpga_register_init_s rst9563_registers[] = {
 
 static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers },
+	{ MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers },
 	{ MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers },
 	{ MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers },
 	{ MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers },
@@ -1919,5 +1937,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 22, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 23, fpga_modules,
 };
Signature · 1 line
2.45.0
#367 lore raw

PATCH v5 42/80 net/ntnic: add FLM module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The Flow Matcher module is a high-performance stateful SDRAM lookup and programming engine which supported exact match lookup in line-rate of up to hundreds of millions of flows.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 286 +++++++++++++++++-
 1 file changed, 284 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +284 -2
index efa7b306bc..739cabfb1c 100644
@@ -468,6 +468,288 @@ static nthw_fpga_register_init_s dbs_registers[] = {
 	{ DBS_TX_UW_DATA, 17, 94, NTHW_FPGA_REG_TYPE_WO, 0, 8, dbs_tx_uw_data_fields },
 };
 
+static nthw_fpga_field_init_s flm_buf_ctrl_fields[] = {
+	{ FLM_BUF_CTRL_INF_AVAIL, 16, 16, 0x0000 },
+	{ FLM_BUF_CTRL_LRN_FREE, 16, 0, 0x0000 },
+	{ FLM_BUF_CTRL_STA_AVAIL, 16, 32, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_control_fields[] = {
+	{ FLM_CONTROL_CALIB_RECALIBRATE, 3, 28, 0 },
+	{ FLM_CONTROL_CRCRD, 1, 12, 0x0000 },
+	{ FLM_CONTROL_CRCWR, 1, 11, 0x0000 },
+	{ FLM_CONTROL_EAB, 5, 18, 0 },
+	{ FLM_CONTROL_ENABLE, 1, 0, 0 },
+	{ FLM_CONTROL_INIT, 1, 1, 0x0000 },
+	{ FLM_CONTROL_LDS, 1, 2, 0x0000 },
+	{ FLM_CONTROL_LFS, 1, 3, 0x0000 },
+	{ FLM_CONTROL_LIS, 1, 4, 0x0000 },
+	{ FLM_CONTROL_PDS, 1, 9, 0x0000 },
+	{ FLM_CONTROL_PIS, 1, 10, 0x0000 },
+	{ FLM_CONTROL_RBL, 4, 13, 0 },
+	{ FLM_CONTROL_RDS, 1, 7, 0x0000 },
+	{ FLM_CONTROL_RIS, 1, 8, 0x0000 },
+	{ FLM_CONTROL_SPLIT_SDRAM_USAGE, 5, 23, 16 },
+	{ FLM_CONTROL_UDS, 1, 5, 0x0000 },
+	{ FLM_CONTROL_UIS, 1, 6, 0x0000 },
+	{ FLM_CONTROL_WPD, 1, 17, 0 },
+};
+
+static nthw_fpga_field_init_s flm_inf_data_fields[] = {
+	{ FLM_INF_DATA_BYTES, 64, 0, 0x0000 }, { FLM_INF_DATA_CAUSE, 3, 224, 0x0000 },
+	{ FLM_INF_DATA_EOR, 1, 287, 0x0000 }, { FLM_INF_DATA_ID, 32, 192, 0x0000 },
+	{ FLM_INF_DATA_PACKETS, 64, 64, 0x0000 }, { FLM_INF_DATA_TS, 64, 128, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_load_aps_fields[] = {
+	{ FLM_LOAD_APS_APS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_load_bin_fields[] = {
+	{ FLM_LOAD_BIN_BIN, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_load_lps_fields[] = {
+	{ FLM_LOAD_LPS_LPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_lrn_data_fields[] = {
+	{ FLM_LRN_DATA_ADJ, 32, 480, 0x0000 }, { FLM_LRN_DATA_COLOR, 32, 448, 0x0000 },
+	{ FLM_LRN_DATA_DSCP, 6, 698, 0x0000 }, { FLM_LRN_DATA_ENT, 1, 693, 0x0000 },
+	{ FLM_LRN_DATA_EOR, 1, 767, 0x0000 }, { FLM_LRN_DATA_FILL, 16, 544, 0x0000 },
+	{ FLM_LRN_DATA_FT, 4, 560, 0x0000 }, { FLM_LRN_DATA_FT_MBR, 4, 564, 0x0000 },
+	{ FLM_LRN_DATA_FT_MISS, 4, 568, 0x0000 }, { FLM_LRN_DATA_ID, 32, 512, 0x0000 },
+	{ FLM_LRN_DATA_KID, 8, 328, 0x0000 }, { FLM_LRN_DATA_MBR_ID1, 28, 572, 0x0000 },
+	{ FLM_LRN_DATA_MBR_ID2, 28, 600, 0x0000 }, { FLM_LRN_DATA_MBR_ID3, 28, 628, 0x0000 },
+	{ FLM_LRN_DATA_MBR_ID4, 28, 656, 0x0000 }, { FLM_LRN_DATA_NAT_EN, 1, 711, 0x0000 },
+	{ FLM_LRN_DATA_NAT_IP, 32, 336, 0x0000 }, { FLM_LRN_DATA_NAT_PORT, 16, 400, 0x0000 },
+	{ FLM_LRN_DATA_NOFI, 1, 716, 0x0000 }, { FLM_LRN_DATA_OP, 4, 694, 0x0000 },
+	{ FLM_LRN_DATA_PRIO, 2, 691, 0x0000 }, { FLM_LRN_DATA_PROT, 8, 320, 0x0000 },
+	{ FLM_LRN_DATA_QFI, 6, 704, 0x0000 }, { FLM_LRN_DATA_QW0, 128, 192, 0x0000 },
+	{ FLM_LRN_DATA_QW4, 128, 64, 0x0000 }, { FLM_LRN_DATA_RATE, 16, 416, 0x0000 },
+	{ FLM_LRN_DATA_RQI, 1, 710, 0x0000 },
+	{ FLM_LRN_DATA_SIZE, 16, 432, 0x0000 }, { FLM_LRN_DATA_STAT_PROF, 4, 687, 0x0000 },
+	{ FLM_LRN_DATA_SW8, 32, 32, 0x0000 }, { FLM_LRN_DATA_SW9, 32, 0, 0x0000 },
+	{ FLM_LRN_DATA_TEID, 32, 368, 0x0000 }, { FLM_LRN_DATA_VOL_IDX, 3, 684, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_prio_fields[] = {
+	{ FLM_PRIO_FT0, 4, 4, 1 }, { FLM_PRIO_FT1, 4, 12, 1 }, { FLM_PRIO_FT2, 4, 20, 1 },
+	{ FLM_PRIO_FT3, 4, 28, 1 }, { FLM_PRIO_LIMIT0, 4, 0, 0 }, { FLM_PRIO_LIMIT1, 4, 8, 0 },
+	{ FLM_PRIO_LIMIT2, 4, 16, 0 }, { FLM_PRIO_LIMIT3, 4, 24, 0 },
+};
+
+static nthw_fpga_field_init_s flm_pst_ctrl_fields[] = {
+	{ FLM_PST_CTRL_ADR, 4, 0, 0x0000 },
+	{ FLM_PST_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_pst_data_fields[] = {
+	{ FLM_PST_DATA_BP, 5, 0, 0x0000 },
+	{ FLM_PST_DATA_PP, 5, 5, 0x0000 },
+	{ FLM_PST_DATA_TP, 5, 10, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_rcp_ctrl_fields[] = {
+	{ FLM_RCP_CTRL_ADR, 5, 0, 0x0000 },
+	{ FLM_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_rcp_data_fields[] = {
+	{ FLM_RCP_DATA_AUTO_IPV4_MASK, 1, 402, 0x0000 },
+	{ FLM_RCP_DATA_BYT_DYN, 5, 387, 0x0000 },
+	{ FLM_RCP_DATA_BYT_OFS, 8, 392, 0x0000 },
+	{ FLM_RCP_DATA_IPN, 1, 386, 0x0000 },
+	{ FLM_RCP_DATA_KID, 8, 377, 0x0000 },
+	{ FLM_RCP_DATA_LOOKUP, 1, 0, 0x0000 },
+	{ FLM_RCP_DATA_MASK, 320, 57, 0x0000 },
+	{ FLM_RCP_DATA_OPN, 1, 385, 0x0000 },
+	{ FLM_RCP_DATA_QW0_DYN, 5, 1, 0x0000 },
+	{ FLM_RCP_DATA_QW0_OFS, 8, 6, 0x0000 },
+	{ FLM_RCP_DATA_QW0_SEL, 2, 14, 0x0000 },
+	{ FLM_RCP_DATA_QW4_DYN, 5, 16, 0x0000 },
+	{ FLM_RCP_DATA_QW4_OFS, 8, 21, 0x0000 },
+	{ FLM_RCP_DATA_SW8_DYN, 5, 29, 0x0000 },
+	{ FLM_RCP_DATA_SW8_OFS, 8, 34, 0x0000 },
+	{ FLM_RCP_DATA_SW8_SEL, 2, 42, 0x0000 },
+	{ FLM_RCP_DATA_SW9_DYN, 5, 44, 0x0000 },
+	{ FLM_RCP_DATA_SW9_OFS, 8, 49, 0x0000 },
+	{ FLM_RCP_DATA_TXPLM, 2, 400, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_scan_fields[] = {
+	{ FLM_SCAN_I, 16, 0, 0 },
+};
+
+static nthw_fpga_field_init_s flm_status_fields[] = {
+	{ FLM_STATUS_CACHE_BUFFER_CRITICAL, 1, 12, 0x0000 },
+	{ FLM_STATUS_CALIB_FAIL, 3, 3, 0 },
+	{ FLM_STATUS_CALIB_SUCCESS, 3, 0, 0 },
+	{ FLM_STATUS_CRCERR, 1, 10, 0x0000 },
+	{ FLM_STATUS_CRITICAL, 1, 8, 0x0000 },
+	{ FLM_STATUS_EFT_BP, 1, 11, 0x0000 },
+	{ FLM_STATUS_IDLE, 1, 7, 0x0000 },
+	{ FLM_STATUS_INITDONE, 1, 6, 0x0000 },
+	{ FLM_STATUS_PANIC, 1, 9, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_aul_done_fields[] = {
+	{ FLM_STAT_AUL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_aul_fail_fields[] = {
+	{ FLM_STAT_AUL_FAIL_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_aul_ignore_fields[] = {
+	{ FLM_STAT_AUL_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_csh_hit_fields[] = {
+	{ FLM_STAT_CSH_HIT_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_csh_miss_fields[] = {
+	{ FLM_STAT_CSH_MISS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_csh_unh_fields[] = {
+	{ FLM_STAT_CSH_UNH_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_cuc_move_fields[] = {
+	{ FLM_STAT_CUC_MOVE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_cuc_start_fields[] = {
+	{ FLM_STAT_CUC_START_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_flows_fields[] = {
+	{ FLM_STAT_FLOWS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_inf_done_fields[] = {
+	{ FLM_STAT_INF_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_inf_skip_fields[] = {
+	{ FLM_STAT_INF_SKIP_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_lrn_done_fields[] = {
+	{ FLM_STAT_LRN_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_lrn_fail_fields[] = {
+	{ FLM_STAT_LRN_FAIL_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_lrn_ignore_fields[] = {
+	{ FLM_STAT_LRN_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_dis_fields[] = {
+	{ FLM_STAT_PCK_DIS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_hit_fields[] = {
+	{ FLM_STAT_PCK_HIT_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_miss_fields[] = {
+	{ FLM_STAT_PCK_MISS_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_pck_unh_fields[] = {
+	{ FLM_STAT_PCK_UNH_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_prb_done_fields[] = {
+	{ FLM_STAT_PRB_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_prb_ignore_fields[] = {
+	{ FLM_STAT_PRB_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_rel_done_fields[] = {
+	{ FLM_STAT_REL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_rel_ignore_fields[] = {
+	{ FLM_STAT_REL_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_sta_done_fields[] = {
+	{ FLM_STAT_STA_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_tul_done_fields[] = {
+	{ FLM_STAT_TUL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_unl_done_fields[] = {
+	{ FLM_STAT_UNL_DONE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_stat_unl_ignore_fields[] = {
+	{ FLM_STAT_UNL_IGNORE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_sta_data_fields[] = {
+	{ FLM_STA_DATA_EOR, 1, 95, 0x0000 }, { FLM_STA_DATA_ID, 32, 0, 0x0000 },
+	{ FLM_STA_DATA_LDS, 1, 32, 0x0000 }, { FLM_STA_DATA_LFS, 1, 33, 0x0000 },
+	{ FLM_STA_DATA_LIS, 1, 34, 0x0000 }, { FLM_STA_DATA_PDS, 1, 39, 0x0000 },
+	{ FLM_STA_DATA_PIS, 1, 40, 0x0000 }, { FLM_STA_DATA_RDS, 1, 37, 0x0000 },
+	{ FLM_STA_DATA_RIS, 1, 38, 0x0000 }, { FLM_STA_DATA_UDS, 1, 35, 0x0000 },
+	{ FLM_STA_DATA_UIS, 1, 36, 0x0000 },
+};
+
+static nthw_fpga_register_init_s flm_registers[] = {
+	{ FLM_BUF_CTRL, 14, 48, NTHW_FPGA_REG_TYPE_RW, 0, 3, flm_buf_ctrl_fields },
+	{ FLM_CONTROL, 0, 31, NTHW_FPGA_REG_TYPE_MIXED, 134217728, 18, flm_control_fields },
+	{ FLM_INF_DATA, 16, 288, NTHW_FPGA_REG_TYPE_RO, 0, 6, flm_inf_data_fields },
+	{ FLM_LOAD_APS, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_load_aps_fields },
+	{ FLM_LOAD_BIN, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_load_bin_fields },
+	{ FLM_LOAD_LPS, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_load_lps_fields },
+	{ FLM_LRN_DATA, 15, 768, NTHW_FPGA_REG_TYPE_WO, 0, 34, flm_lrn_data_fields },
+	{ FLM_PRIO, 6, 32, NTHW_FPGA_REG_TYPE_WO, 269488144, 8, flm_prio_fields },
+	{ FLM_PST_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_pst_ctrl_fields },
+	{ FLM_PST_DATA, 13, 15, NTHW_FPGA_REG_TYPE_WO, 0, 3, flm_pst_data_fields },
+	{ FLM_RCP_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_rcp_ctrl_fields },
+	{ FLM_RCP_DATA, 9, 403, NTHW_FPGA_REG_TYPE_WO, 0, 19, flm_rcp_data_fields },
+	{ FLM_SCAN, 2, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_scan_fields },
+	{ FLM_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_MIXED, 0, 9, flm_status_fields },
+	{ FLM_STAT_AUL_DONE, 41, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_done_fields },
+	{ FLM_STAT_AUL_FAIL, 43, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_fail_fields },
+	{ FLM_STAT_AUL_IGNORE, 42, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_ignore_fields },
+	{ FLM_STAT_CSH_HIT, 52, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_csh_hit_fields },
+	{ FLM_STAT_CSH_MISS, 53, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_csh_miss_fields },
+	{ FLM_STAT_CSH_UNH, 54, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_csh_unh_fields },
+	{ FLM_STAT_CUC_MOVE, 56, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_cuc_move_fields },
+	{ FLM_STAT_CUC_START, 55, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_cuc_start_fields },
+	{ FLM_STAT_FLOWS, 18, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_flows_fields },
+	{ FLM_STAT_INF_DONE, 46, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_inf_done_fields },
+	{ FLM_STAT_INF_SKIP, 47, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_inf_skip_fields },
+	{ FLM_STAT_LRN_DONE, 32, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_lrn_done_fields },
+	{ FLM_STAT_LRN_FAIL, 34, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_lrn_fail_fields },
+	{ FLM_STAT_LRN_IGNORE, 33, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_lrn_ignore_fields },
+	{ FLM_STAT_PCK_DIS, 51, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_dis_fields },
+	{ FLM_STAT_PCK_HIT, 48, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_hit_fields },
+	{ FLM_STAT_PCK_MISS, 49, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_miss_fields },
+	{ FLM_STAT_PCK_UNH, 50, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_pck_unh_fields },
+	{ FLM_STAT_PRB_DONE, 39, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_prb_done_fields },
+	{ FLM_STAT_PRB_IGNORE, 40, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_prb_ignore_fields },
+	{ FLM_STAT_REL_DONE, 37, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_rel_done_fields },
+	{ FLM_STAT_REL_IGNORE, 38, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_rel_ignore_fields },
+	{ FLM_STAT_STA_DONE, 45, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_sta_done_fields },
+	{ FLM_STAT_TUL_DONE, 44, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_tul_done_fields },
+	{ FLM_STAT_UNL_DONE, 35, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_unl_done_fields },
+	{ FLM_STAT_UNL_IGNORE, 36, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_unl_ignore_fields },
+	{ FLM_STA_DATA, 17, 96, NTHW_FPGA_REG_TYPE_RO, 0, 11, flm_sta_data_fields },
+};
+
 static nthw_fpga_field_init_s gfg_burstsize0_fields[] = {
 	{ GFG_BURSTSIZE0_VAL, 24, 0, 0 },
 };
@@ -1743,6 +2025,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers },
 	{ MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers },
 	{ MOD_DBS, 0, MOD_DBS, 0, 11, NTHW_FPGA_BUS_TYPE_RAB2, 12832, 27, dbs_registers },
+	{ MOD_FLM, 0, MOD_FLM, 0, 25, NTHW_FPGA_BUS_TYPE_RAB1, 1280, 43, flm_registers },
 	{ MOD_GFG, 0, MOD_GFG, 1, 1, NTHW_FPGA_BUS_TYPE_RAB2, 8704, 10, gfg_registers },
 	{ MOD_GMF, 0, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9216, 12, gmf_registers },
 	{ MOD_GMF, 1, MOD_GMF, 2, 5, NTHW_FPGA_BUS_TYPE_RAB2, 9728, 12, gmf_registers },
@@ -1817,7 +2100,6 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 	{ NT_FLM_PRESENT, 1 },
 	{ NT_FLM_PRIOS, 4 },
 	{ NT_FLM_PST_PROFILES, 16 },
-	{ NT_FLM_SCRUB_PROFILES, 16 },
 	{ NT_FLM_SIZE_MB, 12288 },
 	{ NT_FLM_STATEFUL, 1 },
 	{ NT_FLM_VARIANT, 2 },
@@ -1937,5 +2219,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 23, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 24, fpga_modules,
 };
Signature · 1 line
2.45.0
#368 lore raw

PATCH v5 43/80 net/ntnic: add HFU module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The Header Field Update module updates protocol fields if the packets have been changed,
for example length fields and next protocol fields.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 38 ++++++++++++++++++-
 1 file changed, 37 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +37 -1
index 739cabfb1c..82068746b3 100644
@@ -919,6 +919,41 @@ static nthw_fpga_register_init_s gpio_phy_registers[] = {
 	{ GPIO_PHY_GPIO, 1, 10, NTHW_FPGA_REG_TYPE_RW, 17, 10, gpio_phy_gpio_fields },
 };
 
+static nthw_fpga_field_init_s hfu_rcp_ctrl_fields[] = {
+	{ HFU_RCP_CTRL_ADR, 6, 0, 0x0000 },
+	{ HFU_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s hfu_rcp_data_fields[] = {
+	{ HFU_RCP_DATA_LEN_A_ADD_DYN, 5, 15, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_ADD_OFS, 8, 20, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_OL4LEN, 1, 1, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_POS_DYN, 5, 2, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_POS_OFS, 8, 7, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_SUB_DYN, 5, 28, 0x0000 },
+	{ HFU_RCP_DATA_LEN_A_WR, 1, 0, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_ADD_DYN, 5, 47, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_ADD_OFS, 8, 52, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_POS_DYN, 5, 34, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_POS_OFS, 8, 39, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_SUB_DYN, 5, 60, 0x0000 },
+	{ HFU_RCP_DATA_LEN_B_WR, 1, 33, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_ADD_DYN, 5, 79, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_ADD_OFS, 8, 84, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_POS_DYN, 5, 66, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_POS_OFS, 8, 71, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_SUB_DYN, 5, 92, 0x0000 },
+	{ HFU_RCP_DATA_LEN_C_WR, 1, 65, 0x0000 },
+	{ HFU_RCP_DATA_TTL_POS_DYN, 5, 98, 0x0000 },
+	{ HFU_RCP_DATA_TTL_POS_OFS, 8, 103, 0x0000 },
+	{ HFU_RCP_DATA_TTL_WR, 1, 97, 0x0000 },
+};
+
+static nthw_fpga_register_init_s hfu_registers[] = {
+	{ HFU_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, hfu_rcp_ctrl_fields },
+	{ HFU_RCP_DATA, 1, 111, NTHW_FPGA_REG_TYPE_WO, 0, 22, hfu_rcp_data_fields },
+};
+
 static nthw_fpga_field_init_s hif_build_time_fields[] = {
 	{ HIF_BUILD_TIME_TIME, 32, 0, 1726740521 },
 };
@@ -2033,6 +2068,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 		MOD_GPIO_PHY, 0, MOD_GPIO_PHY, 1, 0, NTHW_FPGA_BUS_TYPE_RAB0, 16386, 2,
 		gpio_phy_registers
 	},
+	{ MOD_HFU, 0, MOD_HFU, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 9472, 2, hfu_registers },
 	{ MOD_HIF, 0, MOD_HIF, 0, 0, NTHW_FPGA_BUS_TYPE_PCI, 0, 18, hif_registers },
 	{ MOD_HSH, 0, MOD_HSH, 0, 5, NTHW_FPGA_BUS_TYPE_RAB1, 1536, 2, hsh_registers },
 	{ MOD_IIC, 0, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 768, 22, iic_registers },
@@ -2219,5 +2255,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 24, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 25, fpga_modules,
 };
Signature · 1 line
2.45.0
#369 lore raw

PATCH v5 44/80 net/ntnic: add IFR module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The IP Fragmenter module can fragment outgoing packets based on a programmable MTU.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 41 ++++++++++++++++++-
 1 file changed, 40 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +40 -1
index 82068746b3..509e1f6860 100644
@@ -1095,6 +1095,44 @@ static nthw_fpga_register_init_s hsh_registers[] = {
 	{ HSH_RCP_DATA, 1, 743, NTHW_FPGA_REG_TYPE_WO, 0, 23, hsh_rcp_data_fields },
 };
 
+static nthw_fpga_field_init_s ifr_counters_ctrl_fields[] = {
+	{ IFR_COUNTERS_CTRL_ADR, 4, 0, 0x0000 },
+	{ IFR_COUNTERS_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_counters_data_fields[] = {
+	{ IFR_COUNTERS_DATA_DROP, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_df_buf_ctrl_fields[] = {
+	{ IFR_DF_BUF_CTRL_AVAILABLE, 11, 0, 0x0000 },
+	{ IFR_DF_BUF_CTRL_MTU_PROFILE, 16, 11, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_df_buf_data_fields[] = {
+	{ IFR_DF_BUF_DATA_FIFO_DAT, 128, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_rcp_ctrl_fields[] = {
+	{ IFR_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ IFR_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ifr_rcp_data_fields[] = {
+	{ IFR_RCP_DATA_IPV4_DF_DROP, 1, 17, 0x0000 }, { IFR_RCP_DATA_IPV4_EN, 1, 0, 0x0000 },
+	{ IFR_RCP_DATA_IPV6_DROP, 1, 16, 0x0000 }, { IFR_RCP_DATA_IPV6_EN, 1, 1, 0x0000 },
+	{ IFR_RCP_DATA_MTU, 14, 2, 0x0000 },
+};
+
+static nthw_fpga_register_init_s ifr_registers[] = {
+	{ IFR_COUNTERS_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, ifr_counters_ctrl_fields },
+	{ IFR_COUNTERS_DATA, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, ifr_counters_data_fields },
+	{ IFR_DF_BUF_CTRL, 2, 27, NTHW_FPGA_REG_TYPE_RO, 0, 2, ifr_df_buf_ctrl_fields },
+	{ IFR_DF_BUF_DATA, 3, 128, NTHW_FPGA_REG_TYPE_RO, 0, 1, ifr_df_buf_data_fields },
+	{ IFR_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, ifr_rcp_ctrl_fields },
+	{ IFR_RCP_DATA, 1, 18, NTHW_FPGA_REG_TYPE_WO, 0, 5, ifr_rcp_data_fields },
+};
+
 static nthw_fpga_field_init_s iic_adr_fields[] = {
 	{ IIC_ADR_SLV_ADR, 7, 1, 0 },
 };
@@ -2071,6 +2109,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_HFU, 0, MOD_HFU, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 9472, 2, hfu_registers },
 	{ MOD_HIF, 0, MOD_HIF, 0, 0, NTHW_FPGA_BUS_TYPE_PCI, 0, 18, hif_registers },
 	{ MOD_HSH, 0, MOD_HSH, 0, 5, NTHW_FPGA_BUS_TYPE_RAB1, 1536, 2, hsh_registers },
+	{ MOD_IFR, 0, MOD_IFR, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 9984, 6, ifr_registers },
 	{ MOD_IIC, 0, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 768, 22, iic_registers },
 	{ MOD_IIC, 1, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 896, 22, iic_registers },
 	{ MOD_IIC, 2, MOD_IIC, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 24832, 22, iic_registers },
@@ -2255,5 +2294,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 25, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 26, fpga_modules,
 };
Signature · 1 line
2.45.0
#370 lore raw

PATCH v5 45/80 net/ntnic: add MAC Rx module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The IP Fragmenter module can fragment outgoing packets based on a programmable MTU.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 61 ++++++++++++++++++-
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |  3 +-
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |  1 +
 .../supported/nthw_fpga_reg_defs_mac_rx.h     | 29 +++++++++
 4 files changed, 92 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +60 -1
index 509e1f6860..eecd6342c0 100644
@@ -1774,6 +1774,63 @@ static nthw_fpga_register_init_s mac_pcs_registers[] = {
 	},
 };
 
+static nthw_fpga_field_init_s mac_rx_bad_fcs_fields[] = {
+	{ MAC_RX_BAD_FCS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_fragment_fields[] = {
+	{ MAC_RX_FRAGMENT_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_packet_bad_fcs_fields[] = {
+	{ MAC_RX_PACKET_BAD_FCS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_packet_small_fields[] = {
+	{ MAC_RX_PACKET_SMALL_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_bytes_fields[] = {
+	{ MAC_RX_TOTAL_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_good_bytes_fields[] = {
+	{ MAC_RX_TOTAL_GOOD_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_good_packets_fields[] = {
+	{ MAC_RX_TOTAL_GOOD_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_total_packets_fields[] = {
+	{ MAC_RX_TOTAL_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_rx_undersize_fields[] = {
+	{ MAC_RX_UNDERSIZE_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s mac_rx_registers[] = {
+	{ MAC_RX_BAD_FCS, 0, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_bad_fcs_fields },
+	{ MAC_RX_FRAGMENT, 6, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_fragment_fields },
+	{
+		MAC_RX_PACKET_BAD_FCS, 7, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_rx_packet_bad_fcs_fields
+	},
+	{ MAC_RX_PACKET_SMALL, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_packet_small_fields },
+	{ MAC_RX_TOTAL_BYTES, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_total_bytes_fields },
+	{
+		MAC_RX_TOTAL_GOOD_BYTES, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_rx_total_good_bytes_fields
+	},
+	{
+		MAC_RX_TOTAL_GOOD_PACKETS, 2, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_rx_total_good_packets_fields
+	},
+	{ MAC_RX_TOTAL_PACKETS, 1, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_total_packets_fields },
+	{ MAC_RX_UNDERSIZE, 8, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_undersize_fields },
+};
+
 static nthw_fpga_field_init_s pci_rd_tg_tg_ctrl_fields[] = {
 	{ PCI_RD_TG_TG_CTRL_TG_RD_RDY, 1, 0, 0 },
 };
@@ -2123,6 +2180,8 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 		MOD_MAC_PCS, 1, MOD_MAC_PCS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB2, 11776, 44,
 		mac_pcs_registers
 	},
+	{ MOD_MAC_RX, 0, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 10752, 9, mac_rx_registers },
+	{ MOD_MAC_RX, 1, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 12288, 9, mac_rx_registers },
 	{
 		MOD_PCI_RD_TG, 0, MOD_PCI_RD_TG, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 2320, 6,
 		pci_rd_tg_registers
@@ -2294,5 +2353,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 26, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 28, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
index b6be02f45e..5983ba7095 100644
@@ -29,6 +29,7 @@
 #define MOD_IIC (0x7629cddbUL)
 #define MOD_KM (0xcfbd9dbeUL)
 #define MOD_MAC_PCS (0x7abe24c7UL)
+#define MOD_MAC_RX (0x6347b490UL)
 #define MOD_PCIE3 (0xfbc48c18UL)
 #define MOD_PCI_RD_TG (0x9ad9eed2UL)
 #define MOD_PCI_WR_TG (0x274b69e1UL)
@@ -43,7 +44,7 @@
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
-#define MOD_IDX_COUNT (14)
+#define MOD_IDX_COUNT (31)
 
 /* aliases - only aliases go below this point */
 #endif	/* _NTHW_FPGA_MOD_DEFS_H_ */
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
index 3560eeda7d..5ebbec6c7e 100644
@@ -30,6 +30,7 @@
 #include "nthw_fpga_reg_defs_ins.h"
 #include "nthw_fpga_reg_defs_km.h"
 #include "nthw_fpga_reg_defs_mac_pcs.h"
+#include "nthw_fpga_reg_defs_mac_rx.h"
 #include "nthw_fpga_reg_defs_pcie3.h"
 #include "nthw_fpga_reg_defs_pci_rd_tg.h"
 #include "nthw_fpga_reg_defs_pci_wr_tg.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h new file +29 -0
new file mode 100644
index 0000000000..3829c10f3b
@@ -0,0 +1,29 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_REG_DEFS_MAC_RX_
+#define _NTHW_FPGA_REG_DEFS_MAC_RX_
+
+/* MAC_RX */
+#define MAC_RX_BAD_FCS (0xca07f618UL)
+#define MAC_RX_BAD_FCS_COUNT (0x11d5ba0eUL)
+#define MAC_RX_FRAGMENT (0x5363b736UL)
+#define MAC_RX_FRAGMENT_COUNT (0xf664c9aUL)
+#define MAC_RX_PACKET_BAD_FCS (0x4cb8b34cUL)
+#define MAC_RX_PACKET_BAD_FCS_COUNT (0xb6701e28UL)
+#define MAC_RX_PACKET_SMALL (0xed318a65UL)
+#define MAC_RX_PACKET_SMALL_COUNT (0x72095ec7UL)
+#define MAC_RX_TOTAL_BYTES (0x831313e2UL)
+#define MAC_RX_TOTAL_BYTES_COUNT (0xe5d8be59UL)
+#define MAC_RX_TOTAL_GOOD_BYTES (0x912c2d1cUL)
+#define MAC_RX_TOTAL_GOOD_BYTES_COUNT (0x63bb5f3eUL)
+#define MAC_RX_TOTAL_GOOD_PACKETS (0xfbb4f497UL)
+#define MAC_RX_TOTAL_GOOD_PACKETS_COUNT (0xae9d21b0UL)
+#define MAC_RX_TOTAL_PACKETS (0xb0ea3730UL)
+#define MAC_RX_TOTAL_PACKETS_COUNT (0x532c885dUL)
+#define MAC_RX_UNDERSIZE (0xb6fa4bdbUL)
+#define MAC_RX_UNDERSIZE_COUNT (0x471945ffUL)
+
+#endif	/* _NTHW_FPGA_REG_DEFS_MAC_RX_ */
Signature · 1 line
2.45.0
#371 lore raw

PATCH v5 46/80 net/ntnic: add MAC Tx module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The Media Access Control Transmit module contains counters that keep track on transmitted packets.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 38 ++++++++++++++++++-
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |  3 +-
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |  1 +
 .../supported/nthw_fpga_reg_defs_mac_tx.h     | 21 ++++++++++
 4 files changed, 61 insertions(+), 2 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +37 -1
index eecd6342c0..7a2f5aec32 100644
@@ -1831,6 +1831,40 @@ static nthw_fpga_register_init_s mac_rx_registers[] = {
 	{ MAC_RX_UNDERSIZE, 8, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_rx_undersize_fields },
 };
 
+static nthw_fpga_field_init_s mac_tx_packet_small_fields[] = {
+	{ MAC_TX_PACKET_SMALL_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_bytes_fields[] = {
+	{ MAC_TX_TOTAL_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_good_bytes_fields[] = {
+	{ MAC_TX_TOTAL_GOOD_BYTES_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_good_packets_fields[] = {
+	{ MAC_TX_TOTAL_GOOD_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s mac_tx_total_packets_fields[] = {
+	{ MAC_TX_TOTAL_PACKETS_COUNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s mac_tx_registers[] = {
+	{ MAC_TX_PACKET_SMALL, 2, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_tx_packet_small_fields },
+	{ MAC_TX_TOTAL_BYTES, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_tx_total_bytes_fields },
+	{
+		MAC_TX_TOTAL_GOOD_BYTES, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_tx_total_good_bytes_fields
+	},
+	{
+		MAC_TX_TOTAL_GOOD_PACKETS, 1, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1,
+		mac_tx_total_good_packets_fields
+	},
+	{ MAC_TX_TOTAL_PACKETS, 0, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, mac_tx_total_packets_fields },
+};
+
 static nthw_fpga_field_init_s pci_rd_tg_tg_ctrl_fields[] = {
 	{ PCI_RD_TG_TG_CTRL_TG_RD_RDY, 1, 0, 0 },
 };
@@ -2182,6 +2216,8 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	},
 	{ MOD_MAC_RX, 0, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 10752, 9, mac_rx_registers },
 	{ MOD_MAC_RX, 1, MOD_MAC_RX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 12288, 9, mac_rx_registers },
+	{ MOD_MAC_TX, 0, MOD_MAC_TX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 11264, 5, mac_tx_registers },
+	{ MOD_MAC_TX, 1, MOD_MAC_TX, 0, 0, NTHW_FPGA_BUS_TYPE_RAB2, 12800, 5, mac_tx_registers },
 	{
 		MOD_PCI_RD_TG, 0, MOD_PCI_RD_TG, 0, 1, NTHW_FPGA_BUS_TYPE_RAB0, 2320, 6,
 		pci_rd_tg_registers
@@ -2353,5 +2389,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 28, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 30, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
index 5983ba7095..f4a913f3d2 100644
@@ -30,6 +30,7 @@
 #define MOD_KM (0xcfbd9dbeUL)
 #define MOD_MAC_PCS (0x7abe24c7UL)
 #define MOD_MAC_RX (0x6347b490UL)
+#define MOD_MAC_TX (0x351d1316UL)
 #define MOD_PCIE3 (0xfbc48c18UL)
 #define MOD_PCI_RD_TG (0x9ad9eed2UL)
 #define MOD_PCI_WR_TG (0x274b69e1UL)
@@ -44,7 +45,7 @@
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
-#define MOD_IDX_COUNT (31)
+#define MOD_IDX_COUNT (32)
 
 /* aliases - only aliases go below this point */
 #endif	/* _NTHW_FPGA_MOD_DEFS_H_ */
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
index 5ebbec6c7e..7741aa563f 100644
@@ -31,6 +31,7 @@
 #include "nthw_fpga_reg_defs_km.h"
 #include "nthw_fpga_reg_defs_mac_pcs.h"
 #include "nthw_fpga_reg_defs_mac_rx.h"
+#include "nthw_fpga_reg_defs_mac_tx.h"
 #include "nthw_fpga_reg_defs_pcie3.h"
 #include "nthw_fpga_reg_defs_pci_rd_tg.h"
 #include "nthw_fpga_reg_defs_pci_wr_tg.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h new file +21 -0
new file mode 100644
index 0000000000..6a77d449ae
@@ -0,0 +1,21 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_REG_DEFS_MAC_TX_
+#define _NTHW_FPGA_REG_DEFS_MAC_TX_
+
+/* MAC_TX */
+#define MAC_TX_PACKET_SMALL (0xcfcb5e97UL)
+#define MAC_TX_PACKET_SMALL_COUNT (0x84345b01UL)
+#define MAC_TX_TOTAL_BYTES (0x7bd15854UL)
+#define MAC_TX_TOTAL_BYTES_COUNT (0x61fb238cUL)
+#define MAC_TX_TOTAL_GOOD_BYTES (0xcf0260fUL)
+#define MAC_TX_TOTAL_GOOD_BYTES_COUNT (0x8603398UL)
+#define MAC_TX_TOTAL_GOOD_PACKETS (0xd89f151UL)
+#define MAC_TX_TOTAL_GOOD_PACKETS_COUNT (0x12c47c77UL)
+#define MAC_TX_TOTAL_PACKETS (0xe37b5ed4UL)
+#define MAC_TX_TOTAL_PACKETS_COUNT (0x21ddd2ddUL)
+
+#endif	/* _NTHW_FPGA_REG_DEFS_MAC_TX_ */
Signature · 1 line
2.45.0
#372 lore raw

PATCH v5 47/80 net/ntnic: add RPP LR module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The RX Packet Process for Local Retransmit module can add bytes in the FPGA TX pipeline, which is needed when the packet increases in size. Note, this makes room for packet expansion,
but the actual expansion is done by the modules.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 32 ++++++++++++++++++-
 1 file changed, 31 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +31 -1
index 7a2f5aec32..33437da204 100644
@@ -2138,6 +2138,35 @@ static nthw_fpga_register_init_s rmc_registers[] = {
 	{ RMC_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_RO, 0, 2, rmc_status_fields },
 };
 
+static nthw_fpga_field_init_s rpp_lr_ifr_rcp_ctrl_fields[] = {
+	{ RPP_LR_IFR_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ RPP_LR_IFR_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpp_lr_ifr_rcp_data_fields[] = {
+	{ RPP_LR_IFR_RCP_DATA_IPV4_DF_DROP, 1, 17, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_IPV4_EN, 1, 0, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_IPV6_DROP, 1, 16, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_IPV6_EN, 1, 1, 0x0000 },
+	{ RPP_LR_IFR_RCP_DATA_MTU, 14, 2, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpp_lr_rcp_ctrl_fields[] = {
+	{ RPP_LR_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ RPP_LR_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpp_lr_rcp_data_fields[] = {
+	{ RPP_LR_RCP_DATA_EXP, 14, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s rpp_lr_registers[] = {
+	{ RPP_LR_IFR_RCP_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpp_lr_ifr_rcp_ctrl_fields },
+	{ RPP_LR_IFR_RCP_DATA, 3, 18, NTHW_FPGA_REG_TYPE_WO, 0, 5, rpp_lr_ifr_rcp_data_fields },
+	{ RPP_LR_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpp_lr_rcp_ctrl_fields },
+	{ RPP_LR_RCP_DATA, 1, 14, NTHW_FPGA_REG_TYPE_WO, 0, 1, rpp_lr_rcp_data_fields },
+};
+
 static nthw_fpga_field_init_s rst9563_ctrl_fields[] = {
 	{ RST9563_CTRL_PTP_MMCM_CLKSEL, 1, 2, 1 },
 	{ RST9563_CTRL_TS_CLKSEL, 1, 1, 1 },
@@ -2230,6 +2259,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_QSL, 0, MOD_QSL, 0, 7, NTHW_FPGA_BUS_TYPE_RAB1, 1792, 8, qsl_registers },
 	{ MOD_RAC, 0, MOD_RAC, 3, 0, NTHW_FPGA_BUS_TYPE_PCI, 8192, 14, rac_registers },
 	{ MOD_RMC, 0, MOD_RMC, 1, 3, NTHW_FPGA_BUS_TYPE_RAB0, 12288, 4, rmc_registers },
+	{ MOD_RPP_LR, 0, MOD_RPP_LR, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2304, 4, rpp_lr_registers },
 	{ MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers },
 };
 
@@ -2389,5 +2419,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 30, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 31, fpga_modules,
 };
Signature · 1 line
2.45.0
#373 lore raw

PATCH v5 48/80 net/ntnic: add SLC LR module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The Slicer for Local Retransmit module can cut of the head a packet before the packet leaves the FPGA RX pipeline.
This is used when the TX pipeline is configured
to add a new head in the packet

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 20 ++++++++++++++++++-
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |  3 ++-
 2 files changed, 21 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +19 -1
index 33437da204..0f69f89527 100644
@@ -2214,6 +2214,23 @@ static nthw_fpga_register_init_s rst9563_registers[] = {
 	{ RST9563_STICKY, 3, 6, NTHW_FPGA_REG_TYPE_RC1, 0, 6, rst9563_sticky_fields },
 };
 
+static nthw_fpga_field_init_s slc_rcp_ctrl_fields[] = {
+	{ SLC_RCP_CTRL_ADR, 6, 0, 0x0000 },
+	{ SLC_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s slc_rcp_data_fields[] = {
+	{ SLC_RCP_DATA_HEAD_DYN, 5, 1, 0x0000 }, { SLC_RCP_DATA_HEAD_OFS, 8, 6, 0x0000 },
+	{ SLC_RCP_DATA_HEAD_SLC_EN, 1, 0, 0x0000 }, { SLC_RCP_DATA_PCAP, 1, 35, 0x0000 },
+	{ SLC_RCP_DATA_TAIL_DYN, 5, 15, 0x0000 }, { SLC_RCP_DATA_TAIL_OFS, 15, 20, 0x0000 },
+	{ SLC_RCP_DATA_TAIL_SLC_EN, 1, 14, 0x0000 },
+};
+
+static nthw_fpga_register_init_s slc_registers[] = {
+	{ SLC_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, slc_rcp_ctrl_fields },
+	{ SLC_RCP_DATA, 1, 36, NTHW_FPGA_REG_TYPE_WO, 0, 7, slc_rcp_data_fields },
+};
+
 static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers },
 	{ MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers },
@@ -2261,6 +2278,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_RMC, 0, MOD_RMC, 1, 3, NTHW_FPGA_BUS_TYPE_RAB0, 12288, 4, rmc_registers },
 	{ MOD_RPP_LR, 0, MOD_RPP_LR, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2304, 4, rpp_lr_registers },
 	{ MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers },
+	{ MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers },
 };
 
 static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2419,5 +2437,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 31, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 32, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
index f4a913f3d2..865dd6a084 100644
@@ -41,11 +41,12 @@
 #define MOD_RPP_LR (0xba7f945cUL)
 #define MOD_RST9563 (0x385d6d1dUL)
 #define MOD_SDC (0xd2369530UL)
+#define MOD_SLC (0x1aef1f38UL)
 #define MOD_SLC_LR (0x969fc50bUL)
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
-#define MOD_IDX_COUNT (32)
+#define MOD_IDX_COUNT (33)
 
 /* aliases - only aliases go below this point */
 #endif	/* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
#374 lore raw

PATCH v5 49/80 net/ntnic: add Tx CPY module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The TX Copy module writes data to packet fields based on the lookup performed by the FLM module.
This is used for NAT and can support other actions based on the RTE action MODIFY_FIELD.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 204 +++++++++++++++++-
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   3 +-
 2 files changed, 205 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +203 -1
index 0f69f89527..60fd748ea2 100644
@@ -270,6 +270,207 @@ static nthw_fpga_register_init_s cat_registers[] = {
 	{ CAT_RCK_DATA, 3, 32, NTHW_FPGA_REG_TYPE_WO, 0, 32, cat_rck_data_fields },
 };
 
+static nthw_fpga_field_init_s cpy_packet_reader0_ctrl_fields[] = {
+	{ CPY_PACKET_READER0_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_PACKET_READER0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_packet_reader0_data_fields[] = {
+	{ CPY_PACKET_READER0_DATA_DYN, 5, 10, 0x0000 },
+	{ CPY_PACKET_READER0_DATA_OFS, 10, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_ctrl_fields[] = {
+	{ CPY_WRITER0_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER0_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_data_fields[] = {
+	{ CPY_WRITER0_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER0_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER0_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER0_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER0_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_mask_ctrl_fields[] = {
+	{ CPY_WRITER0_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER0_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer0_mask_data_fields[] = {
+	{ CPY_WRITER0_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_ctrl_fields[] = {
+	{ CPY_WRITER1_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER1_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_data_fields[] = {
+	{ CPY_WRITER1_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER1_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER1_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER1_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER1_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_mask_ctrl_fields[] = {
+	{ CPY_WRITER1_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER1_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer1_mask_data_fields[] = {
+	{ CPY_WRITER1_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_ctrl_fields[] = {
+	{ CPY_WRITER2_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER2_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_data_fields[] = {
+	{ CPY_WRITER2_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER2_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER2_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER2_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER2_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_mask_ctrl_fields[] = {
+	{ CPY_WRITER2_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER2_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer2_mask_data_fields[] = {
+	{ CPY_WRITER2_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_ctrl_fields[] = {
+	{ CPY_WRITER3_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER3_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_data_fields[] = {
+	{ CPY_WRITER3_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER3_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER3_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER3_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER3_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_mask_ctrl_fields[] = {
+	{ CPY_WRITER3_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER3_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer3_mask_data_fields[] = {
+	{ CPY_WRITER3_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_ctrl_fields[] = {
+	{ CPY_WRITER4_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER4_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_data_fields[] = {
+	{ CPY_WRITER4_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER4_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER4_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER4_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER4_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_mask_ctrl_fields[] = {
+	{ CPY_WRITER4_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER4_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer4_mask_data_fields[] = {
+	{ CPY_WRITER4_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_ctrl_fields[] = {
+	{ CPY_WRITER5_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER5_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_data_fields[] = {
+	{ CPY_WRITER5_DATA_DYN, 5, 17, 0x0000 }, { CPY_WRITER5_DATA_LEN, 5, 22, 0x0000 },
+	{ CPY_WRITER5_DATA_MASK_POINTER, 4, 27, 0x0000 }, { CPY_WRITER5_DATA_OFS, 14, 3, 0x0000 },
+	{ CPY_WRITER5_DATA_READER_SELECT, 3, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_mask_ctrl_fields[] = {
+	{ CPY_WRITER5_MASK_CTRL_ADR, 4, 0, 0x0000 },
+	{ CPY_WRITER5_MASK_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s cpy_writer5_mask_data_fields[] = {
+	{ CPY_WRITER5_MASK_DATA_BYTE_MASK, 16, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s cpy_registers[] = {
+	{
+		CPY_PACKET_READER0_CTRL, 24, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_packet_reader0_ctrl_fields
+	},
+	{
+		CPY_PACKET_READER0_DATA, 25, 15, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_packet_reader0_data_fields
+	},
+	{ CPY_WRITER0_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer0_ctrl_fields },
+	{ CPY_WRITER0_DATA, 1, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer0_data_fields },
+	{
+		CPY_WRITER0_MASK_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer0_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER0_MASK_DATA, 3, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer0_mask_data_fields
+	},
+	{ CPY_WRITER1_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer1_ctrl_fields },
+	{ CPY_WRITER1_DATA, 5, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer1_data_fields },
+	{
+		CPY_WRITER1_MASK_CTRL, 6, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer1_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER1_MASK_DATA, 7, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer1_mask_data_fields
+	},
+	{ CPY_WRITER2_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer2_ctrl_fields },
+	{ CPY_WRITER2_DATA, 9, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer2_data_fields },
+	{
+		CPY_WRITER2_MASK_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer2_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER2_MASK_DATA, 11, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer2_mask_data_fields
+	},
+	{ CPY_WRITER3_CTRL, 12, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer3_ctrl_fields },
+	{ CPY_WRITER3_DATA, 13, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer3_data_fields },
+	{
+		CPY_WRITER3_MASK_CTRL, 14, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer3_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER3_MASK_DATA, 15, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer3_mask_data_fields
+	},
+	{ CPY_WRITER4_CTRL, 16, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer4_ctrl_fields },
+	{ CPY_WRITER4_DATA, 17, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer4_data_fields },
+	{
+		CPY_WRITER4_MASK_CTRL, 18, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer4_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER4_MASK_DATA, 19, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer4_mask_data_fields
+	},
+	{ CPY_WRITER5_CTRL, 20, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, cpy_writer5_ctrl_fields },
+	{ CPY_WRITER5_DATA, 21, 31, NTHW_FPGA_REG_TYPE_WO, 0, 5, cpy_writer5_data_fields },
+	{
+		CPY_WRITER5_MASK_CTRL, 22, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2,
+		cpy_writer5_mask_ctrl_fields
+	},
+	{
+		CPY_WRITER5_MASK_DATA, 23, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1,
+		cpy_writer5_mask_data_fields
+	},
+};
+
 static nthw_fpga_field_init_s csu_rcp_ctrl_fields[] = {
 	{ CSU_RCP_CTRL_ADR, 4, 0, 0x0000 },
 	{ CSU_RCP_CTRL_CNT, 16, 16, 0x0000 },
@@ -2279,6 +2480,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_RPP_LR, 0, MOD_RPP_LR, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2304, 4, rpp_lr_registers },
 	{ MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers },
 	{ MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers },
+	{ MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers },
 };
 
 static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2437,5 +2639,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 32, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 33, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
index 865dd6a084..0ab5ae0310 100644
@@ -15,6 +15,7 @@
 
 #define MOD_UNKNOWN (0L)/* Unknown/uninitialized - keep this as the first element */
 #define MOD_CAT (0x30b447c2UL)
+#define MOD_CPY (0x1ddc186fUL)
 #define MOD_CSU (0x3f470787UL)
 #define MOD_DBS (0x80b29727UL)
 #define MOD_FLM (0xe7ba53a4UL)
@@ -46,7 +47,7 @@
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
-#define MOD_IDX_COUNT (33)
+#define MOD_IDX_COUNT (34)
 
 /* aliases - only aliases go below this point */
 #endif	/* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
#375 lore raw

Re: [PATCH v5 49/80] net/ntnic: add Tx CPY module registers

Quoted 8 lines · On Wed, 30 Oct 2024 22:38:56 +0100 Serhii Iliushyk <[email protected]> wrote:

From: Oleksandr Kolomeiets <[email protected]>

The TX Copy module writes data to packet fields based on the lookup performed by the FLM module.
This is used for NAT and can support other actions based on the RTE action MODIFY_FIELD.

Something is wrong CI is having problems with this patch. Is there a missing dependency?

Applying: net/ntnic: add IFR module registers
Applying: net/ntnic: add Tx CPY module registers
Patch failed at 0045 net/ntnic: add Tx CPY module registers Use 'git am --show-current-patch' to see the failed patch When you have resolved this problem, run "git am --continue". If you prefer to skip this patch, run "git am --skip" instead. To restore the original branch and stop patching, run "git am --abort".

PS: please send patch series with a cover-letter next time.

#376 lore raw

PATCH v5 50/80 net/ntnic: add Tx INS module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The TX Inserter module injects zeros into an offset of a packet, effectively expanding the packet.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 19 ++++++++++++++++++-
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |  3 ++-
 2 files changed, 20 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +18 -1
index 60fd748ea2..c8841b1dc2 100644
@@ -1457,6 +1457,22 @@ static nthw_fpga_register_init_s iic_registers[] = {
 	{ IIC_TX_FIFO_OCY, 69, 4, NTHW_FPGA_REG_TYPE_RO, 0, 1, iic_tx_fifo_ocy_fields },
 };
 
+static nthw_fpga_field_init_s ins_rcp_ctrl_fields[] = {
+	{ INS_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ INS_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s ins_rcp_data_fields[] = {
+	{ INS_RCP_DATA_DYN, 5, 0, 0x0000 },
+	{ INS_RCP_DATA_LEN, 8, 15, 0x0000 },
+	{ INS_RCP_DATA_OFS, 10, 5, 0x0000 },
+};
+
+static nthw_fpga_register_init_s ins_registers[] = {
+	{ INS_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, ins_rcp_ctrl_fields },
+	{ INS_RCP_DATA, 1, 23, NTHW_FPGA_REG_TYPE_WO, 0, 3, ins_rcp_data_fields },
+};
+
 static nthw_fpga_field_init_s km_cam_ctrl_fields[] = {
 	{ KM_CAM_CTRL_ADR, 13, 0, 0x0000 },
 	{ KM_CAM_CTRL_CNT, 16, 16, 0x0000 },
@@ -2481,6 +2497,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_RST9563, 0, MOD_RST9563, 0, 5, NTHW_FPGA_BUS_TYPE_RAB0, 1024, 5, rst9563_registers },
 	{ MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers },
 	{ MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers },
+	{ MOD_TX_INS, 0, MOD_INS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 8704, 2, ins_registers },
 };
 
 static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2639,5 +2656,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 33, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 34, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
index 0ab5ae0310..8c0c727e16 100644
@@ -28,6 +28,7 @@
 #define MOD_I2CM (0x93bc7780UL)
 #define MOD_IFR (0x9b01f1e6UL)
 #define MOD_IIC (0x7629cddbUL)
+#define MOD_INS (0x24df4b78UL)
 #define MOD_KM (0xcfbd9dbeUL)
 #define MOD_MAC_PCS (0x7abe24c7UL)
 #define MOD_MAC_RX (0x6347b490UL)
@@ -47,7 +48,7 @@
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
-#define MOD_IDX_COUNT (34)
+#define MOD_IDX_COUNT (35)
 
 /* aliases - only aliases go below this point */
 #endif	/* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
#377 lore raw

PATCH v5 51/80 net/ntnic: add Tx RPL module registers

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

The TX Replacer module can replace a range of bytes in a packet. The replacing data is stored in a table in the module and will often contain tunnel data.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 41 ++++++++++++++++++-
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |  3 +-
 2 files changed, 42 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +40 -1
index c8841b1dc2..a3d9f94fc6 100644
@@ -2355,6 +2355,44 @@ static nthw_fpga_register_init_s rmc_registers[] = {
 	{ RMC_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_RO, 0, 2, rmc_status_fields },
 };
 
+static nthw_fpga_field_init_s rpl_ext_ctrl_fields[] = {
+	{ RPL_EXT_CTRL_ADR, 10, 0, 0x0000 },
+	{ RPL_EXT_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_ext_data_fields[] = {
+	{ RPL_EXT_DATA_RPL_PTR, 12, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rcp_ctrl_fields[] = {
+	{ RPL_RCP_CTRL_ADR, 4, 0, 0x0000 },
+	{ RPL_RCP_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rcp_data_fields[] = {
+	{ RPL_RCP_DATA_DYN, 5, 0, 0x0000 }, { RPL_RCP_DATA_ETH_TYPE_WR, 1, 36, 0x0000 },
+	{ RPL_RCP_DATA_EXT_PRIO, 1, 35, 0x0000 }, { RPL_RCP_DATA_LEN, 8, 15, 0x0000 },
+	{ RPL_RCP_DATA_OFS, 10, 5, 0x0000 }, { RPL_RCP_DATA_RPL_PTR, 12, 23, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rpl_ctrl_fields[] = {
+	{ RPL_RPL_CTRL_ADR, 12, 0, 0x0000 },
+	{ RPL_RPL_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s rpl_rpl_data_fields[] = {
+	{ RPL_RPL_DATA_VALUE, 128, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s rpl_registers[] = {
+	{ RPL_EXT_CTRL, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpl_ext_ctrl_fields },
+	{ RPL_EXT_DATA, 3, 12, NTHW_FPGA_REG_TYPE_WO, 0, 1, rpl_ext_data_fields },
+	{ RPL_RCP_CTRL, 0, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpl_rcp_ctrl_fields },
+	{ RPL_RCP_DATA, 1, 37, NTHW_FPGA_REG_TYPE_WO, 0, 6, rpl_rcp_data_fields },
+	{ RPL_RPL_CTRL, 4, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, rpl_rpl_ctrl_fields },
+	{ RPL_RPL_DATA, 5, 128, NTHW_FPGA_REG_TYPE_WO, 0, 1, rpl_rpl_data_fields },
+};
+
 static nthw_fpga_field_init_s rpp_lr_ifr_rcp_ctrl_fields[] = {
 	{ RPP_LR_IFR_RCP_CTRL_ADR, 4, 0, 0x0000 },
 	{ RPP_LR_IFR_RCP_CTRL_CNT, 16, 16, 0x0000 },
@@ -2498,6 +2536,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_SLC_LR, 0, MOD_SLC, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 2048, 2, slc_registers },
 	{ MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers },
 	{ MOD_TX_INS, 0, MOD_INS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 8704, 2, ins_registers },
+	{ MOD_TX_RPL, 0, MOD_RPL, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 8960, 6, rpl_registers },
 };
 
 static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2656,5 +2695,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 34, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 35, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +2 -1
index 8c0c727e16..2b059d98ff 100644
@@ -40,6 +40,7 @@
 #define MOD_QSL (0x448ed859UL)
 #define MOD_RAC (0xae830b42UL)
 #define MOD_RMC (0x236444eUL)
+#define MOD_RPL (0x6de535c3UL)
 #define MOD_RPP_LR (0xba7f945cUL)
 #define MOD_RST9563 (0x385d6d1dUL)
 #define MOD_SDC (0xd2369530UL)
@@ -48,7 +49,7 @@
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
-#define MOD_IDX_COUNT (35)
+#define MOD_IDX_COUNT (36)
 
 /* aliases - only aliases go below this point */
 #endif	/* _NTHW_FPGA_MOD_DEFS_H_ */
Signature · 1 line
2.45.0
#378 lore raw

PATCH v5 52/80 net/ntnic: update alignment for virt queue structs

In reply to Serhii Iliushyk

Update incorrect alignment

---
v2
* Fix __rte_packed usage
Original NT PMD driver use pragma pack(1) wich is similar with combination attributes packed and aligned
In this case aligned(1) can be ignored in case of use attribute packed

---
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c +4 -3
index bde0fed273..e46a3bef28 100644
@@ -3,6 +3,7 @@
  * Copyright(c) 2023 Napatech A/S
  */
 
+#include <rte_common.h>
 #include <unistd.h>
 
 #include "ntos_drv.h"
@@ -67,20 +68,20 @@
 	} \
 } while (0)
 
-struct __rte_aligned(8) virtq_avail {
+struct __rte_packed virtq_avail {
 	uint16_t flags;
 	uint16_t idx;
 	uint16_t ring[];	/* Queue Size */
 };
 
-struct __rte_aligned(8) virtq_used_elem {
+struct __rte_packed virtq_used_elem {
 	/* Index of start of used descriptor chain. */
 	uint32_t id;
 	/* Total length of the descriptor chain which was used (written to) */
 	uint32_t len;
 };
 
-struct __rte_aligned(8) virtq_used {
+struct __rte_packed virtq_used {
 	uint16_t flags;
 	uint16_t idx;
 	struct virtq_used_elem ring[];	/* Queue Size */
Signature · 1 line
2.45.0
#379 lore raw

PATCH v5 53/80 net/ntnic: enable RSS feature

In reply to Serhii Iliushyk

Enable receive side scaling

---
v4
* Use RTE_MIN instead of the ternary operator.

---
 doc/guides/nics/features/ntnic.ini            |  3 +
 doc/guides/nics/ntnic.rst                     |  7 ++
 drivers/net/ntnic/include/create_elements.h   |  1 +
 drivers/net/ntnic/include/flow_api.h          |  2 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  6 ++
 .../profile_inline/flow_api_profile_inline.c  | 43 +++++++++++
 drivers/net/ntnic/ntnic_ethdev.c              | 75 +++++++++++++++++++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 73 ++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  7 ++
 9 files changed, 217 insertions(+)
doc/guides/nics/features/ntnic.ini +3 -0
index 4cb9509742..e5d5abd0ed 100644
@@ -10,6 +10,8 @@ Link status          = Y
 Queue start/stop     = Y
 Unicast MAC filter   = Y
 Multicast MAC filter = Y
+RSS hash             = Y
+RSS key update       = Y
 Linux                = Y
 x86-64               = Y
 
@@ -37,3 +39,4 @@ port_id              = Y
 queue                = Y
 raw_decap            = Y
 raw_encap            = Y
+rss                  = Y
doc/guides/nics/ntnic.rst +7 -0
index f2cb7a362a..4ed732d9f8 100644
@@ -56,6 +56,13 @@ Features
 - Exact match of 140 million flows and policies.
 - Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum
    verification.
+- RSS hash
+- RSS key update
+- RSS based on VLAN or 5-tuple.
+- RSS using different combinations of fields: L3 only, L4 only or both, and
+   source only, destination only or both.
+- Several RSS hash keys, one for each flow type.
+- Default RSS operation with no hash key specification.
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/create_elements.h +1 -0
index 70e6cad195..eaa578e72a 100644
@@ -27,6 +27,7 @@ struct cnv_attr_s {
 
 struct cnv_action_s {
 	struct rte_flow_action flow_actions[MAX_ACTIONS];
+	struct rte_flow_action_rss flow_rss;
 	struct flow_action_raw_encap encap;
 	struct flow_action_raw_decap decap;
 	struct rte_flow_action_queue queue;
drivers/net/ntnic/include/flow_api.h +2 -0
index 2e96fa5bed..4a1525f237 100644
@@ -114,6 +114,8 @@ struct flow_nic_dev {
 	struct flow_eth_dev *eth_base;
 	pthread_mutex_t mtx;
 
+	/* RSS hashing configuration */
+	struct nt_eth_rss_conf rss_conf;
 	/* next NIC linked list */
 	struct flow_nic_dev *next;
 };
drivers/net/ntnic/nthw/flow_api/flow_api.c +6 -0
index fc9c68ed1a..4847b2de99 100644
@@ -1027,6 +1027,12 @@ static const struct flow_filter_ops ops = {
 	.flow_destroy = flow_destroy,
 	.flow_flush = flow_flush,
 	.flow_dev_dump = flow_dev_dump,
+
+	/*
+	 * Other
+	 */
+	 .hw_mod_hsh_rcp_flush = hw_mod_hsh_rcp_flush,
+	 .flow_nic_set_hasher_fields = flow_nic_set_hasher_fields,
 };
 
 void init_flow_filter(void)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +43 -0

49 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +75 -0

93 lines not on this page · raw message

drivers/net/ntnic/ntnic_filter/ntnic_filter.c +73 -0

79 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +7 -0
index 12baa13800..e40ed9b949 100644
@@ -316,6 +316,13 @@ struct flow_filter_ops {
 
 	int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id,
 		struct rte_flow_error *error);
+
+	/*
+	 * Other
+	 */
+	int (*flow_nic_set_hasher_fields)(struct flow_nic_dev *ndev, int hsh_idx,
+		struct nt_eth_rss_conf rss_conf);
+	int (*hw_mod_hsh_rcp_flush)(struct flow_api_backend_s *be, int start_idx, int count);
 };
 
 void register_dev_flow_ops(const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
#380 lore raw

PATCH v5 54/80 net/ntnic: add statistics support

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Statistics init, setup, get, reset, and their
implementation was added.

Statistics FPGA defines were added.

---
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |  29 +-
 .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 192 +++++++++
 .../net/ntnic/include/common_adapter_defs.h   |  15 +
 drivers/net/ntnic/include/create_elements.h   |   4 +
 drivers/net/ntnic/include/nt4ga_adapter.h     |   2 +
 drivers/net/ntnic/include/ntdrv_4ga.h         |   1 +
 drivers/net/ntnic/include/ntnic_stat.h        | 149 +++++++
 drivers/net/ntnic/include/ntos_drv.h          |   9 +
 .../ntnic/include/stream_binary_flow_api.h    |   5 +
 drivers/net/ntnic/meson.build                 |   3 +
 .../net/ntnic/nthw/core/include/nthw_rmc.h    |   1 +
 drivers/net/ntnic/nthw/core/nthw_rmc.c        |  10 +
 drivers/net/ntnic/nthw/stat/nthw_stat.c       | 370 ++++++++++++++++++
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   1 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   1 +
 .../nthw/supported/nthw_fpga_reg_defs_sta.h   |  40 ++
 drivers/net/ntnic/ntnic_ethdev.c              | 119 +++++-
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 132 +++++++
 drivers/net/ntnic/ntnic_mod_reg.c             |  30 ++
 drivers/net/ntnic/ntnic_mod_reg.h             |  17 +
 drivers/net/ntnic/ntutil/nt_util.h            |   1 +
 21 files changed, 1119 insertions(+), 12 deletions(-)
 create mode 100644 drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c
 create mode 100644 drivers/net/ntnic/include/common_adapter_defs.h
 create mode 100644 drivers/net/ntnic/nthw/stat/nthw_stat.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h
drivers/net/ntnic/adapter/nt4ga_adapter.c +18 -11
index d9e6716c30..fa72dfda8d 100644
@@ -212,19 +212,26 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)
 		}
 	}
 
-	nthw_rmc_t *p_nthw_rmc = nthw_rmc_new();
-	if (p_nthw_rmc == NULL) {
-		NT_LOG(ERR, NTNIC, "Failed to allocate memory for RMC module");
-		return -1;
-	}
+	const struct nt4ga_stat_ops *nt4ga_stat_ops = get_nt4ga_stat_ops();
 
-	res = nthw_rmc_init(p_nthw_rmc, p_fpga, 0);
-	if (res) {
-		NT_LOG(ERR, NTNIC, "Failed to initialize RMC module");
-		return -1;
-	}
+	if (nt4ga_stat_ops != NULL) {
+		/* Nt4ga Stat init/setup */
+		res = nt4ga_stat_ops->nt4ga_stat_init(p_adapter_info);
+
+		if (res != 0) {
+			NT_LOG(ERR, NTNIC, "%s: Cannot initialize the statistics module",
+				p_adapter_id_str);
+			return res;
+		}
+
+		res = nt4ga_stat_ops->nt4ga_stat_setup(p_adapter_info);
 
-	nthw_rmc_unblock(p_nthw_rmc, false);
+		if (res != 0) {
+			NT_LOG(ERR, NTNIC, "%s: Cannot setup the statistics module",
+				p_adapter_id_str);
+			return res;
+		}
+	}
 
 	return 0;
 }
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c new file +192 -0

192 lines not on this page · raw message

drivers/net/ntnic/include/common_adapter_defs.h new file +15 -0
new file mode 100644
index 0000000000..6ed9121f0f
@@ -0,0 +1,15 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef _COMMON_ADAPTER_DEFS_H_
+#define _COMMON_ADAPTER_DEFS_H_
+
+/*
+ * Declarations shared by NT adapter types.
+ */
+#define NUM_ADAPTER_MAX (8)
+#define NUM_ADAPTER_PORTS_MAX (128)
+
+#endif	/* _COMMON_ADAPTER_DEFS_H_ */
drivers/net/ntnic/include/create_elements.h +4 -0
index eaa578e72a..1456977837 100644
@@ -46,6 +46,10 @@ struct rte_flow {
 
 	uint32_t flow_stat_id;
 
+	uint64_t stat_pkts;
+	uint64_t stat_bytes;
+	uint8_t stat_tcp_flags;
+
 	uint16_t caller_id;
 };
 
drivers/net/ntnic/include/nt4ga_adapter.h +2 -0
index 809135f130..fef79ce358 100644
@@ -6,6 +6,7 @@
 #ifndef _NT4GA_ADAPTER_H_
 #define _NT4GA_ADAPTER_H_
 
+#include "ntnic_stat.h"
 #include "nt4ga_link.h"
 
 typedef struct hw_info_s {
@@ -30,6 +31,7 @@ typedef struct hw_info_s {
 #include "ntnic_stat.h"
 
 typedef struct adapter_info_s {
+	struct nt4ga_stat_s nt4ga_stat;
 	struct nt4ga_filter_s nt4ga_filter;
 	struct nt4ga_link_s nt4ga_link;
 
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
index 8ebdd98db0..1135e9a539 100644
@@ -15,6 +15,7 @@ typedef struct ntdrv_4ga_s {
 
 	volatile bool b_shutdown;
 	rte_thread_t flm_thread;
+	pthread_mutex_t stat_lck;
 } ntdrv_4ga_t;
 
 #endif	/* __NTDRV_4GA_H__ */
drivers/net/ntnic/include/ntnic_stat.h +149 -0

155 lines not on this page · raw message

drivers/net/ntnic/include/ntos_drv.h +9 -0
index 8fd577dfe3..7b3c8ff3d6 100644
@@ -57,6 +57,9 @@ struct __rte_cache_aligned ntnic_rx_queue {
 	struct flow_queue_id_s queue;    /* queue info - user id and hw queue index */
 	struct rte_mempool *mb_pool; /* mbuf memory pool */
 	uint16_t buf_size; /* Size of data area in mbuf */
+	unsigned long rx_pkts;	/* Rx packet statistics */
+	unsigned long rx_bytes;	/* Rx bytes statistics */
+	unsigned long err_pkts;	/* Rx error packet statistics */
 	int  enabled;  /* Enabling/disabling of this queue */
 
 	struct hwq_s           hwq;
@@ -80,6 +83,9 @@ struct __rte_cache_aligned ntnic_tx_queue {
 	int rss_target_id;
 
 	uint32_t port;     /* Tx port for this queue */
+	unsigned long tx_pkts;	/* Tx packet statistics */
+	unsigned long tx_bytes;	/* Tx bytes statistics */
+	unsigned long err_pkts;	/* Tx error packet stat */
 	int  enabled;  /* Enabling/disabling of this queue */
 	enum fpga_info_profile profile;  /* Inline / Capture */
 };
@@ -95,6 +101,7 @@ struct pmd_internals {
 	/* Offset of the VF from the PF */
 	uint8_t vf_offset;
 	uint32_t port;
+	uint32_t port_id;
 	nt_meta_port_type_t type;
 	struct flow_queue_id_s vpq[MAX_QUEUES];
 	unsigned int           vpq_nb_vq;
@@ -107,6 +114,8 @@ struct pmd_internals {
 	struct rte_ether_addr eth_addrs[NUM_MAC_ADDRS_PER_PORT];
 	/* Multicast ethernet (MAC) addresses. */
 	struct rte_ether_addr mc_addrs[NUM_MULTICAST_ADDRS_PER_PORT];
+	uint64_t last_stat_rtc;
+	uint64_t rx_missed;
 	struct pmd_internals *next;
 };
 
drivers/net/ntnic/include/stream_binary_flow_api.h +5 -0
index e5fe686d99..4ce1561033 100644
@@ -6,6 +6,7 @@
 #ifndef _STREAM_BINARY_FLOW_API_H_
 #define _STREAM_BINARY_FLOW_API_H_
 
+#include <rte_ether.h>
 #include "rte_flow.h"
 #include "rte_flow_driver.h"
 
@@ -44,6 +45,10 @@
 #define FLOW_MAX_QUEUES 128
 
 #define RAW_ENCAP_DECAP_ELEMS_MAX 16
+
+extern uint64_t rte_tsc_freq;
+extern rte_spinlock_t hwlock;
+
 /*
  * Flow eth dev profile determines how the FPGA module resources are
  * managed and what features are available
drivers/net/ntnic/meson.build +3 -0
index 92167d24e4..216341bb11 100644
@@ -25,10 +25,12 @@ includes = [
 # all sources
 sources = files(
         'adapter/nt4ga_adapter.c',
+        'adapter/nt4ga_stat/nt4ga_stat.c',
         'dbsconfig/ntnic_dbsconfig.c',
         'link_mgmt/link_100g/nt4ga_link_100g.c',
         'link_mgmt/nt4ga_link.c',
         'nim/i2c_nim.c',
+        'ntnic_filter/ntnic_filter.c',
         'nthw/dbs/nthw_dbs.c',
         'nthw/supported/nthw_fpga_9563_055_049_0000.c',
         'nthw/supported/nthw_fpga_instances.c',
@@ -48,6 +50,7 @@ sources = files(
         'nthw/core/nthw_rmc.c',
         'nthw/core/nthw_sdc.c',
         'nthw/core/nthw_si5340.c',
+        'nthw/stat/nthw_stat.c',
         'nthw/flow_api/flow_api.c',
         'nthw/flow_api/flow_group.c',
         'nthw/flow_api/flow_id_table.c',
drivers/net/ntnic/nthw/core/include/nthw_rmc.h +1 -0
index 2345820bdc..b239752674 100644
@@ -44,6 +44,7 @@ typedef struct nthw_rmc nthw_rmc;
 nthw_rmc_t *nthw_rmc_new(void);
 int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance);
 
+void nthw_rmc_block(nthw_rmc_t *p);
 void nthw_rmc_unblock(nthw_rmc_t *p, bool b_is_secondary);
 
 #endif	/* NTHW_RMC_H_ */
drivers/net/ntnic/nthw/core/nthw_rmc.c +10 -0
index 4a01424c24..748519aeb4 100644
@@ -77,6 +77,16 @@ int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance)
 	return 0;
 }
 
+void nthw_rmc_block(nthw_rmc_t *p)
+{
+	/* BLOCK_STATT(0)=1 BLOCK_KEEPA(1)=1 BLOCK_MAC_PORT(8:11)=~0 */
+	if (!p->mb_administrative_block) {
+		nthw_field_set_flush(p->mp_fld_ctrl_block_stat_drop);
+		nthw_field_set_flush(p->mp_fld_ctrl_block_keep_alive);
+		nthw_field_set_flush(p->mp_fld_ctrl_block_mac_port);
+	}
+}
+
 void nthw_rmc_unblock(nthw_rmc_t *p, bool b_is_secondary)
 {
 	uint32_t n_block_mask = ~0U << (b_is_secondary ? p->mn_nims : p->mn_ports);
drivers/net/ntnic/nthw/stat/nthw_stat.c new file +370 -0

370 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
index 2b059d98ff..ddc144dc02 100644
@@ -46,6 +46,7 @@
 #define MOD_SDC (0xd2369530UL)
 #define MOD_SLC (0x1aef1f38UL)
 #define MOD_SLC_LR (0x969fc50bUL)
+#define MOD_STA (0x76fae64dUL)
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
index 7741aa563f..8f196f885f 100644
@@ -45,6 +45,7 @@
 #include "nthw_fpga_reg_defs_sdc.h"
 #include "nthw_fpga_reg_defs_slc.h"
 #include "nthw_fpga_reg_defs_slc_lr.h"
+#include "nthw_fpga_reg_defs_sta.h"
 #include "nthw_fpga_reg_defs_tx_cpy.h"
 #include "nthw_fpga_reg_defs_tx_ins.h"
 #include "nthw_fpga_reg_defs_tx_rpl.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h new file +40 -0
new file mode 100644
index 0000000000..640ffcbc52
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_REG_DEFS_STA_
+#define _NTHW_FPGA_REG_DEFS_STA_
+
+/* STA */
+#define STA_CFG (0xcecaf9f4UL)
+#define STA_CFG_CNT_CLEAR (0xc325e12eUL)
+#define STA_CFG_CNT_FRZ (0x8c27a596UL)
+#define STA_CFG_DMA_ENA (0x940dbacUL)
+#define STA_CFG_TX_DISABLE (0x30f43250UL)
+#define STA_HOST_ADR_LSB (0xde569336UL)
+#define STA_HOST_ADR_LSB_LSB (0xb6f2f94bUL)
+#define STA_HOST_ADR_MSB (0xdf94f901UL)
+#define STA_HOST_ADR_MSB_MSB (0x114798c8UL)
+#define STA_LOAD_BIN (0x2e842591UL)
+#define STA_LOAD_BIN_BIN (0x1a2b942eUL)
+#define STA_LOAD_BPS_RX_0 (0xbf8f4595UL)
+#define STA_LOAD_BPS_RX_0_BPS (0x41647781UL)
+#define STA_LOAD_BPS_RX_1 (0xc8887503UL)
+#define STA_LOAD_BPS_RX_1_BPS (0x7c045e31UL)
+#define STA_LOAD_BPS_TX_0 (0x9ae41a49UL)
+#define STA_LOAD_BPS_TX_0_BPS (0x870b7e06UL)
+#define STA_LOAD_BPS_TX_1 (0xede32adfUL)
+#define STA_LOAD_BPS_TX_1_BPS (0xba6b57b6UL)
+#define STA_LOAD_PPS_RX_0 (0x811173c3UL)
+#define STA_LOAD_PPS_RX_0_PPS (0xbee573fcUL)
+#define STA_LOAD_PPS_RX_1 (0xf6164355UL)
+#define STA_LOAD_PPS_RX_1_PPS (0x83855a4cUL)
+#define STA_LOAD_PPS_TX_0 (0xa47a2c1fUL)
+#define STA_LOAD_PPS_TX_0_PPS (0x788a7a7bUL)
+#define STA_LOAD_PPS_TX_1 (0xd37d1c89UL)
+#define STA_LOAD_PPS_TX_1_PPS (0x45ea53cbUL)
+#define STA_STATUS (0x91c5c51cUL)
+#define STA_STATUS_STAT_TOGGLE_MISSED (0xf7242b11UL)
+
+#endif	/* _NTHW_FPGA_REG_DEFS_STA_ */
drivers/net/ntnic/ntnic_ethdev.c +118 -1

149 lines not on this page · raw message

drivers/net/ntnic/ntnic_filter/ntnic_filter.c +132 -0

155 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.c +30 -0
index 593b56bf5b..355e2032b1 100644
@@ -19,6 +19,21 @@ const struct sg_ops_s *get_sg_ops(void)
 	return sg_ops;
 }
 
+static const struct ntnic_filter_ops *ntnic_filter_ops;
+
+void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops)
+{
+	ntnic_filter_ops = ops;
+}
+
+const struct ntnic_filter_ops *get_ntnic_filter_ops(void)
+{
+	if (ntnic_filter_ops == NULL)
+		ntnic_filter_init();
+
+	return ntnic_filter_ops;
+}
+
 static struct link_ops_s *link_100g_ops;
 
 void register_100g_link_ops(struct link_ops_s *ops)
@@ -47,6 +62,21 @@ const struct port_ops *get_port_ops(void)
 	return port_ops;
 }
 
+static const struct nt4ga_stat_ops *nt4ga_stat_ops;
+
+void register_nt4ga_stat_ops(const struct nt4ga_stat_ops *ops)
+{
+	nt4ga_stat_ops = ops;
+}
+
+const struct nt4ga_stat_ops *get_nt4ga_stat_ops(void)
+{
+	if (nt4ga_stat_ops == NULL)
+		nt4ga_stat_ops_init();
+
+	return nt4ga_stat_ops;
+}
+
 static const struct adapter_ops *adapter_ops;
 
 void register_adapter_ops(const struct adapter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +17 -0
index e40ed9b949..30b9afb7d3 100644
@@ -111,6 +111,14 @@ void register_sg_ops(struct sg_ops_s *ops);
 const struct sg_ops_s *get_sg_ops(void);
 void sg_init(void);
 
+struct ntnic_filter_ops {
+	int (*poll_statistics)(struct pmd_internals *internals);
+};
+
+void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops);
+const struct ntnic_filter_ops *get_ntnic_filter_ops(void);
+void ntnic_filter_init(void);
+
 struct link_ops_s {
 	int (*link_init)(struct adapter_info_s *p_adapter_info, nthw_fpga_t *p_fpga);
 };
@@ -175,6 +183,15 @@ void register_port_ops(const struct port_ops *ops);
 const struct port_ops *get_port_ops(void);
 void port_init(void);
 
+struct nt4ga_stat_ops {
+	int (*nt4ga_stat_init)(struct adapter_info_s *p_adapter_info);
+	int (*nt4ga_stat_setup)(struct adapter_info_s *p_adapter_info);
+};
+
+void register_nt4ga_stat_ops(const struct nt4ga_stat_ops *ops);
+const struct nt4ga_stat_ops *get_nt4ga_stat_ops(void);
+void nt4ga_stat_ops_init(void);
+
 struct adapter_ops {
 	int (*init)(struct adapter_info_s *p_adapter_info);
 	int (*deinit)(struct adapter_info_s *p_adapter_info);
drivers/net/ntnic/ntutil/nt_util.h +1 -0
index a482fb43ad..f2eccf3501 100644
@@ -22,6 +22,7 @@
  * The windows size must max be 3 min in order to
  * prevent overflow.
  */
+#define PORT_LOAD_WINDOWS_SIZE 2ULL
 #define FLM_LOAD_WINDOWS_SIZE 2ULL
 
 #define PCIIDENT_TO_DOMAIN(pci_ident) ((uint16_t)(((unsigned int)(pci_ident) >> 16) & 0xFFFFU))
Signature · 1 line
2.45.0
#381 lore raw

PATCH v5 55/80 net/ntnic: add rpf module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

The Receive Port FIFO module controls the small FPGA FIFO
that packets are stored in before they enter the packet processor pipeline.

---
 .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c |  25 +++-
 drivers/net/ntnic/include/ntnic_stat.h        |   2 +
 drivers/net/ntnic/meson.build                 |   1 +
 .../net/ntnic/nthw/core/include/nthw_rpf.h    |  48 +++++++
 drivers/net/ntnic/nthw/core/nthw_rpf.c        | 119 ++++++++++++++++++
 .../net/ntnic/nthw/model/nthw_fpga_model.c    |  12 ++
 .../net/ntnic/nthw/model/nthw_fpga_model.h    |   1 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   1 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   1 +
 .../nthw/supported/nthw_fpga_reg_defs_rpf.h   |  19 +++
 10 files changed, 228 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_rpf.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_rpf.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +24 -1
index 0e20f3ea45..f733fd5459 100644
@@ -11,6 +11,7 @@
 #include "nt4ga_adapter.h"
 #include "ntnic_nim.h"
 #include "flow_filter.h"
+#include "ntnic_stat.h"
 #include "ntnic_mod_reg.h"
 
 #define DEFAULT_MAX_BPS_SPEED 100e9
@@ -43,7 +44,7 @@ static int nt4ga_stat_init(struct adapter_info_s *p_adapter_info)
 
 			if (!p_nthw_rmc) {
 				nthw_stat_delete(p_nthw_stat);
-				NT_LOG(ERR, NTNIC, "%s: ERROR ", p_adapter_id_str);
+				NT_LOG(ERR, NTNIC, "%s: ERROR rmc allocation", p_adapter_id_str);
 				return -1;
 			}
 
@@ -54,6 +55,22 @@ static int nt4ga_stat_init(struct adapter_info_s *p_adapter_info)
 			p_nt4ga_stat->mp_nthw_rmc = NULL;
 		}
 
+		if (nthw_rpf_init(NULL, p_fpga, p_adapter_info->adapter_no) == 0) {
+			nthw_rpf_t *p_nthw_rpf = nthw_rpf_new();
+
+			if (!p_nthw_rpf) {
+				nthw_stat_delete(p_nthw_stat);
+				NT_LOG_DBGX(ERR, NTNIC, "%s: ERROR", p_adapter_id_str);
+				return -1;
+			}
+
+			nthw_rpf_init(p_nthw_rpf, p_fpga, p_adapter_info->adapter_no);
+			p_nt4ga_stat->mp_nthw_rpf = p_nthw_rpf;
+
+		} else {
+			p_nt4ga_stat->mp_nthw_rpf = NULL;
+		}
+
 		p_nt4ga_stat->mp_nthw_stat = p_nthw_stat;
 		nthw_stat_init(p_nthw_stat, p_fpga, 0);
 
@@ -77,6 +94,9 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)
 	if (p_nt4ga_stat->mp_nthw_rmc)
 		nthw_rmc_block(p_nt4ga_stat->mp_nthw_rmc);
 
+	if (p_nt4ga_stat->mp_nthw_rpf)
+		nthw_rpf_block(p_nt4ga_stat->mp_nthw_rpf);
+
 	/* Allocate and map memory for fpga statistics */
 	{
 		uint32_t n_stat_size = (uint32_t)(p_nthw_stat->m_nb_counters * sizeof(uint32_t) +
@@ -112,6 +132,9 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)
 	if (p_nt4ga_stat->mp_nthw_rmc)
 		nthw_rmc_unblock(p_nt4ga_stat->mp_nthw_rmc, false);
 
+	if (p_nt4ga_stat->mp_nthw_rpf)
+		nthw_rpf_unblock(p_nt4ga_stat->mp_nthw_rpf);
+
 	p_nt4ga_stat->mp_stat_structs_color =
 		calloc(p_nthw_stat->m_nb_color_counters, sizeof(struct color_counters));
 
drivers/net/ntnic/include/ntnic_stat.h +2 -0
index 2aee3f8425..ed24a892ec 100644
@@ -8,6 +8,7 @@
 
 #include "common_adapter_defs.h"
 #include "nthw_rmc.h"
+#include "nthw_rpf.h"
 #include "nthw_fpga_model.h"
 
 #define NT_MAX_COLOR_FLOW_STATS 0x400
@@ -102,6 +103,7 @@ struct flm_counters_v1 {
 struct nt4ga_stat_s {
 	nthw_stat_t *mp_nthw_stat;
 	nthw_rmc_t *mp_nthw_rmc;
+	nthw_rpf_t *mp_nthw_rpf;
 	struct nt_dma_s *p_stat_dma;
 	uint32_t *p_stat_dma_virtual;
 	uint32_t n_stat_size;
drivers/net/ntnic/meson.build +1 -0
index 216341bb11..ed5a201fd5 100644
@@ -47,6 +47,7 @@ sources = files(
         'nthw/core/nthw_iic.c',
         'nthw/core/nthw_mac_pcs.c',
         'nthw/core/nthw_pcie3.c',
+        'nthw/core/nthw_rpf.c',
         'nthw/core/nthw_rmc.c',
         'nthw/core/nthw_sdc.c',
         'nthw/core/nthw_si5340.c',
drivers/net/ntnic/nthw/core/include/nthw_rpf.h new file +48 -0

48 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_rpf.c new file +119 -0

119 lines not on this page · raw message

drivers/net/ntnic/nthw/model/nthw_fpga_model.c +12 -0
index 4d495f5b96..9eaaeb550d 100644
@@ -1050,6 +1050,18 @@ uint32_t nthw_field_get_val32(const nthw_field_t *p)
 	return val;
 }
 
+int32_t nthw_field_get_signed(const nthw_field_t *p)
+{
+	uint32_t val;
+
+	nthw_field_get_val(p, &val, 1);
+
+	if (val & (1U << nthw_field_get_bit_pos_high(p)))	/* check sign */
+		val = val | ~nthw_field_get_mask(p);	/* sign extension */
+
+	return (int32_t)val;	/* cast to signed value */
+}
+
 uint32_t nthw_field_get_updated(const nthw_field_t *p)
 {
 	uint32_t val;
drivers/net/ntnic/nthw/model/nthw_fpga_model.h +1 -0
index 7956f0689e..d4e7ab3edd 100644
@@ -227,6 +227,7 @@ void nthw_field_get_val(const nthw_field_t *p, uint32_t *p_data, uint32_t len);
 void nthw_field_set_val(const nthw_field_t *p, const uint32_t *p_data, uint32_t len);
 void nthw_field_set_val_flush(const nthw_field_t *p, const uint32_t *p_data, uint32_t len);
 uint32_t nthw_field_get_val32(const nthw_field_t *p);
+int32_t nthw_field_get_signed(const nthw_field_t *p);
 uint32_t nthw_field_get_updated(const nthw_field_t *p);
 void nthw_field_update_register(const nthw_field_t *p);
 void nthw_field_flush_register(const nthw_field_t *p);
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
index ddc144dc02..03122acaf5 100644
@@ -41,6 +41,7 @@
 #define MOD_RAC (0xae830b42UL)
 #define MOD_RMC (0x236444eUL)
 #define MOD_RPL (0x6de535c3UL)
+#define MOD_RPF (0x8d30dcddUL)
 #define MOD_RPP_LR (0xba7f945cUL)
 #define MOD_RST9563 (0x385d6d1dUL)
 #define MOD_SDC (0xd2369530UL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
index 8f196f885f..7067f4b1d0 100644
@@ -39,6 +39,7 @@
 #include "nthw_fpga_reg_defs_qsl.h"
 #include "nthw_fpga_reg_defs_rac.h"
 #include "nthw_fpga_reg_defs_rmc.h"
+#include "nthw_fpga_reg_defs_rpf.h"
 #include "nthw_fpga_reg_defs_rpl.h"
 #include "nthw_fpga_reg_defs_rpp_lr.h"
 #include "nthw_fpga_reg_defs_rst9563.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h new file +19 -0
new file mode 100644
index 0000000000..72f450b85d
@@ -0,0 +1,19 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_REG_DEFS_RPF_
+#define _NTHW_FPGA_REG_DEFS_RPF_
+
+/* RPF */
+#define RPF_CONTROL (0x7a5bdb50UL)
+#define RPF_CONTROL_KEEP_ALIVE_EN (0x80be3ffcUL)
+#define RPF_CONTROL_PEN (0xb23137b8UL)
+#define RPF_CONTROL_RPP_EN (0xdb51f109UL)
+#define RPF_CONTROL_ST_TGL_EN (0x45a6ecfaUL)
+#define RPF_TS_SORT_PRG (0xff1d137eUL)
+#define RPF_TS_SORT_PRG_MATURING_DELAY (0x2a38e127UL)
+#define RPF_TS_SORT_PRG_TS_AT_EOF (0x9f27d433UL)
+
+#endif	/* _NTHW_FPGA_REG_DEFS_RPF_ */
Signature · 1 line
2.45.0
#382 lore raw

PATCH v5 56/80 net/ntnic: add statistics poll

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Mechanism which poll statistics module and update values with dma module.

---
 doc/guides/nics/ntnic.rst                     |   1 +
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c | 343 ++++++++++++++++++
 drivers/net/ntnic/include/ntdrv_4ga.h         |   1 +
 drivers/net/ntnic/include/ntnic_stat.h        |  78 ++++
 .../net/ntnic/nthw/core/include/nthw_rmc.h    |   5 +
 drivers/net/ntnic/nthw/core/nthw_rmc.c        |  20 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |   1 +
 drivers/net/ntnic/nthw/stat/nthw_stat.c       | 128 +++++++
 drivers/net/ntnic/ntnic_ethdev.c              | 143 ++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |   2 +
 11 files changed, 723 insertions(+)
doc/guides/nics/ntnic.rst +1 -0
index 4ed732d9f8..6e3a290a5c 100644
@@ -63,6 +63,7 @@ Features
    source only, destination only or both.
 - Several RSS hash keys, one for each flow type.
 - Default RSS operation with no hash key specification.
+- Port and queue statistics.
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index 2cace179b3..1b7e4ab3ae 100644
@@ -163,6 +163,7 @@ New Features
   * Added basic handling of the virtual queues.
   * Added flow handling support
   * Enable virtual queues
+  * Added statistics support
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +343 -0

358 lines not on this page · raw message

drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
index 1135e9a539..38e4d0ca35 100644
@@ -16,6 +16,7 @@ typedef struct ntdrv_4ga_s {
 	volatile bool b_shutdown;
 	rte_thread_t flm_thread;
 	pthread_mutex_t stat_lck;
+	rte_thread_t stat_thread;
 } ntdrv_4ga_t;
 
 #endif	/* __NTDRV_4GA_H__ */
drivers/net/ntnic/include/ntnic_stat.h +78 -0

104 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_rmc.h +5 -0
index b239752674..9c40804cd9 100644
@@ -47,4 +47,9 @@ int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance);
 void nthw_rmc_block(nthw_rmc_t *p);
 void nthw_rmc_unblock(nthw_rmc_t *p, bool b_is_secondary);
 
+uint32_t nthw_rmc_get_status_sf_ram_of(nthw_rmc_t *p);
+uint32_t nthw_rmc_get_status_descr_fifo_of(nthw_rmc_t *p);
+uint32_t nthw_rmc_get_dbg_merge(nthw_rmc_t *p);
+uint32_t nthw_rmc_get_mac_if_err(nthw_rmc_t *p);
+
 #endif	/* NTHW_RMC_H_ */
drivers/net/ntnic/nthw/core/nthw_rmc.c +20 -0
index 748519aeb4..570a179fc8 100644
@@ -77,6 +77,26 @@ int nthw_rmc_init(nthw_rmc_t *p, nthw_fpga_t *p_fpga, int n_instance)
 	return 0;
 }
 
+uint32_t nthw_rmc_get_status_sf_ram_of(nthw_rmc_t *p)
+{
+	return (p->mp_reg_status) ? nthw_field_get_updated(p->mp_fld_sf_ram_of) : 0xffffffff;
+}
+
+uint32_t nthw_rmc_get_status_descr_fifo_of(nthw_rmc_t *p)
+{
+	return (p->mp_reg_status) ? nthw_field_get_updated(p->mp_fld_descr_fifo_of) : 0xffffffff;
+}
+
+uint32_t nthw_rmc_get_dbg_merge(nthw_rmc_t *p)
+{
+	return (p->mp_reg_dbg) ? nthw_field_get_updated(p->mp_fld_dbg_merge) : 0xffffffff;
+}
+
+uint32_t nthw_rmc_get_mac_if_err(nthw_rmc_t *p)
+{
+	return (p->mp_reg_mac_if) ? nthw_field_get_updated(p->mp_fld_mac_if_err) : 0xffffffff;
+}
+
 void nthw_rmc_block(nthw_rmc_t *p)
 {
 	/* BLOCK_STATT(0)=1 BLOCK_KEEPA(1)=1 BLOCK_MAC_PORT(8:11)=~0 */
drivers/net/ntnic/nthw/flow_api/flow_api.c +1 -0
index 4847b2de99..84ab811369 100644
@@ -7,6 +7,7 @@
 
 #include "flow_api_engine.h"
 #include "flow_api_nic_setup.h"
+#include "ntlog.h"
 #include "ntnic_mod_reg.h"
 
 #include "flow_api.h"
drivers/net/ntnic/nthw/stat/nthw_stat.c +128 -0

131 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +143 -0

191 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +2 -0
index 30b9afb7d3..8b825d8c48 100644
@@ -186,6 +186,8 @@ void port_init(void);
 struct nt4ga_stat_ops {
 	int (*nt4ga_stat_init)(struct adapter_info_s *p_adapter_info);
 	int (*nt4ga_stat_setup)(struct adapter_info_s *p_adapter_info);
+	int (*nt4ga_stat_collect)(struct adapter_info_s *p_adapter_info,
+		nt4ga_stat_t *p_nt4ga_stat);
 };
 
 void register_nt4ga_stat_ops(const struct nt4ga_stat_ops *ops);
Signature · 1 line
2.45.0
#383 lore raw

PATCH v5 57/80 net/ntnic: added flm stat interface

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

flm stat module interface was added.

---
 drivers/net/ntnic/include/flow_api.h       |  2 ++
 drivers/net/ntnic/include/flow_filter.h    |  1 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c | 11 +++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h          |  2 ++
 4 files changed, 16 insertions(+)
drivers/net/ntnic/include/flow_api.h +2 -0
index 4a1525f237..ed96f77bc0 100644
@@ -233,4 +233,6 @@ int flow_nic_set_hasher(struct flow_nic_dev *ndev, int hsh_idx, enum flow_nic_ha
 int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,
 	struct nt_eth_rss_conf rss_conf);
 
+int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
+
 #endif
drivers/net/ntnic/include/flow_filter.h +1 -0
index d204c0d882..01777f8c9f 100644
@@ -11,5 +11,6 @@
 
 int flow_filter_init(nthw_fpga_t *p_fpga, struct flow_nic_dev **p_flow_device, int adapter_no);
 int flow_filter_done(struct flow_nic_dev *dev);
+int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
 
 #endif  /* __FLOW_FILTER_HPP__ */
drivers/net/ntnic/nthw/flow_api/flow_api.c +11 -0
index 84ab811369..d5a4b0b10c 100644
@@ -1014,6 +1014,16 @@ int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,
 	return profile_inline_ops->flow_nic_set_hasher_fields_inline(ndev, hsh_idx, rss_conf);
 }
 
+int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size)
+{
+	(void)ndev;
+	(void)data;
+	(void)size;
+
+	NT_LOG_DBGX(DBG, FILTER, "Not implemented yet");
+	return -1;
+}
+
 static const struct flow_filter_ops ops = {
 	.flow_filter_init = flow_filter_init,
 	.flow_filter_done = flow_filter_done,
@@ -1028,6 +1038,7 @@ static const struct flow_filter_ops ops = {
 	.flow_destroy = flow_destroy,
 	.flow_flush = flow_flush,
 	.flow_dev_dump = flow_dev_dump,
+	.flow_get_flm_stats = flow_get_flm_stats,
 
 	/*
 	 * Other
drivers/net/ntnic/ntnic_mod_reg.h +2 -0
index 8b825d8c48..8703d478b6 100644
@@ -336,6 +336,8 @@ struct flow_filter_ops {
 	int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id,
 		struct rte_flow_error *error);
 
+	int (*flow_get_flm_stats)(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
+
 	/*
 	 * Other
 	 */
Signature · 1 line
2.45.0
#384 lore raw

PATCH v5 58/80 net/ntnic: add TSM module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

TSM module which operate with timers
in the physical nic was added.

Necessary defines and implementation were added.

The Time Stamp Module controls every aspect of packet timestamping, including time synchronization, time stamp format, PTP protocol, etc.

---
 drivers/net/ntnic/meson.build                 |   1 +
 .../net/ntnic/nthw/core/include/nthw_tsm.h    |  56 ++++++
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  47 +++++
 drivers/net/ntnic/nthw/core/nthw_tsm.c        | 167 ++++++++++++++++++
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   1 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   1 +
 .../nthw/supported/nthw_fpga_reg_defs_tsm.h   |  28 +++
 7 files changed, 301 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_tsm.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_tsm.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h
drivers/net/ntnic/meson.build +1 -0
index ed5a201fd5..a6c4fec0be 100644
@@ -41,6 +41,7 @@ sources = files(
         'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
         'nthw/core/nthw_fpga.c',
         'nthw/core/nthw_gmf.c',
+        'nthw/core/nthw_tsm.c',
         'nthw/core/nthw_gpio_phy.c',
         'nthw/core/nthw_hif.c',
         'nthw/core/nthw_i2cm.c',
drivers/net/ntnic/nthw/core/include/nthw_tsm.h new file +56 -0

56 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_fpga.c +47 -0

65 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_tsm.c new file +167 -0

167 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
index 03122acaf5..e6ed9e714b 100644
@@ -48,6 +48,7 @@
 #define MOD_SLC (0x1aef1f38UL)
 #define MOD_SLC_LR (0x969fc50bUL)
 #define MOD_STA (0x76fae64dUL)
+#define MOD_TSM (0x35422a24UL)
 #define MOD_TX_CPY (0x60acf217UL)
 #define MOD_TX_INS (0x59afa100UL)
 #define MOD_TX_RPL (0x1095dfbbUL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
index 7067f4b1d0..4d299c6aa8 100644
@@ -44,6 +44,7 @@
 #include "nthw_fpga_reg_defs_rpp_lr.h"
 #include "nthw_fpga_reg_defs_rst9563.h"
 #include "nthw_fpga_reg_defs_sdc.h"
+#include "nthw_fpga_reg_defs_tsm.h"
 #include "nthw_fpga_reg_defs_slc.h"
 #include "nthw_fpga_reg_defs_slc_lr.h"
 #include "nthw_fpga_reg_defs_sta.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h new file +28 -0
new file mode 100644
index 0000000000..a087850aa4
@@ -0,0 +1,28 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _NTHW_FPGA_REG_DEFS_TSM_
+#define _NTHW_FPGA_REG_DEFS_TSM_
+
+/* TSM */
+#define TSM_CONFIG (0xef5dec83UL)
+#define TSM_CONFIG_TS_FORMAT (0xe6efc2faUL)
+#define TSM_TIMER_CTRL (0x648da051UL)
+#define TSM_TIMER_CTRL_TIMER_EN_T0 (0x17cee154UL)
+#define TSM_TIMER_CTRL_TIMER_EN_T1 (0x60c9d1c2UL)
+#define TSM_TIMER_T0 (0x417217a5UL)
+#define TSM_TIMER_T0_MAX_COUNT (0xaa601706UL)
+#define TSM_TIMER_T1 (0x36752733UL)
+#define TSM_TIMER_T1_MAX_COUNT (0x6beec8c6UL)
+#define TSM_TIME_HI (0x175acea1UL)
+#define TSM_TIME_HI_SEC (0xc0e9c9a1UL)
+#define TSM_TIME_LO (0x9a55ae90UL)
+#define TSM_TIME_LO_NS (0x879c5c4bUL)
+#define TSM_TS_HI (0xccfe9e5eUL)
+#define TSM_TS_HI_TIME (0xc23fed30UL)
+#define TSM_TS_LO (0x41f1fe6fUL)
+#define TSM_TS_LO_TIME (0xe0292a3eUL)
+
+#endif	/* _NTHW_FPGA_REG_DEFS_TSM_ */
Signature · 1 line
2.45.0
#385 lore raw

PATCH v5 59/80 net/ntnic: add STA module

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

fpga map was extended with STA module
support which enable statistics functionality.

---
 .../supported/nthw_fpga_9563_055_049_0000.c   | 92 ++++++++++++++++++-
 .../nthw/supported/nthw_fpga_mod_str_map.c    |  1 +
 .../nthw/supported/nthw_fpga_reg_defs_sta.h   |  8 ++
 3 files changed, 100 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +91 -1
index a3d9f94fc6..efdb084cd6 100644
@@ -2486,6 +2486,95 @@ static nthw_fpga_register_init_s slc_registers[] = {
 	{ SLC_RCP_DATA, 1, 36, NTHW_FPGA_REG_TYPE_WO, 0, 7, slc_rcp_data_fields },
 };
 
+static nthw_fpga_field_init_s sta_byte_fields[] = {
+	{ STA_BYTE_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_cfg_fields[] = {
+	{ STA_CFG_CNT_CLEAR, 1, 1, 0 },
+	{ STA_CFG_DMA_ENA, 1, 0, 0 },
+};
+
+static nthw_fpga_field_init_s sta_cv_err_fields[] = {
+	{ STA_CV_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_fcs_err_fields[] = {
+	{ STA_FCS_ERR_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_host_adr_lsb_fields[] = {
+	{ STA_HOST_ADR_LSB_LSB, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s sta_host_adr_msb_fields[] = {
+	{ STA_HOST_ADR_MSB_MSB, 32, 0, 0 },
+};
+
+static nthw_fpga_field_init_s sta_load_bin_fields[] = {
+	{ STA_LOAD_BIN_BIN, 32, 0, 8388607 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_rx_0_fields[] = {
+	{ STA_LOAD_BPS_RX_0_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_rx_1_fields[] = {
+	{ STA_LOAD_BPS_RX_1_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_tx_0_fields[] = {
+	{ STA_LOAD_BPS_TX_0_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_bps_tx_1_fields[] = {
+	{ STA_LOAD_BPS_TX_1_BPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_rx_0_fields[] = {
+	{ STA_LOAD_PPS_RX_0_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_rx_1_fields[] = {
+	{ STA_LOAD_PPS_RX_1_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_tx_0_fields[] = {
+	{ STA_LOAD_PPS_TX_0_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_load_pps_tx_1_fields[] = {
+	{ STA_LOAD_PPS_TX_1_PPS, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_pckt_fields[] = {
+	{ STA_PCKT_CNT, 32, 0, 0x0000 },
+};
+
+static nthw_fpga_field_init_s sta_status_fields[] = {
+	{ STA_STATUS_STAT_TOGGLE_MISSED, 1, 0, 0x0000 },
+};
+
+static nthw_fpga_register_init_s sta_registers[] = {
+	{ STA_BYTE, 4, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_byte_fields },
+	{ STA_CFG, 0, 2, NTHW_FPGA_REG_TYPE_RW, 0, 2, sta_cfg_fields },
+	{ STA_CV_ERR, 5, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_cv_err_fields },
+	{ STA_FCS_ERR, 6, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_fcs_err_fields },
+	{ STA_HOST_ADR_LSB, 1, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, sta_host_adr_lsb_fields },
+	{ STA_HOST_ADR_MSB, 2, 32, NTHW_FPGA_REG_TYPE_WO, 0, 1, sta_host_adr_msb_fields },
+	{ STA_LOAD_BIN, 8, 32, NTHW_FPGA_REG_TYPE_WO, 8388607, 1, sta_load_bin_fields },
+	{ STA_LOAD_BPS_RX_0, 11, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_rx_0_fields },
+	{ STA_LOAD_BPS_RX_1, 13, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_rx_1_fields },
+	{ STA_LOAD_BPS_TX_0, 15, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_tx_0_fields },
+	{ STA_LOAD_BPS_TX_1, 17, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_bps_tx_1_fields },
+	{ STA_LOAD_PPS_RX_0, 10, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_rx_0_fields },
+	{ STA_LOAD_PPS_RX_1, 12, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_rx_1_fields },
+	{ STA_LOAD_PPS_TX_0, 14, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_tx_0_fields },
+	{ STA_LOAD_PPS_TX_1, 16, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_load_pps_tx_1_fields },
+	{ STA_PCKT, 3, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, sta_pckt_fields },
+	{ STA_STATUS, 7, 1, NTHW_FPGA_REG_TYPE_RC1, 0, 1, sta_status_fields },
+};
+
 static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_CAT, 0, MOD_CAT, 0, 21, NTHW_FPGA_BUS_TYPE_RAB1, 768, 34, cat_registers },
 	{ MOD_CSU, 0, MOD_CSU, 0, 0, NTHW_FPGA_BUS_TYPE_RAB1, 9728, 2, csu_registers },
@@ -2537,6 +2626,7 @@ static nthw_fpga_module_init_s fpga_modules[] = {
 	{ MOD_TX_CPY, 0, MOD_CPY, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 9216, 26, cpy_registers },
 	{ MOD_TX_INS, 0, MOD_INS, 0, 2, NTHW_FPGA_BUS_TYPE_RAB1, 8704, 2, ins_registers },
 	{ MOD_TX_RPL, 0, MOD_RPL, 0, 4, NTHW_FPGA_BUS_TYPE_RAB1, 8960, 6, rpl_registers },
+	{ MOD_STA, 0, MOD_STA, 0, 9, NTHW_FPGA_BUS_TYPE_RAB0, 2048, 17, sta_registers },
 };
 
 static nthw_fpga_prod_param_s product_parameters[] = {
@@ -2695,5 +2785,5 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 };
 
 nthw_fpga_prod_init_s nthw_fpga_9563_055_049_0000 = {
-	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 35, fpga_modules,
+	200, 9563, 55, 49, 0, 0, 1726740521, 152, product_parameters, 36, fpga_modules,
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c +1 -0
index 150b9dd976..a2ab266931 100644
@@ -19,5 +19,6 @@ const struct nthw_fpga_mod_str_s sa_nthw_fpga_mod_str_map[] = {
 	{ MOD_RAC, "RAC" },
 	{ MOD_RST9563, "RST9563" },
 	{ MOD_SDC, "SDC" },
+	{ MOD_STA, "STA" },
 	{ 0UL, NULL }
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h +8 -0
index 640ffcbc52..0cd183fcaa 100644
@@ -7,11 +7,17 @@
 #define _NTHW_FPGA_REG_DEFS_STA_
 
 /* STA */
+#define STA_BYTE (0xa08364d4UL)
+#define STA_BYTE_CNT (0x3119e6bcUL)
 #define STA_CFG (0xcecaf9f4UL)
 #define STA_CFG_CNT_CLEAR (0xc325e12eUL)
 #define STA_CFG_CNT_FRZ (0x8c27a596UL)
 #define STA_CFG_DMA_ENA (0x940dbacUL)
 #define STA_CFG_TX_DISABLE (0x30f43250UL)
+#define STA_CV_ERR (0x7db7db5dUL)
+#define STA_CV_ERR_CNT (0x2c02fbbeUL)
+#define STA_FCS_ERR (0xa0de1647UL)
+#define STA_FCS_ERR_CNT (0xc68c37d1UL)
 #define STA_HOST_ADR_LSB (0xde569336UL)
 #define STA_HOST_ADR_LSB_LSB (0xb6f2f94bUL)
 #define STA_HOST_ADR_MSB (0xdf94f901UL)
@@ -34,6 +40,8 @@
 #define STA_LOAD_PPS_TX_0_PPS (0x788a7a7bUL)
 #define STA_LOAD_PPS_TX_1 (0xd37d1c89UL)
 #define STA_LOAD_PPS_TX_1_PPS (0x45ea53cbUL)
+#define STA_PCKT (0xecc8f30aUL)
+#define STA_PCKT_CNT (0x63291d16UL)
 #define STA_STATUS (0x91c5c51cUL)
 #define STA_STATUS_STAT_TOGGLE_MISSED (0xf7242b11UL)
 
Signature · 1 line
2.45.0
#386 lore raw

PATCH v5 60/80 net/ntnic: add TSM module

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

fpga map was extended with tsm module
support which enable statistics functionality.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 .../supported/nthw_fpga_9563_055_049_0000.c   | 394 +++++++++++++++++-
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   1 +
 .../nthw/supported/nthw_fpga_reg_defs_tsm.h   | 177 ++++++++
 4 files changed, 572 insertions(+), 1 deletion(-)
doc/guides/nics/features/ntnic.ini +1 -0
index e5d5abd0ed..64351bcdc7 100644
@@ -12,6 +12,7 @@ Unicast MAC filter   = Y
 Multicast MAC filter = Y
 RSS hash             = Y
 RSS key update       = Y
+Basic stats          = Y
 Linux                = Y
 x86-64               = Y
 
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +393 -1

410 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c +1 -0
index a2ab266931..e8ed7faf0d 100644
@@ -20,5 +20,6 @@ const struct nthw_fpga_mod_str_s sa_nthw_fpga_mod_str_map[] = {
 	{ MOD_RST9563, "RST9563" },
 	{ MOD_SDC, "SDC" },
 	{ MOD_STA, "STA" },
+	{ MOD_TSM, "TSM" },
 	{ 0UL, NULL }
 };
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h +177 -0

198 lines not on this page · raw message

Signature · 1 line
2.45.0
#387 lore raw

PATCH v5 61/80 net/ntnic: add xStats

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Extended statistics implementation and
initialization were added.

Extended set of operations for eth dev with xstats support.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 doc/guides/nics/ntnic.rst                     |   2 +
 drivers/net/ntnic/include/ntnic_stat.h        |  36 +
 drivers/net/ntnic/meson.build                 |   1 +
 drivers/net/ntnic/ntnic_ethdev.c              | 112 +++
 drivers/net/ntnic/ntnic_mod_reg.c             |  15 +
 drivers/net/ntnic/ntnic_mod_reg.h             |  28 +
 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c | 829 ++++++++++++++++++
 8 files changed, 1024 insertions(+)
 create mode 100644 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
doc/guides/nics/features/ntnic.ini +1 -0
index 64351bcdc7..947c7ba3a1 100644
@@ -13,6 +13,7 @@ Multicast MAC filter = Y
 RSS hash             = Y
 RSS key update       = Y
 Basic stats          = Y
+Extended stats       = Y
 Linux                = Y
 x86-64               = Y
 
doc/guides/nics/ntnic.rst +2 -0
index 6e3a290a5c..bae27ce1ce 100644
@@ -64,6 +64,8 @@ Features
 - Several RSS hash keys, one for each flow type.
 - Default RSS operation with no hash key specification.
 - Port and queue statistics.
+- RMON statistics in extended stats.
+- Link state information.
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/include/ntnic_stat.h +36 -0
index 0735dbc085..4d4affa3cf 100644
@@ -169,6 +169,39 @@ struct port_counters_v2 {
 };
 
 struct flm_counters_v1 {
+	/* FLM 0.17 */
+	uint64_t current;
+	uint64_t learn_done;
+	uint64_t learn_ignore;
+	uint64_t learn_fail;
+	uint64_t unlearn_done;
+	uint64_t unlearn_ignore;
+	uint64_t auto_unlearn_done;
+	uint64_t auto_unlearn_ignore;
+	uint64_t auto_unlearn_fail;
+	uint64_t timeout_unlearn_done;
+	uint64_t rel_done;
+	uint64_t rel_ignore;
+	/* FLM 0.20 */
+	uint64_t prb_done;
+	uint64_t prb_ignore;
+	uint64_t sta_done;
+	uint64_t inf_done;
+	uint64_t inf_skip;
+	uint64_t pck_hit;
+	uint64_t pck_miss;
+	uint64_t pck_unh;
+	uint64_t pck_dis;
+	uint64_t csh_hit;
+	uint64_t csh_miss;
+	uint64_t csh_unh;
+	uint64_t cuc_start;
+	uint64_t cuc_move;
+	/* FLM 0.17 Load */
+	uint64_t load_lps;
+	uint64_t load_aps;
+	uint64_t max_lps;
+	uint64_t max_aps;
 };
 
 struct nt4ga_stat_s {
@@ -200,6 +233,9 @@ struct nt4ga_stat_s {
 	struct host_buffer_counters *mp_stat_structs_hb;
 	struct port_load_counters *mp_port_load;
 
+	int flm_stat_ver;
+	struct flm_counters_v1 *mp_stat_structs_flm;
+
 	/* Rx/Tx totals: */
 	uint64_t n_totals_reset_timestamp;	/* timestamp for last totals reset */
 
drivers/net/ntnic/meson.build +1 -0
index a6c4fec0be..e59ac5bdb3 100644
@@ -31,6 +31,7 @@ sources = files(
         'link_mgmt/nt4ga_link.c',
         'nim/i2c_nim.c',
         'ntnic_filter/ntnic_filter.c',
+        'ntnic_xstats/ntnic_xstats.c',
         'nthw/dbs/nthw_dbs.c',
         'nthw/supported/nthw_fpga_9563_055_049_0000.c',
         'nthw/supported/nthw_fpga_instances.c',
drivers/net/ntnic/ntnic_ethdev.c +112 -0

124 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.c +15 -0
index 355e2032b1..6737d18a6f 100644
@@ -192,3 +192,18 @@ const struct rte_flow_ops *get_dev_flow_ops(void)
 
 	return dev_flow_ops;
 }
+
+static struct ntnic_xstats_ops *ntnic_xstats_ops;
+
+void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops)
+{
+	ntnic_xstats_ops = ops;
+}
+
+struct ntnic_xstats_ops *get_ntnic_xstats_ops(void)
+{
+	if (ntnic_xstats_ops == NULL)
+		ntnic_xstats_ops_init();
+
+	return ntnic_xstats_ops;
+}
drivers/net/ntnic/ntnic_mod_reg.h +28 -0
index 8703d478b6..65e7972c68 100644
@@ -7,6 +7,10 @@
 #define __NTNIC_MOD_REG_H__
 
 #include <stdint.h>
+
+#include "rte_ethdev.h"
+#include "rte_flow_driver.h"
+
 #include "flow_api.h"
 #include "stream_binary_flow_api.h"
 #include "nthw_fpga_model.h"
@@ -354,4 +358,28 @@ void register_flow_filter_ops(const struct flow_filter_ops *ops);
 const struct flow_filter_ops *get_flow_filter_ops(void);
 void init_flow_filter(void);
 
+struct ntnic_xstats_ops {
+	int (*nthw_xstats_get_names)(nt4ga_stat_t *p_nt4ga_stat,
+		struct rte_eth_xstat_name *xstats_names,
+		unsigned int size);
+	int (*nthw_xstats_get)(nt4ga_stat_t *p_nt4ga_stat,
+		struct rte_eth_xstat *stats,
+		unsigned int n,
+		uint8_t port);
+	void (*nthw_xstats_reset)(nt4ga_stat_t *p_nt4ga_stat, uint8_t port);
+	int (*nthw_xstats_get_names_by_id)(nt4ga_stat_t *p_nt4ga_stat,
+		struct rte_eth_xstat_name *xstats_names,
+		const uint64_t *ids,
+		unsigned int size);
+	int (*nthw_xstats_get_by_id)(nt4ga_stat_t *p_nt4ga_stat,
+		const uint64_t *ids,
+		uint64_t *values,
+		unsigned int n,
+		uint8_t port);
+};
+
+void register_ntnic_xstats_ops(struct ntnic_xstats_ops *ops);
+struct ntnic_xstats_ops *get_ntnic_xstats_ops(void);
+void ntnic_xstats_ops_init(void);
+
 #endif	/* __NTNIC_MOD_REG_H__ */
drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c new file +829 -0

829 lines not on this page · raw message

Signature · 1 line
2.45.0
#388 lore raw

PATCH v5 62/80 net/ntnic: added flow statistics

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

xstats was extended with flow statistics support.

Additional counters that shows learn, unlearn, lps, aps and other.

---
 doc/guides/nics/ntnic.rst                     |   1 +
 .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c |  40 ++++
 drivers/net/ntnic/include/hw_mod_backend.h    |   3 +
 drivers/net/ntnic/include/ntdrv_4ga.h         |   1 +
 drivers/net/ntnic/meson.build                 |   1 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  11 +-
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c   | 142 ++++++++++++++
 .../flow_api/profile_inline/flm_evt_queue.c   | 176 ++++++++++++++++++
 .../flow_api/profile_inline/flm_evt_queue.h   |  52 ++++++
 .../profile_inline/flow_api_profile_inline.c  |  46 +++++
 .../profile_inline/flow_api_profile_inline.h  |   6 +
 drivers/net/ntnic/nthw/rte_pmd_ntnic.h        |  43 +++++
 drivers/net/ntnic/ntnic_ethdev.c              | 132 +++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |   7 +
 14 files changed, 657 insertions(+), 4 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h
 create mode 100644 drivers/net/ntnic/nthw/rte_pmd_ntnic.h
doc/guides/nics/ntnic.rst +1 -0
index bae27ce1ce..47960ca3f1 100644
@@ -66,6 +66,7 @@ Features
 - Port and queue statistics.
 - RMON statistics in extended stats.
 - Link state information.
+- Flow statistics
 
 Limitations
 ~~~~~~~~~~~
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +40 -0
index 3afc5b7853..8fedfdcd04 100644
@@ -189,6 +189,24 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)
 		return -1;
 	}
 
+	if (get_flow_filter_ops() != NULL) {
+		struct flow_nic_dev *ndev = p_adapter_info->nt4ga_filter.mp_flow_device;
+		p_nt4ga_stat->flm_stat_ver = ndev->be.flm.ver;
+		p_nt4ga_stat->mp_stat_structs_flm = calloc(1, sizeof(struct flm_counters_v1));
+
+		if (!p_nt4ga_stat->mp_stat_structs_flm) {
+			NT_LOG_DBGX(ERR, GENERAL, "Cannot allocate mem.");
+			return -1;
+		}
+
+		p_nt4ga_stat->mp_stat_structs_flm->max_aps =
+			nthw_fpga_get_product_param(p_adapter_info->fpga_info.mp_fpga,
+				NT_FLM_LOAD_APS_MAX, 0);
+		p_nt4ga_stat->mp_stat_structs_flm->max_lps =
+			nthw_fpga_get_product_param(p_adapter_info->fpga_info.mp_fpga,
+				NT_FLM_LOAD_LPS_MAX, 0);
+	}
+
 	p_nt4ga_stat->mp_port_load =
 		calloc(NUM_ADAPTER_PORTS_MAX, sizeof(struct port_load_counters));
 
@@ -236,6 +254,7 @@ static int nt4ga_stat_collect_cap_v1_stats(struct adapter_info_s *p_adapter_info
 		return -1;
 
 	nthw_stat_t *p_nthw_stat = p_nt4ga_stat->mp_nthw_stat;
+	struct flow_nic_dev *ndev = p_adapter_info->nt4ga_filter.mp_flow_device;
 
 	const int n_rx_ports = p_nt4ga_stat->mn_rx_ports;
 	const int n_tx_ports = p_nt4ga_stat->mn_tx_ports;
@@ -542,6 +561,27 @@ static int nt4ga_stat_collect_cap_v1_stats(struct adapter_info_s *p_adapter_info
 			(uint64_t)(((__uint128_t)val * 32ULL) / PORT_LOAD_WINDOWS_SIZE);
 	}
 
+	/* Update and get FLM stats */
+	flow_filter_ops->flow_get_flm_stats(ndev, (uint64_t *)p_nt4ga_stat->mp_stat_structs_flm,
+		sizeof(struct flm_counters_v1) / sizeof(uint64_t));
+
+	/*
+	 * Calculate correct load values:
+	 * rpp = nthw_fpga_get_product_param(p_fpga, NT_RPP_PER_PS, 0);
+	 * bin = (uint32_t)(((FLM_LOAD_WINDOWS_SIZE * 1000000000000ULL) / (32ULL * rpp)) - 1ULL);
+	 * load_aps = ((uint64_t)load_aps * 1000000000000ULL) / (uint64_t)((bin+1) * rpp);
+	 * load_lps = ((uint64_t)load_lps * 1000000000000ULL) / (uint64_t)((bin+1) * rpp);
+	 *
+	 * Simplified it gives:
+	 *
+	 * load_lps = (load_lps * 32ULL) / FLM_LOAD_WINDOWS_SIZE
+	 * load_aps = (load_aps * 32ULL) / FLM_LOAD_WINDOWS_SIZE
+	 */
+
+	p_nt4ga_stat->mp_stat_structs_flm->load_aps =
+		(p_nt4ga_stat->mp_stat_structs_flm->load_aps * 32ULL) / FLM_LOAD_WINDOWS_SIZE;
+	p_nt4ga_stat->mp_stat_structs_flm->load_lps =
+		(p_nt4ga_stat->mp_stat_structs_flm->load_lps * 32ULL) / FLM_LOAD_WINDOWS_SIZE;
 	return 0;
 }
 
drivers/net/ntnic/include/hw_mod_backend.h +3 -0
index 17d5755634..9cd9d92823 100644
@@ -688,6 +688,9 @@ int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field,
 int hw_mod_flm_rcp_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
 	uint32_t value);
 
+int hw_mod_flm_stat_update(struct flow_api_backend_s *be);
+int hw_mod_flm_stat_get(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value);
+
 int hw_mod_flm_lrn_data_set_flush(struct flow_api_backend_s *be, enum hw_flm_e field,
 	const uint32_t *value, uint32_t records,
 	uint32_t *handled_records, uint32_t *inf_word_cnt,
drivers/net/ntnic/include/ntdrv_4ga.h +1 -0
index 38e4d0ca35..677aa7b6c8 100644
@@ -17,6 +17,7 @@ typedef struct ntdrv_4ga_s {
 	rte_thread_t flm_thread;
 	pthread_mutex_t stat_lck;
 	rte_thread_t stat_thread;
+	rte_thread_t port_event_thread;
 } ntdrv_4ga_t;
 
 #endif	/* __NTDRV_4GA_H__ */
drivers/net/ntnic/meson.build +1 -0
index e59ac5bdb3..c0b7729929 100644
@@ -59,6 +59,7 @@ sources = files(
         'nthw/flow_api/flow_id_table.c',
         'nthw/flow_api/hw_mod/hw_mod_backend.c',
         'nthw/flow_api/profile_inline/flm_lrn_queue.c',
+        'nthw/flow_api/profile_inline/flm_evt_queue.c',
         'nthw/flow_api/profile_inline/flow_api_profile_inline.c',
         'nthw/flow_api/profile_inline/flow_api_hw_db_inline.c',
         'nthw/flow_api/flow_backend/flow_backend.c',
drivers/net/ntnic/nthw/flow_api/flow_api.c +7 -4
index d5a4b0b10c..0e9fc33dec 100644
@@ -1016,11 +1016,14 @@ int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,
 
 int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size)
 {
-	(void)ndev;
-	(void)data;
-	(void)size;
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL)
+		return -1;
+
+	if (ndev->flow_profile == FLOW_ETH_DEV_PROFILE_INLINE)
+		return profile_inline_ops->flow_get_flm_stats_profile_inline(ndev, data, size);
 
-	NT_LOG_DBGX(DBG, FILTER, "Not implemented yet");
 	return -1;
 }
 
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +142 -0

148 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c new file +176 -0

176 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h new file +52 -0

52 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +46 -0

58 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +6 -0
index c695842077..b44d3a7291 100644
@@ -52,4 +52,10 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,
 	int hsh_idx,
 	struct nt_eth_rss_conf rss_conf);
 
+/*
+ * Stats
+ */
+
+int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
+
 #endif	/* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/nthw/rte_pmd_ntnic.h new file +43 -0

43 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +132 -0

156 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +7 -0
index 65e7972c68..7325bd1ea8 100644
@@ -290,6 +290,13 @@ struct profile_inline_ops {
 		int hsh_idx,
 		struct nt_eth_rss_conf rss_conf);
 
+	/*
+	 * Stats
+	 */
+	int (*flow_get_flm_stats_profile_inline)(struct flow_nic_dev *ndev,
+		uint64_t *data,
+		uint64_t size);
+
 	/*
 	 * NT Flow FLM queue API
 	 */
Signature · 1 line
2.45.0
#389 lore raw

PATCH v5 63/80 net/ntnic: add scrub registers

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Scrub fields were added to the fpga map file
Remove duplicated macro

---
 .../supported/nthw_fpga_9563_055_049_0000.c     | 17 ++++++++++++++++-
 drivers/net/ntnic/ntnic_ethdev.c                |  3 ---
 2 files changed, 16 insertions(+), 4 deletions(-)
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_049_0000.c +16 -1
index 620968ceb6..f1033ca949 100644
@@ -728,7 +728,7 @@ static nthw_fpga_field_init_s flm_lrn_data_fields[] = {
 	{ FLM_LRN_DATA_PRIO, 2, 691, 0x0000 }, { FLM_LRN_DATA_PROT, 8, 320, 0x0000 },
 	{ FLM_LRN_DATA_QFI, 6, 704, 0x0000 }, { FLM_LRN_DATA_QW0, 128, 192, 0x0000 },
 	{ FLM_LRN_DATA_QW4, 128, 64, 0x0000 }, { FLM_LRN_DATA_RATE, 16, 416, 0x0000 },
-	{ FLM_LRN_DATA_RQI, 1, 710, 0x0000 },
+	{ FLM_LRN_DATA_RQI, 1, 710, 0x0000 }, { FLM_LRN_DATA_SCRUB_PROF, 4, 712, 0x0000 },
 	{ FLM_LRN_DATA_SIZE, 16, 432, 0x0000 }, { FLM_LRN_DATA_STAT_PROF, 4, 687, 0x0000 },
 	{ FLM_LRN_DATA_SW8, 32, 32, 0x0000 }, { FLM_LRN_DATA_SW9, 32, 0, 0x0000 },
 	{ FLM_LRN_DATA_TEID, 32, 368, 0x0000 }, { FLM_LRN_DATA_VOL_IDX, 3, 684, 0x0000 },
@@ -782,6 +782,18 @@ static nthw_fpga_field_init_s flm_scan_fields[] = {
 	{ FLM_SCAN_I, 16, 0, 0 },
 };
 
+static nthw_fpga_field_init_s flm_scrub_ctrl_fields[] = {
+	{ FLM_SCRUB_CTRL_ADR, 4, 0, 0x0000 },
+	{ FLM_SCRUB_CTRL_CNT, 16, 16, 0x0000 },
+};
+
+static nthw_fpga_field_init_s flm_scrub_data_fields[] = {
+	{ FLM_SCRUB_DATA_DEL, 1, 12, 0 },
+	{ FLM_SCRUB_DATA_INF, 1, 13, 0 },
+	{ FLM_SCRUB_DATA_R, 4, 8, 0 },
+	{ FLM_SCRUB_DATA_T, 8, 0, 0 },
+};
+
 static nthw_fpga_field_init_s flm_status_fields[] = {
 	{ FLM_STATUS_CACHE_BUFFER_CRITICAL, 1, 12, 0x0000 },
 	{ FLM_STATUS_CALIB_FAIL, 3, 3, 0 },
@@ -921,6 +933,8 @@ static nthw_fpga_register_init_s flm_registers[] = {
 	{ FLM_RCP_CTRL, 8, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_rcp_ctrl_fields },
 	{ FLM_RCP_DATA, 9, 403, NTHW_FPGA_REG_TYPE_WO, 0, 19, flm_rcp_data_fields },
 	{ FLM_SCAN, 2, 16, NTHW_FPGA_REG_TYPE_WO, 0, 1, flm_scan_fields },
+	{ FLM_SCRUB_CTRL, 10, 32, NTHW_FPGA_REG_TYPE_WO, 0, 2, flm_scrub_ctrl_fields },
+	{ FLM_SCRUB_DATA, 11, 14, NTHW_FPGA_REG_TYPE_WO, 0, 4, flm_scrub_data_fields },
 	{ FLM_STATUS, 1, 17, NTHW_FPGA_REG_TYPE_MIXED, 0, 9, flm_status_fields },
 	{ FLM_STAT_AUL_DONE, 41, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_done_fields },
 	{ FLM_STAT_AUL_FAIL, 43, 32, NTHW_FPGA_REG_TYPE_RO, 0, 1, flm_stat_aul_fail_fields },
@@ -3058,6 +3072,7 @@ static nthw_fpga_prod_param_s product_parameters[] = {
 	{ NT_FLM_PRESENT, 1 },
 	{ NT_FLM_PRIOS, 4 },
 	{ NT_FLM_PST_PROFILES, 16 },
+	{ NT_FLM_SCRUB_PROFILES, 16 },
 	{ NT_FLM_SIZE_MB, 12288 },
 	{ NT_FLM_STATEFUL, 1 },
 	{ NT_FLM_VARIANT, 2 },
drivers/net/ntnic/ntnic_ethdev.c +0 -3
index 4a0dafeff0..a212b3ab07 100644
@@ -47,9 +47,6 @@ const rte_thread_attr_t thread_attr = { .priority = RTE_THREAD_PRIORITY_NORMAL }
 #define SG_HW_RX_PKT_BUFFER_SIZE (1024 << 1)
 #define SG_HW_TX_PKT_BUFFER_SIZE (1024 << 1)
 
-/* Max RSS queues */
-#define MAX_QUEUES 125
-
 #define NUM_VQ_SEGS(_data_size_)                                                                  \
 	({                                                                                        \
 		size_t _size = (_data_size_);                                                     \
Signature · 1 line
2.45.0
#390 lore raw

PATCH v5 64/80 net/ntnic: add high-level flow aging support

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

add flow aging functions to the ops structure

---
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 71 +++++++++++++++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 88 +++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             | 21 +++++
 3 files changed, 180 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +71 -0
index 0e9fc33dec..3d65c0f3d0 100644
@@ -1014,6 +1014,70 @@ int flow_nic_set_hasher_fields(struct flow_nic_dev *ndev, int hsh_idx,
 	return profile_inline_ops->flow_nic_set_hasher_fields_inline(ndev, hsh_idx, rss_conf);
 }
 
+static int flow_get_aged_flows(struct flow_eth_dev *dev,
+	uint16_t caller_id,
+	void **context,
+	uint32_t nb_contexts,
+	struct rte_flow_error *error)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline_ops uninitialized");
+		return -1;
+	}
+
+	if (nb_contexts > 0 && !context) {
+		error->type = RTE_FLOW_ERROR_TYPE_UNSPECIFIED;
+		error->message = "rte_flow_get_aged_flows - empty context";
+		return -1;
+	}
+
+	return profile_inline_ops->flow_get_aged_flows_profile_inline(dev, caller_id, context,
+			nb_contexts, error);
+}
+
+static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id,
+	struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info,
+	struct rte_flow_error *error)
+{
+	(void)dev;
+	(void)caller_id;
+	(void)port_info;
+	(void)queue_info;
+	(void)error;
+
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized");
+		return -1;
+	}
+
+	return 0;
+}
+
+static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id,
+	const struct rte_flow_port_attr *port_attr, uint16_t nb_queue,
+	const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error)
+{
+	(void)dev;
+	(void)caller_id;
+	(void)port_attr;
+	(void)queue_attr;
+	(void)nb_queue;
+	(void)error;
+
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized");
+		return -1;
+	}
+
+	return 0;
+}
+
 int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size)
 {
 	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
@@ -1042,6 +1106,13 @@ static const struct flow_filter_ops ops = {
 	.flow_flush = flow_flush,
 	.flow_dev_dump = flow_dev_dump,
 	.flow_get_flm_stats = flow_get_flm_stats,
+	.flow_get_aged_flows = flow_get_aged_flows,
+
+	/*
+	 * NT Flow asynchronous operations API
+	 */
+	.flow_info_get = flow_info_get,
+	.flow_configure = flow_configure,
 
 	/*
 	 * Other
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +88 -0

100 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +21 -0
index 7325bd1ea8..52f197e873 100644
@@ -286,6 +286,12 @@ struct profile_inline_ops {
 		FILE *file,
 		struct rte_flow_error *error);
 
+	int (*flow_get_aged_flows_profile_inline)(struct flow_eth_dev *dev,
+		uint16_t caller_id,
+		void **context,
+		uint32_t nb_contexts,
+		struct rte_flow_error *error);
+
 	int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,
 		int hsh_idx,
 		struct nt_eth_rss_conf rss_conf);
@@ -355,6 +361,21 @@ struct flow_filter_ops {
 	int (*flow_nic_set_hasher_fields)(struct flow_nic_dev *ndev, int hsh_idx,
 		struct nt_eth_rss_conf rss_conf);
 	int (*hw_mod_hsh_rcp_flush)(struct flow_api_backend_s *be, int start_idx, int count);
+
+	int (*flow_get_aged_flows)(struct flow_eth_dev *dev,
+		uint16_t caller_id,
+		void **context,
+		uint32_t nb_contexts,
+		struct rte_flow_error *error);
+
+	int (*flow_info_get)(struct flow_eth_dev *dev, uint8_t caller_id,
+		struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info,
+		struct rte_flow_error *error);
+
+	int (*flow_configure)(struct flow_eth_dev *dev, uint8_t caller_id,
+		const struct rte_flow_port_attr *port_attr, uint16_t nb_queue,
+		const struct rte_flow_queue_attr *queue_attr[],
+		struct rte_flow_error *error);
 };
 
 void register_dev_flow_ops(const struct rte_flow_ops *ops);
Signature · 1 line
2.45.0
#391 lore raw

PATCH v5 65/80 net/ntnic: add aging to the inline profile

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Added implementation for flow get aging.

Module which operate with age queue was extended with get, count and size operations.

---
 drivers/net/ntnic/meson.build                 |  1 +
 .../flow_api/profile_inline/flm_age_queue.c   | 49 ++++++++++++++++++
 .../flow_api/profile_inline/flm_age_queue.h   | 24 +++++++++
 .../profile_inline/flow_api_profile_inline.c  | 51 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.h  |  6 +++
 5 files changed, 131 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h
drivers/net/ntnic/meson.build +1 -0
index c0b7729929..8c6d02a5ec 100644
@@ -58,6 +58,7 @@ sources = files(
         'nthw/flow_api/flow_group.c',
         'nthw/flow_api/flow_id_table.c',
         'nthw/flow_api/hw_mod/hw_mod_backend.c',
+        'nthw/flow_api/profile_inline/flm_age_queue.c',
         'nthw/flow_api/profile_inline/flm_lrn_queue.c',
         'nthw/flow_api/profile_inline/flm_evt_queue.c',
         'nthw/flow_api/profile_inline/flow_api_profile_inline.c',
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c new file +49 -0

49 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h new file +24 -0
new file mode 100644
index 0000000000..d61609cc01
@@ -0,0 +1,24 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef _FLM_AGE_QUEUE_H_
+#define _FLM_AGE_QUEUE_H_
+
+#include "stdint.h"
+
+struct flm_age_event_s {
+	void *context;
+};
+
+/* Max number of event queues */
+#define MAX_EVT_AGE_QUEUES 256
+
+#define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s)
+
+int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj);
+unsigned int flm_age_queue_count(uint16_t caller_id);
+unsigned int flm_age_queue_get_size(uint16_t caller_id);
+
+#endif	/* _FLM_AGE_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +51 -0

69 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +6 -0
index b44d3a7291..e1934bc6a6 100644
@@ -48,6 +48,12 @@ int flow_dev_dump_profile_inline(struct flow_eth_dev *dev,
 	FILE *file,
 	struct rte_flow_error *error);
 
+int flow_get_aged_flows_profile_inline(struct flow_eth_dev *dev,
+	uint16_t caller_id,
+	void **context,
+	uint32_t nb_contexts,
+	struct rte_flow_error *error);
+
 int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,
 	int hsh_idx,
 	struct nt_eth_rss_conf rss_conf);
Signature · 1 line
2.45.0
#392 lore raw

PATCH v5 66/80 net/ntnic: add flow info and flow configure support

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Inline profile was extended with flow info and create.

Module which operate with age queue was extended with create and free operations.

---
 drivers/net/ntnic/include/flow_api.h          |  3 +
 drivers/net/ntnic/include/flow_api_engine.h   |  1 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 19 +----
 .../flow_api/profile_inline/flm_age_queue.c   | 77 +++++++++++++++++++
 .../flow_api/profile_inline/flm_age_queue.h   |  5 ++
 .../profile_inline/flow_api_profile_inline.c  | 62 ++++++++++++++-
 .../profile_inline/flow_api_profile_inline.h  |  9 +++
 drivers/net/ntnic/ntnic_mod_reg.h             |  9 +++
 8 files changed, 169 insertions(+), 16 deletions(-)
drivers/net/ntnic/include/flow_api.h +3 -0
index ed96f77bc0..89f071d982 100644
@@ -77,6 +77,9 @@ struct flow_eth_dev {
 	/* QSL_HSH index if RSS needed QSL v6+ */
 	int rss_target_id;
 
+	/* The size of buffer for aged out flow list */
+	uint32_t nb_aging_objects;
+
 	struct flow_eth_dev *next;
 };
 
drivers/net/ntnic/include/flow_api_engine.h +1 -0
index 155a9e1fd6..604a896717 100644
@@ -320,6 +320,7 @@ struct flow_handle {
 			uint32_t flm_teid;
 			uint8_t flm_rqi;
 			uint8_t flm_qfi;
+			uint8_t flm_scrub_prof;
 		};
 	};
 };
drivers/net/ntnic/nthw/flow_api/flow_api.c +4 -15
index 3d65c0f3d0..76492902ad 100644
@@ -1041,12 +1041,6 @@ static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id,
 	struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info,
 	struct rte_flow_error *error)
 {
-	(void)dev;
-	(void)caller_id;
-	(void)port_info;
-	(void)queue_info;
-	(void)error;
-
 	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
 
 	if (profile_inline_ops == NULL) {
@@ -1054,20 +1048,14 @@ static int flow_info_get(struct flow_eth_dev *dev, uint8_t caller_id,
 		return -1;
 	}
 
-	return 0;
+	return profile_inline_ops->flow_info_get_profile_inline(dev, caller_id, port_info,
+			queue_info, error);
 }
 
 static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id,
 	const struct rte_flow_port_attr *port_attr, uint16_t nb_queue,
 	const struct rte_flow_queue_attr *queue_attr[], struct rte_flow_error *error)
 {
-	(void)dev;
-	(void)caller_id;
-	(void)port_attr;
-	(void)queue_attr;
-	(void)nb_queue;
-	(void)error;
-
 	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
 
 	if (profile_inline_ops == NULL) {
@@ -1075,7 +1063,8 @@ static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id,
 		return -1;
 	}
 
-	return 0;
+	return profile_inline_ops->flow_configure_profile_inline(dev, caller_id, port_attr,
+			nb_queue, queue_attr, error);
 }
 
 int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size)
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +77 -0

89 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +5 -0
index d61609cc01..9ff6ef6de0 100644
@@ -15,8 +15,13 @@ struct flm_age_event_s {
 /* Max number of event queues */
 #define MAX_EVT_AGE_QUEUES 256
 
+/* Max number of event ports */
+#define MAX_EVT_AGE_PORTS 128
+
 #define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s)
 
+void flm_age_queue_free(uint8_t port, uint16_t caller_id);
+struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count);
 int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj);
 unsigned int flm_age_queue_count(uint16_t caller_id);
 unsigned int flm_age_queue_get_size(uint16_t caller_id);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +61 -1

86 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +9 -0
index e1934bc6a6..ea1d9c31b2 100644
@@ -64,4 +64,13 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,
 
 int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
 
+int flow_info_get_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id,
+	struct rte_flow_port_info *port_info,
+	struct rte_flow_queue_info *queue_info, struct rte_flow_error *error);
+
+int flow_configure_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id,
+	const struct rte_flow_port_attr *port_attr, uint16_t nb_queue,
+	const struct rte_flow_queue_attr *queue_attr[],
+	struct rte_flow_error *error);
+
 #endif	/* _FLOW_API_PROFILE_INLINE_H_ */
drivers/net/ntnic/ntnic_mod_reg.h +9 -0
index 52f197e873..15da911ca7 100644
@@ -309,6 +309,15 @@ struct profile_inline_ops {
 	void (*flm_setup_queues)(void);
 	void (*flm_free_queues)(void);
 	uint32_t (*flm_update)(struct flow_eth_dev *dev);
+
+	int (*flow_info_get_profile_inline)(struct flow_eth_dev *dev, uint8_t caller_id,
+		struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info,
+		struct rte_flow_error *error);
+
+	int (*flow_configure_profile_inline)(struct flow_eth_dev *dev, uint8_t caller_id,
+	const struct rte_flow_port_attr *port_attr, uint16_t nb_queue,
+	const struct rte_flow_queue_attr *queue_attr[],
+	struct rte_flow_error *error);
 };
 
 void register_profile_inline_ops(const struct profile_inline_ops *ops);
Signature · 1 line
2.45.0
#393 lore raw

PATCH v5 67/80 net/ntnic: add flow aging event

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Port thread was extended with new age event callback handler. LRN, INF, STA registers getter setter was added.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 doc/guides/nics/ntnic.rst                     |  19 ++
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 drivers/net/ntnic/include/flow_api_engine.h   |  13 ++
 drivers/net/ntnic/include/hw_mod_backend.h    |  11 ++
 .../net/ntnic/nthw/flow_api/flow_id_table.c   |  16 ++
 .../net/ntnic/nthw/flow_api/flow_id_table.h   |   3 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c   | 158 +++++++++++++++
 .../flow_api/profile_inline/flm_age_queue.c   |  28 +++
 .../flow_api/profile_inline/flm_age_queue.h   |  12 ++
 .../flow_api/profile_inline/flm_evt_queue.c   |  20 ++
 .../flow_api/profile_inline/flm_evt_queue.h   |   1 +
 .../profile_inline/flow_api_hw_db_inline.c    | 142 +++++++++++++-
 .../profile_inline/flow_api_hw_db_inline.h    |  84 ++++----
 .../profile_inline/flow_api_profile_inline.c  | 183 ++++++++++++++++++
 .../flow_api_profile_inline_config.h          |  21 +-
 drivers/net/ntnic/ntnic_ethdev.c              |  16 ++
 17 files changed, 692 insertions(+), 37 deletions(-)
doc/guides/nics/features/ntnic.ini +1 -0
index 947c7ba3a1..af2981ccf6 100644
@@ -33,6 +33,7 @@ udp                  = Y
 vlan                 = Y
 
 [rte_flow actions]
+age                  = Y
 drop                 = Y
 jump                 = Y
 mark                 = Y
doc/guides/nics/ntnic.rst +19 -0
index 47960ca3f1..806732e790 100644
@@ -67,6 +67,7 @@ Features
 - RMON statistics in extended stats.
 - Link state information.
 - Flow statistics
+- Flow aging support
 
 Limitations
 ~~~~~~~~~~~
@@ -145,3 +146,21 @@ FILTER
 To enable logging on all levels use wildcard in the following way::
 
    --log-level=pmd.net.ntnic.*,8
+
+Flow Scanner
+        ------------
+
+        Flow Scanner is DPDK mechanism that constantly and periodically scans the RTE flow tables to check for aged-out flows.
+        When flow timeout is reached, i.e. no packets were matched by the flow within timeout period,
+        ``RTE_ETH_EVENT_FLOW_AGED`` event is reported, and flow is marked as aged-out.
+
+        Therefore, flow scanner functionality is closely connected to the RTE flows' ``age`` action.
+
+        There are list of characteristics that ``age timeout`` action has:
+        - functions only in group > 0;
+        - flow timeout is specified in seconds;
+        - flow scanner checks flows age timeout once in 1-480 seconds, therefore, flows may not age-out immediately, depedning on how big are intervals of flow scanner mechanism checks;
+        - aging counters can display maximum of **n - 1** aged flows when aging counters are set to **n**;
+        - overall 15 different timeouts can be specified for the flows at the same time (note that this limit is combined for all actions, therefore, 15 different actions can be created at the same time, maximum limit of 15 can be reached only across different groups - when 5 flows with different timeouts are created per one group, otherwise the limit within one group is 14 distinct flows);
+        - after flow is aged-out it's not automatically deleted;
+        - aged-out flow can be updated with ``flow update`` command, and its aged-out status will be reverted;
doc/guides/rel_notes/release_24_11.rst +1 -0
index 1b7e4ab3ae..8090c925fd 100644
@@ -164,6 +164,7 @@ New Features
   * Added flow handling support
   * Enable virtual queues
   * Added statistics support
+  * Added age rte flow action support
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/include/flow_api_engine.h +13 -0
index 604a896717..c75e7cff83 100644
@@ -148,6 +148,14 @@ struct hsh_def_s {
 	const uint8_t *key;	/* Hash key. */
 };
 
+/*
+ * AGE configuration, see struct rte_flow_action_age
+ */
+struct age_def_s {
+	uint32_t timeout;
+	void *context;
+};
+
 /*
  * Tunnel encapsulation header definition
  */
@@ -264,6 +272,11 @@ struct nic_flow_def {
 	 * Hash module RSS definitions
 	 */
 	struct hsh_def_s hsh;
+
+	/*
+	 * AGE action timeout
+	 */
+	struct age_def_s age;
 };
 
 enum flow_handle_type {
drivers/net/ntnic/include/hw_mod_backend.h +11 -0
index 9cd9d92823..7a36e4c6d6 100644
@@ -688,6 +688,9 @@ int hw_mod_flm_rcp_set_mask(struct flow_api_backend_s *be, enum hw_flm_e field,
 int hw_mod_flm_rcp_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
 	uint32_t value);
 
+int hw_mod_flm_buf_ctrl_update(struct flow_api_backend_s *be);
+int hw_mod_flm_buf_ctrl_get(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value);
+
 int hw_mod_flm_stat_update(struct flow_api_backend_s *be);
 int hw_mod_flm_stat_get(struct flow_api_backend_s *be, enum hw_flm_e field, uint32_t *value);
 
@@ -695,8 +698,16 @@ int hw_mod_flm_lrn_data_set_flush(struct flow_api_backend_s *be, enum hw_flm_e f
 	const uint32_t *value, uint32_t records,
 	uint32_t *handled_records, uint32_t *inf_word_cnt,
 	uint32_t *sta_word_cnt);
+int hw_mod_flm_inf_sta_data_update_get(struct flow_api_backend_s *be, enum hw_flm_e field,
+	uint32_t *inf_value, uint32_t inf_size,
+	uint32_t *inf_word_cnt, uint32_t *sta_value,
+	uint32_t sta_size, uint32_t *sta_word_cnt);
 
+uint32_t hw_mod_flm_scrub_timeout_decode(uint32_t t_enc);
+uint32_t hw_mod_flm_scrub_timeout_encode(uint32_t t);
 int hw_mod_flm_scrub_flush(struct flow_api_backend_s *be, int start_idx, int count);
+int hw_mod_flm_scrub_set(struct flow_api_backend_s *be, enum hw_flm_e field, int index,
+	uint32_t value);
 
 struct hsh_func_s {
 	COMMON_FUNC_INFO_S;
drivers/net/ntnic/nthw/flow_api/flow_id_table.c +16 -0
index 5635ac4524..a3f5e1d7f7 100644
@@ -129,3 +129,19 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id)
 
 	pthread_mutex_unlock(&handle->mtx);
 }
+
+void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h, uint8_t *caller_id,
+	uint8_t *type)
+{
+	struct ntnic_id_table_data *handle = id_table;
+
+	pthread_mutex_lock(&handle->mtx);
+
+	struct ntnic_id_table_element *element = ntnic_id_table_array_find_element(handle, id);
+
+	*caller_id = element->caller_id;
+	*type = element->type;
+	memcpy(flm_h, &element->handle, sizeof(union flm_handles));
+
+	pthread_mutex_unlock(&handle->mtx);
+}
drivers/net/ntnic/nthw/flow_api/flow_id_table.h +3 -0
index e190fe4a11..edb4f42729 100644
@@ -20,4 +20,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t
 	uint8_t type);
 void ntnic_id_table_free_id(void *id_table, uint32_t id);
 
+void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h, uint8_t *caller_id,
+	uint8_t *type);
+
 #endif	/* FLOW_ID_TABLE_H_ */
drivers/net/ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c +158 -0

167 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +28 -0
index fbc947ee1d..76bbd57f65 100644
@@ -13,6 +13,21 @@
 static struct rte_ring *age_queue[MAX_EVT_AGE_QUEUES];
 static RTE_ATOMIC(uint16_t) age_event[MAX_EVT_AGE_PORTS];
 
+__rte_always_inline int flm_age_event_get(uint8_t port)
+{
+	return  rte_atomic_load_explicit(&age_event[port], rte_memory_order_seq_cst);
+}
+
+__rte_always_inline void flm_age_event_set(uint8_t port)
+{
+	rte_atomic_store_explicit(&age_event[port], 1, rte_memory_order_seq_cst);
+}
+
+__rte_always_inline void flm_age_event_clear(uint8_t port)
+{
+	rte_atomic_store_explicit(&age_event[port], 0, rte_memory_order_seq_cst);
+}
+
 void flm_age_queue_free(uint8_t port, uint16_t caller_id)
 {
 	struct rte_ring *q = NULL;
@@ -88,6 +103,19 @@ struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned
 	return q;
 }
 
+void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj)
+{
+	int ret;
+
+	/* If queues is not created, then ignore and return */
+	if (caller_id < MAX_EVT_AGE_QUEUES && age_queue[caller_id] != NULL) {
+		ret = rte_ring_sp_enqueue_elem(age_queue[caller_id], obj, FLM_AGE_ELEM_SIZE);
+
+		if (ret != 0)
+			NT_LOG(DBG, FILTER, "FLM aged event queue full");
+	}
+}
+
 int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj)
 {
 	int ret;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +12 -0
index 9ff6ef6de0..27154836c5 100644
@@ -12,6 +12,14 @@ struct flm_age_event_s {
 	void *context;
 };
 
+/* Indicates why the flow info record was generated */
+#define INF_DATA_CAUSE_SW_UNLEARN 0
+#define INF_DATA_CAUSE_TIMEOUT_FLOW_DELETED 1
+#define INF_DATA_CAUSE_NA 2
+#define INF_DATA_CAUSE_PERIODIC_FLOW_INFO 3
+#define INF_DATA_CAUSE_SW_PROBE 4
+#define INF_DATA_CAUSE_TIMEOUT_FLOW_KEPT 5
+
 /* Max number of event queues */
 #define MAX_EVT_AGE_QUEUES 256
 
@@ -20,8 +28,12 @@ struct flm_age_event_s {
 
 #define FLM_AGE_ELEM_SIZE sizeof(struct flm_age_event_s)
 
+int flm_age_event_get(uint8_t port);
+void flm_age_event_set(uint8_t port);
+void flm_age_event_clear(uint8_t port);
 void flm_age_queue_free(uint8_t port, uint16_t caller_id);
 struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count);
+void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj);
 int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj);
 unsigned int flm_age_queue_count(uint16_t caller_id);
 unsigned int flm_age_queue_get_size(uint16_t caller_id);
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +20 -0
index 98b0e8347a..db9687714f 100644
@@ -138,6 +138,26 @@ static struct rte_ring *flm_evt_queue_create(uint8_t port, uint8_t caller)
 	return q;
 }
 
+int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj)
+{
+	struct rte_ring **stat_q = remote ? stat_q_remote : stat_q_local;
+
+	if (port >= (remote ? MAX_STAT_RMT_QUEUES : MAX_STAT_LCL_QUEUES))
+		return -1;
+
+	if (stat_q[port] == NULL) {
+		if (flm_evt_queue_create(port, remote ? FLM_STAT_REMOTE : FLM_STAT_LOCAL) == NULL)
+			return -1;
+	}
+
+	if (rte_ring_sp_enqueue_elem(stat_q[port], obj, FLM_STAT_ELEM_SIZE) != 0) {
+		NT_LOG(DBG, FILTER, "FLM local status queue full");
+		return -1;
+	}
+
+	return 0;
+}
+
 int flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *obj)
 {
 	int ret;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
index 238be7a3b2..3a61f844b6 100644
@@ -48,5 +48,6 @@ enum {
 #define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s)
 
 int flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *obj);
+int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj);
 
 #endif	/* _FLM_EVT_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +139 -3

206 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +51 -33

114 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +183 -0

257 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h +20 -1
index 8ba8b8f67a..3b53288ddf 100644
@@ -55,4 +55,23 @@
  */
 #define NTNIC_SCANNER_LOAD 0.01
 
-#endif  /* _FLOW_API_PROFILE_INLINE_CONFIG_H_ */
+/*
+ * This define sets the timeout resolution of aged flow scanner (scrubber).
+ *
+ * The timeout resolution feature is provided in order to reduce the number of
+ * write-back operations for flows without attached meter. If the resolution
+ * is disabled (set to 0) and flow timeout is enabled via age action, then a write-back
+ * occurs every the flow is evicted from the flow cache, essentially causing the
+ * lookup performance to drop to that of a flow with meter. By setting the timeout
+ * resolution (>0), write-back for flows happens only when the difference between
+ * the last recorded time for the flow and the current time exceeds the chosen resolution.
+ *
+ * The parameter value is a power of 2 in units of 2^28 nanoseconds. It means that value 8 sets
+ * the timeout resolution to: 2^8 * 2^28 / 1e9 = 68,7 seconds
+ *
+ * NOTE: This parameter has a significant impact on flow lookup performance, especially
+ * if full scanner timeout resolution (=0) is configured.
+ */
+#define NTNIC_SCANNER_TIMEOUT_RESOLUTION 8
+
+#endif	/* _FLOW_API_PROFILE_INLINE_CONFIG_H_ */
drivers/net/ntnic/ntnic_ethdev.c +16 -0
index a212b3ab07..e0f455dc1b 100644
@@ -26,6 +26,7 @@
 #include "ntnic_vfio.h"
 #include "ntnic_mod_reg.h"
 #include "nt_util.h"
+#include "profile_inline/flm_age_queue.h"
 #include "profile_inline/flm_evt_queue.h"
 #include "rte_pmd_ntnic.h"
 
@@ -1814,6 +1815,21 @@ THREAD_FUNC port_event_thread_fn(void *context)
 					}
 				}
 
+				/* AGED event */
+				/* Note: RTE_FLOW_PORT_FLAG_STRICT_QUEUE flag is not supported so
+				 * event is always generated
+				 */
+				int aged_event_count = flm_age_event_get(port_no);
+
+				if (aged_event_count > 0 && eth_dev && eth_dev->data &&
+					eth_dev->data->dev_private) {
+					rte_eth_dev_callback_process(eth_dev,
+						RTE_ETH_EVENT_FLOW_AGED,
+						NULL);
+					flm_age_event_clear(port_no);
+					do_wait = false;
+				}
+
 				if (do_wait)
 					nt_os_wait_usec(10);
 
Signature · 1 line
2.45.0
#394 lore raw

PATCH v5 68/80 net/ntnic: add termination thread

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Introduce clear_pdrv to unregister driver
from global tracking.

Modify drv_deinit to call clear_pdirv and ensure
safe termination.

Add flm sta and age event free.

---
 .../flow_api/profile_inline/flm_age_queue.c   | 10 +++
 .../flow_api/profile_inline/flm_age_queue.h   |  1 +
 .../flow_api/profile_inline/flm_evt_queue.c   | 76 +++++++++++++++++++
 .../flow_api/profile_inline/flm_evt_queue.h   |  1 +
 drivers/net/ntnic/ntnic_ethdev.c              |  6 ++
 5 files changed, 94 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +10 -0
index 76bbd57f65..d916eccec7 100644
@@ -44,6 +44,16 @@ void flm_age_queue_free(uint8_t port, uint16_t caller_id)
 		rte_ring_free(q);
 }
 
+void flm_age_queue_free_all(void)
+{
+	int i;
+	int j;
+
+	for (i = 0; i < MAX_EVT_AGE_PORTS; i++)
+		for (j = 0; j < MAX_EVT_AGE_QUEUES; j++)
+			flm_age_queue_free(i, j);
+}
+
 struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count)
 {
 	char name[20];
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h +1 -0
index 27154836c5..55c410ac86 100644
@@ -32,6 +32,7 @@ int flm_age_event_get(uint8_t port);
 void flm_age_event_set(uint8_t port);
 void flm_age_event_clear(uint8_t port);
 void flm_age_queue_free(uint8_t port, uint16_t caller_id);
+void flm_age_queue_free_all(void);
 struct rte_ring *flm_age_queue_create(uint8_t port, uint16_t caller_id, unsigned int count);
 void flm_age_queue_put(uint16_t caller_id, struct flm_age_event_s *obj);
 int flm_age_queue_get(uint16_t caller_id, struct flm_age_event_s *obj);
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +76 -0

82 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
index 3a61f844b6..d61b282472 100644
@@ -47,6 +47,7 @@ enum {
 #define FLM_EVT_ELEM_SIZE sizeof(struct flm_info_event_s)
 #define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s)
 
+void flm_inf_sta_queue_free_all(uint8_t caller);
 int flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *obj);
 int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj);
 
drivers/net/ntnic/ntnic_ethdev.c +6 -0
index e0f455dc1b..cdf5c346b7 100644
@@ -1420,6 +1420,12 @@ drv_deinit(struct drv_s *p_drv)
 		THREAD_JOIN(p_nt_drv->flm_thread);
 		profile_inline_ops->flm_free_queues();
 		THREAD_JOIN(p_nt_drv->port_event_thread);
+		/* Free all local flm event queues */
+		flm_inf_sta_queue_free_all(FLM_INFO_LOCAL);
+		/* Free all remote flm event queues */
+		flm_inf_sta_queue_free_all(FLM_INFO_REMOTE);
+		/* Free all aged flow event queues */
+		flm_age_queue_free_all();
 	}
 
 	/* stop adapter */
Signature · 1 line
2.45.0
#395 lore raw

PATCH v5 69/80 net/ntnic: add meter support

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add meter implementation to the profile inline.

management functions were extended with meter flow support.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 doc/guides/nics/ntnic.rst                     |   1 +
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 drivers/net/ntnic/include/flow_api.h          |   1 +
 drivers/net/ntnic/include/flow_api_engine.h   |   5 +
 .../flow_api/profile_inline/flm_evt_queue.c   |  21 +
 .../flow_api/profile_inline/flm_evt_queue.h   |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 560 +++++++++++++++++-
 drivers/net/ntnic/ntnic_mod_reg.h             |  27 +
 9 files changed, 600 insertions(+), 18 deletions(-)
doc/guides/nics/features/ntnic.ini +1 -0
index af2981ccf6..e2de6d15f6 100644
@@ -37,6 +37,7 @@ age                  = Y
 drop                 = Y
 jump                 = Y
 mark                 = Y
+meter                = Y
 modify_field         = Y
 port_id              = Y
 queue                = Y
doc/guides/nics/ntnic.rst +1 -0
index 806732e790..bf5743f196 100644
@@ -68,6 +68,7 @@ Features
 - Link state information.
 - Flow statistics
 - Flow aging support
+- Flow metering, including meter policy API.
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index 8090c925fd..76d5efc97c 100644
@@ -165,6 +165,7 @@ New Features
   * Enable virtual queues
   * Added statistics support
   * Added age rte flow action support
+  * Added meter flow metering and flow policy support
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/include/flow_api.h +1 -0
index 89f071d982..032063712a 100644
@@ -100,6 +100,7 @@ struct flow_nic_dev {
 	void *km_res_handle;
 	void *kcc_res_handle;
 
+	void *flm_mtr_handle;
 	void *group_handle;
 	void *hw_db_handle;
 	void *id_table_handle;
drivers/net/ntnic/include/flow_api_engine.h +5 -0
index c75e7cff83..b40a27fbf1 100644
@@ -57,6 +57,7 @@ enum res_type_e {
 
 #define MAX_TCAM_START_OFFSETS 4
 
+#define MAX_FLM_MTRS_SUPPORTED 4
 #define MAX_CPY_WRITERS_SUPPORTED 8
 
 #define MAX_MATCH_FIELDS 16
@@ -223,6 +224,8 @@ struct nic_flow_def {
 
 	uint32_t jump_to_group;
 
+	uint32_t mtr_ids[MAX_FLM_MTRS_SUPPORTED];
+
 	int full_offload;
 
 	/*
@@ -320,6 +323,8 @@ struct flow_handle {
 			uint32_t flm_db_idx_counter;
 			uint32_t flm_db_idxs[RES_COUNT];
 
+			uint32_t flm_mtr_ids[MAX_FLM_MTRS_SUPPORTED];
+
 			uint32_t flm_data[10];
 			uint8_t flm_prot;
 			uint8_t flm_kid;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +21 -0
index 761609a0ea..d76c7da568 100644
@@ -234,6 +234,27 @@ int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj)
 	return 0;
 }
 
+void flm_inf_queue_put(uint8_t port, bool remote, struct flm_info_event_s *obj)
+{
+	int ret;
+
+	/* If queues is not created, then ignore and return */
+	if (!remote) {
+		if (port < MAX_INFO_LCL_QUEUES && info_q_local[port] != NULL) {
+			ret = rte_ring_sp_enqueue_elem(info_q_local[port], obj, FLM_EVT_ELEM_SIZE);
+
+			if (ret != 0)
+				NT_LOG(DBG, FILTER, "FLM local info queue full");
+		}
+
+	} else if (port < MAX_INFO_RMT_QUEUES && info_q_remote[port] != NULL) {
+		ret = rte_ring_sp_enqueue_elem(info_q_remote[port], obj, FLM_EVT_ELEM_SIZE);
+
+		if (ret != 0)
+			NT_LOG(DBG, FILTER, "FLM remote info queue full");
+	}
+}
+
 int flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *obj)
 {
 	int ret;
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
index d61b282472..ee8175cf25 100644
@@ -48,6 +48,7 @@ enum {
 #define FLM_STAT_ELEM_SIZE sizeof(struct flm_status_event_s)
 
 void flm_inf_sta_queue_free_all(uint8_t caller);
+void flm_inf_queue_put(uint8_t port, bool remote, struct flm_info_event_s *obj);
 int flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *obj);
 int flm_sta_queue_put(uint8_t port, bool remote, struct flm_status_event_s *obj);
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +542 -18

662 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +27 -0
index 15da911ca7..1e9dcd549f 100644
@@ -308,6 +308,33 @@ struct profile_inline_ops {
 	 */
 	void (*flm_setup_queues)(void);
 	void (*flm_free_queues)(void);
+
+	/*
+	 * NT Flow FLM Meter API
+	 */
+	int (*flow_mtr_supported)(struct flow_eth_dev *dev);
+	uint64_t (*flow_mtr_meter_policy_n_max)(void);
+	int (*flow_mtr_set_profile)(struct flow_eth_dev *dev, uint32_t profile_id,
+		uint64_t bucket_rate_a, uint64_t bucket_size_a,
+		uint64_t bucket_rate_b, uint64_t bucket_size_b);
+	int (*flow_mtr_set_policy)(struct flow_eth_dev *dev, uint32_t policy_id, int drop);
+	int (*flow_mtr_create_meter)(struct flow_eth_dev *dev, uint8_t caller_id, uint32_t mtr_id,
+		uint32_t profile_id, uint32_t policy_id, uint64_t stats_mask);
+	int (*flow_mtr_probe_meter)(struct flow_eth_dev *dev, uint8_t caller_id, uint32_t mtr_id);
+	int (*flow_mtr_destroy_meter)(struct flow_eth_dev *dev, uint8_t caller_id,
+		uint32_t mtr_id);
+	int (*flm_mtr_adjust_stats)(struct flow_eth_dev *dev, uint8_t caller_id, uint32_t mtr_id,
+		uint32_t adjust_value);
+	uint32_t (*flow_mtr_meters_supported)(struct flow_eth_dev *dev, uint8_t caller_id);
+
+	void (*flm_mtr_read_stats)(struct flow_eth_dev *dev,
+		uint8_t caller_id,
+		uint32_t id,
+		uint64_t *stats_mask,
+		uint64_t *green_pkt,
+		uint64_t *green_bytes,
+		int clear);
+
 	uint32_t (*flm_update)(struct flow_eth_dev *dev);
 
 	int (*flow_info_get_profile_inline)(struct flow_eth_dev *dev, uint8_t caller_id,
Signature · 1 line
2.45.0
#396 lore raw

PATCH v5 70/80 net/ntnic: add meter module

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Meter module was added:
1. add/remove profile
2. create/destroy flow
3. add/remove meter policy
4. read/update stats

eth_dev_ops struct was extended with ops above.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 drivers/net/ntnic/include/ntos_drv.h          |  14 +
 drivers/net/ntnic/meson.build                 |   2 +
 .../net/ntnic/nthw/ntnic_meter/ntnic_meter.c  | 483 ++++++++++++++++++
 drivers/net/ntnic/ntnic_ethdev.c              |  11 +-
 drivers/net/ntnic/ntnic_mod_reg.c             |  21 +
 drivers/net/ntnic/ntnic_mod_reg.h             |  12 +
 7 files changed, 543 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c
doc/guides/nics/features/ntnic.ini +1 -0
index e2de6d15f6..884365f1a0 100644
@@ -39,6 +39,7 @@ jump                 = Y
 mark                 = Y
 meter                = Y
 modify_field         = Y
+passthru             = Y
 port_id              = Y
 queue                = Y
 raw_decap            = Y
drivers/net/ntnic/include/ntos_drv.h +14 -0
index 7b3c8ff3d6..f6ce442d17 100644
@@ -12,6 +12,7 @@
 #include <inttypes.h>
 
 #include <rte_ether.h>
+#include "rte_mtr.h"
 
 #include "stream_binary_flow_api.h"
 #include "nthw_drv.h"
@@ -90,6 +91,19 @@ struct __rte_cache_aligned ntnic_tx_queue {
 	enum fpga_info_profile profile;  /* Inline / Capture */
 };
 
+struct nt_mtr_profile {
+	LIST_ENTRY(nt_mtr_profile) next;
+	uint32_t profile_id;
+	struct rte_mtr_meter_profile profile;
+};
+
+struct nt_mtr {
+	LIST_ENTRY(nt_mtr) next;
+	uint32_t mtr_id;
+	int shared;
+	struct nt_mtr_profile *profile;
+};
+
 struct pmd_internals {
 	const struct rte_pci_device *pci_dev;
 	struct flow_eth_dev *flw_dev;
drivers/net/ntnic/meson.build +2 -0
index 8c6d02a5ec..ca46541ef3 100644
@@ -17,6 +17,7 @@ includes = [
         include_directories('nthw'),
         include_directories('nthw/supported'),
         include_directories('nthw/model'),
+        include_directories('nthw/ntnic_meter'),
         include_directories('nthw/flow_filter'),
         include_directories('nthw/flow_api'),
         include_directories('nim/'),
@@ -92,6 +93,7 @@ sources = files(
         'nthw/flow_filter/flow_nthw_tx_cpy.c',
         'nthw/flow_filter/flow_nthw_tx_ins.c',
         'nthw/flow_filter/flow_nthw_tx_rpl.c',
+        'nthw/ntnic_meter/ntnic_meter.c',
         'nthw/model/nthw_fpga_model.c',
         'nthw/nthw_platform.c',
         'nthw/nthw_rac.c',
drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c new file +483 -0

483 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +10 -1
index cdf5c346b7..df9ee77e06 100644
@@ -1682,7 +1682,7 @@ static int rss_hash_conf_get(struct rte_eth_dev *eth_dev, struct rte_eth_rss_con
 	return 0;
 }
 
-static const struct eth_dev_ops nthw_eth_dev_ops = {
+static struct eth_dev_ops nthw_eth_dev_ops = {
 	.dev_configure = eth_dev_configure,
 	.dev_start = eth_dev_start,
 	.dev_stop = eth_dev_stop,
@@ -1705,6 +1705,7 @@ static const struct eth_dev_ops nthw_eth_dev_ops = {
 	.mac_addr_add = eth_mac_addr_add,
 	.mac_addr_set = eth_mac_addr_set,
 	.set_mc_addr_list = eth_set_mc_addr_list,
+	.mtr_ops_get = NULL,
 	.flow_ops_get = dev_flow_ops_get,
 	.xstats_get = eth_xstats_get,
 	.xstats_get_names = eth_xstats_get_names,
@@ -2168,6 +2169,14 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)
 		return -1;
 	}
 
+	const struct meter_ops_s *meter_ops = get_meter_ops();
+
+	if (meter_ops != NULL)
+		nthw_eth_dev_ops.mtr_ops_get = meter_ops->eth_mtr_ops_get;
+
+	else
+		NT_LOG(DBG, NTNIC, "Meter module is not initialized");
+
 	/* Initialize the queue system */
 	if (err == 0) {
 		sg_ops = get_sg_ops();
drivers/net/ntnic/ntnic_mod_reg.c +21 -0
index 6737d18a6f..10aa778a57 100644
@@ -19,6 +19,27 @@ const struct sg_ops_s *get_sg_ops(void)
 	return sg_ops;
 }
 
+/*
+ *
+ */
+static struct meter_ops_s *meter_ops;
+
+void register_meter_ops(struct meter_ops_s *ops)
+{
+	meter_ops = ops;
+}
+
+const struct meter_ops_s *get_meter_ops(void)
+{
+	if (meter_ops == NULL)
+		meter_init();
+
+	return meter_ops;
+}
+
+/*
+ *
+ */
 static const struct ntnic_filter_ops *ntnic_filter_ops;
 
 void register_ntnic_filter_ops(const struct ntnic_filter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +12 -0
index 1e9dcd549f..3fbbee6490 100644
@@ -115,6 +115,18 @@ void register_sg_ops(struct sg_ops_s *ops);
 const struct sg_ops_s *get_sg_ops(void);
 void sg_init(void);
 
+/* Meter ops section */
+struct meter_ops_s {
+	int (*eth_mtr_ops_get)(struct rte_eth_dev *eth_dev, void *ops);
+};
+
+void register_meter_ops(struct meter_ops_s *ops);
+const struct meter_ops_s *get_meter_ops(void);
+void meter_init(void);
+
+/*
+ *
+ */
 struct ntnic_filter_ops {
 	int (*poll_statistics)(struct pmd_internals *internals);
 };
Signature · 1 line
2.45.0
#397 lore raw

PATCH v5 71/80 net/ntnic: add action update support

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

rte_flow_ops was extended with action update feature.

---
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 66 +++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             | 10 +++
 2 files changed, 76 insertions(+)
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +66 -0
index 6d65ffd38f..8edaccb65c 100644
@@ -9,6 +9,7 @@
 #include "ntnic_mod_reg.h"
 #include "ntos_system.h"
 #include "ntos_drv.h"
+#include "rte_flow.h"
 
 #define MAX_RTE_FLOWS 8192
 
@@ -703,6 +704,70 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *er
 	return res;
 }
 
+static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,
+	struct rte_flow *flow,
+	const struct rte_flow_action actions[],
+	struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG(ERR, FILTER, "flow_filter module uninitialized");
+		return -1;
+	}
+
+	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+
+	static struct rte_flow_error flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+	int res = -1;
+
+	if (internals->flw_dev) {
+		struct pmd_internals *dev_private =
+			(struct pmd_internals *)eth_dev->data->dev_private;
+		struct fpga_info_s *fpga_info = &dev_private->p_drv->ntdrv.adapter_info.fpga_info;
+		struct cnv_action_s action = { 0 };
+
+		if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) {
+			uint32_t queue_offset = 0;
+
+			if (dev_private->type == PORT_TYPE_OVERRIDE &&
+				dev_private->vpq_nb_vq > 0) {
+				/*
+				 * The queues coming from the main PMD will always start from 0
+				 * When the port is a the VF/vDPA port the queues must be changed
+				 * to match the queues allocated for VF/vDPA.
+				 */
+				queue_offset = dev_private->vpq[0].id;
+			}
+
+			if (create_action_elements_inline(&action, actions, MAX_ACTIONS,
+					queue_offset) != 0) {
+				rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+					"Error in actions");
+				return -1;
+			}
+		}
+
+		if (is_flow_handle_typecast(flow)) {
+			res = flow_filter_ops->flow_actions_update(internals->flw_dev,
+					(void *)flow,
+					action.flow_actions,
+					&flow_error);
+
+		} else {
+			res = flow_filter_ops->flow_actions_update(internals->flw_dev,
+					flow->flw_hdl,
+					action.flow_actions,
+					&flow_error);
+		}
+	}
+
+	convert_error(error, &flow_error);
+
+	return res;
+}
+
 static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,
 	struct rte_flow *flow,
 	FILE *file,
@@ -941,6 +1006,7 @@ static const struct rte_flow_ops dev_flow_ops = {
 	.create = eth_flow_create,
 	.destroy = eth_flow_destroy,
 	.flush = eth_flow_flush,
+	.actions_update = eth_flow_actions_update,
 	.dev_dump = eth_flow_dev_dump,
 	.get_aged_flows = eth_flow_get_aged_flows,
 	.info_get = eth_flow_info_get,
drivers/net/ntnic/ntnic_mod_reg.h +10 -0
index 3fbbee6490..563e62ebce 100644
@@ -292,6 +292,11 @@ struct profile_inline_ops {
 		uint16_t caller_id,
 		struct rte_flow_error *error);
 
+	int (*flow_actions_update_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_handle *flow,
+		const struct rte_flow_action action[],
+		struct rte_flow_error *error);
+
 	int (*flow_dev_dump_profile_inline)(struct flow_eth_dev *dev,
 		struct flow_handle *flow,
 		uint16_t caller_id,
@@ -401,6 +406,11 @@ struct flow_filter_ops {
 	int (*flow_flush)(struct flow_eth_dev *dev, uint16_t caller_id,
 		struct rte_flow_error *error);
 
+	int (*flow_actions_update)(struct flow_eth_dev *dev,
+		struct flow_handle *flow,
+		const struct rte_flow_action action[],
+		struct rte_flow_error *error);
+
 	int (*flow_get_flm_stats)(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
 
 	/*
Signature · 1 line
2.45.0
#398 lore raw

PATCH v5 72/80 net/ntnic: add flow action update

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

flow_filter_ops was extended with flow action update API.

---
 drivers/net/ntnic/nthw/flow_api/flow_api.c       | 16 ++++++++++++++++
 .../profile_inline/flow_api_profile_inline.h     |  5 +++++
 2 files changed, 21 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +16 -0
index 76492902ad..1fcccd37fd 100644
@@ -264,6 +264,21 @@ static int flow_flush(struct flow_eth_dev *dev, uint16_t caller_id, struct rte_f
 	return profile_inline_ops->flow_flush_profile_inline(dev, caller_id, error);
 }
 
+static int flow_actions_update(struct flow_eth_dev *dev,
+	struct flow_handle *flow,
+	const struct rte_flow_action action[],
+	struct rte_flow_error *error)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized");
+		return -1;
+	}
+
+	return profile_inline_ops->flow_actions_update_profile_inline(dev, flow, action, error);
+}
+
 /*
  * Device Management API
  */
@@ -1093,6 +1108,7 @@ static const struct flow_filter_ops ops = {
 	.flow_create = flow_create,
 	.flow_destroy = flow_destroy,
 	.flow_flush = flow_flush,
+	.flow_actions_update = flow_actions_update,
 	.flow_dev_dump = flow_dev_dump,
 	.flow_get_flm_stats = flow_get_flm_stats,
 	.flow_get_aged_flows = flow_get_aged_flows,
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +5 -0
index ea1d9c31b2..8a03be1ab7 100644
@@ -42,6 +42,11 @@ int flow_flush_profile_inline(struct flow_eth_dev *dev,
 	uint16_t caller_id,
 	struct rte_flow_error *error);
 
+int flow_actions_update_profile_inline(struct flow_eth_dev *dev,
+	struct flow_handle *flow,
+	const struct rte_flow_action action[],
+	struct rte_flow_error *error);
+
 int flow_dev_dump_profile_inline(struct flow_eth_dev *dev,
 	struct flow_handle *flow,
 	uint16_t caller_id,
Signature · 1 line
2.45.0
#399 lore raw

PATCH v5 73/80 net/ntnic: add flow actions update

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Flow action update was implemented.

---
 doc/guides/nics/ntnic.rst                     |   1 +
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 165 ++++++++++++++++++
 3 files changed, 167 insertions(+)
doc/guides/nics/ntnic.rst +1 -0
index bf5743f196..afdaf22e0b 100644
@@ -69,6 +69,7 @@ Features
 - Flow statistics
 - Flow aging support
 - Flow metering, including meter policy API.
+- Flow update. Update of the action list for specific flow
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index 76d5efc97c..735a295f6e 100644
@@ -166,6 +166,7 @@ New Features
   * Added statistics support
   * Added age rte flow action support
   * Added meter flow metering and flow policy support
+  * Added flow actions update support
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +165 -0

189 lines not on this page · raw message

Signature · 1 line
2.45.0
#400 lore raw

PATCH v5 74/80 net/ntnic: migrate to the RTE spinlock

In reply to Serhii Iliushyk

Migarte form the pthread to rte_spinlock

---
 drivers/net/ntnic/include/flow_api.h          |  6 +-
 drivers/net/ntnic/include/ntdrv_4ga.h         |  3 +-
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |  4 +-
 .../net/ntnic/nthw/core/include/nthw_rpf.h    |  5 +-
 drivers/net/ntnic/nthw/core/nthw_rpf.c        |  3 +-
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 43 +++++-----
 .../net/ntnic/nthw/flow_api/flow_id_table.c   | 20 +++--
 .../profile_inline/flow_api_profile_inline.c  | 80 +++++++++++--------
 .../ntnic/nthw/flow_filter/flow_nthw_flm.c    | 47 +++++++++--
 drivers/net/ntnic/nthw/nthw_rac.c             | 38 ++-------
 drivers/net/ntnic/nthw/nthw_rac.h             |  2 +-
 drivers/net/ntnic/ntnic_ethdev.c              | 31 +++----
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |  6 +-
 13 files changed, 155 insertions(+), 133 deletions(-)
drivers/net/ntnic/include/flow_api.h +3 -3
index 032063712a..d5382669da 100644
@@ -6,7 +6,7 @@
 #ifndef _FLOW_API_H_
 #define _FLOW_API_H_
 
-#include <pthread.h>
+#include <rte_spinlock.h>
 
 #include "ntlog.h"
 
@@ -110,13 +110,13 @@ struct flow_nic_dev {
 	struct flow_handle *flow_base;
 	/* linked list of all FLM flows created on this NIC */
 	struct flow_handle *flow_base_flm;
-	pthread_mutex_t flow_mtx;
+	rte_spinlock_t flow_mtx;
 
 	/* NIC backend API */
 	struct flow_api_backend_s be;
 	/* linked list of created eth-port devices on this NIC */
 	struct flow_eth_dev *eth_base;
-	pthread_mutex_t mtx;
+	rte_spinlock_t mtx;
 
 	/* RSS hashing configuration */
 	struct nt_eth_rss_conf rss_conf;
drivers/net/ntnic/include/ntdrv_4ga.h +2 -1
index 677aa7b6c8..78cf10368a 100644
@@ -7,6 +7,7 @@
 #define __NTDRV_4GA_H__
 
 #include "nt4ga_adapter.h"
+#include <rte_spinlock.h>
 
 typedef struct ntdrv_4ga_s {
 	uint32_t pciident;
@@ -15,7 +16,7 @@ typedef struct ntdrv_4ga_s {
 
 	volatile bool b_shutdown;
 	rte_thread_t flm_thread;
-	pthread_mutex_t stat_lck;
+	rte_spinlock_t stat_lck;
 	rte_thread_t stat_thread;
 	rte_thread_t port_event_thread;
 } ntdrv_4ga_t;
drivers/net/ntnic/nthw/core/include/nthw_i2cm.h +2 -2
index 6e0ec4cf5e..eeb4dffe25 100644
@@ -7,7 +7,7 @@
 #define __NTHW_II2CM_H__
 
 #include "nthw_fpga_model.h"
-#include "pthread.h"
+#include "rte_spinlock.h"
 
 struct nt_i2cm {
 	nthw_fpga_t *mp_fpga;
@@ -39,7 +39,7 @@ struct nt_i2cm {
 	nthw_field_t *mp_fld_io_exp_rst;
 	nthw_field_t *mp_fld_io_exp_int_b;
 
-	pthread_mutex_t i2cmmutex;
+	rte_spinlock_t i2cmmutex;
 };
 
 typedef struct nt_i2cm nthw_i2cm_t;
drivers/net/ntnic/nthw/core/include/nthw_rpf.h +3 -2
index 4c6c57ba55..00b322b2ea 100644
@@ -7,7 +7,8 @@
 #define NTHW_RPF_HPP_
 
 #include "nthw_fpga_model.h"
-#include "pthread.h"
+#include "rte_spinlock.h"
+#include <rte_spinlock.h>
 struct nthw_rpf {
 	nthw_fpga_t *mp_fpga;
 
@@ -28,7 +29,7 @@ struct nthw_rpf {
 	int m_default_maturing_delay;
 	bool m_administrative_block;	/* used to enforce license expiry */
 
-	pthread_mutex_t rpf_mutex;
+	rte_spinlock_t rpf_mutex;
 };
 
 typedef struct nthw_rpf nthw_rpf_t;
drivers/net/ntnic/nthw/core/nthw_rpf.c +2 -1
index 81c704d01a..1ed4d7b4e0 100644
@@ -8,6 +8,7 @@
 #include "nthw_drv.h"
 #include "nthw_register.h"
 #include "nthw_rpf.h"
+#include "rte_spinlock.h"
 
 nthw_rpf_t *nthw_rpf_new(void)
 {
@@ -65,7 +66,7 @@ int nthw_rpf_init(nthw_rpf_t *p, nthw_fpga_t *p_fpga, int n_instance)
 		nthw_fpga_get_product_param(p_fpga, NT_RPF_MATURING_DEL_DEFAULT, 0);
 
 	/* Initialize mutex */
-	pthread_mutex_init(&p->rpf_mutex, NULL);
+	rte_spinlock_init(&p->rpf_mutex);
 	return 0;
 }
 
drivers/net/ntnic/nthw/flow_api/flow_api.c +21 -22

146 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/flow_id_table.c +9 -11
index a3f5e1d7f7..a63f5542d1 100644
@@ -3,12 +3,12 @@
  * Copyright(c) 2024 Napatech A/S
  */
 
-#include <pthread.h>
 #include <stdint.h>
 #include <stdlib.h>
 #include <string.h>
 
 #include "flow_id_table.h"
+#include "rte_spinlock.h"
 
 #define NTNIC_ARRAY_BITS 14
 #define NTNIC_ARRAY_SIZE (1 << NTNIC_ARRAY_BITS)
@@ -25,7 +25,7 @@ struct ntnic_id_table_element {
 
 struct ntnic_id_table_data {
 	struct ntnic_id_table_element *arrays[NTNIC_ARRAY_SIZE];
-	pthread_mutex_t mtx;
+	rte_spinlock_t mtx;
 
 	uint32_t next_id;
 
@@ -68,7 +68,7 @@ void *ntnic_id_table_create(void)
 {
 	struct ntnic_id_table_data *handle = calloc(1, sizeof(struct ntnic_id_table_data));
 
-	pthread_mutex_init(&handle->mtx, NULL);
+	rte_spinlock_init(&handle->mtx);
 	handle->next_id = 1;
 
 	return handle;
@@ -81,8 +81,6 @@ void ntnic_id_table_destroy(void *id_table)
 	for (uint32_t i = 0; i < NTNIC_ARRAY_SIZE; ++i)
 		free(handle->arrays[i]);
 
-	pthread_mutex_destroy(&handle->mtx);
-
 	free(id_table);
 }
 
@@ -91,7 +89,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t
 {
 	struct ntnic_id_table_data *handle = id_table;
 
-	pthread_mutex_lock(&handle->mtx);
+	rte_spinlock_lock(&handle->mtx);
 
 	uint32_t new_id = ntnic_id_table_array_pop_free_id(handle);
 
@@ -103,7 +101,7 @@ uint32_t ntnic_id_table_get_id(void *id_table, union flm_handles flm_h, uint8_t
 	element->type = type;
 	memcpy(&element->handle, &flm_h, sizeof(union flm_handles));
 
-	pthread_mutex_unlock(&handle->mtx);
+	rte_spinlock_unlock(&handle->mtx);
 
 	return new_id;
 }
@@ -112,7 +110,7 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id)
 {
 	struct ntnic_id_table_data *handle = id_table;
 
-	pthread_mutex_lock(&handle->mtx);
+	rte_spinlock_lock(&handle->mtx);
 
 	struct ntnic_id_table_element *current_element =
 		ntnic_id_table_array_find_element(handle, id);
@@ -127,7 +125,7 @@ void ntnic_id_table_free_id(void *id_table, uint32_t id)
 	if (handle->free_tail == 0)
 		handle->free_tail = handle->free_head;
 
-	pthread_mutex_unlock(&handle->mtx);
+	rte_spinlock_unlock(&handle->mtx);
 }
 
 void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h, uint8_t *caller_id,
@@ -135,7 +133,7 @@ void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h,
 {
 	struct ntnic_id_table_data *handle = id_table;
 
-	pthread_mutex_lock(&handle->mtx);
+	rte_spinlock_lock(&handle->mtx);
 
 	struct ntnic_id_table_element *element = ntnic_id_table_array_find_element(handle, id);
 
@@ -143,5 +141,5 @@ void ntnic_id_table_find(void *id_table, uint32_t id, union flm_handles *flm_h,
 	*type = element->type;
 	memcpy(flm_h, &element->handle, sizeof(union flm_handles));
 
-	pthread_mutex_unlock(&handle->mtx);
+	rte_spinlock_unlock(&handle->mtx);
 }
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +46 -34

272 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_filter/flow_nthw_flm.c +39 -8

99 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_rac.c +8 -30
index 461da8e104..ca6aba6db2 100644
@@ -3,6 +3,7 @@
  * Copyright(c) 2023 Napatech A/S
  */
 
+#include "rte_spinlock.h"
 #include "nt_util.h"
 #include "ntlog.h"
 
@@ -10,8 +11,6 @@
 #include "nthw_register.h"
 #include "nthw_rac.h"
 
-#include <pthread.h>
-
 #define RAB_DMA_WAIT (1000000)
 
 #define RAB_READ (0x01)
@@ -217,7 +216,7 @@ int nthw_rac_init(nthw_rac_t *p, nthw_fpga_t *p_fpga, struct fpga_info_s *p_fpga
 		}
 	}
 
-	pthread_mutex_init(&p->m_mutex, NULL);
+	rte_spinlock_init(&p->m_mutex);
 
 	return 0;
 }
@@ -389,19 +388,6 @@ void nthw_rac_bar0_write32(const struct fpga_info_s *p_fpga_info, uint32_t reg_a
 
 int nthw_rac_rab_dma_begin(nthw_rac_t *p)
 {
-	const struct fpga_info_s *const p_fpga_info = p->mp_fpga->p_fpga_info;
-	const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str;
-
-	pthread_mutex_lock(&p->m_mutex);
-
-	if (p->m_dma_active) {
-		pthread_mutex_unlock(&p->m_mutex);
-		NT_LOG(ERR, NTHW,
-			"%s: DMA begin requested, but a DMA transaction is already active",
-			p_adapter_id_str);
-		return -1;
-	}
-
 	p->m_dma_active = true;
 
 	return 0;
@@ -454,19 +440,11 @@ int nthw_rac_rab_dma_commit(nthw_rac_t *p)
 {
 	int ret;
 
-	if (!p->m_dma_active) {
-		/* Expecting mutex not to be locked! */
-		assert(0);      /* alert developer that something is wrong */
-		return -1;
-	}
-
 	nthw_rac_rab_dma_activate(p);
 	ret = nthw_rac_rab_dma_wait(p);
 
 	p->m_dma_active = false;
 
-	pthread_mutex_unlock(&p->m_mutex);
-
 	return ret;
 }
 
@@ -602,7 +580,7 @@ int nthw_rac_rab_write32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint
 		return -1;
 	}
 
-	pthread_mutex_lock(&p->m_mutex);
+	rte_spinlock_lock(&p->m_mutex);
 
 	if (p->m_dma_active) {
 		NT_LOG(ERR, NTHW, "%s: RAB: Illegal operation: DMA enabled", p_adapter_id_str);
@@ -748,7 +726,7 @@ int nthw_rac_rab_write32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint
 	}
 
 exit_unlock_res:
-	pthread_mutex_unlock(&p->m_mutex);
+	rte_spinlock_unlock(&p->m_mutex);
 	return res;
 }
 
@@ -763,7 +741,7 @@ int nthw_rac_rab_read32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint3
 	uint32_t out_buf_free;
 	int res = 0;
 
-	pthread_mutex_lock(&p->m_mutex);
+	rte_spinlock_lock(&p->m_mutex);
 
 	if (address > (1 << RAB_ADDR_BW)) {
 		NT_LOG(ERR, NTHW, "%s: RAB: Illegal address: value too large %d - max %d",
@@ -923,7 +901,7 @@ int nthw_rac_rab_read32(nthw_rac_t *p, bool trc, nthw_rab_bus_id_t bus_id, uint3
 	}
 
 exit_unlock_res:
-	pthread_mutex_unlock(&p->m_mutex);
+	rte_spinlock_unlock(&p->m_mutex);
 	return res;
 }
 
@@ -935,7 +913,7 @@ int nthw_rac_rab_flush(nthw_rac_t *p)
 	uint32_t retry;
 	int res = 0;
 
-	pthread_mutex_lock(&p->m_mutex);
+	rte_spinlock_lock(&p->m_mutex);
 
 	/* Set the flush bit */
 	nthw_rac_reg_write32(p_fpga_info, p->RAC_RAB_BUF_USED_ADDR,
@@ -960,6 +938,6 @@ int nthw_rac_rab_flush(nthw_rac_t *p)
 	/* Clear flush bit when done */
 	nthw_rac_reg_write32(p_fpga_info, p->RAC_RAB_BUF_USED_ADDR, 0x0);
 
-	pthread_mutex_unlock(&p->m_mutex);
+	rte_spinlock_unlock(&p->m_mutex);
 	return res;
 }
drivers/net/ntnic/nthw/nthw_rac.h +1 -1
index c64dac9da9..df92b487af 100644
@@ -16,7 +16,7 @@ struct nthw_rac {
 	nthw_fpga_t *mp_fpga;
 	nthw_module_t *mp_mod_rac;
 
-	pthread_mutex_t m_mutex;
+	rte_spinlock_t m_mutex;
 
 	int mn_param_rac_rab_interfaces;
 	int mn_param_rac_rab_ob_update;
drivers/net/ntnic/ntnic_ethdev.c +16 -15
index df9ee77e06..91669caceb 100644
@@ -18,6 +18,7 @@
 
 #include <sys/queue.h>
 
+#include "rte_spinlock.h"
 #include "ntlog.h"
 #include "ntdrv_4ga.h"
 #include "ntos_drv.h"
@@ -236,7 +237,7 @@ static int dpdk_stats_reset(struct pmd_internals *internals, struct ntdrv_4ga_s
 	if (!p_nthw_stat || !p_nt4ga_stat || n_intf_no < 0 || n_intf_no > NUM_ADAPTER_PORTS_MAX)
 		return -1;
 
-	pthread_mutex_lock(&p_nt_drv->stat_lck);
+	rte_spinlock_lock(&p_nt_drv->stat_lck);
 
 	/* Rx */
 	for (i = 0; i < internals->nb_rx_queues; i++) {
@@ -256,7 +257,7 @@ static int dpdk_stats_reset(struct pmd_internals *internals, struct ntdrv_4ga_s
 
 	p_nt4ga_stat->n_totals_reset_timestamp = time(NULL);
 
-	pthread_mutex_unlock(&p_nt_drv->stat_lck);
+	rte_spinlock_unlock(&p_nt_drv->stat_lck);
 
 	return 0;
 }
@@ -1519,9 +1520,9 @@ static int eth_xstats_get(struct rte_eth_dev *eth_dev, struct rte_eth_xstat *sta
 		return -1;
 	}
 
-	pthread_mutex_lock(&p_nt_drv->stat_lck);
+	rte_spinlock_lock(&p_nt_drv->stat_lck);
 	nb_xstats = ntnic_xstats_ops->nthw_xstats_get(p_nt4ga_stat, stats, n, if_index);
-	pthread_mutex_unlock(&p_nt_drv->stat_lck);
+	rte_spinlock_unlock(&p_nt_drv->stat_lck);
 	return nb_xstats;
 }
 
@@ -1544,10 +1545,10 @@ static int eth_xstats_get_by_id(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	pthread_mutex_lock(&p_nt_drv->stat_lck);
+	rte_spinlock_lock(&p_nt_drv->stat_lck);
 	nb_xstats =
 		ntnic_xstats_ops->nthw_xstats_get_by_id(p_nt4ga_stat, ids, values, n, if_index);
-	pthread_mutex_unlock(&p_nt_drv->stat_lck);
+	rte_spinlock_unlock(&p_nt_drv->stat_lck);
 	return nb_xstats;
 }
 
@@ -1566,9 +1567,9 @@ static int eth_xstats_reset(struct rte_eth_dev *eth_dev)
 		return -1;
 	}
 
-	pthread_mutex_lock(&p_nt_drv->stat_lck);
+	rte_spinlock_lock(&p_nt_drv->stat_lck);
 	ntnic_xstats_ops->nthw_xstats_reset(p_nt4ga_stat, if_index);
-	pthread_mutex_unlock(&p_nt_drv->stat_lck);
+	rte_spinlock_unlock(&p_nt_drv->stat_lck);
 	return dpdk_stats_reset(internals, p_nt_drv, if_index);
 }
 
@@ -1749,14 +1750,14 @@ THREAD_FUNC port_event_thread_fn(void *context)
 		if (p_nt4ga_stat->flm_stat_ver > 22 && p_nt4ga_stat->mp_stat_structs_flm) {
 			if (flmdata.lookup != p_nt4ga_stat->mp_stat_structs_flm->load_lps ||
 				flmdata.access != p_nt4ga_stat->mp_stat_structs_flm->load_aps) {
-				pthread_mutex_lock(&p_nt_drv->stat_lck);
+				rte_spinlock_lock(&p_nt_drv->stat_lck);
 				flmdata.lookup = p_nt4ga_stat->mp_stat_structs_flm->load_lps;
 				flmdata.access = p_nt4ga_stat->mp_stat_structs_flm->load_aps;
 				flmdata.lookup_maximum =
 					p_nt4ga_stat->mp_stat_structs_flm->max_lps;
 				flmdata.access_maximum =
 					p_nt4ga_stat->mp_stat_structs_flm->max_aps;
-				pthread_mutex_unlock(&p_nt_drv->stat_lck);
+				rte_spinlock_unlock(&p_nt_drv->stat_lck);
 
 				if (eth_dev && eth_dev->data && eth_dev->data->dev_private) {
 					rte_eth_dev_callback_process(eth_dev,
@@ -1773,7 +1774,7 @@ THREAD_FUNC port_event_thread_fn(void *context)
 		if (p_nt4ga_stat->mp_port_load) {
 			if (portdata.rx_bps != p_nt4ga_stat->mp_port_load[port_no].rx_bps ||
 				portdata.tx_bps != p_nt4ga_stat->mp_port_load[port_no].tx_bps) {
-				pthread_mutex_lock(&p_nt_drv->stat_lck);
+				rte_spinlock_lock(&p_nt_drv->stat_lck);
 				portdata.rx_bps = p_nt4ga_stat->mp_port_load[port_no].rx_bps;
 				portdata.tx_bps = p_nt4ga_stat->mp_port_load[port_no].tx_bps;
 				portdata.rx_pps = p_nt4ga_stat->mp_port_load[port_no].rx_pps;
@@ -1786,7 +1787,7 @@ THREAD_FUNC port_event_thread_fn(void *context)
 					p_nt4ga_stat->mp_port_load[port_no].rx_bps_max;
 				portdata.tx_bps_maximum =
 					p_nt4ga_stat->mp_port_load[port_no].tx_bps_max;
-				pthread_mutex_unlock(&p_nt_drv->stat_lck);
+				rte_spinlock_unlock(&p_nt_drv->stat_lck);
 
 				if (eth_dev && eth_dev->data && eth_dev->data->dev_private) {
 					rte_eth_dev_callback_process(eth_dev,
@@ -1957,9 +1958,9 @@ THREAD_FUNC adapter_stat_thread_fn(void *context)
 
 		/* Check then collect */
 		{
-			pthread_mutex_lock(&p_nt_drv->stat_lck);
+			rte_spinlock_lock(&p_nt_drv->stat_lck);
 			nt4ga_stat_ops->nt4ga_stat_collect(&p_nt_drv->adapter_info, p_nt4ga_stat);
-			pthread_mutex_unlock(&p_nt_drv->stat_lck);
+			rte_spinlock_unlock(&p_nt_drv->stat_lck);
 		}
 	}
 
@@ -2232,7 +2233,7 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)
 		}
 	}
 
-	pthread_mutex_init(&p_nt_drv->stat_lck, NULL);
+	rte_spinlock_init(&p_nt_drv->stat_lck);
 	res = THREAD_CTRL_CREATE(&p_nt_drv->stat_thread, "nt4ga_stat_thr", adapter_stat_thread_fn,
 			(void *)p_drv);
 
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +3 -3
index 8edaccb65c..4c18088681 100644
@@ -910,7 +910,7 @@ static int poll_statistics(struct pmd_internals *internals)
 
 	internals->last_stat_rtc = now_rtc;
 
-	pthread_mutex_lock(&p_nt_drv->stat_lck);
+	rte_spinlock_lock(&p_nt_drv->stat_lck);
 
 	/*
 	 * Add the RX statistics increments since last time we polled.
@@ -951,7 +951,7 @@ static int poll_statistics(struct pmd_internals *internals)
 	/* Globally only once a second */
 	if ((now_rtc - last_stat_rtc) < rte_tsc_freq) {
 		rte_spinlock_unlock(&hwlock);
-		pthread_mutex_unlock(&p_nt_drv->stat_lck);
+		rte_spinlock_unlock(&p_nt_drv->stat_lck);
 		return 0;
 	}
 
@@ -988,7 +988,7 @@ static int poll_statistics(struct pmd_internals *internals)
 	}
 
 	rte_spinlock_unlock(&hwlock);
-	pthread_mutex_unlock(&p_nt_drv->stat_lck);
+	rte_spinlock_unlock(&p_nt_drv->stat_lck);
 
 	return 0;
 }
Signature · 1 line
2.45.0
#401 lore raw

PATCH v5 75/80 net/ntnic: remove unnecessary

In reply to Serhii Iliushyk

Type casting:
The dev_private has type void * and type casting is not necessary.
FLOW_DEBUG condition
Use the dynamic logging

---
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  4 --
 .../net/ntnic/nthw/ntnic_meter/ntnic_meter.c  | 18 +++----
 drivers/net/ntnic/ntnic_ethdev.c              | 48 +++++++++----------
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 16 +++----
 4 files changed, 41 insertions(+), 45 deletions(-)
drivers/net/ntnic/nthw/flow_api/flow_api.c +0 -4
index 337902f654..ef8caefd9a 100644
@@ -342,7 +342,6 @@ static void flow_ndev_reset(struct flow_nic_dev *ndev)
 
 	ndev->flow_unique_id_counter = 0;
 
-#ifdef FLOW_DEBUG
 	/*
 	 * free all resources default allocated, initially for this NIC DEV
 	 * Is not really needed since the bitmap will be freed in a sec. Therefore
@@ -354,9 +353,7 @@ static void flow_ndev_reset(struct flow_nic_dev *ndev)
 
 	for (unsigned int i = 0; i < RES_COUNT; i++) {
 		int err = 0;
-#if defined(FLOW_DEBUG)
 		NT_LOG(DBG, FILTER, "RES state for: %s", dbg_res_descr[i]);
-#endif
 
 		for (unsigned int ii = 0; ii < ndev->res[i].resource_count; ii++) {
 			int ref = ndev->res[i].ref[ii];
@@ -373,7 +370,6 @@ static void flow_ndev_reset(struct flow_nic_dev *ndev)
 			NT_LOG(DBG, FILTER, "ERROR - some resources not freed");
 	}
 
-#endif
 }
 
 int flow_delete_eth_dev(struct flow_eth_dev *eth_dev)
drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c +9 -9
index e4e8fe0c7d..33593927a4 100644
@@ -42,7 +42,7 @@ static int eth_mtr_capabilities_get_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	uint8_t caller_id = get_caller_id(eth_dev->data->port_id);
 
@@ -110,7 +110,7 @@ static int eth_mtr_meter_profile_add_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	if (meter_profile_id >= profile_inline_ops->flow_mtr_meter_policy_n_max())
 		return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_PROFILE_ID, NULL,
@@ -161,7 +161,7 @@ static int eth_mtr_meter_profile_delete_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	if (meter_profile_id >= profile_inline_ops->flow_mtr_meter_policy_n_max())
 		return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_PROFILE_ID, NULL,
@@ -184,7 +184,7 @@ static int eth_mtr_meter_policy_add_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	if (policy_id >= profile_inline_ops->flow_mtr_meter_policy_n_max())
 		return -rte_mtr_error_set(error, EINVAL, RTE_MTR_ERROR_TYPE_METER_POLICY_ID, NULL,
@@ -250,7 +250,7 @@ static int eth_mtr_create_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	uint8_t caller_id = get_caller_id(eth_dev->data->port_id);
 
@@ -316,7 +316,7 @@ static int eth_mtr_destroy_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	uint8_t caller_id = get_caller_id(eth_dev->data->port_id);
 
@@ -348,7 +348,7 @@ static int eth_mtr_stats_adjust_inline(struct rte_eth_dev *eth_dev,
 
 	const uint64_t adjust_bit = 1ULL << 63;
 	const uint64_t probe_bit = 1ULL << 62;
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 	uint8_t caller_id = get_caller_id(eth_dev->data->port_id);
 
 	if (mtr_id >=
@@ -409,7 +409,7 @@ static int eth_mtr_stats_read_inline(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	uint8_t caller_id = get_caller_id(eth_dev->data->port_id);
 
@@ -445,7 +445,7 @@ static const struct rte_mtr_ops mtr_ops_inline = {
 
 static int eth_mtr_ops_get(struct rte_eth_dev *eth_dev, void *ops)
 {
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 	ntdrv_4ga_t *p_nt_drv = &internals->p_drv->ntdrv;
 	enum fpga_info_profile profile = p_nt_drv->adapter_info.fpga_info.profile;
 
drivers/net/ntnic/ntnic_ethdev.c +24 -24

192 lines not on this page · raw message

drivers/net/ntnic/ntnic_filter/ntnic_filter.c +8 -8
index 4c18088681..0e20606a41 100644
@@ -491,7 +491,7 @@ static int convert_flow(struct rte_eth_dev *eth_dev,
 	struct cnv_action_s *action,
 	struct rte_flow_error *error)
 {
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 	struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
 
 	static struct rte_flow_error flow_error = {
@@ -554,7 +554,7 @@ eth_flow_destroy(struct rte_eth_dev *eth_dev, struct rte_flow *flow, struct rte_
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	static struct rte_flow_error flow_error = {
 		.type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
@@ -595,7 +595,7 @@ static struct rte_flow *eth_flow_create(struct rte_eth_dev *eth_dev,
 		return NULL;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
 
@@ -673,7 +673,7 @@ static int eth_flow_flush(struct rte_eth_dev *eth_dev, struct rte_flow_error *er
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	static struct rte_flow_error flow_error = {
 		.type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
@@ -716,7 +716,7 @@ static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	static struct rte_flow_error flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
 		.message = "none" };
@@ -724,7 +724,7 @@ static int eth_flow_actions_update(struct rte_eth_dev *eth_dev,
 
 	if (internals->flw_dev) {
 		struct pmd_internals *dev_private =
-			(struct pmd_internals *)eth_dev->data->dev_private;
+			eth_dev->data->dev_private;
 		struct fpga_info_s *fpga_info = &dev_private->p_drv->ntdrv.adapter_info.fpga_info;
 		struct cnv_action_s action = { 0 };
 
@@ -780,7 +780,7 @@ static int eth_flow_dev_dump(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	static struct rte_flow_error flow_error = {
 		.type = RTE_FLOW_ERROR_TYPE_NONE, .message = "none" };
@@ -808,7 +808,7 @@ static int eth_flow_get_aged_flows(struct rte_eth_dev *eth_dev,
 		return -1;
 	}
 
-	struct pmd_internals *internals = (struct pmd_internals *)eth_dev->data->dev_private;
+	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	static struct rte_flow_error flow_error = {
 		.type = RTE_FLOW_ERROR_TYPE_NONE,
Signature · 1 line
2.45.0
#402 lore raw

PATCH v5 76/80 net/ntnic: add async create/destroy declaration

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

implementation for async create and destroy flow.

---
 drivers/net/ntnic/include/flow_api_engine.h   |   8 ++
 drivers/net/ntnic/ntnic_ethdev.c              |   1 +
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 105 ++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.c             |  15 +++
 drivers/net/ntnic/ntnic_mod_reg.h             |  18 +++
 5 files changed, 147 insertions(+)
drivers/net/ntnic/include/flow_api_engine.h +8 -0
index b40a27fbf1..505fb8e501 100644
@@ -343,6 +343,14 @@ struct flow_handle {
 	};
 };
 
+struct flow_pattern_template {
+};
+
+struct flow_actions_template {
+};
+struct flow_template_table {
+};
+
 void km_attach_ndev_resource_management(struct km_flow_def_s *km, void **handle);
 void km_free_ndev_resource_management(void **handle);
 
drivers/net/ntnic/ntnic_ethdev.c +1 -0
index 068c3d932a..77436eb02d 100644
@@ -1252,6 +1252,7 @@ eth_dev_start(struct rte_eth_dev *eth_dev)
 		return -1;
 	}
 
+	eth_dev->flow_fp_ops = get_dev_fp_flow_ops();
 	struct pmd_internals *internals = eth_dev->data->dev_private;
 
 	const int n_intf_no = internals->n_intf_no;
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +105 -0

120 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.c +15 -0
index 10aa778a57..658fac72c0 100644
@@ -199,6 +199,21 @@ const struct flow_filter_ops *get_flow_filter_ops(void)
 	return flow_filter_ops;
 }
 
+static const struct rte_flow_fp_ops *dev_fp_flow_ops;
+
+void register_dev_fp_flow_ops(const struct rte_flow_fp_ops *ops)
+{
+	dev_fp_flow_ops = ops;
+}
+
+const struct rte_flow_fp_ops *get_dev_fp_flow_ops(void)
+{
+	if (dev_fp_flow_ops == NULL)
+		dev_fp_flow_init();
+
+	return dev_fp_flow_ops;
+}
+
 static const struct rte_flow_ops *dev_flow_ops;
 
 void register_dev_flow_ops(const struct rte_flow_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +18 -0
index 563e62ebce..572da11d02 100644
@@ -7,6 +7,7 @@
 #define __NTNIC_MOD_REG_H__
 
 #include <stdint.h>
+#include <rte_flow.h>
 
 #include "rte_ethdev.h"
 #include "rte_flow_driver.h"
@@ -426,6 +427,19 @@ struct flow_filter_ops {
 		uint32_t nb_contexts,
 		struct rte_flow_error *error);
 
+	/*
+	 * RTE flow asynchronous operations functions
+	 */
+	struct flow_handle *(*flow_async_create)(struct flow_eth_dev *dev, uint32_t queue_id,
+		const struct rte_flow_op_attr *op_attr,
+		struct flow_template_table *template_table, const struct rte_flow_item pattern[],
+		uint8_t pattern_template_index, const struct rte_flow_action actions[],
+		uint8_t actions_template_index, void *user_data, struct rte_flow_error *error);
+
+	int (*flow_async_destroy)(struct flow_eth_dev *dev, uint32_t queue_id,
+		const struct rte_flow_op_attr *op_attr, struct flow_handle *flow,
+		void *user_data, struct rte_flow_error *error);
+
 	int (*flow_info_get)(struct flow_eth_dev *dev, uint8_t caller_id,
 		struct rte_flow_port_info *port_info, struct rte_flow_queue_info *queue_info,
 		struct rte_flow_error *error);
@@ -436,6 +450,10 @@ struct flow_filter_ops {
 		struct rte_flow_error *error);
 };
 
+void register_dev_fp_flow_ops(const struct rte_flow_fp_ops *ops);
+const struct rte_flow_fp_ops *get_dev_fp_flow_ops(void);
+void dev_fp_flow_init(void);
+
 void register_dev_flow_ops(const struct rte_flow_ops *ops);
 const struct rte_flow_ops *get_dev_flow_ops(void);
 void dev_flow_init(void);
Signature · 1 line
2.45.0
#403 lore raw

PATCH v5 77/80 net/ntnic: add async template declaration

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

rte_flow_ops was exnteded with next features support
1. flow pattern template create
2. flow pattern template destroy
3. flow actions template create
4. flow actions template destroy
5. flow template table create
6. flow template table destroy

---
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 224 ++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  28 +++
 2 files changed, 252 insertions(+)
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +224 -0
index d1f3ed4831..06b6ae442b 100644
@@ -886,6 +886,224 @@ static int eth_flow_configure(struct rte_eth_dev *dev, const struct rte_flow_por
 	return res;
 }
 
+static struct rte_flow_pattern_template *eth_flow_pattern_template_create(struct rte_eth_dev *dev,
+	const struct rte_flow_pattern_template_attr *template_attr,
+	const struct rte_flow_item pattern[], struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized");
+		return NULL;
+	}
+
+	struct pmd_internals *internals = dev->data->dev_private;
+
+	static struct rte_flow_error flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+
+	struct cnv_match_s match = { 0 };
+	struct rte_flow_pattern_template_attr attr = {
+		.relaxed_matching = template_attr->relaxed_matching,
+		.ingress = template_attr->ingress,
+		.egress = template_attr->egress,
+		.transfer = template_attr->transfer,
+	};
+
+	uint16_t caller_id = get_caller_id(dev->data->port_id);
+
+	if (create_match_elements(&match, pattern, MAX_ELEMENTS) != 0) {
+		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM, NULL,
+			"Error in pattern");
+		return NULL;
+	}
+
+	struct flow_pattern_template *res =
+		flow_filter_ops->flow_pattern_template_create(internals->flw_dev, &attr, caller_id,
+			match.rte_flow_item, &flow_error);
+
+	convert_error(error, &flow_error);
+	return (struct rte_flow_pattern_template *)res;
+}
+
+static int eth_flow_pattern_template_destroy(struct rte_eth_dev *dev,
+	struct rte_flow_pattern_template *pattern_template,
+	struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized");
+		return -1;
+	}
+
+	struct pmd_internals *internals = dev->data->dev_private;
+
+	static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+
+	int res = flow_filter_ops->flow_pattern_template_destroy(internals->flw_dev,
+			(struct flow_pattern_template *)
+			pattern_template,
+			&rte_flow_error);
+
+	convert_error(error, &rte_flow_error);
+	return res;
+}
+
+static struct rte_flow_actions_template *eth_flow_actions_template_create(struct rte_eth_dev *dev,
+	const struct rte_flow_actions_template_attr *template_attr,
+	const struct rte_flow_action actions[], const struct rte_flow_action masks[],
+	struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized");
+		return NULL;
+	}
+
+	struct pmd_internals *internals = dev->data->dev_private;
+
+	struct fpga_info_s *fpga_info = &internals->p_drv->ntdrv.adapter_info.fpga_info;
+	static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+
+	struct cnv_action_s action = { 0 };
+	struct cnv_action_s mask = { 0 };
+	struct rte_flow_actions_template_attr attr = {
+		.ingress = template_attr->ingress,
+		.egress = template_attr->egress,
+		.transfer = template_attr->transfer,
+	};
+	uint16_t caller_id = get_caller_id(dev->data->port_id);
+
+	if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) {
+		uint32_t queue_offset = 0;
+
+		if (internals->type == PORT_TYPE_OVERRIDE && internals->vpq_nb_vq > 0)
+			queue_offset = internals->vpq[0].id;
+
+		if (create_action_elements_inline(&action, actions, MAX_ACTIONS, queue_offset) !=
+			0) {
+			rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+				"Error in actions");
+			return NULL;
+		}
+
+		if (create_action_elements_inline(&mask, masks, MAX_ACTIONS, queue_offset) != 0) {
+			rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, NULL,
+				"Error in masks");
+			return NULL;
+		}
+
+	} else {
+		rte_flow_error_set(error, EPERM, RTE_FLOW_ERROR_TYPE_UNSPECIFIED, NULL,
+			"Unsupported adapter profile");
+		return NULL;
+	}
+
+	struct flow_actions_template *res =
+		flow_filter_ops->flow_actions_template_create(internals->flw_dev, &attr, caller_id,
+			action.flow_actions,
+			mask.flow_actions, &rte_flow_error);
+
+	convert_error(error, &rte_flow_error);
+	return (struct rte_flow_actions_template *)res;
+}
+
+static int eth_flow_actions_template_destroy(struct rte_eth_dev *dev,
+	struct rte_flow_actions_template *actions_template,
+	struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, NTNIC, "flow_filter module uninitialized");
+		return -1;
+	}
+
+	struct pmd_internals *internals = dev->data->dev_private;
+
+	static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+
+	int res = flow_filter_ops->flow_actions_template_destroy(internals->flw_dev,
+			(struct flow_actions_template *)
+			actions_template,
+			&rte_flow_error);
+
+	convert_error(error, &rte_flow_error);
+	return res;
+}
+
+static struct rte_flow_template_table *eth_flow_template_table_create(struct rte_eth_dev *dev,
+	const struct rte_flow_template_table_attr *table_attr,
+	struct rte_flow_pattern_template *pattern_templates[], uint8_t nb_pattern_templates,
+	struct rte_flow_actions_template *actions_templates[], uint8_t nb_actions_templates,
+	struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized");
+		return NULL;
+	}
+
+	struct pmd_internals *internals = dev->data->dev_private;
+
+	static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+
+	struct rte_flow_template_table_attr attr = {
+		.flow_attr = {
+			.group = table_attr->flow_attr.group,
+			.priority = table_attr->flow_attr.priority,
+			.ingress = table_attr->flow_attr.ingress,
+			.egress = table_attr->flow_attr.egress,
+			.transfer = table_attr->flow_attr.transfer,
+		},
+		.nb_flows = table_attr->nb_flows,
+	};
+	uint16_t forced_vlan_vid = 0;
+	uint16_t caller_id = get_caller_id(dev->data->port_id);
+
+	struct flow_template_table *res =
+		flow_filter_ops->flow_template_table_create(internals->flw_dev, &attr,
+			forced_vlan_vid, caller_id,
+			(struct flow_pattern_template **)pattern_templates,
+			nb_pattern_templates, (struct flow_actions_template **)actions_templates,
+			nb_actions_templates, &rte_flow_error);
+
+	convert_error(error, &rte_flow_error);
+	return (struct rte_flow_template_table *)res;
+}
+
+static int eth_flow_template_table_destroy(struct rte_eth_dev *dev,
+	struct rte_flow_template_table *template_table,
+	struct rte_flow_error *error)
+{
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "flow_filter module uninitialized");
+		return -1;
+	}
+
+	struct pmd_internals *internals = dev->data->dev_private;
+
+	static struct rte_flow_error rte_flow_error = { .type = RTE_FLOW_ERROR_TYPE_NONE,
+		.message = "none" };
+
+	int res = flow_filter_ops->flow_template_table_destroy(internals->flw_dev,
+			(struct flow_template_table *)
+			template_table,
+			&rte_flow_error);
+
+	convert_error(error, &rte_flow_error);
+	return res;
+}
+
 static struct rte_flow *eth_flow_async_create(struct rte_eth_dev *dev, uint32_t queue_id,
 	const struct rte_flow_op_attr *op_attr,
 	struct rte_flow_template_table *template_table, const struct rte_flow_item pattern[],
@@ -1106,6 +1324,12 @@ static const struct rte_flow_ops dev_flow_ops = {
 	.get_aged_flows = eth_flow_get_aged_flows,
 	.info_get = eth_flow_info_get,
 	.configure = eth_flow_configure,
+	.pattern_template_create = eth_flow_pattern_template_create,
+	.pattern_template_destroy = eth_flow_pattern_template_destroy,
+	.actions_template_create = eth_flow_actions_template_create,
+	.actions_template_destroy = eth_flow_actions_template_destroy,
+	.template_table_create = eth_flow_template_table_create,
+	.template_table_destroy = eth_flow_template_table_destroy,
 };
 
 void dev_flow_init(void)
drivers/net/ntnic/ntnic_mod_reg.h +28 -0
index 572da11d02..92856b81d5 100644
@@ -430,6 +430,34 @@ struct flow_filter_ops {
 	/*
 	 * RTE flow asynchronous operations functions
 	 */
+	struct flow_pattern_template *(*flow_pattern_template_create)(struct flow_eth_dev *dev,
+		const struct rte_flow_pattern_template_attr *template_attr, uint16_t caller_id,
+		const struct rte_flow_item pattern[], struct rte_flow_error *error);
+
+	int (*flow_pattern_template_destroy)(struct flow_eth_dev *dev,
+		struct flow_pattern_template *pattern_template,
+		struct rte_flow_error *error);
+
+	struct flow_actions_template *(*flow_actions_template_create)(struct flow_eth_dev *dev,
+		const struct rte_flow_actions_template_attr *template_attr,  uint16_t caller_id,
+		const struct rte_flow_action actions[], const struct rte_flow_action masks[],
+		struct rte_flow_error *error);
+
+	int (*flow_actions_template_destroy)(struct flow_eth_dev *dev,
+		struct flow_actions_template *actions_template,
+		struct rte_flow_error *error);
+
+	struct flow_template_table *(*flow_template_table_create)(struct flow_eth_dev *dev,
+		const struct rte_flow_template_table_attr *table_attr, uint16_t forced_vlan_vid,
+		uint16_t caller_id,
+		struct flow_pattern_template *pattern_templates[], uint8_t nb_pattern_templates,
+		struct flow_actions_template *actions_templates[], uint8_t nb_actions_templates,
+		struct rte_flow_error *error);
+
+	int (*flow_template_table_destroy)(struct flow_eth_dev *dev,
+		struct flow_template_table *template_table,
+		struct rte_flow_error *error);
+
 	struct flow_handle *(*flow_async_create)(struct flow_eth_dev *dev, uint32_t queue_id,
 		const struct rte_flow_op_attr *op_attr,
 		struct flow_template_table *template_table, const struct rte_flow_item pattern[],
Signature · 1 line
2.45.0
#404 lore raw

PATCH v5 78/80 net/ntnic: add async flow create/delete implementation

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Inline profile was extended with async flow create and delete features implementation.

async create and destroy was added to the flow filter ops.

---
 doc/guides/nics/ntnic.rst                     |   1 +
 doc/guides/rel_notes/release_24_11.rst        |   1 +
 drivers/net/ntnic/include/flow_api_engine.h   |  36 +++
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  39 +++
 .../profile_inline/flow_api_hw_db_inline.c    |  13 +
 .../profile_inline/flow_api_hw_db_inline.h    |   2 +
 .../profile_inline/flow_api_profile_inline.c  | 248 +++++++++++++++++-
 .../profile_inline/flow_api_profile_inline.h  |  14 +
 drivers/net/ntnic/ntnic_mod_reg.h             |  15 ++
 9 files changed, 368 insertions(+), 1 deletion(-)
doc/guides/nics/ntnic.rst +1 -0
index afdaf22e0b..fa6cd2b95c 100644
@@ -70,6 +70,7 @@ Features
 - Flow aging support
 - Flow metering, including meter policy API.
 - Flow update. Update of the action list for specific flow
+- Asynchronous flow support
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index 735a295f6e..13f7dada4b 100644
@@ -167,6 +167,7 @@ New Features
   * Added age rte flow action support
   * Added meter flow metering and flow policy support
   * Added flow actions update support
+  * Added asynchronous flow support
 
 * **Added cryptodev queue pair reset support.**
 
drivers/net/ntnic/include/flow_api_engine.h +36 -0
index 505fb8e501..6935ff483a 100644
@@ -339,6 +339,12 @@ struct flow_handle {
 			uint8_t flm_rqi;
 			uint8_t flm_qfi;
 			uint8_t flm_scrub_prof;
+
+			/* Flow specific pointer to application template table cell stored during
+			 * flow create.
+			 */
+			struct flow_template_table_cell *template_table_cell;
+			bool flm_async;
 		};
 	};
 };
@@ -347,8 +353,38 @@ struct flow_pattern_template {
 };
 
 struct flow_actions_template {
+	struct nic_flow_def *fd;
+
+	uint32_t num_dest_port;
+	uint32_t num_queues;
 };
+
+struct flow_template_table_cell {
+	atomic_int status;
+	atomic_int counter;
+
+	uint32_t flm_db_idx_counter;
+	uint32_t flm_db_idxs[RES_COUNT];
+
+	uint32_t flm_key_id;
+	uint32_t flm_ft;
+
+	uint16_t flm_rpl_ext_ptr;
+	uint8_t  flm_scrub_prof;
+};
+
 struct flow_template_table {
+	struct flow_pattern_template **pattern_templates;
+	uint8_t nb_pattern_templates;
+
+	struct flow_actions_template **actions_templates;
+	uint8_t nb_actions_templates;
+
+	struct flow_template_table_cell *pattern_action_pairs;
+
+	struct rte_flow_attr attr;
+	uint16_t forced_vlan_vid;
+	uint16_t caller_id;
 };
 
 void km_attach_ndev_resource_management(struct km_flow_def_s *km, void **handle);
drivers/net/ntnic/nthw/flow_api/flow_api.c +39 -0
index ef8caefd9a..884a59a5de 100644
@@ -1077,6 +1077,43 @@ static int flow_configure(struct flow_eth_dev *dev, uint8_t caller_id,
 			nb_queue, queue_attr, error);
 }
 
+/*
+ * Flow Asynchronous operation API
+ */
+
+static struct flow_handle *
+flow_async_create(struct flow_eth_dev *dev, uint32_t queue_id,
+	const struct rte_flow_op_attr *op_attr, struct flow_template_table *template_table,
+	const struct rte_flow_item pattern[], uint8_t pattern_template_index,
+	const struct rte_flow_action actions[], uint8_t actions_template_index, void *user_data,
+	struct rte_flow_error *error)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized");
+		return NULL;
+	}
+
+	return profile_inline_ops->flow_async_create_profile_inline(dev, queue_id, op_attr,
+			template_table, pattern, pattern_template_index, actions,
+			actions_template_index, user_data, error);
+}
+
+static int flow_async_destroy(struct flow_eth_dev *dev, uint32_t queue_id,
+	const struct rte_flow_op_attr *op_attr, struct flow_handle *flow,
+	void *user_data, struct rte_flow_error *error)
+{
+	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
+
+	if (profile_inline_ops == NULL) {
+		NT_LOG_DBGX(ERR, FILTER, "profile_inline module uninitialized");
+		return -1;
+	}
+
+	return profile_inline_ops->flow_async_destroy_profile_inline(dev, queue_id, op_attr, flow,
+			user_data, error);
+}
 int flow_get_flm_stats(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size)
 {
 	const struct profile_inline_ops *profile_inline_ops = get_profile_inline_ops();
@@ -1113,6 +1150,8 @@ static const struct flow_filter_ops ops = {
 	 */
 	.flow_info_get = flow_info_get,
 	.flow_configure = flow_configure,
+	.flow_async_create = flow_async_create,
+	.flow_async_destroy = flow_async_destroy,
 
 	/*
 	 * Other
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +13 -0
index 2fee6ae6b5..ffab643f56 100644
@@ -393,6 +393,19 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct
 	}
 }
 
+struct hw_db_idx *hw_db_inline_find_idx(struct flow_nic_dev *ndev, void *db_handle,
+	enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size)
+{
+	(void)ndev;
+	(void)db_handle;
+	for (uint32_t i = 0; i < size; ++i) {
+		if (idxs[i].type == type)
+			return &idxs[i];
+	}
+
+	return NULL;
+}
+
 void hw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struct hw_db_idx *idxs,
 	uint32_t size, FILE *file)
 {
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +2 -0
index c920d36cfd..aa046b68a7 100644
@@ -287,6 +287,8 @@ void hw_db_inline_deref_idxs(struct flow_nic_dev *ndev, void *db_handle, struct
 	uint32_t size);
 const void *hw_db_inline_find_data(struct flow_nic_dev *ndev, void *db_handle,
 	enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size);
+struct hw_db_idx *hw_db_inline_find_idx(struct flow_nic_dev *ndev, void *db_handle,
+	enum hw_db_idx_type type, struct hw_db_idx *idxs, uint32_t size);
 void hw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struct hw_db_idx *idxs,
 	uint32_t size, FILE *file);
 void hw_db_inline_dump_cfn(struct flow_nic_dev *ndev, void *db_handle, FILE *file);
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +247 -1

284 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +14 -0
index 8a03be1ab7..b548142342 100644
@@ -69,6 +69,20 @@ int flow_nic_set_hasher_fields_inline(struct flow_nic_dev *ndev,
 
 int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
 
+/*
+ * RTE flow asynchronous operations functions
+ */
+
+struct flow_handle *flow_async_create_profile_inline(struct flow_eth_dev *dev, uint32_t queue_id,
+	const struct rte_flow_op_attr *op_attr,
+	struct flow_template_table *template_table, const struct rte_flow_item pattern[],
+	uint8_t pattern_template_index, const struct rte_flow_action actions[],
+	uint8_t actions_template_index, void *user_data, struct rte_flow_error *error);
+
+int flow_async_destroy_profile_inline(struct flow_eth_dev *dev, uint32_t queue_id,
+	const struct rte_flow_op_attr *op_attr, struct flow_handle *flow,
+	void *user_data, struct rte_flow_error *error);
+
 int flow_info_get_profile_inline(struct flow_eth_dev *dev, uint8_t caller_id,
 	struct rte_flow_port_info *port_info,
 	struct rte_flow_queue_info *queue_info, struct rte_flow_error *error);
drivers/net/ntnic/ntnic_mod_reg.h +15 -0
index 92856b81d5..e8e7090661 100644
@@ -310,6 +310,21 @@ struct profile_inline_ops {
 		uint32_t nb_contexts,
 		struct rte_flow_error *error);
 
+	/*
+	 * RTE flow asynchronous operations functions
+	 */
+
+	struct flow_handle *(*flow_async_create_profile_inline)(struct flow_eth_dev *dev,
+		uint32_t queue_id, const struct rte_flow_op_attr *op_attr,
+		struct flow_template_table *template_table, const struct rte_flow_item pattern[],
+		uint8_t rte_pattern_template_index, const struct rte_flow_action actions[],
+		uint8_t rte_actions_template_index, void *user_data, struct rte_flow_error *error);
+
+	int (*flow_async_destroy_profile_inline)(struct flow_eth_dev *dev, uint32_t queue_id,
+		const struct rte_flow_op_attr *op_attr,
+		struct flow_handle *flow, void *user_data,
+		struct rte_flow_error *error);
+
 	int (*flow_nic_set_hasher_fields_inline)(struct flow_nic_dev *ndev,
 		int hsh_idx,
 		struct nt_eth_rss_conf rss_conf);
Signature · 1 line
2.45.0
#405 lore raw

PATCH v5 79/80 net/ntnic: add async template implementation

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

flow filter ops and inline API was exnteded with next APIs:
1. flow pattern template create
2. flow pattern template destroy
3. flow actions template create
4. flow actions template destroy
5. flow template table create
6. flow template table destroy

---
 drivers/net/ntnic/include/flow_api_engine.h   |   1 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 104 ++++++++
 .../profile_inline/flow_api_profile_inline.c  | 225 ++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.h  |  28 +++
 drivers/net/ntnic/ntnic_mod_reg.h             |  30 +++
 5 files changed, 388 insertions(+)
drivers/net/ntnic/include/flow_api_engine.h +1 -0
index 6935ff483a..8604dde995 100644
@@ -350,6 +350,7 @@ struct flow_handle {
 };
 
 struct flow_pattern_template {
+	struct nic_flow_def *fd;
 };
 
 struct flow_actions_template {
drivers/net/ntnic/nthw/flow_api/flow_api.c +104 -0

116 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +225 -0

237 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +28 -0
index b548142342..0dc89085ec 100644
@@ -73,6 +73,34 @@ int flow_get_flm_stats_profile_inline(struct flow_nic_dev *ndev, uint64_t *data,
  * RTE flow asynchronous operations functions
  */
 
+struct flow_pattern_template *flow_pattern_template_create_profile_inline(struct flow_eth_dev *dev,
+	const struct rte_flow_pattern_template_attr *template_attr, uint16_t caller_id,
+	const struct rte_flow_item pattern[], struct rte_flow_error *error);
+
+int flow_pattern_template_destroy_profile_inline(struct flow_eth_dev *dev,
+	struct flow_pattern_template *pattern_template,
+	struct rte_flow_error *error);
+
+struct flow_actions_template *flow_actions_template_create_profile_inline(struct flow_eth_dev *dev,
+	const struct rte_flow_actions_template_attr *template_attr, uint16_t caller_id,
+	const struct rte_flow_action actions[], const struct rte_flow_action masks[],
+	struct rte_flow_error *error);
+
+int flow_actions_template_destroy_profile_inline(struct flow_eth_dev *dev,
+	struct flow_actions_template *actions_template,
+	struct rte_flow_error *error);
+
+struct flow_template_table *flow_template_table_create_profile_inline(struct flow_eth_dev *dev,
+	const struct rte_flow_template_table_attr *table_attr, uint16_t forced_vlan_vid,
+	uint16_t caller_id,
+	struct flow_pattern_template *pattern_templates[], uint8_t nb_pattern_templates,
+	struct flow_actions_template *actions_templates[], uint8_t nb_actions_templates,
+	struct rte_flow_error *error);
+
+int flow_template_table_destroy_profile_inline(struct flow_eth_dev *dev,
+	struct flow_template_table *template_table,
+	struct rte_flow_error *error);
+
 struct flow_handle *flow_async_create_profile_inline(struct flow_eth_dev *dev, uint32_t queue_id,
 	const struct rte_flow_op_attr *op_attr,
 	struct flow_template_table *template_table, const struct rte_flow_item pattern[],
drivers/net/ntnic/ntnic_mod_reg.h +30 -0
index e8e7090661..eb764356eb 100644
@@ -314,6 +314,36 @@ struct profile_inline_ops {
 	 * RTE flow asynchronous operations functions
 	 */
 
+	struct flow_pattern_template *(*flow_pattern_template_create_profile_inline)
+		(struct flow_eth_dev *dev,
+		const struct rte_flow_pattern_template_attr *template_attr, uint16_t caller_id,
+		const struct rte_flow_item pattern[], struct rte_flow_error *error);
+
+	int (*flow_pattern_template_destroy_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_pattern_template *pattern_template,
+		struct rte_flow_error *error);
+
+	struct flow_actions_template *(*flow_actions_template_create_profile_inline)
+		(struct flow_eth_dev *dev,
+		const struct rte_flow_actions_template_attr *template_attr,
+		uint16_t caller_id, const struct rte_flow_action actions[],
+		const struct rte_flow_action masks[], struct rte_flow_error *error);
+
+	int (*flow_actions_template_destroy_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_actions_template *actions_template,
+		struct rte_flow_error *error);
+
+	struct flow_template_table *(*flow_template_table_create_profile_inline)
+		(struct flow_eth_dev *dev, const struct rte_flow_template_table_attr *table_attr,
+		uint16_t forced_vlan_vid, uint16_t caller_id,
+		struct flow_pattern_template *pattern_templates[], uint8_t nb_pattern_templates,
+		struct flow_actions_template *actions_templates[], uint8_t nb_actions_templates,
+		struct rte_flow_error *error);
+
+	int (*flow_template_table_destroy_profile_inline)(struct flow_eth_dev *dev,
+		struct flow_template_table *template_table,
+		struct rte_flow_error *error);
+
 	struct flow_handle *(*flow_async_create_profile_inline)(struct flow_eth_dev *dev,
 		uint32_t queue_id, const struct rte_flow_op_attr *op_attr,
 		struct flow_template_table *template_table, const struct rte_flow_item pattern[],
Signature · 1 line
2.45.0