Skip to contentSkip to conversation

add new adapter NT400D13

PATCH In review Serhii Iliushyk 3 participants 40 messages Feb 20, 2025 – Apr 11, 2025

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

cover add new adapter NT400D13

This patchset adds support for the new adapter NT400D13.

Danylo Vodopianov (23):
net/ntnic: add link agx 100g
net/ntnic: add link state machine
net/ntnic: add rpf and gfg init
net/ntnic: add agx setup for port
net/ntnic: add host loopback init
net/ntnic: add line loopback init
net/ntnic: add 100 gbps port init
net/ntnic: add port post init
net/ntnic: add nim low power API
net/ntnic: add link handling API
net/ntnic: add port init to the state machine
net/ntnic: add port disable API
net/ntnic: add nt400d13 pcm init
net/ntnic: add HIF clock test
net/ntnic: add nt400d13 PRM module init
net/ntnic: add nt400d13 PRM module reset
net/ntnic: add SPI v3 support for FPGA
net/ntnic: add i2cm init
net/ntnic: add pca init
net/ntnic: add pcal init
net/ntnic: add reset PHY init
net/ntnic: add igam module init
net/ntnic: init IGAM and config PLL for FPGA

Serhii Iliushyk (9):
net/ntnic: add minimal initialization new NIC NT400D13 net/ntnic: add minimal reset FPGA
net/ntnic: add FPGA modules and registers net/ntnic: add setup for fpga reset net/ntnic: add default reset setting for NT400D13 net/ntnic: add DDR calibration to reset stage net/ntnic: add PHY ftile reset
net/ntnic: add clock init
net/ntnic: revert untrusted loop bound

 doc/guides/nics/ntnic.rst                     |    7 +-
 doc/guides/rel_notes/release_25_03.rst        |    4 +
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |    9 +
 drivers/net/ntnic/include/nt4ga_link.h        |    7 +
 drivers/net/ntnic/include/nthw_gfg.h          |   33 +
 drivers/net/ntnic/include/ntnic_nim.h         |    5 +
 .../include/ntnic_nthw_fpga_rst_nt400dxx.h    |   34 +
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 1029 ++++++
 drivers/net/ntnic/meson.build                 |   16 +
 drivers/net/ntnic/nim/i2c_nim.c               |  158 +-
 drivers/net/ntnic/nim/i2c_nim.h               |    6 +
 ...00D13_U62_Si5332-GM2-RevD-1_V5-Registers.h |  425 +++
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |   10 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |    2 +
 .../net/ntnic/nthw/core/include/nthw_hif.h    |    4 +
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |    3 +
 .../net/ntnic/nthw/core/include/nthw_igam.h   |   40 +
 .../ntnic/nthw/core/include/nthw_pca9532.h    |   25 +
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |   33 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     |   40 +
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  156 +
 .../nthw/core/include/nthw_prm_nt400dxx.h     |   32 +
 .../nthw/core/include/nthw_si5332_si5156.h    |   63 +
 .../net/ntnic/nthw/core/include/nthw_spi_v3.h |  107 +
 .../net/ntnic/nthw/core/include/nthw_spim.h   |   58 +
 .../net/ntnic/nthw/core/include/nthw_spis.h   |   63 +
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   |  220 ++
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   |  377 ++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  427 +++
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  464 +++
 drivers/net/ntnic/nthw/core/nthw_gfg.c        |  340 ++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        |   41 +
 drivers/net/ntnic/nthw/core/nthw_hif.c        |   92 +
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       |  139 +
 drivers/net/ntnic/nthw/core/nthw_igam.c       |   93 +
 drivers/net/ntnic/nthw/core/nthw_pca9532.c    |   60 +
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  |  103 +
 .../net/ntnic/nthw/core/nthw_pcm_nt400dxx.c   |   80 +
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 1242 +++++++
 .../net/ntnic/nthw/core/nthw_prm_nt400dxx.c   |   55 +
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  |  142 +
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     |  358 ++
 drivers/net/ntnic/nthw/core/nthw_spim.c       |  113 +
 drivers/net/ntnic/nthw/core/nthw_spis.c       |  121 +
 drivers/net/ntnic/nthw/nthw_drv.h             |   31 +
 drivers/net/ntnic/nthw/nthw_platform.c        |    3 +
 drivers/net/ntnic/nthw/nthw_platform_drv.h    |    2 +
 .../supported/nthw_fpga_9574_055_049_0000.c   | 3124 +++++++++++++++++
 .../nthw/supported/nthw_fpga_instances.c      |    5 +-
 .../nthw/supported/nthw_fpga_instances.h      |    1 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   11 +
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   11 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   11 +
 .../nthw/supported/nthw_fpga_reg_defs_igam.h  |   32 +
 .../supported/nthw_fpga_reg_defs_pci_ta.h     |   33 +
 .../nthw_fpga_reg_defs_pcm_nt400dxx.h         |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_pdi.h   |   49 +
 .../supported/nthw_fpga_reg_defs_phy_tile.h   |  213 ++
 .../nthw_fpga_reg_defs_prm_nt400dxx.h         |   26 +
 .../nthw/supported/nthw_fpga_reg_defs_rfd.h   |   38 +
 .../supported/nthw_fpga_reg_defs_rst9574.h    |   35 +
 .../nthw/supported/nthw_fpga_reg_defs_spim.h  |   76 +
 .../nthw/supported/nthw_fpga_reg_defs_spis.h  |   51 +
 .../nthw/supported/nthw_fpga_reg_defs_tint.h  |   28 +
 drivers/net/ntnic/ntnic_ethdev.c              |    1 +
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |    2 +-
 drivers/net/ntnic/ntnic_mod_reg.c             |   47 +
 drivers/net/ntnic/ntnic_mod_reg.h             |   25 +
 68 files changed, 10709 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/ntnic/include/nthw_gfg.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt400dxx.h
 create mode 100644 drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c
 create mode 100644 drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_igam.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pca9532.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spim.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spis.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_igam.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pca9532.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_phy_tile.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9574_055_049_0000.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9574.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h
Signature · 1 line
2.45.0
#1 lore raw

PATCH 1/32 net/ntnic: add link agx 100g

From: Danylo Vodopianov <[email protected]>

Minimal implementation for link agx 100g was added. Add support for NT400D13 (Intel Agilex FPGA) link operations.

---
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |  9 ++++
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 42 +++++++++++++++++++
 drivers/net/ntnic/meson.build                 |  1 +
 drivers/net/ntnic/ntnic_mod_reg.c             | 17 ++++++++
 drivers/net/ntnic/ntnic_mod_reg.h             |  4 ++
 5 files changed, 73 insertions(+)
 create mode 100644 drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c
drivers/net/ntnic/adapter/nt4ga_adapter.c +9 -0
index fa72dfda8d..fe9d397293 100644
@@ -196,6 +196,15 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)
 
 			res = link_ops->link_init(p_adapter_info, p_fpga);
 			break;
+		case 9574: /* NT400D13 (Intel Agilex FPGA) */
+			link_ops = get_agx_100g_link_ops();
+			if (link_ops == NULL) {
+				NT_LOG(ERR, NTNIC, "NT400D11 100G link module uninitialized");
+				res = -1;
+				break;
+			}
+			res = link_ops->link_init(p_adapter_info, p_fpga);
+			break;
 
 		default:
 			NT_LOG(ERR, NTNIC, "Unsupported FPGA product: %04d",
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c new file +42 -0

42 lines not on this page · raw message

drivers/net/ntnic/meson.build +1 -0
index 8ae6817dea..7e4f47b1e6 100644
@@ -32,6 +32,7 @@ sources = files(
         'adapter/nt4ga_stat/nt4ga_stat.c',
         'dbsconfig/ntnic_dbsconfig.c',
         'link_mgmt/link_100g/nt4ga_link_100g.c',
+        'link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c',
         'link_mgmt/nt4ga_link.c',
         'nim/i2c_nim.c',
         'ntnic_filter/ntnic_filter.c',
drivers/net/ntnic/ntnic_mod_reg.c +17 -0
index 658fac72c0..598df08fb7 100644
@@ -69,6 +69,23 @@ const struct link_ops_s *get_100g_link_ops(void)
 	return link_100g_ops;
 }
 
+/*
+ *
+ */
+static struct link_ops_s *link_agx_100g_ops;
+
+void register_agx_100g_link_ops(struct link_ops_s *ops)
+{
+	link_agx_100g_ops = ops;
+}
+
+const struct link_ops_s *get_agx_100g_link_ops(void)
+{
+	if (link_agx_100g_ops == NULL)
+		link_agx_100g_init();
+	return link_agx_100g_ops;
+}
+
 static const struct port_ops *port_ops;
 
 void register_port_ops(const struct port_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +4 -0
index bddae823c8..3e84beaa62 100644
@@ -144,6 +144,10 @@ void register_100g_link_ops(struct link_ops_s *ops);
 const struct link_ops_s *get_100g_link_ops(void);
 void link_100g_init(void);
 
+void register_agx_100g_link_ops(struct link_ops_s *ops);
+const struct link_ops_s *get_agx_100g_link_ops(void);
+void link_agx_100g_init(void);
+
 struct port_ops {
 	bool (*get_nim_present)(struct adapter_info_s *p, int port);
 
Signature · 1 line
2.45.0
#2 lore raw

PATCH 2/32 net/ntnic: add link state machine

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Minimal 100g agx link state machine implementation was added.

---
 drivers/net/ntnic/include/nt4ga_link.h        |   5 +
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 111 ++++++++++++++++++
 2 files changed, 116 insertions(+)
drivers/net/ntnic/include/nt4ga_link.h +5 -0
index 8366484830..af7ea4a9f2 100644
@@ -82,9 +82,14 @@ typedef struct adapter_100g_s {
 	nthw_gpio_phy_t gpio_phy[NUM_ADAPTER_PORTS_MAX];
 } adapter_100g_t;
 
+typedef struct adapter_agx_100g_s {
+	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* should be the first field */
+} adapter_agx_100g_t;
+
 typedef union adapter_var_s {
 	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* First field in all the adapters type */
 	adapter_100g_t var100g;
+	adapter_agx_100g_t var_a100g;
 } adapter_var_u;
 
 typedef struct nt4ga_link_s {
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +111 -0

126 lines not on this page · raw message

Signature · 1 line
2.45.0
#3 lore raw

PATCH 3/32 net/ntnic: add rpf and gfg init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

RPF and GFG modules initialization were added.

---
 drivers/net/ntnic/include/nt4ga_link.h        |   2 +
 drivers/net/ntnic/include/nthw_gfg.h          |  33 ++
 .../link_agx_100g/nt4ga_agx_link_100g.c       |  24 ++
 drivers/net/ntnic/meson.build                 |   1 +
 drivers/net/ntnic/nthw/core/nthw_gfg.c        | 340 ++++++++++++++++++
 drivers/net/ntnic/nthw/nthw_drv.h             |  10 +
 6 files changed, 410 insertions(+)
 create mode 100644 drivers/net/ntnic/include/nthw_gfg.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
drivers/net/ntnic/include/nt4ga_link.h +2 -0
index af7ea4a9f2..e3dc3d4d5d 100644
@@ -8,6 +8,7 @@
 
 #include "ntos_drv.h"
 #include "ntnic_nim.h"
+#include "nthw_gfg.h"
 
 enum nt_link_state_e {
 	NT_LINK_STATE_UNKNOWN = 0,	/* The link state has not been read yet */
@@ -84,6 +85,7 @@ typedef struct adapter_100g_s {
 
 typedef struct adapter_agx_100g_s {
 	nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX];	/* should be the first field */
+	nthw_gfg_t gfg[NUM_ADAPTER_PORTS_MAX];
 } adapter_agx_100g_t;
 
 typedef union adapter_var_s {
drivers/net/ntnic/include/nthw_gfg.h new file +33 -0
new file mode 100644
index 0000000000..4583fd9ebd
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTHW_GFG_H_
+#define NTHW_GFG_H_
+
+#include "nthw_fpga_model.h"
+struct nthw_gfg {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_gfg;
+	int mn_instance;
+
+	int mn_param_gfg_present;
+
+	nthw_field_t *mpa_fld_ctrl_enable[8];
+	nthw_field_t *mpa_fld_ctrl_mode[8];
+	nthw_field_t *mpa_fld_ctrl_prbs_en[8];
+	nthw_field_t *mpa_fld_ctrl_size[8];
+	nthw_field_t *mpa_fld_stream_id_val[8];
+	nthw_field_t *mpa_fld_run_run[8];
+	nthw_field_t *mpa_fld_size_mask[8];
+	nthw_field_t *mpa_fld_burst_size_val[8];
+};
+
+typedef struct nthw_gfg nthw_gfg_t;
+
+int nthw_gfg_init(nthw_gfg_t *p, nthw_fpga_t *p_fpga, int n_instance);
+
+int nthw_gfg_stop(nthw_gfg_t *p, const int n_intf_no);
+
+#endif	/* NTHW_GFG_H_ */
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +24 -0
index 369b9b601f..9db32443fc 100644
@@ -11,6 +11,7 @@
 #include <string.h>
 #include "ntnic_mod_reg.h"
 #include "nim_defines.h"
+#include "nthw_gfg.h"
 
 static int nt4ga_agx_link_100g_ports_init(struct adapter_info_s *p_adapter_info,
 	nthw_fpga_t *fpga);
@@ -134,11 +135,34 @@ static uint32_t nt4ga_agx_link_100g_mon(void *data)
 int nt4ga_agx_link_100g_ports_init(struct adapter_info_s *p_adapter_info, nthw_fpga_t *fpga)
 {
 	(void)fpga;
+	nt4ga_link_t *nt4ga_link = &p_adapter_info->nt4ga_link;
 	const int adapter_no = p_adapter_info->adapter_no;
 	int res = 0;
 
 	NT_LOG(DBG, NTNIC, "%s: Initializing ports", p_adapter_info->mp_adapter_id_str);
 
+	if (!nt4ga_link->variables_initialized) {
+		nthw_gfg_t *gfg_mod = p_adapter_info->nt4ga_link.u.var_a100g.gfg;
+		nthw_agx_t *p_nthw_agx = &p_adapter_info->fpga_info.mp_nthw_agx;
+
+		p_nthw_agx->p_rpf = nthw_rpf_new();
+		res = nthw_rpf_init(p_nthw_agx->p_rpf, fpga, adapter_no);
+
+		if (res != 0) {
+			NT_LOG(ERR, NTNIC, "%s: Failed to initialize RPF module (%u)",
+				p_adapter_info->mp_adapter_id_str, res);
+			return res;
+		}
+
+		res = nthw_gfg_init(&gfg_mod[adapter_no], fpga, 0 /* Only one instance */);
+
+		if (res != 0) {
+			NT_LOG(ERR, NTNIC, "%s: Failed to initialize GFG module (%u)",
+				p_adapter_info->mp_adapter_id_str, res);
+			return res;
+		}
+	}
+
 	/*
 	 * Create state-machine thread
 	 */
drivers/net/ntnic/meson.build +1 -0
index 7e4f47b1e6..68d7fdafd4 100644
@@ -47,6 +47,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_gfg.c',
         'nthw/core/nthw_tsm.c',
         'nthw/core/nthw_gpio_phy.c',
         'nthw/core/nthw_hif.c',
drivers/net/ntnic/nthw/core/nthw_gfg.c new file +340 -0

340 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +10 -0
index 69e0360f5f..9dc839c83c 100644
@@ -9,6 +9,15 @@
 #include "nthw_core.h"
 #include "ntnic_dbs.h"
 
+#include "nthw_rpf.h"
+
+/*
+ * Structs for controlling Agilex based NT400DXX adapter
+ */
+typedef struct nthw_agx_s {
+	nthw_rpf_t *p_rpf;
+} nthw_agx_t;
+
 typedef enum nt_meta_port_type_e {
 	PORT_TYPE_PHYSICAL,
 	PORT_TYPE_VIRTUAL,
@@ -88,6 +97,7 @@ typedef struct fpga_info_s {
 
 	nthw_adapter_id_t n_nthw_adapter_id;
 
+	nthw_agx_t mp_nthw_agx;	/* For the Agilex based NT400DXX */
 } fpga_info_t;
 
 
Signature · 1 line
2.45.0
#4 lore raw

PATCH 4/32 net/ntnic: add agx setup for port

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Initialize NIM and PHY settings for Agilex FPGA ports

---
 drivers/net/ntnic/include/ntnic_nim.h         |   5 +
 .../link_agx_100g/nt4ga_agx_link_100g.c       |  86 ++++++++-
 drivers/net/ntnic/meson.build                 |   1 +
 drivers/net/ntnic/nim/i2c_nim.c               |   8 +
 drivers/net/ntnic/nim/i2c_nim.h               |   3 +
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |  19 ++
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  62 +++++++
 .../nthw/core/include/nthw_si5332_si5156.h    |  18 ++
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 173 ++++++++++++++++++
 drivers/net/ntnic/nthw/nthw_drv.h             |   8 +
 10 files changed, 382 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_phy_tile.c
drivers/net/ntnic/include/ntnic_nim.h +5 -0
index 58daa8435f..3e97a9a8b2 100644
@@ -7,9 +7,12 @@
 #define _NTNIC_NIM_H_
 
 #include <stdint.h>
+#include "nthw_pcal6416a.h"
+#include "nthw_i2cm.h"
 
 typedef enum i2c_type {
 	I2C_HWIIC,
+	I2C_HWAGX
 } i2c_type_e;
 
 enum nt_port_type_e {
@@ -38,7 +41,9 @@ typedef struct nim_i2c_ctx {
 	union {
 		nthw_iic_t hwiic;	/* depends on *Fpga_t, instance number, and cycle time */
 		struct {
+			nthw_pcal6416a_t *p_io_nim;
 			nthw_i2cm_t *p_nt_i2cm;
+			nthw_pca9849_t *p_ca9849;
 			int mux_channel;
 		} hwagx;
 	};
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +85 -1

118 lines not on this page · raw message

drivers/net/ntnic/meson.build +1 -0
index 68d7fdafd4..4799ebfb8e 100644
@@ -55,6 +55,7 @@ sources = files(
         'nthw/core/nthw_iic.c',
         'nthw/core/nthw_mac_pcs.c',
         'nthw/core/nthw_pcie3.c',
+        'nthw/core/nthw_phy_tile.c',
         'nthw/core/nthw_rpf.c',
         'nthw/core/nthw_rmc.c',
         'nthw/core/nthw_sdc.c',
drivers/net/ntnic/nim/i2c_nim.c +8 -0
index e6f7755ded..7dbbdb8873 100644
@@ -795,3 +795,11 @@ int construct_and_preinit_nim(nim_i2c_ctx_p ctx, void *extra)
 
 	return res;
 }
+
+void nim_agx_setup(struct nim_i2c_ctx *ctx, nthw_pcal6416a_t *p_io_nim, nthw_i2cm_t *p_nt_i2cm,
+	nthw_pca9849_t *p_ca9849)
+{
+	ctx->hwagx.p_nt_i2cm = p_nt_i2cm;
+	ctx->hwagx.p_ca9849 = p_ca9849;
+	ctx->hwagx.p_io_nim = p_io_nim;
+}
drivers/net/ntnic/nim/i2c_nim.h +3 -0
index edb6dcf1b6..09837448c6 100644
@@ -33,4 +33,7 @@ int nim_qsfp_plus_nim_set_tx_laser_disable(nim_i2c_ctx_t *ctx, bool disable, int
  */
 int construct_and_preinit_nim(nim_i2c_ctx_p ctx, void *extra);
 
+void nim_agx_setup(struct nim_i2c_ctx *ctx, nthw_pcal6416a_t *p_io_nim, nthw_i2cm_t *p_nt_i2cm,
+	nthw_pca9849_t *p_ca9849);
+
 #endif	/* I2C_NIM_H_ */
drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h new file +19 -0
new file mode 100644
index 0000000000..636d2beb85
@@ -0,0 +1,19 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+#ifndef __NTHW_PCAL6416A_H__
+#define __NTHW_PCAL6416A_H__
+
+#include <stdint.h>
+
+/*
+ * PCAL6416A I/O expander class
+ */
+
+struct nthw_pcal6416a {
+};
+
+typedef struct nthw_pcal6416a nthw_pcal6416a_t;
+
+#endif	/* __NTHW_PCAL6416A_H__ */
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h new file +62 -0

62 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h new file +18 -0
new file mode 100644
index 0000000000..fb44c62f12
@@ -0,0 +1,18 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_SI5332_SI5156_H__
+#define __NTHW_SI5332_SI5156_H__
+
+/*
+ * PCA9849 I2c mux class
+ */
+
+struct nthw_pca9849 {
+};
+
+typedef struct nthw_pca9849 nthw_pca9849_t;
+
+#endif	/* __NTHW_SI5332_SI5156_H__ */
drivers/net/ntnic/nthw/core/nthw_phy_tile.c new file +173 -0

173 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +8 -0
index 9dc839c83c..1fc8df52ce 100644
@@ -9,12 +9,20 @@
 #include "nthw_core.h"
 #include "ntnic_dbs.h"
 
+#include "nthw_si5332_si5156.h"
+#include "nthw_pcal6416a.h"
+#include "nthw_phy_tile.h"
 #include "nthw_rpf.h"
+#include "nthw_phy_tile.h"
 
 /*
  * Structs for controlling Agilex based NT400DXX adapter
  */
 typedef struct nthw_agx_s {
+	nthw_i2cm_t *p_i2cm;
+	nthw_pca9849_t *p_pca9849;
+	nthw_pcal6416a_t *p_io_nim;	/* PCAL6416A I/O expander for controlling TS */
+	nthw_phy_tile_t *p_phy_tile;
 	nthw_rpf_t *p_rpf;
 } nthw_agx_t;
 
Signature · 1 line
2.45.0
#5 lore raw

PATCH 5/32 net/ntnic: add host loopback init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Implement PHY line loopback configuration for Agilex FPGA

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 111 ++++++++++++++++++
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |   1 +
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   |  28 +++++
 3 files changed, 140 insertions(+)
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +111 -0
index a6455ee598..f3862b7fe3 100644
@@ -14,6 +14,11 @@
 #include "nthw_gfg.h"
 #include "nthw_phy_tile.h"
 
+typedef enum {
+	LOOPBACK_HOST_NONE,
+	LOOPBACK_HOST
+} loopback_host_t;
+
 static int nt4ga_agx_link_100g_ports_init(struct adapter_info_s *p_adapter_info,
 	nthw_fpga_t *fpga);
 
@@ -29,6 +34,65 @@ void link_agx_100g_init(void)
 	register_agx_100g_link_ops(&link_agx_100g_ops);
 }
 
+/*
+ * Phy handling
+ */
+
+static void phy_rx_path_rst(adapter_info_t *drv, int port, bool reset)
+{
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+	NT_LOG(DBG, NTNIC, "Port %d: %s", port, reset ? "assert" : "deassert");
+	nthw_phy_tile_set_rx_reset(p, port, reset);
+}
+
+static void phy_tx_path_rst(adapter_info_t *drv, int port, bool reset)
+{
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+	NT_LOG(DBG, NTNIC, "Port %d: %s", port, reset ? "assert" : "deassert");
+	nthw_phy_tile_set_tx_reset(p, port, reset);
+}
+
+static void phy_reset_rx(adapter_info_t *drv, int port)
+{
+	phy_rx_path_rst(drv, port, true);
+	nt_os_wait_usec(10000);	/* 10ms */
+	phy_rx_path_rst(drv, port, false);
+	nt_os_wait_usec(10000);	/* 10ms */
+}
+
+static void phy_reset_tx(adapter_info_t *drv, int port)
+{
+	phy_tx_path_rst(drv, port, true);
+	nt_os_wait_usec(10000);	/* 10ms */
+	phy_tx_path_rst(drv, port, false);
+	nt_os_wait_usec(10000);	/* 10ms */
+}
+
+static int phy_set_host_loopback(adapter_info_t *drv, int port, loopback_host_t loopback)
+{
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+
+	switch (loopback) {
+	case LOOPBACK_HOST_NONE:
+		for (uint8_t lane = 0; lane < 4; lane++)
+			nthw_phy_tile_set_host_loopback(p, port, lane, false);
+
+		break;
+
+	case LOOPBACK_HOST:
+		for (uint8_t lane = 0; lane < 4; lane++)
+			nthw_phy_tile_set_host_loopback(p, port, lane, true);
+
+		break;
+
+	default:
+		NT_LOG(ERR, NTNIC, "Port %d: Unhandled loopback value (%d)", port, loopback);
+		return -1;
+	}
+
+	return 0;
+}
+
 /*
  * Utility functions
  */
@@ -81,6 +145,40 @@ static int swap_tx_rx_polarity(adapter_info_t *drv, int port, bool swap)
 	return -1;
 }
 
+static void
+set_loopback(struct adapter_info_s *p_adapter_info, int port, uint32_t mode, uint32_t last_mode)
+{
+	switch (mode) {
+	case 1:
+		NT_LOG(INF, NTNIC, "%s: Applying host loopback",
+			p_adapter_info->mp_port_id_str[port]);
+		phy_set_host_loopback(p_adapter_info, port, LOOPBACK_HOST);
+		swap_tx_rx_polarity(p_adapter_info, port, false);
+		break;
+
+	default:
+		switch (last_mode) {
+		case 1:
+			NT_LOG(INF, NTNIC, "%s: Removing host loopback",
+				p_adapter_info->mp_port_id_str[port]);
+			phy_set_host_loopback(p_adapter_info, port, LOOPBACK_HOST_NONE);
+			swap_tx_rx_polarity(p_adapter_info, port, true);
+			break;
+
+		default:
+			/* do nothing */
+			break;
+		}
+
+		break;
+	}
+
+	/* After changing the loopback the system must be properly reset */
+	phy_reset_rx(p_adapter_info, port);
+	phy_reset_tx(p_adapter_info, port);
+	nt_os_wait_usec(10000);	/* 10ms - arbitrary choice */
+}
+
 /*
  * Link state machine
  */
@@ -146,6 +244,19 @@ static void *_common_ptp_nim_state_machine(void *data)
 			if (is_port_disabled)
 				continue;
 
+			if (link_info->port_action[i].port_lpbk_mode != last_lpbk_mode[i]) {
+				set_loopback(drv,
+					i,
+					link_info->port_action[i].port_lpbk_mode,
+					last_lpbk_mode[i]);
+
+				if (link_info->port_action[i].port_lpbk_mode == 1)
+					link_state[i].link_up = true;
+
+				last_lpbk_mode[i] = link_info->port_action[i].port_lpbk_mode;
+				continue;
+			}
+
 			link_state[i].link_disabled = is_port_disabled;
 
 			if (!link_state[i].nim_present) {
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h +1 -0
index 930c897046..5577f95944 100644
@@ -52,6 +52,7 @@ void nthw_phy_tile_set_tx_pol_inv(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t l
 void nthw_phy_tile_set_rx_pol_inv(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane, bool invert);
 void nthw_phy_tile_set_host_loopback(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
 	bool enable);
+void nthw_phy_tile_set_tx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset);
 void nthw_phy_tile_set_rx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset);
 
 uint32_t nthw_phy_tile_read_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
drivers/net/ntnic/nthw/core/nthw_phy_tile.c +28 -0
index fd7a1e1214..6402e5caf3 100644
@@ -64,6 +64,34 @@ void nthw_phy_tile_set_rx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset)
 	}
 }
 
+void nthw_phy_tile_set_tx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset)
+{
+	/* Reset is active low */
+	nthw_field_get_updated(p->mp_fld_port_config_tx_reset[intf_no]);
+
+	if (reset) {
+		nthw_field_clr_flush(p->mp_fld_port_config_tx_reset[intf_no]);
+
+		/* Wait for ack */
+		if (p->mp_fld_port_status_tx_reset_ackn[intf_no]) {
+			int32_t count = 1000;
+
+			do {
+				nt_os_wait_usec(1000);	/* 1ms */
+			} while (nthw_field_get_updated(p->mp_fld_port_status_tx_reset_ackn
+				[intf_no]) && (--count > 0));
+
+			if (count <= 0) {
+				NT_LOG(ERR, NTHW, "intf_no %u: Time-out waiting for TxResetAck",
+					intf_no);
+			}
+		}
+
+	} else {
+		nthw_field_set_flush(p->mp_fld_port_config_tx_reset[intf_no]);
+	}
+}
+
 uint32_t nthw_phy_tile_read_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
 	uint32_t address)
 {
Signature · 1 line
2.45.0
#6 lore raw

PATCH 6/32 net/ntnic: add line loopback init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Implement PHY host loopback configuration for Agilex FPGA

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 116 ++++++++++++++++++
 drivers/net/ntnic/meson.build                 |   1 +
 drivers/net/ntnic/nim/i2c_nim.c               |  70 +++++++++--
 .../nthw/core/include/nthw_si5332_si5156.h    |   6 +
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  |  31 +++++
 5 files changed, 216 insertions(+), 8 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +116 -0
index f3862b7fe3..9551dfdfdc 100644
@@ -19,6 +19,11 @@ typedef enum {
 	LOOPBACK_HOST
 } loopback_host_t;
 
+typedef enum {
+	LOOPBACK_LINE_NONE,
+	LOOPBACK_LINE
+} loopback_line_t;
+
 static int nt4ga_agx_link_100g_ports_init(struct adapter_info_s *p_adapter_info,
 	nthw_fpga_t *fpga);
 
@@ -93,6 +98,105 @@ static int phy_set_host_loopback(adapter_info_t *drv, int port, loopback_host_t
 	return 0;
 }
 
+static int phy_set_line_loopback(adapter_info_t *drv, int port, loopback_line_t loopback)
+{
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+	uint32_t addr;
+
+	switch (loopback) {
+	case LOOPBACK_LINE_NONE:
+		for (uint8_t lane = 0; lane < 4; lane++) {
+			uint8_t quad_lane;
+
+			for (uint8_t fgt = 0; fgt < 4; fgt++) {
+				uint8_t quad_and_lane_no =
+					(uint8_t)nthw_phy_tile_read_xcvr(p, port, lane, 0xFFFFC);
+				quad_lane = quad_and_lane_no & 0x3;	/* bits[1:0] */
+
+				if (quad_lane == lane)
+					break;
+			}
+
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41830u + (0x8000u * quad_lane),
+				0x03);
+
+			addr = nthw_phy_tile_read_xcvr(p, 0, 0, 0x41768u + (0x8000u * quad_lane)) |
+				(1u << 24u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41768u + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, 0, 0, 0x41414u + (0x8000u * quad_lane)) &
+				~(1u << 29u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41414u + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, 0, 0, 0x4141Cu + (0x8000u * quad_lane)) &
+				~(1u << 30u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x4141Cu + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, 0, 0, 0x41418u + (0x8000u * quad_lane)) &
+				~(1u << 31u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41418u + (0x8000u * quad_lane),
+				addr);
+		}
+
+		break;
+
+	case LOOPBACK_LINE:
+		for (uint8_t lane = 0; lane < 4; lane++) {
+			uint8_t quad_lane;
+
+			for (uint8_t fgt = 0; fgt < 4; fgt++) {
+				uint8_t quad_and_lane_no =
+					(uint8_t)nthw_phy_tile_read_xcvr(p, port, lane, 0xFFFFC);
+				quad_lane = quad_and_lane_no & 0x3;	/* bits[1:0] */
+
+				if (quad_lane == lane)
+					break;
+			}
+
+			addr = nthw_phy_tile_read_xcvr(p, port, 0,
+					0x41830u + (0x8000u * quad_lane)) &
+				0u;
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41830u + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, port, 0,
+					0x41768u + (0x8000u * quad_lane)) &
+				~(1u << 24u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41768u + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, port, 0,
+					0x41414u + (0x8000u * quad_lane)) |
+				(1u << 29u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41414u + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, port, 0,
+					0x4141Cu + (0x8000u * quad_lane)) |
+				(1u << 30u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x4141Cu + (0x8000u * quad_lane),
+				addr);
+
+			addr = nthw_phy_tile_read_xcvr(p, port, 0,
+					0x41418u + (0x8000u * quad_lane)) |
+				(1u << 31u);
+			nthw_phy_tile_write_xcvr(p, port, 0, 0x41418u + (0x8000u * quad_lane),
+				addr);
+		}
+
+		break;
+
+	default:
+		NT_LOG(ERR, NTNIC, "Port %d: Unhandled loopback value (%d)", port, loopback);
+		return -1;
+	}
+
+	return 0;
+}
+
 /*
  * Utility functions
  */
@@ -156,6 +260,12 @@ set_loopback(struct adapter_info_s *p_adapter_info, int port, uint32_t mode, uin
 		swap_tx_rx_polarity(p_adapter_info, port, false);
 		break;
 
+	case 2:
+		NT_LOG(INF, NTNIC, "%s: Applying line loopback",
+			p_adapter_info->mp_port_id_str[port]);
+		phy_set_line_loopback(p_adapter_info, port, LOOPBACK_LINE);
+		break;
+
 	default:
 		switch (last_mode) {
 		case 1:
@@ -165,6 +275,12 @@ set_loopback(struct adapter_info_s *p_adapter_info, int port, uint32_t mode, uin
 			swap_tx_rx_polarity(p_adapter_info, port, true);
 			break;
 
+		case 2:
+			NT_LOG(INF, NTNIC, "%s: Removing line loopback",
+				p_adapter_info->mp_port_id_str[port]);
+			phy_set_line_loopback(p_adapter_info, port, LOOPBACK_LINE_NONE);
+			break;
+
 		default:
 			/* do nothing */
 			break;
drivers/net/ntnic/meson.build +1 -0
index 4799ebfb8e..271115cdd3 100644
@@ -56,6 +56,7 @@ sources = files(
         'nthw/core/nthw_mac_pcs.c',
         'nthw/core/nthw_pcie3.c',
         'nthw/core/nthw_phy_tile.c',
+        'nthw/core/nthw_si5332_si5156.c',
         'nthw/core/nthw_rpf.c',
         'nthw/core/nthw_rmc.c',
         'nthw/core/nthw_sdc.c',
drivers/net/ntnic/nim/i2c_nim.c +62 -8

95 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h +6 -0
index fb44c62f12..968d7eb74a 100644
@@ -6,13 +6,19 @@
 #ifndef __NTHW_SI5332_SI5156_H__
 #define __NTHW_SI5332_SI5156_H__
 
+#include "nthw_i2cm.h"
 /*
  * PCA9849 I2c mux class
  */
 
 struct nthw_pca9849 {
+	nthw_i2cm_t *mp_nt_i2cm;
+	uint8_t m_current_channel;
+	uint8_t m_dev_address;
 };
 
 typedef struct nthw_pca9849 nthw_pca9849_t;
 
+int nthw_pca9849_set_channel(nthw_pca9849_t *p, uint8_t channel);
+
 #endif	/* __NTHW_SI5332_SI5156_H__ */
drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c new file +31 -0
new file mode 100644
index 0000000000..b5560e2990
@@ -0,0 +1,31 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <pthread.h>
+#include "nt_util.h"
+#include "ntlog.h"
+
+#include "nthw_drv.h"
+#include "nthw_register.h"
+
+#include "nthw_si5332_si5156.h"
+
+int nthw_pca9849_set_channel(nthw_pca9849_t *p, uint8_t channel)
+{
+	int res;
+
+	if (p->m_current_channel != channel) {
+		uint8_t data = channel + 4;
+		res = nthw_i2cm_write(p->mp_nt_i2cm, p->m_dev_address, 0, data);
+
+		if (res)
+			return res;
+
+		p->m_current_channel = channel;
+		nt_os_wait_usec(10000);
+	}
+
+	return 0;
+}
Signature · 1 line
2.45.0
#7 lore raw

PATCH 7/32 net/ntnic: add 100 gbps port init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Initialize NIM and 100G port for Agilex FPGA

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 143 ++++++++++++++++++
 drivers/net/ntnic/meson.build                 |   1 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |   2 +
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |  10 ++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        |  41 +++++
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  |  41 +++++
 6 files changed, 238 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +143 -0
index 9551dfdfdc..6593c90ca5 100644
@@ -197,6 +197,26 @@ static int phy_set_line_loopback(adapter_info_t *drv, int port, loopback_line_t
 	return 0;
 }
 
+/*
+ * Nim handling
+ */
+
+static bool nim_is_present(nim_i2c_ctx_p ctx, uint8_t nim_idx)
+{
+	assert(nim_idx < NUM_ADAPTER_PORTS_MAX);
+
+	nthw_pcal6416a_t *p = ctx->hwagx.p_io_nim;
+	uint8_t data = 0;
+
+	if (nim_idx == 0)
+		nthw_pcal6416a_read(p, 3, &data);
+
+	else if (nim_idx == 1)
+		nthw_pcal6416a_read(p, 7, &data);
+
+	return data == 0;
+}
+
 /*
  * Utility functions
  */
@@ -295,6 +315,119 @@ set_loopback(struct adapter_info_s *p_adapter_info, int port, uint32_t mode, uin
 	nt_os_wait_usec(10000);	/* 10ms - arbitrary choice */
 }
 
+/*
+ * Initialize NIM, Code based on nt400d1x.cpp: MyPort::createNim()
+ */
+
+static int create_nim(adapter_info_t *drv, int port, bool enable)
+{
+	int res = 0;
+	const uint8_t valid_nim_id = NT_NIM_QSFP28;
+	sfp_nim_state_t nim;
+	nt4ga_link_t *link_info = &drv->nt4ga_link;
+	nim_i2c_ctx_t *nim_ctx = &link_info->u.nim_ctx[port];
+
+	assert(port >= 0 && port < NUM_ADAPTER_PORTS_MAX);
+	assert(link_info->variables_initialized);
+
+	if (!enable) {
+		phy_reset_rx(drv, port);
+		phy_reset_tx(drv, port);
+	}
+
+	/*
+	 * Wait a little after a module has been inserted before trying to access I2C
+	 * data, otherwise the module will not respond correctly.
+	 */
+	nt_os_wait_usec(1000000);	/* pause 1.0s */
+
+	res = construct_and_preinit_nim(nim_ctx, NULL);
+
+	if (res)
+		return res;
+
+	res = nim_state_build(nim_ctx, &nim);
+
+	if (res)
+		return res;
+
+	/* Set FEC to be enabled by default */
+	nim_ctx->specific_u.qsfp.specific_u.qsfp28.media_side_fec_ena = true;
+
+	NT_LOG(DBG, NTHW, "%s: NIM id = %u (%s), br = %u, vendor = '%s', pn = '%s', sn='%s'",
+		drv->mp_port_id_str[port], nim_ctx->nim_id, nim_id_to_text(nim_ctx->nim_id), nim.br,
+		nim_ctx->vendor_name, nim_ctx->prod_no, nim_ctx->serial_no);
+
+	/*
+	 * Does the driver support the NIM module type?
+	 */
+	if (nim_ctx->nim_id != valid_nim_id) {
+		NT_LOG(ERR, NTHW, "%s: The driver does not support the NIM module type %s",
+			drv->mp_port_id_str[port], nim_id_to_text(nim_ctx->nim_id));
+		NT_LOG(DBG, NTHW, "%s: The driver supports the NIM module type %s",
+			drv->mp_port_id_str[port], nim_id_to_text(valid_nim_id));
+		return -1;
+	}
+
+	return res;
+}
+
+/*
+ * Initialize one 100 Gbps port.
+ */
+static int _port_init(adapter_info_t *p_info, nthw_fpga_t *fpga, int port)
+{
+	uint8_t adapter_no = p_info->adapter_no;
+	int res;
+
+	nt4ga_link_t *link_info = &p_info->nt4ga_link;
+	nthw_gfg_t *p_gfg = &link_info->u.var_a100g.gfg[adapter_no];
+	nthw_phy_tile_t *p_phy_tile = p_info->fpga_info.mp_nthw_agx.p_phy_tile;
+	nthw_rpf_t *p_rpf = p_info->fpga_info.mp_nthw_agx.p_rpf;
+
+	assert(port >= 0 && port < NUM_ADAPTER_PORTS_MAX);
+	assert(link_info->variables_initialized);
+
+	link_info->link_info[port].link_speed = NT_LINK_SPEED_100G;
+	link_info->link_info[port].link_duplex = NT_LINK_DUPLEX_FULL;
+	link_info->link_info[port].link_auto_neg = NT_LINK_AUTONEG_OFF;
+	link_info->speed_capa |= NT_LINK_SPEED_100G;
+
+	nthw_gfg_stop(p_gfg, port);
+
+	for (uint8_t lane = 0; lane < 4; lane++)
+		nthw_phy_tile_set_host_loopback(p_phy_tile, port, lane, false);
+
+	swap_tx_rx_polarity(p_info, port, true);
+	nthw_rpf_set_ts_at_eof(p_rpf, true);
+
+	NT_LOG(DBG, NTNIC, "%s: Setting up port %d", p_info->mp_port_id_str[port], port);
+
+	phy_reset_rx(p_info, port);
+
+	if (nthw_gmf_init(NULL, fpga, port) == 0) {
+		nthw_gmf_t gmf;
+
+		if (nthw_gmf_init(&gmf, fpga, port) == 0)
+			nthw_gmf_set_enable_tsi(&gmf, true, 0, 0, false);
+	}
+
+	nthw_rpf_unblock(p_rpf);
+
+	res = create_nim(p_info, port, true);
+
+	if (res) {
+		NT_LOG(WRN, NTNIC, "%s: NIM initialization failed",
+			p_info->mp_port_id_str[port]);
+		return res;
+	}
+
+	NT_LOG(DBG, NTNIC, "%s: NIM initialized", p_info->mp_port_id_str[port]);
+
+	phy_reset_rx(p_info, port);
+	return res;
+}
+
 /*
  * Link state machine
  */
@@ -310,6 +443,7 @@ static void *_common_ptp_nim_state_machine(void *data)
 	/* link_state_t new_link_state; */
 
 	link_state_t *link_state = link_info->link_state;
+	nim_i2c_ctx_t *nim_ctx = link_info->u.var_a100g.nim_ctx;
 
 	if (!fpga) {
 		NT_LOG(ERR, NTNIC, "%s: fpga is NULL", drv->mp_adapter_id_str);
@@ -361,6 +495,15 @@ static void *_common_ptp_nim_state_machine(void *data)
 				continue;
 
 			if (link_info->port_action[i].port_lpbk_mode != last_lpbk_mode[i]) {
+				/* Loopback mode has changed. Do something */
+				if (!nim_is_present(&nim_ctx[i], i)) {
+					/*
+					 * If there is no Nim present, we need to initialize the
+					 * port  anyway
+					 */
+					_port_init(drv, fpga, i);
+				}
+
 				set_loopback(drv,
 					i,
 					link_info->port_action[i].port_lpbk_mode,
drivers/net/ntnic/meson.build +1 -0
index 271115cdd3..b1505c5549 100644
@@ -55,6 +55,7 @@ sources = files(
         'nthw/core/nthw_iic.c',
         'nthw/core/nthw_mac_pcs.c',
         'nthw/core/nthw_pcie3.c',
+        'nthw/core/nthw_pcal6416a.c',
         'nthw/core/nthw_phy_tile.c',
         'nthw/core/nthw_si5332_si5156.c',
         'nthw/core/nthw_rpf.c',
drivers/net/ntnic/nthw/core/include/nthw_gmf.h +2 -0
index cc5be85154..c8beb2117c 100644
@@ -58,6 +58,8 @@ struct nthw_gmf {
 typedef struct nthw_gmf nthw_gmf_t;
 
 int nthw_gmf_init(nthw_gmf_t *p, nthw_fpga_t *p_fpga, int n_instance);
+void nthw_gmf_set_enable_tsi(nthw_gmf_t *p, bool enable, int tsi_dynamic_offset,
+	int tsi_static_offset, bool tsi_always);
 
 void nthw_gmf_set_enable(nthw_gmf_t *p, bool enable);
 
drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h +10 -0
index 636d2beb85..5ef14a0bc9 100644
@@ -7,13 +7,23 @@
 
 #include <stdint.h>
 
+#include "nthw_i2cm.h"
+#include "nthw_si5332_si5156.h"
+
 /*
  * PCAL6416A I/O expander class
  */
 
 struct nthw_pcal6416a {
+	nthw_i2cm_t *mp_nt_i2cm;
+	uint8_t m_dev_address;
+	nthw_pca9849_t *mp_ca9849;
+	uint8_t m_mux_channel;
+	uint8_t m_config_data[2];
 };
 
 typedef struct nthw_pcal6416a nthw_pcal6416a_t;
 
+void nthw_pcal6416a_read(nthw_pcal6416a_t *p, uint8_t pin, uint8_t *value);
+
 #endif	/* __NTHW_PCAL6416A_H__ */
drivers/net/ntnic/nthw/core/nthw_gmf.c +41 -0

44 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pcal6416a.c new file +41 -0

41 lines not on this page · raw message

Signature · 1 line
2.45.0
#8 lore raw

PATCH 8/32 net/ntnic: add port post init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Configure FEC and TX equalization for 100G NIM on Agilex FPGA

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 122 ++++++++
 drivers/net/ntnic/nim/i2c_nim.c               |  80 +++++
 drivers/net/ntnic/nim/i2c_nim.h               |   3 +
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  25 ++
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 295 ++++++++++++++++++
 5 files changed, 525 insertions(+)
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +122 -0
index 6593c90ca5..fe2acef612 100644
@@ -372,6 +372,121 @@ static int create_nim(adapter_info_t *drv, int port, bool enable)
 	return res;
 }
 
+static int nim_ready_100_gb(adapter_info_t *p_info, int port)
+{
+	nt4ga_link_t *link_info = &p_info->nt4ga_link;
+	nim_i2c_ctx_t *nim_ctx = &link_info->u.nim_ctx[port];
+	nthw_phy_tile_t *p_phy_tile = p_info->fpga_info.mp_nthw_agx.p_phy_tile;
+
+	bool disable_fec_by_port_type = (nim_ctx->port_type == NT_PORT_TYPE_QSFP28_LR4);
+	bool enable_fec = nim_ctx->specific_u.qsfp.specific_u.qsfp28.media_side_fec_ena &&
+		!disable_fec_by_port_type;
+
+	NT_LOG(DBG, NTNIC, "Port %s: DisableFec = %d", p_info->mp_port_id_str[port], !enable_fec);
+	/*
+	 * FecAutonegotiation at 100G is not supported for Napatech adapters and therefore
+	 * not relevant at this speed
+	 */
+
+	/* Adjust NIM power level */
+	if (nim_ctx->pwr_level_req > 4) {
+		qsfp28_set_high_power(nim_ctx);
+		nim_ctx->pwr_level_cur = nim_ctx->pwr_level_req;
+	}
+
+	/* enable_fec is what the end result should be, now find out if it's possible */
+	if (enable_fec) {
+		if (qsfp28_set_fec_enable(nim_ctx, true, false)) {
+			/* Prefer NIM media FEC since the NIM is assumed to know the right FEC */
+			NT_LOG(DBG, NTNIC, "Port %s: NIM media FEC enabled",
+				p_info->mp_port_id_str[port]);
+
+			/* The NIM has been set to FEC on the media side so turn FPGA FEC off */
+			if (nthw_phy_tile_configure_fec(p_phy_tile, port, true)) {
+				NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC disabled",
+					p_info->mp_port_id_str[port]);
+
+			} else {
+				NT_LOG(DBG, NTNIC,
+					"Port %s: FPGA does not support disabling of FEC",
+					p_info->mp_port_id_str[port]);
+				return 1;
+			}
+
+		} else if (qsfp28_set_fec_enable(nim_ctx, false, false)) {
+			/* The NIM does not support FEC at all so turn FPGA FEC on instead */
+			/* This is relevant to SR4 modules */
+			NT_LOG(DBG, NTNIC, "Port %s: No NIM FEC", p_info->mp_port_id_str[port]);
+			nthw_phy_tile_configure_fec(p_phy_tile, port, false);
+			NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC enabled",
+				p_info->mp_port_id_str[port]);
+
+		} else if (qsfp28_set_fec_enable(nim_ctx, true, true)) {
+			/* This probably not a likely scenario */
+			nthw_phy_tile_configure_fec(p_phy_tile, port, false);
+			NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC enabled",
+				p_info->mp_port_id_str[port]);
+			NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC terminated, NIM media FEC enabled",
+				p_info->mp_port_id_str[port]);
+
+		} else {
+			NT_LOG(ERR, NTNIC, "Port %s: Could not enable FEC",
+				p_info->mp_port_id_str[port]);
+			return 1;
+		}
+
+	} else if (qsfp28_set_fec_enable(nim_ctx, false, false)) {
+		/* The NIM does not support FEC at all - this is relevant to LR4 modules */
+		NT_LOG(DBG, NTNIC, "Port %s: No NIM FEC", p_info->mp_port_id_str[port]);
+
+		if (nthw_phy_tile_configure_fec(p_phy_tile, port, true)) {
+			NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC disabled",
+				p_info->mp_port_id_str[port]);
+
+		} else {
+			NT_LOG(ERR, NTNIC, "Port %s: FPGA does not support disabling of FEC",
+				p_info->mp_port_id_str[port]);
+			return 1;
+		}
+
+	} else if (qsfp28_set_fec_enable(nim_ctx, false, true)) {
+		nthw_phy_tile_configure_fec(p_phy_tile, port, false);
+		/* This probably not a likely scenario */
+		NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC enabled", p_info->mp_port_id_str[port]);
+		NT_LOG(DBG, NTNIC, "Port %s: FPGA FEC terminated, NIM media FEC disabled",
+			p_info->mp_port_id_str[port]);
+
+	} else {
+		NT_LOG(ERR, NTNIC, "Port %s: Could not disable FEC",
+			p_info->mp_port_id_str[port]);
+		return 1;
+	}
+
+	if (port == 0) {
+		/* setTxEqualization(uint8_t intf_no, uint8_t lane, uint32_t pre_tap2,
+		 * uint32_t main_tap, uint32_t pre_tap1, uint32_t post_tap1)
+		 */
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 0, 0, 44, 2, 9);
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 1, 0, 44, 2, 9);
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 2, 0, 44, 2, 9);
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 3, 0, 44, 2, 9);
+
+	} else {
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 0, 0, 44, 2, 9);
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 1, 0, 44, 2, 9);
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 2, 0, 44, 2, 9);
+		nthw_phy_tile_set_tx_equalization(p_phy_tile, port, 3, 0, 44, 2, 9);
+	}
+
+	/*
+	 * Perform a full reset. If the RX is in reset from the start this sequence will
+	 * take it out of reset and this is necessary in order to read block/lane lock
+	 * in getLinkState()
+	 */
+	phy_reset_rx(p_info, port);
+	return 0;
+}
+
 /*
  * Initialize one 100 Gbps port.
  */
@@ -424,6 +539,13 @@ static int _port_init(adapter_info_t *p_info, nthw_fpga_t *fpga, int port)
 
 	NT_LOG(DBG, NTNIC, "%s: NIM initialized", p_info->mp_port_id_str[port]);
 
+	res = nim_ready_100_gb(p_info, port);
+
+	if (res) {
+		NT_LOG(WRN, NTNIC, "%s: NIM failed to get ready", p_info->mp_port_id_str[port]);
+		return res;
+	}
+
 	phy_reset_rx(p_info, port);
 	return res;
 }
drivers/net/ntnic/nim/i2c_nim.c +80 -0

92 lines not on this page · raw message

drivers/net/ntnic/nim/i2c_nim.h +3 -0
index 09837448c6..888b709135 100644
@@ -33,6 +33,9 @@ int nim_qsfp_plus_nim_set_tx_laser_disable(nim_i2c_ctx_t *ctx, bool disable, int
  */
 int construct_and_preinit_nim(nim_i2c_ctx_p ctx, void *extra);
 
+void qsfp28_set_high_power(nim_i2c_ctx_p ctx);
+bool qsfp28_set_fec_enable(nim_i2c_ctx_p ctx, bool media_side_fec, bool host_side_fec);
+
 void nim_agx_setup(struct nim_i2c_ctx *ctx, nthw_pcal6416a_t *p_io_nim, nthw_i2cm_t *p_nt_i2cm,
 	nthw_pca9849_t *p_ca9849);
 
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h +25 -0
index 5577f95944..c810f55c0d 100644
@@ -34,15 +34,34 @@ struct nt_phy_tile {
 	nthw_field_t *mp_fld_link_summary_nt_phy_link_state[2];
 	nthw_field_t *mp_fld_link_summary_ll_nt_phy_link_state[2];
 	nthw_field_t *mp_fld_link_summary_link_down_cnt[2];
+	nthw_field_t *mp_fld_link_summary_lh_received_local_fault[2];
 	nthw_field_t *mp_fld_link_summary_lh_remote_fault[2];
 
+	nthw_field_t *mp_fld_port_status_rx_hi_ber[2];
+	nthw_field_t *mp_fld_port_status_rx_am_lock[2];
 	nthw_field_t *mp_fld_port_status_tx_reset_ackn[2];
 	nthw_field_t *mp_fld_port_status_rx_reset_ackn[2];
 
+	nthw_field_t *mp_fld_port_config_reset[2];
 	nthw_field_t *mp_fld_port_config_rx_reset[2];
 	nthw_field_t *mp_fld_port_config_tx_reset[2];
 
+	nthw_field_t *mp_fld_port_comp_rx_compensation[2];
+
+	nthw_register_t *mp_reg_dyn_reconfig_base;
+	nthw_field_t *mp_fld_dyn_reconfig_base_ptr;
+	nthw_field_t *mp_fld_dyn_reconfig_base_busy;
+	nthw_field_t *mp_fld_dyn_reconfig_base_cmd;
+
+	nthw_register_t *mp_reg_dyn_reconfig_data;
+	nthw_field_t *mp_fld_dyn_reconfig_data_data;
+
 	nthw_field_t *mp_fld_scratch_data;
+
+	nthw_register_t *mp_reg_dr_cfg_status;
+	nthw_field_t *mp_fld_dr_cfg_status_curr_profile_id;
+	nthw_field_t *mp_fld_dr_cfg_status_in_progress;
+	nthw_field_t *mp_fld_dr_cfg_status_error;
 };
 
 typedef struct nt_phy_tile nthw_phy_tile_t;
@@ -52,9 +71,15 @@ void nthw_phy_tile_set_tx_pol_inv(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t l
 void nthw_phy_tile_set_rx_pol_inv(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane, bool invert);
 void nthw_phy_tile_set_host_loopback(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
 	bool enable);
+void nthw_phy_tile_set_tx_equalization(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
+	uint32_t pre_tap2, uint32_t main_tap, uint32_t pre_tap1,
+	uint32_t post_tap1);
 void nthw_phy_tile_set_tx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset);
 void nthw_phy_tile_set_rx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset);
 
+uint32_t nthw_phy_tile_read_eth(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t address);
+void nthw_phy_tile_write_eth(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t address, uint32_t data);
+bool nthw_phy_tile_configure_fec(nthw_phy_tile_t *p, uint8_t intf_no, bool enable);
 uint32_t nthw_phy_tile_read_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
 	uint32_t address);
 void nthw_phy_tile_write_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane, uint32_t address,
drivers/net/ntnic/nthw/core/nthw_phy_tile.c +295 -0

320 lines not on this page · raw message

Signature · 1 line
2.45.0
#9 lore raw

PATCH 9/32 net/ntnic: add nim low power API

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add NIM reset and low power functions with presence check

- Implement nim_set_reset function to handle NIM reset.
- Implement set_nim_low_power function to manage NIM power state.
- Add code to check NIM presence before performing reset.

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 53 +++++++++++++++++++
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |  1 +
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  | 39 ++++++++++++++
 3 files changed, 93 insertions(+)
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +53 -0
index fe2acef612..9193f21f6f 100644
@@ -201,6 +201,17 @@ static int phy_set_line_loopback(adapter_info_t *drv, int port, loopback_line_t
  * Nim handling
  */
 
+static void nim_set_reset(struct nim_i2c_ctx *ctx, uint8_t nim_idx, bool reset)
+{
+	nthw_pcal6416a_t *p = ctx->hwagx.p_io_nim;
+
+	if (nim_idx == 0)
+		nthw_pcal6416a_write(p, 0, reset ? 0 : 1);
+
+	else if (nim_idx == 1)
+		nthw_pcal6416a_write(p, 4, reset ? 0 : 1);
+}
+
 static bool nim_is_present(nim_i2c_ctx_p ctx, uint8_t nim_idx)
 {
 	assert(nim_idx < NUM_ADAPTER_PORTS_MAX);
@@ -217,6 +228,20 @@ static bool nim_is_present(nim_i2c_ctx_p ctx, uint8_t nim_idx)
 	return data == 0;
 }
 
+static void set_nim_low_power(nim_i2c_ctx_p ctx, uint8_t nim_idx, bool low_power)
+{
+	nthw_pcal6416a_t *p = ctx->hwagx.p_io_nim;
+
+	if (nim_idx == 0) {
+		/* De-asserting LP mode pin 1 */
+		nthw_pcal6416a_write(p, 1, low_power ? 1 : 0);
+
+	} else if (nim_idx == 1) {
+		/* De-asserting LP mode pin 5 */
+		nthw_pcal6416a_write(p, 5, low_power ? 1 : 0);
+	}
+}
+
 /*
  * Utility functions
  */
@@ -335,6 +360,25 @@ static int create_nim(adapter_info_t *drv, int port, bool enable)
 		phy_reset_tx(drv, port);
 	}
 
+	/*
+	 * Check NIM is present before doing reset.
+	 */
+
+	if (!nim_is_present(nim_ctx, port)) {
+		NT_LOG(DBG, NTNIC, "%s: NIM module is no longer absent!",
+			drv->mp_port_id_str[port]);
+		return -1;
+	}
+
+	/*
+	 * Reset NIM
+	 */
+
+	NT_LOG(DBG, NTNIC, "%s: Performing NIM reset", drv->mp_port_id_str[port]);
+	nim_set_reset(nim_ctx, (uint8_t)port, true);
+	nt_os_wait_usec(100000);/*  pause 0.1s */
+	nim_set_reset(nim_ctx, (uint8_t)port, false);
+
 	/*
 	 * Wait a little after a module has been inserted before trying to access I2C
 	 * data, otherwise the module will not respond correctly.
@@ -369,6 +413,15 @@ static int create_nim(adapter_info_t *drv, int port, bool enable)
 		return -1;
 	}
 
+	if (enable) {
+		NT_LOG(DBG, NTNIC, "%s: De-asserting low power", drv->mp_port_id_str[port]);
+		set_nim_low_power(nim_ctx, port, false);
+
+	} else {
+		NT_LOG(DBG, NTNIC, "%s: Asserting low power", drv->mp_port_id_str[port]);
+		set_nim_low_power(nim_ctx, port, true);
+	}
+
 	return res;
 }
 
drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h +1 -0
index 5ef14a0bc9..a718b59a29 100644
@@ -24,6 +24,7 @@ struct nthw_pcal6416a {
 
 typedef struct nthw_pcal6416a nthw_pcal6416a_t;
 
+void nthw_pcal6416a_write(nthw_pcal6416a_t *p, uint8_t pin, uint8_t value);
 void nthw_pcal6416a_read(nthw_pcal6416a_t *p, uint8_t pin, uint8_t *value);
 
 #endif	/* __NTHW_PCAL6416A_H__ */
drivers/net/ntnic/nthw/core/nthw_pcal6416a.c +39 -0
index 37b6e7ec57..dd803ac66d 100644
@@ -13,11 +13,50 @@
 #include "nthw_pcal6416a.h"
 
 static const uint8_t read_port[2] = { 0x00, 0x01 };
+static const uint8_t write_port[2] = { 0x02, 0x03 };
+static const uint8_t config_port[2] = { 0x06, 0x07 };
 
 /*
  * PCAL6416A I/O expander class
  */
 
+void nthw_pcal6416a_write(nthw_pcal6416a_t *p, uint8_t pin, uint8_t value)
+{
+	uint8_t port;
+	uint8_t data;
+
+	rte_spinlock_lock(&p->mp_nt_i2cm->i2cmmutex);
+	nthw_pca9849_set_channel(p->mp_ca9849, p->m_mux_channel);
+
+	if (pin < 8) {
+		port = 0;
+
+	} else {
+		port = 1;
+		pin = (uint8_t)(pin - 8);
+	}
+
+	nthw_i2cm_read(p->mp_nt_i2cm, p->m_dev_address, write_port[port], &data);
+
+	if (value == 0)
+		data = (uint8_t)(data & (~(uint8_t)(1 << pin)));
+
+	else
+		data = (uint8_t)(data | (1 << pin));
+
+	nthw_i2cm_write(p->mp_nt_i2cm, p->m_dev_address, write_port[port], data);
+
+	/* Enable pin as output pin when writing to it first time */
+	data = (uint8_t)(p->m_config_data[port] & (~(uint8_t)(1 << pin)));
+
+	if (data != p->m_config_data[port]) {
+		nthw_i2cm_write(p->mp_nt_i2cm, p->m_dev_address, config_port[port], data);
+		p->m_config_data[port] = data;
+	}
+
+	rte_spinlock_unlock(&p->mp_nt_i2cm->i2cmmutex);
+}
+
 void nthw_pcal6416a_read(nthw_pcal6416a_t *p, uint8_t pin, uint8_t *value)
 {
 	uint8_t port;
Signature · 1 line
2.45.0
#10 lore raw

PATCH 10/32 net/ntnic: add link handling API

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add link state management and NIM reset functionality

- Implement phy_get_link_state to retrieve PHY link state.
- Implement adjust_maturing_delay to adjust link maturing delay.
- Implement get/set to operate current link state.

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 171 ++++++++++++++++++
 drivers/net/ntnic/meson.build                 |   1 +
 .../ntnic/nthw/core/include/nthw_pca9532.h    |  22 +++
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |   9 +
 drivers/net/ntnic/nthw/core/nthw_pca9532.c    |  40 ++++
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   |  51 +++++-
 drivers/net/ntnic/nthw/nthw_drv.h             |   2 +
 7 files changed, 295 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pca9532.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pca9532.c
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +171 -0
index 9193f21f6f..00a30f24a5 100644
@@ -43,6 +43,38 @@ void link_agx_100g_init(void)
  * Phy handling
  */
 
+static void phy_get_link_state(adapter_info_t *drv,
+	int port,
+	nt_link_state_p p_curr_link_state,
+	nt_link_state_p p_latched_links_state,
+	uint32_t *p_local_fault,
+	uint32_t *p_remote_fault)
+{
+	uint32_t status = 0;
+	uint32_t status_latch = 0;
+
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+
+	nthw_phy_tile_get_link_summary(p,
+		&status,
+		&status_latch,
+		p_local_fault,
+		p_remote_fault,
+		port);
+
+	if (status == 0x0)
+		*p_curr_link_state = NT_LINK_STATE_DOWN;
+
+	else
+		*p_curr_link_state = NT_LINK_STATE_UP;
+
+	if (status_latch == 0x0)
+		*p_latched_links_state = NT_LINK_STATE_DOWN;
+
+	else
+		*p_latched_links_state = NT_LINK_STATE_UP;
+}
+
 static void phy_rx_path_rst(adapter_info_t *drv, int port, bool reset)
 {
 	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
@@ -242,6 +274,135 @@ static void set_nim_low_power(nim_i2c_ctx_p ctx, uint8_t nim_idx, bool low_power
 	}
 }
 
+/*
+ * Link handling
+ */
+
+static void adjust_maturing_delay(adapter_info_t *drv, int port)
+{
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+	nthw_rpf_t *p_rpf = drv->fpga_info.mp_nthw_agx.p_rpf;
+	/*
+	 * Find the maximum of the absolute values of the RX componensation for all
+	 * ports (the RX componensation may not be set for some of the other ports).
+	 */
+	const int16_t unset_rx_compensation = -1;	/* 0xffff */
+	int16_t max_comp = 0;
+
+	for (int i = 0; i < drv->fpga_info.n_phy_ports; i++) {
+		int16_t comp = (int16_t)nthw_phy_tile_get_timestamp_comp_rx(p, i);
+
+		if (comp != unset_rx_compensation && abs(comp) > abs(max_comp))
+			max_comp = comp;
+	}
+
+	int delay = nthw_rpf_get_maturing_delay(p_rpf) - max_comp;
+
+	/*
+	 * For SOF time-stamping account for jumbo frame.
+	 * Frame size = 80000 b. divided by Gb link speed = processing time in ns.
+	 */
+	if (!nthw_rpf_get_ts_at_eof(p_rpf)) {
+		uint32_t jumbo_frame_processing_time_ns = 80000U / 100U;
+		delay -= (int)jumbo_frame_processing_time_ns;
+	}
+
+	const unsigned int delay_bit_width = 19;/* 19 bits maturing delay */
+	const int min_delay = -(1 << (delay_bit_width - 1));
+	const int max_delay = 0;
+
+	if (delay >= min_delay && delay <= max_delay) {
+		nthw_rpf_set_maturing_delay(p_rpf, delay);
+
+	} else {
+		NT_LOG(WRN, NTNIC,
+			"Port %u: Cannot set the RPF adjusted maturing delay to %i because "
+			"that value is outside the legal range [%i:%i]",
+			port, delay, min_delay, max_delay);
+	}
+}
+
+static void set_link_state(adapter_info_t *drv, nim_i2c_ctx_p ctx, link_state_t *state, int port)
+{
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+	/*
+	 * 100G: 4 LEDs per port
+	 */
+
+	bool led_on = state->nim_present && state->link_state == NT_LINK_STATE_UP;
+	uint8_t led_pos = (uint8_t)(port * ctx->lane_count);
+
+	for (uint8_t i = 0; i < ctx->lane_count; i++) {
+		nthw_pca9532_set_led_on(drv->fpga_info.mp_nthw_agx.p_pca9532_led, led_pos + 1,
+			led_on);
+	}
+
+	nthw_phy_tile_set_timestamp_comp_rx(p, port, 0);
+
+	if (ctx->specific_u.qsfp.specific_u.qsfp28.media_side_fec_ena) {
+		/* Updated after mail from JKH 2023-02-07 */
+		nthw_phy_tile_set_timestamp_comp_rx(p, port, 0x9E);
+		/* TODO Hermosa Awaiting comp values to use */
+
+	} else {
+		/* TODO Hermosa Awaiting comp values to use */
+		nthw_phy_tile_set_timestamp_comp_rx(p, port, 0);
+	}
+
+	adjust_maturing_delay(drv, port);	/* MUST be called after timestampCompRx */
+}
+
+static void get_link_state(adapter_info_t *drv, nim_i2c_ctx_p ctx, link_state_t *state, int port)
+{
+	uint32_t local_fault;
+	uint32_t remote_fault;
+	nt_link_state_t curr_link_state;
+
+	nthw_phy_tile_t *p = drv->fpga_info.mp_nthw_agx.p_phy_tile;
+
+	/* Save the current state before reading the new */
+	curr_link_state = state->link_state;
+
+	phy_get_link_state(drv, port, &state->link_state, &state->link_state_latched, &local_fault,
+		&remote_fault);
+
+	if (curr_link_state != state->link_state)
+		NT_LOG(DBG, NTNIC, "Port %d: Faults(Local = %d, Remote = %d)", port, local_fault,
+			remote_fault);
+
+	state->nim_present = nim_is_present(ctx, port);
+
+	if (!state->nim_present)
+		return;	/* No nim so no need to do anything */
+
+	state->link_up = state->link_state == NT_LINK_STATE_UP ? true : false;
+
+	if (state->link_state == NT_LINK_STATE_UP)
+		return;	/* The link is up so no need to do anything else */
+
+	if (remote_fault == 0) {
+		phy_reset_rx(drv, port);
+		NT_LOG(DBG, NTNIC, "Port %u: resetRx due to local fault.", port);
+		return;
+	}
+
+	/* In case of too many errors perform a reset */
+	if (nthw_phy_tile_get_rx_hi_ber(p, port)) {
+		NT_LOG(INF, NTNIC, "Port %u: HiBer", port);
+		phy_reset_rx(drv, port);
+		return;
+	}
+
+	/* If FEC is not enabled then no reason to look at FEC state */
+	if (!ctx->specific_u.qsfp.specific_u.qsfp28.media_side_fec_ena ||
+		nthw_phy_tile_read_fec_enabled_by_scratch(p, port)) {
+		return;
+	}
+
+	if (!nthw_phy_tile_get_rx_am_lock(p, port))
+		phy_reset_rx(drv, port);
+}
+
 /*
  * Utility functions
  */
@@ -645,6 +806,7 @@ static void *_common_ptp_nim_state_machine(void *data)
 
 	while (monitor_task_is_running[adapter_no]) {
 		int i;
+		static bool reported_link[NUM_ADAPTER_PORTS_MAX] = { false };
 
 		for (i = 0; i < nb_ports; i++) {
 			const bool is_port_disabled = link_info->port_action[i].port_disable;
@@ -691,12 +853,14 @@ static void *_common_ptp_nim_state_machine(void *data)
 				continue;
 			}
 
+			get_link_state(drv, nim_ctx, &link_state[i], i);
 			link_state[i].link_disabled = is_port_disabled;
 
 			if (!link_state[i].nim_present) {
 				if (!link_state[i].lh_nim_absent) {
 					NT_LOG(INF, NTNIC, "%s: NIM module removed",
 						drv->mp_port_id_str[i]);
+					reported_link[i] = false;
 					link_state[i].link_up = false;
 					link_state[i].lh_nim_absent = true;
 
@@ -707,6 +871,13 @@ static void *_common_ptp_nim_state_machine(void *data)
 
 				continue;
 			}
+
+			if (reported_link[i] != link_state[i].link_up) {
+				NT_LOG(INF, NTNIC, "%s: link is %s", drv->mp_port_id_str[i],
+					(link_state[i].link_up ? "up" : "down"));
+				reported_link[i] = link_state[i].link_up;
+				set_link_state(drv, nim_ctx, &link_state[i], i);
+			}
 		}
 
 		if (monitor_task_is_running[adapter_no])
drivers/net/ntnic/meson.build +1 -0
index b1505c5549..92aad6f94d 100644
@@ -55,6 +55,7 @@ sources = files(
         'nthw/core/nthw_iic.c',
         'nthw/core/nthw_mac_pcs.c',
         'nthw/core/nthw_pcie3.c',
+        'nthw/core/nthw_pca9532.c',
         'nthw/core/nthw_pcal6416a.c',
         'nthw/core/nthw_phy_tile.c',
         'nthw/core/nthw_si5332_si5156.c',
drivers/net/ntnic/nthw/core/include/nthw_pca9532.h new file +22 -0
new file mode 100644
index 0000000000..24da937a18
@@ -0,0 +1,22 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_PCA9532_H__
+#define __NTHW_PCA9532_H__
+
+#include "nthw_si5332_si5156.h"
+
+struct nthw_pca9532 {
+	nthw_i2cm_t *mp_nt_i2cm;
+	uint8_t m_dev_address;
+	nthw_pca9849_t *mp_ca9849;
+	uint8_t m_mux_channel;
+};
+
+typedef struct nthw_pca9532 nthw_pca9532_t;
+
+void nthw_pca9532_set_led_on(nthw_pca9532_t *p, uint8_t led_pos, bool state_on);
+
+#endif	/* __NTHW_PCA9532_H__ */
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h +9 -0
index c810f55c0d..f84aef44a9 100644
@@ -74,8 +74,17 @@ void nthw_phy_tile_set_host_loopback(nthw_phy_tile_t *p, uint8_t intf_no, uint8_
 void nthw_phy_tile_set_tx_equalization(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
 	uint32_t pre_tap2, uint32_t main_tap, uint32_t pre_tap1,
 	uint32_t post_tap1);
+void nthw_phy_tile_get_link_summary(nthw_phy_tile_t *p, uint32_t *p_nt_phy_link_state,
+	uint32_t *p_ll_nt_phy_link_state, uint32_t *p_lh_local_fault,
+	uint32_t *p_lh_remote_fault, uint8_t index);
 void nthw_phy_tile_set_tx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset);
 void nthw_phy_tile_set_rx_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset);
+bool nthw_phy_tile_read_fec_enabled_by_scratch(nthw_phy_tile_t *p, uint8_t intf_no);
+
+bool nthw_phy_tile_get_rx_hi_ber(nthw_phy_tile_t *p, uint8_t intf_no);
+bool nthw_phy_tile_get_rx_am_lock(nthw_phy_tile_t *p, uint8_t intf_no);
+void nthw_phy_tile_set_timestamp_comp_rx(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t value);
+uint32_t nthw_phy_tile_get_timestamp_comp_rx(nthw_phy_tile_t *p, uint8_t intf_no);
 
 uint32_t nthw_phy_tile_read_eth(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t address);
 void nthw_phy_tile_write_eth(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t address, uint32_t data);
drivers/net/ntnic/nthw/core/nthw_pca9532.c new file +40 -0
new file mode 100644
index 0000000000..fcf5463fcb
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include <pthread.h>
+
+#include "nt_util.h"
+#include "ntlog.h"
+
+#include "nthw_drv.h"
+#include "nthw_register.h"
+
+#include "nthw_pca9532.h"
+
+static const uint8_t led_sel_reg[4] = { 6, 7, 8, 9 };
+
+void nthw_pca9532_set_led_on(nthw_pca9532_t *p, uint8_t led_pos, bool state_on)
+{
+	if (led_pos >= 16) {
+		NT_LOG(ERR, NTHW, "Led pos (%u) out of range", led_pos);
+		return;
+	}
+
+	rte_spinlock_lock(&p->mp_nt_i2cm->i2cmmutex);
+	nthw_pca9849_set_channel(p->mp_ca9849, p->m_mux_channel);
+
+	uint8_t reg_addr = led_sel_reg[led_pos / 4];
+	uint8_t bit_pos = (uint8_t)((led_pos % 4) * 2);
+	uint8_t data = 0U;
+
+	nthw_i2cm_read(p->mp_nt_i2cm, p->m_dev_address, reg_addr, &data);
+	data = data & (uint8_t)(~(0b11 << bit_pos));	/* Set bits to "00" aka off */
+
+	if (state_on)
+		data = (uint8_t)(data | (0b01 << bit_pos));
+
+	nthw_i2cm_write(p->mp_nt_i2cm, p->m_dev_address, reg_addr, data);
+	rte_spinlock_unlock(&p->mp_nt_i2cm->i2cmmutex);
+}
drivers/net/ntnic/nthw/core/nthw_phy_tile.c +50 -1

63 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +2 -0
index 1fc8df52ce..a3c54846f5 100644
@@ -11,6 +11,7 @@
 
 #include "nthw_si5332_si5156.h"
 #include "nthw_pcal6416a.h"
+#include "nthw_pca9532.h"
 #include "nthw_phy_tile.h"
 #include "nthw_rpf.h"
 #include "nthw_phy_tile.h"
@@ -22,6 +23,7 @@ typedef struct nthw_agx_s {
 	nthw_i2cm_t *p_i2cm;
 	nthw_pca9849_t *p_pca9849;
 	nthw_pcal6416a_t *p_io_nim;	/* PCAL6416A I/O expander for controlling TS */
+	nthw_pca9532_t *p_pca9532_led;
 	nthw_phy_tile_t *p_phy_tile;
 	nthw_rpf_t *p_rpf;
 } nthw_agx_t;
Signature · 1 line
2.45.0
#11 lore raw

PATCH 11/32 net/ntnic: add port init to the state machine

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Handle NIM module insertion and initialization

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +33 -0
index 00a30f24a5..33d39ce62f 100644
@@ -872,6 +872,39 @@ static void *_common_ptp_nim_state_machine(void *data)
 				continue;
 			}
 
+			/*
+			 * NIM module is present
+			 */
+			if (link_state[i].lh_nim_absent && link_state[i].nim_present) {
+				sfp_nim_state_t new_state;
+				NT_LOG(INF, NTNIC, "%s: NIM module inserted",
+					drv->mp_port_id_str[i]);
+
+				if (_port_init(drv, fpga, i)) {
+					NT_LOG(ERR, NTNIC,
+						"%s: Failed to initialize NIM module",
+						drv->mp_port_id_str[i]);
+					continue;
+				}
+
+				if (nim_state_build(&nim_ctx[i], &new_state)) {
+					NT_LOG(ERR, NTNIC, "%s: Cannot read basic NIM data",
+						drv->mp_port_id_str[i]);
+					continue;
+				}
+
+				assert(new_state.br);	/* Cannot be zero if NIM is present */
+				NT_LOG(DBG, NTNIC,
+					"%s: NIM id = %u (%s), br = %u, vendor = '%s', pn = '%s', sn='%s'",
+					drv->mp_port_id_str[i], nim_ctx->nim_id,
+					nim_id_to_text(nim_ctx->nim_id), (unsigned int)new_state.br,
+					nim_ctx->vendor_name, nim_ctx->prod_no, nim_ctx->serial_no);
+				link_state[i].lh_nim_absent = false;
+				NT_LOG(DBG, NTNIC, "%s: NIM module initialized",
+					drv->mp_port_id_str[i]);
+				continue;
+			}
+
 			if (reported_link[i] != link_state[i].link_up) {
 				NT_LOG(INF, NTNIC, "%s: link is %s", drv->mp_port_id_str[i],
 					(link_state[i].link_up ? "up" : "down"));
Signature · 1 line
2.45.0
#12 lore raw

PATCH 12/32 net/ntnic: add port disable API

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Added logic to check if the administrative port state has changed.

---
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c +19 -0
index 33d39ce62f..3f59c4a6b8 100644
@@ -501,6 +501,14 @@ set_loopback(struct adapter_info_s *p_adapter_info, int port, uint32_t mode, uin
 	nt_os_wait_usec(10000);	/* 10ms - arbitrary choice */
 }
 
+static void port_disable(adapter_info_t *drv, int port)
+{
+	nim_i2c_ctx_t *nim_ctx = &drv->nt4ga_link.u.nim_ctx[port];
+	phy_reset_rx(drv, port);
+	phy_reset_tx(drv, port);
+	set_nim_low_power(nim_ctx, port, true);
+}
+
 /*
  * Initialize NIM, Code based on nt400d1x.cpp: MyPort::createNim()
  */
@@ -822,6 +830,17 @@ static void *_common_ptp_nim_state_machine(void *data)
 			 */
 			assert(!(disable_port && enable_port));
 
+			if (disable_port) {
+				memset(&link_state[i], 0, sizeof(link_state[i]));
+				link_state[i].link_disabled = true;
+				link_state[i].lh_nim_absent = true;
+				reported_link[i] = false;
+				port_disable(drv, i);
+				NT_LOG(INF, NTNIC, "%s: Port %i is disabled",
+					drv->mp_port_id_str[i], i);
+				continue;
+			}
+
 			if (enable_port) {
 				link_state[i].link_disabled = false;
 				NT_LOG(DBG, NTNIC, "%s: Port %i is enabled",
Signature · 1 line
2.45.0
#13 lore raw

PATCH 13/32 net/ntnic: add minimal initialization new NIC NT400D13

In reply to Serhii Iliushyk

Add function and structures required to init the new NIC NT400D13

---
 doc/guides/nics/ntnic.rst                     |  7 +++++-
 doc/guides/rel_notes/release_25_03.rst        |  4 ++++
 drivers/net/ntnic/meson.build                 |  1 +
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |  8 +++++++
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   | 23 +++++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_fpga.c       | 20 ++++++++++++++++
 drivers/net/ntnic/nthw/nthw_platform.c        |  3 +++
 drivers/net/ntnic/nthw/nthw_platform_drv.h    |  2 ++
 drivers/net/ntnic/ntnic_ethdev.c              |  1 +
 9 files changed, 68 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c
doc/guides/nics/ntnic.rst +6 -1
index f186822504..f519a9f083 100644
@@ -27,8 +27,13 @@ Supported NICs
 
     - FPGA ID 9563 (Inline Flow Management)
 
-All information about NT200A02 can be found by link below:
+- NT400D13 2x100G SmartNIC
+
+    - FPGA ID 9574 (Inline Flow Management)
+
+All information about NT200A02 and NT400D13 can be found by links below:
 https://www.napatech.com/products/nt200a02-smartnic-inline/
+https://www.napatech.com/support/resources/data-sheets/link-inline-software-for-napatech/
 
 
 Features
doc/guides/rel_notes/release_25_03.rst +4 -0
index 8867a4bd74..8064a2e688 100644
@@ -123,6 +123,10 @@ New Features
     This feature enhances the efficiency of probing VF/SFs on a large scale
     by significantly reducing the probing time.
 
+* **Updated Napatech ntnic driver.**
+
+  * Added support for the NT400D13 adapter.
+
 * **Updated Wangxun ngbe driver.**
 
   * Added support for virtual function (VF).
drivers/net/ntnic/meson.build +1 -0
index 92aad6f94d..d56e85dd66 100644
@@ -43,6 +43,7 @@ sources = files(
         'nthw/supported/nthw_fpga_mod_str_map.c',
         'nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c',
         'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c',
+        'nthw/core/nt400dxx/nthw_fpga_nt400dxx.c',
         'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c',
         'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
         'nthw/core/nthw_fpga.c',
drivers/net/ntnic/nthw/core/include/nthw_fpga.h +8 -0
index cee1d23090..8b1d548a25 100644
@@ -36,4 +36,12 @@ void register_nt200a0x_ops(struct nt200a0x_ops *ops);
 struct nt200a0x_ops *get_nt200a0x_ops(void);
 void nt200a0x_ops_init(void);
 
+struct nt400dxx_ops {
+	int (*nthw_fpga_nt400dxx_init)(struct fpga_info_s *p_fpga_info);
+};
+
+void register_nt400dxx_ops(struct nt400dxx_ops *ops);
+struct nt400dxx_ops *get_nt400dxx_ops(void);
+void nt400dxx_ops_init(void);
+
 #endif	/* __NTHW_FPGA_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c new file +23 -0
new file mode 100644
index 0000000000..3f86843ff3
@@ -0,0 +1,23 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "nthw_fpga.h"
+#include "ntnic_mod_reg.h"
+
+
+static int nthw_fpga_nt400dxx_init(struct fpga_info_s *p_fpga_info)
+{
+	assert(p_fpga_info);
+	int res = -1;
+
+	return res;
+}
+
+static struct nt400dxx_ops nt400dxx_ops = { .nthw_fpga_nt400dxx_init = nthw_fpga_nt400dxx_init };
+
+void nt400dxx_ops_init(void)
+{
+	register_nt400dxx_ops(&nt400dxx_ops);
+}
drivers/net/ntnic/nthw/core/nthw_fpga.c +20 -0
index 5ca186209a..e54a210c9f 100644
@@ -266,6 +266,7 @@ int nthw_fpga_init(struct fpga_info_s *p_fpga_info)
 	p_fpga_info->mp_nthw_rac = p_nthw_rac;
 
 	struct nt200a0x_ops *nt200a0x_ops = get_nt200a0x_ops();
+	struct nt400dxx_ops *nt400dxx_ops = get_nt400dxx_ops();
 
 	switch (p_fpga_info->n_nthw_adapter_id) {
 	case NT_HW_ADAPTER_ID_NT200A02:
@@ -273,6 +274,11 @@ int nthw_fpga_init(struct fpga_info_s *p_fpga_info)
 			res = nt200a0x_ops->nthw_fpga_nt200a0x_init(p_fpga_info);
 		break;
 
+	case NT_HW_ADAPTER_ID_NT400D13:
+		if (nt400dxx_ops != NULL)
+			res = nt400dxx_ops->nthw_fpga_nt400dxx_init(p_fpga_info);
+		break;
+
 	default:
 		NT_LOG(ERR, NTHW, "%s: Unsupported HW product id: %d", p_adapter_id_str,
 			p_fpga_info->n_nthw_adapter_id);
@@ -398,3 +404,17 @@ struct nt200a0x_ops *get_nt200a0x_ops(void)
 		nt200a0x_ops_init();
 	return nt200a0x_ops;
 }
+
+static struct nt400dxx_ops *nt400dxx_ops;
+
+void register_nt400dxx_ops(struct nt400dxx_ops *ops)
+{
+	nt400dxx_ops = ops;
+}
+
+struct nt400dxx_ops *get_nt400dxx_ops(void)
+{
+	if (nt400dxx_ops == NULL)
+		nt400dxx_ops_init();
+	return nt400dxx_ops;
+}
drivers/net/ntnic/nthw/nthw_platform.c +3 -0
index 33e18e549f..80063c9d25 100644
@@ -11,6 +11,9 @@ nthw_adapter_id_t nthw_platform_get_nthw_adapter_id(const uint16_t n_pci_device_
 	case NT_HW_PCI_DEVICE_ID_NT200A02:
 		return NT_HW_ADAPTER_ID_NT200A02;
 
+	case NT_HW_PCI_DEVICE_ID_NT400D13:
+		return NT_HW_ADAPTER_ID_NT400D13;
+
 	default:
 		return NT_HW_ADAPTER_ID_UNKNOWN;
 	}
drivers/net/ntnic/nthw/nthw_platform_drv.h +2 -0
index 42eb0b8b05..df54dcead0 100644
@@ -10,10 +10,12 @@
 
 #define NT_HW_PCI_VENDOR_ID (0x18f4)
 #define NT_HW_PCI_DEVICE_ID_NT200A02 (0x1C5)
+#define NT_HW_PCI_DEVICE_ID_NT400D13 (0x295)
 
 enum nthw_adapter_id_e {
 	NT_HW_ADAPTER_ID_UNKNOWN = 0,
 	NT_HW_ADAPTER_ID_NT200A02,
+	NT_HW_ADAPTER_ID_NT400D13,
 };
 
 typedef enum nthw_adapter_id_e nthw_adapter_id_t;
drivers/net/ntnic/ntnic_ethdev.c +1 -0
index 1b6b222c9d..88f6b6af6b 100644
@@ -91,6 +91,7 @@ static const char *const valid_arguments[] = {
 
 static const struct rte_pci_id nthw_pci_id_map[] = {
 	{ RTE_PCI_DEVICE(NT_HW_PCI_VENDOR_ID, NT_HW_PCI_DEVICE_ID_NT200A02) },
+	{ RTE_PCI_DEVICE(NT_HW_PCI_VENDOR_ID, NT_HW_PCI_DEVICE_ID_NT400D13) },
 	{
 		.vendor_id = 0,
 	},	/* sentinel */
Signature · 1 line
2.45.0
#14 lore raw

PATCH 14/32 net/ntnic: add minimal reset FPGA

In reply to Serhii Iliushyk

Define and register FPGA reset operations.

---
 .../include/ntnic_nthw_fpga_rst_nt400dxx.h    | 34 +++++++
 drivers/net/ntnic/meson.build                 |  2 +
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   | 88 ++++++++++++++++++-
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   | 40 +++++++++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 33 +++++++
 drivers/net/ntnic/ntnic_mod_reg.c             | 30 +++++++
 drivers/net/ntnic/ntnic_mod_reg.h             | 21 +++++
 7 files changed, 247 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt400dxx.h new file +34 -0
new file mode 100644
index 0000000000..2f04907ac9
@@ -0,0 +1,34 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2024 Napatech A/S
+ */
+
+#ifndef __NTNIC_NTHW_FPGA_RST_NT400DXX_H__
+#define __NTNIC_NTHW_FPGA_RST_NT400DXX_H__
+
+#include "nthw_drv.h"
+#include "nthw_fpga_model.h"
+
+struct nthw_fpga_rst_nt400dxx {
+	int n_fpga_product_id;
+	int n_fpga_version;
+	int n_fpga_revision;
+	int n_hw_id;
+	bool mb_is_nt400d11;
+
+	nthw_field_t *p_fld_rst_sys;
+	nthw_field_t *p_fld_rst_ddr4;
+	nthw_field_t *p_fld_rst_phy_ftile;
+
+	nthw_field_t *p_fld_stat_ddr4_calib_complete;
+	nthw_field_t *p_fld_stat_phy_ftile_rst_done;
+	nthw_field_t *p_fld_stat_phy_ftile_rdy;
+
+	nthw_field_t *p_fld_latch_ddr4_calib_complete;
+	nthw_field_t *p_fld_latch_phy_ftile_rst_done;
+	nthw_field_t *p_fld_latch_phy_ftile_rdy;
+};
+
+typedef struct nthw_fpga_rst_nt400dxx nthw_fpga_rst_nt400dxx_t;
+
+#endif	/* __NTHW_FPGA_RST_NT400DXX_H__ */
drivers/net/ntnic/meson.build +2 -0
index d56e85dd66..5a159f8bc6 100644
@@ -45,7 +45,9 @@ sources = files(
         'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c',
         'nthw/core/nt400dxx/nthw_fpga_nt400dxx.c',
         'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c',
+        'nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c',
         'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
+        'nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c',
         'nthw/core/nthw_fpga.c',
         'nthw/core/nthw_gmf.c',
         'nthw/core/nthw_gfg.c',
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +87 -1

100 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c new file +40 -0
new file mode 100644
index 0000000000..9ab26583df
@@ -0,0 +1,40 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+#include "nthw_drv.h"
+#include "nthw_register.h"
+#include "nthw_fpga.h"
+
+#include "ntnic_nthw_fpga_rst_nt400dxx.h"
+#include "ntnic_mod_reg.h"
+
+static int nthw_fpga_rst9574_setup(nthw_fpga_t *p_fpga, struct nthw_fpga_rst_nt400dxx *const p)
+{
+	assert(p_fpga);
+	assert(p);
+
+	return 0;
+};
+
+
+
+static int nthw_fpga_rst9574_init(struct fpga_info_s *p_fpga_info,
+	struct nthw_fpga_rst_nt400dxx *p_rst)
+{
+	assert(p_fpga_info);
+	assert(p_rst);
+	int res = -1;
+
+	return res;
+}
+
+static struct rst9574_ops rst9574_ops = {
+	.nthw_fpga_rst9574_init = nthw_fpga_rst9574_init,
+	.nthw_fpga_rst9574_setup = nthw_fpga_rst9574_setup,
+};
+
+void rst9574_ops_init(void)
+{
+	register_rst9574_ops(&rst9574_ops);
+}
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c new file +33 -0
new file mode 100644
index 0000000000..e0e4bc0861
@@ -0,0 +1,33 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#include "ntlog.h"
+#include "nthw_drv.h"
+#include "nthw_register.h"
+#include "nthw_fpga.h"
+#include "nthw_hif.h"
+#include "ntnic_mod_reg.h"
+
+static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
+{
+	assert(p_fpga_info);
+	return 0;
+}
+
+static int nthw_fpga_rst_nt400dxx_reset(struct fpga_info_s *p_fpga_info)
+{
+	assert(p_fpga_info);
+	return 0;
+}
+
+static struct rst_nt400dxx_ops rst_nt400dxx_ops = {
+	.nthw_fpga_rst_nt400dxx_init = nthw_fpga_rst_nt400dxx_init,
+	.nthw_fpga_rst_nt400dxx_reset = nthw_fpga_rst_nt400dxx_reset
+};
+
+void rst_nt400dxx_ops_init(void)
+{
+	register_rst_nt400dxx_ops(&rst_nt400dxx_ops);
+}
drivers/net/ntnic/ntnic_mod_reg.c +30 -0
index 598df08fb7..054b343fe7 100644
@@ -178,6 +178,36 @@ void register_flow_backend_ops(const struct flow_backend_ops *ops)
 	flow_backend_ops = ops;
 }
 
+static struct rst9574_ops *rst9574_ops;
+
+void register_rst9574_ops(struct rst9574_ops *ops)
+{
+	rst9574_ops = ops;
+}
+
+struct rst9574_ops *get_rst9574_ops(void)
+{
+	if (rst9574_ops == NULL)
+		rst9574_ops_init();
+
+	return rst9574_ops;
+}
+
+static struct rst_nt400dxx_ops *rst_nt400dxx_ops;
+
+void register_rst_nt400dxx_ops(struct rst_nt400dxx_ops *ops)
+{
+	rst_nt400dxx_ops = ops;
+}
+
+struct rst_nt400dxx_ops *get_rst_nt400dxx_ops(void)
+{
+	if (rst_nt400dxx_ops == NULL)
+		rst_nt400dxx_ops_init();
+
+	return rst_nt400dxx_ops;
+}
+
 const struct flow_backend_ops *get_flow_backend_ops(void)
 {
 	if (flow_backend_ops == NULL)
drivers/net/ntnic/ntnic_mod_reg.h +21 -0
index 3e84beaa62..9b3650da89 100644
@@ -19,6 +19,7 @@
 #include "nthw_drv.h"
 #include "nt4ga_adapter.h"
 #include "ntnic_nthw_fpga_rst_nt200a0x.h"
+#include "ntnic_nthw_fpga_rst_nt400dxx.h"
 #include "ntnic_virt_queue.h"
 #include "create_elements.h"
 
@@ -255,6 +256,26 @@ void register_rst9563_ops(struct rst9563_ops *ops);
 struct rst9563_ops *get_rst9563_ops(void);
 void rst9563_ops_init(void);
 
+struct rst9574_ops {
+	int (*nthw_fpga_rst9574_init)(struct fpga_info_s *p_fpga_info,
+		struct nthw_fpga_rst_nt400dxx *const p);
+	int (*nthw_fpga_rst9574_setup)(nthw_fpga_t *p_fpga,
+		struct nthw_fpga_rst_nt400dxx *const p);
+};
+
+void register_rst9574_ops(struct rst9574_ops *ops);
+struct rst9574_ops *get_rst9574_ops(void);
+void rst9574_ops_init(void);
+
+struct rst_nt400dxx_ops {
+	int (*nthw_fpga_rst_nt400dxx_init)(struct fpga_info_s *p_fpga_info);
+	int (*nthw_fpga_rst_nt400dxx_reset)(struct fpga_info_s *p_fpga_info);
+};
+
+void register_rst_nt400dxx_ops(struct rst_nt400dxx_ops *ops);
+struct rst_nt400dxx_ops *get_rst_nt400dxx_ops(void);
+void rst_nt400dxx_ops_init(void);
+
 struct flow_backend_ops {
 	const struct flow_api_backend_ops *(*bin_flow_backend_init)(nthw_fpga_t *p_fpga,
 		void **be_dev);
Signature · 1 line
2.45.0
#15 lore raw

PATCH 15/32 net/ntnic: add FPGA modules and registers

In reply to Serhii Iliushyk

Extend driver with new fpga modules for NT400DXX card.

---
 drivers/net/ntnic/meson.build                 |    1 +
 .../supported/nthw_fpga_9574_055_049_0000.c   | 3124 +++++++++++++++++
 .../nthw/supported/nthw_fpga_instances.c      |    5 +-
 .../nthw/supported/nthw_fpga_instances.h      |    1 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   11 +
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   11 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   11 +
 .../nthw/supported/nthw_fpga_reg_defs_igam.h  |   32 +
 .../supported/nthw_fpga_reg_defs_pci_ta.h     |   33 +
 .../nthw_fpga_reg_defs_pcm_nt400dxx.h         |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_pdi.h   |   49 +
 .../supported/nthw_fpga_reg_defs_phy_tile.h   |  213 ++
 .../nthw_fpga_reg_defs_prm_nt400dxx.h         |   26 +
 .../nthw/supported/nthw_fpga_reg_defs_rfd.h   |   38 +
 .../supported/nthw_fpga_reg_defs_rst9574.h    |   35 +
 .../nthw/supported/nthw_fpga_reg_defs_spim.h  |   76 +
 .../nthw/supported/nthw_fpga_reg_defs_spis.h  |   51 +
 .../nthw/supported/nthw_fpga_reg_defs_tint.h  |   28 +
 18 files changed, 3773 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9574_055_049_0000.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9574.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h
drivers/net/ntnic/meson.build +1 -0
index 5a159f8bc6..aec7b52714 100644
@@ -39,6 +39,7 @@ sources = files(
         'ntnic_xstats/ntnic_xstats.c',
         'nthw/dbs/nthw_dbs.c',
         'nthw/supported/nthw_fpga_9563_055_049_0000.c',
+        'nthw/supported/nthw_fpga_9574_055_049_0000.c',
         'nthw/supported/nthw_fpga_instances.c',
         'nthw/supported/nthw_fpga_mod_str_map.c',
         'nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c',
drivers/net/ntnic/nthw/supported/nthw_fpga_9574_055_049_0000.c new file +3124 -0

2,993 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c +4 -1
index c8a310c415..634095646c 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h +1 -0
index 3e5983f763..ad0e700bfd 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +11 -0
index e6ed9e714b..e2a98a737a 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c +11 -0
index 459cc724c2..a0afa22579 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +11 -0
index 4d299c6aa8..5b824ef3e5 100644

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h new file +32 -0
new file mode 100644
index 0000000000..dd247ef0dd

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h new file +33 -0
new file mode 100644
index 0000000000..d9a0b4f381

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h new file +29 -0
new file mode 100644
index 0000000000..fadb8c17e8

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h new file +49 -0

49 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h new file +213 -0

213 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h new file +26 -0
new file mode 100644
index 0000000000..7855c9cab5

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h new file +38 -0
new file mode 100644
index 0000000000..18b67f4032

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9574.h new file +35 -0
new file mode 100644
index 0000000000..90aeaec3a4

Lines of this file are not shown. View the raw message.

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h new file +76 -0

76 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h new file +51 -0

51 lines not on this page · raw message

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h new file +28 -0
new file mode 100644
index 0000000000..acfc07a1b6

Lines of this file are not shown. View the raw message.

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.45.0

Part of the diff is not shown here. View the raw message.

#16 lore raw

PATCH 16/32 net/ntnic: add setup for fpga reset

In reply to Serhii Iliushyk

Initialize FPGA reset module and register fields.

---
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   | 54 +++++++++++++++++++
 1 file changed, 54 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c +54 -0
index 9ab26583df..bd38d6b8c8 100644
@@ -14,6 +14,60 @@ static int nthw_fpga_rst9574_setup(nthw_fpga_t *p_fpga, struct nthw_fpga_rst_nt4
 	assert(p_fpga);
 	assert(p);
 
+	const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str;
+	const int n_fpga_product_id = p_fpga->mn_product_id;
+	const int n_fpga_version = p_fpga->mn_fpga_version;
+	const int n_fpga_revision = p_fpga->mn_fpga_revision;
+
+	nthw_module_t *p_mod_rst;
+	nthw_register_t *p_curr_reg;
+
+	p->n_fpga_product_id = n_fpga_product_id;
+	p->n_fpga_version = n_fpga_version;
+	p->n_fpga_revision = n_fpga_revision;
+
+	NT_LOG(DBG, NTHW, "%s: %s: FPGA reset setup: FPGA %04d-%02d-%02d", p_adapter_id_str,
+		__func__, n_fpga_product_id, n_fpga_version, n_fpga_revision);
+
+	p_mod_rst = nthw_fpga_query_module(p_fpga, MOD_RST9574, 0);
+
+	if (p_mod_rst == NULL) {
+		NT_LOG(ERR, NTHW, "%s: RST %d: no such instance", p_adapter_id_str, 0);
+		return -1;
+	}
+
+	p_mod_rst = nthw_fpga_query_module(p_fpga, MOD_RST9574, 0);
+
+	if (p_mod_rst == NULL) {
+		NT_LOG(ERR, NTHW, "%s: RST %d: no such instance", p_adapter_id_str, 0);
+		return -1;
+	}
+
+	/* RST register field pointers */
+	p_curr_reg = nthw_module_get_register(p_mod_rst, RST9574_RST);
+	p->p_fld_rst_sys = nthw_register_get_field(p_curr_reg, RST9574_RST_SYS);
+	p->p_fld_rst_ddr4 = nthw_register_get_field(p_curr_reg, RST9574_RST_DDR4);
+	p->p_fld_rst_phy_ftile = nthw_register_get_field(p_curr_reg, RST9574_RST_PHY_FTILE);
+	nthw_register_update(p_curr_reg);
+
+	p_curr_reg = nthw_module_get_register(p_mod_rst, RST9574_STAT);
+	p->p_fld_stat_ddr4_calib_complete =
+		nthw_register_get_field(p_curr_reg, RST9574_STAT_DDR4_CALIB_COMPLETE);
+	p->p_fld_stat_phy_ftile_rst_done =
+		nthw_register_get_field(p_curr_reg, RST9574_STAT_PHY_FTILE_RST_DONE);
+	p->p_fld_stat_phy_ftile_rdy =
+		nthw_register_get_field(p_curr_reg, RST9574_STAT_PHY_FTILE_RDY);
+	nthw_register_update(p_curr_reg);
+
+	p_curr_reg = nthw_module_get_register(p_mod_rst, RST9574_LATCH);
+	p->p_fld_latch_ddr4_calib_complete =
+		nthw_register_get_field(p_curr_reg, RST9574_LATCH_DDR4_CALIB_COMPLETE);
+	p->p_fld_latch_phy_ftile_rst_done =
+		nthw_register_get_field(p_curr_reg, RST9574_LATCH_PHY_FTILE_RST_DONE);
+	p->p_fld_latch_phy_ftile_rdy =
+		nthw_register_get_field(p_curr_reg, RST9574_LATCH_PHY_FTILE_RDY);
+	nthw_register_update(p_curr_reg);
+
 	return 0;
 };
 
Signature · 1 line
2.45.0
#17 lore raw

PATCH 17/32 net/ntnic: add default reset setting for NT400D13

In reply to Serhii Iliushyk

Add DDR4 reset and calibration completion handling.

---
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   | 29 ++++++++++++++++++-
 1 file changed, 28 insertions(+), 1 deletion(-)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c +28 -1
index bd38d6b8c8..757ec1b4c6 100644
@@ -71,14 +71,41 @@ static int nthw_fpga_rst9574_setup(nthw_fpga_t *p_fpga, struct nthw_fpga_rst_nt4
 	return 0;
 };
 
+static void nthw_fpga_rst9574_set_default_rst_values(struct nthw_fpga_rst_nt400dxx *const p)
+{
+	nthw_field_update_register(p->p_fld_rst_sys);
+	nthw_field_set_all(p->p_fld_rst_sys);
+	nthw_field_set_val32(p->p_fld_rst_ddr4, 1);
+	nthw_field_set_val_flush32(p->p_fld_rst_phy_ftile, 1);
+}
+
+static int nthw_fpga_rst9574_product_reset(struct fpga_info_s *p_fpga_info,
+	struct nthw_fpga_rst_nt400dxx *p_rst)
+{
+	assert(p_fpga_info);
+	assert(p_rst);
 
+	const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str;
+
+	/* (0) Reset all domains / modules except peripherals: */
+	NT_LOG(DBG, NTHW, "%s: %s: RST defaults", p_adapter_id_str, __func__);
+	nthw_fpga_rst9574_set_default_rst_values(p_rst);
+
+	/*
+	 * Wait a while before waiting for deasserting ddr4 reset
+	 */
+	nt_os_wait_usec(2000);
+
+
+	return 0;
+}
 
 static int nthw_fpga_rst9574_init(struct fpga_info_s *p_fpga_info,
 	struct nthw_fpga_rst_nt400dxx *p_rst)
 {
 	assert(p_fpga_info);
 	assert(p_rst);
-	int res = -1;
+	int res = nthw_fpga_rst9574_product_reset(p_fpga_info, p_rst);
 
 	return res;
 }
Signature · 1 line
2.45.0
#18 lore raw

PATCH 18/32 net/ntnic: add DDR calibration to reset stage

In reply to Serhii Iliushyk

Add DDR4 reset and calibration functions for FPGA.

---
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   | 95 +++++++++++++++++++
 1 file changed, 95 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c +95 -0
index 757ec1b4c6..27d60d1448 100644
@@ -79,6 +79,72 @@ static void nthw_fpga_rst9574_set_default_rst_values(struct nthw_fpga_rst_nt400d
 	nthw_field_set_val_flush32(p->p_fld_rst_phy_ftile, 1);
 }
 
+static void nthw_fpga_rst9574_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, uint32_t val)
+{
+	nthw_field_update_register(p->p_fld_rst_ddr4);
+	nthw_field_set_val_flush32(p->p_fld_rst_ddr4, val);
+}
+
+static bool nthw_fpga_rst9574_get_ddr4_calib_complete_stat(struct nthw_fpga_rst_nt400dxx *const p)
+{
+	return nthw_field_get_updated(p->p_fld_stat_ddr4_calib_complete) != 0;
+}
+
+static bool nthw_fpga_rst9574_get_ddr4_calib_complete_latch(struct nthw_fpga_rst_nt400dxx *const p)
+{
+	return nthw_field_get_updated(p->p_fld_latch_ddr4_calib_complete) != 0;
+}
+
+static void nthw_fpga_rst9574_set_ddr4_calib_complete_latch(struct nthw_fpga_rst_nt400dxx *const p,
+	uint32_t val)
+{
+	nthw_field_update_register(p->p_fld_latch_ddr4_calib_complete);
+	nthw_field_set_val_flush32(p->p_fld_latch_ddr4_calib_complete, val);
+}
+
+static int nthw_fpga_rst9574_wait_ddr4_calibration_complete(struct fpga_info_s *p_fpga_info,
+	struct nthw_fpga_rst_nt400dxx *p_rst)
+{
+	const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str;
+	uint32_t complete;
+	uint32_t retrycount;
+	uint32_t timeout;
+
+	/* 3: wait until DDR4 CALIB COMPLETE */
+	NT_LOG(DBG, NTHW, "%s: %s: DDR4 CALIB COMPLETE wait complete", p_adapter_id_str, __func__);
+	/*
+	 * The following retry count gives a total timeout of 1 * 5 + 5 * 8 = 45sec
+	 * It has been observed that at least 21sec can be necessary
+	 */
+	retrycount = 1;
+	timeout = 50000;/* initial timeout must be set to 5 sec. */
+
+	do {
+		complete = nthw_fpga_rst9574_get_ddr4_calib_complete_stat(p_rst);
+
+		if (!complete)
+			nt_os_wait_usec(100);
+
+		timeout--;
+
+		if (timeout == 0) {
+			if (retrycount == 0) {
+				NT_LOG(ERR, NTHW,
+					"%s: %s: Timeout waiting for DDR4 CALIB COMPLETE to be complete",
+					p_adapter_id_str, __func__);
+				return -1;
+			}
+
+			nthw_fpga_rst9574_ddr4_rst(p_rst, 1);	/* Reset DDR4 */
+			nthw_fpga_rst9574_ddr4_rst(p_rst, 0);
+			retrycount--;
+			timeout = 90000;/* Increase timeout for second attempt to 8 sec. */
+		}
+	} while (!complete);
+
+	return 0;
+}
+
 static int nthw_fpga_rst9574_product_reset(struct fpga_info_s *p_fpga_info,
 	struct nthw_fpga_rst_nt400dxx *p_rst)
 {
@@ -86,6 +152,7 @@ static int nthw_fpga_rst9574_product_reset(struct fpga_info_s *p_fpga_info,
 	assert(p_rst);
 
 	const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str;
+	int res = -1;
 
 	/* (0) Reset all domains / modules except peripherals: */
 	NT_LOG(DBG, NTHW, "%s: %s: RST defaults", p_adapter_id_str, __func__);
@@ -96,6 +163,34 @@ static int nthw_fpga_rst9574_product_reset(struct fpga_info_s *p_fpga_info,
 	 */
 	nt_os_wait_usec(2000);
 
+	/* (1) De-assert DDR4 reset: */
+	NT_LOG(DBG, NTHW, "%s: %s: De-asserting DDR4 reset", p_adapter_id_str, __func__);
+	nthw_fpga_rst9574_ddr4_rst(p_rst, 0);
+
+	/*
+	 * Wait a while before waiting for calibration complete, since calibration complete
+	 * is true while ddr4 is in reset
+	 */
+	nt_os_wait_usec(2000);
+
+	/* (2) Wait until DDR4 calibration complete */
+	res = nthw_fpga_rst9574_wait_ddr4_calibration_complete(p_fpga_info, p_rst);
+
+	if (res)
+		return res;
+
+	/* (3) Set DDR4 calib complete latched bits: */
+	nthw_fpga_rst9574_set_ddr4_calib_complete_latch(p_rst, 1);
+
+	/* Wait for phy to settle.*/
+	nt_os_wait_usec(20000);
+
+	/* (4) Ensure all latched status bits are still set: */
+	if (!nthw_fpga_rst9574_get_ddr4_calib_complete_latch(p_rst)) {
+		NT_LOG(ERR, NTHW, "%s: %s: DDR4 calibration complete has toggled",
+			p_adapter_id_str, __func__);
+	}
+
 
 	return 0;
 }
Signature · 1 line
2.45.0
#19 lore raw

PATCH 19/32 net/ntnic: add PHY ftile reset

In reply to Serhii Iliushyk

Add reset functions and reset procedure for module PHY FTILE

---
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  12 ++
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   | 161 ++++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   |  38 +++++
 3 files changed, 211 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h +12 -0
index f84aef44a9..68d8455b8d 100644
@@ -8,6 +8,10 @@
 
 #include "nthw_fpga_model.h"
 
+enum mac_pcs_mode_e {
+	MAC_PCS_MODE_2X100
+};
+
 struct nt_phy_tile {
 	nthw_fpga_t *mp_fpga;
 
@@ -16,6 +20,8 @@ struct nt_phy_tile {
 	int mn_fpga_version;
 	int mn_fpga_revision;
 
+	enum mac_pcs_mode_e mac_pcs_mode;
+
 	nthw_register_t *mp_reg_port_xcvr_base[2][4];
 	nthw_field_t *mp_fld_port_xcvr_base_ptr[2][4];
 	nthw_field_t *mp_fld_port_xcvr_base_busy[2][4];
@@ -39,6 +45,8 @@ struct nt_phy_tile {
 
 	nthw_field_t *mp_fld_port_status_rx_hi_ber[2];
 	nthw_field_t *mp_fld_port_status_rx_am_lock[2];
+	nthw_field_t *mp_fld_port_status_reset_ackn[2];
+	nthw_field_t *mp_fld_port_status_tx_lanes_stable[2];
 	nthw_field_t *mp_fld_port_status_tx_reset_ackn[2];
 	nthw_field_t *mp_fld_port_status_rx_reset_ackn[2];
 
@@ -93,5 +101,9 @@ uint32_t nthw_phy_tile_read_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t la
 	uint32_t address);
 void nthw_phy_tile_write_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane, uint32_t address,
 	uint32_t data);
+uint32_t nthw_phy_tile_get_port_status_reset_ack(nthw_phy_tile_t *p, uint8_t intf_no);
+uint32_t nthw_phy_tile_get_port_status_tx_lanes_stable(nthw_phy_tile_t *p, uint8_t intf_no);
+uint8_t nthw_phy_tile_get_no_intfs(nthw_phy_tile_t *p);
+void nthw_phy_tile_set_port_config_rst(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t value);
 
 #endif	/* __NTHW_PHY_TILE_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c +161 -0

190 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_phy_tile.c +38 -0
index b057e9e88c..a8c2d03be9 100644
@@ -44,6 +44,17 @@ static const uint32_t eth_soft_csr1 = 0x200;
 static const uint32_t eth_soft_csr2 = 0x204;
 static const uint32_t eth_soft_csr3 = 0x208;
 
+uint8_t nthw_phy_tile_get_no_intfs(nthw_phy_tile_t *p)
+{
+	switch (p->mac_pcs_mode) {
+	case MAC_PCS_MODE_2X100:
+		return 2;
+
+	default:
+		return 0;
+	}
+}
+
 static void nthw_phy_tile_set_reset(nthw_phy_tile_t *p, uint8_t intf_no, bool reset)
 {
 	/* Reset is active low */
@@ -543,3 +554,30 @@ bool nthw_phy_tile_configure_fec(nthw_phy_tile_t *p, uint8_t intf_no, bool enabl
 
 	return true;
 }
+
+uint32_t nthw_phy_tile_get_port_status_reset_ack(nthw_phy_tile_t *p, uint8_t intf_no)
+{
+	if (p->mp_fld_port_status_reset_ackn[intf_no]) {
+		return nthw_field_get_updated(p->mp_fld_port_status_reset_ackn[intf_no]) == 0
+			? 1
+			: 0;    /* Inverted */
+	}
+
+	return 1;
+}
+
+uint32_t nthw_phy_tile_get_port_status_tx_lanes_stable(nthw_phy_tile_t *p, uint8_t intf_no)
+{
+	if (p->mp_fld_port_status_tx_lanes_stable[intf_no])
+		return nthw_field_get_updated(p->mp_fld_port_status_tx_lanes_stable[intf_no]);
+
+	return 1;
+}
+
+void nthw_phy_tile_set_port_config_rst(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t value)
+{
+	if (p->mp_fld_port_config_reset[intf_no]) {
+		nthw_field_get_updated(p->mp_fld_port_config_reset[intf_no]);
+		nthw_field_set_val_flush32(p->mp_fld_port_config_reset[intf_no], value);
+	}
+}
Signature · 1 line
2.45.0
#20 lore raw

PATCH 20/32 net/ntnic: add clock init

In reply to Serhii Iliushyk

Add initialization for the clock subsystem

---
 ...00D13_U62_Si5332-GM2-RevD-1_V5-Registers.h | 425 ++++++++++++++++++
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |   1 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     |  14 +
 .../nthw/core/include/nthw_si5332_si5156.h    |  36 ++
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   | 115 ++++-
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       |  57 +++
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  |  93 ++++
 drivers/net/ntnic/nthw/nthw_drv.h             |   7 +-
 8 files changed, 745 insertions(+), 3 deletions(-)
 create mode 100644 drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h
drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h new file +425 -0
new file mode 100644
index 0000000000..f87828fcfe
@@ -0,0 +1,425 @@
+/*
+ * Si5332-GM2 Rev D Configuration Register Export Header File
+ *
+ * This file represents a series of Skyworks Si5332-GM2 Rev D
+ * register writes that can be performed to load a single configuration
+ * on a device. It was created by a Skyworks ClockBuilder Pro
+ * export tool.
+ *
+ * Part:		                                       Si5332-GM2 Rev D
+ * Design ID:                                          1
+ * Includes Pre/Post Download Control Register Writes: Yes
+ * Created By:                                         ClockBuilder Pro v4.5 [2022-08-23]
+ * Timestamp:                                          2022-10-11 15:44:24 GMT+02:00
+ *
+ * A complete design report corresponding to this export is included at the end
+ * of this header file.
+ *
+ */
+
+#ifndef SI5332_GM2_REVD_REG_CONFIG_HEADER
+#define SI5332_GM2_REVD_REG_CONFIG_HEADER
+
+#define SI5332_GM2_REVD_REG_CONFIG_NUM_REGS 76
+
+typedef struct {
+	unsigned int address;	/* 8-bit register address */
+	unsigned char value;	/* 8-bit register data */
+
+} si5332_gm2_revd_register_t;
+
+si5332_gm2_revd_register_t const si5332_gm2_revd_registers[SI5332_GM2_REVD_REG_CONFIG_NUM_REGS] = {
+	/* Start configuration preamble */
+	/*    Set device in Ready mode */
+	{ 0x0006, 0x01 },
+	/* End configuration preamble */
+
+	/* Start configuration registers */
+	{ 0x0017, 0x31 },
+	{ 0x0018, 0x00 },
+	{ 0x0019, 0x00 },
+	{ 0x001A, 0x00 },
+	{ 0x001B, 0x00 },
+	{ 0x001C, 0x00 },
+	{ 0x0021, 0x6A },
+	{ 0x0024, 0x01 },
+	{ 0x0025, 0x00 },
+	{ 0x0026, 0x00 },
+	{ 0x0027, 0x50 },
+	{ 0x0028, 0x50 },
+	{ 0x0029, 0x00 },
+	{ 0x002A, 0x00 },
+	{ 0x002B, 0x10 },
+	{ 0x0036, 0x07 },
+	{ 0x0037, 0x80 },
+	{ 0x0038, 0x02 },
+	{ 0x0039, 0x80 },
+	{ 0x003A, 0x05 },
+	{ 0x003B, 0x35 },
+	{ 0x003C, 0x00 },
+	{ 0x0048, 0x00 },
+	{ 0x0054, 0x00 },
+	{ 0x0060, 0x00 },
+	{ 0x0067, 0x19 },
+	{ 0x0068, 0x00 },
+	{ 0x0069, 0x00 },
+	{ 0x006A, 0x00 },
+	{ 0x006B, 0x00 },
+	{ 0x006C, 0x01 },
+	{ 0x0073, 0x00 },
+	{ 0x0074, 0x00 },
+	{ 0x0075, 0x01 },
+	{ 0x007A, 0x07 },
+	{ 0x007B, 0x01 },
+	{ 0x007C, 0x00 },
+	{ 0x007D, 0x00 },
+	{ 0x007F, 0x07 },
+	{ 0x0080, 0x01 },
+	{ 0x0081, 0x00 },
+	{ 0x0082, 0x00 },
+	{ 0x0089, 0x07 },
+	{ 0x008A, 0x01 },
+	{ 0x008B, 0x00 },
+	{ 0x008C, 0x00 },
+	{ 0x008E, 0x07 },
+	{ 0x008F, 0x01 },
+	{ 0x0090, 0x00 },
+	{ 0x0091, 0x00 },
+	{ 0x0098, 0x07 },
+	{ 0x0099, 0x01 },
+	{ 0x009A, 0x00 },
+	{ 0x009B, 0x00 },
+	{ 0x009D, 0x07 },
+	{ 0x009E, 0x01 },
+	{ 0x009F, 0x00 },
+	{ 0x00A0, 0x00 },
+	{ 0x00A7, 0x07 },
+	{ 0x00A8, 0x01 },
+	{ 0x00A9, 0x00 },
+	{ 0x00AA, 0x00 },
+	{ 0x00AC, 0x07 },
+	{ 0x00AD, 0x01 },
+	{ 0x00AE, 0x00 },
+	{ 0x00AF, 0x00 },
+	{ 0x00B6, 0xDB },
+	{ 0x00B7, 0x06 },
+	{ 0x00B9, 0x06 },
+	{ 0x00BA, 0x5E },
+	{ 0x00BB, 0x00 },
+	{ 0x00BC, 0x00 },
+	{ 0x00BD, 0x00 },
+	{ 0x00BE, 0x20 },
+	/* End configuration registers */
+
+	/* Start configuration postamble */
+	/*    Set device in Active mode */
+	{ 0x0006, 0x02 },
+	/* End configuration postamble */
+};
+
+/*
+ * Design Report
+ *
+ * Overview
+ * ========
+ * Part:               Si5332EFL Rev D
+ * Project File:       P:\Hardware\NT
+ * Adapters\NT400D13\design\Clock_syn_design\Si5332-GM2-RevD-1-Project_V5.slabtimeproj Design ID: 1
+ * Created By:         ClockBuilder Pro v4.5 [2022-08-23]
+ * Timestamp:          2022-10-11 15:44:24 GMT+02:00
+ *
+ * Design Rule Check
+ * =================
+ * Errors:
+ * - No errors
+ *
+ * Warnings:
+ * - OUT1 [156.25 MHz] and OUT2 [166.625 MHz] may have coupling [1]
+ * - OUT5 [166.625 MHz] and OUT6 [156.25 MHz] may have coupling [1]
+ *
+ * Footnotes:
+ * [1] To avoid coupling in outputs, Skyworks recommends the following:
+ *
+ * - Avoid adjacent frequency values that are close. CBPro uses an output's integration bandwidth
+ *   (IBW) to determine whether two adjacent frequencies are too close. An IBW of 20 MHz is used
+ *   for frequencies 80 MHz and larger. Lower frequencies will use IBW of OUT/4. CBPro will flag
+ *   fundamental coupling and coupling up to the fourth harmonic, where coupling
+ *   frequency = Absolute(OUTa*x - OUTb*y) for all combinations of x and y 1 through 4. If any one
+ *   of these values is less than or equal to the IBW, the output is flagged as having possible
+ *   coupling.
+ * - Adjacent frequency values that are integer multiples of one another are okay and these
+ *   outputs should be grouped accordingly.
+ * - Unused outputs can be used to separate clock outputs that might otherwise interfere
+ *   with one another.
+ *
+ * Skyworks recommends you validate your design's jitter performance using an Evaluation Board.
+ * You can request a custom phase noise report for your design from CBPro's design dashboard.
+ *
+ * Device Grade
+ * ============
+ * Maximum Output Frequency: 166.625 MHz
+ * Frequency Synthesis Mode: Fractional
+ * Frequency Plan Grade:     F
+ * Minimum Base OPN:         Si5332F*
+ *
+ * Base       Output Clock         Supported Frequency Synthesis Modes
+ * OPN Grade  Frequency Range      (Typical Jitter)
+ * ---------  ------------------  --------------------------------------------
+ * Si5332E    5 MHz to 334 MHz    Integer (~230 fs) and fractional (~500 fs)
+ * Si5332F*   5 MHz to 200 MHz    "
+ * Si5332G    5 MHz to 334 MHz    Integer only (~230 fs)
+ * Si5332H    5 MHz to 200 MHz    "
+ * Si5332L*   5 MHz to 334 MHz    Integer (~230 fs) and fractional (~500 fs)
+ *
+ * * Based on your calculated frequency plan, a Si5332F grade device is
+ * sufficient for your design. For more in-system configuration flexibility
+ * (higher frequencies and/or to enable fractional synthesis), consider
+ * selecting device grade Si5332E when specifying an ordering part number (OPN)
+ * for your application. See the datasheet Ordering Guide for more information.
+ *
+ * Design
+ * ======
+ * Base I2C Address: 0x6A
+ *
+ * Universal Hardware Input Pins:
+ *    INPUT1 (P10): None
+ *    INPUT2 (P19): None
+ *    INPUT3 (P20): None
+ *    INPUT4 (P31): None
+ *    INPUT5 (P32): None
+ *    INPUT6 (P36): None
+ *    INPUT7 (P37): None
+ *
+ * Inputs:
+ *    XAXB: 50 MHz
+ *          Crystal Mode
+ *  CLKIN2: Unused
+ *  CLKIN3: Unused
+ *
+ * Outputs:
+ *    OUT0: 156.25 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT1: 156.25 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT2: 166.625 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT3: 166.625 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT4: 166.625 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT5: 166.625 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT6: 156.25 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *    OUT7: 156.25 MHz LVDS Fast 1.8 V, Disabled-State: Stop Low
+ *          Power-up state: Enabled
+ *
+ * Frequency Plan
+ * ==============
+ * Fpfd = 50 MHz
+ * Fvco = 2.5 GHz
+ *
+ * P divider = 1
+ * M = 50
+ * N dividers:
+ *    N0:
+ *       Value: 15.0037509377344336... [ 15 + 5/1333 ]
+ *       OUT2: 166.625 MHz, Error: 0 ppm
+ *       OUT3: 166.625 MHz, Error: 0 ppm
+ *       OUT4: 166.625 MHz, Error: 0 ppm
+ *       OUT5: 166.625 MHz, Error: 0 ppm
+ *    N1:
+ *       Unused
+ *
+ * O dividers:
+ *    O0:
+ *       Value: 16
+ *       OUT0: 156.25 MHz, Error: 0 ppm
+ *       OUT1: 156.25 MHz, Error: 0 ppm
+ *       OUT6: 156.25 MHz, Error: 0 ppm
+ *       OUT7: 156.25 MHz, Error: 0 ppm
+ *    O1:
+ *       Unused
+ *    O2:
+ *       Unused
+ *    O3:
+ *       Unused
+ *    O4:
+ *       Unused
+ *
+ * R dividers:
+ *    R0 = 1
+ *    R1 = 1
+ *    R2 = 1
+ *    R3 = 1
+ *    R4 = 1
+ *    R5 = 1
+ *    R6 = 1
+ *    R7 = 1
+ *
+ * Estimated Power
+ * ===============
+ * Total Power: 233 mW, On Chip Power: 220 mW, Tj: 31 °C
+ *
+ *                    Frequency    Format   Voltage   Current     Power
+ *                  -----------  --------  --------  --------  --------
+ * VDD                                        1.8 V   30.7 mA     55 mW
+ * VDD Dig                                    1.8 V    7.0 mA     13 mW
+ * VDD Xtal                                   1.8 V    2.3 mA      4 mW
+ * VDDO0
+ *            OUT0   156.25 MHz  LVDSFast     1.8 V   11.1 mA     20 mW
+ * VDDO1
+ *            OUT1   156.25 MHz  LVDSFast     1.8 V   11.1 mA     20 mW
+ * VDDO2
+ *            OUT2  166.625 MHz  LVDSFast     1.8 V   11.2 mA     20 mW
+ *            OUT3  166.625 MHz  LVDSFast     1.8 V   11.2 mA     20 mW
+ * VDDO3
+ *            OUT4  166.625 MHz  LVDSFast     1.8 V   11.2 mA     20 mW
+ *            OUT5  166.625 MHz  LVDSFast     1.8 V   11.2 mA     20 mW
+ * VDDO4
+ *            OUT6   156.25 MHz  LVDSFast     1.8 V   11.1 mA     20 mW
+ * VDDO5
+ *            OUT7   156.25 MHz  LVDSFast     1.8 V   11.1 mA     20 mW
+ *                                                   --------  --------
+ *                                            Total  129.4 mA    233 mW
+ *
+ * Note:
+ *
+ * -Tj is junction temperature. Tj must be less than 125 °C (on Si5332-GM2 Revision D) for device
+ *  to comply with datasheet specifications. Tj = Ta + Theta_JA*On_Chip_Power.
+ * -Overall power includes on-chip power dissipation and adds differential load power dissipation
+ *  to estimate total power requirements.
+ * -Above are estimates only: power and temperature should be measured on your PCB.
+ *
+ * Settings
+ * ========
+ *
+ * Location    Setting Name     Decimal Value      Hex Value
+ * ----------  ---------------  -----------------  -----------------
+ * 0x17[7:0]   DESIGN_ID0       49                 0x31
+ * 0x18[7:0]   DESIGN_ID1       0                  0x00
+ * 0x19[7:0]   DESIGN_ID2       0                  0x00
+ * 0x1A[7:0]   DESIGN_ID3       0                  0x00
+ * 0x1B[7:0]   DESIGN_ID4       0                  0x00
+ * 0x1C[7:0]   DESIGN_ID5       0                  0x00
+ * 0x21[6:0]   I2C_ADDR         106                0x6A
+ * 0x24[1:0]   IMUX_SEL         1                  0x1
+ * 0x25[1:0]   OMUX0_SEL0       0                  0x0
+ * 0x25[6:4]   OMUX0_SEL1       0                  0x0
+ * 0x26[1:0]   OMUX1_SEL0       0                  0x0
+ * 0x26[6:4]   OMUX1_SEL1       0                  0x0
+ * 0x27[1:0]   OMUX2_SEL0       0                  0x0
+ * 0x27[6:4]   OMUX2_SEL1       5                  0x5
+ * 0x28[1:0]   OMUX3_SEL0       0                  0x0
+ * 0x28[6:4]   OMUX3_SEL1       5                  0x5
+ * 0x29[1:0]   OMUX4_SEL0       0                  0x0
+ * 0x29[6:4]   OMUX4_SEL1       0                  0x0
+ * 0x2A[1:0]   OMUX5_SEL0       0                  0x0
+ * 0x2A[6:4]   OMUX5_SEL1       0                  0x0
+ * 0x2B[7:0]   HSDIV0A_DIV      16                 0x10
+ * 0x36[14:0]  ID0A_INTG        1920               0x0780
+ * 0x38[14:0]  ID0A_RES         640                0x0280
+ * 0x3A[14:0]  ID0A_DEN         1333               0x0535
+ * 0x3C[0]     ID0A_SS_ENA      0                  0x0
+ * 0x3C[2:1]   ID0A_SS_MODE     0                  0x0
+ * 0x48[0]     ID0B_SS_ENA      0                  0x0
+ * 0x48[2:1]   ID0B_SS_MODE     0                  0x0
+ * 0x54[0]     ID1A_SS_ENA      0                  0x0
+ * 0x54[2:1]   ID1A_SS_MODE     0                  0x0
+ * 0x60[0]     ID1B_SS_ENA      0                  0x0
+ * 0x60[2:1]   ID1B_SS_MODE     0                  0x0
+ * 0x67[14:0]  IDPA_INTG        6400               0x1900
+ * 0x69[14:0]  IDPA_RES         0                  0x0000
+ * 0x6B[14:0]  IDPA_DEN         1                  0x0001
+ * 0x73[1:0]   CLKIN_2_CLK_SEL  0                  0x0
+ * 0x74[1:0]   CLKIN_3_CLK_SEL  0                  0x0
+ * 0x75[4:0]   P_VAL            1                  0x01
+ * 0x7A[3:0]   OUT0_MODE        7                  0x7
+ * 0x7B[5:0]   OUT0_DIV         1                  0x01
+ * 0x7C[2:0]   OUT0_SKEW        0                  0x0
+ * 0x7D[0]     OUT0_STOP_HIGHZ  0                  0x0
+ * 0x7D[5:4]   OUT0_CMOS_INV    0                  0x0
+ * 0x7D[6]     OUT0_DIFF_INV    0                  0x0
+ * 0x7F[3:0]   OUT1_MODE        7                  0x7
+ * 0x80[5:0]   OUT1_DIV         1                  0x01
+ * 0x81[2:0]   OUT1_SKEW        0                  0x0
+ * 0x82[0]     OUT1_STOP_HIGHZ  0                  0x0
+ * 0x82[5:4]   OUT1_CMOS_INV    0                  0x0
+ * 0x82[6]     OUT1_DIFF_INV    0                  0x0
+ * 0x89[3:0]   OUT2_MODE        7                  0x7
+ * 0x8A[5:0]   OUT2_DIV         1                  0x01
+ * 0x8B[2:0]   OUT2_SKEW        0                  0x0
+ * 0x8C[0]     OUT2_STOP_HIGHZ  0                  0x0
+ * 0x8C[5:4]   OUT2_CMOS_INV    0                  0x0
+ * 0x8C[6]     OUT2_DIFF_INV    0                  0x0
+ * 0x8E[3:0]   OUT3_MODE        7                  0x7
+ * 0x8F[5:0]   OUT3_DIV         1                  0x01
+ * 0x90[2:0]   OUT3_SKEW        0                  0x0
+ * 0x91[0]     OUT3_STOP_HIGHZ  0                  0x0
+ * 0x91[5:4]   OUT3_CMOS_INV    0                  0x0
+ * 0x91[6]     OUT3_DIFF_INV    0                  0x0
+ * 0x98[3:0]   OUT4_MODE        7                  0x7
+ * 0x99[5:0]   OUT4_DIV         1                  0x01
+ * 0x9A[2:0]   OUT4_SKEW        0                  0x0
+ * 0x9B[0]     OUT4_STOP_HIGHZ  0                  0x0
+ * 0x9B[5:4]   OUT4_CMOS_INV    0                  0x0
+ * 0x9B[6]     OUT4_DIFF_INV    0                  0x0
+ * 0x9D[3:0]   OUT5_MODE        7                  0x7
+ * 0x9E[5:0]   OUT5_DIV         1                  0x01
+ * 0x9F[2:0]   OUT5_SKEW        0                  0x0
+ * 0xA0[0]     OUT5_STOP_HIGHZ  0                  0x0
+ * 0xA0[5:4]   OUT5_CMOS_INV    0                  0x0
+ * 0xA0[6]     OUT5_DIFF_INV    0                  0x0
+ * 0xA7[3:0]   OUT6_MODE        7                  0x7
+ * 0xA8[5:0]   OUT6_DIV         1                  0x01
+ * 0xA9[2:0]   OUT6_SKEW        0                  0x0
+ * 0xAA[0]     OUT6_STOP_HIGHZ  0                  0x0
+ * 0xAA[5:4]   OUT6_CMOS_INV    0                  0x0
+ * 0xAA[6]     OUT6_DIFF_INV    0                  0x0
+ * 0xAC[3:0]   OUT7_MODE        7                  0x7
+ * 0xAD[5:0]   OUT7_DIV         1                  0x01
+ * 0xAE[2:0]   OUT7_SKEW        0                  0x0
+ * 0xAF[0]     OUT7_STOP_HIGHZ  0                  0x0
+ * 0xAF[5:4]   OUT7_CMOS_INV    0                  0x0
+ * 0xAF[6]     OUT7_DIFF_INV    0                  0x0
+ * 0xB6[0]     OUT0_OE          1                  0x1
+ * 0xB6[1]     OUT1_OE          1                  0x1
+ * 0xB6[3]     OUT2_OE          1                  0x1
+ * 0xB6[4]     OUT3_OE          1                  0x1
+ * 0xB6[6]     OUT4_OE          1                  0x1
+ * 0xB6[7]     OUT5_OE          1                  0x1
+ * 0xB7[1]     OUT6_OE          1                  0x1
+ * 0xB7[2]     OUT7_OE          1                  0x1
+ * 0xB9[0]     XOSC_DIS         0                  0x0
+ * 0xB9[1]     IBUF0_DIS        1                  0x1
+ * 0xB9[2]     IBUF1_DIS        1                  0x1
+ * 0xB9[3]     IMUX_DIS         0                  0x0
+ * 0xB9[4]     PDIV_DIS         0                  0x0
+ * 0xB9[5]     PLL_DIS          0                  0x0
+ * 0xBA[5]     ID0_DIS          0                  0x0
+ * 0xBA[6]     ID1_DIS          1                  0x1
+ * 0xBA[0]     HSDIV0_DIS       0                  0x0
+ * 0xBA[1]     HSDIV1_DIS       1                  0x1
+ * 0xBA[2]     HSDIV2_DIS       1                  0x1
+ * 0xBA[3]     HSDIV3_DIS       1                  0x1
+ * 0xBA[4]     HSDIV4_DIS       1                  0x1
+ * 0xBB[0]     OMUX0_DIS        0                  0x0
+ * 0xBB[1]     OMUX1_DIS        0                  0x0
+ * 0xBB[2]     OMUX2_DIS        0                  0x0
+ * 0xBB[3]     OMUX3_DIS        0                  0x0
+ * 0xBB[4]     OMUX4_DIS        0                  0x0
+ * 0xBB[5]     OMUX5_DIS        0                  0x0
+ * 0xBC[0]     OUT0_DIS         0                  0x0
+ * 0xBC[1]     OUT1_DIS         0                  0x0
+ * 0xBC[3]     OUT2_DIS         0                  0x0
+ * 0xBC[4]     OUT3_DIS         0                  0x0
+ * 0xBC[6]     OUT4_DIS         0                  0x0
+ * 0xBC[7]     OUT5_DIS         0                  0x0
+ * 0xBD[1]     OUT6_DIS         0                  0x0
+ * 0xBD[2]     OUT7_DIS         0                  0x0
+ * 0xBE[7:0]   PLL_MODE         32                 0x20
+ *
+ *
+ */
+
+#endif
drivers/net/ntnic/nthw/core/include/nthw_i2cm.h +1 -0
index eeb4dffe25..53aa3c018e 100644
@@ -46,5 +46,6 @@ typedef struct nt_i2cm nthw_i2cm_t;
 
 int nthw_i2cm_read(nthw_i2cm_t *p, uint8_t dev_addr, uint8_t reg_addr, uint8_t *value);
 int nthw_i2cm_write(nthw_i2cm_t *p, uint8_t dev_addr, uint8_t reg_addr, uint8_t value);
+int nthw_i2cm_write16(nthw_i2cm_t *p, uint8_t dev_addr, uint8_t reg_addr, uint16_t value);
 
 #endif	/* __NTHW_II2CM_H__ */
drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h new file +14 -0
new file mode 100644
index 0000000000..1e114886ca
@@ -0,0 +1,14 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+#ifndef __NTHW_PCM_NT400DXX_H__
+#define __NTHW_PCM_NT400DXX_H__
+
+struct nthw_pcm_nt400_dxx {
+	int mn_module_minor_version;
+};
+
+typedef struct nthw_pcm_nt400_dxx nthw_pcm_nt400dxx_t;
+
+#endif  /* __NTHW_PCM_NT400DXX_H__ */
drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h +36 -0
index 968d7eb74a..753717ba8a 100644
@@ -21,4 +21,40 @@ typedef struct nthw_pca9849 nthw_pca9849_t;
 
 int nthw_pca9849_set_channel(nthw_pca9849_t *p, uint8_t channel);
 
+/*
+ * Si5332 clock synthesizer
+ */
+
+struct nthw_si5332 {
+	nthw_i2cm_t *mp_nt_i2cm;
+	uint8_t m_dev_address;
+	nthw_pca9849_t *mp_pca9849;
+	uint8_t m_mux_channel;
+};
+
+typedef struct nthw_si5332 nthw_si5332_t;
+
+nthw_si5332_t *nthw_si5332_new(void);
+int nthw_si5332_init(nthw_si5332_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address,
+	nthw_pca9849_t *pca9849, uint8_t mux_channel);
+bool nthw_si5332_clock_active(nthw_si5332_t *p);
+void nthw_si5332_write(nthw_si5332_t *p, uint8_t address, uint8_t value);
+
+/*
+ * Si5156 MEMS Super TCXO
+ */
+struct nthw_si5156 {
+	nthw_i2cm_t *mp_nt_i2cm;
+	uint8_t m_dev_address;
+	nthw_pca9849_t *mp_pca9849;
+	uint8_t m_mux_channel;
+};
+
+typedef struct nthw_si5156 nthw_si5156_t;
+
+nthw_si5156_t *nthw_si5156_new(void);
+int nthw_si5156_init(nthw_si5156_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address,
+	nthw_pca9849_t *pca9849, uint8_t mux_channel);
+int nthw_si5156_write16(nthw_si5156_t *p, uint8_t address, uint16_t value);
+
 #endif	/* __NTHW_SI5332_SI5156_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +113 -2

129 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_i2cm.c +57 -0

66 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c +93 -0

102 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +6 -1
index a3c54846f5..1d5b750db9 100644
@@ -12,8 +12,8 @@
 #include "nthw_si5332_si5156.h"
 #include "nthw_pcal6416a.h"
 #include "nthw_pca9532.h"
-#include "nthw_phy_tile.h"
 #include "nthw_rpf.h"
+#include "nthw_pcm_nt400dxx.h"
 #include "nthw_phy_tile.h"
 
 /*
@@ -24,8 +24,13 @@ typedef struct nthw_agx_s {
 	nthw_pca9849_t *p_pca9849;
 	nthw_pcal6416a_t *p_io_nim;	/* PCAL6416A I/O expander for controlling TS */
 	nthw_pca9532_t *p_pca9532_led;
+	nthw_si5332_t *p_si5332;
+	nthw_si5156_t *p_si5156;
+	nthw_pcm_nt400dxx_t *p_pcm;
 	nthw_phy_tile_t *p_phy_tile;
 	nthw_rpf_t *p_rpf;
+	bool tcxo_present;
+	bool tcxo_capable;
 } nthw_agx_t;
 
 typedef enum nt_meta_port_type_e {
Signature · 1 line
2.45.0
#21 lore raw

Re: [PATCH v1 20/32] net/ntnic: add clock init

Quoted 6 lines · Serhii Iliushyk
drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h new file +0 -0
new file mode 100644
index 0000000000..f87828fcfe

drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h line 8

Quoted 8 lines
drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h new file +8 -0
@@ -0,0 +1,425 @@
+/*
+ * Si5332-GM2 Rev D Configuration Register Export Header File
+ *
+ * This file represents a series of Skyworks Si5332-GM2 Rev D
+ * register writes that can be performed to load a single configuration
+ * on a device. It was created by a Skyworks ClockBuilder Pro
+ * export tool.
+ *

This file is missing a SPDX tag.
Please send a fix or we will have to revert this change.

The filename also looks strange, as it does not follow some kind of implicit convention (when I compare to other files in this driver). Could it be renamed?

Signature · 1 line
David Marchand
#22 lore raw

Re: [PATCH v1 20/32] net/ntnic: add clock init

On 05.03.2025, 19:03, "David Marchand" <[email protected]> wrote:

Quoted 6 lines · Serhii Iliushyk
drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h new file +0 -0
new file mode 100644
index 0000000000..f87828fcfe

drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h line 8

Quoted 8 lines
drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h new file +8 -0
@@ -0,0 +1,425 @@
+/*
+ * Si5332-GM2 Rev D Configuration Register Export Header File
+ *
+ * This file represents a series of Skyworks Si5332-GM2 Rev D
+ * register writes that can be performed to load a single configuration
+ * on a device. It was created by a Skyworks ClockBuilder Pro
+ * export tool.
+ *

This file is missing a SPDX tag.
Please send a fix or we will have to revert this change.

The filename also looks strange, as it does not follow some kind of implicit convention (when I compare to other files in this driver). Could it be renamed?

--
David Marchand
Hi David,
We will add the SDPX to the current file. Thanks for noticing it.

The clock profiles are named according to our internal documentation on the PCB (board) design - the "Uxx" is actually the component number on the board design - the versioning ensures that we can support multiple versions of the clock profile for different PCB revisions. Is it suitable for you to change the name of the file to all lowercase and remove dashes:
NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h ---> nt400d13_u62_si5332_gm2_revd_1_v5_registers.h

BR,
Serhii

#23 lore raw

PATCH 21/32 net/ntnic: add nt400d13 pcm init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Initialize and create PCM for FPGA and HIF modules

---
 drivers/net/ntnic/meson.build                 |  1 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     | 24 +++++++-
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 18 ++++++
 .../net/ntnic/nthw/core/nthw_pcm_nt400dxx.c   | 56 +++++++++++++++++++
 drivers/net/ntnic/nthw/nthw_drv.h             |  1 +
 5 files changed, 99 insertions(+), 1 deletion(-)
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c
drivers/net/ntnic/meson.build +1 -0
index aec7b52714..b9ac069bcc 100644
@@ -61,6 +61,7 @@ sources = files(
         'nthw/core/nthw_pcie3.c',
         'nthw/core/nthw_pca9532.c',
         'nthw/core/nthw_pcal6416a.c',
+        'nthw/core/nthw_pcm_nt400dxx.c',
         'nthw/core/nthw_phy_tile.c',
         'nthw/core/nthw_si5332_si5156.c',
         'nthw/core/nthw_rpf.c',
drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h +23 -1
index 1e114886ca..23865f466b 100644
@@ -5,10 +5,32 @@
 #ifndef __NTHW_PCM_NT400DXX_H__
 #define __NTHW_PCM_NT400DXX_H__
 
+#include "nthw_fpga_model.h"
+
 struct nthw_pcm_nt400_dxx {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_pcm;
+	int mn_instance;
+
+	int mn_module_major_version;
 	int mn_module_minor_version;
+
+	nthw_register_t *mp_reg_ctrl;
+	nthw_field_t *mp_fld_ctrl_ts_pll_recal;	/* Dunite HW version 3 */
+	nthw_field_t *mp_fld_ctrl_ts_clksel;
+	nthw_field_t *mp_fld_ctrl_ts_pll_rst;
+
+	nthw_register_t *mp_reg_stat;
+	nthw_field_t *mp_fld_stat_ts_pll_locked;
+
+	nthw_register_t *mp_reg_latch;
+	nthw_field_t *mp_fld_latch_ts_pll_locked;
 };
 
 typedef struct nthw_pcm_nt400_dxx nthw_pcm_nt400dxx_t;
+typedef struct nthw_pcm_nt400_dxx nthw_pcm_nt400_dxx;
+
+nthw_pcm_nt400dxx_t *nthw_pcm_nt400dxx_new(void);
+int nthw_pcm_nt400dxx_init(nthw_pcm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int n_instance);
 
-#endif  /* __NTHW_PCM_NT400DXX_H__ */
+#endif	/* __NTHW_PCM_NT400DXX_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +18 -0
index e0e4bc0861..1d93474cff 100644
@@ -13,6 +13,24 @@
 static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 {
 	assert(p_fpga_info);
+	int res = -1;
+	nthw_fpga_t *p_fpga = NULL;
+
+	p_fpga = p_fpga_info->mp_fpga;
+
+	nthw_hif_t *p_nthw_hif = nthw_hif_new();
+	res = nthw_hif_init(p_nthw_hif, p_fpga, 0);
+
+	if (res == 0)
+		NT_LOG(DBG, NTHW, "%s: Hif module found", p_fpga_info->mp_adapter_id_str);
+
+	/* Create PCM */
+	p_fpga_info->mp_nthw_agx.p_pcm = nthw_pcm_nt400dxx_new();
+	res = nthw_pcm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_pcm, p_fpga, 0);
+
+	if (res != 0)
+		return res;
+
 	return 0;
 }
 
drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c new file +56 -0

56 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +1 -0
index 1d5b750db9..955d0a37b0 100644
@@ -15,6 +15,7 @@
 #include "nthw_rpf.h"
 #include "nthw_pcm_nt400dxx.h"
 #include "nthw_phy_tile.h"
+#include "nthw_pcm_nt400dxx.h"
 
 /*
  * Structs for controlling Agilex based NT400DXX adapter
Signature · 1 line
2.45.0
#24 lore raw

PATCH 22/32 net/ntnic: add HIF clock test

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add HIF clock test with write/read verification.

---
 .../net/ntnic/nthw/core/include/nthw_hif.h    |  3 +
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 20 +++++
 drivers/net/ntnic/nthw/core/nthw_hif.c        | 82 +++++++++++++++++++
 3 files changed, 105 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_hif.h +3 -0
index c8f4669f83..deb9ed04e8 100644
@@ -148,4 +148,7 @@ int nthw_hif_get_stat_rate(nthw_hif_t *p, uint64_t *p_pci_rx_rate, uint64_t *p_p
 
 int nthw_hif_end_point_counters_sample(nthw_hif_t *p, struct nthw_hif_end_point_counters *epc);
 
+int nthw_hif_read_test_reg(nthw_hif_t *p, uint8_t test_reg, uint32_t *p_value);
+int nthw_hif_write_test_reg(nthw_hif_t *p, uint8_t test_reg, uint32_t value);
+
 #endif	/* __NTHW_HIF_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +20 -0
index 1d93474cff..60e7714283 100644
@@ -24,6 +24,26 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 	if (res == 0)
 		NT_LOG(DBG, NTHW, "%s: Hif module found", p_fpga_info->mp_adapter_id_str);
 
+	/* (A) Test HIF clock is running by performing simple write/read test of HIF registers */
+	const uint32_t test_pattern[2] = { 0x11223344, 0x55667788 };
+
+	for (uint8_t i = 0; i < 2; ++i) {
+		uint32_t test_data = 0;
+		nthw_hif_write_test_reg(p_nthw_hif, i, test_pattern[i]);
+		nthw_hif_read_test_reg(p_nthw_hif, i, &test_data);
+
+		if (test_data != test_pattern[i]) {
+			NT_LOG(ERR,
+				NTHW,
+				"%s: %s: Test sys 250 clock failed",
+				p_fpga_info->mp_adapter_id_str,
+				__func__);
+			return -1;
+		}
+	}
+
+	nthw_hif_delete(p_nthw_hif);
+
 	/* Create PCM */
 	p_fpga_info->mp_nthw_agx.p_pcm = nthw_pcm_nt400dxx_new();
 	res = nthw_pcm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_pcm, p_fpga, 0);
drivers/net/ntnic/nthw/core/nthw_hif.c +82 -0

85 lines not on this page · raw message

Signature · 1 line
2.45.0
#25 lore raw

PATCH 23/32 net/ntnic: add nt400d13 PRM module init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Initialize RAB0 and create PRM for FPGA.

---
 drivers/net/ntnic/meson.build                 |  1 +
 .../nthw/core/include/nthw_prm_nt400dxx.h     | 30 +++++++++++++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 11 +++++
 .../net/ntnic/nthw/core/nthw_prm_nt400dxx.c   | 43 +++++++++++++++++++
 drivers/net/ntnic/nthw/nthw_drv.h             |  2 +
 5 files changed, 87 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
drivers/net/ntnic/meson.build +1 -0
index b9ac069bcc..9885d4efbf 100644
@@ -63,6 +63,7 @@ sources = files(
         'nthw/core/nthw_pcal6416a.c',
         'nthw/core/nthw_pcm_nt400dxx.c',
         'nthw/core/nthw_phy_tile.c',
+        'nthw/core/nthw_prm_nt400dxx.c',
         'nthw/core/nthw_si5332_si5156.c',
         'nthw/core/nthw_rpf.c',
         'nthw/core/nthw_rmc.c',
drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h new file +30 -0
new file mode 100644
index 0000000000..09bfd79249
@@ -0,0 +1,30 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef NTHW_PRM_NT400DXX_H_
+#define NTHW_PRM_NT400DXX_H_
+
+#include <stdint.h>
+
+#include "nthw_fpga_model.h"
+
+struct nt_prm_nt400dxx {
+	nthw_fpga_t *mp_fpga;
+	nthw_module_t *mp_mod_prm;
+
+	int mn_instance;
+
+	nthw_register_t *mp_reg_rst;
+	nthw_field_t *mp_fld_rst_periph;
+	nthw_field_t *mp_fld_rst_platform;
+};
+
+typedef struct nt_prm_nt400dxx nthw_prm_nt400dxx_t;
+typedef struct nt_prm_nt400dxx nt_prm_nt400dxx;
+
+nthw_prm_nt400dxx_t *nthw_prm_nt400dxx_new(void);
+int nthw_prm_nt400dxx_init(nthw_prm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int n_instance);
+
+#endif	/* NTHW_PRM_NT400DXX_H_ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +11 -0
index 60e7714283..4d74db88de 100644
@@ -44,6 +44,17 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 
 	nthw_hif_delete(p_nthw_hif);
 
+	/* (b) Init RAB0 */
+	nthw_rac_rab_init(p_fpga_info->mp_nthw_rac, 0x7);
+	nthw_rac_rab_init(p_fpga_info->mp_nthw_rac, 0x6);
+
+	/* Create PRM */
+	p_fpga_info->mp_nthw_agx.p_prm = nthw_prm_nt400dxx_new();
+	res = nthw_prm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_prm, p_fpga, 0);
+
+	if (res != 0)
+		return res;
+
 	/* Create PCM */
 	p_fpga_info->mp_nthw_agx.p_pcm = nthw_pcm_nt400dxx_new();
 	res = nthw_pcm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_pcm, p_fpga, 0);
drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c new file +43 -0

43 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +2 -0
index 955d0a37b0..ecd3bb9cc4 100644
@@ -15,6 +15,7 @@
 #include "nthw_rpf.h"
 #include "nthw_pcm_nt400dxx.h"
 #include "nthw_phy_tile.h"
+#include "nthw_prm_nt400dxx.h"
 #include "nthw_pcm_nt400dxx.h"
 
 /*
@@ -27,6 +28,7 @@ typedef struct nthw_agx_s {
 	nthw_pca9532_t *p_pca9532_led;
 	nthw_si5332_t *p_si5332;
 	nthw_si5156_t *p_si5156;
+	nthw_prm_nt400dxx_t *p_prm;
 	nthw_pcm_nt400dxx_t *p_pcm;
 	nthw_phy_tile_t *p_phy_tile;
 	nthw_rpf_t *p_rpf;
Signature · 1 line
2.45.0
#26 lore raw

PATCH 24/32 net/ntnic: add nt400d13 PRM module reset

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Reset platform and peripherals for PRM initialization.

---
 .../net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h |  2 ++
 .../core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c    | 13 +++++++++++++
 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c     | 12 ++++++++++++
 3 files changed, 27 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h +2 -0
index 09bfd79249..53692145b7 100644
@@ -26,5 +26,7 @@ typedef struct nt_prm_nt400dxx nt_prm_nt400dxx;
 
 nthw_prm_nt400dxx_t *nthw_prm_nt400dxx_new(void);
 int nthw_prm_nt400dxx_init(nthw_prm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int n_instance);
+void nthw_prm_nt400dxx_periph_rst(nthw_prm_nt400dxx_t *p, uint32_t val);
+void nthw_prm_nt400dxx_platform_rst(nthw_prm_nt400dxx_t *p, uint32_t val);
 
 #endif	/* NTHW_PRM_NT400DXX_H_ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +13 -0
index 4d74db88de..ff29101e61 100644
@@ -52,6 +52,19 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 	p_fpga_info->mp_nthw_agx.p_prm = nthw_prm_nt400dxx_new();
 	res = nthw_prm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_prm, p_fpga, 0);
 
+	if (res != 0)
+		return res;
+
+	/* (b1) Reset platform. It is released later */
+	nthw_prm_nt400dxx_platform_rst(p_fpga_info->mp_nthw_agx.p_prm, 1);
+	nt_os_wait_usec(10000);
+
+	/* (C) Reset peripherals and release the reset */
+	nthw_prm_nt400dxx_periph_rst(p_fpga_info->mp_nthw_agx.p_prm, 1);
+	nt_os_wait_usec(10000);
+	nthw_prm_nt400dxx_periph_rst(p_fpga_info->mp_nthw_agx.p_prm, 0);
+	nt_os_wait_usec(10000);
+
 	if (res != 0)
 		return res;
 
drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c +12 -0
index b1910fdbd5..286bda43f8 100644
@@ -41,3 +41,15 @@ int nthw_prm_nt400dxx_init(nthw_prm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int n_in
 	p->mp_fld_rst_platform = nthw_register_get_field(p->mp_reg_rst, PRM_NT400DXX_RST_PLATFORM);
 	return 0;
 }
+
+void nthw_prm_nt400dxx_periph_rst(nthw_prm_nt400dxx_t *p, uint32_t val)
+{
+	nthw_field_update_register(p->mp_fld_rst_periph);
+	nthw_field_set_val_flush32(p->mp_fld_rst_periph, val);
+}
+
+void nthw_prm_nt400dxx_platform_rst(nthw_prm_nt400dxx_t *p, uint32_t val)
+{
+	nthw_field_update_register(p->mp_fld_rst_platform);
+	nthw_field_set_val_flush32(p->mp_fld_rst_platform, val);
+}
Signature · 1 line
2.45.0
#27 lore raw

PATCH 25/32 net/ntnic: add SPI v3 support for FPGA

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

- Implement nthw_spi_v3 module with initialization, transfer, and utility functions.
- Add nthw_spim and nthw_spis modules for SPI primary and secondary interfaces.
- Include SPI v3 header files and update meson build configuration.
- Implement AVR probe function to retrieve and log AVR information.

---
 drivers/net/ntnic/meson.build                 |   3 +
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |   2 +
 .../net/ntnic/nthw/core/include/nthw_spi_v3.h | 107 +++++
 .../net/ntnic/nthw/core/include/nthw_spim.h   |  58 +++
 .../net/ntnic/nthw/core/include/nthw_spis.h   |  63 +++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |   2 +
 drivers/net/ntnic/nthw/core/nthw_fpga.c       | 444 ++++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     | 358 ++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_spim.c       | 113 +++++
 drivers/net/ntnic/nthw/core/nthw_spis.c       | 121 +++++
 10 files changed, 1271 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spim.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spis.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
drivers/net/ntnic/meson.build +3 -0
index 9885d4efbf..7e326a3e1d 100644
@@ -69,6 +69,9 @@ sources = files(
         'nthw/core/nthw_rmc.c',
         'nthw/core/nthw_sdc.c',
         'nthw/core/nthw_si5340.c',
+        'nthw/core/nthw_spim.c',
+        'nthw/core/nthw_spis.c',
+        'nthw/core/nthw_spi_v3.c',
         'nthw/stat/nthw_stat.c',
         'nthw/flow_api/flow_api.c',
         'nthw/flow_api/flow_group.c',
drivers/net/ntnic/nthw/core/include/nthw_fpga.h +2 -0
index 8b1d548a25..418aea8277 100644
@@ -18,6 +18,8 @@ int nthw_fpga_shutdown(struct fpga_info_s *p_fpga_info);
 
 int nthw_fpga_get_param_info(struct fpga_info_s *p_fpga_info, nthw_fpga_t *p_fpga);
 
+int nthw_fpga_avr_probe(nthw_fpga_t *p_fpga, const int n_instance_no);
+
 int nthw_fpga_iic_scan(nthw_fpga_t *p_fpga, const int n_instance_no_begin,
 	const int n_instance_no_end);
 
drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h new file +107 -0

107 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_spim.h new file +58 -0

58 lines not on this page · raw message

drivers/net/ntnic/nthw/core/include/nthw_spis.h new file +63 -0

63 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +2 -0
index ff29101e61..73feaa4ebd 100644
@@ -65,6 +65,8 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 	nthw_prm_nt400dxx_periph_rst(p_fpga_info->mp_nthw_agx.p_prm, 0);
 	nt_os_wait_usec(10000);
 
+	res = nthw_fpga_avr_probe(p_fpga, 0);
+
 	if (res != 0)
 		return res;
 
drivers/net/ntnic/nthw/core/nthw_fpga.c +444 -0

456 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spi_v3.c new file +358 -0

358 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spim.c new file +113 -0

113 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_spis.c new file +121 -0

121 lines not on this page · raw message

Signature · 1 line
2.45.0
#28 lore raw

Re: [PATCH v1 25/32] net/ntnic: add SPI v3 support for FPGA

Quoted 20 lines · On Thu, 20 Feb 2025 23:03:49 +0100 Serhii Iliushyk <[email protected]> wrote:
drivers/net/ntnic/nthw/core/nthw_spi_v3.c new file +20 -0
+/*
+ * Send Tx data using the SPIM module and receive any data using the SPIS module.
+ * The data are sent and received being wrapped into a SPI v3 container.
+ */
+int nthw_spi_v3_transfer(nthw_spi_v3_t *p, uint16_t opcode, struct tx_rx_buf *tx_buf,
+	struct tx_rx_buf *rx_buf)
+{
+	const uint16_t max_payload_rx_size = rx_buf->size;
+	int result = 0;
+
+#pragma pack(push, 1)
+	union {
+		uint32_t raw;
+
+		struct {
+			uint16_t opcode;
+			uint16_t size;
+		};
+	} spi_tx_hdr;
+

drivers/net/ntnic/nthw/core/nthw_spi_v3.c line 193

Quoted 10 lines
drivers/net/ntnic/nthw/core/nthw_spi_v3.c new file +10 -0
+	union {
+		uint32_t raw;
+
+		struct {
+			uint16_t error_code;
+			uint16_t size;
+		};
+	} spi_rx_hdr;
+
+#pragma pack(pop)

Use of pragma's is strongly discouraged. For packed data use __rte_packed_begin, __rte_packed_end. Not sure why packing is needed here at all. The union will result in the same

#29 lore raw

PATCH 26/32 net/ntnic: add i2cm init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Create and initialize I2C for FPGA.

---
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |  2 +
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  7 ++
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       | 82 +++++++++++++++++++
 3 files changed, 91 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_i2cm.h +2 -0
index 53aa3c018e..1bf780d714 100644
@@ -44,6 +44,8 @@ struct nt_i2cm {
 
 typedef struct nt_i2cm nthw_i2cm_t;
 
+nthw_i2cm_t *nthw_i2cm_new(void);
+int nthw_i2cm_init(nthw_i2cm_t *p, nthw_fpga_t *p_fpga, int n_i2c_instance);
 int nthw_i2cm_read(nthw_i2cm_t *p, uint8_t dev_addr, uint8_t reg_addr, uint8_t *value);
 int nthw_i2cm_write(nthw_i2cm_t *p, uint8_t dev_addr, uint8_t reg_addr, uint8_t value);
 int nthw_i2cm_write16(nthw_i2cm_t *p, uint8_t dev_addr, uint8_t reg_addr, uint16_t value);
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +7 -0
index 73feaa4ebd..bfc66a97d1 100644
@@ -67,6 +67,13 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 
 	res = nthw_fpga_avr_probe(p_fpga, 0);
 
+	if (res != 0)
+		return res;
+
+	/* Create I2C */
+	p_fpga_info->mp_nthw_agx.p_i2cm = nthw_i2cm_new();
+	res = nthw_i2cm_init(p_fpga_info->mp_nthw_agx.p_i2cm, p_fpga, 0);
+
 	if (res != 0)
 		return res;
 
drivers/net/ntnic/nthw/core/nthw_i2cm.c +82 -0

88 lines not on this page · raw message

Signature · 1 line
2.45.0
#30 lore raw

PATCH 27/32 net/ntnic: add pca init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add initialization for I2C mux and LED driver.

---
 .../ntnic/nthw/core/include/nthw_pca9532.h    |  3 +++
 .../nthw/core/include/nthw_si5332_si5156.h    |  3 +++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 23 +++++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_pca9532.c    | 20 ++++++++++++++++
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  | 18 +++++++++++++++
 5 files changed, 67 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_pca9532.h +3 -0
index 24da937a18..7cc0008dcb 100644
@@ -17,6 +17,9 @@ struct nthw_pca9532 {
 
 typedef struct nthw_pca9532 nthw_pca9532_t;
 
+nthw_pca9532_t *nthw_pca9532_new(void);
+int nthw_pca9532_init(nthw_pca9532_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address,
+	nthw_pca9849_t *pca9849, uint8_t mux_channel);
 void nthw_pca9532_set_led_on(nthw_pca9532_t *p, uint8_t led_pos, bool state_on);
 
 #endif	/* __NTHW_PCA9532_H__ */
drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h +3 -0
index 753717ba8a..9eaf8872e3 100644
@@ -19,6 +19,9 @@ struct nthw_pca9849 {
 
 typedef struct nthw_pca9849 nthw_pca9849_t;
 
+nthw_pca9849_t *nthw_pca9849_new(void);
+int nthw_pca9849_init(nthw_pca9849_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address);
+
 int nthw_pca9849_set_channel(nthw_pca9849_t *p, uint8_t channel);
 
 /*
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +23 -0
index bfc66a97d1..6c5c1cd51e 100644
@@ -77,6 +77,29 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 	if (res != 0)
 		return res;
 
+	/* Create pca9849 i2c mux */
+	p_fpga_info->mp_nthw_agx.p_pca9849 = nthw_pca9849_new();
+	res = nthw_pca9849_init(p_fpga_info->mp_nthw_agx.p_pca9849,
+			p_fpga_info->mp_nthw_agx.p_i2cm,
+			0x71);
+
+	if (res != 0)
+		return res;
+
+	/* Create LED driver */
+	p_fpga_info->mp_nthw_agx.p_pca9532_led = nthw_pca9532_new();
+	res = nthw_pca9532_init(p_fpga_info->mp_nthw_agx.p_pca9532_led,
+			p_fpga_info->mp_nthw_agx.p_i2cm,
+			0x60,
+			p_fpga_info->mp_nthw_agx.p_pca9849,
+			3);
+
+	if (res != 0)
+		return res;
+
+	for (uint8_t i = 0; i < 16; i++)
+		nthw_pca9532_set_led_on(p_fpga_info->mp_nthw_agx.p_pca9532_led, i, false);
+
 	/* Create PCM */
 	p_fpga_info->mp_nthw_agx.p_pcm = nthw_pcm_nt400dxx_new();
 	res = nthw_pcm_nt400dxx_init(p_fpga_info->mp_nthw_agx.p_pcm, p_fpga, 0);
drivers/net/ntnic/nthw/core/nthw_pca9532.c +20 -0
index fcf5463fcb..af14cd6d06 100644
@@ -15,6 +15,26 @@
 
 static const uint8_t led_sel_reg[4] = { 6, 7, 8, 9 };
 
+nthw_pca9532_t *nthw_pca9532_new(void)
+{
+	nthw_pca9532_t *p = malloc(sizeof(nthw_pca9532_t));
+
+	if (p)
+		memset(p, 0, sizeof(nthw_pca9532_t));
+
+	return p;
+}
+
+int nthw_pca9532_init(nthw_pca9532_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address,
+	nthw_pca9849_t *pca9849, uint8_t mux_channel)
+{
+	p->mp_nt_i2cm = p_nt_i2cm;
+	p->m_dev_address = dev_address;
+	p->mp_ca9849 = pca9849;
+	p->m_mux_channel = mux_channel;
+	return 0;
+}
+
 void nthw_pca9532_set_led_on(nthw_pca9532_t *p, uint8_t led_pos, bool state_on)
 {
 	if (led_pos >= 16) {
drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c +18 -0
index b4a7b57bcb..eb11ebc67a 100644
@@ -13,6 +13,24 @@
 
 #include "nthw_si5332_si5156.h"
 
+nthw_pca9849_t *nthw_pca9849_new(void)
+{
+	nthw_pca9849_t *p = malloc(sizeof(nthw_pca9849_t));
+
+	if (p)
+		memset(p, 0, sizeof(nthw_pca9849_t));
+
+	return p;
+}
+
+int nthw_pca9849_init(nthw_pca9849_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address)
+{
+	p->mp_nt_i2cm = p_nt_i2cm;
+	p->m_dev_address = dev_address;
+	p->m_current_channel = 0;
+	return 0;
+}
+
 int nthw_pca9849_set_channel(nthw_pca9849_t *p, uint8_t channel)
 {
 	int res;
Signature · 1 line
2.45.0
#31 lore raw

PATCH 28/32 net/ntnic: add pcal init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add initialization for I/O expanders and configure TS settings.

---
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |  3 +
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 69 +++++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  | 23 +++++++
 drivers/net/ntnic/nthw/nthw_drv.h             |  1 +
 4 files changed, 96 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h +3 -0
index a718b59a29..e3dadcc8e3 100644
@@ -24,6 +24,9 @@ struct nthw_pcal6416a {
 
 typedef struct nthw_pcal6416a nthw_pcal6416a_t;
 
+nthw_pcal6416a_t *nthw_pcal6416a_new(void);
+int nthw_pcal6416a_init(nthw_pcal6416a_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address,
+	nthw_pca9849_t *pca9849, uint8_t mux_channel);
 void nthw_pcal6416a_write(nthw_pcal6416a_t *p, uint8_t pin, uint8_t value);
 void nthw_pcal6416a_read(nthw_pcal6416a_t *p, uint8_t pin, uint8_t *value);
 
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +69 -0

81 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_pcal6416a.c +23 -0
index dd803ac66d..2fca469497 100644
@@ -20,6 +20,29 @@ static const uint8_t config_port[2] = { 0x06, 0x07 };
  * PCAL6416A I/O expander class
  */
 
+nthw_pcal6416a_t *nthw_pcal6416a_new(void)
+{
+	nthw_pcal6416a_t *p = malloc(sizeof(nthw_pcal6416a_t));
+
+	if (p) {
+		memset(p, 0, sizeof(nthw_pcal6416a_t));
+		p->m_config_data[0] = 0xFF;
+		p->m_config_data[1] = 0xFF;
+	}
+
+	return p;
+}
+
+int nthw_pcal6416a_init(nthw_pcal6416a_t *p, nthw_i2cm_t *p_nt_i2cm, uint8_t dev_address,
+	nthw_pca9849_t *pca9849, uint8_t mux_channel)
+{
+	p->mp_nt_i2cm = p_nt_i2cm;
+	p->m_dev_address = dev_address;
+	p->mp_ca9849 = pca9849;
+	p->m_mux_channel = mux_channel;
+	return 0;
+}
+
 void nthw_pcal6416a_write(nthw_pcal6416a_t *p, uint8_t pin, uint8_t value)
 {
 	uint8_t port;
drivers/net/ntnic/nthw/nthw_drv.h +1 -0
index ecd3bb9cc4..574dd663ea 100644
@@ -24,6 +24,7 @@
 typedef struct nthw_agx_s {
 	nthw_i2cm_t *p_i2cm;
 	nthw_pca9849_t *p_pca9849;
+	nthw_pcal6416a_t *p_io_ts;	/* PCAL6416A I/O expander for controlling TS */
 	nthw_pcal6416a_t *p_io_nim;	/* PCAL6416A I/O expander for controlling TS */
 	nthw_pca9532_t *p_pca9532_led;
 	nthw_si5332_t *p_si5332;
Signature · 1 line
2.45.0
#32 lore raw

PATCH 29/32 net/ntnic: add reset PHY init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Add initialization and logging for Phy Tile module.

---
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  39 ++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  16 +
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 598 ++++++++++++++++++
 3 files changed, 653 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h +39 -0
index 68d8455b8d..ba044a5091 100644
@@ -9,12 +9,16 @@
 #include "nthw_fpga_model.h"
 
 enum mac_pcs_mode_e {
+	MAC_PCS_MODE_8x10_25,
+	MAC_PCS_MODE_2X40,
 	MAC_PCS_MODE_2X100
 };
 
 struct nt_phy_tile {
 	nthw_fpga_t *mp_fpga;
 
+	nthw_module_t *m_mod_phy_tile;
+
 	int mn_phy_tile_instance;
 
 	int mn_fpga_version;
@@ -27,6 +31,7 @@ struct nt_phy_tile {
 	nthw_field_t *mp_fld_port_xcvr_base_busy[2][4];
 	nthw_field_t *mp_fld_port_xcvr_base_cmd[2][4];
 
+	nthw_register_t *mp_reg_port_xcvr_data[2][4];
 	nthw_field_t *mp_fld_port_xcvr_data_data[2][4];
 
 	nthw_register_t *mp_reg_port_eth_base[2];
@@ -34,27 +39,44 @@ struct nt_phy_tile {
 	nthw_field_t *mp_fld_port_eth_base_busy[2];
 	nthw_field_t *mp_fld_port_eth_base_cmd[2];
 
+	nthw_register_t *mp_reg_port_eth_data[2];
 	nthw_field_t *mp_fld_port_eth_data_data[2];
 
 	nthw_register_t *mp_reg_link_summary[2];
 	nthw_field_t *mp_fld_link_summary_nt_phy_link_state[2];
 	nthw_field_t *mp_fld_link_summary_ll_nt_phy_link_state[2];
 	nthw_field_t *mp_fld_link_summary_link_down_cnt[2];
+	nthw_field_t *mp_fld_link_summary_ll_rx_block_lock[2];
+	nthw_field_t *mp_fld_link_summary_ll_rx_am_lock[2];
+	nthw_field_t *mp_fld_link_summary_lh_rx_high_bit_error_rate[2];
 	nthw_field_t *mp_fld_link_summary_lh_received_local_fault[2];
 	nthw_field_t *mp_fld_link_summary_lh_remote_fault[2];
 
+	nthw_register_t *mp_reg_port_status[2];
+	nthw_field_t *mp_fld_port_status_rx_pcs_fully_aligned[2];
 	nthw_field_t *mp_fld_port_status_rx_hi_ber[2];
+	nthw_field_t *mp_fld_port_status_rx_remote_fault[2];
+	nthw_field_t *mp_fld_port_status_rx_local_fault[2];
 	nthw_field_t *mp_fld_port_status_rx_am_lock[2];
 	nthw_field_t *mp_fld_port_status_reset_ackn[2];
 	nthw_field_t *mp_fld_port_status_tx_lanes_stable[2];
+	nthw_field_t *mp_fld_port_status_tx_pll_locked[2];
+	nthw_field_t *mp_fld_port_status_sys_pll_locked[2];
 	nthw_field_t *mp_fld_port_status_tx_reset_ackn[2];
 	nthw_field_t *mp_fld_port_status_rx_reset_ackn[2];
 
+	nthw_register_t *mp_reg_port_config[2];
+	nthw_field_t *mp_fld_port_config_dyn_reset;
 	nthw_field_t *mp_fld_port_config_reset[2];
 	nthw_field_t *mp_fld_port_config_rx_reset[2];
 	nthw_field_t *mp_fld_port_config_tx_reset[2];
+	nthw_field_t *mp_fld_port_config_nt_linkup_latency[2];
+	nthw_field_t *mp_fld_port_config_nt_force_linkdown[2];
+	nthw_field_t *mp_fld_port_config_nt_auto_force_linkdown[2];
 
+	nthw_register_t *mp_reg_port_comp[2];
 	nthw_field_t *mp_fld_port_comp_rx_compensation[2];
+	nthw_field_t *mp_fld_port_comp_tx_compensation[2];
 
 	nthw_register_t *mp_reg_dyn_reconfig_base;
 	nthw_field_t *mp_fld_dyn_reconfig_base_ptr;
@@ -64,17 +86,34 @@ struct nt_phy_tile {
 	nthw_register_t *mp_reg_dyn_reconfig_data;
 	nthw_field_t *mp_fld_dyn_reconfig_data_data;
 
+	nthw_register_t *mp_reg_scratch;
 	nthw_field_t *mp_fld_scratch_data;
 
+	nthw_register_t *mp_reg_dr_cfg;
+	nthw_field_t *mp_fld_reg_dr_cfg_features;
+	nthw_field_t *mp_fld_reg_dr_cfg_tx_flush_level;
+
 	nthw_register_t *mp_reg_dr_cfg_status;
 	nthw_field_t *mp_fld_dr_cfg_status_curr_profile_id;
 	nthw_field_t *mp_fld_dr_cfg_status_in_progress;
 	nthw_field_t *mp_fld_dr_cfg_status_error;
+
+	nthw_register_t *mp_reg_sys_pll;
+	nthw_field_t *mp_fld_sys_pll_set_rdy;
+	nthw_field_t *mp_fld_sys_pll_get_rdy;
+	nthw_field_t *mp_fld_sys_pll_system_pll_lock;
+	nthw_field_t *mp_fld_sys_pll_en_ref_clk_fgt;
+	nthw_field_t *mp_fld_sys_pll_disable_ref_clk_monitor;
+	nthw_field_t *mp_fld_sys_pll_ref_clk_fgt_enabled;
+	nthw_field_t *mp_fld_sys_pll_forward_rst;
+	nthw_field_t *mp_fld_sys_pll_force_rst;
 };
 
 typedef struct nt_phy_tile nthw_phy_tile_t;
 typedef struct nt_phy_tile nt_phy_tile;
 
+nthw_phy_tile_t *nthw_phy_tile_new(void);
+int nthw_phy_tile_init(nthw_phy_tile_t *p, nthw_fpga_t *p_fpga, int mn_phy_tile_instance);
 void nthw_phy_tile_set_tx_pol_inv(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane, bool invert);
 void nthw_phy_tile_set_rx_pol_inv(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane, bool invert);
 void nthw_phy_tile_set_host_loopback(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +16 -0
index c8fd37d0ff..35cbaea81e 100644
@@ -181,7 +181,23 @@ static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 
 static int nthw_fpga_rst_nt400dxx_reset(struct fpga_info_s *p_fpga_info)
 {
+	const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str;
+	nthw_fpga_t *p_fpga = NULL;
+
+	p_fpga = p_fpga_info->mp_fpga;
+
 	assert(p_fpga_info);
+
+	NT_LOG(DBG, NTHW, "%s: %s: BEGIN", p_adapter_id_str, __PRETTY_FUNCTION__);
+
+	/* Create Phy Tile module */
+	p_fpga_info->mp_nthw_agx.p_phy_tile = nthw_phy_tile_new();
+
+	if (nthw_phy_tile_init(p_fpga_info->mp_nthw_agx.p_phy_tile, p_fpga, 0)) {
+		NT_LOG(ERR, NTHW, "%s: Failed to create Phy Tile Module", p_adapter_id_str);
+		return -1;
+	}
+
 	return 0;
 }
 
drivers/net/ntnic/nthw/core/nthw_phy_tile.c +598 -0

604 lines not on this page · raw message

Signature · 1 line
2.45.0
#33 lore raw

PATCH 30/32 net/ntnic: add igam module init

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

Create and initialize IGAM module.

---
 drivers/net/ntnic/meson.build                 |  1 +
 .../net/ntnic/nthw/core/include/nthw_igam.h   | 37 +++++++++++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  4 ++
 drivers/net/ntnic/nthw/core/nthw_igam.c       | 62 +++++++++++++++++++
 4 files changed, 104 insertions(+)
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_igam.h
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_igam.c
drivers/net/ntnic/meson.build +1 -0
index 7e326a3e1d..30a92130b5 100644
@@ -56,6 +56,7 @@ sources = files(
         'nthw/core/nthw_gpio_phy.c',
         'nthw/core/nthw_hif.c',
         'nthw/core/nthw_i2cm.c',
+        'nthw/core/nthw_igam.c',
         'nthw/core/nthw_iic.c',
         'nthw/core/nthw_mac_pcs.c',
         'nthw/core/nthw_pcie3.c',
drivers/net/ntnic/nthw/core/include/nthw_igam.h new file +37 -0
new file mode 100644
index 0000000000..e78637a331
@@ -0,0 +1,37 @@
+/*
+ * SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Napatech A/S
+ */
+
+#ifndef __NTHW_IGAM_H__
+#define __NTHW_IGAM_H__
+
+#include "nthw_fpga_model.h"
+
+struct nt_igam {
+	nthw_fpga_t *mp_fpga;
+
+	nthw_module_t *mp_mod_igam;
+
+	int mn_igam_instance;
+
+	nthw_register_t *mp_reg_base;
+	nthw_field_t *mp_fld_base_ptr;
+	nthw_field_t *mp_fld_base_busy;
+	nthw_field_t *mp_fld_base_cmd;
+
+	nthw_register_t *mp_reg_data;
+	nthw_field_t *mp_fld_data_data;
+
+	/* CTRL From version 0.1 */
+	nthw_register_t *mp_reg_ctrl;
+	nthw_field_t *mp_fld_ctrl_forward_rst;
+};
+
+typedef struct nt_igam nthw_igam_t;
+typedef struct nt_igam nthw_igam;
+
+nthw_igam_t *nthw_igam_new(void);
+int nthw_igam_init(nthw_igam_t *p, nthw_fpga_t *p_fpga, int mn_igam_instance);
+
+#endif	/*  __NTHW_IGAM_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +4 -0
index 35cbaea81e..95394b9c8f 100644
@@ -9,6 +9,7 @@
 #include "nthw_fpga.h"
 #include "nthw_hif.h"
 #include "ntnic_mod_reg.h"
+#include "nthw_igam.h"
 
 static int nthw_fpga_rst_nt400dxx_init(struct fpga_info_s *p_fpga_info)
 {
@@ -198,6 +199,9 @@ static int nthw_fpga_rst_nt400dxx_reset(struct fpga_info_s *p_fpga_info)
 		return -1;
 	}
 
+	nthw_igam_t *p_igam = nthw_igam_new();
+	nthw_igam_init(p_igam, p_fpga, 0);
+
 	return 0;
 }
 
drivers/net/ntnic/nthw/core/nthw_igam.c new file +62 -0

62 lines not on this page · raw message

Signature · 1 line
2.45.0
#34 lore raw

PATCH 31/32 net/ntnic: init IGAM and config PLL for FPGA

In reply to Serhii Iliushyk

From: Danylo Vodopianov <[email protected]>

- Initialize IGAM module and check for its presence.
- Enable system PLL using IGAM and check for PLL lock status.
- Reset and configure TS PLL and check for lock status.
- Force HIF soft reset and de-assert platform reset.
- Enable RAB1 and RAB2 and perform RAB initialization and flush.
- Check system PLL readiness using PHY_TILE and handle PLL lock status.

---
 .../net/ntnic/nthw/core/include/nthw_hif.h    |   1 +
 .../net/ntnic/nthw/core/include/nthw_igam.h   |   3 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     |   4 +
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |   8 +
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   | 211 ++++++++++++++++++
 drivers/net/ntnic/nthw/core/nthw_hif.c        |  10 +
 drivers/net/ntnic/nthw/core/nthw_igam.c       |  31 +++
 .../net/ntnic/nthw/core/nthw_pcm_nt400dxx.c   |  24 ++
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   |  61 +++++
 drivers/net/ntnic/nthw/nthw_drv.h             |   2 +
 10 files changed, 355 insertions(+)
drivers/net/ntnic/nthw/core/include/nthw_hif.h +1 -0
index deb9ed04e8..7d5e1f1310 100644
@@ -135,6 +135,7 @@ void nthw_hif_delete(nthw_hif_t *p);
 int nthw_hif_init(nthw_hif_t *p, nthw_fpga_t *p_fpga, int n_instance);
 
 int nthw_hif_trigger_sample_time(nthw_hif_t *p);
+int nthw_hif_force_soft_reset(nthw_hif_t *p);
 
 int nthw_hif_stat_req_enable(nthw_hif_t *p);
 int nthw_hif_stat_req_disable(nthw_hif_t *p);
drivers/net/ntnic/nthw/core/include/nthw_igam.h +3 -0
index e78637a331..fed462cd34 100644
@@ -33,5 +33,8 @@ typedef struct nt_igam nthw_igam;
 
 nthw_igam_t *nthw_igam_new(void);
 int nthw_igam_init(nthw_igam_t *p, nthw_fpga_t *p_fpga, int mn_igam_instance);
+uint32_t nthw_igam_read(nthw_igam_t *p, uint32_t address);
+void nthw_igam_write(nthw_igam_t *p, uint32_t address, uint32_t data);
+void nthw_igam_set_ctrl_forward_rst(nthw_igam_t *p, uint32_t value);
 
 #endif	/*  __NTHW_IGAM_H__ */
drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h +4 -0
index 23865f466b..47d2670cf5 100644
@@ -32,5 +32,9 @@ typedef struct nthw_pcm_nt400_dxx nthw_pcm_nt400_dxx;
 
 nthw_pcm_nt400dxx_t *nthw_pcm_nt400dxx_new(void);
 int nthw_pcm_nt400dxx_init(nthw_pcm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int n_instance);
+void nthw_pcm_nt400dxx_set_ts_pll_recal(nthw_pcm_nt400dxx_t *p, uint32_t val);
+bool nthw_pcm_nt400dxx_get_ts_pll_locked_stat(nthw_pcm_nt400dxx_t *p);
+bool nthw_pcm_nt400dxx_get_ts_pll_locked_latch(nthw_pcm_nt400dxx_t *p);
+void nthw_pcm_nt400dxx_set_ts_pll_locked_latch(nthw_pcm_nt400dxx_t *p, uint32_t val);
 
 #endif	/* __NTHW_PCM_NT400DXX_H__ */
drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h +8 -0
index ba044a5091..c4ec100c23 100644
@@ -142,7 +142,15 @@ void nthw_phy_tile_write_xcvr(nthw_phy_tile_t *p, uint8_t intf_no, uint8_t lane,
 	uint32_t data);
 uint32_t nthw_phy_tile_get_port_status_reset_ack(nthw_phy_tile_t *p, uint8_t intf_no);
 uint32_t nthw_phy_tile_get_port_status_tx_lanes_stable(nthw_phy_tile_t *p, uint8_t intf_no);
+void nthw_phy_tile_set_sys_pll_set_rdy(nthw_phy_tile_t *p, uint32_t value);
+uint32_t nthw_phy_tile_get_sys_pll_get_rdy(nthw_phy_tile_t *p);
+uint32_t nthw_phy_tile_get_sys_pll_system_pll_lock(nthw_phy_tile_t *p);
+void nthw_phy_tile_set_sys_pll_en_ref_clk_fgt(nthw_phy_tile_t *p, uint32_t value);
+uint32_t nthw_phy_tile_get_sys_pll_ref_clk_fgt_enabled(nthw_phy_tile_t *p);
+void nthw_phy_tile_set_sys_pll_forward_rst(nthw_phy_tile_t *p, uint32_t value);
+void nthw_phy_tile_set_sys_pll_force_rst(nthw_phy_tile_t *p, uint32_t value);
 uint8_t nthw_phy_tile_get_no_intfs(nthw_phy_tile_t *p);
 void nthw_phy_tile_set_port_config_rst(nthw_phy_tile_t *p, uint8_t intf_no, uint32_t value);
+bool nthw_phy_tile_use_phy_tile_pll_check(nthw_phy_tile_t *p);
 
 #endif	/* __NTHW_PHY_TILE_H__ */
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c +211 -0

229 lines not on this page · raw message

drivers/net/ntnic/nthw/core/nthw_hif.c +10 -0
index 92a2348bbb..630262a7fc 100644
@@ -202,6 +202,16 @@ int nthw_hif_init(nthw_hif_t *p, nthw_fpga_t *p_fpga, int n_instance)
 	return 0;
 }
 
+int nthw_hif_force_soft_reset(nthw_hif_t *p)
+{
+	if (p->mp_fld_ctrl_fsr) {
+		nthw_field_update_register(p->mp_fld_ctrl_fsr);
+		nthw_field_set_flush(p->mp_fld_ctrl_fsr);
+	}
+
+	return 0;
+}
+
 int nthw_hif_trigger_sample_time(nthw_hif_t *p)
 {
 	nthw_field_set_val_flush32(p->mp_fld_sample_time, 0xfee1dead);
drivers/net/ntnic/nthw/core/nthw_igam.c +31 -0
index 5dc7e36c7b..385282298a 100644
@@ -60,3 +60,34 @@ int nthw_igam_init(nthw_igam_t *p, nthw_fpga_t *p_fpga, int mn_igam_instance)
 
 	return 0;
 }
+
+uint32_t nthw_igam_read(nthw_igam_t *p, uint32_t address)
+{
+	nthw_register_update(p->mp_reg_base);
+	nthw_field_set_val32(p->mp_fld_base_cmd, 0);
+	nthw_field_set_val_flush32(p->mp_fld_base_ptr, address);
+
+	while (nthw_field_get_updated(p->mp_fld_base_busy) == 1)
+		nt_os_wait_usec(100);
+
+	return nthw_field_get_updated(p->mp_fld_data_data);
+}
+
+void nthw_igam_write(nthw_igam_t *p, uint32_t address, uint32_t data)
+{
+	nthw_field_set_val_flush32(p->mp_fld_data_data, data);
+	nthw_register_update(p->mp_reg_base);
+	nthw_field_set_val32(p->mp_fld_base_ptr, address);
+	nthw_field_set_val_flush32(p->mp_fld_base_cmd, 1);
+
+	while (nthw_field_get_updated(p->mp_fld_base_busy) == 1)
+		nt_os_wait_usec(100);
+}
+
+void nthw_igam_set_ctrl_forward_rst(nthw_igam_t *p, uint32_t value)
+{
+	if (p->mp_fld_ctrl_forward_rst) {
+		nthw_field_get_updated(p->mp_fld_ctrl_forward_rst);
+		nthw_field_set_val_flush32(p->mp_fld_ctrl_forward_rst, value);
+	}
+}
drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c +24 -0
index f32a277e86..e7be634a83 100644
@@ -54,3 +54,27 @@ int nthw_pcm_nt400dxx_init(nthw_pcm_nt400dxx_t *p, nthw_fpga_t *p_fpga, int n_in
 
 	return 0;
 }
+
+void nthw_pcm_nt400dxx_set_ts_pll_recal(nthw_pcm_nt400dxx_t *p, uint32_t val)
+{
+	if (p->mp_fld_ctrl_ts_pll_recal) {
+		nthw_field_update_register(p->mp_fld_ctrl_ts_pll_recal);
+		nthw_field_set_val_flush32(p->mp_fld_ctrl_ts_pll_recal, val);
+	}
+}
+
+bool nthw_pcm_nt400dxx_get_ts_pll_locked_stat(nthw_pcm_nt400dxx_t *p)
+{
+	return nthw_field_get_updated(p->mp_fld_stat_ts_pll_locked) != 0;
+}
+
+bool nthw_pcm_nt400dxx_get_ts_pll_locked_latch(nthw_pcm_nt400dxx_t *p)
+{
+	return nthw_field_get_updated(p->mp_fld_latch_ts_pll_locked) != 0;
+}
+
+void nthw_pcm_nt400dxx_set_ts_pll_locked_latch(nthw_pcm_nt400dxx_t *p, uint32_t val)
+{
+	nthw_field_update_register(p->mp_fld_latch_ts_pll_locked);
+	nthw_field_set_val_flush32(p->mp_fld_latch_ts_pll_locked, val);
+}
drivers/net/ntnic/nthw/core/nthw_phy_tile.c +61 -0

73 lines not on this page · raw message

drivers/net/ntnic/nthw/nthw_drv.h +2 -0
index 574dd663ea..e1a00c5ea5 100644
@@ -17,6 +17,7 @@
 #include "nthw_phy_tile.h"
 #include "nthw_prm_nt400dxx.h"
 #include "nthw_pcm_nt400dxx.h"
+#include "nthw_igam.h"
 
 /*
  * Structs for controlling Agilex based NT400DXX adapter
@@ -31,6 +32,7 @@ typedef struct nthw_agx_s {
 	nthw_si5156_t *p_si5156;
 	nthw_prm_nt400dxx_t *p_prm;
 	nthw_pcm_nt400dxx_t *p_pcm;
+	nthw_igam_t *p_igam;
 	nthw_phy_tile_t *p_phy_tile;
 	nthw_rpf_t *p_rpf;
 	bool tcxo_present;
Signature · 1 line
2.45.0
#35 lore raw

PATCH 32/32 net/ntnic: revert untrusted loop bound

In reply to Serhii Iliushyk

The changes for untrusted loop bound breaks VLAN processing

This reverts commit 36cd2cb0eea49813dd59ee1df2eb592e8ae5b6b4.

---
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +1 -1
index 70bff776be..43f45ebe34 100644
@@ -53,7 +53,7 @@ int interpret_raw_data(uint8_t *data, uint8_t *preserve, int size, struct rte_fl
 		goto interpret_end;
 
 	/* VLAN */
-	if (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ||
+	while (ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_VLAN) ||
 		ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ) ||
 		ether_type == rte_cpu_to_be_16(RTE_ETHER_TYPE_QINQ1)) {
 		if (size - pkti == 0)
Signature · 1 line
2.45.0
#36 lore raw

Re: [PATCH v1 32/32] net/ntnic: revert untrusted loop bound

Quoted 5 lines · On Thu, 20 Feb 2025 23:03:56 +0100 Serhii Iliushyk <[email protected]> wrote:

The changes for untrusted loop bound breaks VLAN processing

This reverts commit 36cd2cb0eea49813dd59ee1df2eb592e8ae5b6b4.

This will bring back the Coverity bug and potential for VLAN "packet of doom" bugs. Any loop iterating over VLAN's needs to limit depth

#37 lore raw
In reply to Serhii Iliushyk

Ok, scan of ntnic with PVS studio after this bundle. Similar to Coverity it is a good automated tool for finding bugs.

MESSAGES
LocationCodeMessage
Fails/Info

nt4ga_adapter.c (129)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. Under certain conditions the pointer can be null.

nt4ga_adapter.c (150)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. Under certain conditions the pointer can be null.

nt4ga_stat.c (252)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'p_nt4ga_stat' pointer was utilized before it was verified against nullptr. Check lines:
252, 259.

nt4ga_stat.c (47)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'p_nt4ga_stat' is always true.

ntnic_dbsconfig.c (595)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'txvq' pointer was utilized before it was verified against nullptr. Check lines: 595, 597.

ntnic_dbsconfig.c (765)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'irq_vector

Quoted 1 line

= 0' is always false.

ntnic_dbsconfig.c (400)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

hw_mod_backend.h (750)
V1071 <https://pvs-studio.com/en/docs/warnings/v1071/> Consider inspecting the 'hw_mod_hsh_rcp_set' function. The return value is not always used. Total calls: 15, discarded results: 1.

nt4ga_link_100g.c (259)
V781 <https://pvs-studio.com/en/docs/warnings/v781/> The value of the 'port' variable is checked after it was used. Perhaps there is a mistake in program logic. Check lines: 259, 261.

nt4ga_link_100g.c (674)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always true: res == 0.

nt4ga_agx_link_100g.c (696)
V523 <https://pvs-studio.com/en/docs/warnings/v523/> The 'then' statement is equivalent to the 'else' statement.

nt4ga_agx_link_100g.c (1012)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'res == 0' is always true.

nt4ga_agx_link_100g.c (1021)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'res == 0' is always true.

nt4ga_agx_link_100g.c (522)
V781 <https://pvs-studio.com/en/docs/warnings/v781/> The value of the 'port' variable is checked after it was used. Perhaps there is a mistake in program logic. Check lines: 522, 524.

nt4ga_agx_link_100g.c (916)
V619 <https://pvs-studio.com/en/docs/warnings/v619/> The array 'nim_ctx' is being utilized as a pointer to single object.

nt4ga_agx_link_100g.c (318)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (370)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (370)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (385)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (391)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (976)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (984)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

nt4ga_agx_link_100g.c (380)
V1051 <https://pvs-studio.com/en/docs/warnings/v1051/> Consider checking for misprints. It's possible that the 'state->link_up' should be checked here.

i2c_nim.c (126)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'multi_byte == 1' is always true.

i2c_nim.c (881)
V519 <https://pvs-studio.com/en/docs/warnings/v519/> The variable is assigned values twice successively. Perhaps this is a mistake. Check lines:
880, 881.

nthw_fpga_rst9563.c (62)
V519 <https://pvs-studio.com/en/docs/warnings/v519/> The 'p->mp_fld_rst_ptp' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 61, 62.

nthw_fpga_rst9563.c (107)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression '!p->mp_fld_stat_tsm_ref_mmcm_locked' is always true.

nthw_fpga_rst9563.c (129)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression '!p->mp_fld_sticky_tsm_ref_mmcm_unlocked' is always true.

nthw_fpga_rst_nt200a0x.c (531)
V519 <https://pvs-studio.com/en/docs/warnings/v519/> The 'res' variable is assigned values twice successively. Perhaps this is a mistake. Check lines:
530, 531.

nthw_fpga_rst_nt200a0x.c (62)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_fpga_rst_nt200a0x.c (72)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_fpga_nt400dxx.c (187)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'rst9574_ops' is always true.

nthw_fpga_rst_nt400dxx.c (185)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'p_fpga_info' pointer was utilized before it was verified against nullptr. Check lines:
185, 194.

nthw_fpga_rst_nt400dxx.c (60)
V525 <https://pvs-studio.com/en/docs/warnings/v525/> The code contains the collection of similar blocks. Check items 'nthw_prm_nt400dxx_platform_rst', 'nthw_prm_nt400dxx_periph_rst', 'nthw_prm_nt400dxx_periph_rst' in lines 60, 64, 66.

nthw_fpga_rst_nt400dxx.c (116)
V525 <https://pvs-studio.com/en/docs/warnings/v525/> The code contains the collection of similar blocks. Check items '0', '1', '0', '0', '1' in lines 116, 122, 128, 134, 140.

nthw_fpga.c (623)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'p_fpga_info' pointer was utilized before it was verified against nullptr. Check lines:
623, 639.

nthw_fpga.c (317)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: avr_vpd_info.n_avr_spi_version >= 3.

nthw_fpga.c (387)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: avr_vpd_info.n_avr_spi_version >= 3.

nthw_fpga.c (469)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: avr_vpd_info.n_avr_spi_version >= 3.

nthw_fpga.c (831)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always true: p_fpga_info.

nthw_fpga.c (831)
V571 <https://pvs-studio.com/en/docs/warnings/v571/> Recurring check. The 'p_fpga_info' condition was already verified in line 830.

nthw_fpga.c (524)
V1086 <https://pvs-studio.com/en/docs/warnings/v1086/> A call of the 'memcpy' function will lead to underflow of the buffer '& p_vpd_board_info[0]'.

nthw_hif.c (27)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_hif.c (82)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_iic.c (257)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_iic.c (242)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_pcie3.c (28)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_pcm_nt400dxx.c (45)
V525 <https://pvs-studio.com/en/docs/warnings/v525/> The code contains the collection of similar blocks. Check items 'nthw_register_query_field', 'nthw_register_get_field', 'nthw_register_get_field' in lines 45, 49, 53.

nthw_phy_tile.c (821)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'i == 0' is always false.

nthw_phy_tile.c (800)
V1048 <https://pvs-studio.com/en/docs/warnings/v1048/> The 'xcvr_instance' variable was assigned the same value.

nthw_phy_tile.c (86)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

nthw_rpf.c (26)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_sdc.c (26)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_sdc.c (135)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'pn_result_mask' is always true.

nthw_si5340.c (48)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_spi_v3.c (140)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_spi_v3.c (148)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_spi_v3.c (154)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_spi_v3.c (159)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_tsm.c (92)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'p_ts' is always true.

nthw_tsm.c (111)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'p_time' is always true.

flow_api.c (833)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'ndev' is always true.

flow_api.c (999)
V1029 <https://pvs-studio.com/en/docs/warnings/v1029/> Numeric Truncation Error. Return value of the 'strlen' function is written to the 16-bit variable.

flow_api.c (1001)
V1029 <https://pvs-studio.com/en/docs/warnings/v1029/> Numeric Truncation Error. Return value of the 'strlen' function is written to the 16-bit variable.

flow_api.c (214)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_api.c (227)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_api.c (428)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_group.c (35)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> There might be dereferencing of a potential null pointer 'group_handle'. Check lines: 35, 32.

flow_hsh_cfg.c (74)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_hsh_cfg.c (77)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_id_table.c (71)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> There might be dereferencing of a potential null pointer 'handle'. Check lines: 71, 69.

flow_km.c (583)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_km.c (614)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_km.c (791)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_km.c (92)
V769 <https://pvs-studio.com/en/docs/warnings/v769/> The '(char *) km->cam_dist' pointer in the expression could be nullptr. In such case, resulting value of arithmetic operations on this pointer will be senseless and it should not be used. Check lines: 92, 85.

hw_mod_flm.c (836)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'be->flm.ver < 18' is always false.

hw_mod_hsh.c (127)
V568 <https://pvs-studio.com/en/docs/warnings/v568/> It's odd that 'sizeof()' operator evaluates the size of a pointer to a class, but not the size of the 'be->hsh.v5.rcp' class object.

hw_mod_hsh.c (130)
V1064 <https://pvs-studio.com/en/docs/warnings/v1064/> The 'buffer_size' operand of integer division is less than the 'element_size' one. The result will always be zero.

hw_mod_hsh.c (133)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: index < max_idx. Unsigned type value is never < 0.

hw_mod_hsh.c (133)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: word_off < max_idx. Unsigned type value is never < 0.

hw_mod_pdb.c (137)
V568 <https://pvs-studio.com/en/docs/warnings/v568/> It's odd that 'sizeof()' operator evaluates the size of a pointer to a class, but not the size of the 'be->pdb.v9.rcp' class object.

hw_mod_pdb.c (140)
V1064 <https://pvs-studio.com/en/docs/warnings/v1064/> The 'buffer_size' operand of integer division is less than the 'element_size' one. The result will always be zero.

hw_mod_pdb.c (143)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: * value < max_idx. Unsigned type value is never < 0.

hw_mod_pdb.c (143)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: index < max_idx. Unsigned type value is never < 0.

flm_evt_queue.c (194)
V557 <https://pvs-studio.com/en/docs/warnings/v557/> Array overrun is possible. The value of 'port' index could reach 127.

flm_evt_queue.c (202)
V557 <https://pvs-studio.com/en/docs/warnings/v557/> Array overrun is possible. The value of 'port' index could reach 127.

flm_evt_queue.c (80)
V1037 <https://pvs-studio.com/en/docs/warnings/v1037/> Two or more case-branches perform the same actions. Check lines: 80, 88

flm_evt_queue.c (84)
V1037 <https://pvs-studio.com/en/docs/warnings/v1037/> Two or more case-branches perform the same actions. Check lines: 84, 92

flow_api_hw_db_inline.c (2461)
V1086 <https://pvs-studio.com/en/docs/warnings/v1086/> A call of the 'memset' function will lead to underflow of the buffer '& db->flm[idx.id1].data'.

flow_api_hw_db_inline.c (426)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (428)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (428)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (428)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (428)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (438)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (446)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (455)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (457)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the eighth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (457)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (457)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (457)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (457)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (457)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (467)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (482)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (494)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (509)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (518)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (526)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (560)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (578)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (579)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (579)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (579)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (579)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (581)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (581)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (581)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (581)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (583)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (583)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The integer argument of 32-bit size is expected.

flow_api_hw_db_inline.c (596)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (604)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (610)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (618)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (619)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (620)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (621)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (627)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (628)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (629)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fourth actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (629)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (636)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the third actual argument of the 'fprintf' function. The SIGNED integer type argument is expected.

flow_api_hw_db_inline.c (706)
V1037 <https://pvs-studio.com/en/docs/warnings/v1037/> Two or more case-branches perform the same actions. Check lines: 706, 736, 742

flow_api_profile_inline.c (117)
V629 <https://pvs-studio.com/en/docs/warnings/v629/> Consider inspecting the '1 << (shift - 1)' expression. Bit shifting of the 32-bit value with a subsequent expansion to the 64-bit type.

flow_api_profile_inline.c (738)
V674 <https://pvs-studio.com/en/docs/warnings/v674/> The '0.01' literal of the 'double' type is compared to a value of the 'int' type. Consider inspecting the '0.01 > 0' expression.

flow_api_profile_inline.c (3469)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> There might be dereferencing of a potential null pointer 'fh'. Check lines: 3469, 3467.

flow_api_profile_inline.c (4925)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> There might be dereferencing of a potential null pointer 'template'. Check lines: 4925, 4923.

flow_api_profile_inline.c (4990)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> There might be dereferencing of a potential null pointer 'template'. Check lines: 4990, 4988.

flow_api_profile_inline.c (5262)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> There might be dereferencing of a potential null pointer 'fh'. Check lines: 5262, 5260.

flow_api_profile_inline.c (4307)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'err' is always false.

flow_api_profile_inline.c (2040)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always true: match_cnt == 1.

flow_api_profile_inline.c (196)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer is cast to a more strictly aligned pointer type

flow_api_profile_inline.c (254)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer is cast to a more strictly aligned pointer type

flow_api_profile_inline.c (294)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer is cast to a more strictly aligned pointer type

flow_api_profile_inline.c (347)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer is cast to a more strictly aligned pointer type

flow_api_profile_inline.c (434)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer 'data' is cast to a more strictly aligned pointer type.

flow_api_profile_inline.c (510)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer 'data' is cast to a more strictly aligned pointer type.

flow_api_profile_inline.c (980)
V1032 <https://pvs-studio.com/en/docs/warnings/v1032/> The pointer is cast to a more strictly aligned pointer type

flow_api_profile_inline.c (4758)
V523 <https://pvs-studio.com/en/docs/warnings/v523/> The 'then' statement is equivalent to the 'else' statement.

flow_api_profile_inline.c (2272)
V525 <https://pvs-studio.com/en/docs/warnings/v525/> The code contains the collection of similar blocks. Check items 'qw_data', 'qw_data', 'qw_mask' in lines 2272, 2273, 2275.

flow_api_profile_inline.c (1160)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the eighth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

flow_api_profile_inline.c (1224)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_api_profile_inline.c (3133)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_api_profile_inline.c (4507)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

flow_api_profile_inline.c (3573)
V1048 <https://pvs-studio.com/en/docs/warnings/v1048/> The 'action_set_data.contains_jump' variable was assigned the same value.

flow_api_profile_inline.c (972)
V1051 <https://pvs-studio.com/en/docs/warnings/v1051/> Consider checking for misprints. It's possible that the 'flm_id' should be checked here.

flow_nthw_cat.c (29)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_csu.c (33)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_flm.c (30)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_flm.c (736)
V1020 <https://pvs-studio.com/en/docs/warnings/v1020/> The function exited without calling the 'rte_spinlock_unlock' function. Check lines: 736, 729.

flow_nthw_hfu.c (33)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_hsh.c (34)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_info.c (34)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_km.c (43)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_pdb.c (34)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_qsl.c (34)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_rpp_lr.c (33)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_rpp_lr.c (65)
V1004 <https://pvs-studio.com/en/docs/warnings/v1004/> The 'p->m_rpp_lr' pointer was used unsafely after it was verified against nullptr. Check
lines: 57, 65.

flow_nthw_slc_lr.c (34)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_tx_cpy.c (34)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_tx_ins.c (33)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

flow_nthw_tx_rpl.c (33)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_fpga_model.c (491)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'p->m_rpp_lr' pointer was utilized before it was verified against nullptr. Check lines:
'nthw_fpga_model.c:479', 'nthw_fpga_model.c:491', 'flow_nthw_rpp_lr.c:65', 'flow_nthw_rpp_lr.c:69'.

nthw_fpga_model.c (186)
V597 <https://pvs-studio.com/en/docs/warnings/v597/> The compiler could delete the 'memset' function call, which is used to flush 'p' object. The memset_s() function should be used to erase the private data.

nthw_fpga_model.c (365)
V522 <https://pvs-studio.com/en/docs/warnings/v522/> Dereferencing of the null pointer might take place. The potential null pointer is passed into 'nthw_fpga_get_param_info' function. Inspect the second argument. Check
lines: 'nthw_fpga_model.c:365', 'nthw_fpga.c:25', 'nthw_fpga.c:687'.

nthw_fpga_model.c (906)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the 14th actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_fpga_model.c (906)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (515)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression '(word_cnt
+ 3) > (0x4000)' is always false.

nthw_rac.c (34)
V575 <https://pvs-studio.com/en/docs/warnings/v575/> The potential null pointer is passed into 'memset' function. Inspect the first argument. Check
lines: 34, 33.

nthw_rac.c (265)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the eighth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (469)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the eighth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (508)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the eighth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (560)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (578)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (747)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (768)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

nthw_rac.c (94)
V1048 <https://pvs-studio.com/en/docs/warnings/v1048/> The 'p->mp_reg_dbg_data' variable was assigned the same value.

ntnic_meter.c (89)
V525 <https://pvs-studio.com/en/docs/warnings/v525/> The code contains the collection of similar blocks. Check items '0', '1', '0', '0', '0', '0' in lines 89, 90, 91, 94, 95, 96.

nthw_stat.c (257)
V1048 <https://pvs-studio.com/en/docs/warnings/v1048/> The 'p->mn_stat_layout_version' variable was assigned the same value.

ntnic_ethdev.c (2194)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'err == 0' is always true.

ntnic_ethdev.c (334)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'internals->p_drv' pointer was utilized before it was verified against nullptr. Check lines:
334, 350.

ntnic_ethdev.c (2268)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression '(1 << n_intf_no) & ~n_port_mask' is always false.

ntnic_ethdev.c (191)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: !p_nt4ga_stat.

ntnic_ethdev.c (238)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: !p_nt4ga_stat.

ntnic_ethdev.c (1763)
V1044 <https://pvs-studio.com/en/docs/warnings/v1044/> Loop break conditions do not depend on the number of iterations.

ntnic_ethdev.c (1900)
V1044 <https://pvs-studio.com/en/docs/warnings/v1044/> Loop break conditions do not depend on the number of iterations.

ntnic_ethdev.c (1935)
V1044 <https://pvs-studio.com/en/docs/warnings/v1044/> Loop break conditions do not depend on the number of iterations.

ntnic_ethdev.c (1942)
V1044 <https://pvs-studio.com/en/docs/warnings/v1044/> Loop break conditions do not depend on the number of iterations.

ntnic_ethdev.c (1370)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'port == internals->n_intf_no' is always true.

ntnic_ethdev.c (1396)
V547 <https://pvs-studio.com/en/docs/warnings/v547/> Expression 'port == internals->n_intf_no' is always true.

ntnic_ethdev.c (375)
V574 <https://pvs-studio.com/en/docs/warnings/v574/> The 'hw_recv' pointer is used simultaneously as an array and as a pointer to single object. Check
lines: 375, 457.

ntnic_ethdev.c (844)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (866)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the tenth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (907)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (974)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the seventh actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

ntnic_ethdev.c (974)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

ntnic_ethdev.c (1012)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (1042)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (1076)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (1136)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (1277)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

ntnic_ethdev.c (1335)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

ntnic_ethdev.c (2302)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_ethdev.c (2308)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the sixth actual argument of the 'rte_log' function. The SIGNED integer type argument is expected.

ntnic_filter.c (481)
V595 <https://pvs-studio.com/en/docs/warnings/v595/> The 'internals' pointer was utilized before it was verified against nullptr. Check lines:
481, 487.

ntnic_filter.c (1159)
V560 <https://pvs-studio.com/en/docs/warnings/v560/> A part of conditional expression is always false: !p_nt4ga_stat.

ntnic_filter.c (357)
V576 <https://pvs-studio.com/en/docs/warnings/v576/> Incorrect format. Consider checking the fifth actual argument of the 'rte_log' function. The UNSIGNED integer type argument is expected.

ntnic_filter.c (1121)
V1027 <https://pvs-studio.com/en/docs/warnings/v1027/> Pointer to an object of the 'flow_handle' class is cast to unrelated 'rte_flow' class.

ntnic_filter.c (1143)
V1027 <https://pvs-studio.com/en/docs/warnings/v1027/> Pointer to an object of the 'rte_flow' class is cast to unrelated 'flow_handle' class.

ntnic_vfio.c (81)
V1048 <https://pvs-studio.com/en/docs/warnings/v1048/> The 'vfio->container_fd' variable was assigned the same value.

Quoted 171 lines · Serhii Iliushyk

This patchset adds support for the new adapter NT400D13.

Danylo Vodopianov (23):
net/ntnic: add link agx 100g
net/ntnic: add link state machine
net/ntnic: add rpf and gfg init
net/ntnic: add agx setup for port
net/ntnic: add host loopback init
net/ntnic: add line loopback init
net/ntnic: add 100 gbps port init
net/ntnic: add port post init
net/ntnic: add nim low power API
net/ntnic: add link handling API
net/ntnic: add port init to the state machine
net/ntnic: add port disable API
net/ntnic: add nt400d13 pcm init
net/ntnic: add HIF clock test
net/ntnic: add nt400d13 PRM module init
net/ntnic: add nt400d13 PRM module reset
net/ntnic: add SPI v3 support for FPGA
net/ntnic: add i2cm init
net/ntnic: add pca init
net/ntnic: add pcal init
net/ntnic: add reset PHY init
net/ntnic: add igam module init
net/ntnic: init IGAM and config PLL for FPGA

Serhii Iliushyk (9):
net/ntnic: add minimal initialization new NIC NT400D13 net/ntnic: add minimal reset FPGA
net/ntnic: add FPGA modules and registers net/ntnic: add setup for fpga reset net/ntnic: add default reset setting for NT400D13 net/ntnic: add DDR calibration to reset stage net/ntnic: add PHY ftile reset
net/ntnic: add clock init
net/ntnic: revert untrusted loop bound

 doc/guides/nics/ntnic.rst                     |    7 +-
 doc/guides/rel_notes/release_25_03.rst        |    4 +
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |    9 +
 drivers/net/ntnic/include/nt4ga_link.h        |    7 +
 drivers/net/ntnic/include/nthw_gfg.h          |   33 +
 drivers/net/ntnic/include/ntnic_nim.h         |    5 +
 .../include/ntnic_nthw_fpga_rst_nt400dxx.h    |   34 +
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 1029 ++++++
 drivers/net/ntnic/meson.build                 |   16 +
 drivers/net/ntnic/nim/i2c_nim.c               |  158 +-
 drivers/net/ntnic/nim/i2c_nim.h               |    6 +
 ...00D13_U62_Si5332-GM2-RevD-1_V5-Registers.h |  425 +++
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |   10 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |    2 +
 .../net/ntnic/nthw/core/include/nthw_hif.h    |    4 +
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |    3 +
 .../net/ntnic/nthw/core/include/nthw_igam.h   |   40 +
 .../ntnic/nthw/core/include/nthw_pca9532.h    |   25 +
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |   33 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     |   40 +
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  156 +
 .../nthw/core/include/nthw_prm_nt400dxx.h     |   32 +
 .../nthw/core/include/nthw_si5332_si5156.h    |   63 +
 .../net/ntnic/nthw/core/include/nthw_spi_v3.h |  107 +
 .../net/ntnic/nthw/core/include/nthw_spim.h   |   58 +
 .../net/ntnic/nthw/core/include/nthw_spis.h   |   63 +
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   |  220 ++
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   |  377 ++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  427 +++
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  464 +++
 drivers/net/ntnic/nthw/core/nthw_gfg.c        |  340 ++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        |   41 +
 drivers/net/ntnic/nthw/core/nthw_hif.c        |   92 +
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       |  139 +
 drivers/net/ntnic/nthw/core/nthw_igam.c       |   93 +
 drivers/net/ntnic/nthw/core/nthw_pca9532.c    |   60 +
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  |  103 +
 .../net/ntnic/nthw/core/nthw_pcm_nt400dxx.c   |   80 +
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 1242 +++++++
 .../net/ntnic/nthw/core/nthw_prm_nt400dxx.c   |   55 +
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  |  142 +
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     |  358 ++
 drivers/net/ntnic/nthw/core/nthw_spim.c       |  113 +
 drivers/net/ntnic/nthw/core/nthw_spis.c       |  121 +
 drivers/net/ntnic/nthw/nthw_drv.h             |   31 +
 drivers/net/ntnic/nthw/nthw_platform.c        |    3 +
 drivers/net/ntnic/nthw/nthw_platform_drv.h    |    2 +
 .../supported/nthw_fpga_9574_055_049_0000.c   | 3124 +++++++++++++++++
 .../nthw/supported/nthw_fpga_instances.c      |    5 +-
 .../nthw/supported/nthw_fpga_instances.h      |    1 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   11 +
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   11 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   11 +
 .../nthw/supported/nthw_fpga_reg_defs_igam.h  |   32 +
 .../supported/nthw_fpga_reg_defs_pci_ta.h     |   33 +
 .../nthw_fpga_reg_defs_pcm_nt400dxx.h         |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_pdi.h   |   49 +
 .../supported/nthw_fpga_reg_defs_phy_tile.h   |  213 ++
 .../nthw_fpga_reg_defs_prm_nt400dxx.h         |   26 +
 .../nthw/supported/nthw_fpga_reg_defs_rfd.h   |   38 +
 .../supported/nthw_fpga_reg_defs_rst9574.h    |   35 +
 .../nthw/supported/nthw_fpga_reg_defs_spim.h  |   76 +
 .../nthw/supported/nthw_fpga_reg_defs_spis.h  |   51 +
 .../nthw/supported/nthw_fpga_reg_defs_tint.h  |   28 +
 drivers/net/ntnic/ntnic_ethdev.c              |    1 +
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |    2 +-
 drivers/net/ntnic/ntnic_mod_reg.c             |   47 +
 drivers/net/ntnic/ntnic_mod_reg.h             |   25 +
 68 files changed, 10709 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/ntnic/include/nthw_gfg.h
 create mode 100644
drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt400dxx.h
 create mode 100644
drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c
 create mode 100644
drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_igam.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pca9532.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
 create mode 100644
drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spim.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spis.h
 create mode 100644
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c
 create mode 100644
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c
 create mode 100644
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_igam.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pca9532.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_phy_tile.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_9574_055_049_0000.c
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9574.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h
 create mode 100644
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h
 create mode 100644

drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h

--
2.45.0

#38 lore raw
In reply to Serhii Iliushyk
Quoted 139 lines · On Thu, 20 Feb 2025 23:03:24 +0100 Serhii Iliushyk <[email protected]> wrote:

This patchset adds support for the new adapter NT400D13.

Danylo Vodopianov (23):
net/ntnic: add link agx 100g
net/ntnic: add link state machine
net/ntnic: add rpf and gfg init
net/ntnic: add agx setup for port
net/ntnic: add host loopback init
net/ntnic: add line loopback init
net/ntnic: add 100 gbps port init
net/ntnic: add port post init
net/ntnic: add nim low power API
net/ntnic: add link handling API
net/ntnic: add port init to the state machine
net/ntnic: add port disable API
net/ntnic: add nt400d13 pcm init
net/ntnic: add HIF clock test
net/ntnic: add nt400d13 PRM module init
net/ntnic: add nt400d13 PRM module reset
net/ntnic: add SPI v3 support for FPGA
net/ntnic: add i2cm init
net/ntnic: add pca init
net/ntnic: add pcal init
net/ntnic: add reset PHY init
net/ntnic: add igam module init
net/ntnic: init IGAM and config PLL for FPGA

Serhii Iliushyk (9):
net/ntnic: add minimal initialization new NIC NT400D13 net/ntnic: add minimal reset FPGA
net/ntnic: add FPGA modules and registers net/ntnic: add setup for fpga reset net/ntnic: add default reset setting for NT400D13 net/ntnic: add DDR calibration to reset stage net/ntnic: add PHY ftile reset
net/ntnic: add clock init
net/ntnic: revert untrusted loop bound

 doc/guides/nics/ntnic.rst                     |    7 +-
 doc/guides/rel_notes/release_25_03.rst        |    4 +
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |    9 +
 drivers/net/ntnic/include/nt4ga_link.h        |    7 +
 drivers/net/ntnic/include/nthw_gfg.h          |   33 +
 drivers/net/ntnic/include/ntnic_nim.h         |    5 +
 .../include/ntnic_nthw_fpga_rst_nt400dxx.h    |   34 +
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 1029 ++++++
 drivers/net/ntnic/meson.build                 |   16 +
 drivers/net/ntnic/nim/i2c_nim.c               |  158 +-
 drivers/net/ntnic/nim/i2c_nim.h               |    6 +
 ...00D13_U62_Si5332-GM2-RevD-1_V5-Registers.h |  425 +++
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |   10 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |    2 +
 .../net/ntnic/nthw/core/include/nthw_hif.h    |    4 +
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |    3 +
 .../net/ntnic/nthw/core/include/nthw_igam.h   |   40 +
 .../ntnic/nthw/core/include/nthw_pca9532.h    |   25 +
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |   33 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     |   40 +
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  156 +
 .../nthw/core/include/nthw_prm_nt400dxx.h     |   32 +
 .../nthw/core/include/nthw_si5332_si5156.h    |   63 +
 .../net/ntnic/nthw/core/include/nthw_spi_v3.h |  107 +
 .../net/ntnic/nthw/core/include/nthw_spim.h   |   58 +
 .../net/ntnic/nthw/core/include/nthw_spis.h   |   63 +
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   |  220 ++
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   |  377 ++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  427 +++
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  464 +++
 drivers/net/ntnic/nthw/core/nthw_gfg.c        |  340 ++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        |   41 +
 drivers/net/ntnic/nthw/core/nthw_hif.c        |   92 +
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       |  139 +
 drivers/net/ntnic/nthw/core/nthw_igam.c       |   93 +
 drivers/net/ntnic/nthw/core/nthw_pca9532.c    |   60 +
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  |  103 +
 .../net/ntnic/nthw/core/nthw_pcm_nt400dxx.c   |   80 +
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 1242 +++++++
 .../net/ntnic/nthw/core/nthw_prm_nt400dxx.c   |   55 +
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  |  142 +
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     |  358 ++
 drivers/net/ntnic/nthw/core/nthw_spim.c       |  113 +
 drivers/net/ntnic/nthw/core/nthw_spis.c       |  121 +
 drivers/net/ntnic/nthw/nthw_drv.h             |   31 +
 drivers/net/ntnic/nthw/nthw_platform.c        |    3 +
 drivers/net/ntnic/nthw/nthw_platform_drv.h    |    2 +
 .../supported/nthw_fpga_9574_055_049_0000.c   | 3124 +++++++++++++++++
 .../nthw/supported/nthw_fpga_instances.c      |    5 +-
 .../nthw/supported/nthw_fpga_instances.h      |    1 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   11 +
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   11 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   11 +
 .../nthw/supported/nthw_fpga_reg_defs_igam.h  |   32 +
 .../supported/nthw_fpga_reg_defs_pci_ta.h     |   33 +
 .../nthw_fpga_reg_defs_pcm_nt400dxx.h         |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_pdi.h   |   49 +
 .../supported/nthw_fpga_reg_defs_phy_tile.h   |  213 ++
 .../nthw_fpga_reg_defs_prm_nt400dxx.h         |   26 +
 .../nthw/supported/nthw_fpga_reg_defs_rfd.h   |   38 +
 .../supported/nthw_fpga_reg_defs_rst9574.h    |   35 +
 .../nthw/supported/nthw_fpga_reg_defs_spim.h  |   76 +
 .../nthw/supported/nthw_fpga_reg_defs_spis.h  |   51 +
 .../nthw/supported/nthw_fpga_reg_defs_tint.h  |   28 +
 drivers/net/ntnic/ntnic_ethdev.c              |    1 +
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |    2 +-
 drivers/net/ntnic/ntnic_mod_reg.c             |   47 +
 drivers/net/ntnic/ntnic_mod_reg.h             |   25 +
 68 files changed, 10709 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/ntnic/include/nthw_gfg.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt400dxx.h
 create mode 100644 drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c
 create mode 100644 drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_igam.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pca9532.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spim.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spis.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_igam.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pca9532.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_phy_tile.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9574_055_049_0000.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h
Quoted 9 lines
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9574.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h

I will merge this for next-net BUT
The driver is better after this patch series, but still low quality.

Several pre-existing issues in this driver; looks like it did not get enough review during 24.11 release when it was merged.

✔ passed
✘ Failed

Basic hygiene
✔ Look at CI results in patchwork
✔ Merge cleanly with git am
✔ Run checkpatches
✔ Run check-git-log
✔ Run check-symbol-maps.sh
✔ Run check-doc-vs-code
✔ Run check-spdk-tag

Builds
✔ Normal Gcc build; make sure driver is built! ✔ Use latest experimental Gcc 15
✔ Clang build using current version (clang-19) ✔ Doc build
o Build for 32 bit x86
o Cross build for Windows (if applicable) ✔ Debug build
✔ Enable asserts
✔ Test meson builds

Experimental builds:
✔ Enable address sanitizer

✘ Enable extra warnings (edit meson.build) for
-Wvla, -Wformat-truncation, -Waddress-of-packed-member

Let's not add more VLA's, these could be arrays with a fixed size.

[1470/3259] Compiling C object drivers...ofile_inline_flow_api_hw_db_inline.c.o ../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c: In function ‘hw_db_inline_alloc_prioritized_cfn’:
../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c:1346:9: warning: ISO C90 forbids variable length array ‘sorted_priority’ [-Wvla]

 1346 |         } sorted_priority[db->nb_cat];
      |         ^

[1479/3259] Compiling C object drivers...ile_inline_flow_api_profile_inline.c.o ../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c: In function ‘setup_db_qsl_data’:
../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c:3193:17: warning: ISO C90 forbids variable length array ‘ports’ [-Wvla]

 3193 |                 uint32_t ports[fd->dst_num_avail];
      |                 ^~~~~~~~
../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c:3194:17: warning: ISO C90 forbids variable length array ‘queues’ [-Wvla]
 3194 |                 uint32_t queues[fd->dst_num_avail];
      |                 ^~~~~~~~

This is not doing what you expect, ports is uint32_t array

		uint32_t ports[fd->dst_num_avail];
		uint32_t queues[fd->dst_num_avail];

		memset(ports, 0, fd->dst_num_avail);
		memset(queues, 0, fd->dst_num_avail);

Instead use HW_DB_INLINE_MAX_QST_PER_QSL

Look for anti-patterns:
✘ Driver must not disable warnings with compiler flags or pragma's
Using pragma pack()

✘ Driver must not use thread and signal
Using thread to monitor, should not be done by PMD specific thread.

✘ Driver should not call abort() or assert() directly
Is using assert() when should be using RTE_ASSERT()

✘ Review exposed symbol names
The driver exposes lots of global symbols (when statically linked) that do not have a consistent prefix of nthw_...
Examples: get_rx_idle(), set_rx_idle(), dev_flow_init()

✔ Apply coccinelle scripts

✘ Review use of malloc
Several places call malloc but do not check return value

✘ Review use of memset

The code related to stats has several issues:
- function returns -1 but never checked by callers
- stats structure is already zero'd by ethdev
- if queue is greater than RTE_ETHDEV_QUEUE_STAT_CNTRS the statistics should still be counted for that queue, just no per-queue stats
- the use of term if_index is potentially confusing; normally if_index refers to the interface index assigned by the OS used for ioctl's etc. In this driver it appears to be the index of the phy.

static int dpdk_stats_collect(struct pmd_internals *internals, struct rte_eth_stats *stats)

{
	const struct ntnic_filter_ops *ntnic_filter_ops = get_ntnic_filter_ops();

	if (ntnic_filter_ops == NULL) {
		NT_LOG_DBGX(ERR, NTNIC, "ntnic_filter_ops uninitialized");
		return -1;
	}
...
	ntnic_filter_ops->poll_statistics(internals);
	memset(stats, 0, sizeof(*stats));

	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < internals->nb_rx_queues; i++) {
		stats->q_ipackets[i] = internals->rxq_scg[i].rx_pkts;
		stats->q_ibytes[i] = internals->rxq_scg[i].rx_bytes;
		rx_total += stats->q_ipackets[i];
		rx_total_b += stats->q_ibytes[i];
	}

	for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < internals->nb_tx_queues; i++) {
		stats->q_opackets[i] = internals->txq_scg[i].tx_pkts;
		stats->q_obytes[i] = internals->txq_scg[i].tx_bytes;
		stats->q_errors[i] = internals->txq_scg[i].err_pkts;
		tx_total += stats->q_opackets[i];
		tx_total_b += stats->q_obytes[i];
		tx_err_total += stats->q_errors[i];
	}

Other:
The handling of queue start/stop in this device is odd. Doesn't do deferred start.
When Rx is stopped most drivers do some action to stop the hardware.

Given the use of thread, driver should *not* have been merged in 24.11. The DPDK has a set of assumptions about thread and process model, and drivers making their own threads can cause problems in applications. (Other drivers use alarm for this type of port monitor function).

#39 lore raw

Hi Stephen,

Some time ago we received the change request about usage of threads inside of the ntnic PMD driver. I would like to discuss this request.
In our case, some threads are part of the design of the protocols between the driver and the FPGA, and are required for both functionality, robustness, and performance.

We currently have 3 distinct threads: Monitoring thread, for health and statistics. Link manager thread, for automatic control of link of the physical ports. Flow thread, to service the flow related FIFOs of the FPGA.
The monitoring thread could be redesigned to API calls instead, for example rte_alarm, though the work will take some time.
The link manager and flow thread can’t be redesigned without
1) significant changes to our FPGA or
2) introduction of a kernel driver to handle the functionality.
Due to this, we want to leave usage of threads as it is.

We wonder if removing threads from the PMD driver is a strict requirement or a "nice to have feature?"
What are the technical concerns behind this request? What would the impact be if usage of threads remains the same(will the driver be excluded from the repo)? Any thoughts about it are valuable; we will gladly discuss them.

Thanks,
Serhii
________________________________
From: Stephen Hemminger <[email protected]>
Sent: 22 February 2025 23:41
To: Serhii Iliushyk <[email protected]>
Cc: [email protected] <[email protected]>; Mykola Kostenok <[email protected]>; Christian Koue Muf <[email protected]>
Subject: Re: [PATCH v1 00/32] add new adapter NT400D13

Quoted 139 lines · On Thu, 20 Feb 2025 23:03:24 +0100 Serhii Iliushyk <[email protected]> wrote:

This patchset adds support for the new adapter NT400D13.

Danylo Vodopianov (23):
net/ntnic: add link agx 100g
net/ntnic: add link state machine
net/ntnic: add rpf and gfg init
net/ntnic: add agx setup for port
net/ntnic: add host loopback init
net/ntnic: add line loopback init
net/ntnic: add 100 gbps port init
net/ntnic: add port post init
net/ntnic: add nim low power API
net/ntnic: add link handling API
net/ntnic: add port init to the state machine
net/ntnic: add port disable API
net/ntnic: add nt400d13 pcm init
net/ntnic: add HIF clock test
net/ntnic: add nt400d13 PRM module init
net/ntnic: add nt400d13 PRM module reset
net/ntnic: add SPI v3 support for FPGA
net/ntnic: add i2cm init
net/ntnic: add pca init
net/ntnic: add pcal init
net/ntnic: add reset PHY init
net/ntnic: add igam module init
net/ntnic: init IGAM and config PLL for FPGA

Serhii Iliushyk (9):
net/ntnic: add minimal initialization new NIC NT400D13 net/ntnic: add minimal reset FPGA
net/ntnic: add FPGA modules and registers net/ntnic: add setup for fpga reset net/ntnic: add default reset setting for NT400D13 net/ntnic: add DDR calibration to reset stage net/ntnic: add PHY ftile reset
net/ntnic: add clock init
net/ntnic: revert untrusted loop bound

 doc/guides/nics/ntnic.rst                     |    7 +-
 doc/guides/rel_notes/release_25_03.rst        |    4 +
 drivers/net/ntnic/adapter/nt4ga_adapter.c     |    9 +
 drivers/net/ntnic/include/nt4ga_link.h        |    7 +
 drivers/net/ntnic/include/nthw_gfg.h          |   33 +
 drivers/net/ntnic/include/ntnic_nim.h         |    5 +
 .../include/ntnic_nthw_fpga_rst_nt400dxx.h    |   34 +
 .../link_agx_100g/nt4ga_agx_link_100g.c       | 1029 ++++++
 drivers/net/ntnic/https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmeson.build&c=E,1,V2jW0UmjAZTalpELBq8Dn7dVNfOTq_s_dwmagWH1e90cq826b3Jzkh8fF9_OEiNqN1Y6yB9ByFEKV0xnAbe5QV4HLrYCdQV_kB9SynmAtvcFYup0pmk,&typo=1                 |   16 +
 drivers/net/ntnic/nim/i2c_nim.c               |  158 +-
 drivers/net/ntnic/nim/i2c_nim.h               |    6 +
 ...00D13_U62_Si5332-GM2-RevD-1_V5-Registers.h |  425 +++
 .../net/ntnic/nthw/core/include/nthw_fpga.h   |   10 +
 .../net/ntnic/nthw/core/include/nthw_gmf.h    |    2 +
 .../net/ntnic/nthw/core/include/nthw_hif.h    |    4 +
 .../net/ntnic/nthw/core/include/nthw_i2cm.h   |    3 +
 .../net/ntnic/nthw/core/include/nthw_igam.h   |   40 +
 .../ntnic/nthw/core/include/nthw_pca9532.h    |   25 +
 .../ntnic/nthw/core/include/nthw_pcal6416a.h  |   33 +
 .../nthw/core/include/nthw_pcm_nt400dxx.h     |   40 +
 .../ntnic/nthw/core/include/nthw_phy_tile.h   |  156 +
 .../nthw/core/include/nthw_prm_nt400dxx.h     |   32 +
 .../nthw/core/include/nthw_si5332_si5156.h    |   63 +
 .../net/ntnic/nthw/core/include/nthw_spi_v3.h |  107 +
 .../net/ntnic/nthw/core/include/nthw_spim.h   |   58 +
 .../net/ntnic/nthw/core/include/nthw_spis.h   |   63 +
 .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c   |  220 ++
 .../core/nt400dxx/reset/nthw_fpga_rst9574.c   |  377 ++
 .../nt400dxx/reset/nthw_fpga_rst_nt400dxx.c   |  427 +++
 drivers/net/ntnic/nthw/core/nthw_fpga.c       |  464 +++
 drivers/net/ntnic/nthw/core/nthw_gfg.c        |  340 ++
 drivers/net/ntnic/nthw/core/nthw_gmf.c        |   41 +
 drivers/net/ntnic/nthw/core/nthw_hif.c        |   92 +
 drivers/net/ntnic/nthw/core/nthw_i2cm.c       |  139 +
 drivers/net/ntnic/nthw/core/nthw_igam.c       |   93 +
 drivers/net/ntnic/nthw/core/nthw_pca9532.c    |   60 +
 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c  |  103 +
 .../net/ntnic/nthw/core/nthw_pcm_nt400dxx.c   |   80 +
 drivers/net/ntnic/nthw/core/nthw_phy_tile.c   | 1242 +++++++
 .../net/ntnic/nthw/core/nthw_prm_nt400dxx.c   |   55 +
 .../net/ntnic/nthw/core/nthw_si5332_si5156.c  |  142 +
 drivers/net/ntnic/nthw/core/nthw_spi_v3.c     |  358 ++
 drivers/net/ntnic/nthw/core/nthw_spim.c       |  113 +
 drivers/net/ntnic/nthw/core/nthw_spis.c       |  121 +
 drivers/net/ntnic/nthw/nthw_drv.h             |   31 +
 drivers/net/ntnic/nthw/nthw_platform.c        |    3 +
 drivers/net/ntnic/nthw/nthw_platform_drv.h    |    2 +
 .../supported/nthw_fpga_9574_055_049_0000.c   | 3124 +++++++++++++++++
 .../nthw/supported/nthw_fpga_instances.c      |    5 +-
 .../nthw/supported/nthw_fpga_instances.h      |    1 +
 .../ntnic/nthw/supported/nthw_fpga_mod_defs.h |   11 +
 .../nthw/supported/nthw_fpga_mod_str_map.c    |   11 +
 .../ntnic/nthw/supported/nthw_fpga_reg_defs.h |   11 +
 .../nthw/supported/nthw_fpga_reg_defs_igam.h  |   32 +
 .../supported/nthw_fpga_reg_defs_pci_ta.h     |   33 +
 .../nthw_fpga_reg_defs_pcm_nt400dxx.h         |   29 +
 .../nthw/supported/nthw_fpga_reg_defs_pdi.h   |   49 +
 .../supported/nthw_fpga_reg_defs_phy_tile.h   |  213 ++
 .../nthw_fpga_reg_defs_prm_nt400dxx.h         |   26 +
 .../nthw/supported/nthw_fpga_reg_defs_rfd.h   |   38 +
 .../supported/nthw_fpga_reg_defs_rst9574.h    |   35 +
 .../nthw/supported/nthw_fpga_reg_defs_spim.h  |   76 +
 .../nthw/supported/nthw_fpga_reg_defs_spis.h  |   51 +
 .../nthw/supported/nthw_fpga_reg_defs_tint.h  |   28 +
 drivers/net/ntnic/ntnic_ethdev.c              |    1 +
 drivers/net/ntnic/ntnic_filter/ntnic_filter.c |    2 +-
 drivers/net/ntnic/ntnic_mod_reg.c             |   47 +
 drivers/net/ntnic/ntnic_mod_reg.h             |   25 +
 68 files changed, 10709 insertions(+), 11 deletions(-)
 create mode 100644 drivers/net/ntnic/include/nthw_gfg.h
 create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt400dxx.h
 create mode 100644 drivers/net/ntnic/link_mgmt/link_agx_100g/nt4ga_agx_link_100g.c
 create mode 100644 drivers/net/ntnic/nthw/core/include/NT400D13_U62_Si5332-GM2-RevD-1_V5-Registers.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_igam.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pca9532.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcal6416a.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_si5332_si5156.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spi_v3.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spim.h
 create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_spis.h
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9574.c
 create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_gfg.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_igam.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pca9532.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcal6416a.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_phy_tile.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_prm_nt400dxx.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5332_si5156.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spi_v3.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spim.c
 create mode 100644 drivers/net/ntnic/nthw/core/nthw_spis.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9574_055_049_0000.c
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_igam.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_ta.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcm_nt400dxx.h
Quoted 9 lines
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pdi.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_phy_tile.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_prm_nt400dxx.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rfd.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9574.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spim.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_spis.h
 create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_tint.h

I will merge this for next-net BUT
The driver is better after this patch series, but still low quality.

Several pre-existing issues in this driver; looks like it did not get enough review during 24.11 release when it was merged.

✔ passed
✘ Failed

Basic hygiene
✔ Look at CI results in patchwork
✔ Merge cleanly with git am
✔ Run checkpatches
✔ Run check-git-log
✔ Run https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fcheck-symbol-maps.sh&c=E,1,_xJVo6bETFeApP-wtnvbWAvxaCa7qbnLMt7zRlpiRqjS0m95ct6mvHNzJet-519faqsNDIQ1syIb2Zy2Ofg6Ow0SCxip8zUntKKIuMak&typo=1
✔ Run check-doc-vs-code
✔ Run check-spdk-tag

Builds
✔ Normal Gcc build; make sure driver is built! ✔ Use latest experimental Gcc 15
✔ Clang build using current version (clang-19) ✔ Doc build
o Build for 32 bit x86
o Cross build for Windows (if applicable) ✔ Debug build
✔ Enable asserts
✔ Test meson builds

Experimental builds:
✔ Enable address sanitizer

✘ Enable extra warnings (edit https://linkprotect.cudasvc.com/url?a=https%3a%2f%2fmeson.build&c=E,1,mL1G4BVjr4bxM-sD_s9RIW1LCs5wCyCL61shJTZo3iTRNFbe50BYXiKNbPD6OaCA84bSRTFNPk1K6QYBvlf7Q3XzyW8lLPKkgH9tUdywAJZkhd-X5iW-f4bjPA,,&typo=1) for
-Wvla, -Wformat-truncation, -Waddress-of-packed-member

Let's not add more VLA's, these could be arrays with a fixed size.

[1470/3259] Compiling C object drivers...ofile_inline_flow_api_hw_db_inline.c.o ../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c: In function ‘hw_db_inline_alloc_prioritized_cfn’:
../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c:1346:9: warning: ISO C90 forbids variable length array ‘sorted_priority’ [-Wvla]

 1346 |         } sorted_priority[db->nb_cat];
      |         ^

[1479/3259] Compiling C object drivers...ile_inline_flow_api_profile_inline.c.o ../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c: In function ‘setup_db_qsl_data’:
../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c:3193:17: warning: ISO C90 forbids variable length array ‘ports’ [-Wvla]

 3193 |                 uint32_t ports[fd->dst_num_avail];
      |                 ^~~~~~~~
../drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c:3194:17: warning: ISO C90 forbids variable length array ‘queues’ [-Wvla]
 3194 |                 uint32_t queues[fd->dst_num_avail];
      |                 ^~~~~~~~

This is not doing what you expect, ports is uint32_t array

                uint32_t ports[fd->dst_num_avail];
                uint32_t queues[fd->dst_num_avail];

                memset(ports, 0, fd->dst_num_avail);
                memset(queues, 0, fd->dst_num_avail);

Instead use HW_DB_INLINE_MAX_QST_PER_QSL

Look for anti-patterns:
✘ Driver must not disable warnings with compiler flags or pragma's
Using pragma pack()

✘ Driver must not use thread and signal
Using thread to monitor, should not be done by PMD specific thread.

✘ Driver should not call abort() or assert() directly
Is using assert() when should be using RTE_ASSERT()

✘ Review exposed symbol names
The driver exposes lots of global symbols (when statically linked) that do not have a consistent prefix of nthw_...
Examples: get_rx_idle(), set_rx_idle(), dev_flow_init()

✔ Apply coccinelle scripts

✘ Review use of malloc
Several places call malloc but do not check return value

✘ Review use of memset

The code related to stats has several issues:
- function returns -1 but never checked by callers
- stats structure is already zero'd by ethdev
- if queue is greater than RTE_ETHDEV_QUEUE_STAT_CNTRS the statistics should still be counted for that queue, just no per-queue stats
- the use of term if_index is potentially confusing; normally if_index refers to the interface index assigned by the OS used for ioctl's etc. In this driver it appears to be the index of the phy.

static int dpdk_stats_collect(struct pmd_internals *internals, struct rte_eth_stats *stats)

{
        const struct ntnic_filter_ops *ntnic_filter_ops = get_ntnic_filter_ops();

        if (ntnic_filter_ops == NULL) {
                NT_LOG_DBGX(ERR, NTNIC, "ntnic_filter_ops uninitialized");
                return -1;
        }
...
        ntnic_filter_ops->poll_statistics(internals);
        memset(stats, 0, sizeof(*stats));

        for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < internals->nb_rx_queues; i++) {
                stats->q_ipackets[i] = internals->rxq_scg[i].rx_pkts;
                stats->q_ibytes[i] = internals->rxq_scg[i].rx_bytes;
                rx_total += stats->q_ipackets[i];
                rx_total_b += stats->q_ibytes[i];
        }

        for (i = 0; i < RTE_ETHDEV_QUEUE_STAT_CNTRS && i < internals->nb_tx_queues; i++) {
                stats->q_opackets[i] = internals->txq_scg[i].tx_pkts;
                stats->q_obytes[i] = internals->txq_scg[i].tx_bytes;
                stats->q_errors[i] = internals->txq_scg[i].err_pkts;
                tx_total += stats->q_opackets[i];
                tx_total_b += stats->q_obytes[i];
                tx_err_total += stats->q_errors[i];
        }

Other:
The handling of queue start/stop in this device is odd. Doesn't do deferred start.
When Rx is stopped most drivers do some action to stop the hardware.

Given the use of thread, driver should *not* have been merged in 24.11. The DPDK has a set of assumptions about thread and process model, and drivers making their own threads can cause problems in applications. (Other drivers use alarm for this type of port monitor function).