net/ntnic: Add registers for NapaTech SmartNiC
Subsystems (2)
PATCH v10 8/21 net/ntnic: add adapter initialization
In reply to Serhii IliushykAdd interfaces for initialize the adapter
Add proper PCI device deinitialization
---
v6
* Function for global var clearing was removed
v9
* Fix PCI devide deinitialization
* Fix p_hw_info usage
v10
* Use 8 spaces as indentation in meson
--- drivers/net/ntnic/adapter/nt4ga_adapter.c | 145 ++++++++++++++++++++++ drivers/net/ntnic/include/nt4ga_adapter.h | 40 ++++++ drivers/net/ntnic/include/ntdrv_4ga.h | 2 + drivers/net/ntnic/meson.build | 2 + drivers/net/ntnic/ntnic_ethdev.c | 85 ++++++++++++- drivers/net/ntnic/ntnic_mod_reg.c | 20 +++ drivers/net/ntnic/ntnic_mod_reg.h | 27 ++++ 7 files changed, 320 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/adapter/nt4ga_adapter.c create mode 100644 drivers/net/ntnic/include/nt4ga_adapter.h create mode 100644 drivers/net/ntnic/ntnic_mod_reg.c create mode 100644 drivers/net/ntnic/ntnic_mod_reg.h
drivers/net/ntnic/adapter/nt4ga_adapter.c new file +145 -0
@@ -0,0 +1,145 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#include <rte_thread.h> + +#include "ntlog.h" +#include "nt_util.h" +#include "ntnic_mod_reg.h" + +static int nt4ga_adapter_show_info (struct adapter_info_s *p_adapter_info,FILE *pfh) +{ +const char *const p_dev_name = p_adapter_info->p_dev_name; +const char *const p_adapter_id_str = p_adapter_info->mp_adapter_id_str; +fpga_info_t *p_fpga_info = &p_adapter_info->fpga_info; +hw_info_t *p_hw_info = &p_adapter_info->hw_info; +char a_pci_ident_str[32 ]; + +snprintf (a_pci_ident_str,sizeof (a_pci_ident_str),PCIIDENT_PRINT_STR , +PCIIDENT_TO_DOMAIN (p_fpga_info->pciident), +PCIIDENT_TO_BUSNR (p_fpga_info->pciident), +PCIIDENT_TO_DEVNR (p_fpga_info->pciident), +PCIIDENT_TO_FUNCNR (p_fpga_info->pciident)); + +fprintf (pfh,"%s: DeviceName: %s\n" , p_adapter_id_str, (p_dev_name ? p_dev_name :"NA" )); +fprintf (pfh,"%s: PCI Details:\n" , p_adapter_id_str); +fprintf (pfh,"%s: %s: %08X: %04X:%04X %04X:%04X\n" , p_adapter_id_str, a_pci_ident_str, + p_fpga_info->pciident, p_hw_info->pci_vendor_id, p_hw_info->pci_device_id, + p_hw_info->pci_sub_vendor_id, p_hw_info->pci_sub_device_id); +fprintf (pfh,"%s: FPGA Details:\n" , p_adapter_id_str); +fprintf (pfh,"%s: %03d-%04d-%02d-%02d [%016" PRIX64 "] (%08X)\n" , p_adapter_id_str, + p_fpga_info->n_fpga_type_id, p_fpga_info->n_fpga_prod_id, + p_fpga_info->n_fpga_ver_id, p_fpga_info->n_fpga_rev_id, p_fpga_info->n_fpga_ident, + p_fpga_info->n_fpga_build_time); +fprintf (pfh,"%s: FpgaDebugMode=0x%x\n" , p_adapter_id_str, p_fpga_info->n_fpga_debug_mode); +fprintf (pfh,"%s: Hw=0x%02X_rev%d: %s\n" , p_adapter_id_str, p_hw_info->hw_platform_id, + p_fpga_info->nthw_hw_info.hw_id, p_fpga_info->nthw_hw_info.hw_plat_id_str); +fprintf (pfh,"%s: MCU Details:\n" , p_adapter_id_str); + +return 0 ; +} + +static int nt4ga_adapter_init (struct adapter_info_s *p_adapter_info) +{ +char *const p_dev_name =malloc (24 ); +char *const p_adapter_id_str =malloc (24 ); +fpga_info_t *fpga_info = &p_adapter_info->fpga_info; +hw_info_t *p_hw_info = &p_adapter_info->hw_info; + + + p_hw_info->n_nthw_adapter_id =nthw_platform_get_nthw_adapter_id (p_hw_info->pci_device_id); + + fpga_info->n_nthw_adapter_id = p_hw_info->n_nthw_adapter_id; +/* ref: DN-0060 section 9 */ + p_hw_info->hw_product_type = p_hw_info->pci_device_id &0x000f ; +/* ref: DN-0060 section 9 */ + p_hw_info->hw_platform_id = (p_hw_info->pci_device_id >>4 ) &0x00ff ; +/* ref: DN-0060 section 9 */ + p_hw_info->hw_reserved1 = (p_hw_info->pci_device_id >>12 ) &0x000f ; + + p_adapter_info->p_dev_name = p_dev_name; + +if (p_dev_name) { +snprintf (p_dev_name,24 ,PCIIDENT_PRINT_STR , +PCIIDENT_TO_DOMAIN (p_adapter_info->fpga_info.pciident), +PCIIDENT_TO_BUSNR (p_adapter_info->fpga_info.pciident), +PCIIDENT_TO_DEVNR (p_adapter_info->fpga_info.pciident), +PCIIDENT_TO_FUNCNR (p_adapter_info->fpga_info.pciident)); +NT_LOG (DBG ,NTNIC ,"%s: (0x%08X)\n" , p_dev_name, + p_adapter_info->fpga_info.pciident); + } + + p_adapter_info->mp_adapter_id_str = p_adapter_id_str; + + p_adapter_info->fpga_info.mp_adapter_id_str = p_adapter_id_str; + +if (p_adapter_id_str) { +snprintf (p_adapter_id_str,24 ,"PCI:" PCIIDENT_PRINT_STR , +PCIIDENT_TO_DOMAIN (p_adapter_info->fpga_info.pciident), +PCIIDENT_TO_BUSNR (p_adapter_info->fpga_info.pciident), +PCIIDENT_TO_DEVNR (p_adapter_info->fpga_info.pciident), +PCIIDENT_TO_FUNCNR (p_adapter_info->fpga_info.pciident)); +NT_LOG (DBG ,NTNIC ,"%s: %s\n" , p_adapter_id_str, p_dev_name); + } + + { +int i; + +for (i =0 ; i < (int )ARRAY_SIZE (p_adapter_info->mp_port_id_str); i++) { +char *p =malloc (32 ); + +if (p) { +snprintf (p,32 ,"%s:intf_%d" , + (p_adapter_id_str ? p_adapter_id_str :"NA" ), i); + } + + p_adapter_info->mp_port_id_str[i] = p; + } + } + +return 0 ; +} + +static int nt4ga_adapter_deinit (struct adapter_info_s *p_adapter_info) +{ +fpga_info_t *fpga_info = &p_adapter_info->fpga_info; +int i; +int res =-1 ; + + +/* Free adapter port ident strings */ +for (i =0 ; i < fpga_info->n_phy_ports; i++) { +if (p_adapter_info->mp_port_id_str[i]) { +free (p_adapter_info->mp_port_id_str[i]); + p_adapter_info->mp_port_id_str[i] =NULL ; + } + } + +/* Free adapter ident string */ +if (p_adapter_info->mp_adapter_id_str) { +free (p_adapter_info->mp_adapter_id_str); + p_adapter_info->mp_adapter_id_str =NULL ; + } + +/* Free devname ident string */ +if (p_adapter_info->p_dev_name) { +free (p_adapter_info->p_dev_name); + p_adapter_info->p_dev_name =NULL ; + } + +return res; +} + +static const struct adapter_ops ops = { + .init = nt4ga_adapter_init, + .deinit = nt4ga_adapter_deinit, + + .show_info = nt4ga_adapter_show_info, +}; + +void adapter_init (void ) +{ +register_adapter_ops (&ops); +}
drivers/net/ntnic/include/nt4ga_adapter.h new file +40 -0
@@ -0,0 +1,40 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef _NT4GA_ADAPTER_H_ +#define _NT4GA_ADAPTER_H_ + +#include "ntos_drv.h" +typedef struct hw_info_s { +/* pciids */ +uint16_t pci_vendor_id; +uint16_t pci_device_id; +uint16_t pci_sub_vendor_id; +uint16_t pci_sub_device_id; +uint16_t pci_class_id; + +/* Derived from pciid */ +nthw_adapter_id_t n_nthw_adapter_id; +int hw_platform_id; +int hw_product_type; +int hw_reserved1; +}hw_info_t ; + +typedef struct adapter_info_s { +struct hw_info_s hw_info; +struct fpga_info_s fpga_info; + +char *mp_port_id_str[NUM_ADAPTER_PORTS_MAX ]; +char *mp_adapter_id_str; +char *p_dev_name; +volatile bool *pb_shutdown; + +int adapter_no; +int n_rx_host_buffers; +int n_tx_host_buffers; +}adapter_info_t ; + + +#endif /* _NT4GA_ADAPTER_H_ */
drivers/net/ntnic/include/ntdrv_4ga.h +2 -0
@@ -6,9 +6,11 @@ #ifndef __NTDRV_4GA_H__ #define __NTDRV_4GA_H__ +#include "nt4ga_adapter.h" typedef struct ntdrv_4ga_s { uint32_t pciident; + struct adapter_info_s adapter_info; char *p_drv_name; volatile bool b_shutdown;
drivers/net/ntnic/meson.build +2 -0
@@ -18,9 +18,11 @@ includes = [ # all sources sources = files( + 'adapter/nt4ga_adapter.c', 'nthw/nthw_platform.c', 'ntlog/ntlog.c', 'ntutil/nt_util.c', + 'ntnic_mod_reg.c', 'ntnic_vfio.c', 'ntnic_ethdev.c', )
drivers/net/ntnic/ntnic_ethdev.c +84 -1
134 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c new file +20 -0
@@ -0,0 +1,20 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#include "ntnic_mod_reg.h" + +static const struct adapter_ops *adapter_ops; + +void register_adapter_ops (const struct adapter_ops *ops) +{ + adapter_ops = ops; +} + +const struct adapter_ops *get_adapter_ops (void ) +{ +if (adapter_ops ==NULL ) +adapter_init (); +return adapter_ops; +}
drivers/net/ntnic/ntnic_mod_reg.h new file +27 -0
@@ -0,0 +1,27 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef __NTNIC_MOD_REG_H__ +#define __NTNIC_MOD_REG_H__ + +#include <stdint.h> +#include "nthw_platform_drv.h" +#include "nthw_drv.h" +#include "nt4ga_adapter.h" +#include "ntos_drv.h" + +struct adapter_ops { +int (*init)(struct adapter_info_s *p_adapter_info); +int (*deinit)(struct adapter_info_s *p_adapter_info); + +int (*show_info)(struct adapter_info_s *p_adapter_info,FILE *pfh); +}; + +void register_adapter_ops (const struct adapter_ops *ops); +const struct adapter_ops *get_adapter_ops (void ); +void adapter_init (void ); + + +#endif /* __NTNIC_MOD_REG_H__ */
Signature · 1 line
2.43.0
PATCH v10 9/21 net/ntnic: add registers and FPGA model
In reply to Serhii IliushykThe NTNIC PMD does not rely on a kernel space Napatech driver, thus all defines related to the register layout is part of the PMD code, which will be added in later commits.
---
v6
* Remove unnecessary comments
* Remove EOF markers and Auto-gen comments
v10
* Remove "for NapaTech NIC" from the commit message title
* Use 8 spaces as indentation in meson
--- drivers/net/ntnic/include/fpga_model.h | 102 ++ drivers/net/ntnic/meson.build | 4 + .../net/ntnic/nthw/model/nthw_fpga_model.c | 1192 ++++++++++++++++ .../net/ntnic/nthw/model/nthw_fpga_model.h | 245 ++++ drivers/net/ntnic/nthw/nthw_register.h | 21 + .../supported/nthw_fpga_9563_055_039_0000.c | 1225 +++++++++++++++++ .../nthw/supported/nthw_fpga_instances.c | 4 + .../nthw/supported/nthw_fpga_instances.h | 5 + .../ntnic/nthw/supported/nthw_fpga_mod_defs.h | 28 + .../nthw/supported/nthw_fpga_mod_str_map.c | 19 + .../nthw/supported/nthw_fpga_mod_str_map.h | 9 + .../nthw/supported/nthw_fpga_param_defs.h | 224 +++ .../ntnic/nthw/supported/nthw_fpga_reg_defs.h | 27 + .../nthw/supported/nthw_fpga_reg_defs_gfg.h | 118 ++ .../nthw/supported/nthw_fpga_reg_defs_gmf.h | 60 + .../supported/nthw_fpga_reg_defs_gpio_phy.h | 40 + .../nthw/supported/nthw_fpga_reg_defs_hif.h | 71 + .../nthw/supported/nthw_fpga_reg_defs_i2cm.h | 30 + .../nthw/supported/nthw_fpga_reg_defs_iic.h | 88 ++ .../supported/nthw_fpga_reg_defs_mac_pcs.h | 290 ++++ .../supported/nthw_fpga_reg_defs_pci_rd_tg.h | 29 + .../supported/nthw_fpga_reg_defs_pci_wr_tg.h | 32 + .../nthw/supported/nthw_fpga_reg_defs_pcie3.h | 273 ++++ .../nthw/supported/nthw_fpga_reg_defs_rac.h | 64 + .../supported/nthw_fpga_reg_defs_rst9563.h | 51 + .../nthw/supported/nthw_fpga_reg_defs_sdc.h | 36 + drivers/net/ntnic/ntnic_ethdev.c | 1 + 27 files changed, 4288 insertions(+) create mode 100644 drivers/net/ntnic/include/fpga_model.h create mode 100644 drivers/net/ntnic/nthw/model/nthw_fpga_model.c create mode 100644 drivers/net/ntnic/nthw/model/nthw_fpga_model.h create mode 100644 drivers/net/ntnic/nthw/nthw_register.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_param_defs.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gfg.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gmf.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_phy.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hif.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_i2cm.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_iic.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_pcs.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_rd_tg.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_wr_tg.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcie3.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rac.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9563.h create mode 100644 drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sdc.h
drivers/net/ntnic/include/fpga_model.h new file +102 -0
@@ -0,0 +1,102 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef _FPGA_MODEL_H_ +#define _FPGA_MODEL_H_ + +#include <unistd.h> +#include <stdint.h> +#include <inttypes.h> + +typedef uint32_t nthw_id_t ; + +enum nthw_fpga_bus_type { +NTHW_FPGA_BUS_TYPE_UNKNOWN = +0 ,/* Unknown/uninitialized - keep this as the first enum element */ +NTHW_FPGA_BUS_TYPE_BAR , +NTHW_FPGA_BUS_TYPE_PCI , +NTHW_FPGA_BUS_TYPE_CCIP , +NTHW_FPGA_BUS_TYPE_RAB0 , +NTHW_FPGA_BUS_TYPE_RAB1 , +NTHW_FPGA_BUS_TYPE_RAB2 , +NTHW_FPGA_BUS_TYPE_NMB , +NTHW_FPGA_BUS_TYPE_NDM , +NTHW_FPGA_BUS_TYPE_SPI0 , +NTHW_FPGA_BUS_TYPE_SPI =NTHW_FPGA_BUS_TYPE_SPI0 , +}; + +typedef enum nthw_fpga_bus_type nthw_fpga_bus_type_e ; + +enum nthw_fpga_register_type { +NTHW_FPGA_REG_TYPE_UNKNOWN = +0 ,/* Unknown/uninitialized - keep this as the first enum element */ +NTHW_FPGA_REG_TYPE_RW , +NTHW_FPGA_REG_TYPE_RO , +NTHW_FPGA_REG_TYPE_WO , +NTHW_FPGA_REG_TYPE_RC1 , +NTHW_FPGA_REG_TYPE_MIXED , +}; + +typedef enum nthw_fpga_register_type nthw_fpga_register_type_e ; + +struct nthw_fpga_field_init { +nthw_id_t id; +uint16_t bw; +uint16_t low; +uint64_t reset_val; +}; + +typedef struct nthw_fpga_field_init nthw_fpga_field_init_s ; + +struct nthw_fpga_register_init { +nthw_id_t id; +uint32_t addr_rel; +uint16_t bw; +nthw_fpga_register_type_e type; +uint64_t reset_val; +int nb_fields; +struct nthw_fpga_field_init *fields; +}; + +typedef struct nthw_fpga_register_init nthw_fpga_register_init_s ; + +struct nthw_fpga_module_init { +nthw_id_t id; +int instance; +nthw_id_t def_id; +int major_version; +int minor_version; +nthw_fpga_bus_type_e bus_id; +uint32_t addr_base; +int nb_registers; +struct nthw_fpga_register_init *registers; +}; + +typedef struct nthw_fpga_module_init nthw_fpga_module_init_s ; + +struct nthw_fpga_prod_param { +const nthw_id_t id; +const int value; +}; + +typedef struct nthw_fpga_prod_param nthw_fpga_prod_param_s ; + +struct nthw_fpga_prod_init { +int fpga_item_id; +int fpga_product_id; +int fpga_version; +int fpga_revision; +int fpga_patch_no; +int fpga_build_no; +uint32_t fpga_build_time; +int nb_prod_params; +struct nthw_fpga_prod_param *product_params; +int nb_modules; +struct nthw_fpga_module_init *modules; +}; + +typedef struct nthw_fpga_prod_init nthw_fpga_prod_init_s ; + +#endif /* _FPGA_MODEL_H_ */
drivers/net/ntnic/meson.build +4 -0
@@ -14,11 +14,15 @@ includes = [ include_directories('ntlog'), include_directories('ntutil'), include_directories('nthw'), + include_directories('nthw/supported'), ] # all sources sources = files( 'adapter/nt4ga_adapter.c', + 'nthw/supported/nthw_fpga_9563_055_039_0000.c', + 'nthw/supported/nthw_fpga_instances.c', + 'nthw/supported/nthw_fpga_mod_str_map.c', 'nthw/nthw_platform.c', 'ntlog/ntlog.c', 'ntutil/nt_util.c',
drivers/net/ntnic/nthw/model/nthw_fpga_model.c new file +1192 -0
1,192 lines not on this page · raw message
drivers/net/ntnic/nthw/model/nthw_fpga_model.h new file +245 -0
245 lines not on this page · raw message
drivers/net/ntnic/nthw/nthw_register.h new file +21 -0
@@ -0,0 +1,21 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef NTHW_REGISTER_H_ +#define NTHW_REGISTER_H_ + +#include <unistd.h> +#include <stdint.h> +#include <stdbool.h> +#include <inttypes.h> + + +#include "fpga_model.h" + +#include "nthw_fpga_mod_defs.h" +#include "nthw_fpga_param_defs.h" +#include "nthw_fpga_reg_defs.h" + +#endif /* NTHW_REGISTER_H_ */
drivers/net/ntnic/nthw/supported/nthw_fpga_9563_055_039_0000.c new file +1225 -0
1,225 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_instances.c new file +4 -0
@@ -0,0 +1,4 @@ + + +#include "nthw_fpga_instances.h" +nthw_fpga_prod_init_s *nthw_fpga_instances[] = { &nthw_fpga_9563_055_039_0000,NULL };
drivers/net/ntnic/nthw/supported/nthw_fpga_instances.h new file +5 -0
@@ -0,0 +1,5 @@ + + +#include "fpga_model.h" +extern nthw_fpga_prod_init_s *nthw_fpga_instances[]; +extern nthw_fpga_prod_init_s nthw_fpga_9563_055_039_0000;
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_defs.h new file +28 -0
@@ -0,0 +1,28 @@ +/* +* nthw_fpga_mod_defs.h +* +* Auto-generated file - do *NOT* edit +* +*/ + +#ifndef _NTHW_FPGA_MOD_DEFS_H_ +#define _NTHW_FPGA_MOD_DEFS_H_ + +#define MOD_UNKNOWN (0L)/* Unknown/uninitialized - keep this as the first element */ +#define MOD_GFG (0xfc423807UL) +#define MOD_GMF (0x68b1d15aUL) +#define MOD_GPIO_PHY (0xbbe81659UL) +#define MOD_HIF (0x7815363UL) +#define MOD_I2CM (0x93bc7780UL) +#define MOD_IIC (0x7629cddbUL) +#define MOD_MAC_PCS (0x7abe24c7UL) +#define MOD_PCIE3 (0xfbc48c18UL) +#define MOD_PCI_RD_TG (0x9ad9eed2UL) +#define MOD_PCI_WR_TG (0x274b69e1UL) +#define MOD_RAC (0xae830b42UL) +#define MOD_RST9563 (0x385d6d1dUL) +#define MOD_SDC (0xd2369530UL) +#define MOD_IDX_COUNT (14) + +/* aliases - only aliases go below this point */ +#endif /* _NTHW_FPGA_MOD_DEFS_H_ */
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.c new file +19 -0
@@ -0,0 +1,19 @@ + + +#include "nthw_fpga_mod_str_map.h" +const struct nthw_fpga_mod_str_s sa_nthw_fpga_mod_str_map[] = { + {MOD_GFG ,"GFG" }, + {MOD_GMF ,"GMF" }, + {MOD_GPIO_PHY ,"GPIO_PHY" }, + {MOD_HIF ,"HIF" }, + {MOD_I2CM ,"I2CM" }, + {MOD_IIC ,"IIC" }, + {MOD_MAC_PCS ,"MAC_PCS" }, + {MOD_PCIE3 ,"PCIE3" }, + {MOD_PCI_RD_TG ,"PCI_RD_TG" }, + {MOD_PCI_WR_TG ,"PCI_WR_TG" }, + {MOD_RAC ,"RAC" }, + {MOD_RST9563 ,"RST9563" }, + {MOD_SDC ,"SDC" }, + {0UL ,NULL } +};
drivers/net/ntnic/nthw/supported/nthw_fpga_mod_str_map.h new file +9 -0
@@ -0,0 +1,9 @@ + + +#include "nthw_fpga_mod_defs.h" +#include "fpga_model.h" +struct nthw_fpga_mod_str_s { +const nthw_id_t a; +const char *b; +}; +extern const struct nthw_fpga_mod_str_s sa_nthw_fpga_mod_str_map[];
drivers/net/ntnic/nthw/supported/nthw_fpga_param_defs.h new file +224 -0
135 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs.h new file +27 -0
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gfg.h new file +118 -0
118 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gmf.h new file +60 -0
60 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_gpio_phy.h new file +40 -0
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_hif.h new file +71 -0
71 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_i2cm.h new file +30 -0
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_iic.h new file +88 -0
88 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_mac_pcs.h new file +290 -0
290 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_rd_tg.h new file +29 -0
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pci_wr_tg.h new file +32 -0
Lines of this file are not shown. View the raw message.
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_pcie3.h new file +273 -0
273 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rac.h new file +64 -0
64 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_rst9563.h new file +51 -0
51 lines not on this page · raw message
drivers/net/ntnic/nthw/supported/nthw_fpga_reg_defs_sdc.h new file +36 -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.43.0
Part of the diff is not shown here. View the raw message.
PATCH v10 10/21 net/ntnic: add FPGA modules for initialization
In reply to Serhii IliushykNew ntnic FPGA modules:
- Host Interface (HIF): Basic FPGA info such as prod ID and build time.
- Inter-Integrated Circuit Controller (IIC): Use the FPGA to access the other integrated circuits on the ntnic.
- PCI Express Gen3 (PCIE3): The FPGA part of PCIe3 initialization, speed tests, and configuration.
---
v6
* Remove unnecessary comments
v10
* Use 8 spaces as indentation in meson
DVO: Remove unnecessary comments
--- drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_core.h | 16 + .../net/ntnic/nthw/core/include/nthw_hif.h | 151 ++++ .../net/ntnic/nthw/core/include/nthw_iic.h | 100 +++ .../net/ntnic/nthw/core/include/nthw_pcie3.h | 96 +++ drivers/net/ntnic/nthw/core/nthw_hif.c | 312 +++++++ drivers/net/ntnic/nthw/core/nthw_iic.c | 527 ++++++++++++ drivers/net/ntnic/nthw/core/nthw_pcie3.c | 259 ++++++ drivers/net/ntnic/nthw/nthw_drv.h | 3 +- drivers/net/ntnic/nthw/nthw_rac.c | 784 ++++++++++++++++++ drivers/net/ntnic/nthw/nthw_rac.h | 153 ++++ 11 files changed, 2400 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_core.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_hif.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_iic.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_pcie3.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_hif.c create mode 100644 drivers/net/ntnic/nthw/core/nthw_iic.c create mode 100644 drivers/net/ntnic/nthw/core/nthw_pcie3.c create mode 100644 drivers/net/ntnic/nthw/nthw_rac.c create mode 100644 drivers/net/ntnic/nthw/nthw_rac.h
drivers/net/ntnic/meson.build +1 -0
@@ -13,6 +13,7 @@ includes = [ include_directories('include'), include_directories('ntlog'), include_directories('ntutil'), + include_directories('nthw/core/include'), include_directories('nthw'), include_directories('nthw/supported'), ]
drivers/net/ntnic/nthw/core/include/nthw_core.h new file +16 -0
@@ -0,0 +1,16 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef __NTHW_CORE_H__ +#define __NTHW_CORE_H__ + +#include <stdlib.h> +#include <string.h> +#include <stdint.h> + +#include "nthw_platform_drv.h" + + +#endif /* __NTHW_CORE_H__ */
drivers/net/ntnic/nthw/core/include/nthw_hif.h new file +151 -0
151 lines not on this page · raw message
drivers/net/ntnic/nthw/core/include/nthw_iic.h new file +100 -0
100 lines not on this page · raw message
drivers/net/ntnic/nthw/core/include/nthw_pcie3.h new file +96 -0
96 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_hif.c new file +312 -0
312 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_iic.c new file +527 -0
527 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_pcie3.c new file +259 -0
259 lines not on this page · raw message
drivers/net/ntnic/nthw/nthw_drv.h +1 -2
@@ -6,8 +6,7 @@ #ifndef __NTHW_DRV_H__ #define __NTHW_DRV_H__ -#include <stddef.h> -#include "nthw_platform_drv.h" +#include "nthw_core.h" typedef enum nt_meta_port_type_e { PORT_TYPE_PHYSICAL,
drivers/net/ntnic/nthw/nthw_rac.c new file +784 -0
784 lines not on this page · raw message
drivers/net/ntnic/nthw/nthw_rac.h new file +153 -0
153 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v10 11/21 net/ntnic: add FPGA initialization functionality
In reply to Serhii IliushykEnable FPGA initialization and adds ethdev fw_version_get.
---
v5
* Fix Typo/Spelling
v7
* Add FW update feature to documentation - INI and RST files v10
* Use 8 spaces as indentation in meson
--- doc/guides/nics/features/ntnic.ini | 1 + doc/guides/nics/ntnic.rst | 5 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 49 +++- drivers/net/ntnic/meson.build | 7 + .../net/ntnic/nthw/core/include/nthw_core.h | 4 + .../net/ntnic/nthw/core/include/nthw_fpga.h | 22 ++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 222 ++++++++++++++++++ drivers/net/ntnic/nthw/nthw_drv.h | 1 + drivers/net/ntnic/nthw/nthw_register.h | 1 + drivers/net/ntnic/ntnic_ethdev.c | 41 +++- drivers/net/ntnic/ntnic_mod_reg.h | 1 + 11 files changed, 352 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_fpga.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_fpga.c
doc/guides/nics/features/ntnic.ini +1 -0
@@ -4,5 +4,6 @@ ; Refer to default.ini for the full list of available PMD features. ; [Features] +FW version = Y Linux = Y x86-64 = Y
doc/guides/nics/ntnic.rst +5 -0
@@ -29,6 +29,11 @@ Supported NICs All information about NT200A02 can be found by link below: https://www.napatech.com/products/nt200a02-smartnic-inline/ +Features +-------- + +- FW version + Limitations ~~~~~~~~~~~
drivers/net/ntnic/adapter/nt4ga_adapter.c +48 -1
85 lines not on this page · raw message
drivers/net/ntnic/meson.build +7 -0
@@ -16,6 +16,7 @@ includes = [ include_directories('nthw/core/include'), include_directories('nthw'), include_directories('nthw/supported'), + include_directories('nthw/model'), ] # all sources
@@ -24,7 +25,13 @@ sources = files( 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c', + 'nthw/core/nthw_fpga.c', + 'nthw/core/nthw_hif.c', + 'nthw/core/nthw_iic.c', + 'nthw/core/nthw_pcie3.c', + 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', + 'nthw/nthw_rac.c', 'ntlog/ntlog.c', 'ntutil/nt_util.c', 'ntnic_mod_reg.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +4 -0
@@ -11,6 +11,10 @@#include <stdint.h> #include "nthw_platform_drv.h" +#include "nthw_fpga_model.h" +#include "nthw_hif.h" +#include "nthw_pcie3.h" +#include "nthw_iic.h" #endif /* __NTHW_CORE_H__ */
drivers/net/ntnic/nthw/core/include/nthw_fpga.h new file +22 -0
@@ -0,0 +1,22 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef __NTHW_FPGA_H__ +#define __NTHW_FPGA_H__ + +#include "nthw_drv.h" + +#include "nthw_fpga_model.h" + +#include "nthw_rac.h" +#include "nthw_iic.h" + +int nthw_fpga_init (struct fpga_info_s *p_fpga_info); +int nthw_fpga_shutdown (struct fpga_info_s *p_fpga_info); + +int nthw_fpga_get_param_info (struct fpga_info_s *p_fpga_info,nthw_fpga_t *p_fpga); + + +#endif /* __NTHW_FPGA_H__ */
drivers/net/ntnic/nthw/core/nthw_fpga.c new file +222 -0
222 lines not on this page · raw message
drivers/net/ntnic/nthw/nthw_drv.h +1 -0
@@ -22,6 +22,7 @@ enum fpga_info_profile { };typedef struct mcu_info_s { +bool mb_has_mcu;int mn_mcu_type;int mn_mcu_dram_size; }mcu_info_t ;
drivers/net/ntnic/nthw/nthw_register.h +1 -0
@@ -11,6 +11,7 @@#include <stdbool.h> #include <inttypes.h> +#include "nthw_fpga_model.h" #include "fpga_model.h"
drivers/net/ntnic/ntnic_ethdev.c +40 -1
83 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.h +1 -0
@@ -7,6 +7,7 @@#define __NTNIC_MOD_REG_H__#include <stdint.h> +#include "nthw_fpga_model.h" #include "nthw_platform_drv.h" #include "nthw_drv.h" #include "nt4ga_adapter.h"
Signature · 1 line
2.43.0
PATCH v10 12/21 net/ntnic: add support of the NT200A0X smartNIC
In reply to Serhii IliushykAdd ntnic support for NT200A0X NIC
---
v10
* Use 8 spaces as indentation in meson
--- drivers/net/ntnic/adapter/nt4ga_adapter.c | 6 +++ drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_fpga.h | 7 +++ .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.c | 54 +++++++++++++++++++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 31 +++++++++++ drivers/net/ntnic/nthw/nthw_platform.c | 3 ++ drivers/net/ntnic/nthw/nthw_platform_drv.h | 2 + drivers/net/ntnic/ntnic_ethdev.c | 3 ++ 8 files changed, 107 insertions(+) create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c
drivers/net/ntnic/adapter/nt4ga_adapter.c +6 -0
@@ -127,6 +127,12 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)assert (fpga_info->n_fpga_prod_id >0 );switch (fpga_info->n_fpga_prod_id) { +/* NT200A01: 2x100G (Xilinx) */ +case 9563 :/* NT200A02 (Cap) */ +NT_LOG (ERR ,NTNIC ,"NT200A02 100G link module uninitialized\n" ); + res =-1 ; +break ; +default :NT_LOG (ERR ,NTNIC ,"Unsupported FPGA product: %04d\n" , fpga_info->n_fpga_prod_id);
drivers/net/ntnic/meson.build +1 -0
@@ -25,6 +25,7 @@ sources = files( 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c', + 'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c', 'nthw/core/nthw_fpga.c', 'nthw/core/nthw_hif.c', 'nthw/core/nthw_iic.c',
drivers/net/ntnic/nthw/core/include/nthw_fpga.h +7 -0
@@ -18,5 +18,12 @@ int nthw_fpga_shutdown(struct fpga_info_s *p_fpga_info);int nthw_fpga_get_param_info (struct fpga_info_s *p_fpga_info,nthw_fpga_t *p_fpga); +struct nt200a0x_ops { +int (*nthw_fpga_nt200a0x_init)(struct fpga_info_s *p_fpga_info); +}; + +void register_nt200a0x_ops (struct nt200a0x_ops *ops); +struct nt200a0x_ops *get_nt200a0x_ops (void ); +void nt200a0x_ops_init (void );#endif /* __NTHW_FPGA_H__ */
drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c new file +54 -0
54 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_fpga.c +31 -0
@@ -152,7 +152,18 @@ int nthw_fpga_init(struct fpga_info_s *p_fpga_info)nthw_rac_rab_flush (p_nthw_rac); p_fpga_info->mp_nthw_rac = p_nthw_rac; +bool included = true; +struct nt200a0x_ops *nt200a0x_ops =get_nt200a0x_ops (); +switch (p_fpga_info->n_nthw_adapter_id) { +case NT_HW_ADAPTER_ID_NT200A02 : +if (nt200a0x_ops !=NULL ) + res = nt200a0x_ops->nthw_fpga_nt200a0x_init (p_fpga_info); + +else + included = false; + +break ;default :NT_LOG (ERR ,NTHW ,"%s: Unsupported HW product id: %d\n" , p_adapter_id_str, p_fpga_info->n_nthw_adapter_id);
@@ -160,6 +171,12 @@ int nthw_fpga_init(struct fpga_info_s *p_fpga_info)break ; } +if (!included) { +NT_LOG (ERR ,NTHW ,"%s: NOT INCLUDED HW product: %d\n" , p_adapter_id_str, + p_fpga_info->n_nthw_adapter_id); + res =-1 ; + } +if (res) {NT_LOG (ERR ,NTHW ,"%s: status: 0x%08X\n" , p_adapter_id_str, res);return res;
@@ -220,3 +237,17 @@ int nthw_fpga_shutdown(struct fpga_info_s *p_fpga_info)return res; } + +static struct nt200a0x_ops *nt200a0x_ops; + +void register_nt200a0x_ops (struct nt200a0x_ops *ops) +{ + nt200a0x_ops = ops; +} + +struct nt200a0x_ops *get_nt200a0x_ops (void ) +{ +if (nt200a0x_ops ==NULL ) +nt200a0x_ops_init (); +return nt200a0x_ops; +}
drivers/net/ntnic/nthw/nthw_platform.c +3 -0
@@ -8,6 +8,9 @@nthw_adapter_id_t nthw_platform_get_nthw_adapter_id (const uint16_t n_pci_device_id) {switch (n_pci_device_id) { +case NT_HW_PCI_DEVICE_ID_NT200A02 : +return NT_HW_ADAPTER_ID_NT200A02 ; +default :return NT_HW_ADAPTER_ID_UNKNOWN ; }
drivers/net/ntnic/nthw/nthw_platform_drv.h +2 -0
@@ -9,9 +9,11 @@#include <stdint.h> #define NT_HW_PCI_VENDOR_ID (0x18f4) +#define NT_HW_PCI_DEVICE_ID_NT200A02 (0x1C5)enum nthw_adapter_id_e {NT_HW_ADAPTER_ID_UNKNOWN =0 , +NT_HW_ADAPTER_ID_NT200A02 , };typedef enum nthw_adapter_id_e nthw_adapter_id_t ;
drivers/net/ntnic/ntnic_ethdev.c +3 -0
@@ -25,6 +25,7 @@#define EXCEPTION_PATH_HID 0static const struct rte_pci_id nthw_pci_id_map[] = { + {RTE_PCI_DEVICE (NT_HW_PCI_VENDOR_ID ,NT_HW_PCI_DEVICE_ID_NT200A02 ) }, { .vendor_id =0 , },/* sentinel */
@@ -475,9 +476,11 @@ nthw_pci_remove(struct rte_pci_device *pci_dev)static struct rte_pci_driver rte_nthw_pmd = { .id_table = nthw_pci_id_map, + .drv_flags =RTE_PCI_DRV_NEED_MAPPING , .probe = nthw_pci_probe, .remove = nthw_pci_remove, };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" );
Signature · 1 line
2.43.0
PATCH v10 13/21 net/ntnic: add startup and reset sequence for NT200A0X
In reply to Serhii IliushykAdds reset (RST) module for FW 9563.
Also adds SDRAM Controller (SDC) module,
as it is part of the startup and reset sequence.
---
v5
* Fix Typo/Spelling
v10
* Use 8 spaces as indentation in meson
--- .../include/ntnic_nthw_fpga_rst_nt200a0x.h | 81 +++ drivers/net/ntnic/meson.build | 3 + .../net/ntnic/nthw/core/include/nthw_core.h | 2 + .../net/ntnic/nthw/core/include/nthw_fpga.h | 6 + .../net/ntnic/nthw/core/include/nthw_sdc.h | 42 ++ .../nthw/core/nt200a0x/nthw_fpga_nt200a0x.c | 24 +- .../core/nt200a0x/reset/nthw_fpga_rst9563.c | 216 +++++++ .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.c | 570 ++++++++++++++++++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 82 +++ drivers/net/ntnic/nthw/core/nthw_sdc.c | 176 ++++++ drivers/net/ntnic/ntnic_mod_reg.c | 28 + drivers/net/ntnic/ntnic_mod_reg.h | 20 + 12 files changed, 1249 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_sdc.h create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c create mode 100644 drivers/net/ntnic/nthw/core/nthw_sdc.c
drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h new file +81 -0
@@ -0,0 +1,81 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef __NTNIC_NTHW_FPGA_RST_NT200A0X_H__ +#define __NTNIC_NTHW_FPGA_RST_NT200A0X_H__ + +#include "nthw_drv.h" +#include "nthw_fpga_model.h" + +struct nthw_fpga_rst_nt200a0x { +int mn_fpga_product_id; +int mn_fpga_version; +int mn_fpga_revision; + +int mn_hw_id; + +int mn_si_labs_clock_synth_model; + +nthw_field_t *mp_fld_rst_sys; +nthw_field_t *mp_fld_rst_sys_mmcm; +nthw_field_t *mp_fld_rst_core_mmcm; +nthw_field_t *mp_fld_rst_rpp; +nthw_field_t *mp_fld_rst_ddr4; +nthw_field_t *mp_fld_rst_sdc; +nthw_field_t *mp_fld_rst_phy; +nthw_field_t *mp_fld_rst_serdes_rx; +nthw_field_t *mp_fld_rst_serdes_tx; +nthw_field_t *mp_fld_rst_serdes_rx_datapath; +nthw_field_t *mp_fld_rst_pcs_rx; +nthw_field_t *mp_fld_rst_mac_rx; +nthw_field_t *mp_fld_rst_mac_tx; +nthw_field_t *mp_fld_rst_ptp; +nthw_field_t *mp_fld_rst_ts; +nthw_field_t *mp_fld_rst_ptp_mmcm; +nthw_field_t *mp_fld_rst_ts_mmcm; +nthw_field_t *mp_fld_rst_periph; +nthw_field_t *mp_fld_rst_tsm_ref_mmcm; +nthw_field_t *mp_fld_rst_tmc; + +/* CTRL register field pointers */ +nthw_field_t *mp_fld_ctrl_ts_clk_sel_override; +nthw_field_t *mp_fld_ctrl_ts_clk_sel; +nthw_field_t *mp_fld_ctrl_ts_clk_sel_ref; +nthw_field_t *mp_fld_ctrl_ptp_mmcm_clk_sel; + +/* STAT register field pointers */ +nthw_field_t *mp_fld_stat_ddr4_mmcm_locked; +nthw_field_t *mp_fld_stat_sys_mmcm_locked; +nthw_field_t *mp_fld_stat_core_mmcm_locked; +nthw_field_t *mp_fld_stat_ddr4_pll_locked; +nthw_field_t *mp_fld_stat_ptp_mmcm_locked; +nthw_field_t *mp_fld_stat_ts_mmcm_locked; +nthw_field_t *mp_fld_stat_tsm_ref_mmcm_locked; + +/* STICKY register field pointers */ +nthw_field_t *mp_fld_sticky_ptp_mmcm_unlocked; +nthw_field_t *mp_fld_sticky_ts_mmcm_unlocked; +nthw_field_t *mp_fld_sticky_ddr4_mmcm_unlocked; +nthw_field_t *mp_fld_sticky_ddr4_pll_unlocked; +nthw_field_t *mp_fld_sticky_core_mmcm_unlocked; +nthw_field_t *mp_fld_sticky_pci_sys_mmcm_unlocked; +nthw_field_t *mp_fld_sticky_tsm_ref_mmcm_unlocked; + +/* POWER register field pointers */ +nthw_field_t *mp_fld_power_pu_phy; +nthw_field_t *mp_fld_power_pu_nseb; + +void (*reset_serdes_rx)(struct nthw_fpga_rst_nt200a0x *p,uint32_t intf_no,uint32_t rst); +void (*pcs_rx_rst)(struct nthw_fpga_rst_nt200a0x *p,uint32_t intf_no,uint32_t rst); +void (*get_serdes_rx_rst)(struct nthw_fpga_rst_nt200a0x *p,uint32_t intf_no, +uint32_t *p_set); +void (*get_pcs_rx_rst)(struct nthw_fpga_rst_nt200a0x *p,uint32_t intf_no, +uint32_t *p_set); +bool (*is_rst_serdes_rx_datapath_implemented)(struct nthw_fpga_rst_nt200a0x *p); +}; + +typedef struct nthw_fpga_rst_nt200a0x nthw_fpga_rst_nt200a0x_t ; + +#endif /* __NTHW_FPGA_RST_NT200A0X_H__ */
drivers/net/ntnic/meson.build +3 -0
@@ -26,10 +26,13 @@ sources = files( 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c', 'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c', + 'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c', + 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nthw_fpga.c', 'nthw/core/nthw_hif.c', 'nthw/core/nthw_iic.c', 'nthw/core/nthw_pcie3.c', + 'nthw/core/nthw_sdc.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +2 -0
@@ -16,5 +16,7 @@#include "nthw_pcie3.h" #include "nthw_iic.h" +#include "nthw_sdc.h" +#endif /* __NTHW_CORE_H__ */
drivers/net/ntnic/nthw/core/include/nthw_fpga.h +6 -0
@@ -18,6 +18,12 @@ int nthw_fpga_shutdown(struct fpga_info_s *p_fpga_info);int nthw_fpga_get_param_info (struct fpga_info_s *p_fpga_info,nthw_fpga_t *p_fpga); +int nthw_fpga_iic_scan (nthw_fpga_t *p_fpga,const int n_instance_no_begin, +const int n_instance_no_end); + +int nthw_fpga_silabs_detect (nthw_fpga_t *p_fpga,const int n_instance_no,const int n_dev_addr, +const int n_page_reg_addr); +struct nt200a0x_ops {int (*nthw_fpga_nt200a0x_init)(struct fpga_info_s *p_fpga_info); };
drivers/net/ntnic/nthw/core/include/nthw_sdc.h new file +42 -0
42 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nt200a0x/nthw_fpga_nt200a0x.c +23 -1
@@ -13,14 +13,36 @@ static int nthw_fpga_nt200a0x_init(struct fpga_info_s *p_fpga_info)assert (p_fpga_info);const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; +struct nthw_fpga_rst_nt200a0x rst;int res =-1 ; +const struct rst_nt200a0x_ops *rst_nt200a0x_ops =get_rst_nt200a0x_ops (); + +if (rst_nt200a0x_ops ==NULL ) { +NT_LOG (ERR ,NTHW ,"RST NT200A0X NOT INCLUDED\n" ); +return -1 ; + } + +/* reset common */ + res = rst_nt200a0x_ops->nthw_fpga_rst_nt200a0x_init (p_fpga_info, &rst); + +if (res) { +NT_LOG_DBGX (ERR ,NTHW ,"%s: FPGA=%04d res=%d\n" , p_adapter_id_str, + p_fpga_info->n_fpga_prod_id, res); +return res; + }bool included = true; +struct rst9563_ops *rst9563_ops =get_rst9563_ops ();/* reset specific */ switch (p_fpga_info->n_fpga_prod_id) {case 9563 : - included = false; +if (rst9563_ops !=NULL ) + res = rst9563_ops->nthw_fpga_rst9563_init (p_fpga_info, &rst); + +else + included = false; +break ;default :
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c new file +216 -0
216 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c new file +570 -0
570 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_fpga.c +82 -0
88 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_sdc.c new file +176 -0
176 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c +28 -0
@@ -18,3 +18,31 @@ const struct adapter_ops *get_adapter_ops(void)adapter_init ();return adapter_ops; } + +static struct rst_nt200a0x_ops *rst_nt200a0x_ops; + +void register_rst_nt200a0x_ops (struct rst_nt200a0x_ops *ops) +{ + rst_nt200a0x_ops = ops; +} + +struct rst_nt200a0x_ops *get_rst_nt200a0x_ops (void ) +{ +if (rst_nt200a0x_ops ==NULL ) +rst_nt200a0x_ops_init (); +return rst_nt200a0x_ops; +} + +static struct rst9563_ops *rst9563_ops; + +void register_rst9563_ops (struct rst9563_ops *ops) +{ + rst9563_ops = ops; +} + +struct rst9563_ops *get_rst9563_ops (void ) +{ +if (rst9563_ops ==NULL ) +rst9563_ops_init (); +return rst9563_ops; +}
drivers/net/ntnic/ntnic_mod_reg.h +20 -0
@@ -11,6 +11,7 @@#include "nthw_platform_drv.h" #include "nthw_drv.h" #include "nt4ga_adapter.h" +#include "ntnic_nthw_fpga_rst_nt200a0x.h" #include "ntos_drv.h" struct adapter_ops {
@@ -24,5 +25,24 @@ void register_adapter_ops(const struct adapter_ops *ops);const struct adapter_ops *get_adapter_ops (void );void adapter_init (void ); +struct rst_nt200a0x_ops { +int (*nthw_fpga_rst_nt200a0x_init)(struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt200a0x *p_rst); +int (*nthw_fpga_rst_nt200a0x_reset)(nthw_fpga_t *p_fpga, +const struct nthw_fpga_rst_nt200a0x *p); +}; + +void register_rst_nt200a0x_ops (struct rst_nt200a0x_ops *ops); +struct rst_nt200a0x_ops *get_rst_nt200a0x_ops (void ); +void rst_nt200a0x_ops_init (void ); + +struct rst9563_ops { +int (*nthw_fpga_rst9563_init)(struct fpga_info_s *p_fpga_info, +struct nthw_fpga_rst_nt200a0x *const p); +}; + +void register_rst9563_ops (struct rst9563_ops *ops); +struct rst9563_ops *get_rst9563_ops (void ); +void rst9563_ops_init (void );#endif /* __NTNIC_MOD_REG_H__ */
Signature · 1 line
2.43.0
PATCH v10 14/21 net/ntnic: add clock profile for the NT200A0X smartNIC
In reply to Serhii IliushykBecause the ntnic hardware supports multiple different FPGAs with different pipelines and port speeds,
the clock profile is not hardcoded into the product,
and need to be initialized from software.
The clock profile itself is an array of integers
that was generated by Silicon Labs ClockBuilder.
---
v6
* EOF comment was removed
v10
* Remove "#ifdef __cplusplus" and "#endif" around static_assert
* Use 8 spaces as indentation in meson
--- .../ntnic/include/clock_profiles_structs.h | 33 + .../include/ntnic_nthw_fpga_rst_nt200a0x.h | 1 + drivers/net/ntnic/meson.build | 2 + .../net/ntnic/nthw/core/include/nthw_core.h | 2 + .../net/ntnic/nthw/core/include/nthw_fpga.h | 4 + .../net/ntnic/nthw/core/include/nthw_si5340.h | 33 + .../NT200A02_U23_Si5340_adr0_v5-Registers.h | 753 ++++++++++++++++++ .../clock_profiles/nthw_fpga_clk9563.c | 45 ++ .../core/nt200a0x/reset/nthw_fpga_rst9563.c | 35 + .../nt200a0x/reset/nthw_fpga_rst_nt200a0x.c | 3 + drivers/net/ntnic/nthw/core/nthw_fpga.c | 23 + drivers/net/ntnic/nthw/core/nthw_si5340.c | 198 +++++ drivers/net/ntnic/ntnic_mod_reg.c | 14 + drivers/net/ntnic/ntnic_mod_reg.h | 9 + 14 files changed, 1155 insertions(+) create mode 100644 drivers/net/ntnic/include/clock_profiles_structs.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_si5340.h create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/NT200A02_U23_Si5340_adr0_v5-Registers.h create mode 100644 drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c create mode 100644 drivers/net/ntnic/nthw/core/nthw_si5340.c
drivers/net/ntnic/include/clock_profiles_structs.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef _NT_CLOCK_PROFILES_STRUCTS_H_ +#define _NT_CLOCK_PROFILES_STRUCTS_H_ + +#include <stdint.h> + +#define clk_profile_size_error_msg "Size test failed" + +struct clk_profile_data_fmt1_s { +uint16_t reg_addr; +uint8_t reg_val; +}; + +struct clk_profile_data_fmt2_s { +unsigned int reg_addr; +unsigned char reg_val; +}; + +typedef struct clk_profile_data_fmt1_s clk_profile_data_fmt1_t ; +typedef struct clk_profile_data_fmt2_s clk_profile_data_fmt2_t ; + +enum clk_profile_data_fmt_e { + clk_profile_data_fmt_1, + clk_profile_data_fmt_2, +}; + +typedef enum clk_profile_data_fmt_e clk_profile_data_fmt_t ; + +#endif /* _NT_CLOCK_PROFILES_STRUCTS_H_ */
drivers/net/ntnic/include/ntnic_nthw_fpga_rst_nt200a0x.h +1 -0
@@ -17,6 +17,7 @@ struct nthw_fpga_rst_nt200a0x {int mn_hw_id;int mn_si_labs_clock_synth_model; +uint8_t mn_si_labs_clock_synth_i2c_addr;nthw_field_t *mp_fld_rst_sys;nthw_field_t *mp_fld_rst_sys_mmcm;
drivers/net/ntnic/meson.build +2 -0
@@ -25,6 +25,7 @@ sources = files( 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c', + 'nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c', 'nthw/core/nt200a0x/nthw_fpga_nt200a0x.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c',
@@ -33,6 +34,7 @@ sources = files( 'nthw/core/nthw_iic.c', 'nthw/core/nthw_pcie3.c', 'nthw/core/nthw_sdc.c', + 'nthw/core/nthw_si5340.c', 'nthw/model/nthw_fpga_model.c', 'nthw/nthw_platform.c', 'nthw/nthw_rac.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +2 -0
@@ -18,5 +18,7 @@#include "nthw_sdc.h" +#include "nthw_si5340.h" +#endif /* __NTHW_CORE_H__ */
drivers/net/ntnic/nthw/core/include/nthw_fpga.h +4 -0
@@ -24,6 +24,10 @@ int nthw_fpga_iic_scan(nthw_fpga_t *p_fpga, const int n_instance_no_begin,int nthw_fpga_silabs_detect (nthw_fpga_t *p_fpga,const int n_instance_no,const int n_dev_addr,const int n_page_reg_addr); +int nthw_fpga_si5340_clock_synth_init_fmt2 (nthw_fpga_t *p_fpga,const uint8_t n_iic_addr, +const clk_profile_data_fmt2_t *p_clk_profile, +const int n_clk_profile_rec_cnt); +struct nt200a0x_ops {int (*nthw_fpga_nt200a0x_init)(struct fpga_info_s *p_fpga_info); };
drivers/net/ntnic/nthw/core/include/nthw_si5340.h new file +33 -0
@@ -0,0 +1,33 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef __NTHW_SI5340_H__ +#define __NTHW_SI5340_H__ + +#include "clock_profiles_structs.h" + +#define SI5340_SUCCESS (0) +#define SI5340_FAILED (999) +#define SI5340_TIMEOUT (666) + +struct nthw_si5340 { +uint8_t mn_iic_addr; +nthw_iic_t *mp_nthw_iic; +int mn_clk_cfg; +uint8_t m_si5340_page; +}; + +typedef struct nthw_si5340 nthw_si5340_t ; + +nthw_si5340_t *nthw_si5340_new (void ); +int nthw_si5340_init (nthw_si5340_t *p,nthw_iic_t *p_nthw_iic,uint8_t n_iic_addr); +void nthw_si5340_delete (nthw_si5340_t *p); + +int nthw_si5340_config (nthw_si5340_t *p,const void *p_data,int data_cnt, +clk_profile_data_fmt_t data_format); +int nthw_si5340_config_fmt2 (nthw_si5340_t *p,const clk_profile_data_fmt2_t *p_data, +const int data_cnt); + +#endif /* __NTHW_SI5338_H__ */
drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/NT200A02_U23_Si5340_adr0_v5-Registers.h new file +753 -0
753 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nt200a0x/clock_profiles/nthw_fpga_clk9563.c new file +45 -0
45 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c +35 -0
@@ -164,6 +164,34 @@ static int nthw_fpga_rst9563_periph_reset(nthw_fpga_t *p_fpga)return 0 ; } +static int nthw_fpga_rst9563_clock_synth_init (nthw_fpga_t *p_fpga, +const int n_si_labs_clock_synth_model, +const uint8_t n_si_labs_clock_synth_i2c_addr) +{ +const char *const p_adapter_id_str = p_fpga->p_fpga_info->mp_adapter_id_str; +const int n_fpga_product_id = p_fpga->mn_product_id; +int res; +const struct clk9563_ops *clk9563_ops =get_clk9563_ops (); + +if (clk9563_ops ==NULL ) { +NT_LOG (INF ,NTNIC ,"CLK9563 module not included\n" ); +return -1 ; + } + +if (n_si_labs_clock_synth_model ==5340 ) { + res =nthw_fpga_si5340_clock_synth_init_fmt2 (p_fpga, n_si_labs_clock_synth_i2c_addr, + clk9563_ops->get_p_data_9563_si5340_nt200a02_u23_v5 (), + *clk9563_ops->get_n_data_9563_si5340_nt200a02_u23_v5 ()); + + }else { +NT_LOG (ERR ,NTHW ,"%s: Fpga %d: Unsupported clock synth model (%d)\n" , + p_adapter_id_str, n_fpga_product_id, n_si_labs_clock_synth_model); + res =-1 ; + } + +return res; +} +static int nthw_fpga_rst9563_init (struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt200a0x *p_rst) {
@@ -173,9 +201,13 @@ static int nthw_fpga_rst9563_init(struct fpga_info_s *p_fpga_info,const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str; (void )p_adapter_id_str;int res =-1 ; +int n_si_labs_clock_synth_model; +uint8_t n_si_labs_clock_synth_i2c_addr;nthw_fpga_t *p_fpga =NULL ; p_fpga = p_fpga_info->mp_fpga; + n_si_labs_clock_synth_model = p_rst->mn_si_labs_clock_synth_model; + n_si_labs_clock_synth_i2c_addr = p_rst->mn_si_labs_clock_synth_i2c_addr; res =nthw_fpga_rst9563_periph_reset (p_fpga);
@@ -184,6 +216,9 @@ static int nthw_fpga_rst9563_init(struct fpga_info_s *p_fpga_info,return res; } + res =nthw_fpga_rst9563_clock_synth_init (p_fpga, n_si_labs_clock_synth_model, + n_si_labs_clock_synth_i2c_addr); +if (res) {NT_LOG_DBGX (DEBUG ,NTHW ,"%s: ERROR: res=%d\n" , p_adapter_id_str, res);return res;
drivers/net/ntnic/nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c +3 -0
@@ -552,7 +552,10 @@ static int nthw_fpga_rst_nt200a0x_init(struct fpga_info_s *p_fpga_info, } p_rst->mn_si_labs_clock_synth_model = n_si_labs_clock_synth_model; + p_rst->mn_si_labs_clock_synth_i2c_addr = n_si_labs_clock_synth_i2c_addr; p_rst->mn_hw_id = p_fpga_info->nthw_hw_info.hw_id; +NT_LOG_DBGX (DEBUG ,NTHW ,"%s: Si%04d @ 0x%02x\n" , p_adapter_id_str, + p_rst->mn_si_labs_clock_synth_model, p_rst->mn_si_labs_clock_synth_i2c_addr);return res; }
drivers/net/ntnic/nthw/core/nthw_fpga.c +23 -0
@@ -147,6 +147,29 @@ int nthw_fpga_silabs_detect(nthw_fpga_t *p_fpga, const int n_instance_no, constreturn res; } +/* +* NT200A02, NT200A01-HWbuild2 +*/ +int nthw_fpga_si5340_clock_synth_init_fmt2 (nthw_fpga_t *p_fpga,const uint8_t n_iic_addr, +const clk_profile_data_fmt2_t *p_clk_profile, +const int n_clk_profile_rec_cnt) +{ +int res; +nthw_iic_t *p_nthw_iic =nthw_iic_new (); +nthw_si5340_t *p_nthw_si5340 =nthw_si5340_new (); + +assert (p_nthw_iic); +assert (p_nthw_si5340); +nthw_iic_init (p_nthw_iic, p_fpga,0 ,8 );/* I2C cycle time 125Mhz ~ 8ns */ + +nthw_si5340_init (p_nthw_si5340, p_nthw_iic, n_iic_addr);/* si5340_u23_i2c_addr_7bit */ + res =nthw_si5340_config_fmt2 (p_nthw_si5340, p_clk_profile, n_clk_profile_rec_cnt); +nthw_si5340_delete (p_nthw_si5340); + p_nthw_si5340 =NULL ; + +return res; +} +int nthw_fpga_init (struct fpga_info_s *p_fpga_info) {const char *const p_adapter_id_str = p_fpga_info->mp_adapter_id_str;
drivers/net/ntnic/nthw/core/nthw_si5340.c new file +198 -0
198 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c +14 -0
@@ -19,6 +19,20 @@ const struct adapter_ops *get_adapter_ops(void)return adapter_ops; } +static struct clk9563_ops *clk9563_ops; + +void register_clk9563_ops (struct clk9563_ops *ops) +{ + clk9563_ops = ops; +} + +struct clk9563_ops *get_clk9563_ops (void ) +{ +if (clk9563_ops ==NULL ) +clk9563_ops_init (); +return clk9563_ops; +} +static struct rst_nt200a0x_ops *rst_nt200a0x_ops;void register_rst_nt200a0x_ops (struct rst_nt200a0x_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +9 -0
@@ -25,6 +25,15 @@ void register_adapter_ops(const struct adapter_ops *ops);const struct adapter_ops *get_adapter_ops (void );void adapter_init (void ); +struct clk9563_ops { +const int *(*get_n_data_9563_si5340_nt200a02_u23_v5)(void ); +const clk_profile_data_fmt2_t *(*get_p_data_9563_si5340_nt200a02_u23_v5)(void ); +}; + +void register_clk9563_ops (struct clk9563_ops *ops); +struct clk9563_ops *get_clk9563_ops (void ); +void clk9563_ops_init (void ); +struct rst_nt200a0x_ops {int (*nthw_fpga_rst_nt200a0x_init)(struct fpga_info_s *p_fpga_info,struct nthw_fpga_rst_nt200a0x *p_rst);
Signature · 1 line
2.43.0
PATCH v10 15/21 net/ntnic: add link management skeleton
In reply to Serhii IliushykAdd functionality to read and control the link-state of the ntnic. Note that must functions are not implemented yet.
Adds the following eth_dev_ops:
- dev_set_link_up
- dev_set_link_down
- link_update
- mac_addr_add
- mac_addr_set
- set_mc_addr_list
- promiscuous_enable
---
v5
* Fix Typo/Spelling
v6
* if_index was replaced with n_intf_no
* MAC addr assignment approach was reworked
v7
* Add relate features to documentation - INI and RST files v10
* Use 8 spaces as indentation in meson
--- doc/guides/nics/features/ntnic.ini | 3 + doc/guides/nics/ntnic.rst | 5 + drivers/net/ntnic/adapter/nt4ga_adapter.c | 6 + drivers/net/ntnic/include/nt4ga_adapter.h | 5 +- drivers/net/ntnic/include/nt4ga_link.h | 84 +++++++ drivers/net/ntnic/include/ntos_drv.h | 10 + drivers/net/ntnic/link_mgmt/nt4ga_link.c | 176 ++++++++++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/ntnic_ethdev.c | 281 ++++++++++++++++++++++ drivers/net/ntnic/ntnic_mod_reg.c | 14 ++ drivers/net/ntnic/ntnic_mod_reg.h | 50 +++- drivers/net/ntnic/ntutil/nt_util.c | 131 ++++++++++ drivers/net/ntnic/ntutil/nt_util.h | 11 + 13 files changed, 775 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/include/nt4ga_link.h create mode 100644 drivers/net/ntnic/link_mgmt/nt4ga_link.c
doc/guides/nics/features/ntnic.ini +3 -0
@@ -5,5 +5,8 @@ ; [Features] FW version = Y +Speed capabilities = Y +Unicast MAC filter = Y +Multicast MAC filter = Y Linux = Y x86-64 = Y
doc/guides/nics/ntnic.rst +5 -0
@@ -33,6 +33,11 @@ Features -------- - FW version +- Speed capabilities +- Link status (Link update only) +- Unicast MAC filter +- Multicast MAC filter +- Promiscuous mode (Enable only. The device always run promiscuous mode) Limitations ~~~~~~~~~~~
drivers/net/ntnic/adapter/nt4ga_adapter.c +6 -0
@@ -124,8 +124,14 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)assert (n_phy_ports >=1 ); { +int i;assert (fpga_info->n_fpga_prod_id >0 ); +for (i =0 ; i <NUM_ADAPTER_PORTS_MAX ; i++) { +/* Disable all ports. Must be enabled later */ + p_adapter_info->nt4ga_link.port_action[i].port_disable = true; + } +switch (fpga_info->n_fpga_prod_id) {/* NT200A01: 2x100G (Xilinx) */ case 9563 :/* NT200A02 (Cap) */
drivers/net/ntnic/include/nt4ga_adapter.h +4 -1
@@ -6,7 +6,8 @@ #ifndef _NT4GA_ADAPTER_H_ #define _NT4GA_ADAPTER_H_ -#include "ntos_drv.h" +#include "nt4ga_link.h" + typedef struct hw_info_s { /* pciids */ uint16_t pci_vendor_id;
@@ -23,6 +24,8 @@ typedef struct hw_info_s { } hw_info_t; typedef struct adapter_info_s { + struct nt4ga_link_s nt4ga_link; + struct hw_info_s hw_info; struct fpga_info_s fpga_info;
drivers/net/ntnic/include/nt4ga_link.h new file +84 -0
84 lines not on this page · raw message
drivers/net/ntnic/include/ntos_drv.h +10 -0
@@ -25,7 +25,17 @@ struct pmd_internals {const struct rte_pci_device *pci_dev;char name[20 ];int n_intf_no; +int lpbk_mode; +unsigned int nb_rx_queues; +unsigned int nb_tx_queues; +/* Offset of the VF from the PF */ +uint8_t vf_offset; +nt_meta_port_type_t type;struct drv_s *p_drv; +/* Ethernet (MAC) addresses. Element number zero denotes default address. */ +struct rte_ether_addr eth_addrs[NUM_MAC_ADDRS_PER_PORT ]; +/* Multicast ethernet (MAC) addresses. */ +struct rte_ether_addr mc_addrs[NUM_MULTICAST_ADDRS_PER_PORT ];struct pmd_internals *next; };
drivers/net/ntnic/link_mgmt/nt4ga_link.c new file +176 -0
176 lines not on this page · raw message
drivers/net/ntnic/meson.build +1 -0
@@ -22,6 +22,7 @@ includes = [ # all sources sources = files( 'adapter/nt4ga_adapter.c', + 'link_mgmt/nt4ga_link.c', 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c',
drivers/net/ntnic/ntnic_ethdev.c +281 -0
370 lines not on this page · raw message
drivers/net/ntnic/ntnic_mod_reg.c +14 -0
@@ -5,6 +5,20 @@#include "ntnic_mod_reg.h" +static const struct port_ops *port_ops; + +void register_port_ops (const struct port_ops *ops) +{ + port_ops = ops; +} + +const struct port_ops *get_port_ops (void ) +{ +if (port_ops ==NULL ) +port_init (); +return port_ops; +} +static const struct adapter_ops *adapter_ops;void register_adapter_ops (const struct adapter_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +49 -1
56 lines not on this page · raw message
drivers/net/ntnic/ntutil/nt_util.c +131 -0
134 lines not on this page · raw message
drivers/net/ntnic/ntutil/nt_util.h +11 -0
@@ -7,6 +7,7 @@#define NTOSS_SYSTEM_NT_UTIL_H #include <stdint.h> +#include "nt4ga_link.h" #ifndef ARRAY_SIZE #define ARRAY_SIZE (arr) RTE_DIM(arr)
@@ -30,6 +31,11 @@ struct nt_dma_s {uint64_t size; }; +struct port_link_speed { +int port_id; +int link_speed; +}; +struct nt_dma_s *nt_dma_alloc (uint64_t size,uint64_t align,int numa);void nt_dma_free (struct nt_dma_s *vfio_addr);
@@ -40,4 +46,9 @@ struct nt_util_vfio_impl {void nt_util_vfio_init (struct nt_util_vfio_impl *impl); +int nt_link_speed_to_eth_speed_num (enum nt_link_speed_e nt_link_speed); +uint32_t nt_link_speed_capa_to_eth_speed_capa (int nt_link_speed_capa); +nt_link_speed_t convert_link_speed (int link_speed_mbps); +int nt_link_duplex_to_eth_duplex (enum nt_link_duplex_e nt_link_duplex); +#endif /* NTOSS_SYSTEM_NT_UTIL_H */
Signature · 1 line
2.43.0
Re: [PATCH v10 15/21] net/ntnic: add link management skeleton
Quoted 4 lines · Serhii Iliushyk
drivers/net/ntnic/ntnic_ethdev.c +0
-0@@ -373,6 +645,15 @@ nthw_pci_dev_init(struct rte_pci_device *pci_dev)return -1 ; }
drivers/net/ntnic/ntnic_ethdev.c nthw_pci_dev_init(struct rte_pci_device *pci_dev) · line 657
Quoted 10 lines
drivers/net/ntnic/ntnic_ethdev.c +9
-0+/* connect structs */ + internals->p_drv = p_drv; + eth_dev->data->dev_private = internals; + eth_dev->data->mac_addrs =rte_malloc (NULL , +NUM_MAC_ADDRS_PER_PORT *sizeof (struct rte_ether_addr ),0 ); +rte_memcpy (ð_dev->data->mac_addrs[0 ], + &internals->eth_addrs[0 ],RTE_ETHER_ADDR_LEN ); + +
DPDK has 'rte_ether_addr_copy()' API for MAC address copy, this is not a change request for this patch series, but you can use it when this code is updated in the future.
PATCH v10 16/21 net/ntnic: add link 100G module ops
In reply to Serhii IliushykAs the ntnic can support different speeds,
an abstraction layer for 100G speed is needed.
---
v10
* Use 8 spaces as indentation in meson
--- drivers/net/ntnic/adapter/nt4ga_adapter.c | 12 ++++- .../link_mgmt/link_100g/nt4ga_link_100g.c | 49 +++++++++++++++++++ drivers/net/ntnic/meson.build | 1 + drivers/net/ntnic/ntnic_mod_reg.c | 14 ++++++ drivers/net/ntnic/ntnic_mod_reg.h | 8 +++ 5 files changed, 82 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c
drivers/net/ntnic/adapter/nt4ga_adapter.c +10 -2
@@ -125,6 +125,7 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info) {int i; +const struct link_ops_s *link_ops =NULL ;assert (fpga_info->n_fpga_prod_id >0 );for (i =0 ; i <NUM_ADAPTER_PORTS_MAX ; i++) {
@@ -135,8 +136,15 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)switch (fpga_info->n_fpga_prod_id) {/* NT200A01: 2x100G (Xilinx) */ case 9563 :/* NT200A02 (Cap) */ -NT_LOG (ERR ,NTNIC ,"NT200A02 100G link module uninitialized\n" ); - res =-1 ; + link_ops =get_100g_link_ops (); + +if (link_ops ==NULL ) { +NT_LOG (ERR ,NTNIC ,"NT200A02 100G link module uninitialized\n" ); + res =-1 ; +break ; + } + + res = link_ops->link_init (p_adapter_info, p_fpga);break ;default :
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c new file +49 -0
49 lines not on this page · raw message
drivers/net/ntnic/meson.build +1 -0
@@ -22,6 +22,7 @@ includes = [ # all sources sources = files( 'adapter/nt4ga_adapter.c', + 'link_mgmt/link_100g/nt4ga_link_100g.c', 'link_mgmt/nt4ga_link.c', 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c',
drivers/net/ntnic/ntnic_mod_reg.c +14 -0
@@ -5,6 +5,20 @@#include "ntnic_mod_reg.h" +static struct link_ops_s *link_100g_ops; + +void register_100g_link_ops (struct link_ops_s *ops) +{ + link_100g_ops = ops; +} + +const struct link_ops_s *get_100g_link_ops (void ) +{ +if (link_100g_ops ==NULL ) +link_100g_init (); +return link_100g_ops; +} +static const struct port_ops *port_ops;void register_port_ops (const struct port_ops *ops)
drivers/net/ntnic/ntnic_mod_reg.h +8 -0
@@ -13,6 +13,14 @@#include "nt4ga_adapter.h" #include "ntnic_nthw_fpga_rst_nt200a0x.h" +struct link_ops_s { +int (*link_init)(struct adapter_info_s *p_adapter_info,nthw_fpga_t *p_fpga); +}; + +void register_100g_link_ops (struct link_ops_s *ops); +const struct link_ops_s *get_100g_link_ops (void ); +void link_100g_init (void ); +struct port_ops {/* * port:s link mode
Signature · 1 line
2.43.0
PATCH v10 17/21 net/ntnic: add generic NIM and I2C modules
In reply to Serhii IliushykAs the ntnic can support different port speeds, it also needs to support different NIMs (Network Interface Module). This commit add the generic NIM support for ntnic, such that the specific modules,
such as QSFP28 can be added later.
The communication with NIMs is in the form of I2C, so support for such a module is added as well.
Additionally a thread is added to control the NIM stat machines.
---
v6
* Remove unnecessary comments
v10
* Use 8 spaces as indentation in meson
--- drivers/net/ntnic/adapter/nt4ga_adapter.c | 34 +++ drivers/net/ntnic/include/nt4ga_adapter.h | 3 + drivers/net/ntnic/include/nt4ga_link.h | 13 + drivers/net/ntnic/include/ntnic_nim.h | 61 +++++ .../link_mgmt/link_100g/nt4ga_link_100g.c | 214 ++++++++++++++++- drivers/net/ntnic/link_mgmt/nt4ga_link.c | 13 + drivers/net/ntnic/meson.build | 3 + drivers/net/ntnic/nim/i2c_nim.c | 224 ++++++++++++++++++ drivers/net/ntnic/nim/i2c_nim.h | 24 ++ drivers/net/ntnic/nim/nim_defines.h | 29 +++ .../net/ntnic/nthw/core/include/nthw_core.h | 1 + .../net/ntnic/nthw/core/include/nthw_i2cm.h | 50 ++++ drivers/net/ntnic/nthw/core/nthw_fpga.c | 3 + drivers/net/ntnic/nthw/core/nthw_i2cm.c | 192 +++++++++++++++ drivers/net/ntnic/nthw/nthw_drv.h | 1 + drivers/net/ntnic/ntnic_mod_reg.h | 7 + 16 files changed, 871 insertions(+), 1 deletion(-) create mode 100644 drivers/net/ntnic/include/ntnic_nim.h create mode 100644 drivers/net/ntnic/nim/i2c_nim.c create mode 100644 drivers/net/ntnic/nim/i2c_nim.h create mode 100644 drivers/net/ntnic/nim/nim_defines.h create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_i2cm.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_i2cm.c
drivers/net/ntnic/adapter/nt4ga_adapter.c +34 -0
@@ -9,6 +9,32 @@#include "nthw_fpga.h" #include "ntnic_mod_reg.h" +/* +* Global variables shared by NT adapter types +*/ +rte_thread_t monitor_tasks[NUM_ADAPTER_MAX ]; +volatile int monitor_task_is_running[NUM_ADAPTER_MAX ]; + +/* +* Signal-handler to stop all monitor threads +*/ +static void stop_monitor_tasks (int signum) +{ +const size_t N =ARRAY_SIZE (monitor_task_is_running); +size_t i; + +/* Stop all monitor tasks */ +for (i =0 ; i <N ; i++) { +const int is_running = monitor_task_is_running[i]; + monitor_task_is_running[i] =0 ; + +if (signum ==-1 && is_running !=0 ) { +rte_thread_join (monitor_tasks[i],NULL ); +memset (&monitor_tasks[i],0 ,sizeof (monitor_tasks[0 ])); + } + } +} +static int nt4ga_adapter_show_info (struct adapter_info_s *p_adapter_info,FILE *pfh) {const char *const p_dev_name = p_adapter_info->p_dev_name;
@@ -35,6 +61,9 @@ static int nt4ga_adapter_show_info(struct adapter_info_s *p_adapter_info, FILE * p_fpga_info->n_fpga_ver_id, p_fpga_info->n_fpga_rev_id, p_fpga_info->n_fpga_ident, p_fpga_info->n_fpga_build_time);fprintf (pfh,"%s: FpgaDebugMode=0x%x\n" , p_adapter_id_str, p_fpga_info->n_fpga_debug_mode); +fprintf (pfh,"%s: Nims=%d PhyPorts=%d PhyQuads=%d RxPorts=%d TxPorts=%d\n" , + p_adapter_id_str, p_fpga_info->n_nims, p_fpga_info->n_phy_ports, + p_fpga_info->n_phy_quads, p_fpga_info->n_rx_ports, p_fpga_info->n_tx_ports);fprintf (pfh,"%s: Hw=0x%02X_rev%d: %s\n" , p_adapter_id_str, p_hw_info->hw_platform_id, p_fpga_info->nthw_hw_info.hw_id, p_fpga_info->nthw_hw_info.hw_plat_id_str);fprintf (pfh,"%s: MCU Details:\n" , p_adapter_id_str);
@@ -56,6 +85,7 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)* (nthw_fpga_init()) */ int n_phy_ports =-1 ; +int n_nim_ports =-1 ;int res =-1 ;nthw_fpga_t *p_fpga =NULL ;
@@ -122,6 +152,8 @@ static int nt4ga_adapter_init(struct adapter_info_s *p_adapter_info)assert (p_fpga); n_phy_ports = fpga_info->n_phy_ports;assert (n_phy_ports >=1 ); + n_nim_ports = fpga_info->n_nims; +assert (n_nim_ports >=1 ); {int i;
@@ -171,6 +203,8 @@ static int nt4ga_adapter_deinit(struct adapter_info_s *p_adapter_info)int i;int res =-1 ; +stop_monitor_tasks (-1 ); +nthw_fpga_shutdown (&p_adapter_info->fpga_info);/* Rac rab reset flip flop */
drivers/net/ntnic/include/nt4ga_adapter.h +3 -0
@@ -39,5 +39,8 @@ typedef struct adapter_info_s { int n_tx_host_buffers; } adapter_info_t; +extern rte_thread_t monitor_tasks[NUM_ADAPTER_MAX ]; +extern volatile int monitor_task_is_running[NUM_ADAPTER_MAX ]; +#endif /* _NT4GA_ADAPTER_H_ */
drivers/net/ntnic/include/nt4ga_link.h +13 -0
@@ -7,6 +7,7 @@#define NT4GA_LINK_H_ #include "ntos_drv.h" +#include "ntnic_nim.h" enum nt_link_state_e {NT_LINK_STATE_UNKNOWN =0 ,/* The link state has not been read yet */
@@ -41,6 +42,8 @@ enum nt_link_auto_neg_e { typedef struct link_state_s { bool link_disabled; + bool nim_present; + bool lh_nim_absent; bool link_up; enum nt_link_state_e link_state; enum nt_link_state_e link_state_latched;
@@ -73,12 +76,22 @@ typedef struct port_action_s { uint32_t port_lpbk_mode; } port_action_t; +typedef struct adapter_100g_s { +nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX ];/* Should be the first field */ +}adapter_100g_t ; + +typedef union adapter_var_s { +nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX ];/* First field in all the adapters type */ +adapter_100g_t var100g; +}adapter_var_u ; +typedef struct nt4ga_link_s {link_state_t link_state[NUM_ADAPTER_PORTS_MAX ];link_info_t link_info[NUM_ADAPTER_PORTS_MAX ];port_action_t port_action[NUM_ADAPTER_PORTS_MAX ];uint32_t speed_capa;bool variables_initialized; +adapter_var_u u; }nt4ga_link_t ;#endif /* NT4GA_LINK_H_ */
drivers/net/ntnic/include/ntnic_nim.h new file +61 -0
61 lines not on this page · raw message
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +213 -1
241 lines not on this page · raw message
drivers/net/ntnic/link_mgmt/nt4ga_link.c +13 -0
@@ -12,6 +12,7 @@#include "ntnic_mod_reg.h" #include "nt4ga_link.h" +#include "i2c_nim.h" /* * port: speed capabilities
@@ -26,6 +27,16 @@ static uint32_t nt4ga_port_get_link_speed_capabilities(struct adapter_info_s *p,return nt_link_speed_capa; } +/* +* port: nim present +*/ +static bool nt4ga_port_get_nim_present (struct adapter_info_s *p,int port) +{ +nt4ga_link_t *const p_link = &p->nt4ga_link; +const bool nim_present = p_link->link_state[port].nim_present; +return nim_present; +} +/* * port: link mode */
@@ -131,6 +142,8 @@ static uint32_t nt4ga_port_get_loopback_mode(struct adapter_info_s *p, int port)static const struct port_ops ops = { + .get_nim_present = nt4ga_port_get_nim_present, +/* * port:s link mode */
drivers/net/ntnic/meson.build +3 -0
@@ -17,6 +17,7 @@ includes = [ include_directories('nthw'), include_directories('nthw/supported'), include_directories('nthw/model'), + include_directories('nim/'), ] # all sources
@@ -24,6 +25,7 @@ sources = files( 'adapter/nt4ga_adapter.c', 'link_mgmt/link_100g/nt4ga_link_100g.c', 'link_mgmt/nt4ga_link.c', + 'nim/i2c_nim.c', 'nthw/supported/nthw_fpga_9563_055_039_0000.c', 'nthw/supported/nthw_fpga_instances.c', 'nthw/supported/nthw_fpga_mod_str_map.c',
@@ -33,6 +35,7 @@ sources = files( 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nthw_fpga.c', 'nthw/core/nthw_hif.c', + 'nthw/core/nthw_i2cm.c', 'nthw/core/nthw_iic.c', 'nthw/core/nthw_pcie3.c', 'nthw/core/nthw_sdc.c',
drivers/net/ntnic/nim/i2c_nim.c new file +224 -0
224 lines not on this page · raw message
drivers/net/ntnic/nim/i2c_nim.h new file +24 -0
@@ -0,0 +1,24 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef I2C_NIM_H_ +#define I2C_NIM_H_ + +#include "ntnic_nim.h" + +/* +* Returns a type name such as "SFP/SFP+" for a given NIM type identifier, +* or the string "ILLEGAL!". +*/ +const char *nim_id_to_text (uint8_t nim_id); + +/* +* This function tries to classify NIM based on it's ID and some register reads +* and collects information into ctx structure. The @extra parameter could contain +* the initialization argument for specific type of NIMS. +*/ +int construct_and_preinit_nim (nim_i2c_ctx_p ctx); + +#endif /* I2C_NIM_H_ */
drivers/net/ntnic/nim/nim_defines.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* SPDX-License-Identifier: BSD-3-Clause +* Copyright(c) 2023 Napatech A/S +*/ + +#ifndef NIM_DEFINES_H_ +#define NIM_DEFINES_H_ + +#define NIM_IDENTIFIER_ADDR 0/* 1 byte */ + +/* I2C addresses */ +#define NIM_I2C_0XA0 0xA0/* Basic I2C address */ +#define NIM_I2C_0XA2 0xA2/* Diagnostic monitoring */ + +typedef enum { +NIM_OPTION_TX_DISABLE , +/* Indicates that the module should be checked for the two next FEC types */ +NIM_OPTION_FEC , +NIM_OPTION_MEDIA_SIDE_FEC , +NIM_OPTION_HOST_SIDE_FEC , +NIM_OPTION_RX_ONLY +}nim_option_t ; + +enum nt_nim_identifier_e { +NT_NIM_UNKNOWN =0x00 ,/* Nim type is unknown */ +}; +typedef enum nt_nim_identifier_e nt_nim_identifier_t ; + +#endif /* NIM_DEFINES_H_ */
drivers/net/ntnic/nthw/core/include/nthw_core.h +1 -0
@@ -15,6 +15,7 @@#include "nthw_hif.h" #include "nthw_pcie3.h" #include "nthw_iic.h" +#include "nthw_i2cm.h" #include "nthw_sdc.h"
drivers/net/ntnic/nthw/core/include/nthw_i2cm.h new file +50 -0
50 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_fpga.c +3 -0
@@ -19,12 +19,14 @@ int nthw_fpga_get_param_info(struct fpga_info_s *p_fpga_info, nthw_fpga_t *p_fpg {mcu_info_t *p_mcu_info = &p_fpga_info->mcu_info; +const int n_nims =nthw_fpga_get_product_param (p_fpga,NT_NIMS ,-1 );const int n_phy_ports =nthw_fpga_get_product_param (p_fpga,NT_PHY_PORTS ,-1 );const int n_phy_quads =nthw_fpga_get_product_param (p_fpga,NT_PHY_QUADS ,-1 );const int n_rx_ports =nthw_fpga_get_product_param (p_fpga,NT_RX_PORTS ,-1 );const int n_tx_ports =nthw_fpga_get_product_param (p_fpga,NT_TX_PORTS ,-1 );const int n_vf_offset =nthw_fpga_get_product_param (p_fpga,NT_HIF_VF_OFFSET ,4 ); + p_fpga_info->n_nims = n_nims; p_fpga_info->n_phy_ports = n_phy_ports; p_fpga_info->n_phy_quads = n_phy_quads; p_fpga_info->n_rx_ports = n_rx_ports;
@@ -236,6 +238,7 @@ int nthw_fpga_init(struct fpga_info_s *p_fpga_info)nthw_fpga_get_param_info (p_fpga_info, p_fpga);/* debug: report params */ +NT_LOG (DBG ,NTHW ,"%s: NT_NIMS=%d\n" , p_adapter_id_str, p_fpga_info->n_nims);NT_LOG (DBG ,NTHW ,"%s: NT_PHY_PORTS=%d\n" , p_adapter_id_str, p_fpga_info->n_phy_ports);NT_LOG (DBG ,NTHW ,"%s: NT_PHY_QUADS=%d\n" , p_adapter_id_str, p_fpga_info->n_phy_quads);NT_LOG (DBG ,NTHW ,"%s: NT_RX_PORTS=%d\n" , p_adapter_id_str, p_fpga_info->n_rx_ports);
drivers/net/ntnic/nthw/core/nthw_i2cm.c new file +192 -0
192 lines not on this page · raw message
drivers/net/ntnic/nthw/nthw_drv.h +1 -0
@@ -52,6 +52,7 @@ typedef struct fpga_info_s {int n_fpga_debug_mode; +int n_nims;int n_phy_ports;int n_phy_quads;int n_rx_ports;
drivers/net/ntnic/ntnic_mod_reg.h +7 -0
@@ -22,6 +22,8 @@ const struct link_ops_s *get_100g_link_ops(void);void link_100g_init (void );struct port_ops { +bool (*get_nim_present)(struct adapter_info_s *p,int port); +/* * port:s link mode */
@@ -60,6 +62,11 @@ struct port_ops {uint32_t (*get_link_speed_capabilities)(struct adapter_info_s *p,int port); +/* +* port: nim capabilities +*/ +nim_i2c_ctx_t (*get_nim_capabilities)(struct adapter_info_s *p,int port); +/* * port: tx power */
Signature · 1 line
2.43.0
PATCH v10 18/21 net/ntnic: add QSFP support
In reply to Serhii IliushykIncludes support for QSFP and QSFP+.
--- drivers/net/ntnic/include/ntnic_nim.h | 10 + .../link_mgmt/link_100g/nt4ga_link_100g.c | 12 +- drivers/net/ntnic/nim/i2c_nim.c | 310 +++++++++++++++++- drivers/net/ntnic/nim/i2c_nim.h | 14 +- drivers/net/ntnic/nim/nim_defines.h | 3 + drivers/net/ntnic/nim/qsfp_registers.h | 43 +++ 6 files changed, 389 insertions(+), 3 deletions(-) create mode 100644 drivers/net/ntnic/nim/qsfp_registers.h
drivers/net/ntnic/include/ntnic_nim.h +10 -0
@@ -15,6 +15,8 @@ typedef enum i2c_type {enum nt_port_type_e {NT_PORT_TYPE_NOT_AVAILABLE =0 ,/* The NIM/port type is not available (unknown) */ NT_PORT_TYPE_NOT_RECOGNISED ,/* The NIM/port type not recognized */ +NT_PORT_TYPE_QSFP_PLUS_NOT_PRESENT ,/* QSFP type but slot is empty */ +NT_PORT_TYPE_QSFP_PLUS ,/* QSFP type */ };typedef enum nt_port_type_e nt_port_type_t , *nt_port_type_p ;
@@ -51,6 +53,14 @@ typedef struct nim_i2c_ctx {bool tx_disable;bool dmi_supp; +union { +struct { +bool rx_only; +union { + } specific_u; + } qsfp; + + } specific_u; } nim_i2c_ctx_t, *nim_i2c_ctx_p; struct nim_sensor_group {
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +11 -1
@@ -18,6 +18,7 @@ static int _create_nim(adapter_info_t *drv, int port)int res =0 ;const uint8_t valid_nim_id =17U ;nim_i2c_ctx_t *nim_ctx; +sfp_nim_state_t nim;nt4ga_link_t *link_info = &drv->nt4ga_link;assert (port >=0 && port <NUM_ADAPTER_PORTS_MAX );
@@ -31,11 +32,20 @@ static int _create_nim(adapter_info_t *drv, int port)*/ nt_os_wait_usec (1000000 );/* pause 1.0s */ - res =construct_and_preinit_nim (nim_ctx); + res =construct_and_preinit_nim (nim_ctx,NULL );if (res)return res; + res =nim_state_build (nim_ctx, &nim); + +if (res) +return res; + +NT_LOG (DBG ,NTHW ,"%s: NIM id = %u (%s), br = %u, vendor = '%s', pn = '%s', sn='%s'\n" , + drv->mp_port_id_str[port], nim_ctx->nim_id,nim_id_to_text (nim_ctx->nim_id), nim.br, + nim_ctx->vendor_name, nim_ctx->prod_no, nim_ctx->serial_no); +/* * Does the driver support the NIM module type? */
drivers/net/ntnic/nim/i2c_nim.c +309 -1
347 lines not on this page · raw message
drivers/net/ntnic/nim/i2c_nim.h +13 -1
@@ -8,17 +8,29 @@#include "ntnic_nim.h" +typedef struct sfp_nim_state { +uint8_t br;/* bit rate, units of 100 MBits/sec */ +}sfp_nim_state_t , *sfp_nim_state_p ; + +/* +* Builds an nim state for the port implied by `ctx`, returns zero +* if successful, and non-zero otherwise. SFP and QSFP nims are supported +*/ +int nim_state_build (nim_i2c_ctx_t *ctx,sfp_nim_state_t *state); +/* * Returns a type name such as "SFP/SFP+" for a given NIM type identifier, * or the string "ILLEGAL!". */ const char *nim_id_to_text (uint8_t nim_id); +int nim_qsfp_plus_nim_set_tx_laser_disable (nim_i2c_ctx_t *ctx,bool disable,int lane_idx); +/* * This function tries to classify NIM based on it's ID and some register reads * and collects information into ctx structure. The @extra parameter could contain * the initialization argument for specific type of NIMS. */ -int construct_and_preinit_nim (nim_i2c_ctx_p ctx); +int construct_and_preinit_nim (nim_i2c_ctx_p ctx,void *extra);#endif /* I2C_NIM_H_ */
drivers/net/ntnic/nim/nim_defines.h +3 -0
@@ -7,6 +7,7 @@#define NIM_DEFINES_H_ #define NIM_IDENTIFIER_ADDR 0/* 1 byte */ +#define QSFP_EXTENDED_IDENTIFIER 129/* I2C addresses */ #define NIM_I2C_0XA0 0xA0/* Basic I2C address */
@@ -23,6 +24,8 @@ typedef enum {enum nt_nim_identifier_e {NT_NIM_UNKNOWN =0x00 ,/* Nim type is unknown */ +NT_NIM_QSFP =0x0C ,/* Nim type = QSFP */ +NT_NIM_QSFP_PLUS =0x0D ,/* Nim type = QSFP+ */ };typedef enum nt_nim_identifier_e nt_nim_identifier_t ;
drivers/net/ntnic/nim/qsfp_registers.h new file +43 -0
43 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v10 19/21 net/ntnic: add QSFP28 support
In reply to Serhii IliushykIncludes support for QSFP28
--- drivers/net/ntnic/include/ntnic_nim.h | 21 ++ drivers/net/ntnic/link_mgmt/nt4ga_link.c | 25 +++ drivers/net/ntnic/nim/i2c_nim.c | 267 ++++++++++++++++++++++- drivers/net/ntnic/nim/nim_defines.h | 1 + 4 files changed, 313 insertions(+), 1 deletion(-)
drivers/net/ntnic/include/ntnic_nim.h +21 -0
@@ -17,6 +17,19 @@ enum nt_port_type_e {NT_PORT_TYPE_NOT_RECOGNISED ,/* The NIM/port type not recognized */ NT_PORT_TYPE_QSFP_PLUS_NOT_PRESENT ,/* QSFP type but slot is empty */ NT_PORT_TYPE_QSFP_PLUS ,/* QSFP type */ +NT_PORT_TYPE_QSFP28_NOT_PRESENT ,/* QSFP28 type but slot is empty */ +NT_PORT_TYPE_QSFP28 ,/* QSFP28 type */ +NT_PORT_TYPE_QSFP28_SR4 ,/* QSFP28-SR4 type */ +NT_PORT_TYPE_QSFP28_LR4 ,/* QSFP28-LR4 type */ +NT_PORT_TYPE_QSFP28_CR_CA_L ,/* QSFP28-CR-CA-L type */ +NT_PORT_TYPE_QSFP28_CR_CA_S ,/* QSFP28-CR-CA-S type */ +NT_PORT_TYPE_QSFP28_CR_CA_N ,/* QSFP28-CR-CA-N type */ +/* QSFP28-FR type. Uses PAM4 modulation on one lane only */ +NT_PORT_TYPE_QSFP28_FR , +/* QSFP28-DR type. Uses PAM4 modulation on one lane only */ +NT_PORT_TYPE_QSFP28_DR , +/* QSFP28-LR type. Uses PAM4 modulation on one lane only */ + NT_PORT_TYPE_QSFP28_LR, };typedef enum nt_port_type_e nt_port_type_t , *nt_port_type_p ;
@@ -56,7 +69,15 @@ typedef struct nim_i2c_ctx {union {struct {bool rx_only; +bool qsfp28;union { +struct { +uint8_t rev_compliance; +bool media_side_fec_ctrl; +bool host_side_fec_ctrl; +bool media_side_fec_ena; +bool host_side_fec_ena; + } qsfp28; } specific_u; } qsfp;
drivers/net/ntnic/link_mgmt/nt4ga_link.c +25 -0
@@ -140,6 +140,26 @@ static uint32_t nt4ga_port_get_loopback_mode(struct adapter_info_s *p, int port)return p_link->port_action[port].port_lpbk_mode; } +/* +* port: tx power +*/ +static int nt4ga_port_tx_power (struct adapter_info_s *p,int port,bool disable) +{ +nt4ga_link_t *link_info = &p->nt4ga_link; + +if (link_info->u.nim_ctx[port].port_type ==NT_PORT_TYPE_QSFP28_SR4 || + link_info->u.nim_ctx[port].port_type ==NT_PORT_TYPE_QSFP28 || + link_info->u.nim_ctx[port].port_type ==NT_PORT_TYPE_QSFP28_LR4 ) { +nim_i2c_ctx_t *nim_ctx = &link_info->u.var100g.nim_ctx[port]; + +if (!nim_ctx->specific_u.qsfp.rx_only) { +if (nim_qsfp_plus_nim_set_tx_laser_disable (nim_ctx, disable,-1 ) !=0 ) +return 1 ; + } + } + +return 0 ; +}static const struct port_ops ops = { .get_nim_present = nt4ga_port_get_nim_present,
@@ -181,6 +201,11 @@ static const struct port_ops ops = { .get_loopback_mode = nt4ga_port_get_loopback_mode, .get_link_speed_capabilities = nt4ga_port_get_link_speed_capabilities, + +/* +* port: tx power +*/ + .tx_power = nt4ga_port_tx_power, };void port_init (void )
drivers/net/ntnic/nim/i2c_nim.c +266 -1
316 lines not on this page · raw message
drivers/net/ntnic/nim/nim_defines.h +1 -0
@@ -26,6 +26,7 @@ enum nt_nim_identifier_e {NT_NIM_UNKNOWN =0x00 ,/* Nim type is unknown */ NT_NIM_QSFP =0x0C ,/* Nim type = QSFP */ NT_NIM_QSFP_PLUS =0x0D ,/* Nim type = QSFP+ */ + NT_NIM_QSFP28 = 0x11, /* Nim type = QSFP28 */ };typedef enum nt_nim_identifier_e nt_nim_identifier_t ;
Signature · 1 line
2.43.0
PATCH v10 20/21 net/ntnic: add GPIO communication for NIMs
In reply to Serhii IliushykFor NIM reset sequence GPIO communication is used. After this commit the NIMs supported by ntnic
is able to start up and be controlled fully by the adapter.
---
v5
* Fix Typo/Spelling
v10
* Use 8 spaces as indentation in meson
--- drivers/net/ntnic/include/nt4ga_link.h | 1 + .../link_mgmt/link_100g/nt4ga_link_100g.c | 71 ++++++++- drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_core.h | 1 + .../ntnic/nthw/core/include/nthw_gpio_phy.h | 48 ++++++ drivers/net/ntnic/nthw/core/nthw_gpio_phy.c | 145 ++++++++++++++++++ 6 files changed, 263 insertions(+), 4 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_gpio_phy.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_gpio_phy.c
drivers/net/ntnic/include/nt4ga_link.h +1 -0
@@ -78,6 +78,7 @@ typedef struct port_action_s {typedef struct adapter_100g_s {nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX ];/* Should be the first field */ +nthw_gpio_phy_t gpio_phy[NUM_ADAPTER_PORTS_MAX ]; }adapter_100g_t ; typedef union adapter_var_s {
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +67 -4
145 lines not on this page · raw message
drivers/net/ntnic/meson.build +1 -0
@@ -34,6 +34,7 @@ sources = files( 'nthw/core/nt200a0x/reset/nthw_fpga_rst9563.c', 'nthw/core/nt200a0x/reset/nthw_fpga_rst_nt200a0x.c', 'nthw/core/nthw_fpga.c', + 'nthw/core/nthw_gpio_phy.c', 'nthw/core/nthw_hif.c', 'nthw/core/nthw_i2cm.c', 'nthw/core/nthw_iic.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +1 -0
@@ -17,6 +17,7 @@#include "nthw_iic.h" #include "nthw_i2cm.h" +#include "nthw_gpio_phy.h" #include "nthw_sdc.h" #include "nthw_si5340.h"
drivers/net/ntnic/nthw/core/include/nthw_gpio_phy.h new file +48 -0
48 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_gpio_phy.c new file +145 -0
145 lines not on this page · raw message
Signature · 1 line
2.43.0
PATCH v10 21/21 net/ntnic: add physical layer control module
In reply to Serhii IliushykAdds functionality to control the physical layer of the OSI model. This takes the form of the module
MAC PCS (Media Access Control Physical Coding Sublayer).
The functionality is used by the 100G link functionality to establish link.
---
v10
* Remove GTY_RX_BUF_STAT initialization
--- drivers/net/ntnic/include/nt4ga_link.h | 1 + .../link_mgmt/link_100g/nt4ga_link_100g.c | 393 +++++++- drivers/net/ntnic/meson.build | 1 + .../net/ntnic/nthw/core/include/nthw_core.h | 1 + .../ntnic/nthw/core/include/nthw_mac_pcs.h | 250 +++++ drivers/net/ntnic/nthw/core/nthw_mac_pcs.c | 864 ++++++++++++++++++ 6 files changed, 1508 insertions(+), 2 deletions(-) create mode 100644 drivers/net/ntnic/nthw/core/include/nthw_mac_pcs.h create mode 100644 drivers/net/ntnic/nthw/core/nthw_mac_pcs.c
drivers/net/ntnic/include/nt4ga_link.h +1 -0
@@ -78,6 +78,7 @@ typedef struct port_action_s {typedef struct adapter_100g_s {nim_i2c_ctx_t nim_ctx[NUM_ADAPTER_PORTS_MAX ];/* Should be the first field */ +nthw_mac_pcs_t mac_pcs100g[NUM_ADAPTER_PORTS_MAX ];nthw_gpio_phy_t gpio_phy[NUM_ADAPTER_PORTS_MAX ]; }adapter_100g_t ;
drivers/net/ntnic/link_mgmt/link_100g/nt4ga_link_100g.c +391 -2
499 lines not on this page · raw message
drivers/net/ntnic/meson.build +1 -0
@@ -38,6 +38,7 @@ sources = files( 'nthw/core/nthw_hif.c', 'nthw/core/nthw_i2cm.c', 'nthw/core/nthw_iic.c', + 'nthw/core/nthw_mac_pcs.c', 'nthw/core/nthw_pcie3.c', 'nthw/core/nthw_sdc.c', 'nthw/core/nthw_si5340.c',
drivers/net/ntnic/nthw/core/include/nthw_core.h +1 -0
@@ -18,6 +18,7 @@#include "nthw_i2cm.h" #include "nthw_gpio_phy.h" +#include "nthw_mac_pcs.h" #include "nthw_sdc.h" #include "nthw_si5340.h"
drivers/net/ntnic/nthw/core/include/nthw_mac_pcs.h new file +250 -0
250 lines not on this page · raw message
drivers/net/ntnic/nthw/core/nthw_mac_pcs.c new file +864 -0
864 lines not on this page · raw message
Signature · 1 line
2.43.0
Re: [PATCH v10 01/21] net/ntnic: add ethdev and makes PMD available
In reply to Serhii IliushykQuoted 5 lines · Serhii Iliushyk
Add initial ntnic ethdev skeleton and register PCI probe functions Update documentation: Device description and feature list
Signed-off-by Serhii Iliushyk <[email protected]>
For series,
Series applied to dpdk-next-net/main, thanks.
Re: [PATCH v10 01/21] net/ntnic: add ethdev and makes PMD available
Quoted 4 lines · Ferruh Yigit
Quoted 3 lines · Serhii Iliushyk
Add initial ntnic ethdev skeleton and register PCI probe functions Update documentation: Device description and feature list
Quoted 8 lines
Quoted 2 lines
Signed-off-by Serhii Iliushyk <[email protected]>For series,
Reviewed-by Ferruh Yigit <[email protected]>Series applied to dpdk-next-net/main, thanks.
Hi Serhii,
Thomas highlighted that some files in the driver missing SPDX tag, they can be viewed with './devtools/check-spdx-tag.sh' tool, can you please check them?
I am not sure about the auto-generated files, @Thomas and @Hemant can comment more, but at least for rest can you please send a patch to add license and copyright?
Re: [PATCH v10 01/21] net/ntnic: add ethdev and makes PMD available
23/07/2024 09:49, Ferruh Yigit:
Quoted 4 lines · Ferruh Yigit
Thomas highlighted that some files in the driver missing SPDX tag, they can be viewed with '
./devtools/check-spdx-tag.sh' tool, can you please check them?
When getting the next-net tree into main,
I've added exceptions for ntnic files in the script in order to continue using it for checking new patches.
I think it would be better to remove such exceptions.
Quoted 3 lines
I am not sure about the auto-generated files, @Thomas and @Hemant can comment more, but at least for rest can you please send a patch to add license and copyright?