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 2 of 6

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

PATCH v2 6/73 net/ntnic: add management API for NT flow profile

In reply to Serhii Iliushyk

Management API implements (re)setting of the NT flow dev

---
 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    | 60 +++++++++++++++++++
 .../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, 102 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 +60 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +20 -0
index a6293f5f82..c9e4008b7e 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)
+{
+	return -1;
+}
+
+int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
+{
+	return 0;
+}
+
 struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev,
 	const struct rte_flow_attr *attr,
 	uint16_t forced_vlan_vid,
@@ -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
#84 lore raw

PATCH v2 7/73 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  | 52 ++++++++++++++++
 9 files changed, 278 insertions(+)
 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 +52 -0

69 lines not on this page · raw message

Signature · 1 line
2.45.0
#85 lore raw

Re: [PATCH v2 07/73] net/ntnic: add NT flow profile management implementation

drivers/net/ntnic/include/flow_api.h struct flow_nic_dev { · line 67

Quoted 12 lines · On Tue, 22 Oct 2024 18:54:24 +0200 Serhii Iliushyk <[email protected]> wrote:
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;
+

Use of untyped pointers (void *) can lead to errors, it would have been better to make these struct pointers.

#86 lore raw

PATCH v2 8/73 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 +
 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 ++++++++++++++++++
 13 files changed, 1103 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
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
#87 lore raw

Re: [PATCH v2 08/73] net/ntnic: add create/destroy implementation for NT flows

drivers/net/ntnic/include/flow_api.h struct flow_nic_dev { · line 73

Quoted 11 lines · On Tue, 22 Oct 2024 18:54:25 +0200 Serhii Iliushyk <[email protected]> wrote:
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;

Use of pthread_mutex makes the driver unportable to Windows, and will block the the thread in case of contention. And it will not handle the case of primary/secondary process.

Prefer use of DPDK spinlock if possible.

#88 lore raw

Re: [PATCH v2 08/73] net/ntnic: add create/destroy implementation for NT flows

Quoted 27 lines

On 22.10.2024, 20:21, "Stephen Hemminger" wrote:

On Tue, 22 Oct 2024 18:54:25 +0200
Serhii Iliushyk <[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>> <mailto:[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>> <mailto:[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>> <mailto:[email protected] <mailto:[email protected]> <mailto:[email protected] <mailto:[email protected]>>>>> wrote:

drivers/net/ntnic/include/flow_api.h struct flow_nic_dev { · line 73

Quoted 11 lines
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;

Use of pthread_mutex makes the driver unportable to Windows, and will block the the thread in case of contention. And it will not handle the case of primary/secondary process.

Quoted 2 lines

Prefer use of DPDK spinlock if possible.

Hi Stephen!

The current version of our PMD supports only Linux x86_64 platforms. Due to this, we have added a special condition to the meson.build file:

```
if not is_linux or not dpdk_conf.has('RTE_ARCH_X86_64')
build = false
reason = 'only supported on x86_64 Linux'
subdir_done()
endif
```

We prefer to use pthread for the current patch set and fix it later.

Best regards,
Serhii

NOTE: Please ignore the disclaimer. We are working on fix it.

#89 lore raw

PATCH v2 9/73 net/ntnic: add infrastructure for for flow actions and items

In reply to Serhii Iliushyk

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

---
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    | 33 ++++++++
 drivers/net/ntnic/nthw/flow_api/flow_km.c     | 81 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.c  | 68 +++++++++++++++-
 5 files changed, 258 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 +33 -0
index 34154c65f8..99b207a01c 100644
@@ -133,6 +133,39 @@ enum km_flm_if_select_e {
 	unsigned int alloced_size;                                                                \
 	int debug
 
+enum {
+	PROT_OTHER = 0,
+	PROT_L2_ETH2 = 1,
+};
+
+enum {
+	PROT_L3_IPV4 = 1,
+};
+
+enum {
+	PROT_L4_ICMP = 4
+};
+
+enum {
+	PROT_TUN_L3_OTHER = 0,
+	PROT_TUN_L3_IPV4 = 1,
+};
+
+enum {
+	PROT_TUN_L4_OTHER = 0,
+	PROT_TUN_L4_ICMP = 4
+};
+
+
+enum {
+	CPY_SELECT_DSCP_IPV4 = 0,
+	CPY_SELECT_DSCP_IPV6 = 1,
+	CPY_SELECT_RQI_QFI = 2,
+	CPY_SELECT_IPV4 = 3,
+	CPY_SELECT_PORT = 4,
+	CPY_SELECT_TEID = 5,
+};
+
 struct common_func_s {
 	COMMON_FUNC_INFO_S;
 };
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
#90 lore raw

PATCH v2 10/73 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 +
 .../profile_inline/flow_api_profile_inline.c  | 37 +++++++++++++++++++
 2 files changed, 38 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
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +37 -0
index 0f136ee164..a3fe2fe902 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
#91 lore raw

PATCH v2 11/73 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 a3fe2fe902..96b7192edc 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
#92 lore raw

PATCH v2 12/73 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 96b7192edc..603039374a 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
#93 lore raw

PATCH v2 13/73 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 603039374a..64168fcc7d 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
#94 lore raw

PATCH v2 14/73 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    |  23 +++
 .../profile_inline/flow_api_profile_inline.c  | 180 ++++++++++++++++++
 3 files changed, 204 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 +23 -0
index 99b207a01c..0c22129fb4 100644
@@ -120,6 +120,29 @@ 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,
+	DYN_L4 = 7,
+	DYN_L4_PAYLOAD = 8,
+	DYN_TUN_L3 = 13,
+	DYN_TUN_L4 = 16,
+};
+
+/* Sideband info bit indicator */
+
 enum km_flm_if_select_e {
 	KM_FLM_IF_FIRST = 0,
 	KM_FLM_IF_SECOND = 1
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +180 -0

204 lines not on this page · raw message

Signature · 1 line
2.45.0
#95 lore raw

PATCH v2 15/73 net/ntnic: add item IPv4

In reply to Serhii Iliushyk

Add possibility to use RTE_FLOW_ITEM_TYPE_IPV4

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 .../profile_inline/flow_api_profile_inline.c  | 162 ++++++++++++++++++
 2 files changed, 163 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 +162 -0

169 lines not on this page · raw message

Signature · 1 line
2.45.0
#96 lore raw

PATCH v2 16/73 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
#97 lore raw

PATCH v2 17/73 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 6bf0ff8821..efefd52979 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;
 			break;
 
 		default:
Signature · 1 line
2.45.0
#98 lore raw

PATCH v2 18/73 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    | 4 ++++
 1 file changed, 4 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +4 -0
index efefd52979..e47014615e 100644
@@ -939,6 +939,10 @@ 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:
Signature · 1 line
2.45.0
#99 lore raw

PATCH v2 19/73 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
#100 lore raw

PATCH v2 20/73 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
#101 lore raw

PATCH v2 21/73 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 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  1 +
 .../profile_inline/flow_api_profile_inline.c  | 94 +++++++++++++++++++
 3 files changed, 96 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
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 +94 -0

106 lines not on this page · raw message

Signature · 1 line
2.45.0
#102 lore raw

PATCH v2 22/73 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
#103 lore raw

PATCH v2 23/73 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  | 273 ++++++++++++++++++
 4 files changed, 304 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 6800a8d834..2aee2ee973 100644
@@ -47,6 +47,33 @@ static const struct {
 } err_msg[] = {
 	/* 00 */ { "Operation successfully completed" },
 	/* 01 */ { "Operation failed" },
+	/* 02 */ { "Memory allocation failed" },
+	/* 03 */ { "Too many output destinations" },
+	/* 04 */ { "Too many output queues for RSS" },
+	/* 05 */ { "The VLAN TPID specified is not supported" },
+	/* 06 */ { "The VxLan Push header specified is not accepted" },
+	/* 07 */ { "While interpreting VxLan Pop action, could not find a destination port" },
+	/* 08 */ { "Failed in creating a HW-internal VTEP port" },
+	/* 09 */ { "Too many VLAN tag matches" },
+	/* 10 */ { "IPv6 invalid header specified" },
+	/* 11 */ { "Too many tunnel ports. HW limit reached" },
+	/* 12 */ { "Unknown or unsupported flow match element received" },
+	/* 13 */ { "Match failed because of HW limitations" },
+	/* 14 */ { "Match failed because of HW resource limitations" },
+	/* 15 */ { "Match failed because of too complex element definitions" },
+	/* 16 */ { "Action failed. To too many output destinations" },
+	/* 17 */ { "Action Output failed, due to HW resource exhaustion" },
+	/* 18 */ { "Push Tunnel Header action cannot output to multiple destination queues" },
+	/* 19 */ { "Inline action HW resource exhaustion" },
+	/* 20 */ { "Action retransmit/recirculate HW resource exhaustion" },
+	/* 21 */ { "Flow counter HW resource exhaustion" },
+	/* 22 */ { "Internal HW resource exhaustion to handle Actions" },
+	/* 23 */ { "Internal HW QSL compare failed" },
+	/* 24 */ { "Internal CAT CFN reuse failed" },
+	/* 25 */ { "Match variations too complex" },
+	/* 26 */ { "Match failed because of CAM/TCAM full" },
+	/* 27 */ { "Internal creation of a tunnel end point port failed" },
+	/* 28 */ { "Unknown or unsupported flow action received" },
 	/* 29 */ { "Removing flow failed" },
 };
 
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +273 -0

291 lines not on this page · raw message

Signature · 1 line
2.45.0
#104 lore raw

PATCH v2 24/73 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 +
 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 ++++++++++++++++++
 4 files changed, 190 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
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
#105 lore raw

PATCH v2 25/73 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 +
 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 | 278 ++++++++++++-
 7 files changed, 713 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
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 +274 -4

293 lines not on this page · raw message

Signature · 1 line
2.45.0
#106 lore raw

PATCH v2 26/73 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
#107 lore raw

PATCH v2 27/73 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 5176464054..73fab083de 100644
@@ -2277,18 +2277,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;
 }
 
@@ -2450,6 +2470,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);
 
@@ -2498,6 +2521,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
#108 lore raw

PATCH v2 28/73 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 73fab083de..1eab579142 100644
@@ -2473,6 +2473,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);
 
@@ -2530,6 +2543,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
#109 lore raw

PATCH v2 29/73 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
#110 lore raw

PATCH v2 30/73 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.

---
 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 +++
 7 files changed, 2024 insertions(+), 29 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +91 -19
index b1d39b919b..a0f02f4e8a 100644
@@ -52,34 +52,32 @@ enum res_type_e {
  */
 #define MAX_OUTPUT_DEST (128)
 
+#define MAX_WORD_NUM 24
+#define MAX_BANKS 6
+
+#define MAX_TCAM_START_OFFSETS 4
+
 #define MAX_CPY_WRITERS_SUPPORTED 8
 
 #define MAX_MATCH_FIELDS 16
 
 /*
- * Tunnel encapsulation header definition
+ *          128      128     32     32    32
+ * Have  |  QW0  ||  QW4  || SW8 || SW9 | SWX   in FPGA
+ *
+ * Each word may start at any offset, though
+ * they are combined in chronological order, with all enabled to
+ * build the extracted match data, thus that is how the match key
+ * must be build
  */
-#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;
+enum extractor_e {
+	KM_USE_EXTRACTOR_UNDEF,
+	KM_USE_EXTRACTOR_QWORD,
+	KM_USE_EXTRACTOR_SWORD,
 };
 
 struct match_elem_s {
+	enum extractor_e extr;
 	int masked_for_tcam;	/* if potentially selected for TCAM */
 	uint32_t e_word[4];
 	uint32_t e_mask[4];
@@ -89,16 +87,76 @@ struct match_elem_s {
 	uint32_t word_len;
 };
 
+enum cam_tech_use_e {
+	KM_CAM,
+	KM_TCAM,
+	KM_SYNERGY
+};
+
 struct km_flow_def_s {
 	struct flow_api_backend_s *be;
 
+	/* For keeping track of identical entries */
+	struct km_flow_def_s *reference;
+	struct km_flow_def_s *root;
+
 	/* For collect flow elements and sorting */
 	struct match_elem_s match[MAX_MATCH_FIELDS];
+	struct match_elem_s *match_map[MAX_MATCH_FIELDS];
 	int num_ftype_elem;
 
+	/* Finally formatted CAM/TCAM entry */
+	enum cam_tech_use_e target;
+	uint32_t entry_word[MAX_WORD_NUM];
+	uint32_t entry_mask[MAX_WORD_NUM];
+	int key_word_size;
+
+	/* TCAM calculated possible bank start offsets */
+	int start_offsets[MAX_TCAM_START_OFFSETS];
+	int num_start_offsets;
+
 	/* Flow information */
 	/* HW input port ID needed for compare. In port must be identical on flow types */
 	uint32_t port_id;
+	uint32_t info;	/* used for color (actions) */
+	int info_set;
+	int flow_type;	/* 0 is illegal and used as unset */
+	int flushed_to_target;	/* if this km entry has been finally programmed into NIC hw */
+
+	/* CAM specific bank management */
+	int cam_paired;
+	int record_indexes[MAX_BANKS];
+	int bank_used;
+	uint32_t *cuckoo_moves;	/* for CAM statistics only */
+	struct cam_distrib_s *cam_dist;
+
+	/* TCAM specific bank management */
+	struct tcam_distrib_s *tcam_dist;
+	int tcam_start_bank;
+	int tcam_record;
+};
+
+/*
+ * 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;
+
+	uint8_t len;
+
+	uint8_t nb_vlans;
+
+	uint8_t ip_version;	/* 4: v4, 6: v6 */
+
+	uint8_t new_outer;
+	uint8_t l2_len;
+	uint8_t l3_len;
+	uint8_t l4_len;
 };
 
 enum flow_port_type_e {
@@ -247,11 +305,25 @@ struct flow_handle {
 	};
 };
 
+void km_attach_ndev_resource_management(struct km_flow_def_s *km, void **handle);
 void km_free_ndev_resource_management(void **handle);
 
 int km_add_match_elem(struct km_flow_def_s *km, uint32_t e_word[4], uint32_t e_mask[4],
 	uint32_t word_len, enum frame_offs_e start, int8_t offset);
 
+int km_key_create(struct km_flow_def_s *km, uint32_t port_id);
+/*
+ * Compares 2 KM key definitions after first collect validate and optimization.
+ * km is compared against an existing km1.
+ * if identical, km1 flow_type is returned
+ */
+int km_key_compare(struct km_flow_def_s *km, struct km_flow_def_s *km1);
+
+int km_rcp_set(struct km_flow_def_s *km, int index);
+
+int km_write_data_match_entry(struct km_flow_def_s *km, uint32_t color);
+int km_clear_data_match_entry(struct km_flow_def_s *km);
+
 void kcc_free_ndev_resource_management(void **handle);
 
 /*
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
#111 lore raw

PATCH v2 31/73 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.

---
 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  | 850 +++++++++++++++++-
 .../profile_inline/flow_api_profile_inline.h  |   4 +
 drivers/net/ntnic/ntnic_mod_reg.h             |   4 +
 15 files changed, 1706 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
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 +849 -1

913 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
#112 lore raw

PATCH v2 32/73 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
#113 lore raw

PATCH v2 33/73 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          | 129 +++++++++
 drivers/net/ntnic/ntutil/nt_util.h            |   8 +
 8 files changed, 1113 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 +129 -0

129 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
#114 lore raw

PATCH v2 34/73 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
#115 lore raw

PATCH v2 35/73 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
#116 lore raw

PATCH v2 36/73 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
#117 lore raw

PATCH v2 37/73 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 043e4244fc..7f1e311988 100644
@@ -1006,6 +1006,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)
 {
@@ -1031,6 +1047,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 df391b6399..5505198148 100644
@@ -569,9 +569,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
#118 lore raw

PATCH v2 38/73 net/ntnic: add flow flush

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

Implements flow flush API

---
 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 7f1e311988..34f2cad2cd 100644
@@ -253,6 +253,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
  */
@@ -1047,6 +1059,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 5505198148..87b26bd315 100644
@@ -569,6 +569,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,
@@ -600,6 +637,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
#119 lore raw

PATCH v2 39/73 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
#120 lore raw

PATCH v2 40/73 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
#121 lore raw

PATCH v2 41/73 net/ntnic: add MOD CSU

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
#122 lore raw

PATCH v2 42/73 net/ntnic: add MOD FLM

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
#123 lore raw

PATCH v2 43/73 net/ntnic: add HFU module

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
#124 lore raw
In reply to Serhii Iliushyk
Quoted 1 line · On Tue, 22 Oct 2024 18:54:17 +0200 Serhii Iliushyk <[email protected]> wrote:

Disclaimer: This email and any files transmitted with it may contain confidential information intended for the addressee(s) only. The information is not to be surrendered or copied to unauthorized persons. If you have received this communication in error, please notify the sender immediately and delete this e-mail from your system.

Please fix your mail system.
If the DPDK users were to follow this advice as exactly worded by your lawyers, then all these emails would be have to be dropped since we are not authorized by napatech.

#125 lore raw

PATCH v2 44/73 net/ntnic: add IFR module

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
#126 lore raw

PATCH v2 45/73 net/ntnic: add MAC Rx module

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
#127 lore raw

PATCH v2 46/73 net/ntnic: add MAC Tx module

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
#128 lore raw

PATCH v2 47/73 net/ntnic: add RPP LR module

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
#129 lore raw

PATCH v2 48/73 net/ntnic: add MOD SLC LR

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
#130 lore raw

PATCH v2 49/73 net/ntnic: add Tx CPY module

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
#131 lore raw

PATCH v2 50/73 net/ntnic: add Tx INS module

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
#132 lore raw

PATCH v2 51/73 net/ntnic: add Tx RPL module

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
#133 lore raw

PATCH v2 52/73 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
#134 lore raw

PATCH v2 53/73 net/ntnic: enable RSS feature

In reply to Serhii Iliushyk

Enable receive side scaling

---
 doc/guides/nics/features/ntnic.ini            |  3 +
 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              | 77 +++++++++++++++++++
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 73 ++++++++++++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  7 ++
 8 files changed, 212 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
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 34f2cad2cd..d61044402d 100644
@@ -1061,6 +1061,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 +77 -0

95 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
#135 lore raw

PATCH v2 54/73 net/ntnic: add statistics API

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Statistics init, setup, get, reset APIs and their
implementation were 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
#136 lore raw

PATCH v2 55/73 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
#137 lore raw

PATCH v2 56/73 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.

---
 .../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 +
 9 files changed, 721 insertions(+)
drivers/net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c +343 -0
index f733fd5459..3afc5b7853 100644
@@ -16,6 +16,27 @@
 
 #define DEFAULT_MAX_BPS_SPEED 100e9
 
+/* Inline timestamp format s pcap 32:32 bits. Convert to nsecs */
+static inline uint64_t timestamp2ns(uint64_t ts)
+{
+	return ((ts) >> 32) * 1000000000 + ((ts) & 0xffffffff);
+}
+
+static int nt4ga_stat_collect_cap_v1_stats(struct adapter_info_s *p_adapter_info,
+	nt4ga_stat_t *p_nt4ga_stat,
+	uint32_t *p_stat_dma_virtual);
+
+static int nt4ga_stat_collect(struct adapter_info_s *p_adapter_info, nt4ga_stat_t *p_nt4ga_stat)
+{
+	nthw_stat_t *p_nthw_stat = p_nt4ga_stat->mp_nthw_stat;
+
+	p_nt4ga_stat->last_timestamp = timestamp2ns(*p_nthw_stat->mp_timestamp);
+	nt4ga_stat_collect_cap_v1_stats(p_adapter_info, p_nt4ga_stat,
+		p_nt4ga_stat->p_stat_dma_virtual);
+
+	return 0;
+}
+
 static int nt4ga_stat_init(struct adapter_info_s *p_adapter_info)
 {
 	const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str;
@@ -203,9 +224,331 @@ static int nt4ga_stat_setup(struct adapter_info_s *p_adapter_info)
 	return 0;
 }
 
+/* Called with stat mutex locked */
+static int nt4ga_stat_collect_cap_v1_stats(struct adapter_info_s *p_adapter_info,
+	nt4ga_stat_t *p_nt4ga_stat,
+	uint32_t *p_stat_dma_virtual)
+{
+	(void)p_adapter_info;
+	const struct flow_filter_ops *flow_filter_ops = get_flow_filter_ops();
+
+	if (flow_filter_ops == NULL)
+		return -1;
+
+	nthw_stat_t *p_nthw_stat = p_nt4ga_stat->mp_nthw_stat;
+
+	const int n_rx_ports = p_nt4ga_stat->mn_rx_ports;
+	const int n_tx_ports = p_nt4ga_stat->mn_tx_ports;
+	int c, h, p;
+
+	if (!p_nthw_stat || !p_nt4ga_stat)
+		return -1;
+
+	if (p_nthw_stat->mn_stat_layout_version < 6) {
+		NT_LOG(ERR, NTNIC, "HW STA module version not supported");
+		return -1;
+	}
+
+	/* RX ports */
+	for (c = 0; c < p_nthw_stat->m_nb_color_counters / 2; c++) {
+		p_nt4ga_stat->mp_stat_structs_color[c].color_packets += p_stat_dma_virtual[c * 2];
+		p_nt4ga_stat->mp_stat_structs_color[c].color_bytes +=
+			p_stat_dma_virtual[c * 2 + 1];
+	}
+
+	/* Move to Host buffer counters */
+	p_stat_dma_virtual += p_nthw_stat->m_nb_color_counters;
+
+	for (h = 0; h < p_nthw_stat->m_nb_rx_host_buffers; h++) {
+		p_nt4ga_stat->mp_stat_structs_hb[h].flush_packets += p_stat_dma_virtual[h * 8];
+		p_nt4ga_stat->mp_stat_structs_hb[h].drop_packets += p_stat_dma_virtual[h * 8 + 1];
+		p_nt4ga_stat->mp_stat_structs_hb[h].fwd_packets += p_stat_dma_virtual[h * 8 + 2];
+		p_nt4ga_stat->mp_stat_structs_hb[h].dbs_drop_packets +=
+			p_stat_dma_virtual[h * 8 + 3];
+		p_nt4ga_stat->mp_stat_structs_hb[h].flush_bytes += p_stat_dma_virtual[h * 8 + 4];
+		p_nt4ga_stat->mp_stat_structs_hb[h].drop_bytes += p_stat_dma_virtual[h * 8 + 5];
+		p_nt4ga_stat->mp_stat_structs_hb[h].fwd_bytes += p_stat_dma_virtual[h * 8 + 6];
+		p_nt4ga_stat->mp_stat_structs_hb[h].dbs_drop_bytes +=
+			p_stat_dma_virtual[h * 8 + 7];
+	}
+
+	/* Move to Rx Port counters */
+	p_stat_dma_virtual += p_nthw_stat->m_nb_rx_hb_counters;
+
+	/* RX ports */
+	for (p = 0; p < n_rx_ports; p++) {
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 0];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].broadcast_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 1];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].multicast_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 2];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].unicast_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 3];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_alignment +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 4];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_code_violation +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 5];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_crc +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 6];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].undersize_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 7];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].oversize_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 8];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].fragments +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 9];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].jabbers_not_truncated +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 10];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].jabbers_truncated +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 11];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_64_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 12];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_65_to_127_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 13];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_128_to_255_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 14];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_256_to_511_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 15];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_512_to_1023_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 16];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_1024_to_1518_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 17];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_1519_to_2047_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 18];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_2048_to_4095_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 19];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_4096_to_8191_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 20];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_8192_to_max_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 21];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].mac_drop_events +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 22];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_lr +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 23];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].duplicate +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 24];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_ip_chksum_error +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 25];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_udp_chksum_error +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 26];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_tcp_chksum_error +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 27];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_giant_undersize +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 28];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_baby_giant +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 29];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_not_isl_vlan_mpls +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 30];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 31];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_vlan +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 32];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl_vlan +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 33];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_mpls +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 34];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl_mpls +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 35];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_vlan_mpls +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 36];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_isl_vlan_mpls +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 37];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_no_filter +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 38];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_dedup_drop +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 39];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_filter_drop +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 40];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_overflow +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 41];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts_dbs_drop +=
+			p_nthw_stat->m_dbs_present
+			? p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 42]
+			: 0;
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_no_filter +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 43];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_dedup_drop +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 44];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_filter_drop +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 45];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_overflow +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 46];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].octets_dbs_drop +=
+			p_nthw_stat->m_dbs_present
+			? p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 47]
+			: 0;
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_first_hit +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 48];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_first_not_hit +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 49];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_mid_hit +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 50];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_mid_not_hit +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 51];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_last_hit +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 52];
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].ipft_last_not_hit +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 53];
+
+		/* Rx totals */
+		uint64_t new_drop_events_sum =
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 22] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 38] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 39] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 40] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 41] +
+			(p_nthw_stat->m_dbs_present
+				? p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 42]
+				: 0);
+
+		uint64_t new_packets_sum =
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 7] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 8] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 9] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 10] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 11] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 12] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 13] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 14] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 15] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 16] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 17] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 18] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 19] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 20] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 21];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].drop_events += new_drop_events_sum;
+		p_nt4ga_stat->cap.mp_stat_structs_port_rx[p].pkts += new_packets_sum;
+
+		p_nt4ga_stat->a_port_rx_octets_total[p] +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_rx_port_counters + 0];
+		p_nt4ga_stat->a_port_rx_packets_total[p] += new_packets_sum;
+		p_nt4ga_stat->a_port_rx_drops_total[p] += new_drop_events_sum;
+	}
+
+	/* Move to Tx Port counters */
+	p_stat_dma_virtual += n_rx_ports * p_nthw_stat->m_nb_rx_port_counters;
+
+	for (p = 0; p < n_tx_ports; p++) {
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 0];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].broadcast_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 1];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].multicast_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 2];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].unicast_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 3];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_alignment +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 4];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_code_violation +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 5];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_crc +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 6];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].undersize_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 7];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].oversize_pkts +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 8];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].fragments +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 9];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].jabbers_not_truncated +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 10];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].jabbers_truncated +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 11];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_64_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 12];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_65_to_127_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 13];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_128_to_255_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 14];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_256_to_511_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 15];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_512_to_1023_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 16];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_1024_to_1518_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 17];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_1519_to_2047_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 18];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_2048_to_4095_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 19];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_4096_to_8191_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 20];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_8192_to_max_octets +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 21];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].mac_drop_events +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 22];
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts_lr +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 23];
+
+		/* Tx totals */
+		uint64_t new_drop_events_sum =
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 22];
+
+		uint64_t new_packets_sum =
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 7] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 8] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 9] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 10] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 11] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 12] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 13] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 14] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 15] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 16] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 17] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 18] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 19] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 20] +
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 21];
+
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].drop_events += new_drop_events_sum;
+		p_nt4ga_stat->cap.mp_stat_structs_port_tx[p].pkts += new_packets_sum;
+
+		p_nt4ga_stat->a_port_tx_octets_total[p] +=
+			p_stat_dma_virtual[p * p_nthw_stat->m_nb_tx_port_counters + 0];
+		p_nt4ga_stat->a_port_tx_packets_total[p] += new_packets_sum;
+		p_nt4ga_stat->a_port_tx_drops_total[p] += new_drop_events_sum;
+	}
+
+	/* Update and get port load counters */
+	for (p = 0; p < n_rx_ports; p++) {
+		uint32_t val;
+		nthw_stat_get_load_bps_rx(p_nthw_stat, p, &val);
+		p_nt4ga_stat->mp_port_load[p].rx_bps =
+			(uint64_t)(((__uint128_t)val * 32ULL * 64ULL * 8ULL) /
+				PORT_LOAD_WINDOWS_SIZE);
+		nthw_stat_get_load_pps_rx(p_nthw_stat, p, &val);
+		p_nt4ga_stat->mp_port_load[p].rx_pps =
+			(uint64_t)(((__uint128_t)val * 32ULL) / PORT_LOAD_WINDOWS_SIZE);
+	}
+
+	for (p = 0; p < n_tx_ports; p++) {
+		uint32_t val;
+		nthw_stat_get_load_bps_tx(p_nthw_stat, p, &val);
+		p_nt4ga_stat->mp_port_load[p].tx_bps =
+			(uint64_t)(((__uint128_t)val * 32ULL * 64ULL * 8ULL) /
+				PORT_LOAD_WINDOWS_SIZE);
+		nthw_stat_get_load_pps_tx(p_nthw_stat, p, &val);
+		p_nt4ga_stat->mp_port_load[p].tx_pps =
+			(uint64_t)(((__uint128_t)val * 32ULL) / PORT_LOAD_WINDOWS_SIZE);
+	}
+
+	return 0;
+}
+
 static struct nt4ga_stat_ops ops = {
 	.nt4ga_stat_init = nt4ga_stat_init,
 	.nt4ga_stat_setup = nt4ga_stat_setup,
+	.nt4ga_stat_collect = nt4ga_stat_collect
 };
 
 void nt4ga_stat_ops_init(void)
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 d61044402d..aac3144cc0 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
#138 lore raw

PATCH v2 57/73 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 aac3144cc0..e953fc1a12 100644
@@ -1048,6 +1048,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,
@@ -1062,6 +1072,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
#139 lore raw

PATCH v2 58/73 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
#140 lore raw

PATCH v2 59/73 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
#141 lore raw

PATCH v2 60/73 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
#142 lore raw

PATCH v2 61/73 net/ntnic: add xstats

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Extended statistics implementation and
initialization were added.

eth_dev_ops api was extended with new xstats apis.

---
 doc/guides/nics/features/ntnic.ini            |   1 +
 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 ++++++++++++++++++
 7 files changed, 1022 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
 
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
#143 lore raw

PATCH v2 62/73 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.

---
 .../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 +
 13 files changed, 656 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
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 e953fc1a12..efe9a1a3b9 100644
@@ -1050,11 +1050,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
#144 lore raw

PATCH v2 63/73 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 9c286a4f35..263b3ee7d4 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
#145 lore raw

PATCH v2 64/73 net/ntnic: update documentation

In reply to Serhii Iliushyk

From: Oleksandr Kolomeiets <[email protected]>

Update required documentation

---
 doc/guides/nics/ntnic.rst | 30 ++++++++++++++++++++++++++++++
 1 file changed, 30 insertions(+)
doc/guides/nics/ntnic.rst +30 -0
index 2c160ae592..e7e1cbcff7 100644
@@ -40,6 +40,36 @@ Features
 - Unicast MAC filter
 - Multicast MAC filter
 - Promiscuous mode (Enable only. The device always run promiscuous mode)
+- Multiple TX and RX queues.
+- Scattered and gather for TX and RX.
+- 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.
+- VLAN filtering.
+- RX VLAN stripping via raw decap.
+- TX VLAN insertion via raw encap.
+- Flow API.
+- Multiple process.
+- Tunnel types: GTP.
+- Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum
+    verification.
+- Support for multiple rte_flow groups.
+- Encapsulation and decapsulation of GTP data.
+- Packet modification: NAT, TTL decrement, DSCP tagging
+- Traffic mirroring.
+- Jumbo frame support.
+- Port and queue statistics.
+- RMON statistics in extended stats.
+- Flow metering, including meter policy API.
+- Link state information.
+- CAM and TCAM based matching.
+- Exact match of 140 million flows and policies.
+- Basic stats
+- Extended stats
 
 Limitations
 ~~~~~~~~~~~
Signature · 1 line
2.45.0
#146 lore raw

PATCH v2 65/73 net/ntnic: added flow aged APIs

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

FLow aged API was added to the flow_filter_ops.

---
 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             | 23 +++++
 3 files changed, 182 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +71 -0
index efe9a1a3b9..b101a9462e 100644
@@ -1048,6 +1048,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();
@@ -1076,6 +1140,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 +23 -0
index 7325bd1ea8..a199aff61f 100644
@@ -280,6 +280,12 @@ struct profile_inline_ops {
 		uint16_t caller_id,
 		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_dev_dump_profile_inline)(struct flow_eth_dev *dev,
 		struct flow_handle *flow,
 		uint16_t caller_id,
@@ -348,6 +354,23 @@ struct flow_filter_ops {
 		struct rte_flow_error *error);
 
 	int (*flow_get_flm_stats)(struct flow_nic_dev *ndev, uint64_t *data, uint64_t size);
+	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);
+
+	/*
+	 * NT Flow asynchronous operations API
+	 */
+	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);
 
 	/*
 	 * Other
Signature · 1 line
2.45.0
#147 lore raw

PATCH v2 66/73 net/ntnic: add aged API to the inline profile

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Added implementation for flow get aged API.

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
#148 lore raw

PATCH v2 67/73 net/ntnic: add info and configure flow API

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Inline profile was extended with flow info and create APIS.

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

---
v2
* Fix usage of the rte_atomic

---
 drivers/net/ntnic/include/flow_api.h          |  3 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 19 +----
 .../flow_api/profile_inline/flm_age_queue.c   | 79 +++++++++++++++++++
 .../flow_api/profile_inline/flm_age_queue.h   |  5 ++
 .../profile_inline/flow_api_profile_inline.c  | 59 ++++++++++++++
 .../profile_inline/flow_api_profile_inline.h  |  9 +++
 drivers/net/ntnic/ntnic_mod_reg.h             |  9 +++
 7 files changed, 168 insertions(+), 15 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/nthw/flow_api/flow_api.c +4 -15
index b101a9462e..5349dc84ab 100644
@@ -1075,12 +1075,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) {
@@ -1088,20 +1082,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) {
@@ -1109,7 +1097,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 +79 -0

91 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 +59 -0

71 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 a199aff61f..029b0ac4eb 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
#149 lore raw

PATCH v2 68/73 net/ntnic: add aged flow 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.

---
 drivers/net/ntnic/include/hw_mod_backend.h    |   7 +
 .../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   |  75 +++++++++++
 .../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_profile_inline.c  | 121 ++++++++++++++++++
 drivers/net/ntnic/ntnic_ethdev.c              |  16 +++
 10 files changed, 299 insertions(+)
drivers/net/ntnic/include/hw_mod_backend.h +7 -0
index 9cd9d92823..92e1205640 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,6 +698,10 @@ 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);
 
 int hw_mod_flm_scrub_flush(struct flow_api_backend_s *be, int start_idx, int count);
 
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 +75 -0

84 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +28 -0
index cdc7223d51..51126dfded 100644
@@ -15,6 +15,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_flag_clear_explicit(&age_event[port], rte_memory_order_seq_cst);
+}
+
 void flm_age_queue_free(uint8_t port, uint16_t caller_id)
 {
 	struct rte_ring *q = NULL;
@@ -90,6 +105,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_profile_inline.c +121 -0

147 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +16 -0
index 263b3ee7d4..6cac8da17e 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"
 
@@ -1816,6 +1817,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
#150 lore raw

PATCH v2 69/73 net/ntnic: add thread termination

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              | 12 +++
 5 files changed, 100 insertions(+)
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.c +10 -0
index 51126dfded..f4b071ebbb 100644
@@ -46,6 +46,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 +12 -0
index 6cac8da17e..15374d3045 100644
@@ -1416,6 +1416,18 @@ drv_deinit(struct drv_s *p_drv)
 	p_drv->ntdrv.b_shutdown = true;
 	THREAD_JOIN(p_nt_drv->stat_thread);
 
+	if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) {
+		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();
+	}
+
 	if (fpga_info->profile == FPGA_INFO_PROFILE_INLINE) {
 		THREAD_JOIN(p_nt_drv->flm_thread);
 		profile_inline_ops->flm_free_queues();
Signature · 1 line
2.45.0
#151 lore raw

PATCH v2 70/73 net/ntnic: add age documentation

In reply to Serhii Iliushyk

ntnic.rst document was exntede with age feature specification. ntnic.ini was extended with rte_flow action age support.

---
 doc/guides/nics/features/ntnic.ini     |  1 +
 doc/guides/nics/ntnic.rst              | 18 ++++++++++++++++++
 doc/guides/rel_notes/release_24_11.rst | 15 +++++++++------
 3 files changed, 28 insertions(+), 6 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 +18 -0
index e7e1cbcff7..e5a8d71892 100644
@@ -148,3 +148,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 +9 -6
index fa4822d928..5be9660287 100644
@@ -154,12 +154,15 @@ New Features
 
 * **Updated Napatech ntnic net driver [EXPERIMENTAL].**
 
-  * Updated supported version of the FPGA to 9563.55.49.
-  * Extended and fixed logging.
-  * Added NT flow filter initialization.
-  * Added NT flow backend initialization.
-  * Added initialization of FPGA modules related to flow HW offload.
-  * Added basic handling of the virtual queues.
+  * Update supported version of the FPGA to 9563.55.49
+  * Fix Coverity issues
+  * Fix issues related to release 24.07
+  * Extended and fixed the implementation of the logging
+  * Added NT flow filter init API
+  * Added NT flow backend initialization API
+  * Added initialization of FPGA modules related to flow HW offload
+  * Added basic handling of the virtual queues
+  * Added age rte flow action support
 
 * **Added cryptodev queue pair reset support.**
 
Signature · 1 line
2.45.0
#152 lore raw

PATCH v2 71/73 net/ntnic: add meter API

In reply to Serhii Iliushyk

Add meter API and implementation to the profile inline.

management functions were extended with meter flow support.

---
 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  | 534 +++++++++++++++++-
 drivers/net/ntnic/ntnic_mod_reg.h             |  34 ++
 6 files changed, 578 insertions(+), 18 deletions(-)
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 155a9e1fd6..8f1a6419f3 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
@@ -215,6 +216,8 @@ struct nic_flow_def {
 
 	uint32_t jump_to_group;
 
+	uint32_t mtr_ids[MAX_FLM_MTRS_SUPPORTED];
+
 	int full_offload;
 
 	/*
@@ -307,6 +310,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 +516 -18

609 lines not on this page · raw message

drivers/net/ntnic/ntnic_mod_reg.h +34 -0
index 029b0ac4eb..503674f4a4 100644
@@ -303,10 +303,44 @@ struct profile_inline_ops {
 		uint64_t *data,
 		uint64_t size);
 
+	/*
+	 * 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);
+
 	/*
 	 * NT Flow FLM queue API
 	 */
 	void (*flm_setup_queues)(void);
+	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);
+
 	void (*flm_free_queues)(void);
 	uint32_t (*flm_update)(struct flow_eth_dev *dev);
 
Signature · 1 line
2.45.0
#153 lore raw

PATCH v2 72/73 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.

---
 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             |  18 +
 drivers/net/ntnic/ntnic_mod_reg.h             |  11 +
 6 files changed, 538 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c
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 15374d3045..f7503b62ab 100644
@@ -1690,7 +1690,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 = {
+struct eth_dev_ops nthw_eth_dev_ops = {
 	.dev_configure = eth_dev_configure,
 	.dev_start = eth_dev_start,
 	.dev_stop = eth_dev_stop,
@@ -1713,6 +1713,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,
@@ -2176,6 +2177,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 +18 -0
index 6737d18a6f..8d4a11feba 100644
@@ -19,6 +19,24 @@ 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 +11 -0
index 503674f4a4..147d8b2acb 100644
@@ -9,6 +9,8 @@
 #include <stdint.h>
 
 #include "rte_ethdev.h"
+#include "rte_mtr_driver.h"
+
 #include "rte_flow_driver.h"
 
 #include "flow_api.h"
@@ -115,6 +117,15 @@ 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
#154 lore raw

PATCH v2 73/73 net/ntnic: add meter documentation

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

ntnic.ini was extended with rte_flow action meter support.

---
 doc/guides/nics/features/ntnic.ini     | 1 +
 doc/guides/nics/ntnic.rst              | 1 +
 doc/guides/rel_notes/release_24_11.rst | 1 +
 3 files changed, 3 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
index af2981ccf6..ecb0605de6 100644
@@ -43,3 +43,4 @@ queue                = Y
 raw_decap            = Y
 raw_encap            = Y
 rss                  = Y
+meter                = Y
\ No newline at end of file
doc/guides/nics/ntnic.rst +1 -0
index e5a8d71892..4ae94b161c 100644
@@ -70,6 +70,7 @@ Features
 - Exact match of 140 million flows and policies.
 - Basic stats
 - Extended stats
+- Flow metering, including meter policy API.
 
 Limitations
 ~~~~~~~~~~~
doc/guides/rel_notes/release_24_11.rst +1 -0
index 5be9660287..b4a0bdf245 100644
@@ -163,6 +163,7 @@ New Features
   * Added initialization of FPGA modules related to flow HW offload
   * Added basic handling of the virtual queues
   * Added age rte flow action support
+  * Added meter flow metering and flow policy support
 
 * **Added cryptodev queue pair reset support.**
 
Signature · 1 line
2.45.0
#155 lore raw

v3 cover Provide flow filter API and statistics

In reply to Serhii Iliushyk

The list of updates provided by the patchset:
* Multiple TX and RX queues.
* Scattered and gather for TX and RX.
* 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.
* VLAN filtering.
* RX VLAN stripping via raw decap.
* TX VLAN insertion via raw encap.
* Flow API.
* Multiple process.
* Tunnel types: GTP.
* Tunnel HW offload: Packet type, inner/outer RSS, IP and UDP checksum verification.
* Support for multiple rte_flow groups.
* Encapsulation and decapsulation of GTP data.
* Packet modification: NAT, TTL decrement, DSCP tagging
* Traffic mirroring.
* Jumbo frame support.
* Port and queue statistics.
* RMON statistics in extended stats.
* Flow metering, including meter policy API.
* Link state information.
* CAM and TCAM based matching.
* Exact match of 140 million flows and policies.
* Basic stats
* Extended stats
* Flow metering, including meter policy API.

NOTE: Please ignore the disclaimer. We are working on fix it.

Danylo Vodopianov (36):
net/ntnic: add API for configuration NT flow dev net/ntnic: add item UDP
net/ntnic: add action TCP
net/ntnic: add action VLAN
net/ntnic: add item SCTP
net/ntnic: add items IPv6 and ICMPv6 net/ntnic: add action modify filed net/ntnic: add items gtp and actions raw encap/decap net/ntnic: add cat module
net/ntnic: add SLC LR module
net/ntnic: add PDB module
net/ntnic: add QSL module
net/ntnic: add KM module
net/ntnic: add hash API
net/ntnic: add TPE module
net/ntnic: add FLM module
net/ntnic: add flm rcp module
net/ntnic: add learn flow queue handling net/ntnic: match and action db attributes were added net/ntnic: add statistics API
net/ntnic: add rpf module
net/ntnic: add statistics poll
net/ntnic: added flm stat interface net/ntnic: add tsm module
net/ntnic: add xstats
net/ntnic: added flow statistics
net/ntnic: add scrub registers
net/ntnic: add flow aging API
net/ntnic: add aging API to the inline profile net/ntnic: add flow info and flow configure APIs net/ntnic: add flow aging event
net/ntnic: add termination thread net/ntnic: add aging documentation net/ntnic: add meter API
net/ntnic: add meter module
net/ntnic: update meter documentation

Oleksandr Kolomeiets (17):
net/ntnic: add flow dump feature
net/ntnic: add flow flush
net/ntnic: sort FPGA registers alphanumerically
net/ntnic: add MOD CSU
net/ntnic: add MOD FLM
net/ntnic: add HFU module
net/ntnic: add IFR module
net/ntnic: add MAC Rx module
net/ntnic: add MAC Tx module
net/ntnic: add RPP LR module
net/ntnic: add MOD SLC LR
net/ntnic: add Tx CPY module
net/ntnic: add Tx INS module
net/ntnic: add Tx RPL module
net/ntnic: add STA module
net/ntnic: add TSM module
net/ntnic: update documentation

Serhii Iliushyk (20):
net/ntnic: add flow filter API
net/ntnic: add minimal create/destroy flow operations net/ntnic: add internal flow create/destroy API net/ntnic: add minimal NT flow inline profile net/ntnic: add management API for NT flow profile net/ntnic: add NT flow profile management implementation net/ntnic: add create/destroy implementation for NT flows net/ntnic: add infrastructure for for flow actions and items net/ntnic: add action queue
net/ntnic: add action mark
net/ntnic: add ation jump
net/ntnic: add action drop
net/ntnic: add item eth
net/ntnic: add item IPv4
net/ntnic: add item ICMP
net/ntnic: add item port ID
net/ntnic: add item void
net/ntnic: add GMF (Generic MAC Feeder) module net/ntnic: update alignment for virt queue structs net/ntnic: enable RSS feature

 doc/guides/nics/features/ntnic.ini            |   32 +
 doc/guides/nics/ntnic.rst                     |   49 +
 doc/guides/rel_notes/release_24_11.rst        |    4 +
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |   29 +-
 .../net/ntnic/adapter/nt4ga_stat/nt4ga_stat.c |  598 ++
 drivers/net/ntnic/dbsconfig/ntnic_dbsconfig.c |    7 +-
 .../net/ntnic/include/common_adapter_defs.h   |   15 +
 drivers/net/ntnic/include/create_elements.h   |   73 +
 drivers/net/ntnic/include/flow_api.h          |  138 +
 drivers/net/ntnic/include/flow_api_engine.h   |  328 +
 drivers/net/ntnic/include/flow_filter.h       |    1 +
 drivers/net/ntnic/include/hw_mod_backend.h    |  252 +
 drivers/net/ntnic/include/nt4ga_adapter.h     |    2 +
 drivers/net/ntnic/include/ntdrv_4ga.h         |    4 +
 drivers/net/ntnic/include/ntnic_stat.h        |  265 +
 drivers/net/ntnic/include/ntos_drv.h          |   24 +
 .../ntnic/include/stream_binary_flow_api.h    |   67 +
 .../link_mgmt/link_100g/nt4ga_link_100g.c     |    8 +
 drivers/net/ntnic/meson.build                 |   20 +
 .../net/ntnic/nthw/core/include/nthw_core.h   |    1 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |   64 +
 .../net/ntnic/nthw/core/include/nthw_rmc.h    |    6 +
 .../net/ntnic/nthw/core/include/nthw_rpf.h    |   48 +
 .../net/ntnic/nthw/core/include/nthw_tsm.h    |   56 +
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |   47 +
 drivers/net/ntnic/nthw/core/nthw_gmf.c        |  133 +
 drivers/net/ntnic/nthw/core/nthw_rmc.c        |   30 +
 drivers/net/ntnic/nthw/core/nthw_rpf.c        |  119 +
 drivers/net/ntnic/nthw/core/nthw_tsm.c        |  167 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    |  759 +++
 drivers/net/ntnic/nthw/flow_api/flow_group.c  |   99 +
 drivers/net/ntnic/nthw/flow_api/flow_hasher.c |  156 +
 drivers/net/ntnic/nthw/flow_api/flow_hasher.h |   21 +
 .../net/ntnic/nthw/flow_api/flow_id_table.c   |  147 +
 .../net/ntnic/nthw/flow_api/flow_id_table.h   |   26 +
 drivers/net/ntnic/nthw/flow_api/flow_km.c     | 1171 ++++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_cat.c   |  457 ++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_flm.c   |  723 +++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_hsh.c   |  179 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_km.c    |  380 ++
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_pdb.c   |  144 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_qsl.c   |  218 +
 .../nthw/flow_api/hw_mod/hw_mod_slc_lr.c      |  100 +
 .../ntnic/nthw/flow_api/hw_mod/hw_mod_tpe.c   |  757 +++
 .../flow_api/profile_inline/flm_age_queue.c   |  164 +
 .../flow_api/profile_inline/flm_age_queue.h   |   42 +
 .../flow_api/profile_inline/flm_evt_queue.c   |  293 +
 .../flow_api/profile_inline/flm_evt_queue.h   |   55 +
 .../flow_api/profile_inline/flm_lrn_queue.c   |   70 +
 .../flow_api/profile_inline/flm_lrn_queue.h   |   25 +
 .../profile_inline/flow_api_hw_db_inline.c    | 2987 +++++++++
 .../profile_inline/flow_api_hw_db_inline.h    |  392 ++
 .../profile_inline/flow_api_profile_inline.c  | 5361 +++++++++++++++++
 .../profile_inline/flow_api_profile_inline.h  |   76 +
 .../flow_api_profile_inline_config.h          |   77 +
 .../net/ntnic/nthw/model/nthw_fpga_model.c    |   12 +
 .../net/ntnic/nthw/model/nthw_fpga_model.h    |    1 +
 .../net/ntnic/nthw/ntnic_meter/ntnic_meter.c  |  483 ++
 drivers/net/ntnic/nthw/rte_pmd_ntnic.h        |   43 +
 drivers/net/ntnic/nthw/stat/nthw_stat.c       |  498 ++
 .../supported/nthw_fpga_9563_055_049_0000.c   | 3317 ++++++----
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   11 +-
 .../nthw/supported/nthw_fpga_mod_str_map.c    |    2 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |    5 +
 .../supported/nthw_fpga_reg_defs_mac_rx.h     |   29 +
 .../supported/nthw_fpga_reg_defs_mac_tx.h     |   21 +
 .../nthw/supported/nthw_fpga_reg_defs_rpf.h   |   19 +
 .../nthw/supported/nthw_fpga_reg_defs_sta.h   |   48 +
 .../nthw/supported/nthw_fpga_reg_defs_tsm.h   |  205 +
 drivers/net/ntnic/ntnic_ethdev.c              |  744 ++-
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |  940 +++
 drivers/net/ntnic/ntnic_mod_reg.c             |   96 +
 drivers/net/ntnic/ntnic_mod_reg.h             |  225 +
 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c |  829 +++
 drivers/net/ntnic/ntutil/nt_util.h            |   12 +
 75 files changed, 23963 insertions(+), 1043 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/include/create_elements.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gmf.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_rpf.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_tsm.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gmf.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_rpf.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_tsm.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_group.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/flow_hasher.h
 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/flm_age_queue.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_age_queue.h
 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/flow_api/profile_inline/flm_lrn_queue.c
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flm_lrn_queue.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
 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
 create mode 100644 drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h
 create mode 100644 drivers/net/ntnic/nthw/ntnic_meter/ntnic_meter.c
 create mode 100644 drivers/net/ntnic/nthw/rte_pmd_ntnic.h
 create mode 100644 drivers/net/ntnic/nthw/stat/nthw_stat.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_rx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_tx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rpf.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tsm.h
 create mode 100644 drivers/net/ntnic/ntnic_filter/ntnic_filter.c
 create mode 100644 drivers/net/ntnic/ntnic_xstats/ntnic_xstats.c
Signature · 1 line
2.45.0
#156 lore raw

PATCH v3 1/73 net/ntnic: add API for configuration NT flow dev

From: Danylo Vodopianov <[email protected]>

This API allows to enable of flow profile for NT SmartNIC

---
 drivers/net/ntnic/include/flow_api.h          |  30 +++
 drivers/net/ntnic/include/flow_api_engine.h   |   5 +
 drivers/net/ntnic/include/ntos_drv.h          |   1 +
 .../ntnic/include/stream_binary_flow_api.h    |   9 +
 drivers/net/ntnic/nthw/flow_api/flow_api.c    | 221 ++++++++++++++++++
 drivers/net/ntnic/ntnic_ethdev.c              |  22 ++
 drivers/net/ntnic/ntnic_mod_reg.c             |   5 +
 drivers/net/ntnic/ntnic_mod_reg.h             |  14 ++
 8 files changed, 307 insertions(+)
drivers/net/ntnic/include/flow_api.h +30 -0
index 984450afdc..c80906ec50 100644
@@ -34,6 +34,8 @@ struct flow_eth_dev {
 	struct flow_nic_dev *ndev;
 	/* NIC port id */
 	uint8_t port;
+	/* App assigned port_id - may be DPDK port_id */
+	uint32_t port_id;
 
 	/* 0th for exception */
 	struct flow_queue_id_s rx_queue[FLOW_MAX_QUEUES + 1];
@@ -41,6 +43,9 @@ struct flow_eth_dev {
 	/* VSWITCH has exceptions sent on queue 0 per design */
 	int num_queues;
 
+	/* QSL_HSH index if RSS needed QSL v6+ */
+	int rss_target_id;
+
 	struct flow_eth_dev *next;
 };
 
@@ -48,6 +53,8 @@ struct flow_eth_dev {
 struct flow_nic_dev {
 	uint8_t adapter_no;     /* physical adapter no in the host system */
 	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;
 
 	struct hw_mod_resource_s res[RES_COUNT];/* raw NIC resource allocation table */
 	void *km_res_handle;
@@ -73,6 +80,14 @@ struct flow_nic_dev {
 
 extern const char *dbg_res_descr[];
 
+#define flow_nic_set_bit(arr, x)                                                                  \
+	do {                                                                                      \
+		uint8_t *_temp_arr = (arr);                                                       \
+		size_t _temp_x = (x);                                                             \
+		_temp_arr[_temp_x / 8] =                                                          \
+			(uint8_t)(_temp_arr[_temp_x / 8] | (uint8_t)(1 << (_temp_x % 8)));        \
+	} while (0)
+
 #define flow_nic_unset_bit(arr, x)                                                                \
 	do {                                                                                      \
 		size_t _temp_x = (x);                                                             \
@@ -85,6 +100,18 @@ extern const char *dbg_res_descr[];
 		(arr[_temp_x / 8] & (uint8_t)(1 << (_temp_x % 8)));                               \
 	})
 
+#define flow_nic_mark_resource_used(_ndev, res_type, index)                                       \
+	do {                                                                                      \
+		struct flow_nic_dev *_temp_ndev = (_ndev);                                        \
+		typeof(res_type) _temp_res_type = (res_type);                                     \
+		size_t _temp_index = (index);                                                     \
+		NT_LOG(DBG, FILTER, "mark resource used: %s idx %zu",                             \
+		       dbg_res_descr[_temp_res_type], _temp_index);                               \
+		assert(flow_nic_is_bit_set(_temp_ndev->res[_temp_res_type].alloc_bm,              \
+					   _temp_index) == 0);                                    \
+		flow_nic_set_bit(_temp_ndev->res[_temp_res_type].alloc_bm, _temp_index);          \
+	} while (0)
+
 #define flow_nic_mark_resource_unused(_ndev, res_type, index)                                     \
 	do {                                                                                      \
 		typeof(res_type) _temp_res_type = (res_type);                                 \
@@ -97,6 +124,9 @@ extern const char *dbg_res_descr[];
 #define flow_nic_is_resource_used(_ndev, res_type, index)                                         \
 	(!!flow_nic_is_bit_set((_ndev)->res[res_type].alloc_bm, index))
 
+int flow_nic_alloc_resource(struct flow_nic_dev *ndev, enum res_type_e res_type,
+	uint32_t alignment);
+
 void flow_nic_free_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int idx);
 
 int flow_nic_deref_resource(struct flow_nic_dev *ndev, enum res_type_e res_type, int index);
drivers/net/ntnic/include/flow_api_engine.h +5 -0
index db5e6fe09d..d025677e25 100644
@@ -41,6 +41,11 @@ enum res_type_e {
 	RES_INVALID
 };
 
+/*
+ * Flow NIC offload management
+ */
+#define MAX_OUTPUT_DEST (128)
+
 void km_free_ndev_resource_management(void **handle);
 
 void kcc_free_ndev_resource_management(void **handle);
drivers/net/ntnic/include/ntos_drv.h +1 -0
index d51d1e3677..8fd577dfe3 100644
@@ -86,6 +86,7 @@ struct __rte_cache_aligned ntnic_tx_queue {
 
 struct pmd_internals {
 	const struct rte_pci_device *pci_dev;
+	struct flow_eth_dev *flw_dev;
 	char name[20];
 	int n_intf_no;
 	int lpbk_mode;
drivers/net/ntnic/include/stream_binary_flow_api.h +9 -0
index 10529b8843..47e5353344 100644
@@ -12,11 +12,20 @@
 
 #define FLOW_MAX_QUEUES 128
 
+/*
+ * Flow eth dev profile determines how the FPGA module resources are
+ * managed and what features are available
+ */
+enum flow_eth_dev_profile {
+	FLOW_ETH_DEV_PROFILE_INLINE = 0,
+};
+
 struct flow_queue_id_s {
 	int id;
 	int hw_id;
 };
 
 struct flow_eth_dev;             /* port device */
+struct flow_handle;
 
 #endif  /* _STREAM_BINARY_FLOW_API_H_ */
drivers/net/ntnic/nthw/flow_api/flow_api.c +221 -0

255 lines not on this page · raw message

drivers/net/ntnic/ntnic_ethdev.c +22 -0
index bff893ec7a..510c0e5d23 100644
@@ -1355,6 +1355,13 @@ static const struct eth_dev_ops nthw_eth_dev_ops = {
 static int
 nthw_pci_dev_init(struct rte_pci_device *pci_dev)
 {
+	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 statement is not necessary here to allow traffic processing by SW  */
+	}
+
 	nt_vfio_init();
 	const struct port_ops *port_ops = get_port_ops();
 
@@ -1378,10 +1385,13 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)
 	uint32_t n_port_mask = -1;	/* All ports enabled by default */
 	uint32_t nb_rx_queues = 1;
 	uint32_t nb_tx_queues = 1;
+	uint32_t exception_path = 0;
 	struct flow_queue_id_s queue_ids[MAX_QUEUES];
 	int n_phy_ports;
 	struct port_link_speed pls_mbps[NUM_ADAPTER_PORTS_MAX] = { 0 };
 	int num_port_speeds = 0;
+	enum flow_eth_dev_profile profile = FLOW_ETH_DEV_PROFILE_INLINE;
+
 	NT_LOG_DBGX(DBG, NTNIC, "Dev %s PF #%i Init : %02x:%02x:%i", pci_dev->name,
 		pci_dev->addr.function, pci_dev->addr.bus, pci_dev->addr.devid,
 		pci_dev->addr.function);
@@ -1681,6 +1691,18 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)
 			return -1;
 		}
 
+		if (flow_filter_ops != NULL) {
+			internals->flw_dev = flow_filter_ops->flow_get_eth_dev(0, n_intf_no,
+				eth_dev->data->port_id, nb_rx_queues, queue_ids,
+				&internals->txq_scg[0].rss_target_id, profile, exception_path);
+
+			if (!internals->flw_dev) {
+				NT_LOG(ERR, NTNIC,
+					"Error creating port. Resource exhaustion in HW");
+				return -1;
+			}
+		}
+
 		/* connect structs */
 		internals->p_drv = p_drv;
 		eth_dev->data->dev_private = internals;
drivers/net/ntnic/ntnic_mod_reg.c +5 -0
index a03c97801b..ac8afdef6a 100644
@@ -118,6 +118,11 @@ const struct flow_backend_ops *get_flow_backend_ops(void)
 	return flow_backend_ops;
 }
 
+const struct profile_inline_ops *get_profile_inline_ops(void)
+{
+	return NULL;
+}
+
 static const struct flow_filter_ops *flow_filter_ops;
 
 void register_flow_filter_ops(const struct flow_filter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +14 -0
index 5b97b3d8ac..017d15d7bc 100644
@@ -8,6 +8,7 @@
 
 #include <stdint.h>
 #include "flow_api.h"
+#include "stream_binary_flow_api.h"
 #include "nthw_fpga_model.h"
 #include "nthw_platform_drv.h"
 #include "nthw_drv.h"
@@ -223,10 +224,23 @@ 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);
 
+const struct profile_inline_ops *get_profile_inline_ops(void);
+
 struct flow_filter_ops {
 	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);
+	/*
+	 * Device Management API
+	 */
+	struct flow_eth_dev *(*flow_get_eth_dev)(uint8_t adapter_no,
+		uint8_t hw_port_no,
+		uint32_t port_id,
+		int alloc_rx_queues,
+		struct flow_queue_id_s queue_ids[],
+		int *rss_target_id,
+		enum flow_eth_dev_profile flow_profile,
+		uint32_t exception_path);
 };
 
 void register_flow_filter_ops(const struct flow_filter_ops *ops);
Signature · 1 line
2.45.0
#157 lore raw

PATCH v3 2/73 net/ntnic: add flow filter API

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
#158 lore raw

PATCH v3 3/73 net/ntnic: add minimal create/destroy flow operations

In reply to Serhii Iliushyk

Add high level API with describes base 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
#159 lore raw

PATCH v3 4/73 net/ntnic: add internal flow create/destroy API

In reply to Serhii Iliushyk

NT-specific flow filter API 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 f49aca79c1..d779dc481f 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
@@ -604,6 +638,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
#160 lore raw

PATCH v3 5/73 net/ntnic: add minimal NT flow inline profile

In reply to Serhii Iliushyk

The flow profile implements a 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 d779dc481f..d0dad8e8f8 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
#161 lore raw

PATCH v3 6/73 net/ntnic: add management API for NT flow profile

In reply to Serhii Iliushyk

Management API implements (re)setting of the NT flow dev

---
 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    | 60 +++++++++++++++++++
 .../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, 102 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 +60 -0

94 lines not on this page · raw message

drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +20 -0
index a6293f5f82..c9e4008b7e 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)
+{
+	return -1;
+}
+
+int done_flow_management_of_ndev_profile_inline(struct flow_nic_dev *ndev)
+{
+	return 0;
+}
+
 struct flow_handle *flow_create_profile_inline(struct flow_eth_dev *dev,
 	const struct rte_flow_attr *attr,
 	uint16_t forced_vlan_vid,
@@ -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
#162 lore raw

PATCH v3 7/73 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  | 52 ++++++++++++++++
 9 files changed, 278 insertions(+)
 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 +52 -0

69 lines not on this page · raw message

Signature · 1 line
2.45.0
#163 lore raw

PATCH v3 8/73 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 +
 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 ++++++++++++++++++
 13 files changed, 1103 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
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
#164 lore raw

PATCH v3 9/73 net/ntnic: add infrastructure for for flow actions and items

In reply to Serhii Iliushyk

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

---
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    | 33 ++++++++
 drivers/net/ntnic/nthw/flow_api/flow_km.c     | 81 +++++++++++++++++++
 .../profile_inline/flow_api_profile_inline.c  | 68 +++++++++++++++-
 5 files changed, 258 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 +33 -0
index 34154c65f8..99b207a01c 100644
@@ -133,6 +133,39 @@ enum km_flm_if_select_e {
 	unsigned int alloced_size;                                                                \
 	int debug
 
+enum {
+	PROT_OTHER = 0,
+	PROT_L2_ETH2 = 1,
+};
+
+enum {
+	PROT_L3_IPV4 = 1,
+};
+
+enum {
+	PROT_L4_ICMP = 4
+};
+
+enum {
+	PROT_TUN_L3_OTHER = 0,
+	PROT_TUN_L3_IPV4 = 1,
+};
+
+enum {
+	PROT_TUN_L4_OTHER = 0,
+	PROT_TUN_L4_ICMP = 4
+};
+
+
+enum {
+	CPY_SELECT_DSCP_IPV4 = 0,
+	CPY_SELECT_DSCP_IPV6 = 1,
+	CPY_SELECT_RQI_QFI = 2,
+	CPY_SELECT_IPV4 = 3,
+	CPY_SELECT_PORT = 4,
+	CPY_SELECT_TEID = 5,
+};
+
 struct common_func_s {
 	COMMON_FUNC_INFO_S;
 };
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
#165 lore raw

PATCH v3 10/73 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 +
 .../profile_inline/flow_api_profile_inline.c  | 37 +++++++++++++++++++
 2 files changed, 38 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
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +37 -0
index 0f136ee164..a3fe2fe902 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
#166 lore raw

PATCH v3 11/73 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 a3fe2fe902..96b7192edc 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
#167 lore raw

PATCH v3 12/73 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 96b7192edc..603039374a 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
#168 lore raw

PATCH v3 13/73 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 603039374a..64168fcc7d 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
#169 lore raw

PATCH v3 14/73 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    |  23 +++
 .../profile_inline/flow_api_profile_inline.c  | 180 ++++++++++++++++++
 3 files changed, 204 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 +23 -0
index 99b207a01c..0c22129fb4 100644
@@ -120,6 +120,29 @@ 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,
+	DYN_L4 = 7,
+	DYN_L4_PAYLOAD = 8,
+	DYN_TUN_L3 = 13,
+	DYN_TUN_L4 = 16,
+};
+
+/* Sideband info bit indicator */
+
 enum km_flm_if_select_e {
 	KM_FLM_IF_FIRST = 0,
 	KM_FLM_IF_SECOND = 1
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +180 -0

204 lines not on this page · raw message

Signature · 1 line
2.45.0