Add NT400D11 support and new features
Subsystems (2)
cover Add NT400D11 support and new features
This series of patches adds support for NT400D11 FPGA and implements several new features including pattern matching on inner Ethernet and VLAN headers, exception path handling, flow query with count action, flow pull, and extends flow dump with MBR configuration
Serhii Iliushyk (19):
net/ntnic: add stubs for init NT400D11
net/ntnic: add reset setup for NT400D11
net/ntnic: add reset init stage 0 for NT400D11 net/ntnic: add reset init stage 1 for NT400D11 net/ntnic: add reset init stage 2 for NT400D11 net/ntnic: add reset init stage 3 and 4 for NT400D11 net/ntnic: add reset init stage 5 for NT400D11 net/ntnic: add reset init stage 6 for NT400D11 net/ntnic: add reset init stage 7 for NT400D11 net/ntnic: add reset init stage 8 for NT400D11 net/ntnic: add fpga registers for NT400D11 net/ntnic: add support pattern matching on inner ETH headers net/ntnic: add support pattern matching on inner VLAN header net/ntnic: add handling exception path option net/ntnic: add flow query with count action net/ntnic: add flow pull
net/ntnic: extend flow dump with MBR configuration net/ntnic: rename hwlock
net/ntnic: rename nt log types
Stephen Hemminger (1):
net/ntnic: make flow lock local
doc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 15 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 3 +- drivers/net/ntnic/include/create_elements.h | 2 - drivers/net/ntnic/include/flow_api_engine.h | 2 + .../ntnic/include/stream_binary_flow_api.h | 2 +- drivers/net/ntnic/meson.build | 2 + .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 41 + .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 380 ++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 15 + .../flow_api/profile_inline/flm_evt_queue.c | 14 + .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 54 +- .../profile_inline/flow_api_hw_db_inline.h | 4 +- .../profile_inline/flow_api_profile_inline.c | 94 +- .../profile_inline/flow_api_profile_inline.h | 3 + .../flow_api_profile_inline_config.h | 48 + drivers/net/ntnic/nthw/nthw_platform.c | 3 + drivers/net/ntnic/nthw/nthw_platform_drv.h | 2 + .../supported/nthw_fpga_9569_055_049_0000.c | 3132 +++++++++++++++++ .../nthw/supported/nthw_fpga_instances.c | 3 +- .../nthw/supported/nthw_fpga_instances.h | 1 + .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_rst9569.h | 35 + drivers/net/ntnic/ntlog/ntlog.h | 16 +- drivers/net/ntnic/ntnic_ethdev.c | 44 +- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 85 +- drivers/net/ntnic/ntnic_mod_reg.c | 15 + drivers/net/ntnic/ntnic_mod_reg.h | 17 + 31 files changed, 3976 insertions(+), 61 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h
Signature · 1 line
2.45.0
PATCH 1/20 net/ntnic: add stubs for init NT400D11
Add stubs for NT400D11 init functions.
These stubs will be replaced with actual implementations in future commits.
--- doc/guides/nics/ntnic.rst | 6 +++ drivers/net/ntnic/adapter/nt4ga_adapter.c | 3 +- drivers/net/ntnic/meson.build | 1 + .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 41 +++++++++++++++++++ .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 27 ++++++++++++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 1 + drivers/net/ntnic/nthw/nthw_platform.c | 3 ++ drivers/net/ntnic/nthw/nthw_platform_drv.h | 2 + drivers/net/ntnic/ntnic_ethdev.c | 1 + drivers/net/ntnic/ntnic_mod_reg.c | 15 +++++++ drivers/net/ntnic/ntnic_mod_reg.h | 9 ++++ 11 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c
doc/guides/nics/ntnic.rst +6 -0
@@ -27,6 +27,10 @@ Supported NICs - FPGA ID 9563 (Inline Flow Management) +- NT400D11 2x100G SmartNIC + + - FPGA ID 9569 (Inline Flow Management) + - NT400D13 2x100G SmartNIC - FPGA ID 9574 (Inline Flow Management)
@@ -34,6 +38,8 @@ Supported NICs All information about NT200A02 and NT400D13 can be found by links below: - https://www.napatech.com/products/nt200a02-smartnic-inline/ +- https://www.napatech.com/products/nt400d11-smartnic-programmable/ +- https://www.napatech.com/products/nt400d13-smartnic-programmable/ - https://www.napatech.com/support/resources/data-sheets/link-inline-software-for-napatech/
drivers/net/ntnic/adapter/nt4ga_adapter.c +2 -1
@@ -172,10 +172,11 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) res = link_ops->link_init (p_adapter_info, p_fpga);break ; +case 9569 :/* NT400D11 (Intel Agilex FPGA) */ case 9574 :/* NT400D13 (Intel Agilex FPGA) */ link_ops =nthw_get_agx_100g_link_ops ();if (link_ops ==NULL ) { -NT_LOG (ERR ,NTNIC ,"NT400D11 100G link module uninitialized" ); +NT_LOG (ERR ,NTNIC ,"NT400Dxx 100G link module uninitialized" ); res =-1 ;break ; }
drivers/net/ntnic/meson.build +1 -0
@@ -47,6 +47,7 @@ sources = files( '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/nt400dxx/reset/nthw_fpga_rst9569.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c', 'nthw/core/nthw_fpga.c',
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +41 -0
59 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2025 Napatech A/S +*/ + +#include "ntnic_mod_reg.h" + + +static int nthw_fpga_rst9569_setup (void ) +{ +return 0 ; +}; + +static int nthw_fpga_rst9569_init (void ) +{ +return 0 ; +} + +static struct rst9569_ops rst9569_ops = { + .nthw_fpga_rst9569_init = nthw_fpga_rst9569_init, + .nthw_fpga_rst9569_setup = nthw_fpga_rst9569_setup, +}; + +void nthw_rst9569_ops_init (void ) +{ +nthw_reg_rst9569_ops (&rst9569_ops); +}
drivers/net/ntnic/nthw/core/nthw_fpga.c +1 -0
@@ -440,6 +440,7 @@ 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_NT400D11 :case NT_HW_ADAPTER_ID_NT400D13 :if (nt400dxx_ops !=NULL ) res = nt400dxx_ops->nthw_fpga_nt400dxx_init (p_fpga_info);
drivers/net/ntnic/nthw/nthw_platform.c +3 -0
@@ -11,6 +11,9 @@ nthw_adapter_id_t nthw_platform_get_adapter_id(const uint16_t n_pci_device_id)case NT_HW_PCI_DEVICE_ID_NT200A02 :return NT_HW_ADAPTER_ID_NT200A02 ; +case NT_HW_PCI_DEVICE_ID_NT400D11 : +return NT_HW_ADAPTER_ID_NT400D11 ; +case NT_HW_PCI_DEVICE_ID_NT400D13 :return NT_HW_ADAPTER_ID_NT400D13 ;
drivers/net/ntnic/nthw/nthw_platform_drv.h +2 -0
@@ -10,11 +10,13 @@#define NT_HW_PCI_VENDOR_ID (0x18f4)#define NT_HW_PCI_DEVICE_ID_NT200A02 (0x1C5) +#define NT_HW_PCI_DEVICE_ID_NT400D11 (0x215)#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_NT400D11 ,NT_HW_ADAPTER_ID_NT400D13 , };
drivers/net/ntnic/ntnic_ethdev.c +1 -0
@@ -84,6 +84,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_NT400D11 ) }, {RTE_PCI_DEVICE (NT_HW_PCI_VENDOR_ID ,NT_HW_PCI_DEVICE_ID_NT400D13 ) }, { .vendor_id =0 ,
drivers/net/ntnic/ntnic_mod_reg.c +15 -0
@@ -193,6 +193,21 @@ struct rst9574_ops *nthw_get_rst9574_ops(void)return rst9574_ops; } +static struct rst9569_ops *rst9569_ops; + +void nthw_reg_rst9569_ops (struct rst9569_ops *ops) +{ + rst9569_ops = ops; +} + +struct rst9569_ops *nthw_get_rst9569_ops (void ) +{ +if (rst9569_ops ==NULL ) +nthw_rst9569_ops_init (); + +return rst9569_ops; +} +static struct rst_nt400dxx_ops *rst_nt400dxx_ops;void nthw_reg_rst_nt400dxx_ops (struct rst_nt400dxx_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +9 -0
@@ -269,6 +269,15 @@ struct rst9574_ops { struct nthw_fpga_rst_nt400dxx *const p); }; +struct rst9569_ops { +int (*nthw_fpga_rst9569_init)(void ); +int (*nthw_fpga_rst9569_setup)(void ); +}; + +void nthw_reg_rst9569_ops (struct rst9569_ops *ops); +struct rst9569_ops *nthw_get_rst9569_ops (void ); +void nthw_rst9569_ops_init (void ); +void nthw_reg_rst9574_ops (struct rst9574_ops *ops);struct rst9574_ops *nthw_get_rst9574_ops (void );void nthw_rst9574_ops_init (void );
Signature · 1 line
2.45.0
PATCH 2/20 net/ntnic: add reset setup for NT400D11
In reply to Serhii IliushykAdd base register initialization.
--- .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 2 +- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 54 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_rst9569.h | 35 ++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 3 +- 6 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +1 -1
@@ -132,7 +132,7 @@ static int nthw_fpga_nt400dxx_init(struct fpga_info_s *p_fpga_info)return -1 ; } - res = rst9569_ops->nthw_fpga_rst9569_setup (); + res = rst9569_ops->nthw_fpga_rst9569_setup (p_fpga, &rst);if (res) { NT_LOG(ERR,
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +53 -1
63 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
@@ -51,6 +51,7 @@#define MOD_RPF (0x8d30dcddUL)#define MOD_RPP_LR (0xba7f945cUL)#define MOD_RST9563 (0x385d6d1dUL) +#define MOD_RST9569 (0xd8888403UL)#define MOD_RST9574 (0xbf22c9ffUL)#define MOD_SDC (0xd2369530UL)#define MOD_SLC (0x1aef1f38UL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -50,6 +50,7 @@#include "nthw_fpga_reg_defs_rpl.h" #include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h" +#include "nthw_fpga_reg_defs_rst9569.h" #include "nthw_fpga_reg_defs_rst9574.h" #include "nthw_fpga_reg_defs_sdc.h" #include "nthw_fpga_reg_defs_tsm.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2025 Napatech A/S +*/ + +/* +* nthw_fpga_reg_defs_rst9569.h +* +* Auto-generated file - do *NOT* edit +* +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_RST9569_ +#define _NTHW_FPGA_REG_DEFS_RST9569_ + +/* RST9569 */ +#define NTHW_MOD_RST9569 (0xd8888403UL) +#define RST9569_LATCH (0x93ac825dUL) +#define RST9569_LATCH_DDR4_CALIB_COMPLETE (0xf7a3f47eUL) +#define RST9569_LATCH_PHY_FTILE_RDY (0xf189f59cUL) +#define RST9569_LATCH_PHY_FTILE_RST_DONE (0x237710edUL) +#define RST9569_RST (0x7cda32a2UL) +#define RST9569_RST_DDR4 (0x215e3dadUL) +#define RST9569_RST_PHY_FTILE (0xd633010bUL) +#define RST9569_RST_SYS (0x74a18159UL) +#define RST9569_STAT (0xce6f562UL) +#define RST9569_STAT_DDR4_CALIB_COMPLETE (0x80a181a3UL) +#define RST9569_STAT_PHY_FTILE_RDY (0x5bf72501UL) +#define RST9569_STAT_PHY_FTILE_RST_DONE (0x26325becUL) + +#endif /* _NTHW_FPGA_REG_DEFS_RST9569_ */ + +/* +* Auto-generated file - do *NOT* edit +*/
drivers/net/ntnic/ntnic_mod_reg.h +2 -1
@@ -271,7 +271,8 @@ struct rst9574_ops {struct rst9569_ops {int (*nthw_fpga_rst9569_init)(void ); -int (*nthw_fpga_rst9569_setup)(void ); +int (*nthw_fpga_rst9569_setup)(nthw_fpga_t *p_fpga, +struct nthw_fpga_rst_nt400dxx *const p); };void nthw_reg_rst9569_ops (struct rst9569_ops *ops);
Signature · 1 line
2.45.0
PATCH 3/20 net/ntnic: add reset init stage 0 for NT400D11
In reply to Serhii Iliushykadd reset all domains stage for nt400d11
--- .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 2 +- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 33 ++++++++++++++++++- drivers/net/ntnic/ntnic_mod_reg.h | 3 +- 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +1 -1
@@ -209,7 +209,7 @@ static int nthw_fpga_nt400dxx_init(struct fpga_info_s *p_fpga_info)switch (p_fpga_info->n_fpga_prod_id) {case 9569 :if (rst9569_ops) - res = rst9569_ops->nthw_fpga_rst9569_init (); + res = rst9569_ops->nthw_fpga_rst9569_init (p_fpga_info, &rst);if (res) { NT_LOG(ERR,
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +32 -1
@@ -6,6 +6,8 @@#include "ntnic_mod_reg.h" #include "nthw_register.h" #include "nthw_drv.h" +#include "nt_util.h" +#include "ntlog.h" static int nthw_fpga_rst9569_setup (nthw_fpga_t *p_fpga,struct nthw_fpga_rst_nt400dxx *const p)
@@ -63,11 +65,40 @@ static int nthw_fpga_rst9569_setup(nthw_fpga_t *p_fpga, struct nthw_fpga_rst_nt4return 0 ; }; -static int nthw_fpga_rst9569_init (void ) +static void nthw_fpga_rst9569_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_rst9569_product_reset (struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *p_rst) +{ +RTE_ASSERT (p_fpga_info); +RTE_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_DBGX (DBG ,NTHW ,"%s: RST defaults" , p_adapter_id_str); +nthw_fpga_rst9569_set_default_rst_values (p_rst); +return 0 ; } +static int nthw_fpga_rst9569_init (struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *p_rst) +{ +RTE_ASSERT (p_fpga_info); +RTE_ASSERT (p_rst); + +int res =nthw_fpga_rst9569_product_reset (p_fpga_info, p_rst); + +return res; +} +static struct rst9569_ops rst9569_ops = { .nthw_fpga_rst9569_init = nthw_fpga_rst9569_init, .nthw_fpga_rst9569_setup = nthw_fpga_rst9569_setup,
drivers/net/ntnic/ntnic_mod_reg.h +2 -1
@@ -270,7 +270,8 @@ struct rst9574_ops { };struct rst9569_ops { -int (*nthw_fpga_rst9569_init)(void ); +int (*nthw_fpga_rst9569_init)(struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *const p);int (*nthw_fpga_rst9569_setup)(nthw_fpga_t *p_fpga,struct nthw_fpga_rst_nt400dxx *const p); };
Signature · 1 line
2.45.0
PATCH 4/20 net/ntnic: add reset init stage 1 for NT400D11
In reply to Serhii Iliushykadd De-assert DDR4 reset.
--- .../nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +15 -0
@@ -73,6 +73,12 @@ static void nthw_fpga_rst9569_set_default_rst_values(struct nthw_fpga_rst_nt400dnthw_field_set_val_flush32 (p->p_fld_rst_phy_ftile,1 ); } +static void nthw_fpga_rst9569_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 int nthw_fpga_rst9569_product_reset (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -85,6 +91,15 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,NT_LOG_DBGX (DBG ,NTHW ,"%s: RST defaults" , p_adapter_id_str);nthw_fpga_rst9569_set_default_rst_values (p_rst); +/* +* Wait a while before waiting for deasserting ddr4 reset +*/ +nthw_os_wait_usec (2000 ); + +/* (1) De-assert DDR4 reset: */ +NT_LOG_DBGX (DBG ,NTHW ,"%s: De-asserting DDR4 reset" , p_adapter_id_str); +nthw_fpga_rst9569_ddr4_rst (p_rst,0 ); +return 0 ; }
Signature · 1 line
2.45.0
PATCH 5/20 net/ntnic: add reset init stage 2 for NT400D11
In reply to Serhii Iliushykadd DDR4 calibration complete.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +64 -0
@@ -79,6 +79,54 @@ static void nthw_fpga_rst9569_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, unthw_field_set_val_flush32 (p->p_fld_rst_ddr4, val); } +static bool nthw_fpga_rst9569_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 int nthw_fpga_rst9569_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_DBGX (DBG ,NTHW ,"%s: DDR4 CALIB COMPLETE wait complete" , p_adapter_id_str); +/* +* 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_rst9569_get_ddr4_calib_complete_stat (p_rst); + +if (!complete) +nthw_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_rst9569_ddr4_rst (p_rst,1 );/* Reset DDR4 */ +nthw_fpga_rst9569_ddr4_rst (p_rst,0 ); + retrycount--; + timeout =90000 ;/* Increase timeout for second attempt to 8 sec. */ + } + }while (!complete); + +return 0 ; +} +static int nthw_fpga_rst9569_product_reset (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -100,6 +148,22 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,NT_LOG_DBGX (DBG ,NTHW ,"%s: De-asserting DDR4 reset" , p_adapter_id_str);nthw_fpga_rst9569_ddr4_rst (p_rst,0 ); +/* +* Wait a while before waiting for calibration complete, since calibration complete +* is true while ddr4 is in reset +*/ +nthw_os_wait_usec (2000 ); + +/* (2) Wait until DDR4 calibration complete */ +NT_LOG_DBGX (DBG ,NTHW ,"%s: DDR4 calibration" , p_adapter_id_str); +int res =nthw_fpga_rst9569_wait_ddr4_calibration_complete (p_fpga_info, p_rst); + +if (res) { +NT_LOG (ERR ,NTHW ,"%s: DDR4 calibration failed" , p_adapter_id_str); +return res; + } + +return 0 ; }
Signature · 1 line
2.45.0
PATCH 6/20 net/ntnic: add reset init stage 3 and 4 for NT400D11
In reply to Serhii Iliushykadd DDR4 calib complete latched bits.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +24 -0
@@ -84,6 +84,13 @@ static bool nthw_fpga_rst9569_get_ddr4_calib_complete_stat(struct nthw_fpga_rst_return nthw_field_get_updated (p->p_fld_stat_ddr4_calib_complete) !=0 ; } +static void nthw_fpga_rst9569_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_rst9569_wait_ddr4_calibration_complete (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -127,6 +134,11 @@ static int nthw_fpga_rst9569_wait_ddr4_calibration_complete(struct fpga_info_s *return 0 ; } +static bool nthw_fpga_rst9569_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 int nthw_fpga_rst9569_product_reset (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -163,6 +175,18 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,return res; } +/* (3) Set DDR4 calib complete latched bits: */ +nthw_fpga_rst9569_set_ddr4_calib_complete_latch (p_rst,1 ); + +/* Wait for phy to settle. */ +nthw_os_wait_usec (20000 ); + +/* (4) Ensure all latched status bits are still set: */ +if (!nthw_fpga_rst9569_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
PATCH 7/20 net/ntnic: add reset init stage 5 for NT400D11
In reply to Serhii Iliushykadd PHY_FTILE reset.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 62 ++++++++++++++++++- 1 file changed, 60 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +60 -2
@@ -79,11 +79,26 @@ static void nthw_fpga_rst9569_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, unthw_field_set_val_flush32 (p->p_fld_rst_ddr4, val); } +static bool nthw_fpga_rst9569_get_phy_ftile_rst (struct nthw_fpga_rst_nt400dxx *const p) +{ +return nthw_field_get_updated (p->p_fld_rst_phy_ftile) !=0 ; +} +static bool nthw_fpga_rst9569_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_rst9569_get_phy_ftile_rst_done_stat (struct nthw_fpga_rst_nt400dxx *const p) +{ +return nthw_field_get_updated (p->p_fld_stat_phy_ftile_rst_done) !=0 ; +} + +static bool nthw_fpga_rst9569_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_rst9569_set_ddr4_calib_complete_latch (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) {
@@ -134,9 +149,33 @@ static int nthw_fpga_rst9569_wait_ddr4_calibration_complete(struct fpga_info_s *return 0 ; } -static bool nthw_fpga_rst9569_get_ddr4_calib_complete_latch (struct nthw_fpga_rst_nt400dxx *const p) +static int nthw_fpga_rst9569_wait_phy_ftile_rst_done (struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *p_rst) { -return nthw_field_get_updated (p->p_fld_latch_ddr4_calib_complete) !=0 ; +const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; +uint32_t complete; +uint32_t timeout; + +/* 5: wait until PHY_FTILE reset done */ +NT_LOG (DBG ,NTHW ,"%s: %s: PHY FTILE RESET done" , p_adapter_id_str, __func__); + timeout =50000 ;/* initial timeout must be set to 5 sec. */ + +do { + complete =nthw_fpga_rst9569_get_phy_ftile_rst_done_stat (p_rst); + +if (!complete) +nthw_os_wait_usec (100 ); + + timeout--; + +if (timeout ==0 ) { +NT_LOG (ERR ,NTHW ,"%s: %s: Timeout waiting for PHY FTILE RESET to be done" , + p_adapter_id_str, __func__); +return -1 ; + } + }while (!complete); + +return 0 ; } static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,
@@ -187,6 +226,25 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, p_adapter_id_str, __func__); } +bool success = true; + +do { +/* Only wait for ftile rst done if ftile is indeed in reset. */ +if (nthw_fpga_rst9569_get_phy_ftile_rst (p_rst)) { +/* (5) Wait until PHY_FTILE reset done */ +NT_LOG_DBGX (DBG ,NTHW ,"%s: Wait until PHY_FTILE reset done" , + p_adapter_id_str); + res =nthw_fpga_rst9569_wait_phy_ftile_rst_done (p_fpga_info, p_rst); + +if (res) { +NT_LOG (ERR ,NTHW ,"%s: PHY_FTILE reset done failed" , + p_adapter_id_str); +return res; + } + } + + }while (!success); +return 0 ; }
Signature · 1 line
2.45.0
PATCH 8/20 net/ntnic: add reset init stage 6 for NT400D11
In reply to Serhii Iliushykadd De-assert PHY_FTILE reset.
--- .../nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +13 -0
@@ -79,6 +79,12 @@ static void nthw_fpga_rst9569_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, unthw_field_set_val_flush32 (p->p_fld_rst_ddr4, val); } +static void nthw_fpga_rst9569_phy_ftile_rst (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) +{ +nthw_field_update_register (p->p_fld_rst_phy_ftile); +nthw_field_set_val_flush32 (p->p_fld_rst_phy_ftile, val); +} +static bool nthw_fpga_rst9569_get_phy_ftile_rst (struct nthw_fpga_rst_nt400dxx *const p) {return nthw_field_get_updated (p->p_fld_rst_phy_ftile) !=0 ;
@@ -243,6 +249,13 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, } } +/* (6) De-assert PHY_FTILE reset: */ +NT_LOG (DBG ,NTHW ,"%s: %s: De-asserting PHY_FTILE reset" , p_adapter_id_str, + __func__); +nthw_fpga_rst9569_phy_ftile_rst (p_rst,0 ); + +nthw_os_wait_usec (10000 ); + }while (!success);
Signature · 1 line
2.45.0
PATCH 9/20 net/ntnic: add reset init stage 7 for NT400D11
In reply to Serhii Iliushykadd waiting while PHY_FTILE ready.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 90 ++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +88 -2
@@ -100,6 +100,11 @@ static bool nthw_fpga_rst9569_get_phy_ftile_rst_done_stat(struct nthw_fpga_rst_nreturn nthw_field_get_updated (p->p_fld_stat_phy_ftile_rst_done) !=0 ; } +static bool nthw_fpga_rst9569_get_phy_ftile_rdy_stat (struct nthw_fpga_rst_nt400dxx *const p) +{ +return nthw_field_get_updated (p->p_fld_stat_phy_ftile_rdy) !=0 ; +} +static bool nthw_fpga_rst9569_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 ;
@@ -155,6 +160,40 @@ static int nthw_fpga_rst9569_wait_ddr4_calibration_complete(struct fpga_info_s *return 0 ; } +static int nthw_fpga_rst9569_wait_phy_ftile_rdy (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 timeout; + +/* 5: wait until PHY_FTILE reset done */ +NT_LOG (DBG ,NTHW ,"%s: %s: PHY FTILE ready" , p_adapter_id_str, __func__); + timeout =50000 ;/* initial timeout must be set to 5 sec. */ + +do { + complete =nthw_fpga_rst9569_get_phy_ftile_rdy_stat (p_rst); + +if (!complete) { +nthw_os_wait_usec (100 ); + + }else { +NT_LOG (DBG ,NTHW ,"%s: PHY FTILE ready, margin to timeout %u" , + p_adapter_id_str, timeout); + } + + timeout--; + +if (timeout ==0 ) { +NT_LOG_DBGX (ERR ,NTHW ,"%s: Timeout waiting for PHY FTILE ready" , + p_adapter_id_str); +return -1 ; + } + }while (!complete); + +return 0 ; +} +static int nthw_fpga_rst9569_wait_phy_ftile_rst_done (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -232,7 +271,8 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, p_adapter_id_str, __func__); } -bool success = true; +int tries =0 ; +bool success = false; do { /* Only wait for ftile rst done if ftile is indeed in reset. */
@@ -256,8 +296,54 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,nthw_os_wait_usec (10000 ); - }while (!success); +/* (7) Wait until PHY_FTILE ready */ +if (nthw_fpga_rst9569_wait_phy_ftile_rdy (p_fpga_info, p_rst) ==-1 ) { +if (++tries >=5 ) { +/* Give up */ +NT_LOG_DBGX (ERR ,NTHW ,"%s: PHY_TILE not ready after %u attempts" , + p_adapter_id_str, tries); +return res; + } +/* Try to recover with as little effort as possible */ +nthw_phy_tile_t *p_phy_tile = p_fpga_info->mp_nthw_agx.p_phy_tile; + +for (uint8_t i =0 ; i <nthw_phy_tile_get_no_intfs (p_phy_tile); i++) { +/* Also consider TX_PLL_LOCKED == 0 */ +if (!nthw_phy_tile_get_port_status_tx_lanes_stable (p_phy_tile, + i)) { + success = false; +NT_LOG_DBGX (WRN ,NTHW , +"%s: PHY_TILE Intf %u TX_LANES_STABLE == FALSE" , + p_adapter_id_str, i); + +/* Active low */ +nthw_phy_tile_set_port_config_rst (p_phy_tile, i,0 ); +int32_t count =1000 ; + +do { +nthw_os_wait_usec (1000 ); + }while + (!nthw_phy_tile_get_port_status_reset_ack (p_phy_tile, i) && + (--count >0 )); + +if (count <=0 ) { +NT_LOG (ERR ,NTHW , +"%s: IntfNo %u: Time-out waiting for PortStatusResetAck" , + p_adapter_id_str, i); + } + +/* Active low */ +nthw_phy_tile_set_port_config_rst (p_phy_tile, i,1 ); +nthw_os_wait_usec (20000 ); + } + } + + }else { +NT_LOG_DBGX (DBG ,NTHW ,"%s: PHY_TILE ready" , p_adapter_id_str); + success = true; + } + }while (!success);return 0 ; }
Signature · 1 line
2.45.0
PATCH 10/20 net/ntnic: add reset init stage 8 for NT400D11
In reply to Serhii Iliushykadd De-assert SYS reset
--- .../ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +10 -0
@@ -73,6 +73,12 @@ static void nthw_fpga_rst9569_set_default_rst_values(struct nthw_fpga_rst_nt400dnthw_field_set_val_flush32 (p->p_fld_rst_phy_ftile,1 ); } +static void nthw_fpga_rst9569_sys_rst (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) +{ +nthw_field_update_register (p->p_fld_rst_sys); +nthw_field_set_val_flush32 (p->p_fld_rst_sys, val); +} +static void nthw_fpga_rst9569_ddr4_rst (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) {nthw_field_update_register (p->p_fld_rst_ddr4);
@@ -345,6 +351,10 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, } }while (!success); +/* (8) De-assert SYS reset: */ +NT_LOG (DBG ,NTHW ,"%s: %s: De-asserting SYS reset" , p_adapter_id_str, __func__); +nthw_fpga_rst9569_sys_rst (p_rst,0 ); +return 0 ; }
Signature · 1 line
2.45.0
PATCH 11/20 net/ntnic: add fpga registers for NT400D11
In reply to Serhii Iliushykadd fpga registers description
--- drivers/net/ntnic/meson.build | 1 + .../supported/nthw_fpga_9569_055_049_0000.c | 3132 +++++++++++++++++ .../nthw/supported/nthw_fpga_instances.c | 3 +- .../nthw/supported/nthw_fpga_instances.h | 1 + 4 files changed, 3136 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c
drivers/net/ntnic/meson.build +1 -0
@@ -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_9569_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',
drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c new file +3132 -0
2,993 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c +2 -1
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h +1 -0
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.
PATCH 12/20 net/ntnic: add support pattern matching on inner ETH headers
In reply to Serhii IliushykImplements support for match on inner ETH header.
Updates flow dump output to print both outer and
inner l2 masks.
--- drivers/net/ntnic/include/flow_api_engine.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 9 ++++-- .../profile_inline/flow_api_hw_db_inline.h | 1 + .../profile_inline/flow_api_profile_inline.c | 30 +++++++++++-------- 4 files changed, 25 insertions(+), 16 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +1 -0
@@ -203,6 +203,7 @@ struct nic_flow_def {int l3_prot;int l4_prot;int tunnel_prot; +int tunnel_l2_prot;int tunnel_l3_prot;int tunnel_l4_prot;int vlans;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +6 -3
@@ -396,10 +396,11 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const strucfprintf (file," Port msk 0x%02x, VLAN msk 0x%02x\n" , (int )data->mac_port_mask, (int )data->vlan_mask);fprintf (file, -" Proto msks: Frag 0x%02x, l2 0x%02x, l3 0x%02x, l4 0x%02x, l3t 0x%02x, l4t 0x%02x\n" , +" Proto msks: Frag 0x%02x, l2 0x%02x, l3 0x%02x, l4 0x%02x, l2t 0x%02x, l3t 0x%02x, l4t 0x%02x\n" , (int )data->ptc_mask_frag, (int )data->ptc_mask_l2, (int )data->ptc_mask_l3, (int )data->ptc_mask_l4, - (int )data->ptc_mask_l3_tunnel, (int )data->ptc_mask_l4_tunnel); + (int )data->ptc_mask_l2_tunnel, (int )data->ptc_mask_l3_tunnel, + (int )data->ptc_mask_l4_tunnel);fprintf (file," IP protocol: pn %u pnt %u\n" , data->ip_prot, data->ip_prot_tunnel);break ;
@@ -958,7 +959,8 @@ static int hw_db_inline_filter_apply(struct flow_nic_dev *ndev,nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_L4 , cat_hw_id,0 , cat->ptc_mask_l4);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TUNNEL , cat_hw_id,0 , cat->ptc_mask_tunnel); -nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 ,-1 ); +nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 , + cat->ptc_mask_l2_tunnel);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 ,-1 );nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_MPLS , cat_hw_id,0 ,-1 ); nthw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_L3, cat_hw_id, 0,
@@ -2294,6 +2296,7 @@ static int hw_db_inline_cat_compare(const struct hw_db_inline_cat_data *data1, data1->ptc_mask_l3 == data2->ptc_mask_l3 && data1->ptc_mask_l4 == data2->ptc_mask_l4 && data1->ptc_mask_tunnel == data2->ptc_mask_tunnel && + data1->ptc_mask_l2_tunnel == data2->ptc_mask_l2_tunnel && data1->ptc_mask_l3_tunnel == data2->ptc_mask_l3_tunnel && data1->ptc_mask_l4_tunnel == data2->ptc_mask_l4_tunnel && data1->err_mask_ttl_tunnel == data2->err_mask_ttl_tunnel &&
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +1 -0
@@ -219,6 +219,7 @@ struct hw_db_inline_cat_data { uint32_t err_mask_ttl : 2; uint32_t padding1 : 9; +uint8_t ptc_mask_l2_tunnel;uint8_t ip_prot;uint8_t ip_prot_tunnel; };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +17 -13
@@ -908,6 +908,7 @@ static inline struct nic_flow_def *prepare_nic_flow_def(struct nic_flow_def *fd) fd->l4_prot =-1 ; fd->vlans =0 ; fd->tunnel_prot =-1 ; + fd->tunnel_l2_prot =-1 ; fd->tunnel_l3_prot =-1 ; fd->tunnel_l4_prot =-1 ; fd->fragmentation =-1 ;
@@ -928,7 +929,8 @@ static inline struct nic_flow_def *allocate_nic_flow_def(void)static bool fd_has_empty_pattern (const struct nic_flow_def *fd) {return fd && fd->vlans ==0 && fd->l2_prot <0 && fd->l3_prot <0 && fd->l4_prot <0 && - fd->tunnel_prot <0 && fd->tunnel_l3_prot <0 && fd->tunnel_l4_prot <0 && + fd->tunnel_prot <0 && fd->tunnel_l2_prot <0 && + fd->tunnel_l3_prot <0 && fd->tunnel_l4_prot <0 && fd->ip_prot <0 && fd->tunnel_ip_prot <0 && fd->non_empty <0 ; }
@@ -1798,15 +1800,11 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,const struct rte_ether_hdr *eth_mask = (const struct rte_ether_hdr *)elem[eidx].mask; -if (any_count >0 ) { -NT_LOG (ERR ,FILTER , -"Tunneled L2 ethernet not supported" ); -nthw_flow_nic_set_error (ERR_FAILED , error); -return -1 ; - } -if (eth_spec ==NULL || eth_mask ==NULL ) { - fd->l2_prot =PROT_L2_ETH2 ; +if (any_count >0 || fd->l2_prot !=-1 ) + fd->tunnel_l2_prot =PROT_L2_ETH2 ; +else + fd->l2_prot =PROT_L2_ETH2 ;break ; }
@@ -1876,8 +1874,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,nthw_km_add_match_elem (&fd->km, &qw_data[(size_t )(qw_counter *4 )], - &qw_mask[(size_t )(qw_counter *4 )],4 ,DYN_L2 ,0 ); -set_key_def_qw (key_def, qw_counter,DYN_L2 ,0 ); + &qw_mask[(size_t )(qw_counter *4 )],4 , + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,0 ); +set_key_def_qw (key_def, qw_counter, + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,0 ); qw_counter +=1 ;if (!non_zero)
@@ -1898,8 +1898,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, sw_data[0 ] =ntohs (eth_spec->ether_type) <<16 & sw_mask[0 ];nthw_km_add_match_elem (&fd->km, &sw_data[0 ], - &sw_mask[0 ],1 ,DYN_L2 ,12 ); -set_key_def_sw (key_def, sw_counter,DYN_L2 ,12 ); + &sw_mask[0 ],1 , + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,12 ); +set_key_def_sw (key_def, sw_counter, + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,12 ); sw_counter +=1 ; }
@@ -3699,6 +3701,8 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n fd->ttl_sub_outer) ? -1 : 0x1, .ptc_mask_tunnel = fd->tunnel_prot != -1 ? (1 << (fd->tunnel_prot > 10 ? 10 : fd->tunnel_prot)) : -1, + .ptc_mask_l2_tunnel = + fd->tunnel_l2_prot != -1 ? (1 << fd->tunnel_l2_prot) : -1, .ptc_mask_l3_tunnel = fd->tunnel_l3_prot != -1 ? (1 << fd->tunnel_l3_prot) : -1, .ptc_mask_l4_tunnel =
Signature · 1 line
2.45.0
PATCH 13/20 net/ntnic: add support pattern matching on inner VLAN header
In reply to Serhii IliushykImplements support for match on single or multiple nested inner VLAN headers.
Updates flow dump output to print both outer and inner VLAN masks.
--- drivers/net/ntnic/include/flow_api_engine.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 9 ++++-- .../profile_inline/flow_api_hw_db_inline.h | 3 +- .../profile_inline/flow_api_profile_inline.c | 31 +++++++++++++------ 4 files changed, 31 insertions(+), 13 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +1 -0
@@ -207,6 +207,7 @@ struct nic_flow_def {int tunnel_l3_prot;int tunnel_l4_prot;int vlans; +int tunnel_vlans;int fragmentation;int ip_prot;int tunnel_ip_prot;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +6 -3
@@ -393,8 +393,9 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struccase HW_DB_IDX_TYPE_CAT : {const struct hw_db_inline_cat_data *data = &db->cat[idxs[i].ids].data;fprintf (file," CAT %" PRIu32"\n" , idxs[i].ids); -fprintf (file," Port msk 0x%02x, VLAN msk 0x%02x\n" , - (int )data->mac_port_mask, (int )data->vlan_mask); +fprintf (file," Port msk 0x%02x, VLAN msk 0x%02x, VLAN tun msk 0x%02x\n" , + (int )data->mac_port_mask, (int )data->vlan_mask, + (int )data->vlan_mask_tunnel); fprintf(file, " Proto msks: Frag 0x%02x, l2 0x%02x, l3 0x%02x, l4 0x%02x, l2t 0x%02x, l3t 0x%02x, l4t 0x%02x\n", (int)data->ptc_mask_frag, (int)data->ptc_mask_l2,
@@ -961,7 +962,8 @@ static int hw_db_inline_filter_apply(struct flow_nic_dev *ndev, cat->ptc_mask_tunnel);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 , cat->ptc_mask_l2_tunnel); -nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 ,-1 ); +nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 , + cat->vlan_mask_tunnel);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_MPLS , cat_hw_id,0 ,-1 );nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L3 , cat_hw_id,0 , cat->ptc_mask_l3_tunnel);
@@ -2296,6 +2298,7 @@ static int hw_db_inline_cat_compare(const struct hw_db_inline_cat_data *data1, data1->ptc_mask_l3 == data2->ptc_mask_l3 && data1->ptc_mask_l4 == data2->ptc_mask_l4 && data1->ptc_mask_tunnel == data2->ptc_mask_tunnel && + data1->vlan_mask_tunnel == data2->vlan_mask_tunnel && data1->ptc_mask_l2_tunnel == data2->ptc_mask_l2_tunnel && data1->ptc_mask_l3_tunnel == data2->ptc_mask_l3_tunnel && data1->ptc_mask_l4_tunnel == data2->ptc_mask_l4_tunnel &&
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +2 -1
@@ -212,12 +212,13 @@ struct hw_db_inline_cat_data { uint32_t ptc_mask_l4 : 5; uint32_t padding0 : 1; + uint32_t vlan_mask_tunnel : 4; uint32_t ptc_mask_tunnel : 11; uint32_t ptc_mask_l3_tunnel : 3; uint32_t ptc_mask_l4_tunnel : 5; uint32_t err_mask_ttl_tunnel : 2; uint32_t err_mask_ttl : 2; - uint32_t padding1 : 9; + uint32_t padding1 : 5;uint8_t ptc_mask_l2_tunnel;uint8_t ip_prot;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +22 -9
@@ -907,6 +907,7 @@ static inline struct nic_flow_def *prepare_nic_flow_def(struct nic_flow_def *fd) fd->l3_prot =-1 ; fd->l4_prot =-1 ; fd->vlans =0 ; + fd->tunnel_vlans =0 ; fd->tunnel_prot =-1 ; fd->tunnel_l2_prot =-1 ; fd->tunnel_l3_prot =-1 ;
@@ -928,7 +929,8 @@ static inline struct nic_flow_def *allocate_nic_flow_def(void)static bool fd_has_empty_pattern (const struct nic_flow_def *fd) { -return fd && fd->vlans ==0 && fd->l2_prot <0 && fd->l3_prot <0 && fd->l4_prot <0 && +return fd && fd->vlans ==0 && fd->tunnel_vlans ==0 && fd->l2_prot <0 && + fd->l3_prot <0 && fd->l4_prot <0 && fd->tunnel_prot <0 && fd->tunnel_l2_prot <0 && fd->tunnel_l3_prot <0 && fd->tunnel_l4_prot <0 && fd->ip_prot <0 && fd->tunnel_ip_prot <0 && fd->non_empty <0 ;
@@ -1920,7 +1922,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, (const struct rte_vlan_hdr *)elem[eidx].mask;if (vlan_spec ==NULL || vlan_mask ==NULL ) { - fd->vlans +=1 ; +if (any_count >0 ) + fd->tunnel_vlans +=1 ; +else + fd->vlans +=1 ;break ; }
@@ -1947,9 +1952,13 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, sw_data[0 ] &= sw_mask[0 ];nthw_km_add_match_elem (&fd->km, &sw_data[0 ], &sw_mask[0 ],1 , -DYN_FIRST_VLAN ,2 +4 * fd->vlans); -set_key_def_sw (key_def, sw_counter,DYN_FIRST_VLAN , -2 +4 * fd->vlans); + any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : + fd->vlans)); +set_key_def_sw (key_def, sw_counter, + any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : + fd->vlans)); sw_counter +=1 ; }else if (qw_counter <2 && qw_free >0 ) {
@@ -1973,10 +1982,13 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, qw_data[2 ] &= qw_mask[2 ]; qw_data[3 ] &= qw_mask[3 ]; -nthw_km_add_match_elem (&fd->km, &qw_data[0 ], &qw_mask[0 ],4 , -DYN_FIRST_VLAN ,2 +4 * fd->vlans); -set_key_def_qw (key_def, qw_counter,DYN_FIRST_VLAN , -2 +4 * fd->vlans); +nthw_km_add_match_elem (&fd->km, &qw_data[0 ], &qw_mask[0 ], +4 , any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : + fd->vlans)); +set_key_def_qw (key_def, qw_counter, + any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : fd->vlans)); qw_counter +=1 ; qw_free -=1 ;
@@ -3699,6 +3711,7 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n .ptc_mask_l4 = fd->l4_prot != -1 ? (1 << fd->l4_prot) : -1, .err_mask_ttl = (fd->ttl_sub_enable && fd->ttl_sub_outer) ? -1 : 0x1, + .vlan_mask_tunnel = (0xf << fd->tunnel_vlans) & 0xf, .ptc_mask_tunnel = fd->tunnel_prot != -1 ? (1 << (fd->tunnel_prot > 10 ? 10 : fd->tunnel_prot)) : -1, .ptc_mask_l2_tunnel =
Signature · 1 line
2.45.0
PATCH 14/20 net/ntnic: add handling exception path option
In reply to Serhii IliushykEnable exception path for unmatched packets to go through queue 0.
--- doc/guides/nics/ntnic.rst | 9 +++++++++ drivers/net/ntnic/ntnic_ethdev.c | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+)
doc/guides/nics/ntnic.rst +9 -0
@@ -136,6 +136,15 @@ Multiple arguments for the same device are separated by ‘,’ comma. By default, the value is set to 1. +``exception_path`` parameter [int] + + Enable exception path for unmatched packets to go through queue 0. + + To enable exception_path:: + + -a <domain>:<bus>:00.0,exception_path=1 + + By default, the value is set to 0. Logging and Debugging ---------------------
drivers/net/ntnic/ntnic_ethdev.c +21 -0
@@ -73,11 +73,13 @@ uint64_t rte_tsc_freq;#define ETH_DEV_NTNIC_HELP_ARG "help"#define ETH_DEV_NTHW_RXQUEUES_ARG "rxqs"#define ETH_DEV_NTHW_TXQUEUES_ARG "txqs" +#define ETH_DEV_NTHW_EXCEPTION_PATH_ARG "exception_path"static const char *const valid_arguments[] = {ETH_DEV_NTNIC_HELP_ARG ,ETH_DEV_NTHW_RXQUEUES_ARG ,ETH_DEV_NTHW_TXQUEUES_ARG , +ETH_DEV_NTHW_EXCEPTION_PATH_ARG ,NULL , };
@@ -2260,6 +2262,25 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)NT_LOG_DBGX (DBG ,NTNIC ,"devargs: %s=%u" ,ETH_DEV_NTHW_TXQUEUES_ARG , nb_tx_queues); } + + kvargs_count =rte_kvargs_count (kvlist,ETH_DEV_NTHW_EXCEPTION_PATH_ARG ); + +if (kvargs_count !=0 ) { +assert (kvargs_count ==1 ); + res =rte_kvargs_process (kvlist,ETH_DEV_NTHW_EXCEPTION_PATH_ARG , + &nthw_string_to_u32, &exception_path); + +if (res <0 ) { +NT_LOG_DBGX (ERR ,NTNIC , +"problem with command line arguments: res=%d" , res); +return -1 ; + } + +NT_LOG_DBGX (DBG ,NTNIC ,"devargs: %s=%u" , +ETH_DEV_NTHW_EXCEPTION_PATH_ARG , exception_path); + } + +rte_kvargs_free (kvlist); }
Signature · 1 line
2.45.0
PATCH 15/20 net/ntnic: add flow query with count action
In reply to Serhii IliushykImplemented the eth_flow_query function to handle flow queries for ntnic driver.
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -35,6 +35,7 @@ vlan = Y [rte_flow actions] age = Y +count = Y drop = Y jump = Y mark = Y
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +46 -0
58 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH 16/20 net/ntnic: add flow pull
In reply to Serhii IliushykImplemented the eth_flow_pull function to handle
flow pull for ntnic driver.
--- drivers/net/ntnic/nthw/flow_api/flow_api.c | 15 +++++++++ .../flow_api/profile_inline/flm_evt_queue.c | 14 ++++++++ .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_profile_inline.c | 33 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 3 ++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 29 ++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 6 ++++ 7 files changed, 101 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +15 -0
@@ -1214,6 +1214,20 @@ static int flow_async_destroy(struct flow_eth_dev *dev, uint32_t queue_id,return profile_inline_ops->nthw_flow_async_destroy_profile_inline (dev, queue_id, op_attr, flow, user_data, error); } + +static int flow_pull (struct flow_eth_dev *dev,uint16_t caller_id,uint32_t queue_id, +struct rte_flow_op_result res[],uint16_t n_res,struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =nthw_get_profile_inline_ops (); +if (profile_inline_ops ==NULL ) { +NT_LOG (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return profile_inline_ops->nthw_flow_pull_profile_inline (dev, caller_id, + queue_id, res, n_res, error); +} +int nthw_flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size) {const struct profile_inline_ops *profile_inline_ops =nthw_get_profile_inline_ops ();
@@ -1274,6 +1288,7 @@ static const struct flow_filter_ops ops = { .flow_template_table_destroy = flow_template_table_destroy, .flow_async_create = flow_async_create, .flow_async_destroy = flow_async_destroy, + .flow_pull = flow_pull,/* * Other
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +14 -0
@@ -289,3 +289,17 @@ int nthw_flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *oreturn -ENOENT ; } + +int nthw_flm_sta_queue_get (uint8_t port,bool remote,struct flm_status_event_s *obj) +{ +struct rte_ring **stat_q = remote ? stat_q_remote : stat_q_local; + +if (port >= (remote ?MAX_STAT_RMT_QUEUES :MAX_STAT_LCL_QUEUES )) +return -1 ; + +if (stat_q[port] ==NULL ) +if (flm_evt_queue_create (port, remote ?FLM_STAT_REMOTE :FLM_STAT_LOCAL ) ==NULL ) +return -1 ; + +return rte_ring_sc_dequeue_elem (stat_q[port], obj,FLM_STAT_ELEM_SIZE ); +}
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
@@ -51,5 +51,6 @@ void nthw_flm_inf_sta_queue_free_all(uint8_t caller);void nthw_flm_inf_queue_put (uint8_t port,bool remote,struct flm_info_event_s *obj);int nthw_flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj);int nthw_flm_sta_queue_put (uint8_t port,bool remote,struct flm_status_event_s *obj); +int nthw_flm_sta_queue_get (uint8_t port,bool remote,struct flm_status_event_s *obj);#endif /* _FLM_EVT_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +33 -0
@@ -5400,6 +5400,38 @@ int nthw_flow_async_destroy_profile_inline(struct flow_eth_dev *dev, uint32_t qureturn 0 ; } +int nthw_flow_pull_profile_inline (struct flow_eth_dev *dev, +uint16_t caller_id, +uint32_t queue_id, +struct rte_flow_op_result res[], +uint16_t n_res, +struct rte_flow_error *error) +{ + (void )dev; + (void )queue_id; + (void )error; +struct flm_status_event_s obj; +struct flow_handle *fh; +int count =0 ; +uint8_t port =0 ; +bool remote_caller =is_remote_caller (caller_id, &port); + +for (int i =0 ; i < n_res; i++) { +if (nthw_flm_sta_queue_get (port, remote_caller, &obj) !=0 ) +break ; + + fh = obj.flow; +if (fh->type !=FLOW_HANDLE_TYPE_FLM || !fh->flm_async) +continue ; + + res[i].status = obj.learn_done ?RTE_FLOW_OP_SUCCESS :RTE_FLOW_OP_ERROR ; + res[i].user_data = fh->user_data; + count++; + } + +return count; +} +static const struct profile_inline_ops ops = {/* * Management
@@ -5438,6 +5470,7 @@ static const struct profile_inline_ops ops = { nthw_flow_template_table_destroy_profile_inline, .nthw_flow_async_create_profile_inline = nthw_flow_async_create_profile_inline, .nthw_flow_async_destroy_profile_inline = nthw_flow_async_destroy_profile_inline, + .nthw_flow_pull_profile_inline = nthw_flow_pull_profile_inline,/* * NT Flow FLM Meter API */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +3 -0
@@ -123,6 +123,9 @@ int nthw_flow_async_destroy_profile_inline(struct flow_eth_dev *dev, uint32_t qu const struct rte_flow_op_attr *op_attr, struct flow_handle *flow, void *user_data, struct rte_flow_error *error); +int nthw_flow_pull_profile_inline (struct flow_eth_dev *dev,uint16_t caller_id,uint32_t queue_id, +struct rte_flow_op_result res[],uint16_t n_res,struct rte_flow_error *error); +int nthw_flow_info_get_profile_inline (struct flow_eth_dev *dev,uint8_t caller_id,struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info,struct rte_flow_error *error);
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +29 -0
@@ -1173,6 +1173,34 @@ static int eth_flow_async_destroy(struct rte_eth_dev *dev, uint32_t queue_id,return res; } +static int +eth_flow_pull (struct rte_eth_dev *eth_dev, +uint32_t queue_id, +struct rte_flow_op_result op_result[], +uint16_t n_res, +struct rte_flow_error *error) + +{ +const struct flow_filter_ops *flow_filter_ops =nthw_get_flow_filter_ops (); +if (flow_filter_ops ==NULL ) { +NT_LOG (ERR ,FILTER ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = eth_dev->data->dev_private; + + error->type =RTE_FLOW_ERROR_TYPE_NONE ; + error->message ="none" ; + +/* Main application caller_id is port_id shifted above VDPA ports */ +uint16_t caller_id =get_caller_id (eth_dev->data->port_id); + +int res = flow_filter_ops->flow_pull (internals->flw_dev, caller_id, queue_id, + op_result, n_res, error); + +return res; +} +static int poll_statistics (struct pmd_internals *internals) {int flow;
@@ -1365,6 +1393,7 @@ void nthw_dev_flow_init(void)static struct rte_flow_fp_ops async_dev_flow_ops = { .async_create = eth_flow_async_create, .async_destroy = eth_flow_async_destroy, + .pull = eth_flow_pull, };void nthw_dev_fp_flow_init (void )
drivers/net/ntnic/ntnic_mod_reg.h +6 -0
@@ -397,6 +397,9 @@ struct profile_inline_ops { struct flow_handle *flow, void *user_data, struct rte_flow_error *error); +int (*nthw_flow_pull_profile_inline)(struct flow_eth_dev *dev,uint16_t caller_id, +uint32_t queue_id,struct rte_flow_op_result res[], +uint16_t n_res,struct rte_flow_error *error);/* * Stats */
@@ -560,6 +563,9 @@ struct flow_filter_ops { const struct rte_flow_op_attr *op_attr, struct flow_handle *flow, void *user_data, struct rte_flow_error *error); +int (*flow_pull)(struct flow_eth_dev *dev,uint16_t caller_id,uint32_t queue_id, +struct rte_flow_op_result res[],uint16_t n_res,struct rte_flow_error *error); +int (*flow_info_get)(struct flow_eth_dev *dev,uint8_t caller_id,struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info,struct rte_flow_error *error);
Signature · 1 line
2.45.0
PATCH 17/20 net/ntnic: extend flow dump with MBR configuration
In reply to Serhii Iliushykadd dump of MBR init configuration and extend dump of MBR rules
--- .../profile_inline/flow_api_hw_db_inline.c | 36 ++++++++++++-- .../flow_api_profile_inline_config.h | 48 +++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +33 -3
@@ -23,6 +23,13 @@#define HW_DB_FT_TYPE_FLM 0#define HW_DB_FT_TYPE_KM 1 + +/******************************************************************************/ +/* MBR Configuration support */ +/******************************************************************************/ +static int8_t hw_db_pkt_layer_dyn[] =NTNIC_FLOW_MBR_PKT_LAYER_PER_GROUP ; +static int8_t hw_db_pkt_layer_ofs[] =NTNIC_FLOW_MBR_PKT_LAYER_OFFSET_PER_GROUP ; +/******************************************************************************/ /* Handle */ /******************************************************************************/
@@ -533,11 +540,34 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struc &db->flm[idxs[i].id2].ft[idxs[i].id1].data;fprintf (file," FLM_FT %" PRIu32"\n" , idxs[i].id1); -if (data->is_group_zero) +if (data->is_group_zero) {fprintf (file," Jump to %d\n" , data->jump); + }else { +uint32_t group_orig =0 ; -else -fprintf (file," Group %d\n" , data->group); +if (nthw_flow_group_translate_get_orig_group (ndev->group_handle, + data->group, + &group_orig) <0 ) { +fprintf (file," Encoded group: %d\n" , data->group); + + }else { +fprintf (file," Group %d, encoded group: %d\n" , + group_orig, data->group); + } + +const int dyn_group_orig = + group_orig >=sizeof (hw_db_pkt_layer_dyn) ? + hw_db_pkt_layer_dyn[0 ] : + hw_db_pkt_layer_dyn[group_orig]; + +const int ofs_group_orig = + group_orig >=sizeof (hw_db_pkt_layer_ofs) ? + hw_db_pkt_layer_ofs[0 ] : + hw_db_pkt_layer_ofs[group_orig]; + +fprintf (file," BYT dyn %d, ofs %d\n" , + dyn_group_orig, ofs_group_orig); + }fprintf (file," ACTION_SET id %d\n" , data->action_set.ids);break ;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h +48 -0
54 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH 18/20 net/ntnic: make flow lock local
In reply to Serhii IliushykFrom: Stephen Hemminger <[email protected]>
The variable flow_lock is only used in one file.
--- drivers/net/ntnic/include/create_elements.h | 2 -- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/ntnic/include/create_elements.h +0 -2
@@ -58,6 +58,4 @@ enum nt_rte_flow_item_type { NT_RTE_FLOW_ITEM_TYPE_TUNNEL, }; -extern rte_spinlock_t flow_lock; -#endif /* __CREATE_ELEMENTS_H__ */
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +1 -1
@@ -28,7 +28,7 @@static struct rte_flow nt_flows[MAX_RTE_FLOWS ]; -rte_spinlock_t flow_lock =RTE_SPINLOCK_INITIALIZER ; +static rte_spinlock_t flow_lock =RTE_SPINLOCK_INITIALIZER ;static struct rte_flow nt_flows[MAX_RTE_FLOWS ]; static int nthw_interpret_raw_data(uint8_t *data, uint8_t *preserve, int size,
Signature · 1 line
2.45.0
PATCH 19/20 net/ntnic: rename hwlock
In reply to Serhii IliushykAll global variables in driver should use common prefix. Rename hwlock to nthw_lock.
--- drivers/net/ntnic/include/stream_binary_flow_api.h | 2 +- drivers/net/ntnic/ntnic_ethdev.c | 14 +++++++------- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/ntnic/include/stream_binary_flow_api.h +1 -1
@@ -47,7 +47,7 @@#define RAW_ENCAP_DECAP_ELEMS_MAX 16extern uint64_t rte_tsc_freq; -extern rte_spinlock_t hwlock; +extern rte_spinlock_t nthw_lock;/* * Flow eth dev profile determines how the FPGA module resources are
drivers/net/ntnic/ntnic_ethdev.c +7 -7
@@ -95,7 +95,7 @@ static const struct rte_pci_id nthw_pci_id_map[] = {static const struct sg_ops_s *sg_ops; -rte_spinlock_t hwlock =RTE_SPINLOCK_INITIALIZER ; +rte_spinlock_t nthw_lock =RTE_SPINLOCK_INITIALIZER ;/* * Store and get adapter info
@@ -127,9 +127,9 @@ store_pdrv(struct drv_s *p_drv) PCIIDENT_TO_FUNCNR(p_drv->ntdrv.pciident)); } -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock); _g_p_drv[p_drv->adapter_no] = p_drv; -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock); }static void clear_pdrv (struct drv_s *p_drv)
@@ -137,9 +137,9 @@ static void clear_pdrv(struct drv_s *p_drv)if (p_drv->adapter_no >=NUM_ADAPTER_MAX )return ; -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock); _g_p_drv[p_drv->adapter_no] =NULL ; -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock); } static struct drv_s *
@@ -147,7 +147,7 @@ get_pdrv_from_pci(struct rte_pci_addr addr) {int i;struct drv_s *p_drv =NULL ; -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock);for (i =0 ; i <NUM_ADAPTER_MAX ; i++) {if (_g_p_drv[i]) {
@@ -159,7 +159,7 @@ get_pdrv_from_pci(struct rte_pci_addr addr) } } -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);return p_drv; }
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +4 -4
@@ -1215,7 +1215,7 @@ static int poll_statistics(struct pmd_internals *internals)RTE_ASSERT (rte_tsc_freq >0 ); -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock);uint64_t now_rtc =rte_get_tsc_cycles ();
@@ -1224,7 +1224,7 @@ static int poll_statistics(struct pmd_internals *internals)* if more than a second since last stat read, do a new one */ if ((now_rtc - internals->last_stat_rtc) < rte_tsc_freq) { -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);return 0 ; }
@@ -1270,7 +1270,7 @@ static int poll_statistics(struct pmd_internals *internals)/* Globally only once a second */ if ((now_rtc - last_stat_rtc) < rte_tsc_freq) { -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ; }
@@ -1307,7 +1307,7 @@ static int poll_statistics(struct pmd_internals *internals) } } -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ;
Signature · 1 line
2.45.0
PATCH 20/20 net/ntnic: rename nt log types
In reply to Serhii IliushykAll global variables in driver should use common prefix.
--- drivers/net/ntnic/ntlog/ntlog.h | 16 ++++++++-------- drivers/net/ntnic/ntnic_ethdev.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/ntnic/ntlog/ntlog.h +8 -8
@@ -10,14 +10,14 @@#include <stdint.h> #include <rte_log.h> -extern int nt_log_general; -#define RTE_LOGTYPE_GENERAL nt_log_general -extern int nt_log_nthw; -#define RTE_LOGTYPE_NTHW nt_log_nthw -extern int nt_log_filter; -#define RTE_LOGTYPE_FILTER nt_log_filter -extern int nt_log_ntnic; -#define RTE_LOGTYPE_NTNIC nt_log_ntnic +extern int nthw_logtype_general; +#define RTE_LOGTYPE_GENERAL nthw_logtype_general +extern int nthw_logtype_nthw; +#define RTE_LOGTYPE_NTHW nthw_logtype_nthw +extern int nthw_logtype_filter; +#define RTE_LOGTYPE_FILTER nthw_logtype_filter +extern int nthw_logtype_ntnic; +#define RTE_LOGTYPE_NTNIC nthw_logtype_ntnic#define NT_DRIVER_NAME "ntnic"
drivers/net/ntnic/ntnic_ethdev.c +4 -4
@@ -2751,7 +2751,7 @@ RTE_PMD_REGISTER_PCI(net_ntnic, rte_nthw_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_ntnic, nthw_pci_id_map);RTE_PMD_REGISTER_KMOD_DEP (net_ntnic,"* vfio-pci" ); -RTE_LOG_REGISTER_SUFFIX (nt_log_general, general,INFO ); -RTE_LOG_REGISTER_SUFFIX (nt_log_nthw, nthw,INFO ); -RTE_LOG_REGISTER_SUFFIX (nt_log_filter, filter,INFO ); -RTE_LOG_REGISTER_SUFFIX (nt_log_ntnic, ntnic,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_general, general,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_nthw, nthw,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_filter, filter,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_ntnic, ntnic,INFO );
Signature · 1 line
2.45.0
v2 cover Add NT400D11 support and new features
This series of patches adds support for NT400D11 FPGA and implements several new features including pattern matching on inner Ethernet and VLAN headers, exception path handling, flow query with count action, flow pull, and extends flow dump with MBR configuration
Serhii Iliushyk (20):
net/ntnic: add stubs for init NT400D11
net/ntnic: add reset setup for NT400D11
net/ntnic: add reset initi stage 0 for NT400D11 net/ntnic: add reset init stage 1 for NT400D11 net/ntnic: add reset init stage 2 for NT400D11 net/ntnic: add reset init stage 3 and 4 for NT400D11 net/ntnic: add reset init stage 5 for NT400D11 net/ntnic: add reset init stage 6 for NT400D11 net/ntnic: add reset init stage 7 for NT400D11 net/ntnic: add reset init stage 8 for NT400D11 net/ntnic: add fpga registers for NT400D11 net/ntnic: add support pattern matching on inner ETH headers net/ntnic: add support pattern matching on inner VLAN header net/ntnic: add handling exception path option net/ntnic: add flow query with count action net/ntnic: add flow pull
net/ntnic: extend flow dump with MBR configuration net/ntnic: rename hwlock
net/ntnic: rename nt log types
net/ntnic: fix potential name conflict
Stephen Hemminger (1):
net/ntnic: make flow lock local
doc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 15 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 3 +- drivers/net/ntnic/include/create_elements.h | 2 - drivers/net/ntnic/include/flow_api_engine.h | 2 + .../ntnic/include/stream_binary_flow_api.h | 4 +- drivers/net/ntnic/meson.build | 2 + .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 41 + .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 380 ++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 15 + .../flow_api/profile_inline/flm_evt_queue.c | 14 + .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 54 +- .../profile_inline/flow_api_hw_db_inline.h | 4 +- .../profile_inline/flow_api_profile_inline.c | 94 +- .../profile_inline/flow_api_profile_inline.h | 3 + .../flow_api_profile_inline_config.h | 48 + drivers/net/ntnic/nthw/nthw_platform.c | 3 + drivers/net/ntnic/nthw/nthw_platform_drv.h | 2 + .../supported/nthw_fpga_9569_055_049_0000.c | 3132 +++++++++++++++++ .../nthw/supported/nthw_fpga_instances.c | 3 +- .../nthw/supported/nthw_fpga_instances.h | 1 + .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_rst9569.h | 35 + drivers/net/ntnic/ntlog/ntlog.h | 16 +- drivers/net/ntnic/ntnic_ethdev.c | 48 +- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 91 +- drivers/net/ntnic/ntnic_mod_reg.c | 15 + drivers/net/ntnic/ntnic_mod_reg.h | 17 + 31 files changed, 3982 insertions(+), 67 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h
Signature · 1 line
2.45.0
PATCH v2 1/21 net/ntnic: add stubs for init NT400D11
Add stubs for NT400D11 init functions.
These stubs will be replaced with actual implementations in future commits.
--- doc/guides/nics/ntnic.rst | 6 +++ drivers/net/ntnic/adapter/nt4ga_adapter.c | 3 +- drivers/net/ntnic/meson.build | 1 + .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 41 +++++++++++++++++++ .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 27 ++++++++++++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 1 + drivers/net/ntnic/nthw/nthw_platform.c | 3 ++ drivers/net/ntnic/nthw/nthw_platform_drv.h | 2 + drivers/net/ntnic/ntnic_ethdev.c | 1 + drivers/net/ntnic/ntnic_mod_reg.c | 15 +++++++ drivers/net/ntnic/ntnic_mod_reg.h | 9 ++++ 11 files changed, 108 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c
doc/guides/nics/ntnic.rst +6 -0
@@ -27,6 +27,10 @@ Supported NICs - FPGA ID 9563 (Inline Flow Management) +- NT400D11 2x100G SmartNIC + + - FPGA ID 9569 (Inline Flow Management) + - NT400D13 2x100G SmartNIC - FPGA ID 9574 (Inline Flow Management)
@@ -34,6 +38,8 @@ Supported NICs All information about NT200A02 and NT400D13 can be found by links below: - https://www.napatech.com/products/nt200a02-smartnic-inline/ +- https://www.napatech.com/products/nt400d11-smartnic-programmable/ +- https://www.napatech.com/products/nt400d13-smartnic-programmable/ - https://www.napatech.com/support/resources/data-sheets/link-inline-software-for-napatech/
drivers/net/ntnic/adapter/nt4ga_adapter.c +2 -1
@@ -172,10 +172,11 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) res = link_ops->link_init (p_adapter_info, p_fpga);break ; +case 9569 :/* NT400D11 (Intel Agilex FPGA) */ case 9574 :/* NT400D13 (Intel Agilex FPGA) */ link_ops =nthw_get_agx_100g_link_ops ();if (link_ops ==NULL ) { -NT_LOG (ERR ,NTNIC ,"NT400D11 100G link module uninitialized" ); +NT_LOG (ERR ,NTNIC ,"NT400Dxx 100G link module uninitialized" ); res =-1 ;break ; }
drivers/net/ntnic/meson.build +1 -0
@@ -47,6 +47,7 @@ sources = files( '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/nt400dxx/reset/nthw_fpga_rst9569.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nt400dxx/reset/nthw_fpga_rst_nt400dxx.c', 'nthw/core/nthw_fpga.c',
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +41 -0
59 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c new file +27 -0
@@ -0,0 +1,27 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2025 Napatech A/S +*/ + +#include "ntnic_mod_reg.h" + + +static int nthw_fpga_rst9569_setup (void ) +{ +return 0 ; +}; + +static int nthw_fpga_rst9569_init (void ) +{ +return 0 ; +} + +static struct rst9569_ops rst9569_ops = { + .nthw_fpga_rst9569_init = nthw_fpga_rst9569_init, + .nthw_fpga_rst9569_setup = nthw_fpga_rst9569_setup, +}; + +void nthw_rst9569_ops_init (void ) +{ +nthw_reg_rst9569_ops (&rst9569_ops); +}
drivers/net/ntnic/nthw/core/nthw_fpga.c +1 -0
@@ -440,6 +440,7 @@ 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_NT400D11 :case NT_HW_ADAPTER_ID_NT400D13 :if (nt400dxx_ops !=NULL ) res = nt400dxx_ops->nthw_fpga_nt400dxx_init (p_fpga_info);
drivers/net/ntnic/nthw/nthw_platform.c +3 -0
@@ -11,6 +11,9 @@ nthw_adapter_id_t nthw_platform_get_adapter_id(const uint16_t n_pci_device_id)case NT_HW_PCI_DEVICE_ID_NT200A02 :return NT_HW_ADAPTER_ID_NT200A02 ; +case NT_HW_PCI_DEVICE_ID_NT400D11 : +return NT_HW_ADAPTER_ID_NT400D11 ; +case NT_HW_PCI_DEVICE_ID_NT400D13 :return NT_HW_ADAPTER_ID_NT400D13 ;
drivers/net/ntnic/nthw/nthw_platform_drv.h +2 -0
@@ -10,11 +10,13 @@#define NT_HW_PCI_VENDOR_ID (0x18f4)#define NT_HW_PCI_DEVICE_ID_NT200A02 (0x1C5) +#define NT_HW_PCI_DEVICE_ID_NT400D11 (0x215)#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_NT400D11 ,NT_HW_ADAPTER_ID_NT400D13 , };
drivers/net/ntnic/ntnic_ethdev.c +1 -0
@@ -84,6 +84,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_NT400D11 ) }, {RTE_PCI_DEVICE (NT_HW_PCI_VENDOR_ID ,NT_HW_PCI_DEVICE_ID_NT400D13 ) }, { .vendor_id =0 ,
drivers/net/ntnic/ntnic_mod_reg.c +15 -0
@@ -193,6 +193,21 @@ struct rst9574_ops *nthw_get_rst9574_ops(void)return rst9574_ops; } +static struct rst9569_ops *rst9569_ops; + +void nthw_reg_rst9569_ops (struct rst9569_ops *ops) +{ + rst9569_ops = ops; +} + +struct rst9569_ops *nthw_get_rst9569_ops (void ) +{ +if (rst9569_ops ==NULL ) +nthw_rst9569_ops_init (); + +return rst9569_ops; +} +static struct rst_nt400dxx_ops *rst_nt400dxx_ops;void nthw_reg_rst_nt400dxx_ops (struct rst_nt400dxx_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +9 -0
@@ -269,6 +269,15 @@ struct rst9574_ops { struct nthw_fpga_rst_nt400dxx *const p); }; +struct rst9569_ops { +int (*nthw_fpga_rst9569_init)(void ); +int (*nthw_fpga_rst9569_setup)(void ); +}; + +void nthw_reg_rst9569_ops (struct rst9569_ops *ops); +struct rst9569_ops *nthw_get_rst9569_ops (void ); +void nthw_rst9569_ops_init (void ); +void nthw_reg_rst9574_ops (struct rst9574_ops *ops);struct rst9574_ops *nthw_get_rst9574_ops (void );void nthw_rst9574_ops_init (void );
Signature · 1 line
2.45.0
PATCH v2 2/21 net/ntnic: add reset setup for NT400D11
In reply to Serhii IliushykAdd base register initialization.
--- .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 2 +- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 54 ++++++++++++++++++- .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_rst9569.h | 35 ++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 3 +- 6 files changed, 93 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +1 -1
@@ -132,7 +132,7 @@ static int nthw_fpga_nt400dxx_init(struct fpga_info_s *p_fpga_info)return -1 ; } - res = rst9569_ops->nthw_fpga_rst9569_setup (); + res = rst9569_ops->nthw_fpga_rst9569_setup (p_fpga, &rst);if (res) { NT_LOG(ERR,
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +53 -1
63 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h +1 -0
@@ -51,6 +51,7 @@#define MOD_RPF (0x8d30dcddUL)#define MOD_RPP_LR (0xba7f945cUL)#define MOD_RST9563 (0x385d6d1dUL) +#define MOD_RST9569 (0xd8888403UL)#define MOD_RST9574 (0xbf22c9ffUL)#define MOD_SDC (0xd2369530UL)#define MOD_SLC (0x1aef1f38UL)
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h +1 -0
@@ -50,6 +50,7 @@#include "nthw_fpga_reg_defs_rpl.h" #include "nthw_fpga_reg_defs_rpp_lr.h" #include "nthw_fpga_reg_defs_rst9563.h" +#include "nthw_fpga_reg_defs_rst9569.h" #include "nthw_fpga_reg_defs_rst9574.h" #include "nthw_fpga_reg_defs_sdc.h" #include "nthw_fpga_reg_defs_tsm.h"
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h new file +35 -0
@@ -0,0 +1,35 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2025 Napatech A/S +*/ + +/* +* nthw_fpga_reg_defs_rst9569.h +* +* Auto-generated file - do *NOT* edit +* +*/ + +#ifndef _NTHW_FPGA_REG_DEFS_RST9569_ +#define _NTHW_FPGA_REG_DEFS_RST9569_ + +/* RST9569 */ +#define NTHW_MOD_RST9569 (0xd8888403UL) +#define RST9569_LATCH (0x93ac825dUL) +#define RST9569_LATCH_DDR4_CALIB_COMPLETE (0xf7a3f47eUL) +#define RST9569_LATCH_PHY_FTILE_RDY (0xf189f59cUL) +#define RST9569_LATCH_PHY_FTILE_RST_DONE (0x237710edUL) +#define RST9569_RST (0x7cda32a2UL) +#define RST9569_RST_DDR4 (0x215e3dadUL) +#define RST9569_RST_PHY_FTILE (0xd633010bUL) +#define RST9569_RST_SYS (0x74a18159UL) +#define RST9569_STAT (0xce6f562UL) +#define RST9569_STAT_DDR4_CALIB_COMPLETE (0x80a181a3UL) +#define RST9569_STAT_PHY_FTILE_RDY (0x5bf72501UL) +#define RST9569_STAT_PHY_FTILE_RST_DONE (0x26325becUL) + +#endif /* _NTHW_FPGA_REG_DEFS_RST9569_ */ + +/* +* Auto-generated file - do *NOT* edit +*/
drivers/net/ntnic/ntnic_mod_reg.h +2 -1
@@ -271,7 +271,8 @@ struct rst9574_ops {struct rst9569_ops {int (*nthw_fpga_rst9569_init)(void ); -int (*nthw_fpga_rst9569_setup)(void ); +int (*nthw_fpga_rst9569_setup)(nthw_fpga_t *p_fpga, +struct nthw_fpga_rst_nt400dxx *const p); };void nthw_reg_rst9569_ops (struct rst9569_ops *ops);
Signature · 1 line
2.45.0
PATCH v2 3/21 net/ntnic: add reset initi stage 0 for NT400D11
In reply to Serhii Iliushykadd reset all domains stage for nt400d11
--- .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 2 +- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 33 ++++++++++++++++++- drivers/net/ntnic/ntnic_mod_reg.h | 3 +- 3 files changed, 35 insertions(+), 3 deletions(-)
drivers/net/ntnic/nthw/core/nt400dxx/nthw_fpga_nt400dxx.c +1 -1
@@ -209,7 +209,7 @@ static int nthw_fpga_nt400dxx_init(struct fpga_info_s *p_fpga_info)switch (p_fpga_info->n_fpga_prod_id) {case 9569 :if (rst9569_ops) - res = rst9569_ops->nthw_fpga_rst9569_init (); + res = rst9569_ops->nthw_fpga_rst9569_init (p_fpga_info, &rst);if (res) { NT_LOG(ERR,
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +32 -1
@@ -6,6 +6,8 @@#include "ntnic_mod_reg.h" #include "nthw_register.h" #include "nthw_drv.h" +#include "nt_util.h" +#include "ntlog.h" static int nthw_fpga_rst9569_setup (nthw_fpga_t *p_fpga,struct nthw_fpga_rst_nt400dxx *const p)
@@ -63,11 +65,40 @@ static int nthw_fpga_rst9569_setup(nthw_fpga_t *p_fpga, struct nthw_fpga_rst_nt4return 0 ; }; -static int nthw_fpga_rst9569_init (void ) +static void nthw_fpga_rst9569_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_rst9569_product_reset (struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *p_rst) +{ +RTE_ASSERT (p_fpga_info); +RTE_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_DBGX (DBG ,NTHW ,"%s: RST defaults" , p_adapter_id_str); +nthw_fpga_rst9569_set_default_rst_values (p_rst); +return 0 ; } +static int nthw_fpga_rst9569_init (struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *p_rst) +{ +RTE_ASSERT (p_fpga_info); +RTE_ASSERT (p_rst); + +int res =nthw_fpga_rst9569_product_reset (p_fpga_info, p_rst); + +return res; +} +static struct rst9569_ops rst9569_ops = { .nthw_fpga_rst9569_init = nthw_fpga_rst9569_init, .nthw_fpga_rst9569_setup = nthw_fpga_rst9569_setup,
drivers/net/ntnic/ntnic_mod_reg.h +2 -1
@@ -270,7 +270,8 @@ struct rst9574_ops { };struct rst9569_ops { -int (*nthw_fpga_rst9569_init)(void ); +int (*nthw_fpga_rst9569_init)(struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *const p);int (*nthw_fpga_rst9569_setup)(nthw_fpga_t *p_fpga,struct nthw_fpga_rst_nt400dxx *const p); };
Signature · 1 line
2.45.0
PATCH v2 4/21 net/ntnic: add reset init stage 1 for NT400D11
In reply to Serhii Iliushykadd De-assert DDR4 reset.
--- .../nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +15 -0
@@ -73,6 +73,12 @@ static void nthw_fpga_rst9569_set_default_rst_values(struct nthw_fpga_rst_nt400dnthw_field_set_val_flush32 (p->p_fld_rst_phy_ftile,1 ); } +static void nthw_fpga_rst9569_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 int nthw_fpga_rst9569_product_reset (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -85,6 +91,15 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,NT_LOG_DBGX (DBG ,NTHW ,"%s: RST defaults" , p_adapter_id_str);nthw_fpga_rst9569_set_default_rst_values (p_rst); +/* +* Wait a while before waiting for deasserting ddr4 reset +*/ +nthw_os_wait_usec (2000 ); + +/* (1) De-assert DDR4 reset: */ +NT_LOG_DBGX (DBG ,NTHW ,"%s: De-asserting DDR4 reset" , p_adapter_id_str); +nthw_fpga_rst9569_ddr4_rst (p_rst,0 ); +return 0 ; }
Signature · 1 line
2.45.0
PATCH v2 5/21 net/ntnic: add reset init stage 2 for NT400D11
In reply to Serhii Iliushykadd DDR4 calibration complete.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +64 -0
@@ -79,6 +79,54 @@ static void nthw_fpga_rst9569_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, unthw_field_set_val_flush32 (p->p_fld_rst_ddr4, val); } +static bool nthw_fpga_rst9569_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 int nthw_fpga_rst9569_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_DBGX (DBG ,NTHW ,"%s: DDR4 CALIB COMPLETE wait complete" , p_adapter_id_str); +/* +* 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_rst9569_get_ddr4_calib_complete_stat (p_rst); + +if (!complete) +nthw_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_rst9569_ddr4_rst (p_rst,1 );/* Reset DDR4 */ +nthw_fpga_rst9569_ddr4_rst (p_rst,0 ); + retrycount--; + timeout =90000 ;/* Increase timeout for second attempt to 8 sec. */ + } + }while (!complete); + +return 0 ; +} +static int nthw_fpga_rst9569_product_reset (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -100,6 +148,22 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,NT_LOG_DBGX (DBG ,NTHW ,"%s: De-asserting DDR4 reset" , p_adapter_id_str);nthw_fpga_rst9569_ddr4_rst (p_rst,0 ); +/* +* Wait a while before waiting for calibration complete, since calibration complete +* is true while ddr4 is in reset +*/ +nthw_os_wait_usec (2000 ); + +/* (2) Wait until DDR4 calibration complete */ +NT_LOG_DBGX (DBG ,NTHW ,"%s: DDR4 calibration" , p_adapter_id_str); +int res =nthw_fpga_rst9569_wait_ddr4_calibration_complete (p_fpga_info, p_rst); + +if (res) { +NT_LOG (ERR ,NTHW ,"%s: DDR4 calibration failed" , p_adapter_id_str); +return res; + } + +return 0 ; }
Signature · 1 line
2.45.0
PATCH v2 6/21 net/ntnic: add reset init stage 3 and 4 for NT400D11
In reply to Serhii Iliushykadd DDR4 calib complete latched bits.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +24 -0
@@ -84,6 +84,13 @@ static bool nthw_fpga_rst9569_get_ddr4_calib_complete_stat(struct nthw_fpga_rst_return nthw_field_get_updated (p->p_fld_stat_ddr4_calib_complete) !=0 ; } +static void nthw_fpga_rst9569_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_rst9569_wait_ddr4_calibration_complete (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -127,6 +134,11 @@ static int nthw_fpga_rst9569_wait_ddr4_calibration_complete(struct fpga_info_s *return 0 ; } +static bool nthw_fpga_rst9569_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 int nthw_fpga_rst9569_product_reset (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -163,6 +175,18 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,return res; } +/* (3) Set DDR4 calib complete latched bits: */ +nthw_fpga_rst9569_set_ddr4_calib_complete_latch (p_rst,1 ); + +/* Wait for phy to settle. */ +nthw_os_wait_usec (20000 ); + +/* (4) Ensure all latched status bits are still set: */ +if (!nthw_fpga_rst9569_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
PATCH v2 7/21 net/ntnic: add reset init stage 5 for NT400D11
In reply to Serhii Iliushykadd PHY_FTILE reset.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 62 ++++++++++++++++++- 1 file changed, 60 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +60 -2
@@ -79,11 +79,26 @@ static void nthw_fpga_rst9569_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, unthw_field_set_val_flush32 (p->p_fld_rst_ddr4, val); } +static bool nthw_fpga_rst9569_get_phy_ftile_rst (struct nthw_fpga_rst_nt400dxx *const p) +{ +return nthw_field_get_updated (p->p_fld_rst_phy_ftile) !=0 ; +} +static bool nthw_fpga_rst9569_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_rst9569_get_phy_ftile_rst_done_stat (struct nthw_fpga_rst_nt400dxx *const p) +{ +return nthw_field_get_updated (p->p_fld_stat_phy_ftile_rst_done) !=0 ; +} + +static bool nthw_fpga_rst9569_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_rst9569_set_ddr4_calib_complete_latch (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) {
@@ -134,9 +149,33 @@ static int nthw_fpga_rst9569_wait_ddr4_calibration_complete(struct fpga_info_s *return 0 ; } -static bool nthw_fpga_rst9569_get_ddr4_calib_complete_latch (struct nthw_fpga_rst_nt400dxx *const p) +static int nthw_fpga_rst9569_wait_phy_ftile_rst_done (struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt400dxx *p_rst) { -return nthw_field_get_updated (p->p_fld_latch_ddr4_calib_complete) !=0 ; +const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; +uint32_t complete; +uint32_t timeout; + +/* 5: wait until PHY_FTILE reset done */ +NT_LOG (DBG ,NTHW ,"%s: %s: PHY FTILE RESET done" , p_adapter_id_str, __func__); + timeout =50000 ;/* initial timeout must be set to 5 sec. */ + +do { + complete =nthw_fpga_rst9569_get_phy_ftile_rst_done_stat (p_rst); + +if (!complete) +nthw_os_wait_usec (100 ); + + timeout--; + +if (timeout ==0 ) { +NT_LOG (ERR ,NTHW ,"%s: %s: Timeout waiting for PHY FTILE RESET to be done" , + p_adapter_id_str, __func__); +return -1 ; + } + }while (!complete); + +return 0 ; } static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,
@@ -187,6 +226,25 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, p_adapter_id_str, __func__); } +bool success = true; + +do { +/* Only wait for ftile rst done if ftile is indeed in reset. */ +if (nthw_fpga_rst9569_get_phy_ftile_rst (p_rst)) { +/* (5) Wait until PHY_FTILE reset done */ +NT_LOG_DBGX (DBG ,NTHW ,"%s: Wait until PHY_FTILE reset done" , + p_adapter_id_str); + res =nthw_fpga_rst9569_wait_phy_ftile_rst_done (p_fpga_info, p_rst); + +if (res) { +NT_LOG (ERR ,NTHW ,"%s: PHY_FTILE reset done failed" , + p_adapter_id_str); +return res; + } + } + + }while (!success); +return 0 ; }
Signature · 1 line
2.45.0
PATCH v2 8/21 net/ntnic: add reset init stage 6 for NT400D11
In reply to Serhii Iliushykadd De-assert PHY_FTILE reset.
--- .../nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c | 13 +++++++++++++ 1 file changed, 13 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +13 -0
@@ -79,6 +79,12 @@ static void nthw_fpga_rst9569_ddr4_rst(struct nthw_fpga_rst_nt400dxx *const p, unthw_field_set_val_flush32 (p->p_fld_rst_ddr4, val); } +static void nthw_fpga_rst9569_phy_ftile_rst (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) +{ +nthw_field_update_register (p->p_fld_rst_phy_ftile); +nthw_field_set_val_flush32 (p->p_fld_rst_phy_ftile, val); +} +static bool nthw_fpga_rst9569_get_phy_ftile_rst (struct nthw_fpga_rst_nt400dxx *const p) {return nthw_field_get_updated (p->p_fld_rst_phy_ftile) !=0 ;
@@ -243,6 +249,13 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, } } +/* (6) De-assert PHY_FTILE reset: */ +NT_LOG (DBG ,NTHW ,"%s: %s: De-asserting PHY_FTILE reset" , p_adapter_id_str, + __func__); +nthw_fpga_rst9569_phy_ftile_rst (p_rst,0 ); + +nthw_os_wait_usec (10000 ); + }while (!success);
Signature · 1 line
2.45.0
PATCH v2 9/21 net/ntnic: add reset init stage 7 for NT400D11
In reply to Serhii Iliushykadd waiting while PHY_FTILE ready.
--- .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 90 ++++++++++++++++++- 1 file changed, 88 insertions(+), 2 deletions(-)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +88 -2
@@ -100,6 +100,11 @@ static bool nthw_fpga_rst9569_get_phy_ftile_rst_done_stat(struct nthw_fpga_rst_nreturn nthw_field_get_updated (p->p_fld_stat_phy_ftile_rst_done) !=0 ; } +static bool nthw_fpga_rst9569_get_phy_ftile_rdy_stat (struct nthw_fpga_rst_nt400dxx *const p) +{ +return nthw_field_get_updated (p->p_fld_stat_phy_ftile_rdy) !=0 ; +} +static bool nthw_fpga_rst9569_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 ;
@@ -155,6 +160,40 @@ static int nthw_fpga_rst9569_wait_ddr4_calibration_complete(struct fpga_info_s *return 0 ; } +static int nthw_fpga_rst9569_wait_phy_ftile_rdy (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 timeout; + +/* 5: wait until PHY_FTILE reset done */ +NT_LOG (DBG ,NTHW ,"%s: %s: PHY FTILE ready" , p_adapter_id_str, __func__); + timeout =50000 ;/* initial timeout must be set to 5 sec. */ + +do { + complete =nthw_fpga_rst9569_get_phy_ftile_rdy_stat (p_rst); + +if (!complete) { +nthw_os_wait_usec (100 ); + + }else { +NT_LOG (DBG ,NTHW ,"%s: PHY FTILE ready, margin to timeout %u" , + p_adapter_id_str, timeout); + } + + timeout--; + +if (timeout ==0 ) { +NT_LOG_DBGX (ERR ,NTHW ,"%s: Timeout waiting for PHY FTILE ready" , + p_adapter_id_str); +return -1 ; + } + }while (!complete); + +return 0 ; +} +static int nthw_fpga_rst9569_wait_phy_ftile_rst_done (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt400dxx *p_rst) {
@@ -232,7 +271,8 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, p_adapter_id_str, __func__); } -bool success = true; +int tries =0 ; +bool success = false; do { /* Only wait for ftile rst done if ftile is indeed in reset. */
@@ -256,8 +296,54 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info,nthw_os_wait_usec (10000 ); - }while (!success); +/* (7) Wait until PHY_FTILE ready */ +if (nthw_fpga_rst9569_wait_phy_ftile_rdy (p_fpga_info, p_rst) ==-1 ) { +if (++tries >=5 ) { +/* Give up */ +NT_LOG_DBGX (ERR ,NTHW ,"%s: PHY_TILE not ready after %u attempts" , + p_adapter_id_str, tries); +return res; + } +/* Try to recover with as little effort as possible */ +nthw_phy_tile_t *p_phy_tile = p_fpga_info->mp_nthw_agx.p_phy_tile; + +for (uint8_t i =0 ; i <nthw_phy_tile_get_no_intfs (p_phy_tile); i++) { +/* Also consider TX_PLL_LOCKED == 0 */ +if (!nthw_phy_tile_get_port_status_tx_lanes_stable (p_phy_tile, + i)) { + success = false; +NT_LOG_DBGX (WRN ,NTHW , +"%s: PHY_TILE Intf %u TX_LANES_STABLE == FALSE" , + p_adapter_id_str, i); + +/* Active low */ +nthw_phy_tile_set_port_config_rst (p_phy_tile, i,0 ); +int32_t count =1000 ; + +do { +nthw_os_wait_usec (1000 ); + }while + (!nthw_phy_tile_get_port_status_reset_ack (p_phy_tile, i) && + (--count >0 )); + +if (count <=0 ) { +NT_LOG (ERR ,NTHW , +"%s: IntfNo %u: Time-out waiting for PortStatusResetAck" , + p_adapter_id_str, i); + } + +/* Active low */ +nthw_phy_tile_set_port_config_rst (p_phy_tile, i,1 ); +nthw_os_wait_usec (20000 ); + } + } + + }else { +NT_LOG_DBGX (DBG ,NTHW ,"%s: PHY_TILE ready" , p_adapter_id_str); + success = true; + } + }while (!success);return 0 ; }
Signature · 1 line
2.45.0
PATCH v2 10/21 net/ntnic: add reset init stage 8 for NT400D11
In reply to Serhii Iliushykadd De-assert SYS reset
--- .../ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c +10 -0
@@ -73,6 +73,12 @@ static void nthw_fpga_rst9569_set_default_rst_values(struct nthw_fpga_rst_nt400dnthw_field_set_val_flush32 (p->p_fld_rst_phy_ftile,1 ); } +static void nthw_fpga_rst9569_sys_rst (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) +{ +nthw_field_update_register (p->p_fld_rst_sys); +nthw_field_set_val_flush32 (p->p_fld_rst_sys, val); +} +static void nthw_fpga_rst9569_ddr4_rst (struct nthw_fpga_rst_nt400dxx *const p,uint32_t val) {nthw_field_update_register (p->p_fld_rst_ddr4);
@@ -345,6 +351,10 @@ static int nthw_fpga_rst9569_product_reset(struct fpga_info_s *p_fpga_info, } }while (!success); +/* (8) De-assert SYS reset: */ +NT_LOG (DBG ,NTHW ,"%s: %s: De-asserting SYS reset" , p_adapter_id_str, __func__); +nthw_fpga_rst9569_sys_rst (p_rst,0 ); +return 0 ; }
Signature · 1 line
2.45.0
PATCH v2 11/21 net/ntnic: add fpga registers for NT400D11
In reply to Serhii Iliushykadd fpga registers description
--- drivers/net/ntnic/meson.build | 1 + .../supported/nthw_fpga_9569_055_049_0000.c | 3132 +++++++++++++++++ .../nthw/supported/nthw_fpga_instances.c | 3 +- .../nthw/supported/nthw_fpga_instances.h | 1 + 4 files changed, 3136 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c
drivers/net/ntnic/meson.build +1 -0
@@ -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_9569_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',
drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c new file +3132 -0
2,993 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c +2 -1
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h +1 -0
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.
PATCH v2 12/21 net/ntnic: add support pattern matching on inner ETH headers
In reply to Serhii IliushykImplements support for match on inner ETH header.
Updates flow dump output to print both outer and
inner l2 masks.
--- drivers/net/ntnic/include/flow_api_engine.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 9 ++++-- .../profile_inline/flow_api_hw_db_inline.h | 1 + .../profile_inline/flow_api_profile_inline.c | 30 +++++++++++-------- 4 files changed, 25 insertions(+), 16 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +1 -0
@@ -203,6 +203,7 @@ struct nic_flow_def {int l3_prot;int l4_prot;int tunnel_prot; +int tunnel_l2_prot;int tunnel_l3_prot;int tunnel_l4_prot;int vlans;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +6 -3
@@ -396,10 +396,11 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const strucfprintf (file," Port msk 0x%02x, VLAN msk 0x%02x\n" , (int )data->mac_port_mask, (int )data->vlan_mask);fprintf (file, -" Proto msks: Frag 0x%02x, l2 0x%02x, l3 0x%02x, l4 0x%02x, l3t 0x%02x, l4t 0x%02x\n" , +" Proto msks: Frag 0x%02x, l2 0x%02x, l3 0x%02x, l4 0x%02x, l2t 0x%02x, l3t 0x%02x, l4t 0x%02x\n" , (int )data->ptc_mask_frag, (int )data->ptc_mask_l2, (int )data->ptc_mask_l3, (int )data->ptc_mask_l4, - (int )data->ptc_mask_l3_tunnel, (int )data->ptc_mask_l4_tunnel); + (int )data->ptc_mask_l2_tunnel, (int )data->ptc_mask_l3_tunnel, + (int )data->ptc_mask_l4_tunnel);fprintf (file," IP protocol: pn %u pnt %u\n" , data->ip_prot, data->ip_prot_tunnel);break ;
@@ -958,7 +959,8 @@ static int hw_db_inline_filter_apply(struct flow_nic_dev *ndev,nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_L4 , cat_hw_id,0 , cat->ptc_mask_l4);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TUNNEL , cat_hw_id,0 , cat->ptc_mask_tunnel); -nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 ,-1 ); +nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 , + cat->ptc_mask_l2_tunnel);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 ,-1 );nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_MPLS , cat_hw_id,0 ,-1 ); nthw_mod_cat_cfn_set(&ndev->be, HW_CAT_CFN_PTC_TNL_L3, cat_hw_id, 0,
@@ -2294,6 +2296,7 @@ static int hw_db_inline_cat_compare(const struct hw_db_inline_cat_data *data1, data1->ptc_mask_l3 == data2->ptc_mask_l3 && data1->ptc_mask_l4 == data2->ptc_mask_l4 && data1->ptc_mask_tunnel == data2->ptc_mask_tunnel && + data1->ptc_mask_l2_tunnel == data2->ptc_mask_l2_tunnel && data1->ptc_mask_l3_tunnel == data2->ptc_mask_l3_tunnel && data1->ptc_mask_l4_tunnel == data2->ptc_mask_l4_tunnel && data1->err_mask_ttl_tunnel == data2->err_mask_ttl_tunnel &&
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +1 -0
@@ -219,6 +219,7 @@ struct hw_db_inline_cat_data { uint32_t err_mask_ttl : 2; uint32_t padding1 : 9; +uint8_t ptc_mask_l2_tunnel;uint8_t ip_prot;uint8_t ip_prot_tunnel; };
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +17 -13
@@ -908,6 +908,7 @@ static inline struct nic_flow_def *prepare_nic_flow_def(struct nic_flow_def *fd) fd->l4_prot =-1 ; fd->vlans =0 ; fd->tunnel_prot =-1 ; + fd->tunnel_l2_prot =-1 ; fd->tunnel_l3_prot =-1 ; fd->tunnel_l4_prot =-1 ; fd->fragmentation =-1 ;
@@ -928,7 +929,8 @@ static inline struct nic_flow_def *allocate_nic_flow_def(void)static bool fd_has_empty_pattern (const struct nic_flow_def *fd) {return fd && fd->vlans ==0 && fd->l2_prot <0 && fd->l3_prot <0 && fd->l4_prot <0 && - fd->tunnel_prot <0 && fd->tunnel_l3_prot <0 && fd->tunnel_l4_prot <0 && + fd->tunnel_prot <0 && fd->tunnel_l2_prot <0 && + fd->tunnel_l3_prot <0 && fd->tunnel_l4_prot <0 && fd->ip_prot <0 && fd->tunnel_ip_prot <0 && fd->non_empty <0 ; }
@@ -1798,15 +1800,11 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,const struct rte_ether_hdr *eth_mask = (const struct rte_ether_hdr *)elem[eidx].mask; -if (any_count >0 ) { -NT_LOG (ERR ,FILTER , -"Tunneled L2 ethernet not supported" ); -nthw_flow_nic_set_error (ERR_FAILED , error); -return -1 ; - } -if (eth_spec ==NULL || eth_mask ==NULL ) { - fd->l2_prot =PROT_L2_ETH2 ; +if (any_count >0 || fd->l2_prot !=-1 ) + fd->tunnel_l2_prot =PROT_L2_ETH2 ; +else + fd->l2_prot =PROT_L2_ETH2 ;break ; }
@@ -1876,8 +1874,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev,nthw_km_add_match_elem (&fd->km, &qw_data[(size_t )(qw_counter *4 )], - &qw_mask[(size_t )(qw_counter *4 )],4 ,DYN_L2 ,0 ); -set_key_def_qw (key_def, qw_counter,DYN_L2 ,0 ); + &qw_mask[(size_t )(qw_counter *4 )],4 , + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,0 ); +set_key_def_qw (key_def, qw_counter, + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,0 ); qw_counter +=1 ;if (!non_zero)
@@ -1898,8 +1898,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, sw_data[0 ] =ntohs (eth_spec->ether_type) <<16 & sw_mask[0 ];nthw_km_add_match_elem (&fd->km, &sw_data[0 ], - &sw_mask[0 ],1 ,DYN_L2 ,12 ); -set_key_def_sw (key_def, sw_counter,DYN_L2 ,12 ); + &sw_mask[0 ],1 , + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,12 ); +set_key_def_sw (key_def, sw_counter, + any_count >0 ?DYN_TUN_L2 :DYN_L2 ,12 ); sw_counter +=1 ; }
@@ -3699,6 +3701,8 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n fd->ttl_sub_outer) ? -1 : 0x1, .ptc_mask_tunnel = fd->tunnel_prot != -1 ? (1 << (fd->tunnel_prot > 10 ? 10 : fd->tunnel_prot)) : -1, + .ptc_mask_l2_tunnel = + fd->tunnel_l2_prot != -1 ? (1 << fd->tunnel_l2_prot) : -1, .ptc_mask_l3_tunnel = fd->tunnel_l3_prot != -1 ? (1 << fd->tunnel_l3_prot) : -1, .ptc_mask_l4_tunnel =
Signature · 1 line
2.45.0
PATCH v2 13/21 net/ntnic: add support pattern matching on inner VLAN header
In reply to Serhii IliushykImplements support for match on single or multiple nested inner VLAN headers.
Updates flow dump output to print both outer and inner VLAN masks.
--- drivers/net/ntnic/include/flow_api_engine.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 9 ++++-- .../profile_inline/flow_api_hw_db_inline.h | 3 +- .../profile_inline/flow_api_profile_inline.c | 31 +++++++++++++------ 4 files changed, 31 insertions(+), 13 deletions(-)
drivers/net/ntnic/include/flow_api_engine.h +1 -0
@@ -207,6 +207,7 @@ struct nic_flow_def {int tunnel_l3_prot;int tunnel_l4_prot;int vlans; +int tunnel_vlans;int fragmentation;int ip_prot;int tunnel_ip_prot;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +6 -3
@@ -393,8 +393,9 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struccase HW_DB_IDX_TYPE_CAT : {const struct hw_db_inline_cat_data *data = &db->cat[idxs[i].ids].data;fprintf (file," CAT %" PRIu32"\n" , idxs[i].ids); -fprintf (file," Port msk 0x%02x, VLAN msk 0x%02x\n" , - (int )data->mac_port_mask, (int )data->vlan_mask); +fprintf (file," Port msk 0x%02x, VLAN msk 0x%02x, VLAN tun msk 0x%02x\n" , + (int )data->mac_port_mask, (int )data->vlan_mask, + (int )data->vlan_mask_tunnel); fprintf(file, " Proto msks: Frag 0x%02x, l2 0x%02x, l3 0x%02x, l4 0x%02x, l2t 0x%02x, l3t 0x%02x, l4t 0x%02x\n", (int)data->ptc_mask_frag, (int)data->ptc_mask_l2,
@@ -961,7 +962,8 @@ static int hw_db_inline_filter_apply(struct flow_nic_dev *ndev, cat->ptc_mask_tunnel);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L2 , cat_hw_id,0 , cat->ptc_mask_l2_tunnel); -nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 ,-1 ); +nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_VLAN , cat_hw_id,0 , + cat->vlan_mask_tunnel);nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_MPLS , cat_hw_id,0 ,-1 );nthw_mod_cat_cfn_set (&ndev->be,HW_CAT_CFN_PTC_TNL_L3 , cat_hw_id,0 , cat->ptc_mask_l3_tunnel);
@@ -2296,6 +2298,7 @@ static int hw_db_inline_cat_compare(const struct hw_db_inline_cat_data *data1, data1->ptc_mask_l3 == data2->ptc_mask_l3 && data1->ptc_mask_l4 == data2->ptc_mask_l4 && data1->ptc_mask_tunnel == data2->ptc_mask_tunnel && + data1->vlan_mask_tunnel == data2->vlan_mask_tunnel && data1->ptc_mask_l2_tunnel == data2->ptc_mask_l2_tunnel && data1->ptc_mask_l3_tunnel == data2->ptc_mask_l3_tunnel && data1->ptc_mask_l4_tunnel == data2->ptc_mask_l4_tunnel &&
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.h +2 -1
@@ -212,12 +212,13 @@ struct hw_db_inline_cat_data { uint32_t ptc_mask_l4 : 5; uint32_t padding0 : 1; + uint32_t vlan_mask_tunnel : 4; uint32_t ptc_mask_tunnel : 11; uint32_t ptc_mask_l3_tunnel : 3; uint32_t ptc_mask_l4_tunnel : 5; uint32_t err_mask_ttl_tunnel : 2; uint32_t err_mask_ttl : 2; - uint32_t padding1 : 9; + uint32_t padding1 : 5;uint8_t ptc_mask_l2_tunnel;uint8_t ip_prot;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +22 -9
@@ -907,6 +907,7 @@ static inline struct nic_flow_def *prepare_nic_flow_def(struct nic_flow_def *fd) fd->l3_prot =-1 ; fd->l4_prot =-1 ; fd->vlans =0 ; + fd->tunnel_vlans =0 ; fd->tunnel_prot =-1 ; fd->tunnel_l2_prot =-1 ; fd->tunnel_l3_prot =-1 ;
@@ -928,7 +929,8 @@ static inline struct nic_flow_def *allocate_nic_flow_def(void)static bool fd_has_empty_pattern (const struct nic_flow_def *fd) { -return fd && fd->vlans ==0 && fd->l2_prot <0 && fd->l3_prot <0 && fd->l4_prot <0 && +return fd && fd->vlans ==0 && fd->tunnel_vlans ==0 && fd->l2_prot <0 && + fd->l3_prot <0 && fd->l4_prot <0 && fd->tunnel_prot <0 && fd->tunnel_l2_prot <0 && fd->tunnel_l3_prot <0 && fd->tunnel_l4_prot <0 && fd->ip_prot <0 && fd->tunnel_ip_prot <0 && fd->non_empty <0 ;
@@ -1920,7 +1922,10 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, (const struct rte_vlan_hdr *)elem[eidx].mask;if (vlan_spec ==NULL || vlan_mask ==NULL ) { - fd->vlans +=1 ; +if (any_count >0 ) + fd->tunnel_vlans +=1 ; +else + fd->vlans +=1 ;break ; }
@@ -1947,9 +1952,13 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, sw_data[0 ] &= sw_mask[0 ];nthw_km_add_match_elem (&fd->km, &sw_data[0 ], &sw_mask[0 ],1 , -DYN_FIRST_VLAN ,2 +4 * fd->vlans); -set_key_def_sw (key_def, sw_counter,DYN_FIRST_VLAN , -2 +4 * fd->vlans); + any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : + fd->vlans)); +set_key_def_sw (key_def, sw_counter, + any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : + fd->vlans)); sw_counter +=1 ; }else if (qw_counter <2 && qw_free >0 ) {
@@ -1973,10 +1982,13 @@ static int interpret_flow_elements(const struct flow_eth_dev *dev, qw_data[2 ] &= qw_mask[2 ]; qw_data[3 ] &= qw_mask[3 ]; -nthw_km_add_match_elem (&fd->km, &qw_data[0 ], &qw_mask[0 ],4 , -DYN_FIRST_VLAN ,2 +4 * fd->vlans); -set_key_def_qw (key_def, qw_counter,DYN_FIRST_VLAN , -2 +4 * fd->vlans); +nthw_km_add_match_elem (&fd->km, &qw_data[0 ], &qw_mask[0 ], +4 , any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : + fd->vlans)); +set_key_def_qw (key_def, qw_counter, + any_count >0 ?DYN_TUN_VLAN :DYN_FIRST_VLAN , +2 +4 * (any_count >0 ? fd->tunnel_vlans : fd->vlans)); qw_counter +=1 ; qw_free -=1 ;
@@ -3699,6 +3711,7 @@ static struct flow_handle *create_flow_filter(struct flow_eth_dev *dev, struct n .ptc_mask_l4 = fd->l4_prot != -1 ? (1 << fd->l4_prot) : -1, .err_mask_ttl = (fd->ttl_sub_enable && fd->ttl_sub_outer) ? -1 : 0x1, + .vlan_mask_tunnel = (0xf << fd->tunnel_vlans) & 0xf, .ptc_mask_tunnel = fd->tunnel_prot != -1 ? (1 << (fd->tunnel_prot > 10 ? 10 : fd->tunnel_prot)) : -1, .ptc_mask_l2_tunnel =
Signature · 1 line
2.45.0
PATCH v2 14/21 net/ntnic: add handling exception path option
In reply to Serhii IliushykEnable exception path for unmatched packets to go through queue 0.
--- doc/guides/nics/ntnic.rst | 9 +++++++++ drivers/net/ntnic/ntnic_ethdev.c | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+)
doc/guides/nics/ntnic.rst +9 -0
@@ -136,6 +136,15 @@ Multiple arguments for the same device are separated by ‘,’ comma. By default, the value is set to 1. +``exception_path`` parameter [int] + + Enable exception path for unmatched packets to go through queue 0. + + To enable exception_path:: + + -a <domain>:<bus>:00.0,exception_path=1 + + By default, the value is set to 0. Logging and Debugging ---------------------
drivers/net/ntnic/ntnic_ethdev.c +21 -0
@@ -73,11 +73,13 @@ uint64_t rte_tsc_freq;#define ETH_DEV_NTNIC_HELP_ARG "help"#define ETH_DEV_NTHW_RXQUEUES_ARG "rxqs"#define ETH_DEV_NTHW_TXQUEUES_ARG "txqs" +#define ETH_DEV_NTHW_EXCEPTION_PATH_ARG "exception_path"static const char *const valid_arguments[] = {ETH_DEV_NTNIC_HELP_ARG ,ETH_DEV_NTHW_RXQUEUES_ARG ,ETH_DEV_NTHW_TXQUEUES_ARG , +ETH_DEV_NTHW_EXCEPTION_PATH_ARG ,NULL , };
@@ -2260,6 +2262,25 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)NT_LOG_DBGX (DBG ,NTNIC ,"devargs: %s=%u" ,ETH_DEV_NTHW_TXQUEUES_ARG , nb_tx_queues); } + + kvargs_count =rte_kvargs_count (kvlist,ETH_DEV_NTHW_EXCEPTION_PATH_ARG ); + +if (kvargs_count !=0 ) { +assert (kvargs_count ==1 ); + res =rte_kvargs_process (kvlist,ETH_DEV_NTHW_EXCEPTION_PATH_ARG , + &nthw_string_to_u32, &exception_path); + +if (res <0 ) { +NT_LOG_DBGX (ERR ,NTNIC , +"problem with command line arguments: res=%d" , res); +return -1 ; + } + +NT_LOG_DBGX (DBG ,NTNIC ,"devargs: %s=%u" , +ETH_DEV_NTHW_EXCEPTION_PATH_ARG , exception_path); + } + +rte_kvargs_free (kvlist); }
Signature · 1 line
2.45.0
PATCH v2 15/21 net/ntnic: add flow query with count action
In reply to Serhii IliushykImplemented the eth_flow_query function to handle flow queries for ntnic driver.
--- doc/guides/nics/features/ntnic.ini | 1 + drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 46 +++++++++++++++++++ 2 files changed, 47 insertions(+)
doc/guides/nics/features/ntnic.ini +1 -0
@@ -35,6 +35,7 @@ vlan = Y [rte_flow actions] age = Y +count = Y drop = Y jump = Y mark = Y
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +46 -0
58 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v2 16/21 net/ntnic: add flow pull
In reply to Serhii IliushykImplemented the eth_flow_pull function to handle
flow pull for ntnic driver.
--- drivers/net/ntnic/nthw/flow_api/flow_api.c | 15 +++++++++ .../flow_api/profile_inline/flm_evt_queue.c | 14 ++++++++ .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_profile_inline.c | 33 +++++++++++++++++++ .../profile_inline/flow_api_profile_inline.h | 3 ++ drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 29 ++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.h | 6 ++++ 7 files changed, 101 insertions(+)
drivers/net/ntnic/nthw/flow_api/flow_api.c +15 -0
@@ -1214,6 +1214,20 @@ static int flow_async_destroy(struct flow_eth_dev *dev, uint32_t queue_id,return profile_inline_ops->nthw_flow_async_destroy_profile_inline (dev, queue_id, op_attr, flow, user_data, error); } + +static int flow_pull (struct flow_eth_dev *dev,uint16_t caller_id,uint32_t queue_id, +struct rte_flow_op_result res[],uint16_t n_res,struct rte_flow_error *error) +{ +const struct profile_inline_ops *profile_inline_ops =nthw_get_profile_inline_ops (); +if (profile_inline_ops ==NULL ) { +NT_LOG (ERR ,FILTER ,"profile_inline module uninitialized" ); +return -1 ; + } + +return profile_inline_ops->nthw_flow_pull_profile_inline (dev, caller_id, + queue_id, res, n_res, error); +} +int nthw_flow_get_flm_stats (struct flow_nic_dev *ndev,uint64_t *data,uint64_t size) {const struct profile_inline_ops *profile_inline_ops =nthw_get_profile_inline_ops ();
@@ -1274,6 +1288,7 @@ static const struct flow_filter_ops ops = { .flow_template_table_destroy = flow_template_table_destroy, .flow_async_create = flow_async_create, .flow_async_destroy = flow_async_destroy, + .flow_pull = flow_pull,/* * Other
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.c +14 -0
@@ -289,3 +289,17 @@ int nthw_flm_inf_queue_get(uint8_t port, bool remote, struct flm_info_event_s *oreturn -ENOENT ; } + +int nthw_flm_sta_queue_get (uint8_t port,bool remote,struct flm_status_event_s *obj) +{ +struct rte_ring **stat_q = remote ? stat_q_remote : stat_q_local; + +if (port >= (remote ?MAX_STAT_RMT_QUEUES :MAX_STAT_LCL_QUEUES )) +return -1 ; + +if (stat_q[port] ==NULL ) +if (flm_evt_queue_create (port, remote ?FLM_STAT_REMOTE :FLM_STAT_LOCAL ) ==NULL ) +return -1 ; + +return rte_ring_sc_dequeue_elem (stat_q[port], obj,FLM_STAT_ELEM_SIZE ); +}
drivers/net/ntnic/nthw/flow_api/profile_inline/flm_evt_queue.h +1 -0
@@ -51,5 +51,6 @@ void nthw_flm_inf_sta_queue_free_all(uint8_t caller);void nthw_flm_inf_queue_put (uint8_t port,bool remote,struct flm_info_event_s *obj);int nthw_flm_inf_queue_get (uint8_t port,bool remote,struct flm_info_event_s *obj);int nthw_flm_sta_queue_put (uint8_t port,bool remote,struct flm_status_event_s *obj); +int nthw_flm_sta_queue_get (uint8_t port,bool remote,struct flm_status_event_s *obj);#endif /* _FLM_EVT_QUEUE_H_ */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.c +33 -0
@@ -5400,6 +5400,38 @@ int nthw_flow_async_destroy_profile_inline(struct flow_eth_dev *dev, uint32_t qureturn 0 ; } +int nthw_flow_pull_profile_inline (struct flow_eth_dev *dev, +uint16_t caller_id, +uint32_t queue_id, +struct rte_flow_op_result res[], +uint16_t n_res, +struct rte_flow_error *error) +{ + (void )dev; + (void )queue_id; + (void )error; +struct flm_status_event_s obj; +struct flow_handle *fh; +int count =0 ; +uint8_t port =0 ; +bool remote_caller =is_remote_caller (caller_id, &port); + +for (int i =0 ; i < n_res; i++) { +if (nthw_flm_sta_queue_get (port, remote_caller, &obj) !=0 ) +break ; + + fh = obj.flow; +if (fh->type !=FLOW_HANDLE_TYPE_FLM || !fh->flm_async) +continue ; + + res[i].status = obj.learn_done ?RTE_FLOW_OP_SUCCESS :RTE_FLOW_OP_ERROR ; + res[i].user_data = fh->user_data; + count++; + } + +return count; +} +static const struct profile_inline_ops ops = {/* * Management
@@ -5438,6 +5470,7 @@ static const struct profile_inline_ops ops = { nthw_flow_template_table_destroy_profile_inline, .nthw_flow_async_create_profile_inline = nthw_flow_async_create_profile_inline, .nthw_flow_async_destroy_profile_inline = nthw_flow_async_destroy_profile_inline, + .nthw_flow_pull_profile_inline = nthw_flow_pull_profile_inline,/* * NT Flow FLM Meter API */
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline.h +3 -0
@@ -123,6 +123,9 @@ int nthw_flow_async_destroy_profile_inline(struct flow_eth_dev *dev, uint32_t qu const struct rte_flow_op_attr *op_attr, struct flow_handle *flow, void *user_data, struct rte_flow_error *error); +int nthw_flow_pull_profile_inline (struct flow_eth_dev *dev,uint16_t caller_id,uint32_t queue_id, +struct rte_flow_op_result res[],uint16_t n_res,struct rte_flow_error *error); +int nthw_flow_info_get_profile_inline (struct flow_eth_dev *dev,uint8_t caller_id,struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info,struct rte_flow_error *error);
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +29 -0
@@ -1173,6 +1173,34 @@ static int eth_flow_async_destroy(struct rte_eth_dev *dev, uint32_t queue_id,return res; } +static int +eth_flow_pull (struct rte_eth_dev *eth_dev, +uint32_t queue_id, +struct rte_flow_op_result op_result[], +uint16_t n_res, +struct rte_flow_error *error) + +{ +const struct flow_filter_ops *flow_filter_ops =nthw_get_flow_filter_ops (); +if (flow_filter_ops ==NULL ) { +NT_LOG (ERR ,FILTER ,"flow_filter module uninitialized" ); +return -1 ; + } + +struct pmd_internals *internals = eth_dev->data->dev_private; + + error->type =RTE_FLOW_ERROR_TYPE_NONE ; + error->message ="none" ; + +/* Main application caller_id is port_id shifted above VDPA ports */ +uint16_t caller_id =get_caller_id (eth_dev->data->port_id); + +int res = flow_filter_ops->flow_pull (internals->flw_dev, caller_id, queue_id, + op_result, n_res, error); + +return res; +} +static int poll_statistics (struct pmd_internals *internals) {int flow;
@@ -1365,6 +1393,7 @@ void nthw_dev_flow_init(void)static struct rte_flow_fp_ops async_dev_flow_ops = { .async_create = eth_flow_async_create, .async_destroy = eth_flow_async_destroy, + .pull = eth_flow_pull, };void nthw_dev_fp_flow_init (void )
drivers/net/ntnic/ntnic_mod_reg.h +6 -0
@@ -397,6 +397,9 @@ struct profile_inline_ops { struct flow_handle *flow, void *user_data, struct rte_flow_error *error); +int (*nthw_flow_pull_profile_inline)(struct flow_eth_dev *dev,uint16_t caller_id, +uint32_t queue_id,struct rte_flow_op_result res[], +uint16_t n_res,struct rte_flow_error *error);/* * Stats */
@@ -560,6 +563,9 @@ struct flow_filter_ops { const struct rte_flow_op_attr *op_attr, struct flow_handle *flow, void *user_data, struct rte_flow_error *error); +int (*flow_pull)(struct flow_eth_dev *dev,uint16_t caller_id,uint32_t queue_id, +struct rte_flow_op_result res[],uint16_t n_res,struct rte_flow_error *error); +int (*flow_info_get)(struct flow_eth_dev *dev,uint8_t caller_id,struct rte_flow_port_info *port_info,struct rte_flow_queue_info *queue_info,struct rte_flow_error *error);
Signature · 1 line
2.45.0
PATCH v2 17/21 net/ntnic: extend flow dump with MBR configuration
In reply to Serhii Iliushykadd dump of MBR init configuration and extend dump of MBR rules
--- .../profile_inline/flow_api_hw_db_inline.c | 36 ++++++++++++-- .../flow_api_profile_inline_config.h | 48 +++++++++++++++++++ 2 files changed, 81 insertions(+), 3 deletions(-)
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_hw_db_inline.c +33 -3
@@ -23,6 +23,13 @@#define HW_DB_FT_TYPE_FLM 0#define HW_DB_FT_TYPE_KM 1 + +/******************************************************************************/ +/* MBR Configuration support */ +/******************************************************************************/ +static int8_t hw_db_pkt_layer_dyn[] =NTNIC_FLOW_MBR_PKT_LAYER_PER_GROUP ; +static int8_t hw_db_pkt_layer_ofs[] =NTNIC_FLOW_MBR_PKT_LAYER_OFFSET_PER_GROUP ; +/******************************************************************************/ /* Handle */ /******************************************************************************/
@@ -533,11 +540,34 @@ void nthw_db_inline_dump(struct flow_nic_dev *ndev, void *db_handle, const struc &db->flm[idxs[i].id2].ft[idxs[i].id1].data;fprintf (file," FLM_FT %" PRIu32"\n" , idxs[i].id1); -if (data->is_group_zero) +if (data->is_group_zero) {fprintf (file," Jump to %d\n" , data->jump); + }else { +uint32_t group_orig =0 ; -else -fprintf (file," Group %d\n" , data->group); +if (nthw_flow_group_translate_get_orig_group (ndev->group_handle, + data->group, + &group_orig) <0 ) { +fprintf (file," Encoded group: %d\n" , data->group); + + }else { +fprintf (file," Group %d, encoded group: %d\n" , + group_orig, data->group); + } + +const int dyn_group_orig = + group_orig >=sizeof (hw_db_pkt_layer_dyn) ? + hw_db_pkt_layer_dyn[0 ] : + hw_db_pkt_layer_dyn[group_orig]; + +const int ofs_group_orig = + group_orig >=sizeof (hw_db_pkt_layer_ofs) ? + hw_db_pkt_layer_ofs[0 ] : + hw_db_pkt_layer_ofs[group_orig]; + +fprintf (file," BYT dyn %d, ofs %d\n" , + dyn_group_orig, ofs_group_orig); + }fprintf (file," ACTION_SET id %d\n" , data->action_set.ids);break ;
drivers/net/ntnic/nthw/flow_api/profile_inline/flow_api_profile_inline_config.h +48 -0
54 lines not on this page · raw message
Signature · 1 line
2.45.0
PATCH v2 18/21 net/ntnic: make flow lock local
In reply to Serhii IliushykFrom: Stephen Hemminger <[email protected]>
The variable flow_lock is only used in one file.
--- drivers/net/ntnic/include/create_elements.h | 2 -- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-)
drivers/net/ntnic/include/create_elements.h +0 -2
@@ -58,6 +58,4 @@ enum nt_rte_flow_item_type { NT_RTE_FLOW_ITEM_TYPE_TUNNEL, }; -extern rte_spinlock_t flow_lock; -#endif /* __CREATE_ELEMENTS_H__ */
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +1 -1
@@ -28,7 +28,7 @@static struct rte_flow nt_flows[MAX_RTE_FLOWS ]; -rte_spinlock_t flow_lock =RTE_SPINLOCK_INITIALIZER ; +static rte_spinlock_t flow_lock =RTE_SPINLOCK_INITIALIZER ;static struct rte_flow nt_flows[MAX_RTE_FLOWS ]; static int nthw_interpret_raw_data(uint8_t *data, uint8_t *preserve, int size,
Signature · 1 line
2.45.0
PATCH v2 19/21 net/ntnic: rename hwlock
In reply to Serhii IliushykAll global variables in driver should use common prefix. Rename hwlock to nthw_lock.
--- drivers/net/ntnic/include/stream_binary_flow_api.h | 2 +- drivers/net/ntnic/ntnic_ethdev.c | 14 +++++++------- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 8 ++++---- 3 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/ntnic/include/stream_binary_flow_api.h +1 -1
@@ -47,7 +47,7 @@#define RAW_ENCAP_DECAP_ELEMS_MAX 16extern uint64_t rte_tsc_freq; -extern rte_spinlock_t hwlock; +extern rte_spinlock_t nthw_lock;/* * Flow eth dev profile determines how the FPGA module resources are
drivers/net/ntnic/ntnic_ethdev.c +7 -7
@@ -95,7 +95,7 @@ static const struct rte_pci_id nthw_pci_id_map[] = {static const struct sg_ops_s *sg_ops; -rte_spinlock_t hwlock =RTE_SPINLOCK_INITIALIZER ; +rte_spinlock_t nthw_lock =RTE_SPINLOCK_INITIALIZER ;/* * Store and get adapter info
@@ -127,9 +127,9 @@ store_pdrv(struct drv_s *p_drv) PCIIDENT_TO_FUNCNR(p_drv->ntdrv.pciident)); } -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock); _g_p_drv[p_drv->adapter_no] = p_drv; -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock); }static void clear_pdrv (struct drv_s *p_drv)
@@ -137,9 +137,9 @@ static void clear_pdrv(struct drv_s *p_drv)if (p_drv->adapter_no >=NUM_ADAPTER_MAX )return ; -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock); _g_p_drv[p_drv->adapter_no] =NULL ; -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock); } static struct drv_s *
@@ -147,7 +147,7 @@ get_pdrv_from_pci(struct rte_pci_addr addr) {int i;struct drv_s *p_drv =NULL ; -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock);for (i =0 ; i <NUM_ADAPTER_MAX ; i++) {if (_g_p_drv[i]) {
@@ -159,7 +159,7 @@ get_pdrv_from_pci(struct rte_pci_addr addr) } } -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);return p_drv; }
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +4 -4
@@ -1215,7 +1215,7 @@ static int poll_statistics(struct pmd_internals *internals)RTE_ASSERT (rte_tsc_freq >0 ); -rte_spinlock_lock (&hwlock); +rte_spinlock_lock (&nthw_lock);uint64_t now_rtc =rte_get_tsc_cycles ();
@@ -1224,7 +1224,7 @@ static int poll_statistics(struct pmd_internals *internals)* if more than a second since last stat read, do a new one */ if ((now_rtc - internals->last_stat_rtc) < rte_tsc_freq) { -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);return 0 ; }
@@ -1270,7 +1270,7 @@ static int poll_statistics(struct pmd_internals *internals)/* Globally only once a second */ if ((now_rtc - last_stat_rtc) < rte_tsc_freq) { -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ; }
@@ -1307,7 +1307,7 @@ static int poll_statistics(struct pmd_internals *internals) } } -rte_spinlock_unlock (&hwlock); +rte_spinlock_unlock (&nthw_lock);rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ;
Signature · 1 line
2.45.0
PATCH v2 20/21 net/ntnic: rename nt log types
In reply to Serhii IliushykAll global variables in driver should use common prefix.
--- drivers/net/ntnic/ntlog/ntlog.h | 16 ++++++++-------- drivers/net/ntnic/ntnic_ethdev.c | 8 ++++---- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/net/ntnic/ntlog/ntlog.h +8 -8
@@ -10,14 +10,14 @@#include <stdint.h> #include <rte_log.h> -extern int nt_log_general; -#define RTE_LOGTYPE_GENERAL nt_log_general -extern int nt_log_nthw; -#define RTE_LOGTYPE_NTHW nt_log_nthw -extern int nt_log_filter; -#define RTE_LOGTYPE_FILTER nt_log_filter -extern int nt_log_ntnic; -#define RTE_LOGTYPE_NTNIC nt_log_ntnic +extern int nthw_logtype_general; +#define RTE_LOGTYPE_GENERAL nthw_logtype_general +extern int nthw_logtype_nthw; +#define RTE_LOGTYPE_NTHW nthw_logtype_nthw +extern int nthw_logtype_filter; +#define RTE_LOGTYPE_FILTER nthw_logtype_filter +extern int nthw_logtype_ntnic; +#define RTE_LOGTYPE_NTNIC nthw_logtype_ntnic#define NT_DRIVER_NAME "ntnic"
drivers/net/ntnic/ntnic_ethdev.c +4 -4
@@ -2751,7 +2751,7 @@ RTE_PMD_REGISTER_PCI(net_ntnic, rte_nthw_pmd);RTE_PMD_REGISTER_PCI_TABLE (net_ntnic, nthw_pci_id_map);RTE_PMD_REGISTER_KMOD_DEP (net_ntnic,"* vfio-pci" ); -RTE_LOG_REGISTER_SUFFIX (nt_log_general, general,INFO ); -RTE_LOG_REGISTER_SUFFIX (nt_log_nthw, nthw,INFO ); -RTE_LOG_REGISTER_SUFFIX (nt_log_filter, filter,INFO ); -RTE_LOG_REGISTER_SUFFIX (nt_log_ntnic, ntnic,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_general, general,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_nthw, nthw,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_filter, filter,INFO ); +RTE_LOG_REGISTER_SUFFIX (nthw_logtype_ntnic, ntnic,INFO );
Signature · 1 line
2.45.0
PATCH v2 21/21 net/ntnic: fix potential name conflict
In reply to Serhii IliushykDrivers should not have global variables that could conflict with EAL. Rename rte_tsc_freq to nthw_tsc_freq.
--- drivers/net/ntnic/include/stream_binary_flow_api.h | 2 +- drivers/net/ntnic/ntnic_ethdev.c | 4 ++-- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/ntnic/include/stream_binary_flow_api.h +1 -1
@@ -46,7 +46,7 @@#define RAW_ENCAP_DECAP_ELEMS_MAX 16 -extern uint64_t rte_tsc_freq; +extern uint64_t nthw_tsc_freq;extern rte_spinlock_t nthw_lock;/*
drivers/net/ntnic/ntnic_ethdev.c +2 -2
@@ -67,7 +67,7 @@#define MTUINITVAL 1500 -uint64_t rte_tsc_freq; +uint64_t nthw_tsc_freq;#define ETH_DEV_NTNIC_HELP_ARG "help"
@@ -2723,7 +2723,7 @@ nthw_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,*/ uint64_t now_rtc =rte_get_tsc_cycles ();nthw_os_wait_usec (10 *1000 ); - rte_tsc_freq =100 * (rte_get_tsc_cycles () - now_rtc); + nthw_tsc_freq =100 * (rte_get_tsc_cycles () - now_rtc);NT_LOG_DBGX (DBG ,NTNIC ,"leave: ret=%d" , ret);return ret;
drivers/net/ntnic/ntnic_filter/ntnic_filter.c +3 -3
@@ -1213,7 +1213,7 @@ static int poll_statistics(struct pmd_internals *internals)if (!p_nt4ga_stat || n_intf_no <0 || n_intf_no >=NUM_ADAPTER_PORTS_MAX )return -1 ; -RTE_ASSERT (rte_tsc_freq >0 ); +RTE_ASSERT (nthw_tsc_freq >0 );rte_spinlock_lock (&nthw_lock);
@@ -1223,7 +1223,7 @@ static int poll_statistics(struct pmd_internals *internals)* Check per port max once a second * if more than a second since last stat read, do a new one */ -if ((now_rtc - internals->last_stat_rtc) < rte_tsc_freq) { +if ((now_rtc - internals->last_stat_rtc) < nthw_tsc_freq) {rte_spinlock_unlock (&nthw_lock);return 0 ; }
@@ -1269,7 +1269,7 @@ static int poll_statistics(struct pmd_internals *internals) }/* Globally only once a second */ -if ((now_rtc - last_stat_rtc) < rte_tsc_freq) { +if ((now_rtc - last_stat_rtc) < nthw_tsc_freq) {rte_spinlock_unlock (&nthw_lock);rte_spinlock_unlock (&p_nt_drv->stat_lck);return 0 ;
Signature · 1 line
2.45.0
Stephen Hemminger
AppliedQuoted 37 lines · On Wed, 1 Oct 2025 17:09:42 +0200 Serhii Iliushyk <[email protected]> wrote:
net/ntnic: add handling exception path option net/ntnic: add flow query with count action net/ntnic: add flow pull
net/ntnic: extend flow dump with MBR configuration net/ntnic: rename hwlock
net/ntnic: rename nt log typesStephen Hemminger (1):
net/ntnic: make flow lock localdoc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 15 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 3 +- drivers/net/ntnic/include/create_elements.h | 2 - drivers/net/ntnic/include/flow_api_engine.h | 2 + .../ntnic/include/stream_binary_flow_api.h | 2 +- drivers/net/ntnic/meson.build | 2 + .../nthw/core/nt400dxx/nthw_fpga_nt400dxx.c | 41 + .../core/nt400dxx/reset/nthw_fpga_rst9569.c | 380 ++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 1 + drivers/net/ntnic/nthw/flow_api/flow_api.c | 15 + .../flow_api/profile_inline/flm_evt_queue.c | 14 + .../flow_api/profile_inline/flm_evt_queue.h | 1 + .../profile_inline/flow_api_hw_db_inline.c | 54 +- .../profile_inline/flow_api_hw_db_inline.h | 4 +- .../profile_inline/flow_api_profile_inline.c | 94 +- .../profile_inline/flow_api_profile_inline.h | 3 + .../flow_api_profile_inline_config.h | 48 + drivers/net/ntnic/nthw/nthw_platform.c | 3 + drivers/net/ntnic/nthw/nthw_platform_drv.h | 2 + .../supported/nthw_fpga_9569_055_049_0000.c | 3132 +++++++++++++++++ .../nthw/supported/nthw_fpga_instances.c | 3 +- .../nthw/supported/nthw_fpga_instances.h | 1 + .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 1 + .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 1 + .../supported/nthw_fpga_reg_defs_rst9569.h | 35 + drivers/net/ntnic/ntlog/ntlog.h | 16 +-
Quoted 8 lines
drivers/net/ntnic/ntnic_ethdev.c | 44 +- drivers/net/ntnic/ntnic_filter/ntnic_filter.c | 85 +- drivers/net/ntnic/ntnic_mod_reg.c | 15 + drivers/net/ntnic/ntnic_mod_reg.h | 17 + 31 files changed, 3976 insertions(+), 61 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/nt400dxx/reset/nthw_fpga_rst9569.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9569_055_049_0000.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9569.h
Queued this version to next-net