Add support of NFP3800 chip and firmware with NFDk
cover Add support of NFP3800 chip and firmware with NFDk
NFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.
Chaoyong He (2):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration
Jin Liu (12):
net/nfp: remove pessimistic limit net/nfp: rename set MAC function
net/nfp: rename function and struct net/nfp: support NFP3800 card
net/nfp: support NFDK firmware
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: nfdk stop and close function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function net/nfp: modify RSS logic
drivers/net/nfp/nfp_common.c | 89 ++++- drivers/net/nfp/nfp_common.h | 53 ++- drivers/net/nfp/nfp_ctrl.h | 3 + drivers/net/nfp/nfp_ethdev.c | 423 +++++++++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 215 +++++++---- drivers/net/nfp/nfp_rxtx.c | 505 +++++++++++++++++++++++--- drivers/net/nfp/nfp_rxtx.h | 89 ++++- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 - drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 + 11 files changed, 1128 insertions(+), 309 deletions(-)
Signature · 1 line
2.27.0
PATCH 1/14 net/nfp: change the coding style
From: Chaoyong He <[email protected]>
Change the coding style of some logics, to make it more compatible with the DPDK coding style.
--- drivers/net/nfp/nfp_ethdev.c | 150 ++++++++++++++++---------------- drivers/net/nfp/nfp_ethdev_vf.c | 5 +- 2 files changed, 75 insertions(+), 80 deletions(-)
drivers/net/nfp/nfp_ethdev.c +73 -77
@@ -340,8 +340,7 @@ nfp_net_close(struct rte_eth_dev *dev)/* unregister callback func from eal lib */ rte_intr_callback_unregister (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)dev); + nfp_net_dev_interrupt_handler, (void *)dev);/* * The ixgbe PMD disables the pcie master on the
@@ -388,8 +387,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)struct nfp_pf_dev *pf_dev;struct nfp_net_hw *hw;struct rte_ether_addr *tmp_ether_addr; - -uint64_t tx_bar_off =0 , rx_bar_off =0 ; +uint64_t rx_bar_off =0 ; +uint64_t tx_bar_off =0 ;uint32_t start_q;int stride =4 ;int port =0 ;
@@ -404,9 +403,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " +"mask to 40 bits!\n" , pci_dev->device.name);return -ENODEV ; };
@@ -416,14 +414,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev)return -ENODEV ; } -/* Use PF array of physical ports to get pointer to +/* +* Use PF array of physical ports to get pointer to * this specific port */ hw = pf_dev->ports[port];PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " -"NFP internal port number: %d" , - port, hw->nfp_idx); +"NFP internal port number: %d" , port, hw->nfp_idx); eth_dev->dev_ops = &nfp_net_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count;
@@ -456,13 +454,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (port ==0 ) { hw->ctrl_bar = pf_dev->ctrl_bar; }else { -if (!pf_dev->ctrl_bar) +if (pf_dev->ctrl_bar ==NULL )return -ENODEV ; -/* Use port offset in pf ctrl_bar for this -* ports control bar -*/ - hw->ctrl_bar = pf_dev->ctrl_bar + - (port *NFP_PF_CSR_SLICE_SIZE ); +/* Use port offset in pf ctrl_bar for this ports control bar */ + hw->ctrl_bar = pf_dev->ctrl_bar + (port *NFP_PF_CSR_SLICE_SIZE ); }PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar);
@@ -557,8 +552,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) tmp_ether_addr = (struct rte_ether_addr *)&hw->mac_addr;if (!rte_is_valid_assigned_ether_addr (tmp_ether_addr)) { -PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , - port); +PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , port);/* Using random mac addresses for VFs */ rte_eth_random_addr (&hw->mac_addr[0 ]);nfp_net_write_mac (hw, (uint8_t *)&hw->mac_addr);
@@ -583,8 +577,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {/* Registering LSC interrupt handler */ rte_intr_callback_register (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)eth_dev); + nfp_net_dev_interrupt_handler, (void *)eth_dev);/* Telling the firmware about the LSC interrupt entry */ nn_cfg_writeb (hw,NFP_NET_CFG_LSC ,NFP_NET_IRQ_LSC_IDX );/* Recording current stats counters values */
@@ -656,8 +649,10 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) }static int -nfp_fw_setup (struct rte_pci_device *dev,struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table,struct nfp_hwinfo *hwinfo) +nfp_fw_setup (struct rte_pci_device *dev, +struct nfp_cpp *cpp, +struct nfp_eth_table *nfp_eth_table, +struct nfp_hwinfo *hwinfo) {struct nfp_nsp *nsp;const char *nfp_fw_model;
@@ -675,12 +670,12 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,if (nfp_eth_table->count ==0 || nfp_eth_table->count >8 ) {PMD_DRV_LOG (ERR ,"NFP ethernet table reports wrong ports: %u" , - nfp_eth_table->count); + nfp_eth_table->count);return -EIO ; }PMD_DRV_LOG (INFO ,"NFP ethernet port table reports %u ports" , - nfp_eth_table->count); + nfp_eth_table->count);PMD_DRV_LOG (INFO ,"Port speed: %u" , nfp_eth_table->ports[0 ].speed);
@@ -689,7 +684,7 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, nfp_eth_table->ports[0].speed / 1000); nsp =nfp_nsp_open (cpp); -if (!nsp) { +if (nsp ==NULL ) {PMD_DRV_LOG (ERR ,"NFP error when obtaining NSP handle" );return -EIO ; }
@@ -701,32 +696,32 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,return err; } -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev) +static int +nfp_init_phyports (struct nfp_pf_dev *pf_dev) { +int i; +int ret =0 ;struct nfp_net_hw *hw;struct rte_eth_dev *eth_dev; -struct nfp_eth_table *nfp_eth_table =NULL ; -int ret =0 ; -int i; +struct nfp_eth_table *nfp_eth_table; +char port_name[RTE_ETH_NAME_MAX_LEN ]; nfp_eth_table =nfp_eth_read_ports (pf_dev->cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); - ret = -EIO ; - goto error; +return -EIO ; }/* Loop through all physical ports on PF */ for (i =0 ; i < pf_dev->total_phyports; i++) {const unsigned int numa_node =rte_socket_id (); -char port_name[RTE_ETH_NAME_MAX_LEN ];snprintf (port_name,sizeof (port_name),"%s_port%d" , pf_dev->pci_dev->device.name, i);/* Allocate a eth_dev for this phyport */ eth_dev =rte_eth_dev_allocate (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) { ret = -ENODEV ; goto port_cleanup; }
@@ -734,8 +729,8 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate memory for this phyport */ eth_dev->data->dev_private =rte_zmalloc_socket (port_name,sizeof (struct nfp_net_hw ), -RTE_CACHE_LINE_SIZE , numa_node); -if (!eth_dev->data->dev_private) { +RTE_CACHE_LINE_SIZE , numa_node); +if (eth_dev->data->dev_private ==NULL ) { ret = -ENOMEM ;rte_eth_dev_release_port (eth_dev); goto port_cleanup;
@@ -759,7 +754,6 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)* nfp_net_init */ ret =nfp_net_init (eth_dev); -if (ret) { ret = -ENODEV ; goto port_cleanup;
@@ -782,24 +776,25 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev) } eth_table_cleanup:free (nfp_eth_table); -error: +return ret; } -static int nfp_pf_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_init (struct rte_pci_device *pci_dev) { -struct nfp_pf_dev *pf_dev =NULL ; +int err; +int ret =0 ; +int total_ports;struct nfp_cpp *cpp; +struct nfp_pf_dev *pf_dev;struct nfp_hwinfo *hwinfo; -struct nfp_rtsym_table *sym_tbl; -struct nfp_eth_table *nfp_eth_table =NULL ;char name[RTE_ETH_NAME_MAX_LEN ]; -int total_ports; -int ret = -ENODEV ; -int err; +struct nfp_rtsym_table *sym_tbl; +struct nfp_eth_table *nfp_eth_table; -if (!pci_dev) -return ret; +if (pci_dev ==NULL ) +return -ENODEV ;/* * When device bound to UIO, the device could be used, by mistake,
@@ -813,21 +808,21 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" ); ret = -EIO ; goto error; } hwinfo =nfp_hwinfo_read (cpp); -if (!hwinfo) { +if (hwinfo ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading hwinfo table" ); ret = -EIO ; goto error; } nfp_eth_table =nfp_eth_read_ports (cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); ret = -EIO ; goto hwinfo_cleanup;
@@ -841,7 +836,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Now the symbol table should be there */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" ); ret = -EIO ;
@@ -865,7 +860,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Allocate memory for the PF "device" */ snprintf (name,sizeof (name),"nfp_pf%d" ,0 ); pf_dev =rte_zmalloc (name,sizeof (*pf_dev),0 ); -if (!pf_dev) { +if (pf_dev ==NULL ) { ret = -ENOMEM ; goto sym_tbl_cleanup; }
@@ -883,9 +878,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Map the symbol table */ pf_dev->ctrl_bar =nfp_rtsym_map (pf_dev->sym_tbl,"_pf0_net_bar0" , - pf_dev->total_phyports *32768 , - &pf_dev->ctrl_area); -if (!pf_dev->ctrl_bar) { + pf_dev->total_phyports *32768 , &pf_dev->ctrl_area); +if (pf_dev->ctrl_bar ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for _pf0_net_ctrl_bar" ); ret = -EIO ; goto pf_cleanup;
@@ -895,10 +889,9 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* configure access to tx/rx vNIC BARs */ pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ), -NFP_QCP_QUEUE_AREA_SZ , - &pf_dev->hwqueues_area); -if (!pf_dev->hw_queues) { +NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + &pf_dev->hwqueues_area); +if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" ); ret = -EIO ; goto ctrl_area_cleanup;
@@ -906,7 +899,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"tx/rx bar address: 0x%p" , pf_dev->hw_queues); -/* Initialize and prep physical ports now +/* +* Initialize and prep physical ports now * This will loop through all physical ports */ ret =nfp_init_phyports (pf_dev);
@@ -941,15 +935,16 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)* is no need to initialise the PF again. Only minimal work is required * here */ -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_secondary_init (struct rte_pci_device *pci_dev) { -struct nfp_cpp *cpp; -struct nfp_rtsym_table *sym_tbl; -int total_ports;int i;int err; +int total_ports; +struct nfp_cpp *cpp; +struct nfp_rtsym_table *sym_tbl; -if (!pci_dev) +if (pci_dev ==NULL )return -ENODEV ;/*
@@ -964,7 +959,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" );return -EIO ; }
@@ -974,7 +969,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)* here so we have to read the number of ports from firmware */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" );return -EIO ;
@@ -989,13 +984,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)snprintf (port_name,sizeof (port_name),"%s_port%d" , pci_dev->device.name, i); -PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , - port_name); +PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , port_name); eth_dev =rte_eth_dev_attach_secondary (port_name); -if (!eth_dev) { -RTE_LOG (ERR ,EAL , -"secondary process attach failed, " -"ethdev doesn't exist" ); +if (eth_dev ==NULL ) { +RTE_LOG (ERR ,EAL ,"secondary process attach failed, " +"ethdev doesn't exist" );return -ENODEV ; } eth_dev->process_private = cpp;
@@ -1012,8 +1005,9 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return 0 ; } -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev) +static int +nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +struct rte_pci_device *dev) {if (rte_eal_process_type () ==RTE_PROC_PRIMARY )return nfp_pf_init (dev);
@@ -1035,7 +1029,8 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { }, }; -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev) +static int +nfp_pci_uninit (struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev;uint16_t port_id;
@@ -1052,7 +1047,8 @@ static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)return -ENOTSUP ; } -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev) +static int +eth_nfp_pci_remove (struct rte_pci_device *pci_dev) {return rte_eth_dev_pci_generic_remove (pci_dev, nfp_pci_uninit); }
drivers/net/nfp/nfp_ethdev_vf.c +2 -3
@@ -296,9 +296,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " +"mask to 40 bits!\n" , pci_dev->device.name);return -ENODEV ; };
Signature · 1 line
2.27.0
Re: [PATCH 01/14] net/nfp: change the coding style
Quoted 8 lines · Jin Liu
From: Chaoyong He <[email protected]>
Change the coding style of some logics, to make it more compatible with the DPDK coding style.
Signed-off-by Chaoyong He <[email protected]>Signed-off-by Jin Liu <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
drivers/net/nfp/nfp_ethdev.c nfp_net_init(struct rte_eth_dev *eth_dev) · line 407
Quoted 9 lines
drivers/net/nfp/nfp_ethdev.c +2
-3@@ -404,9 +403,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " +"mask to 40 bits!\n" , pci_dev->device.name);
Since you are updating this part, it may be better to not break the string, like:
RTE_LOG(ERR, PMD,
"device %s can not be used: restricted dma mask to 40 bits!\n", pci_dev->device.name);
<...>
Quoted 18 lines
drivers/net/nfp/nfp_ethdev.c +7
-5-static int nfp_init_phyports (struct nfp_pf_dev *pf_dev) +static int +nfp_init_phyports (struct nfp_pf_dev *pf_dev) { +int i; +int ret =0 ;struct nfp_net_hw *hw;struct rte_eth_dev *eth_dev; -struct nfp_eth_table *nfp_eth_table =NULL ; -int ret =0 ; -int i; +struct nfp_eth_table *nfp_eth_table; +char port_name[RTE_ETH_NAME_MAX_LEN ]; nfp_eth_table =nfp_eth_read_ports (pf_dev->cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {
drivers/net/nfp/nfp_ethdev.c nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, · line 722
Quoted 10 lines
drivers/net/nfp/nfp_ethdev.c +1
-3PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); - ret = -EIO ; - goto error; +return -EIO ; }/* Loop through all physical ports on PF */ for (i =0 ; i < pf_dev->total_phyports; i++) {const unsigned int numa_node =rte_socket_id (); -char port_name[RTE_ETH_NAME_MAX_LEN ];
No need to increase the scope of the variable 'port_name', above is valid for the coding convention.
<...>
Quoted 5 lines
drivers/net/nfp/nfp_ethdev.c +0
-1@@ -989,13 +984,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)snprintf (port_name,sizeof (port_name),"%s_port%d" , pci_dev->device.name, i); - PMD_DRV_LOG(DEBUG, "Secondary attaching to port %s",
drivers/net/nfp/nfp_ethdev.c static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev) · line 991
Quoted 10 lines
drivers/net/nfp/nfp_ethdev.c +4
-5- port_name); +PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , port_name); eth_dev =rte_eth_dev_attach_secondary (port_name); -if (!eth_dev) { -RTE_LOG (ERR ,EAL , -"secondary process attach failed, " -"ethdev doesn't exist" ); +if (eth_dev ==NULL ) { +RTE_LOG (ERR ,EAL ,"secondary process attach failed, " +"ethdev doesn't exist" );
Same here.
<...>
drivers/net/nfp/nfp_ethdev.c nfp_netvf_init(struct rte_eth_dev *eth_dev) · line 300
Quoted 9 lines
drivers/net/nfp/nfp_ethdev.c +2
-3@@ -296,9 +296,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " +"mask to 40 bits!\n" , pci_dev->device.name);
ditto
RE: [PATCH 01/14] net/nfp: change the coding style
Will do, thanks
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:52
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 01/14] net/nfp: change the coding style
Quoted 8 lines · Jin Liu
From: Chaoyong He <[email protected]>
Change the coding style of some logics, to make it more compatible with the DPDK coding style.
Signed-off-by Chaoyong He <[email protected]>Signed-off-by Jin Liu <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
drivers/net/nfp/nfp_ethdev.c nfp_net_init(struct rte_eth_dev *eth_dev) · line 407
Quoted 9 lines
drivers/net/nfp/nfp_ethdev.c +2
-3@@ -404,9 +403,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " +"mask to 40 bits!\n" , pci_dev->device.name);
Since you are updating this part, it may be better to not break the string, like:
RTE_LOG(ERR, PMD,
"device %s can not be used: restricted dma mask to 40 bits!\n", pci_dev->device.name);
<...>
Quoted 18 lines
drivers/net/nfp/nfp_ethdev.c +7
-5-static int nfp_init_phyports (struct nfp_pf_dev *pf_dev) +static int +nfp_init_phyports (struct nfp_pf_dev *pf_dev) { +int i; +int ret =0 ;struct nfp_net_hw *hw;struct rte_eth_dev *eth_dev; -struct nfp_eth_table *nfp_eth_table =NULL ; -int ret =0 ; -int i; +struct nfp_eth_table *nfp_eth_table; +char port_name[RTE_ETH_NAME_MAX_LEN ]; nfp_eth_table =nfp_eth_read_ports (pf_dev->cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {
drivers/net/nfp/nfp_ethdev.c nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, · line 722
Quoted 10 lines
drivers/net/nfp/nfp_ethdev.c +1
-3PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); - ret = -EIO ; - goto error; +return -EIO ; }/* Loop through all physical ports on PF */ for (i =0 ; i < pf_dev->total_phyports; i++) {const unsigned int numa_node =rte_socket_id (); -char port_name[RTE_ETH_NAME_MAX_LEN ];
No need to increase the scope of the variable 'port_name', above is valid for the coding convention.
<...>
Quoted 5 lines
drivers/net/nfp/nfp_ethdev.c +0
-1@@ -989,13 +984,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)snprintf (port_name,sizeof (port_name),"%s_port%d" , pci_dev->device.name, i); - PMD_DRV_LOG(DEBUG, "Secondary attaching to port %s",
drivers/net/nfp/nfp_ethdev.c static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev) · line 991
Quoted 10 lines
drivers/net/nfp/nfp_ethdev.c +4
-5- port_name); +PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , port_name); eth_dev =rte_eth_dev_attach_secondary (port_name); -if (!eth_dev) { -RTE_LOG (ERR ,EAL , -"secondary process attach failed, " -"ethdev doesn't exist" ); +if (eth_dev ==NULL ) { +RTE_LOG (ERR ,EAL ,"secondary process attach failed, " +"ethdev doesn't exist" );
Same here.
<...>
drivers/net/nfp/nfp_ethdev.c nfp_netvf_init(struct rte_eth_dev *eth_dev) · line 300
Quoted 9 lines
drivers/net/nfp/nfp_ethdev.c +2
-3@@ -296,9 +296,8 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " +"mask to 40 bits!\n" , pci_dev->device.name);
ditto
PATCH 2/14 net/nfp: remove unnecessary forward function declaration
In reply to Jin LiuFrom: Chaoyong He <[email protected]>
This commit remove some unnecessary forward function declarations.
--- drivers/net/nfp/nfp_ethdev.c | 22 ---------------------- drivers/net/nfp/nfp_ethdev_vf.c | 12 ------------ drivers/net/nfp/nfp_rxtx.c | 21 --------------------- 3 files changed, 55 deletions(-)
drivers/net/nfp/nfp_ethdev.c +0 -22
@@ -38,28 +38,6 @@#include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" - -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port); -static int nfp_net_start (struct rte_eth_dev *dev); -static int nfp_net_stop (struct rte_eth_dev *dev); -static int nfp_net_set_link_up (struct rte_eth_dev *dev); -static int nfp_net_set_link_down (struct rte_eth_dev *dev); -static int nfp_net_close (struct rte_eth_dev *dev); -static int nfp_net_init (struct rte_eth_dev *eth_dev); -static int nfp_fw_upload (struct rte_pci_device *dev, -struct nfp_nsp *nsp,char *card); -static int nfp_fw_setup (struct rte_pci_device *dev, -struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table, -struct nfp_hwinfo *hwinfo); -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev); -static int nfp_pf_init (struct rte_pci_device *pci_dev); -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev); -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev); -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev); -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port) {
drivers/net/nfp/nfp_ethdev_vf.c +0 -12
@@ -23,18 +23,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -static void nfp_netvf_read_mac (struct nfp_net_hw *hw); -static int nfp_netvf_start (struct rte_eth_dev *dev); -static int nfp_netvf_stop (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_up (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_down (struct rte_eth_dev *dev); -static int nfp_netvf_close (struct rte_eth_dev *dev); -static int nfp_netvf_init (struct rte_eth_dev *eth_dev); -static int nfp_vf_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *pci_dev); -static int eth_nfp_vf_pci_remove (struct rte_pci_device *pci_dev); -static void nfp_netvf_read_mac (struct nfp_net_hw *hw) {
drivers/net/nfp/nfp_rxtx.c +0 -21
@@ -21,27 +21,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -/* Prototypes */ -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq); -static inline void nfp_net_mbuf_alloc_failed (struct nfp_net_rxq *rxq); -static inline void nfp_net_set_hash (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mbuf); -static inline void nfp_net_rx_cksum (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mb); -static void nfp_net_rx_queue_release_mbufs (struct nfp_net_rxq *rxq); -static int nfp_net_tx_free_bufs (struct nfp_net_txq *txq); -static void nfp_net_tx_queue_release_mbufs (struct nfp_net_txq *txq); -static inline uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq); -static inline uint32_t nfp_net_txq_full (struct nfp_net_txq *txq); -static inline void nfp_net_tx_tso (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static inline void nfp_net_tx_cksum (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq) {
Signature · 1 line
2.27.0
PATCH 3/14 net/nfp: remove pessimistic limit
In reply to Jin LiuMultiple writes cause intermediate pointer values that do not end on complete TX descriptors.
The QCP peripheral on the NFP provides a number of access modes. In some access modes, the maximum amount to add must be restricted to a 6bit value. The particular access mode used by _nfp_qcp_ptr_add() has no such restrictions, so the "NFP_QCP_MAX_ADD" test is unnecessary.
Note that trying to add more that the configured ring size in a single add will cause a QCP overflow, caught and handled by the QCP peripheral.
--- drivers/net/nfp/nfp_common.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/nfp/nfp_common.h +1 -11
@@ -44,9 +44,6 @@ struct nfp_net_adapter;/* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) -/* Maximum value which can be added to a queue with one transaction */ -#define NFP_QCP_MAX_ADD 0x7f -/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -304,8 +301,6 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val)* @q: Base address for queue structure * @ptr: Add to the Read or Write pointer * @val: Value to add to the queue pointer -* -* If @val is greater than @NFP_QCP_MAX_ADD multiple writes are performed. */ static inline void nfp_qcp_ptr_add (uint8_t *q,enum nfp_qcp_ptr ptr,uint32_t val)
@@ -317,12 +312,7 @@ nfp_qcp_ptr_add(uint8_t *q, enum nfp_qcp_ptr ptr, uint32_t val)else off =NFP_QCP_QUEUE_ADD_WPTR ; -while (val >NFP_QCP_MAX_ADD ) { -nn_writel (rte_cpu_to_le_32 (NFP_QCP_MAX_ADD ), q + off); - val -=NFP_QCP_MAX_ADD ; -} - -nn_writel (rte_cpu_to_le_32 (val), q + off); +nn_writel (rte_cpu_to_le_32 (val), q + off); }/*
Signature · 1 line
2.27.0
PATCH 4/14 net/nfp: rename set MAC function
In reply to Jin LiuThe NFP eth driver function name start with 'nfp_net', but set_mac function start with 'nfp' only, rename it, be consistent with others.
--- drivers/net/nfp/nfp_common.c | 2 +- drivers/net/nfp/nfp_common.h | 2 +- drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/nfp/nfp_common.c +1 -1
@@ -267,7 +267,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) }int -nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) +nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) {struct nfp_net_hw *hw;uint32_t update, ctrl;
drivers/net/nfp/nfp_common.h +1 -1
@@ -347,7 +347,7 @@ void nfp_net_disable_queues(struct rte_eth_dev *dev);void nfp_net_params_setup (struct nfp_net_hw *hw);void nfp_eth_copy_mac (uint8_t *dst,const uint8_t *src);void nfp_net_write_mac (struct nfp_net_hw *hw,uint8_t *mac); -int nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +int nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr);int nfp_configure_rx_interrupt (struct rte_eth_dev *dev,struct rte_intr_handle *intr_handle);uint32_t nfp_check_offloads (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +1 -1
@@ -344,7 +344,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
drivers/net/nfp/nfp_ethdev_vf.c +1 -1
@@ -251,7 +251,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
Signature · 1 line
2.27.0
PATCH 5/14 net/nfp: rename function and struct
In reply to Jin LiuAdd 'nfd3' into the nfd3 firmware eth driver function name, preparation for the next work, as we will support another nfdk firmware version.
--- drivers/net/nfp/nfp_ethdev.c | 28 +++++++++---------- drivers/net/nfp/nfp_ethdev_vf.c | 26 +++++++++--------- drivers/net/nfp/nfp_rxtx.c | 48 ++++++++++++++++----------------- drivers/net/nfp/nfp_rxtx.h | 12 ++++----- 4 files changed, 57 insertions(+), 57 deletions(-)
drivers/net/nfp/nfp_ethdev.c +14 -14
@@ -179,7 +179,7 @@ nfp_net_start(struct rte_eth_dev *dev)/* Stop device: disable rx and tx functions to allow for reconfiguring. */ static int -nfp_net_stop (struct rte_eth_dev *dev) +nfp_net_nfd3_stop (struct rte_eth_dev *dev) {int i;struct nfp_net_hw *hw;
@@ -195,7 +195,7 @@ nfp_net_stop(struct rte_eth_dev *dev)/* Clear queues */ for (i =0 ; i < dev->data->nb_tx_queues; i++) { this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); +nfp_net_nfd3_reset_tx_queue (this_tx_q); }for (i =0 ; i < dev->data->nb_rx_queues; i++) {
@@ -251,7 +251,7 @@ nfp_net_set_link_down(struct rte_eth_dev *dev)/* Reset and stop device. The device can not be restarted. */ static int -nfp_net_close (struct rte_eth_dev *dev) +nfp_net_nfd3_close (struct rte_eth_dev *dev) {struct nfp_net_hw *hw;struct rte_pci_device *pci_dev;
@@ -279,8 +279,8 @@ nfp_net_close(struct rte_eth_dev *dev)/* Clear queues */ for (i =0 ; i < dev->data->nb_tx_queues; i++) { this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); +nfp_net_nfd3_reset_tx_queue (this_tx_q); +nfp_net_nfd3_tx_queue_release (dev, i); }for (i =0 ; i < dev->data->nb_rx_queues; i++) {
@@ -329,13 +329,13 @@ nfp_net_close(struct rte_eth_dev *dev) }/* Initialise and register driver with DPDK Application */ -static const struct eth_dev_ops nfp_net_eth_dev_ops = { +static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, - .dev_stop = nfp_net_stop, + .dev_stop = nfp_net_nfd3_stop, .dev_set_link_up = nfp_net_set_link_up, .dev_set_link_down = nfp_net_set_link_down, - .dev_close = nfp_net_close, + .dev_close = nfp_net_nfd3_close, .promiscuous_enable = nfp_net_promisc_enable, .promiscuous_disable = nfp_net_promisc_disable, .link_update = nfp_net_link_update,
@@ -352,8 +352,8 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, - .tx_queue_release = nfp_net_tx_queue_release, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, + .tx_queue_release = nfp_net_nfd3_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable, };
@@ -401,10 +401,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " "NFP internal port number: %d" , port, hw->nfp_idx); - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -970,10 +970,10 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return -ENODEV ; } eth_dev->process_private = cpp; - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;rte_eth_dev_probing_finish (eth_dev); }
drivers/net/nfp/nfp_ethdev_vf.c +13 -13
@@ -143,7 +143,7 @@ nfp_netvf_start(struct rte_eth_dev *dev) }static int -nfp_netvf_stop (struct rte_eth_dev *dev) +nfp_netvf_nfd3_stop (struct rte_eth_dev *dev) {struct nfp_net_txq *this_tx_q;struct nfp_net_rxq *this_rx_q;
@@ -156,7 +156,7 @@ nfp_netvf_stop(struct rte_eth_dev *dev)/* Clear queues */ for (i =0 ; i < dev->data->nb_tx_queues; i++) { this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); +nfp_net_nfd3_reset_tx_queue (this_tx_q); }for (i =0 ; i < dev->data->nb_rx_queues; i++) {
@@ -182,7 +182,7 @@ nfp_netvf_set_link_down(struct rte_eth_dev *dev __rte_unused)/* Reset and stop device. The device can not be restarted. */ static int -nfp_netvf_close (struct rte_eth_dev *dev) +nfp_netvf_nfd3_close (struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev;struct nfp_net_txq *this_tx_q;
@@ -206,8 +206,8 @@ nfp_netvf_close(struct rte_eth_dev *dev)/* Clear queues */ for (i =0 ; i < dev->data->nb_tx_queues; i++) { this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); +nfp_net_nfd3_reset_tx_queue (this_tx_q); +nfp_net_nfd3_tx_queue_release (dev, i); }for (i =0 ; i < dev->data->nb_rx_queues; i++) {
@@ -236,13 +236,13 @@ nfp_netvf_close(struct rte_eth_dev *dev) }/* Initialise and register VF driver with DPDK Application */ -static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { +static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_netvf_start, - .dev_stop = nfp_netvf_stop, + .dev_stop = nfp_netvf_nfd3_stop, .dev_set_link_up = nfp_netvf_set_link_up, .dev_set_link_down = nfp_netvf_set_link_down, - .dev_close = nfp_netvf_close, + .dev_close = nfp_netvf_nfd3_close, .promiscuous_enable = nfp_net_promisc_enable, .promiscuous_disable = nfp_net_promisc_disable, .link_update = nfp_net_link_update,
@@ -259,8 +259,8 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, - .tx_queue_release = nfp_net_tx_queue_release, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, + .tx_queue_release = nfp_net_nfd3_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable, };
@@ -291,10 +291,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); - eth_dev->dev_ops = &nfp_netvf_eth_dev_ops; + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -467,7 +467,7 @@ static const struct rte_pci_id pci_id_nfp_vf_net_map[] = {static int nfp_vf_pci_uninit (struct rte_eth_dev *eth_dev) {/* VF cleanup, just free private port data */ -return nfp_netvf_close (eth_dev); +return nfp_netvf_nfd3_close (eth_dev); } static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
drivers/net/nfp/nfp_rxtx.c +24 -24
162 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +6 -6
@@ -53,7 +53,7 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) -struct nfp_net_tx_desc { +struct nfp_net_nfd3_tx_desc { union { struct { uint8_t dma_addr_hi; /* High bits of host buf address */
@@ -124,7 +124,7 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_tx_desc *txds; +struct nfp_net_nfd3_tx_desc *txds;/* * At this point 48 bytes have been used for all the fields in the
@@ -284,12 +284,12 @@ int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_rxconf *rx_conf, struct rte_mempool *mp); -void nfp_net_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx); -void nfp_net_reset_tx_queue (struct nfp_net_txq *txq); -int nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +void nfp_net_nfd3_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx); +void nfp_net_nfd3_reset_tx_queue (struct nfp_net_txq *txq); +int nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf); -uint16_t nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */
Signature · 1 line
2.27.0
PATCH 6/14 net/nfp: support NFP3800 card
In reply to Jin LiuAdd support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
--- drivers/net/nfp/nfp_common.h | 33 +++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 ++++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 ++++++++++++---- 5 files changed, 79 insertions(+), 13 deletions(-)
drivers/net/nfp/nfp_common.h +31 -2
@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803#define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000#define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 -#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 +#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003/* Include NFP4000VF */ /* Forward declaration */ struct nfp_net_adapter ;
@@ -41,8 +43,16 @@ struct nfp_net_adapter;#define NFP_QCP_QUEUE_STS_HI 0x000c#define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask (0x3ffff) +#define NFP_PCIE_QCP_NFP3800_OFFSET 0x400000 +#define NFP_PCIE_QCP_NFP6000_OFFSET 0x80000 +#define NFP_PCIE_QUEUE_NFP3800_MASK 0x1ff +#define NFP_PCIE_QUEUE_NFP6000_MASK 0xff +#define NFP_PCIE_QCP_PF_OFFSET 0x0 +#define NFP_PCIE_QCP_VF_OFFSET 0x0 +/* The offset of the queue controller queues in the PCIe Target */ -#define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) +#define NFP_PCIE_QUEUE (_offset, _q, _mask) \ + ((_offset) + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & (_mask))))/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -339,6 +349,25 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr)return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +static inline uint32_t nfp_pci_queue (struct rte_pci_device *pdev,uint16_t queue) +{ +switch (pdev->id.device_id) { +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +case PCI_DEVICE_ID_NFP3800_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); +case PCI_DEVICE_ID_NFP6000_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +default : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); + } +} +/* Prototypes for common NFP functions */ int nfp_net_reconfig (struct nfp_net_hw *hw,uint32_t ctrl,uint32_t update);int nfp_net_configure (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +25 -3
@@ -445,12 +445,13 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC :case PCI_DEVICE_ID_NFP4000_PF_NIC :case PCI_DEVICE_ID_NFP6000_PF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -763,6 +764,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) {int err;int ret =0 ; +uint64_t addr;int total_ports;struct nfp_cpp *cpp;struct nfp_pf_dev *pf_dev;
@@ -866,8 +868,24 @@ nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , pf_dev->ctrl_bar);/* configure access to tx/rx vNIC BARs */ +switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP3800_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP3800_MASK ); +break ; +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP6000_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP6000_MASK ); +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no device ID matching" ); + err = -ENODEV ; + goto ctrl_area_cleanup; + } + pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + addr,NFP_QCP_QUEUE_AREA_SZ , &pf_dev->hwqueues_area);if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" );
@@ -994,6 +1012,10 @@ nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_PF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP4000_PF_NIC )
drivers/net/nfp/nfp_ethdev_vf.c +7 -2
@@ -326,11 +326,12 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_VF_NIC :case PCI_DEVICE_ID_NFP6000_VF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -455,6 +456,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) }static const struct rte_pci_id pci_id_nfp_vf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_VF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP6000_VF_NIC )
drivers/net/nfp/nfpcore/nfp_cpp.h +1 -1
@@ -214,7 +214,7 @@ void nfp_cpp_free(struct nfp_cpp *cpp);* @return true if model is in the NFP6000 family, false otherwise. */ #define NFP_CPP_MODEL_IS_6000 (model) \ - ((NFP_CPP_MODEL_CHIP_of(model) >= 0x4000) && \ + ((NFP_CPP_MODEL_CHIP_of(model) >= 0x3800) && \ (NFP_CPP_MODEL_CHIP_of(model) < 0x7000))/*
drivers/net/nfp/nfpcore/nfp_nsp_eth.c +15 -5
@@ -266,6 +266,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)struct nfp_eth_table *table;uint32_t table_sz;int i, j, ret, cnt =0 ; +const struct rte_ether_addr *mac; entries =malloc (NSP_ETH_TABLE_SIZE );if (!entries)
@@ -278,9 +279,15 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) goto err; } -for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +/* The NFP3800 NIC support 8 ports, but only 2 ports are valid, +* the rest 6 ports mac are all 0, ensure we don't use these port +*/ +for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac))) cnt++; + }/* Some versions of flash will give us 0 instead of port count. For * those that give a port count, verify it against the value calculated
@@ -299,10 +306,13 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)memset (table,0 , table_sz); table->count = cnt; -for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac)))nfp_eth_port_translate (nsp, &entries[i], i, - &table->ports[j++]); + &table->ports[j++]); + }nfp_eth_calc_port_geometry (table);for (i =0 ; i < (int )table->count; i++)
Signature · 1 line
2.27.0
Re: [PATCH 06/14] net/nfp: support NFP3800 card
Quoted 21 lines · Jin Liu
Add support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
Signed-off-by Jin Liu<[email protected]>Signed-off-by Diana Wang<[email protected]>Signed-off-by Peng Zhang<[email protected]>Signed-off-by Chaoyong He<[email protected]>Signed-off-by Niklas Söderlund<[email protected]>--- drivers/net/nfp/nfp_common.h | 33 +++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 ++++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 ++++++++++++---- 5 files changed, 79 insertions(+), 13 deletions(-)drivers/net/nfp/nfp_common.h +0
-0
drivers/net/nfp/nfp_common.h line 20
Quoted 5 lines
drivers/net/nfp/nfp_common.h +2
-0@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803
Can you please document new device support both in the driver doc and release notes?
RE: [PATCH 06/14] net/nfp: support NFP3800 card
Will do, thanks
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:53
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 06/14] net/nfp: support NFP3800 card
Quoted 21 lines · Jin Liu
Add support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
Signed-off-by Jin Liu<[email protected]>Signed-off-by Diana Wang<[email protected]>Signed-off-by Peng Zhang<[email protected]>Signed-off-by Chaoyong He<[email protected]>Signed-off-by Niklas Söderlund<[email protected]>--- drivers/net/nfp/nfp_common.h | 33 +++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 ++++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 ++++++++++++---- 5 files changed, 79 insertions(+), 13 deletions(-)(quoted diff) +0
-0
b/drivers/net/nfp/nfp_common.hindex1dd230bcc6..346fece527100644
drivers/net/nfp/nfp_common.h line 20
Quoted 5 lines
drivers/net/nfp/nfp_common.h +2
-0@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803
Can you please document new device support both in the driver doc and release notes?
PATCH 7/14 net/nfp: support NFDK firmware
In reply to Jin LiuModify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
--- drivers/net/nfp/nfp_ctrl.h | 2 ++ drivers/net/nfp/nfp_ethdev.c | 51 ++++++++++++++++++++++++++------- drivers/net/nfp/nfp_ethdev_vf.c | 37 +++++++++++++++++------- 3 files changed, 69 insertions(+), 21 deletions(-)
drivers/net/nfp/nfp_ctrl.h +2 -0
@@ -135,6 +135,8 @@* - define more STS bits */ #define NFP_NET_CFG_VERSION 0x0030 +#define NFP_NET_CFG_VERSION_DP_NFD3 0 +#define NFP_NET_CFG_VERSION_DP_NFDK 1#define NFP_NET_CFG_VERSION_RESERVED_MASK (0xff << 24)#define NFP_NET_CFG_VERSION_CLASS_MASK (0xff << 16)#define NFP_NET_CFG_VERSION_CLASS (x) (((x) & 0xff) << 16)
drivers/net/nfp/nfp_ethdev.c +40 -11
94 lines not on this page · raw message
drivers/net/nfp/nfp_ethdev_vf.c +27 -10
@@ -287,7 +287,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)RTE_LOG (ERR ,PMD ,"device %s can not be used: restricted dma " "mask to 40 bits!\n" , pci_dev->device.name);return -ENODEV ; - }; + } hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);
@@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr; +if (hw->ctrl_bar ==NULL ) { +PMD_DRV_LOG (ERR , +"hw->ctrl_bar is NULL. BAR0 not configured" ); +return -ENODEV ; + } + +PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar); + + hw->ver =nn_cfg_readl (hw,NFP_NET_CFG_VERSION ); + +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : +if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) { +PMD_DRV_LOG (ERR ,"NFDK must use ABI 5 or newer,found: %d" , +NFD_CFG_MAJOR_VERSION_of (hw->ver)); +return -EINVAL ; + } +break ; +default : +PMD_DRV_LOG (ERR ,"The version of firmware is not correct." ); +return -EINVAL ; + } +/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ;
@@ -312,15 +338,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) pci_dev->addr.domain, pci_dev->addr.bus, pci_dev->addr.devid, pci_dev->addr.function); - hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr; -if (hw->ctrl_bar ==NULL ) { -PMD_DRV_LOG (ERR , -"hw->ctrl_bar is NULL. BAR0 not configured" ); -return -ENODEV ; - } - -PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar); - hw->max_rx_queues =nn_cfg_readl (hw,NFP_NET_CFG_MAX_RXRINGS ); hw->max_tx_queues =nn_cfg_readl (hw,NFP_NET_CFG_MAX_TXRINGS );
Signature · 1 line
2.27.0
Re: [PATCH 07/14] net/nfp: support NFDK firmware
Quoted 3 lines · Jin Liu
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
Creating a new set of dev_ops for new FW is a way and it works, but it looks like it creates some duplication of the code, and maintaining multiple dev_ops can be difficult (driver already has different ones for PF & VF).
Another option can be keeping ethdev interface same, but manage different FWs closer to FW, where directly interacted with FW. Like keeping dev_ops as 'nfp_net_tx_queue_release()' and managing different FW within this function, instead of having two dev_ops, 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'.
If difference is small, this can be better to reduce duplication.
What is the difference between two FWs, as far as I can see Tx descriptor is different and queue setup is affected, is it only diff?
Quoted 5 lines
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
Quoted 20 lines
drivers/net/nfp/nfp_ethdev_vf.c +16
-0@@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr; +if (hw->ctrl_bar ==NULL ) { +PMD_DRV_LOG (ERR , +"hw->ctrl_bar is NULL. BAR0 not configured" ); +return -ENODEV ; + } + +PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar); + + hw->ver =nn_cfg_readl (hw,NFP_NET_CFG_VERSION ); + +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : +if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
drivers/net/nfp/nfp_ethdev_vf.c nfp_netvf_init(struct rte_eth_dev *eth_dev) · line 324
Quoted 10 lines
drivers/net/nfp/nfp_ethdev_vf.c +10
-0+PMD_DRV_LOG (ERR ,"NFDK must use ABI 5 or newer,found: %d" , +NFD_CFG_MAJOR_VERSION_of (hw->ver)); +return -EINVAL ; + } +break ; +default : +PMD_DRV_LOG (ERR ,"The version of firmware is not correct." ); +return -EINVAL ; + } +
This part seems extracted to its own function for PF ('nfp_net_ethdev_ops_mount()'), why not do the same for VF, to have same logic between them.
RE: [PATCH 07/14] net/nfp: support NFDK firmware
We also want to just use one function 'nfp_net_tx_queue_release()' to service both NFD3 and NFDk, But we can not get the version of NFD in function 'nfp_net_tx_queue_release()', now get NFD version through 'hw->ver'
For the function 'nfp_net_ethdev_ops_mount()', the logic below is in two different C files, nfp_ethdev.c and nfp_ethdev_vf.c And the variable of struct eth_dev_ops is defined as static, if we want to use function both in nfp_ethdev.c and nfp_ethdev_vf.c We need to change the eth_dev_ops variable as non-static, this is not we want.
> + switch (NFD_CFG_CLASS_VER_of(hw->ver)) {
> + case NFP_NET_CFG_VERSION_DP_NFD3:
> + break;
> + case NFP_NET_CFG_VERSION_DP_NFDK:
> + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) {
> + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d",
> + NFD_CFG_MAJOR_VERSION_of(hw->ver));
> + return -EINVAL;
> + }
> + break;
> + default:
> + PMD_DRV_LOG(ERR, "The version of firmware is not correct.");
> + return -EINVAL;-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware
Quoted 3 lines · Jin Liu
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
Creating a new set of dev_ops for new FW is a way and it works, but it looks like it creates some duplication of the code, and maintaining multiple dev_ops can be difficult (driver already has different ones for PF & VF).
Another option can be keeping ethdev interface same, but manage different FWs closer to FW, where directly interacted with FW.
Like keeping dev_ops as 'nfp_net_tx_queue_release()' and managing different FW within this function, instead of having two dev_ops, 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'. If difference is small, this can be better to reduce duplication.
What is the difference between two FWs, as far as I can see Tx descriptor is different and queue setup is affected, is it only diff?
Quoted 5 lines
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
Quoted 20 lines
drivers/net/nfp/nfp_ethdev_vf.c +16
-0@@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr; +if (hw->ctrl_bar ==NULL ) { +PMD_DRV_LOG (ERR , +"hw->ctrl_bar is NULL. BAR0 not configured" ); +return -ENODEV ; + } + +PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar); + + hw->ver =nn_cfg_readl (hw,NFP_NET_CFG_VERSION ); + +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : +if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
drivers/net/nfp/nfp_ethdev_vf.c nfp_netvf_init(struct rte_eth_dev *eth_dev) · line 324
Quoted 10 lines
drivers/net/nfp/nfp_ethdev_vf.c +10
-0+PMD_DRV_LOG (ERR ,"NFDK must use ABI 5 or newer,found: %d" , +NFD_CFG_MAJOR_VERSION_of (hw->ver)); +return -EINVAL ; + } +break ; +default : +PMD_DRV_LOG (ERR ,"The version of firmware is not correct." ); +return -EINVAL ; + } +
This part seems extracted to its own function for PF ('nfp_net_ethdev_ops_mount()'), why not do the same for VF, to have same logic between them.
Re: [PATCH 07/14] net/nfp: support NFDK firmware
Quoted 2 lines · Kevin Liu
We also want to just use one function '
nfp_net_tx_queue_release()' to service both NFD3 and NFDk, But we can not get the version of NFD in function 'nfp_net_tx_queue_release()', now get NFD version through 'hw->ver'
Again, it is up to you, but it should be possible to add 'dev' or 'hw' reference to the queue struct, to be able to access the version information. And it can be possible to have something like 'struct fw_ops', set it during initialization and use in rest of the dev_ops.
Quoted 16 lines
For the function '
nfp_net_ethdev_ops_mount()', the logic below is in two different C files,nfp_ethdev.candnfp_ethdev_vf.cAnd the variable of structeth_dev_opsis defined as static, if we want to use function both innfp_ethdev.candnfp_ethdev_vf.cWe need to change theeth_dev_opsvariable as non-static, this is not we want.> + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { > + case NFP_NET_CFG_VERSION_DP_NFD3: > + break; > + case NFP_NET_CFG_VERSION_DP_NFDK: > + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) { > + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d", > + NFD_CFG_MAJOR_VERSION_of(hw->ver)); > + return -EINVAL; > + } > + break; > + default: > + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); > + return -EINVAL;
My comment was to extract the logic into its own function as it is done is PF, so to have something like 'nfp_netvf_ethdev_ops_mount()'.
Quoted 62 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmwareQuoted 3 lines · Jin Liu
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
Creating a new set of
dev_opsfor new FW is a way and it works, but it looks like it creates some duplication of the code, and maintaining multipledev_opscan be difficult (driver already has different ones for PF & VF).Another option can be keeping ethdev interface same, but manage different FWs closer to FW, where directly interacted with FW.
Like keepingdev_opsas 'nfp_net_tx_queue_release()' and managing different FW within this function, instead of having twodev_ops, 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'. If difference is small, this can be better to reduce duplication.What is the difference between two FWs, as far as I can see Tx descriptor is different and queue setup is affected, is it only diff?
Quoted 5 lines
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]><...>
Quoted 20 lines
drivers/net/nfp/nfp_ethdev_vf.c +16
-0@@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr; +if (hw->ctrl_bar ==NULL ) { +PMD_DRV_LOG (ERR , +"hw->ctrl_bar is NULL. BAR0 not configured" ); +return -ENODEV ; + } + +PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar); + + hw->ver =nn_cfg_readl (hw,NFP_NET_CFG_VERSION ); + +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : +if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {drivers/net/nfp/nfp_ethdev_vf.c nfp_netvf_init(struct rte_eth_dev *eth_dev) · line 324
Quoted 10 lines
drivers/net/nfp/nfp_ethdev_vf.c +10
-0+PMD_DRV_LOG (ERR ,"NFDK must use ABI 5 or newer,found: %d" , +NFD_CFG_MAJOR_VERSION_of (hw->ver)); +return -EINVAL ; + } +break ; +default : +PMD_DRV_LOG (ERR ,"The version of firmware is not correct." ); +return -EINVAL ; + } +This part seems extracted to its own function for PF ('
nfp_net_ethdev_ops_mount()'), why not do the same for VF, to have same logic between them.
RE: [PATCH 07/14] net/nfp: support NFDK firmware
Now, I modify logic, just keep 'nfp_net_tx_queue_release()', delete 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'
Quoted 1 line
Quoted 1 line
Quoted 1 line
My comment was to extract the logic into its own function as it is done is PF, so to have something like '
nfp_netvf_ethdev_ops_mount()'.
the logic I just use once in nfp_ethdev_vf.c, so not create a function. I will create 'nfp_netvf_ethdev_ops_mount()' in nfp_ethdev_vf.c later
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, June 14, 2022 17:22
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware
Quoted 2 lines · Kevin Liu
We also want to just use one function '
nfp_net_tx_queue_release()' to service both NFD3 and NFDk, But we can not get the version of NFD in function 'nfp_net_tx_queue_release()', now get NFD version through 'hw->ver'
Again, it is up to you, but it should be possible to add 'dev' or 'hw'
reference to the queue struct, to be able to access the version information.
And it can be possible to have something like 'struct fw_ops', set it during initialization and use in rest of the dev_ops.
Quoted 16 lines
For the function '
nfp_net_ethdev_ops_mount()', the logic below is in two different C files,nfp_ethdev.candnfp_ethdev_vf.cAnd the variable of structeth_dev_opsis defined as static, if we want to use function both innfp_ethdev.candnfp_ethdev_vf.cWe need to change theeth_dev_opsvariable as non-static, this is not we want.> + switch (NFD_CFG_CLASS_VER_of(hw->ver)) { > + case NFP_NET_CFG_VERSION_DP_NFD3: > + break; > + case NFP_NET_CFG_VERSION_DP_NFDK: > + if (NFD_CFG_MAJOR_VERSION_of(hw->ver) < 5) { > + PMD_DRV_LOG(ERR, "NFDK must use ABI 5 or newer,found: %d", > + NFD_CFG_MAJOR_VERSION_of(hw->ver)); > + return -EINVAL; > + } > + break; > + default: > + PMD_DRV_LOG(ERR, "The version of firmware is not correct."); > + return -EINVAL;
My comment was to extract the logic into its own function as it is done is PF, so to have something like 'nfp_netvf_ethdev_ops_mount()'.
Quoted 62 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmwareQuoted 3 lines · Jin Liu
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
Creating a new set of
dev_opsfor new FW is a way and it works, but it looks like it creates some duplication of the code, and maintaining multipledev_opscan be difficult (driver already has different ones for PF & VF).Another option can be keeping ethdev interface same, but manage different FWs closer to FW, where directly interacted with FW.
Like keepingdev_opsas 'nfp_net_tx_queue_release()' and managing different FW within this function, instead of having twodev_ops, 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'. If difference is small, this can be better to reduce duplication.What is the difference between two FWs, as far as I can see Tx descriptor is different and queue setup is affected, is it only diff?
Quoted 5 lines
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]><...>
Quoted 20 lines
drivers/net/nfp/nfp_ethdev_vf.c +16
-0@@ -296,6 +296,32 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; + hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr; +if (hw->ctrl_bar ==NULL ) { +PMD_DRV_LOG (ERR , +"hw->ctrl_bar is NULL. BAR0 not configured" ); +return -ENODEV ; + } + +PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar); + + hw->ver =nn_cfg_readl (hw,NFP_NET_CFG_VERSION ); + +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : +if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {drivers/net/nfp/nfp_ethdev_vf.c nfp_netvf_init(struct rte_eth_dev *eth_dev) · line 324
Quoted 10 lines
drivers/net/nfp/nfp_ethdev_vf.c +10
-0+PMD_DRV_LOG (ERR ,"NFDK must use ABI 5 or newer,found: %d" , +NFD_CFG_MAJOR_VERSION_of (hw->ver)); +return -EINVAL ; + } +break ; +default : +PMD_DRV_LOG (ERR ,"The version of firmware is not correct." ); +return -EINVAL ; + } +This part seems extracted to its own function for PF ('
nfp_net_ethdev_ops_mount()'), why not do the same for VF, to have same logic between them.
PATCH 8/14 net/nfp: structure adjustment
In reply to Jin LiuAdd and modify the nfp PMD struct and macro that will be used by NFDK firmware.
--- drivers/net/nfp/nfp_rxtx.h | 69 +++++++++++++++++++++++++++++++++++--- 1 file changed, 65 insertions(+), 4 deletions(-)
drivers/net/nfp/nfp_rxtx.h +65 -4
@@ -53,6 +53,31 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) +#define NFDK_TX_MAX_DATA_PER_HEAD 0x00001000 +#define NFDK_DESC_TX_DMA_LEN_HEAD 0x0fff +#define NFDK_DESC_TX_TYPE_HEAD 0xf000 +#define NFDK_DESC_TX_DMA_LEN 0x3fff +#define NFDK_TX_DESC_PER_SIMPLE_PKT 2 +#define NFDK_DESC_TX_TYPE_TSO 2 +#define NFDK_DESC_TX_TYPE_SIMPLE 8 +#define NFDK_DESC_TX_TYPE_GATHER 1 +#define NFDK_DESC_TX_EOP BIT(14) +#define NFDK_DESC_TX_L4_CSUM BIT(1) +#define NFDK_DESC_TX_L3_CSUM BIT(0) + +#define NFDK_TX_MAX_DATA_PER_DESC 0x00004000 +#define NFDK_TX_DESC_GATHER_MAX 17 +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) +#define NFDK_TX_DESC_BLOCK_SZ 256 +#define NFDK_TX_DESC_BLOCK_CNT (NFDK_TX_DESC_BLOCK_SZ / \ + sizeof(struct nfp_net_nfdk_tx_desc)) +#define NFDK_TX_DESC_STOP_CNT (NFDK_TX_DESC_BLOCK_CNT * \ + NFDK_TX_DESC_PER_SIMPLE_PKT) +#define NFDK_TX_MAX_DATA_PER_BLOCK 0x00010000 +#define D_BLOCK_CPL (idx) (NFDK_TX_DESC_BLOCK_CNT - \ + (idx) % NFDK_TX_DESC_BLOCK_CNT) +#define D_IDX (ring, idx) ((idx) & ((ring)->tx_count - 1)) + struct nfp_net_nfd3_tx_desc { union { struct {
@@ -84,6 +109,33 @@ struct nfp_net_nfd3_tx_desc { }; }; +struct nfp_net_nfdk_tx_desc { +union { +struct { +__le16 dma_addr_hi;/* High bits of host buf address */ +__le16 dma_len_type;/* Length to DMA for this desc */ +__le32 dma_addr_lo;/* Low 32bit of host buf addr */ + }; + +struct { +__le16 mss;/* MSS to be used for LSO */ +uint8_t lso_hdrlen;/* LSO, TCP payload offset */ +uint8_t lso_totsegs;/* LSO, total segments */ +uint8_t l3_offset;/* L3 header offset */ +uint8_t l4_offset;/* L4 header offset */ +__le16 lso_meta_res;/* Rsvd bits in TSO metadata */ + }; + +struct { +uint8_t flags;/* TX Flags, see @NFDK_DESC_TX_* */ +uint8_t reserved[7 ];/* meta byte placeholder */ + }; + +__le32 vals[2 ]; +__le64 raw; + }; +}; +struct nfp_net_txq {struct nfp_net_hw *hw;/* Backpointer to nfp_net structure */
@@ -114,9 +166,14 @@ struct nfp_net_txq {* For each descriptor keep a reference to the mbuf and * DMA address used until completion is signalled. */ -struct { -struct rte_mbuf *mbuf; - } *txbufs; +union { +struct { +struct rte_mbuf *mbuf; + } *txbufs; +struct { +struct rte_mbuf *mbuf; + } *ktxbufs; + };/* * Information about the host side queue location. @txds is
@@ -124,7 +181,10 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_nfd3_tx_desc *txds; +union { +struct nfp_net_nfd3_tx_desc *txds; +struct nfp_net_nfdk_tx_desc *ktxds; + };/* * At this point 48 bytes have been used for all the fields in the
@@ -137,6 +197,7 @@ struct nfp_net_txq {uint32_t tx_hthresh;/* not used by now. Future? */ uint32_t tx_wthresh;/* not used by now. Future? */ uint16_t port_id; +uint16_t data_pending;/* used by nfdk only */ int qidx;int tx_qcidx;__le64 dma;
Signature · 1 line
2.27.0
Re: [PATCH 08/14] net/nfp: structure adjustment
Quoted 8 lines · Jin Liu
Add and modify the nfp PMD struct and macro that will be used by NFDK firmware.
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
Quoted 4 lines
drivers/net/nfp/nfp_rxtx.h +0
-0@@ -114,9 +166,14 @@ struct nfp_net_txq {* For each descriptor keep a reference to the mbuf and * DMA address used until completion is signalled. */
drivers/net/nfp/nfp_rxtx.h struct nfp_net_txq { · line 175
Quoted 10 lines
drivers/net/nfp/nfp_rxtx.h +7
-3-struct { -struct rte_mbuf *mbuf; - } *txbufs; +union { +struct { +struct rte_mbuf *mbuf; + } *txbufs; +struct { +struct rte_mbuf *mbuf; + } *ktxbufs;
What is the point of this union? Both structs are same.
RE: [PATCH 08/14] net/nfp: structure adjustment
We want to distinguish between NFD3 and NFDk, and maybe it is not necessary, I will update it, thanks
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 08/14] net/nfp: structure adjustment
Quoted 8 lines · Jin Liu
Add and modify the nfp PMD struct and macro that will be used by NFDK firmware.
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
Quoted 4 lines
drivers/net/nfp/nfp_rxtx.h +0
-0@@ -114,9 +166,14 @@ struct nfp_net_txq {* For each descriptor keep a reference to the mbuf and * DMA address used until completion is signalled. */
drivers/net/nfp/nfp_rxtx.h struct nfp_net_txq { · line 175
Quoted 10 lines
drivers/net/nfp/nfp_rxtx.h +7
-3-struct { -struct rte_mbuf *mbuf; - } *txbufs; +union { +struct { +struct rte_mbuf *mbuf; + } *txbufs; +struct { +struct rte_mbuf *mbuf; + } *ktxbufs;
What is the point of this union? Both structs are same.
PATCH 9/14 net/nfp: nfdk netdev option and queue function
In reply to Jin LiuAdd ethdev option for NFDK firmware, implement tx_queue setup and release function for NFDK firmware.
--- drivers/net/nfp/nfp_ethdev.c | 32 ++++++- drivers/net/nfp/nfp_ethdev_vf.c | 40 +++++++-- drivers/net/nfp/nfp_rxtx.c | 153 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 7 ++ 4 files changed, 226 insertions(+), 6 deletions(-)
drivers/net/nfp/nfp_ethdev.c +31 -1
@@ -358,11 +358,41 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_net_start, + .dev_stop = nfp_net_nfd3_stop, + .dev_set_link_up = nfp_net_set_link_up, + .dev_set_link_down = nfp_net_set_link_down, + .dev_close = nfp_net_nfd3_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_nfdk_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_net_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -370,13 +400,13 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_ethdev_vf.c +35 -5
@@ -265,6 +265,35 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_netvf_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_netvf_start, + .dev_stop = nfp_netvf_nfd3_stop, + .dev_set_link_up = nfp_netvf_set_link_up, + .dev_set_link_down = nfp_netvf_set_link_down, + .dev_close = nfp_netvf_nfd3_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_nfdk_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static int nfp_netvf_init (struct rte_eth_dev *eth_dev) {
@@ -291,11 +320,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); - eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; - eth_dev->rx_queue_count = nfp_net_rx_queue_count; - eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; - hw->ctrl_bar = (uint8_t *)pci_dev->mem_resource[0 ].addr;if (hw->ctrl_bar ==NULL ) { PMD_DRV_LOG(ERR,
@@ -309,6 +333,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -316,12 +341,17 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } + eth_dev->rx_queue_count = nfp_net_rx_queue_count; + eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts; +/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ;
drivers/net/nfp/nfp_rxtx.c +153 -0
156 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +7 -0
@@ -352,6 +352,13 @@ int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, const struct rte_eth_txconf *tx_conf);uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int nfp_net_nfdk_tx_queue_setup (struct rte_eth_dev *dev, +uint16_t queue_idx, +uint16_t nb_desc, +unsigned int socket_id, +const struct rte_eth_txconf *tx_conf); +void nfp_net_nfdk_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx); +void nfp_net_nfdk_reset_tx_queue (struct nfp_net_txq *txq);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH 10/14 net/nfp: add queue stop and close helper function
In reply to Jin LiuThis commit does not introduce new features, just integrate some common logic into helper functions to reduce the same logic and increase code reuse, include queue stop and queue close logic, will be used when NFP net stop and close.
queue stop: reset queue
queue close: reset and release queue
Modify nfd3 firmware net stop and close function, use helper function to stop and close queue instead of before logic.
--- drivers/net/nfp/nfp_common.c | 75 +++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_common.h | 6 +++ drivers/net/nfp/nfp_ethdev.c | 27 ++---------- drivers/net/nfp/nfp_ethdev_vf.c | 29 ++----------- 4 files changed, 89 insertions(+), 48 deletions(-)
drivers/net/nfp/nfp_common.c +75 -0
@@ -1293,6 +1293,81 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev)return ret; } +void +nfp_net_stop_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); + } +} + +void +nfp_net_close_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); +nfp_net_rx_queue_release (dev, i); + } +} + +void +nfp_net_nfd3_stop_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_nfd3_reset_tx_queue (this_tx_q); + } +} + +void +nfp_net_nfd3_close_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_nfd3_reset_tx_queue (this_tx_q); +nfp_net_nfd3_tx_queue_release (dev, i); + } +} + +void +nfp_net_nfdk_stop_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_nfdk_reset_tx_queue (this_tx_q); + } +} + +void +nfp_net_nfdk_close_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_nfdk_reset_tx_queue (this_tx_q); +nfp_net_nfdk_tx_queue_release (dev, i); + } +} +RTE_LOG_REGISTER_SUFFIX (nfp_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (nfp_logtype_driver, driver,NOTICE );/*
drivers/net/nfp/nfp_common.h +6 -0
@@ -409,6 +409,12 @@ int nfp_net_rss_hash_update(struct rte_eth_dev *dev,int nfp_net_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf);int nfp_net_rss_config_default (struct rte_eth_dev *dev); +void nfp_net_stop_rx_queue (struct rte_eth_dev *dev); +void nfp_net_close_rx_queue (struct rte_eth_dev *dev); +void nfp_net_nfd3_stop_tx_queue (struct rte_eth_dev *dev); +void nfp_net_nfd3_close_tx_queue (struct rte_eth_dev *dev); +void nfp_net_nfdk_stop_tx_queue (struct rte_eth_dev *dev); +void nfp_net_nfdk_close_tx_queue (struct rte_eth_dev *dev);#define NFP_NET_DEV_PRIVATE_TO_HW (adapter)\ (&((struct nfp_net_adapter *)adapter)->hw)
drivers/net/nfp/nfp_ethdev.c +4 -23
@@ -181,10 +181,7 @@ nfp_net_start(struct rte_eth_dev *dev)static int nfp_net_nfd3_stop (struct rte_eth_dev *dev) { -int i;struct nfp_net_hw *hw; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;PMD_INIT_LOG (DEBUG ,"Stop" );
@@ -193,15 +190,9 @@ nfp_net_nfd3_stop(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_nfd3_reset_tx_queue (this_tx_q); - } +nfp_net_nfd3_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);if (rte_eal_process_type () ==RTE_PROC_PRIMARY )/* Configure the physical port down */
@@ -256,8 +247,6 @@ nfp_net_nfd3_close(struct rte_eth_dev *dev)struct nfp_net_hw *hw;struct rte_pci_device *pci_dev;struct nfp_pf_dev *pf_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -277,17 +266,9 @@ nfp_net_nfd3_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_nfd3_reset_tx_queue (this_tx_q); -nfp_net_nfd3_tx_queue_release (dev, i); - } +nfp_net_nfd3_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);/* Cancel possible impending LSC work here before releasing the port*/ rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler,
drivers/net/nfp/nfp_ethdev_vf.c +4 -25
@@ -145,24 +145,14 @@ nfp_netvf_start(struct rte_eth_dev *dev)static int nfp_netvf_nfd3_stop (struct rte_eth_dev *dev) { -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i; -PMD_INIT_LOG (DEBUG ,"Stop" );nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_nfd3_reset_tx_queue (this_tx_q); - } +nfp_net_nfd3_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);return 0 ; }
@@ -185,9 +175,6 @@ static int nfp_netvf_nfd3_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ;
@@ -204,17 +191,9 @@ nfp_netvf_nfd3_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_nfd3_reset_tx_queue (this_tx_q); -nfp_net_nfd3_tx_queue_release (dev, i); - } +nfp_net_nfd3_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);rte_intr_disable (pci_dev->intr_handle);
Signature · 1 line
2.27.0
PATCH 11/14 net/nfp: nfdk stop and close function
In reply to Jin LiuImplement NIC stop and close function for NFDK firmware.
--- drivers/net/nfp/nfp_ethdev.c | 92 ++++++++++++++++++++++++++++++++- drivers/net/nfp/nfp_ethdev_vf.c | 64 +++++++++++++++++++++-- 2 files changed, 151 insertions(+), 5 deletions(-)
drivers/net/nfp/nfp_ethdev.c +90 -2
@@ -309,6 +309,94 @@ nfp_net_nfd3_close(struct rte_eth_dev *dev)return 0 ; } +static int +nfp_net_nfdk_stop (struct rte_eth_dev *dev) +{ +struct nfp_net_hw *hw; + +PMD_INIT_LOG (DEBUG ,"Stop" ); + + hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); + +nfp_net_disable_queues (dev); + +/* Clear queues */ +nfp_net_nfdk_stop_tx_queue (dev); + +nfp_net_stop_rx_queue (dev); + +if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) +/* Configure the physical port down */ +nfp_eth_set_configured (hw->cpp, hw->nfp_idx,0 ); +else +nfp_eth_set_configured (dev->process_private, hw->nfp_idx,0 ); + +return 0 ; +} + +static int +nfp_net_nfdk_close (struct rte_eth_dev *dev) +{ +int i; +struct nfp_net_hw *hw; +struct rte_pci_device *pci_dev; +struct nfp_pf_dev *pf_dev; + +if (rte_eal_process_type () !=RTE_PROC_PRIMARY ) +return 0 ; + +PMD_INIT_LOG (DEBUG ,"Close" ); + + pf_dev =NFP_NET_DEV_PRIVATE_TO_PF (dev->data->dev_private); + hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); + pci_dev =RTE_ETH_DEV_TO_PCI (dev); + +/* +* We assume that the DPDK application is stopping all the +* threads/queues before calling the device close function. +*/ + +nfp_net_disable_queues (dev); + +/* Clear queues */ +nfp_net_nfdk_close_tx_queue (dev); + +nfp_net_close_rx_queue (dev); + +/* Cancel possible impending LSC work here before releasing the port*/ +rte_eal_alarm_cancel (nfp_net_dev_interrupt_delayed_handler, (void *)dev); + +/* Only free PF resources after all physical ports have been closed */ +/* Mark this port as unused and free device priv resources*/ +nn_cfg_writeb (hw,NFP_NET_CFG_LSC ,0xff ); + pf_dev->ports[hw->idx] =NULL ; +rte_eth_dev_release_port (dev); + +for (i =0 ; i < pf_dev->total_phyports; i++) { +/* Check to see if ports are still in use */ +if (pf_dev->ports[i]) +return 0 ; + } + +/* Now it is safe to free all PF resources */ +PMD_INIT_LOG (INFO ,"Freeing PF resources" ); +nfp_cpp_area_free (pf_dev->ctrl_area); +nfp_cpp_area_free (pf_dev->hwqueues_area); +free (pf_dev->hwinfo); +free (pf_dev->sym_tbl); +nfp_cpp_free (pf_dev->cpp); +rte_free (pf_dev); + +rte_intr_disable (pci_dev->intr_handle); + +/* unregister callback func from eal lib */ +rte_intr_callback_unregister (pci_dev->intr_handle, + nfp_net_dev_interrupt_handler, + (void *)dev); + +return 0 ; +} +/* Initialise and register driver with DPDK Application */ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure,
@@ -342,10 +430,10 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, - .dev_stop = nfp_net_nfd3_stop, + .dev_stop = nfp_net_nfdk_stop, .dev_set_link_up = nfp_net_set_link_up, .dev_set_link_down = nfp_net_set_link_down, - .dev_close = nfp_net_nfd3_close, + .dev_close = nfp_net_nfdk_close, .promiscuous_enable = nfp_net_promisc_enable, .promiscuous_disable = nfp_net_promisc_disable, .link_update = nfp_net_link_update,
drivers/net/nfp/nfp_ethdev_vf.c +61 -3
84 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH 12/14 net/nfp: move macro from C file to head file
In reply to Jin LiuMove macro __round_mask, round_up and round_down from C file to corresponding head file, will be used by TX function of nfp net nfdk firmware.
--- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 ------------------- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/net/nfp/nfpcore/nfp_rtsym.c +0 -19
@@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp)return rtbl; } -/* -* This looks more complex than it should be. But we need to get the type for -* the ~ right in round_down (it needs to be as wide as the result!), and we -* want to evaluate the macro arguments just once each. -*/ -#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) - -#define round_up (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((((_x) - 1) | __round_mask(_x, y)) + 1); \ - })) - -#define round_down (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((_x) & ~__round_mask(_x, y)); \ - })) -struct nfp_rtsym_table *__nfp_rtsym_table_read (struct nfp_cpp *cpp,const struct nfp_mip *mip) {
drivers/net/nfp/nfpcore/nfp_rtsym.h +19 -0
@@ -15,6 +15,25 @@#define NFP_RTSYM_TARGET_LMEM -1#define NFP_RTSYM_TARGET_EMU_CACHE -7 +/* +* This looks more complex than it should be. But we need to get the type for +* the ~ right in round_down (it needs to be as wide as the result!), and we +* want to evaluate the macro arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) + +#define round_up (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((((_x) - 1) | __round_mask(_x, y)) + 1); \ + })) + +#define round_down (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((_x) & ~__round_mask(_x, y)); \ + })) +/* * Structure describing a run-time NFP symbol. *
Signature · 1 line
2.27.0
PATCH 13/14 net/nfp: nfdk packet xmit function
In reply to Jin LiuImplement NFP3800 card packet transmit function for NFDK firmware.
--- drivers/net/nfp/nfp_ethdev.c | 3 +- drivers/net/nfp/nfp_ethdev_vf.c | 3 +- drivers/net/nfp/nfp_rxtx.c | 281 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 3 + 4 files changed, 288 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +2 -1
@@ -462,6 +462,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -470,6 +471,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -478,7 +480,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_ethdev_vf.c +2 -1
@@ -365,6 +365,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -373,6 +374,7 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -381,7 +383,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
drivers/net/nfp/nfp_rxtx.c +281 -0
290 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +3 -0
@@ -359,6 +359,9 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, const struct rte_eth_txconf *tx_conf);void nfp_net_nfdk_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx);void nfp_net_nfdk_reset_tx_queue (struct nfp_net_txq *txq); +uint16_t nfp_net_nfdk_xmit_pkts (void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH 14/14 net/nfp: modify RSS logic
In reply to Jin LiuModify RSS-related interface functions, as the NFDK firmware support feature NFP_NET_CFG_CTRL_RSS2 rather than NFP_NET_CFG_CTRL_RSS.
--- drivers/net/nfp/nfp_common.c | 12 ++++++------ drivers/net/nfp/nfp_ctrl.h | 1 + drivers/net/nfp/nfp_ethdev.c | 12 +++++++++++- drivers/net/nfp/nfp_ethdev_vf.c | 12 +++++++++++- drivers/net/nfp/nfp_rxtx.c | 2 +- 5 files changed, 30 insertions(+), 9 deletions(-)
drivers/net/nfp/nfp_common.c +6 -6
@@ -171,7 +171,7 @@ nfp_net_configure(struct rte_eth_dev *dev)/* Checking RX mode */ if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS && - !(hw->cap &NFP_NET_CFG_CTRL_RSS )) { + !(hw->cap &NFP_NET_CFG_CTRL_RSS_ANY )) {PMD_INIT_LOG (INFO ,"RSS not supported" );return -EINVAL ; }
@@ -752,7 +752,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG, }; -if (hw->cap &NFP_NET_CFG_CTRL_RSS ) { +if (hw->cap &NFP_NET_CFG_CTRL_RSS_ANY ) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 |
@@ -1053,7 +1053,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,uint32_t update;int ret; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; ret =nfp_net_rss_reta_write (dev, reta_conf, reta_size);
@@ -1081,7 +1081,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ;if (reta_size !=NFP_NET_CFG_RSS_ITBL_SZ ) {
@@ -1179,7 +1179,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, rss_hf = rss_conf->rss_hf;/* Checking if RSS is enabled */ -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) { +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY )) {if (rss_hf !=0 ) {/* Enable RSS? */ PMD_DRV_LOG (ERR ,"RSS unsupported" );return -EINVAL ;
@@ -1214,7 +1214,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; rss_hf = rss_conf->rss_hf;
drivers/net/nfp/nfp_ctrl.h +1 -0
@@ -119,6 +119,7 @@#define NFP_NET_CFG_MACADDR 0x0024#define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) +#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2)/* * Read-only words (0x0030 - 0x0050):
drivers/net/nfp/nfp_ethdev.c +11 -1
@@ -123,7 +123,17 @@ nfp_net_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no fw version match" ); +return -ENODEV ; + } }/* Enable device */
drivers/net/nfp/nfp_ethdev_vf.c +11 -1
@@ -95,7 +95,17 @@ nfp_netvf_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no fw version match" ); +return -ENODEV ; + } }/* Enable device */
drivers/net/nfp/nfp_rxtx.c +1 -1
@@ -138,7 +138,7 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,uint32_t hash =0 ;uint32_t hash_type =0 ; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return ;/* this is true for new firmwares */
Signature · 1 line
2.27.0
Re: [PATCH 14/14] net/nfp: modify RSS logic
Quoted 8 lines · Jin Liu
Modify RSS-related interface functions, as the NFDK firmware support feature
NFP_NET_CFG_CTRL_RSS2rather thanNFP_NET_CFG_CTRL_RSS.Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
Quoted 45 lines
drivers/net/nfp/nfp_ctrl.h +1
-0@@ -119,6 +119,7 @@#define NFP_NET_CFG_MACADDR 0x0024#define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) +#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2)/* * Read-only words (0x0030 - 0x0050): drivers/net/nfp/nfp_ethdev.c +11
-1@@ -123,7 +123,17 @@ nfp_net_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no fw version match" ); +return -ENODEV ; + } }/* Enable device */ drivers/net/nfp/nfp_ethdev_vf.c +1
-1@@ -95,7 +95,17 @@ nfp_netvf_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +switch (NFD_CFG_CLASS_VER_of (hw->ver)) {
drivers/net/nfp/nfp_ethdev_vf.c nfp_netvf_start(struct rte_eth_dev *dev) · line 108
Quoted 10 lines
drivers/net/nfp/nfp_ethdev_vf.c +10
-0+case NFP_NET_CFG_VERSION_DP_NFD3 : + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no fw version match" ); +return -ENODEV ; + }
As this FW specific changes crept into various locations, it can be harder to maintain the code. I wonder if something like below can help, what do you think:
unsigned int nfp_FW_RSS[] = { // common for both PF & VF
NFP_NET_CFG_CTRL_RSS, NFP_NET_CFG_CTRL_RSS2, };
new_ctrl = nfp_FW_RSS[NFD_CFG_CLASS_VER_of(hw->ver)];
RE: [PATCH 14/14] net/nfp: modify RSS logic
Yes, you are right, thanks for your comment.
And I found this logic is not right, and I have update this logic as below We will use RSS2 if NIC cap support, otherwise will use RSS
if (hw->cap & NFP_NET_CFG_CTRL_RSS2) new_ctrl |= NFP_NET_CFG_CTRL_RSS2; else new_ctrl |= NFP_NET_CFG_CTRL_RSS;
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:57
To: Kevin Liu <[email protected]>; [email protected]
Cc: Niklas Soderlund <[email protected]>; Diana Wang <[email protected]>; Nole Zhang <[email protected]>; Chaoyong He <[email protected]>
Subject: Re: [PATCH 14/14] net/nfp: modify RSS logic
Quoted 8 lines · Jin Liu
Modify RSS-related interface functions, as the NFDK firmware support feature
NFP_NET_CFG_CTRL_RSS2rather thanNFP_NET_CFG_CTRL_RSS.Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>
<...>
Quoted 47 lines
drivers/net/nfp/nfp_ctrl.h +2
-0@@ -119,6 +119,7 @@#define NFP_NET_CFG_MACADDR 0x0024#define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) +#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | +NFP_NET_CFG_CTRL_RSS2)/* * Read-only words (0x0030 - 0x0050): (quoted diff) +0
-0
b/drivers/net/nfp/nfp_ethdev.cindex238b2b5451..bd7dd30f10100644drivers/net/nfp/nfp_ethdev.c +11
-1@@ -123,7 +123,17 @@ nfp_net_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +switch (NFD_CFG_CLASS_VER_of (hw->ver)) { +case NFP_NET_CFG_VERSION_DP_NFD3 : + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no fw version match" ); +return -ENODEV ; + } }/* Enable device */ (quoted diff) +0
-0
b/drivers/net/nfp/nfp_ethdev_vf.cindexbb8206c4f6..8769f07be4100644drivers/net/nfp/nfp_ethdev_vf.c +1
-1@@ -95,7 +95,17 @@ nfp_netvf_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +switch (NFD_CFG_CLASS_VER_of (hw->ver)) {
drivers/net/nfp/nfp_ethdev_vf.c nfp_netvf_start(struct rte_eth_dev *dev) · line 108
Quoted 10 lines
drivers/net/nfp/nfp_ethdev_vf.c +10
-0+case NFP_NET_CFG_VERSION_DP_NFD3 : + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +break ; +case NFP_NET_CFG_VERSION_DP_NFDK : + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no fw version match" ); +return -ENODEV ; + }
As this FW specific changes crept into various locations, it can be harder to maintain the code. I wonder if something like below can help, what do you think:
unsigned int nfp_FW_RSS[] = { // common for both PF & VF
NFP_NET_CFG_CTRL_RSS, NFP_NET_CFG_CTRL_RSS2, };
new_ctrl = nfp_FW_RSS[NFD_CFG_CLASS_VER_of(hw->ver)];
Quoted 5 lines · Jin Liu
NFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.
Hi Jin,
This set requires some documentation update. Current driver doc mentions that driver supports 'Agilio Basic Firmware' FW, I think overall new FW support should be documented and relevant parts needs to be updated.
Also can you please update the release notes for the set? Please update release notes in the relevant patch, instead of a separate doc patch.
Quoted 31 lines
Chaoyong He (2):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declarationJin Liu (12):
net/nfp: remove pessimistic limit net/nfp: rename set MAC function
net/nfp: rename function and struct net/nfp: support NFP3800 card
net/nfp: support NFDK firmware
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: nfdk stop and close function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function net/nfp: modify RSS logicdrivers/net/nfp/nfp_common.c | 89 ++++- drivers/net/nfp/nfp_common.h | 53 ++- drivers/net/nfp/nfp_ctrl.h | 3 + drivers/net/nfp/nfp_ethdev.c | 423 +++++++++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 215 +++++++---- drivers/net/nfp/nfp_rxtx.c | 505 +++++++++++++++++++++++--- drivers/net/nfp/nfp_rxtx.h | 89 ++++- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 - drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 + 11 files changed, 1128 insertions(+), 309 deletions(-)
Yes, I will update documentation and release notes, thanks
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Friday, June 3, 2022 06:51
To: Kevin Liu <[email protected]>
Cc: Niklas Soderlund <[email protected]>; [email protected]
Subject: Re: [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk
Quoted 5 lines · Jin Liu
NFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.
Hi Jin,
This set requires some documentation update. Current driver doc mentions that driver supports 'Agilio Basic Firmware' FW, I think overall new FW support should be documented and relevant parts needs to be updated.
Also can you please update the release notes for the set? Please update release notes in the relevant patch, instead of a separate doc patch.
Quoted 31 lines
Chaoyong He (2):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declarationJin Liu (12):
net/nfp: remove pessimistic limit net/nfp: rename set MAC function
net/nfp: rename function and struct net/nfp: support NFP3800 card
net/nfp: support NFDK firmware
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: nfdk stop and close function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function net/nfp: modify RSS logicdrivers/net/nfp/nfp_common.c | 89 ++++- drivers/net/nfp/nfp_common.h | 53 ++- drivers/net/nfp/nfp_ctrl.h | 3 + drivers/net/nfp/nfp_ethdev.c | 423 +++++++++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 215 +++++++---- drivers/net/nfp/nfp_rxtx.c | 505 +++++++++++++++++++++++--- drivers/net/nfp/nfp_rxtx.h | 89 ++++- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 - drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 + 11 files changed, 1128 insertions(+), 309 deletions(-)
v2 cover Add support of NFP3800 chip and firmware with NFDk
In reply to Jin LiuNFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.
* Changes since v1
- Added updated documentation for NFP to cover NFD.
- Documented the addition of NFD in the release notes.
- Added nfp_netvf_ethdev_ops_mount() to make code better.
- Used capability instead of version to select RSS.
- Adjusted nfp_net_txq struct,just keep one txbuf.
Jin Liu (15):
doc: update release note
doc: update nfp documentation
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration net/nfp: remove pessimistic limit
net/nfp: rename set MAC function
net/nfp: rename function and struct
net/nfp: support NFP3800 card
net/nfp: support firmware with NFDk
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function
net/nfp: modify RSS logic
doc/guides/nics/nfp.rst | 10 +- doc/guides/rel_notes/release_22_07.rst | 3 + drivers/net/nfp/nfp_common.c | 64 +++- drivers/net/nfp/nfp_common.h | 51 ++- drivers/net/nfp/nfp_ctrl.h | 3 + drivers/net/nfp/nfp_ethdev.c | 315 +++++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 153 +++++---- drivers/net/nfp/nfp_rxtx.c | 451 +++++++++++++++++++++++-- drivers/net/nfp/nfp_rxtx.h | 72 +++- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 ++ 13 files changed, 893 insertions(+), 289 deletions(-)
Signature · 1 line
2.27.0
PATCH v2 1/15 doc: update release note
Add support for a new type NFP NIC NFP3800 and firmware with NFDk.
--- doc/guides/rel_notes/release_22_07.rst | 3 +++ 1 file changed, 3 insertions(+)
doc/guides/rel_notes/release_22_07.rst +3 -0
@@ -146,6 +146,9 @@ New Features * ``RTE_EVENT_QUEUE_ATTR_WEIGHT`` * ``RTE_EVENT_QUEUE_ATTR_AFFINITY`` +* **Added support for new NFP NIC.** + + Added support for a new type NFP NIC NFP3800 and the firmware with NFDk. Removed Items -------------
Signature · 1 line
2.27.0
Re: [PATCH v2 01/15] doc: update release note
Quoted 14 lines · Jin Liu
Add support for a new type NFP NIC NFP3800 and firmware with NFDk.
Signed-off-by Jin Liu <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>--- doc/guides/rel_notes/release_22_07.rst | 3 +++ 1 file changed, 3 insertions(+)doc/guides/rel_notes/release_22_07.rst +0
-0
doc/guides/rel_notes/release_22_07.rst New Features · line 152
Quoted 7 lines
doc/guides/rel_notes/release_22_07.rst +3
-0@@ -146,6 +146,9 @@ New Features * ``RTE_EVENT_QUEUE_ATTR_WEIGHT`` * ``RTE_EVENT_QUEUE_ATTR_AFFINITY`` +* **Added support for new NFP NIC.** + + Added support for a new type NFP NIC NFP3800 and the firmware with NFDk.
Hi Jin,
Instead of having doc patch as separate patch, can you please squash it to the patch that is adding the announced feature? In the feature this enabled people checking the git history to find code and doc update atomically in same commit. Like NFP3800 support part can go into patch 8/15.
And can you please check the order of the log in the document's section comment? It should be grouped with net driver updates, in vendor name sorted manner, instead of going to end.
PATCH v2 2/15 doc: update nfp documentation
In reply to Jin LiuThis set patches add support for a new type of NFP nic NFP3800 and the firmware with NFDk.
--- doc/guides/nics/nfp.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
doc/guides/nics/nfp.rst +6 -4
@@ -12,7 +12,8 @@ up to 400-Gb/s. This document explains how to use DPDK with the Netronome Poll Mode Driver (PMD) supporting Netronome's Network Flow Processor 6xxx -(NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx). +(NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx) or +Netronome's Flow Processor 38xx (NFP-38xx). NFP is a SRIOV capable device and the PMD supports the physical function (PF) and the virtual functions (VFs).
@@ -99,9 +100,10 @@ more than one SmartNIC, same type of SmartNIC or different ones, and to upload a different firmware to each SmartNIC. .. Note:: - Currently the NFP PMD supports using the PF with Agilio Basic Firmware. See - https://help.netronome.com/support/solutions for more information on the - various firmwares supported by the Netronome Agilio CX smartNIC. + Currently the NFP PMD supports using the PF with Agilio Firmware with NFD3 + and Agilio Firmware with NFDk. See https://help.netronome.com/support/solutions + for more information on the various firmwares supported by the Netronome + Agilio CX smartNIC. PF multiport support --------------------
Signature · 1 line
2.27.0
Re: [PATCH v2 02/15] doc: update nfp documentation
Quoted 15 lines · Jin Liu
This set patches add support for a new type of NFP nic NFP3800 and the firmware with NFDk.
Signed-off-by Jin Liu <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>--- doc/guides/nics/nfp.rst | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)doc/guides/nics/nfp.rst +0
-0
doc/guides/nics/nfp.rst up to 400-Gb/s. · line 17
Quoted 7 lines
doc/guides/nics/nfp.rst +2
-1@@ -12,7 +12,8 @@ up to 400-Gb/s. This document explains how to use DPDK with the Netronome Poll Mode Driver (PMD) supporting Netronome's Network Flow Processor 6xxx -(NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx). +(NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx) or +Netronome's Flow Processor 38xx (NFP-38xx).
It is clearer to update working as "supporting X, Y and Z"
Again please squash the patch to the relevant commit, instead of having a separate doc patch.
Quoted 16 lines
doc/guides/nics/nfp.rst +4
-3NFP is a SRIOV capable device and the PMD supports the physical function (PF) and the virtual functions (VFs).@@ -99,9 +100,10 @@ more than one SmartNIC, same type of SmartNIC or different ones, and to upload a different firmware to each SmartNIC. .. Note:: - Currently the NFP PMD supports using the PF with Agilio Basic Firmware. See - https://help.netronome.com/support/solutions for more information on the - various firmwares supported by the Netronome Agilio CX smartNIC. + Currently the NFP PMD supports using the PF with Agilio Firmware with NFD3 + and Agilio Firmware with NFDk. See https://help.netronome.com/support/solutions + for more information on the various firmwares supported by the Netronome + Agilio CX smartNIC. PF multiport support --------------------
PATCH v2 3/15 net/nfp: change the coding style
In reply to Jin LiuChange the coding style of some logics, to make it more compatible with the DPDK coding style.
--- drivers/net/nfp/nfp_ethdev.c | 149 ++++++++++++++++---------------- drivers/net/nfp/nfp_ethdev_vf.c | 8 +- 2 files changed, 77 insertions(+), 80 deletions(-)
drivers/net/nfp/nfp_ethdev.c +73 -76
@@ -340,8 +340,7 @@ nfp_net_close(struct rte_eth_dev *dev)/* unregister callback func from eal lib */ rte_intr_callback_unregister (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)dev); + nfp_net_dev_interrupt_handler, (void *)dev);/* * The ixgbe PMD disables the pcie master on the
@@ -388,8 +387,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)struct nfp_pf_dev *pf_dev;struct nfp_net_hw *hw;struct rte_ether_addr *tmp_ether_addr; - -uint64_t tx_bar_off =0 , rx_bar_off =0 ; +uint64_t rx_bar_off =0 ; +uint64_t tx_bar_off =0 ;uint32_t start_q;int stride =4 ;int port =0 ;
@@ -404,11 +403,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD , +"device %s can not be used: restricted dma mask to 40 bits!\n" , + pci_dev->device.name);return -ENODEV ; - }; + } port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx;if (port <0 || port >7 ) {
@@ -416,14 +415,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev)return -ENODEV ; } -/* Use PF array of physical ports to get pointer to +/* +* Use PF array of physical ports to get pointer to * this specific port */ hw = pf_dev->ports[port];PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " -"NFP internal port number: %d" , - port, hw->nfp_idx); +"NFP internal port number: %d" , port, hw->nfp_idx); eth_dev->dev_ops = &nfp_net_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count;
@@ -456,13 +455,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (port ==0 ) { hw->ctrl_bar = pf_dev->ctrl_bar; }else { -if (!pf_dev->ctrl_bar) +if (pf_dev->ctrl_bar ==NULL )return -ENODEV ; -/* Use port offset in pf ctrl_bar for this -* ports control bar -*/ - hw->ctrl_bar = pf_dev->ctrl_bar + - (port *NFP_PF_CSR_SLICE_SIZE ); +/* Use port offset in pf ctrl_bar for this ports control bar */ + hw->ctrl_bar = pf_dev->ctrl_bar + (port *NFP_PF_CSR_SLICE_SIZE ); }PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar);
@@ -557,8 +553,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) tmp_ether_addr = (struct rte_ether_addr *)&hw->mac_addr;if (!rte_is_valid_assigned_ether_addr (tmp_ether_addr)) { -PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , - port); +PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , port);/* Using random mac addresses for VFs */ rte_eth_random_addr (&hw->mac_addr[0 ]);nfp_net_write_mac (hw, (uint8_t *)&hw->mac_addr);
@@ -583,8 +578,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {/* Registering LSC interrupt handler */ rte_intr_callback_register (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)eth_dev); + nfp_net_dev_interrupt_handler, (void *)eth_dev);/* Telling the firmware about the LSC interrupt entry */ nn_cfg_writeb (hw,NFP_NET_CFG_LSC ,NFP_NET_IRQ_LSC_IDX );/* Recording current stats counters values */
@@ -656,8 +650,10 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) }static int -nfp_fw_setup (struct rte_pci_device *dev,struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table,struct nfp_hwinfo *hwinfo) +nfp_fw_setup (struct rte_pci_device *dev, +struct nfp_cpp *cpp, +struct nfp_eth_table *nfp_eth_table, +struct nfp_hwinfo *hwinfo) {struct nfp_nsp *nsp;const char *nfp_fw_model;
@@ -675,12 +671,12 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,if (nfp_eth_table->count ==0 || nfp_eth_table->count >8 ) {PMD_DRV_LOG (ERR ,"NFP ethernet table reports wrong ports: %u" , - nfp_eth_table->count); + nfp_eth_table->count);return -EIO ; }PMD_DRV_LOG (INFO ,"NFP ethernet port table reports %u ports" , - nfp_eth_table->count); + nfp_eth_table->count);PMD_DRV_LOG (INFO ,"Port speed: %u" , nfp_eth_table->ports[0 ].speed);
@@ -689,7 +685,7 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, nfp_eth_table->ports[0].speed / 1000); nsp =nfp_nsp_open (cpp); -if (!nsp) { +if (nsp ==NULL ) {PMD_DRV_LOG (ERR ,"NFP error when obtaining NSP handle" );return -EIO ; }
@@ -701,19 +697,19 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,return err; } -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev) +static int +nfp_init_phyports (struct nfp_pf_dev *pf_dev) { +int i; +int ret =0 ;struct nfp_net_hw *hw;struct rte_eth_dev *eth_dev; -struct nfp_eth_table *nfp_eth_table =NULL ; -int ret =0 ; -int i; +struct nfp_eth_table *nfp_eth_table; nfp_eth_table =nfp_eth_read_ports (pf_dev->cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); - ret = -EIO ; - goto error; +return -EIO ; }/* Loop through all physical ports on PF */
@@ -726,7 +722,7 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate a eth_dev for this phyport */ eth_dev =rte_eth_dev_allocate (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) { ret = -ENODEV ; goto port_cleanup; }
@@ -734,8 +730,8 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate memory for this phyport */ eth_dev->data->dev_private =rte_zmalloc_socket (port_name,sizeof (struct nfp_net_hw ), -RTE_CACHE_LINE_SIZE , numa_node); -if (!eth_dev->data->dev_private) { +RTE_CACHE_LINE_SIZE , numa_node); +if (eth_dev->data->dev_private ==NULL ) { ret = -ENOMEM ;rte_eth_dev_release_port (eth_dev); goto port_cleanup;
@@ -759,7 +755,6 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)* nfp_net_init */ ret =nfp_net_init (eth_dev); -if (ret) { ret = -ENODEV ; goto port_cleanup;
@@ -782,24 +777,25 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev) } eth_table_cleanup:free (nfp_eth_table); -error: +return ret; } -static int nfp_pf_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_init (struct rte_pci_device *pci_dev) { -struct nfp_pf_dev *pf_dev =NULL ; +int err; +int ret =0 ; +int total_ports;struct nfp_cpp *cpp; +struct nfp_pf_dev *pf_dev;struct nfp_hwinfo *hwinfo; -struct nfp_rtsym_table *sym_tbl; -struct nfp_eth_table *nfp_eth_table =NULL ;char name[RTE_ETH_NAME_MAX_LEN ]; -int total_ports; -int ret = -ENODEV ; -int err; +struct nfp_rtsym_table *sym_tbl; +struct nfp_eth_table *nfp_eth_table; -if (!pci_dev) -return ret; +if (pci_dev ==NULL ) +return -ENODEV ;/* * When device bound to UIO, the device could be used, by mistake,
@@ -813,21 +809,21 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" ); ret = -EIO ; goto error; } hwinfo =nfp_hwinfo_read (cpp); -if (!hwinfo) { +if (hwinfo ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading hwinfo table" ); ret = -EIO ; goto error; } nfp_eth_table =nfp_eth_read_ports (cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); ret = -EIO ; goto hwinfo_cleanup;
@@ -841,7 +837,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Now the symbol table should be there */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" ); ret = -EIO ;
@@ -865,7 +861,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Allocate memory for the PF "device" */ snprintf (name,sizeof (name),"nfp_pf%d" ,0 ); pf_dev =rte_zmalloc (name,sizeof (*pf_dev),0 ); -if (!pf_dev) { +if (pf_dev ==NULL ) { ret = -ENOMEM ; goto sym_tbl_cleanup; }
@@ -883,9 +879,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Map the symbol table */ pf_dev->ctrl_bar =nfp_rtsym_map (pf_dev->sym_tbl,"_pf0_net_bar0" , - pf_dev->total_phyports *32768 , - &pf_dev->ctrl_area); -if (!pf_dev->ctrl_bar) { + pf_dev->total_phyports *32768 , &pf_dev->ctrl_area); +if (pf_dev->ctrl_bar ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for _pf0_net_ctrl_bar" ); ret = -EIO ; goto pf_cleanup;
@@ -895,10 +890,9 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* configure access to tx/rx vNIC BARs */ pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ), -NFP_QCP_QUEUE_AREA_SZ , - &pf_dev->hwqueues_area); -if (!pf_dev->hw_queues) { +NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + &pf_dev->hwqueues_area); +if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" ); ret = -EIO ; goto ctrl_area_cleanup;
@@ -906,7 +900,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"tx/rx bar address: 0x%p" , pf_dev->hw_queues); -/* Initialize and prep physical ports now +/* +* Initialize and prep physical ports now * This will loop through all physical ports */ ret =nfp_init_phyports (pf_dev);
@@ -941,15 +936,16 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)* is no need to initialise the PF again. Only minimal work is required * here */ -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_secondary_init (struct rte_pci_device *pci_dev) { -struct nfp_cpp *cpp; -struct nfp_rtsym_table *sym_tbl; -int total_ports;int i;int err; +int total_ports; +struct nfp_cpp *cpp; +struct nfp_rtsym_table *sym_tbl; -if (!pci_dev) +if (pci_dev ==NULL )return -ENODEV ;/*
@@ -964,7 +960,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" );return -EIO ; }
@@ -974,7 +970,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)* here so we have to read the number of ports from firmware */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" );return -EIO ;
@@ -989,13 +985,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)snprintf (port_name,sizeof (port_name),"%s_port%d" , pci_dev->device.name, i); -PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , - port_name); +PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , port_name); eth_dev =rte_eth_dev_attach_secondary (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) {RTE_LOG (ERR ,EAL , -"secondary process attach failed, " -"ethdev doesn't exist" ); +"secondary process attach failed, ethdev doesn't exist" );return -ENODEV ; } eth_dev->process_private = cpp;
@@ -1012,8 +1006,9 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return 0 ; } -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev) +static int +nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +struct rte_pci_device *dev) {if (rte_eal_process_type () ==RTE_PROC_PRIMARY )return nfp_pf_init (dev);
@@ -1035,7 +1030,8 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { }, }; -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev) +static int +nfp_pci_uninit (struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev;uint16_t port_id;
@@ -1052,7 +1048,8 @@ static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)return -ENOTSUP ; } -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev) +static int +eth_nfp_pci_remove (struct rte_pci_device *pci_dev) {return rte_eth_dev_pci_generic_remove (pci_dev, nfp_pci_uninit); }
drivers/net/nfp/nfp_ethdev_vf.c +4 -4
@@ -296,11 +296,11 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD , +"device %s can not be used: restricted dma mask to 40 bits!\n" , + pci_dev->device.name);return -ENODEV ; - }; + } hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);
Signature · 1 line
2.27.0
PATCH v2 4/15 net/nfp: remove unnecessary forward function declaration
In reply to Jin LiuThis commit remove some unnecessary forward function declarations.
--- drivers/net/nfp/nfp_ethdev.c | 22 ---------------------- drivers/net/nfp/nfp_ethdev_vf.c | 12 ------------ drivers/net/nfp/nfp_rxtx.c | 21 --------------------- 3 files changed, 55 deletions(-)
drivers/net/nfp/nfp_ethdev.c +0 -22
@@ -38,28 +38,6 @@#include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" - -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port); -static int nfp_net_start (struct rte_eth_dev *dev); -static int nfp_net_stop (struct rte_eth_dev *dev); -static int nfp_net_set_link_up (struct rte_eth_dev *dev); -static int nfp_net_set_link_down (struct rte_eth_dev *dev); -static int nfp_net_close (struct rte_eth_dev *dev); -static int nfp_net_init (struct rte_eth_dev *eth_dev); -static int nfp_fw_upload (struct rte_pci_device *dev, -struct nfp_nsp *nsp,char *card); -static int nfp_fw_setup (struct rte_pci_device *dev, -struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table, -struct nfp_hwinfo *hwinfo); -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev); -static int nfp_pf_init (struct rte_pci_device *pci_dev); -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev); -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev); -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev); -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port) {
drivers/net/nfp/nfp_ethdev_vf.c +0 -12
@@ -23,18 +23,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -static void nfp_netvf_read_mac (struct nfp_net_hw *hw); -static int nfp_netvf_start (struct rte_eth_dev *dev); -static int nfp_netvf_stop (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_up (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_down (struct rte_eth_dev *dev); -static int nfp_netvf_close (struct rte_eth_dev *dev); -static int nfp_netvf_init (struct rte_eth_dev *eth_dev); -static int nfp_vf_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *pci_dev); -static int eth_nfp_vf_pci_remove (struct rte_pci_device *pci_dev); -static void nfp_netvf_read_mac (struct nfp_net_hw *hw) {
drivers/net/nfp/nfp_rxtx.c +0 -21
@@ -21,27 +21,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -/* Prototypes */ -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq); -static inline void nfp_net_mbuf_alloc_failed (struct nfp_net_rxq *rxq); -static inline void nfp_net_set_hash (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mbuf); -static inline void nfp_net_rx_cksum (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mb); -static void nfp_net_rx_queue_release_mbufs (struct nfp_net_rxq *rxq); -static int nfp_net_tx_free_bufs (struct nfp_net_txq *txq); -static void nfp_net_tx_queue_release_mbufs (struct nfp_net_txq *txq); -static inline uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq); -static inline uint32_t nfp_net_txq_full (struct nfp_net_txq *txq); -static inline void nfp_net_tx_tso (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static inline void nfp_net_tx_cksum (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq) {
Signature · 1 line
2.27.0
PATCH v2 5/15 net/nfp: remove pessimistic limit
In reply to Jin LiuMultiple writes cause intermediate pointer values that do not end on complete TX descriptors.
The QCP peripheral on the NFP provides a number of access modes. In some access modes, the maximum amount to add must be restricted to a 6bit value. The particular access mode used by _nfp_qcp_ptr_add() has no such restrictions, so the "NFP_QCP_MAX_ADD" test is unnecessary.
Note that trying to add more that the configured ring size in a single add will cause a QCP overflow, caught and handled by the QCP peripheral.
--- drivers/net/nfp/nfp_common.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/nfp/nfp_common.h +1 -11
@@ -44,9 +44,6 @@ struct nfp_net_adapter;/* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) -/* Maximum value which can be added to a queue with one transaction */ -#define NFP_QCP_MAX_ADD 0x7f -/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -307,8 +304,6 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val)* @q: Base address for queue structure * @ptr: Add to the Read or Write pointer * @val: Value to add to the queue pointer -* -* If @val is greater than @NFP_QCP_MAX_ADD multiple writes are performed. */ static inline void nfp_qcp_ptr_add (uint8_t *q,enum nfp_qcp_ptr ptr,uint32_t val)
@@ -320,12 +315,7 @@ nfp_qcp_ptr_add(uint8_t *q, enum nfp_qcp_ptr ptr, uint32_t val)else off =NFP_QCP_QUEUE_ADD_WPTR ; -while (val >NFP_QCP_MAX_ADD ) { -nn_writel (rte_cpu_to_le_32 (NFP_QCP_MAX_ADD ), q + off); - val -=NFP_QCP_MAX_ADD ; -} - -nn_writel (rte_cpu_to_le_32 (val), q + off); +nn_writel (rte_cpu_to_le_32 (val), q + off); }/*
Signature · 1 line
2.27.0
PATCH v2 6/15 net/nfp: rename set MAC function
In reply to Jin LiuThe NFP eth driver function name start with 'nfp_net', but set_mac function start with 'nfp' only, rename it, be consistent with others.
--- drivers/net/nfp/nfp_common.c | 2 +- drivers/net/nfp/nfp_common.h | 2 +- drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/nfp/nfp_common.c +1 -1
@@ -274,7 +274,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) }int -nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) +nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) {struct nfp_net_hw *hw;uint32_t update, ctrl;
drivers/net/nfp/nfp_common.h +1 -1
@@ -350,7 +350,7 @@ void nfp_net_disable_queues(struct rte_eth_dev *dev);void nfp_net_params_setup (struct nfp_net_hw *hw);void nfp_eth_copy_mac (uint8_t *dst,const uint8_t *src);void nfp_net_write_mac (struct nfp_net_hw *hw,uint8_t *mac); -int nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +int nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr);int nfp_configure_rx_interrupt (struct rte_eth_dev *dev,struct rte_intr_handle *intr_handle);uint32_t nfp_check_offloads (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +1 -1
@@ -344,7 +344,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
drivers/net/nfp/nfp_ethdev_vf.c +1 -1
@@ -251,7 +251,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
Signature · 1 line
2.27.0
PATCH v2 7/15 net/nfp: rename function and struct
In reply to Jin LiuAdd 'nfd3' into the firmware with NFD3 eth driver function name, preparation for the next work, as we will support another version firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 12 ++++++------ drivers/net/nfp/nfp_ethdev_vf.c | 8 ++++---- drivers/net/nfp/nfp_rxtx.c | 30 +++++++++++++++--------------- drivers/net/nfp/nfp_rxtx.h | 8 ++++---- 4 files changed, 29 insertions(+), 29 deletions(-)
drivers/net/nfp/nfp_ethdev.c +6 -6
@@ -329,7 +329,7 @@ nfp_net_close(struct rte_eth_dev *dev) }/* Initialise and register driver with DPDK Application */ -static const struct eth_dev_ops nfp_net_eth_dev_ops = { +static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, .dev_stop = nfp_net_stop,
@@ -352,7 +352,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -402,10 +402,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " "NFP internal port number: %d" , port, hw->nfp_idx); - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -971,10 +971,10 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return -ENODEV ; } eth_dev->process_private = cpp; - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;rte_eth_dev_probing_finish (eth_dev); }
drivers/net/nfp/nfp_ethdev_vf.c +4 -4
@@ -236,7 +236,7 @@ nfp_netvf_close(struct rte_eth_dev *dev) }/* Initialise and register VF driver with DPDK Application */ -static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { +static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_netvf_start, .dev_stop = nfp_netvf_stop,
@@ -259,7 +259,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -292,10 +292,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); - eth_dev->dev_ops = &nfp_netvf_eth_dev_ops; + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
drivers/net/nfp/nfp_rxtx.c +15 -15
@@ -655,7 +655,7 @@ nfp_net_reset_tx_queue(struct nfp_net_txq *txq) }int -nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf) {
@@ -670,7 +670,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,PMD_INIT_FUNC_TRACE ();/* Validating number of descriptors */ - tx_desc_sz = nb_desc *sizeof (struct nfp_net_tx_desc ); + tx_desc_sz = nb_desc *sizeof (struct nfp_net_nfd3_tx_desc );if (tx_desc_sz %NFP_ALIGN_RING_DESC !=0 || nb_desc >NFP_NET_MAX_TX_DESC || nb_desc <NFP_NET_MIN_TX_DESC ) {
@@ -718,7 +718,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,* resizing in later calls to the queue setup function. */ tz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_idx, -sizeof (struct nfp_net_tx_desc ) * +sizeof (struct nfp_net_nfd3_tx_desc ) *NFP_NET_MAX_TX_DESC ,NFP_MEMZONE_ALIGN , socket_id);if (tz ==NULL ) {
@@ -743,7 +743,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,/* Saving physical and virtual addresses for the TX ring */ txq->dma = (uint64_t )tz->iova; - txq->txds = (struct nfp_net_tx_desc *)tz->addr; + txq->txds = (struct nfp_net_nfd3_tx_desc *)tz->addr;/* mbuf pointers array for referencing mbufs linked to TX descriptors */ txq->txbufs = rte_zmalloc_socket("txq->txbufs",
@@ -773,7 +773,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,/* Leaving always free descriptors for avoiding wrapping confusion */ static inline -uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq) +uint32_t nfp_net_nfd3_free_tx_desc (struct nfp_net_txq *txq) {if (txq->wr_p >= txq->rd_p)return txq->tx_count - (txq->wr_p - txq->rd_p) -8 ;
@@ -790,14 +790,14 @@ uint32_t nfp_free_tx_desc(struct nfp_net_txq *txq)* This function uses the host copy* of read/write pointers */ static inline -uint32_t nfp_net_txq_full (struct nfp_net_txq *txq) +uint32_t nfp_net_nfd3_txq_full (struct nfp_net_txq *txq) { -return (nfp_free_tx_desc (txq) < txq->tx_free_thresh); +return (nfp_net_nfd3_free_tx_desc (txq) < txq->tx_free_thresh); }/* nfp_net_tx_tso - Set TX descriptor for TSO */ static inline void -nfp_net_tx_tso (struct nfp_net_txq *txq,struct nfp_net_tx_desc *txd, +nfp_net_nfd3_tx_tso (struct nfp_net_txq *txq,struct nfp_net_nfd3_tx_desc *txd,struct rte_mbuf *mb) {uint64_t ol_flags;
@@ -828,7 +828,7 @@ nfp_net_tx_tso(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd,/* nfp_net_tx_cksum - Set TX CSUM offload flags in TX descriptor */ static inline void -nfp_net_tx_cksum (struct nfp_net_txq *txq,struct nfp_net_tx_desc *txd, +nfp_net_nfd3_tx_cksum (struct nfp_net_txq *txq,struct nfp_net_nfd3_tx_desc *txd,struct rte_mbuf *mb) {uint64_t ol_flags;
@@ -857,11 +857,11 @@ nfp_net_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd, }uint16_t -nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) +nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct nfp_net_txq *txq;struct nfp_net_hw *hw; -struct nfp_net_tx_desc *txds, txd; +struct nfp_net_nfd3_tx_desc *txds, txd;struct rte_mbuf *pkt;uint64_t dma_addr;int pkt_size, dma_size;
@@ -876,10 +876,10 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)PMD_TX_LOG (DEBUG ,"working for queue %u at pos %d and %u packets" , txq->qidx, txq->wr_p, nb_pkts); -if ((nfp_free_tx_desc (txq) < nb_pkts) || (nfp_net_txq_full (txq))) +if ((nfp_net_nfd3_free_tx_desc (txq) < nb_pkts) || (nfp_net_nfd3_txq_full (txq)))nfp_net_tx_free_bufs (txq); - free_descs = (uint16_t )nfp_free_tx_desc (txq); + free_descs = (uint16_t )nfp_net_nfd3_free_tx_desc (txq);if (unlikely (free_descs ==0 ))return 0 ;
@@ -913,8 +913,8 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)* multisegment packet, but TSO info needs to be in all of them. */ txd.data_len = pkt->pkt_len; -nfp_net_tx_tso (txq, &txd, pkt); -nfp_net_tx_cksum (txq, &txd, pkt); +nfp_net_nfd3_tx_tso (txq, &txd, pkt); +nfp_net_nfd3_tx_cksum (txq, &txd, pkt);if ((pkt->ol_flags &RTE_MBUF_F_TX_VLAN ) && (hw->cap &NFP_NET_CFG_CTRL_TXVLAN )) {
drivers/net/nfp/nfp_rxtx.h +4 -4
@@ -53,7 +53,7 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) -struct nfp_net_tx_desc { +struct nfp_net_nfd3_tx_desc { union { struct { uint8_t dma_addr_hi; /* High bits of host buf address */
@@ -124,7 +124,7 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_tx_desc *txds; +struct nfp_net_nfd3_tx_desc *txds;/* * At this point 48 bytes have been used for all the fields in the
@@ -286,10 +286,10 @@ int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct rte_mempool *mp);void nfp_net_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx);void nfp_net_reset_tx_queue (struct nfp_net_txq *txq); -int nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +int nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf); -uint16_t nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */
Signature · 1 line
2.27.0
PATCH v2 8/15 net/nfp: support NFP3800 card
In reply to Jin LiuAdd support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
--- drivers/net/nfp/nfp_common.h | 33 +++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 ++++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 ++++++++++++---- 5 files changed, 79 insertions(+), 13 deletions(-)
drivers/net/nfp/nfp_common.h +31 -2
@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803#define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000#define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 -#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 +#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003/* Include NFP4000VF */ /* Forward declaration */ struct nfp_net_adapter ;
@@ -41,8 +43,16 @@ struct nfp_net_adapter;#define NFP_QCP_QUEUE_STS_HI 0x000c#define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask (0x3ffff) +#define NFP_PCIE_QCP_NFP3800_OFFSET 0x400000 +#define NFP_PCIE_QCP_NFP6000_OFFSET 0x80000 +#define NFP_PCIE_QUEUE_NFP3800_MASK 0x1ff +#define NFP_PCIE_QUEUE_NFP6000_MASK 0xff +#define NFP_PCIE_QCP_PF_OFFSET 0x0 +#define NFP_PCIE_QCP_VF_OFFSET 0x0 +/* The offset of the queue controller queues in the PCIe Target */ -#define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) +#define NFP_PCIE_QUEUE (_offset, _q, _mask) \ + ((_offset) + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & (_mask))))/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -342,6 +352,25 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr)return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +static inline uint32_t nfp_pci_queue (struct rte_pci_device *pdev,uint16_t queue) +{ +switch (pdev->id.device_id) { +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +case PCI_DEVICE_ID_NFP3800_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); +case PCI_DEVICE_ID_NFP6000_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +default : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); + } +} +/* Prototypes for common NFP functions */ int nfp_net_reconfig (struct nfp_net_hw *hw,uint32_t ctrl,uint32_t update);int nfp_net_configure (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +25 -3
@@ -446,12 +446,13 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC :case PCI_DEVICE_ID_NFP4000_PF_NIC :case PCI_DEVICE_ID_NFP6000_PF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -764,6 +765,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) {int err;int ret =0 ; +uint64_t addr;int total_ports;struct nfp_cpp *cpp;struct nfp_pf_dev *pf_dev;
@@ -867,8 +869,24 @@ nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , pf_dev->ctrl_bar);/* configure access to tx/rx vNIC BARs */ +switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP3800_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP3800_MASK ); +break ; +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP6000_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP6000_MASK ); +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no device ID matching" ); + err = -ENODEV ; + goto ctrl_area_cleanup; + } + pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + addr,NFP_QCP_QUEUE_AREA_SZ , &pf_dev->hwqueues_area);if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" );
@@ -995,6 +1013,10 @@ nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_PF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP4000_PF_NIC )
drivers/net/nfp/nfp_ethdev_vf.c +7 -2
@@ -327,11 +327,12 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_VF_NIC :case PCI_DEVICE_ID_NFP6000_VF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -456,6 +457,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) }static const struct rte_pci_id pci_id_nfp_vf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_VF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP6000_VF_NIC )
drivers/net/nfp/nfpcore/nfp_cpp.h +1 -1
@@ -214,7 +214,7 @@ void nfp_cpp_free(struct nfp_cpp *cpp);* @return true if model is in the NFP6000 family, false otherwise. */ #define NFP_CPP_MODEL_IS_6000 (model) \ - ((NFP_CPP_MODEL_CHIP_of(model) >= 0x4000) && \ + ((NFP_CPP_MODEL_CHIP_of(model) >= 0x3800) && \ (NFP_CPP_MODEL_CHIP_of(model) < 0x7000))/*
drivers/net/nfp/nfpcore/nfp_nsp_eth.c +15 -5
@@ -266,6 +266,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)struct nfp_eth_table *table;uint32_t table_sz;int i, j, ret, cnt =0 ; +const struct rte_ether_addr *mac; entries =malloc (NSP_ETH_TABLE_SIZE );if (!entries)
@@ -278,9 +279,15 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) goto err; } -for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +/* The NFP3800 NIC support 8 ports, but only 2 ports are valid, +* the rest 6 ports mac are all 0, ensure we don't use these port +*/ +for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac))) cnt++; + }/* Some versions of flash will give us 0 instead of port count. For * those that give a port count, verify it against the value calculated
@@ -299,10 +306,13 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)memset (table,0 , table_sz); table->count = cnt; -for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac)))nfp_eth_port_translate (nsp, &entries[i], i, - &table->ports[j++]); + &table->ports[j++]); + }nfp_eth_calc_port_geometry (table);for (i =0 ; i < (int )table->count; i++)
Signature · 1 line
2.27.0
Re: [PATCH v2 08/15] net/nfp: support NFP3800 card
Quoted 52 lines · Jin Liu
Add support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
Signed-off-by Jin Liu <[email protected]>Signed-off-by Diana Wang <[email protected]>Signed-off-by Peng Zhang <[email protected]>Signed-off-by Chaoyong He <[email protected]>Signed-off-by Niklas Söderlund <[email protected]>--- drivers/net/nfp/nfp_common.h | 33 +++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 ++++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 ++++++++++++---- 5 files changed, 79 insertions(+), 13 deletions(-)drivers/net/nfp/nfp_common.h +12
-2@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803#define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000#define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 -#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 +#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003/* Include NFP4000VF */ /* Forward declaration */ struct nfp_net_adapter ;@@ -41,8 +43,16 @@ struct nfp_net_adapter;#define NFP_QCP_QUEUE_STS_HI 0x000c#define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask (0x3ffff) +#define NFP_PCIE_QCP_NFP3800_OFFSET 0x400000 +#define NFP_PCIE_QCP_NFP6000_OFFSET 0x80000 +#define NFP_PCIE_QUEUE_NFP3800_MASK 0x1ff +#define NFP_PCIE_QUEUE_NFP6000_MASK 0xff +#define NFP_PCIE_QCP_PF_OFFSET 0x0 +#define NFP_PCIE_QCP_VF_OFFSET 0x0 +/* The offset of the queue controller queues in the PCIe Target */ -#define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) +#define NFP_PCIE_QUEUE (_offset, _q, _mask) \ + ((_offset) + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & (_mask))))/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
drivers/net/nfp/nfp_common.h nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr) · line 356
Quoted 5 lines
drivers/net/nfp/nfp_common.h +2
-0@@ -342,6 +352,25 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr)return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +static inline uint32_t nfp_pci_queue (struct rte_pci_device *pdev,uint16_t queue) +{
One of the previous patch in this set fixes syntax like above, and this patch is adding more, can you please update as:
static inline uint32_tnfp_pci_queue(struct rte_pci_device *pdev, uint16_t queue)
PATCH v2 9/15 net/nfp: support firmware with NFDk
In reply to Jin LiuModify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
--- drivers/net/nfp/nfp_ctrl.h | 2 ++ drivers/net/nfp/nfp_ethdev.c | 49 +++++++++++++++++++++++------- drivers/net/nfp/nfp_ethdev_vf.c | 53 ++++++++++++++++++++++++--------- 3 files changed, 80 insertions(+), 24 deletions(-)
drivers/net/nfp/nfp_ctrl.h +2 -0
@@ -135,6 +135,8 @@* - define more STS bits */ #define NFP_NET_CFG_VERSION 0x0030 +#define NFP_NET_CFG_VERSION_DP_NFD3 0 +#define NFP_NET_CFG_VERSION_DP_NFDK 1#define NFP_NET_CFG_VERSION_RESERVED_MASK (0xff << 24)#define NFP_NET_CFG_VERSION_CLASS_MASK (0xff << 16)#define NFP_NET_CFG_VERSION_CLASS (x) (((x) & 0xff) << 16)
drivers/net/nfp/nfp_ethdev.c +39 -10
86 lines not on this page · raw message
drivers/net/nfp/nfp_ethdev_vf.c +39 -14
77 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v2 10/15 net/nfp: structure adjustment
In reply to Jin LiuAdd and modify the nfp PMD struct and macro that will be used by firmware with NFDk.
--- drivers/net/nfp/nfp_rxtx.h | 58 +++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-)
drivers/net/nfp/nfp_rxtx.h +57 -1
@@ -53,6 +53,31 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) +#define NFDK_TX_MAX_DATA_PER_HEAD 0x00001000 +#define NFDK_DESC_TX_DMA_LEN_HEAD 0x0fff +#define NFDK_DESC_TX_TYPE_HEAD 0xf000 +#define NFDK_DESC_TX_DMA_LEN 0x3fff +#define NFDK_TX_DESC_PER_SIMPLE_PKT 2 +#define NFDK_DESC_TX_TYPE_TSO 2 +#define NFDK_DESC_TX_TYPE_SIMPLE 8 +#define NFDK_DESC_TX_TYPE_GATHER 1 +#define NFDK_DESC_TX_EOP BIT(14) +#define NFDK_DESC_TX_L4_CSUM BIT(1) +#define NFDK_DESC_TX_L3_CSUM BIT(0) + +#define NFDK_TX_MAX_DATA_PER_DESC 0x00004000 +#define NFDK_TX_DESC_GATHER_MAX 17 +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) +#define NFDK_TX_DESC_BLOCK_SZ 256 +#define NFDK_TX_DESC_BLOCK_CNT (NFDK_TX_DESC_BLOCK_SZ / \ + sizeof(struct nfp_net_nfdk_tx_desc)) +#define NFDK_TX_DESC_STOP_CNT (NFDK_TX_DESC_BLOCK_CNT * \ + NFDK_TX_DESC_PER_SIMPLE_PKT) +#define NFDK_TX_MAX_DATA_PER_BLOCK 0x00010000 +#define D_BLOCK_CPL (idx) (NFDK_TX_DESC_BLOCK_CNT - \ + (idx) % NFDK_TX_DESC_BLOCK_CNT) +#define D_IDX (ring, idx) ((idx) & ((ring)->tx_count - 1)) + struct nfp_net_nfd3_tx_desc { union { struct {
@@ -84,6 +109,33 @@ struct nfp_net_nfd3_tx_desc { }; }; +struct nfp_net_nfdk_tx_desc { +union { +struct { +__le16 dma_addr_hi;/* High bits of host buf address */ +__le16 dma_len_type;/* Length to DMA for this desc */ +__le32 dma_addr_lo;/* Low 32bit of host buf addr */ + }; + +struct { +__le16 mss;/* MSS to be used for LSO */ +uint8_t lso_hdrlen;/* LSO, TCP payload offset */ +uint8_t lso_totsegs;/* LSO, total segments */ +uint8_t l3_offset;/* L3 header offset */ +uint8_t l4_offset;/* L4 header offset */ +__le16 lso_meta_res;/* Rsvd bits in TSO metadata */ + }; + +struct { +uint8_t flags;/* TX Flags, see @NFDK_DESC_TX_* */ +uint8_t reserved[7 ];/* meta byte placeholder */ + }; + +__le32 vals[2 ]; +__le64 raw; + }; +}; +struct nfp_net_txq {struct nfp_net_hw *hw;/* Backpointer to nfp_net structure */
@@ -124,7 +176,10 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_nfd3_tx_desc *txds; +union { +struct nfp_net_nfd3_tx_desc *txds; +struct nfp_net_nfdk_tx_desc *ktxds; + };/* * At this point 48 bytes have been used for all the fields in the
@@ -137,6 +192,7 @@ struct nfp_net_txq {uint32_t tx_hthresh;/* not used by now. Future? */ uint32_t tx_wthresh;/* not used by now. Future? */ uint16_t port_id; +uint16_t data_pending;/* used by nfdk only */ int qidx;int tx_qcidx;__le64 dma;
Signature · 1 line
2.27.0
PATCH v2 11/15 net/nfp: nfdk netdev option and queue function
In reply to Jin LiuAdd ethdev option for firmware with NFDk, implement tx_queue setup function for firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 32 ++++++++- drivers/net/nfp/nfp_ethdev_vf.c | 32 ++++++++- drivers/net/nfp/nfp_rxtx.c | 117 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 5 ++ 4 files changed, 184 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +31 -1
@@ -358,11 +358,41 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_net_start, + .dev_stop = nfp_net_stop, + .dev_set_link_up = nfp_net_set_link_up, + .dev_set_link_down = nfp_net_set_link_down, + .dev_close = nfp_net_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_net_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -370,13 +400,13 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_ethdev_vf.c +31 -1
@@ -265,11 +265,41 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_netvf_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_netvf_start, + .dev_stop = nfp_netvf_stop, + .dev_set_link_up = nfp_netvf_set_link_up, + .dev_set_link_down = nfp_netvf_set_link_down, + .dev_close = nfp_netvf_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_netvf_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -277,13 +307,13 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_rxtx.c +117 -0
120 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +5 -0
@@ -347,6 +347,11 @@ int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, const struct rte_eth_txconf *tx_conf);uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int nfp_net_nfdk_tx_queue_setup (struct rte_eth_dev *dev, +uint16_t queue_idx, +uint16_t nb_desc, +unsigned int socket_id, +const struct rte_eth_txconf *tx_conf);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH v2 12/15 net/nfp: add queue stop and close helper function
In reply to Jin LiuThis commit does not introduce new features, just integrate some common logic into helper functions to reduce the same logic and increase code reuse, include queue stop and queue close logic, will be used when NFP net stop and close.
queue stop: reset queue
queue close: reset and release queue
Modify NFP net stop and close function, use helper function to stop and close queue instead of before logic.
--- drivers/net/nfp/nfp_common.c | 50 +++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_common.h | 4 +++ drivers/net/nfp/nfp_ethdev.c | 27 +++--------------- drivers/net/nfp/nfp_ethdev_vf.c | 29 +++---------------- 4 files changed, 62 insertions(+), 48 deletions(-)
drivers/net/nfp/nfp_common.c +50 -0
@@ -1320,6 +1320,56 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev)return ret; } +void +nfp_net_stop_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); + } +} + +void +nfp_net_close_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); +nfp_net_rx_queue_release (dev, i); + } +} + +void +nfp_net_stop_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_reset_tx_queue (this_tx_q); + } +} + +void +nfp_net_close_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_reset_tx_queue (this_tx_q); +nfp_net_tx_queue_release (dev, i); + } +} +RTE_LOG_REGISTER_SUFFIX (nfp_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (nfp_logtype_driver, driver,NOTICE );/*
drivers/net/nfp/nfp_common.h +4 -0
@@ -412,6 +412,10 @@ int nfp_net_rss_hash_update(struct rte_eth_dev *dev,int nfp_net_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf);int nfp_net_rss_config_default (struct rte_eth_dev *dev); +void nfp_net_stop_rx_queue (struct rte_eth_dev *dev); +void nfp_net_close_rx_queue (struct rte_eth_dev *dev); +void nfp_net_stop_tx_queue (struct rte_eth_dev *dev); +void nfp_net_close_tx_queue (struct rte_eth_dev *dev);#define NFP_NET_DEV_PRIVATE_TO_HW (adapter)\ (&((struct nfp_net_adapter *)adapter)->hw)
drivers/net/nfp/nfp_ethdev.c +4 -23
@@ -181,10 +181,7 @@ nfp_net_start(struct rte_eth_dev *dev)static int nfp_net_stop (struct rte_eth_dev *dev) { -int i;struct nfp_net_hw *hw; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;PMD_INIT_LOG (DEBUG ,"Stop" );
@@ -193,15 +190,9 @@ nfp_net_stop(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); - } +nfp_net_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);if (rte_eal_process_type () ==RTE_PROC_PRIMARY )/* Configure the physical port down */
@@ -256,8 +247,6 @@ nfp_net_close(struct rte_eth_dev *dev)struct nfp_net_hw *hw;struct rte_pci_device *pci_dev;struct nfp_pf_dev *pf_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -277,17 +266,9 @@ nfp_net_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); - } +nfp_net_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);/* Cancel possible impending LSC work here before releasing the port*/ rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler,
drivers/net/nfp/nfp_ethdev_vf.c +4 -25
@@ -145,24 +145,14 @@ nfp_netvf_start(struct rte_eth_dev *dev)static int nfp_netvf_stop (struct rte_eth_dev *dev) { -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i; -PMD_INIT_LOG (DEBUG ,"Stop" );nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); - } +nfp_net_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);return 0 ; }
@@ -185,9 +175,6 @@ static int nfp_netvf_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ;
@@ -204,17 +191,9 @@ nfp_netvf_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); - } +nfp_net_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);rte_intr_disable (pci_dev->intr_handle);
Signature · 1 line
2.27.0
PATCH v2 13/15 net/nfp: move macro from C file to head file
In reply to Jin LiuMove macro __round_mask, round_up and round_down from C file to corresponding head file, will be used by TX function of nfp net firmware with NFDk.
--- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 ------------------- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/net/nfp/nfpcore/nfp_rtsym.c +0 -19
@@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp)return rtbl; } -/* -* This looks more complex than it should be. But we need to get the type for -* the ~ right in round_down (it needs to be as wide as the result!), and we -* want to evaluate the macro arguments just once each. -*/ -#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) - -#define round_up (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((((_x) - 1) | __round_mask(_x, y)) + 1); \ - })) - -#define round_down (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((_x) & ~__round_mask(_x, y)); \ - })) -struct nfp_rtsym_table *__nfp_rtsym_table_read (struct nfp_cpp *cpp,const struct nfp_mip *mip) {
drivers/net/nfp/nfpcore/nfp_rtsym.h +19 -0
@@ -15,6 +15,25 @@#define NFP_RTSYM_TARGET_LMEM -1#define NFP_RTSYM_TARGET_EMU_CACHE -7 +/* +* This looks more complex than it should be. But we need to get the type for +* the ~ right in round_down (it needs to be as wide as the result!), and we +* want to evaluate the macro arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) + +#define round_up (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((((_x) - 1) | __round_mask(_x, y)) + 1); \ + })) + +#define round_down (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((_x) & ~__round_mask(_x, y)); \ + })) +/* * Structure describing a run-time NFP symbol. *
Signature · 1 line
2.27.0
PATCH v2 14/15 net/nfp: nfdk packet xmit function
In reply to Jin LiuImplement NFP3800 card packet transmit function for firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 3 +- drivers/net/nfp/nfp_ethdev_vf.c | 3 +- drivers/net/nfp/nfp_rxtx.c | 281 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 3 + 4 files changed, 288 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +2 -1
@@ -374,6 +374,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -382,6 +383,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -390,7 +392,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_ethdev_vf.c +2 -1
@@ -279,6 +279,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -287,6 +288,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -295,7 +297,6 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_rxtx.c +281 -0
290 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +3 -0
@@ -352,6 +352,9 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); +uint16_t nfp_net_nfdk_xmit_pkts (void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH v2 15/15 net/nfp: modify RSS logic
In reply to Jin LiuNow NFP NIC support two type of RSS logic, NFP_NET_CFG_CTRL_RSS and NFP_NET_CFG_CTRL_RSS2, use NFP_NET_CFG_CTRL_RSS2 if NIC capability support, otherwise use NFP_NET_CFG_CTRL_RSS.
--- drivers/net/nfp/nfp_common.c | 12 ++++++------ drivers/net/nfp/nfp_ctrl.h | 1 + drivers/net/nfp/nfp_ethdev.c | 5 ++++- drivers/net/nfp/nfp_ethdev_vf.c | 5 ++++- drivers/net/nfp/nfp_rxtx.c | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-)
drivers/net/nfp/nfp_common.c +6 -6
@@ -171,7 +171,7 @@ nfp_net_configure(struct rte_eth_dev *dev)/* Checking RX mode */ if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS && - !(hw->cap &NFP_NET_CFG_CTRL_RSS )) { + !(hw->cap &NFP_NET_CFG_CTRL_RSS_ANY )) {PMD_INIT_LOG (INFO ,"RSS not supported" );return -EINVAL ; }
@@ -769,7 +769,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG, }; -if (hw->cap &NFP_NET_CFG_CTRL_RSS ) { +if (hw->cap &NFP_NET_CFG_CTRL_RSS_ANY ) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 |
@@ -1080,7 +1080,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,uint32_t update;int ret; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; ret =nfp_net_rss_reta_write (dev, reta_conf, reta_size);
@@ -1108,7 +1108,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ;if (reta_size !=NFP_NET_CFG_RSS_ITBL_SZ ) {
@@ -1206,7 +1206,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, rss_hf = rss_conf->rss_hf;/* Checking if RSS is enabled */ -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) { +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY )) {if (rss_hf !=0 ) {/* Enable RSS? */ PMD_DRV_LOG (ERR ,"RSS unsupported" );return -EINVAL ;
@@ -1241,7 +1241,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; rss_hf = rss_conf->rss_hf;
drivers/net/nfp/nfp_ctrl.h +1 -0
@@ -119,6 +119,7 @@#define NFP_NET_CFG_MACADDR 0x0024#define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) +#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2)/* * Read-only words (0x0030 - 0x0050):
drivers/net/nfp/nfp_ethdev.c +4 -1
@@ -123,7 +123,10 @@ nfp_net_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +if (hw->cap &NFP_NET_CFG_CTRL_RSS2 ) + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +else + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; }/* Enable device */
drivers/net/nfp/nfp_ethdev_vf.c +4 -1
@@ -95,7 +95,10 @@ nfp_netvf_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +if (hw->cap &NFP_NET_CFG_CTRL_RSS2 ) + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +else + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; }/* Enable device */
drivers/net/nfp/nfp_rxtx.c +1 -1
@@ -138,7 +138,7 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,uint32_t hash =0 ;uint32_t hash_type =0 ; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return ;/* this is true for new firmwares */
Signature · 1 line
2.27.0
Quoted 12 lines · Jin Liu
NFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.* Changes since v1
- Added updated documentation for NFP to cover NFD.
- Documented the addition of NFD in the release notes.
- Addednfp_netvf_ethdev_ops_mount()to make code better.
- Used capability instead of version to select RSS.
- Adjustednfp_net_txqstruct,just keep one txbuf.
Quoted 16 lines
Jin Liu (15):
doc: update release note
doc: update nfp documentation
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration net/nfp: remove pessimistic limit
net/nfp: rename set MAC function
net/nfp: rename function and struct
net/nfp: support NFP3800 card
net/nfp: support firmware with NFDk
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function
net/nfp: modify RSS logic
Hi Jin,
Patches good except doc update organization and minor syntax issue, can you please send a new version with these addressed?
Thanks,
ferruh
v3 cover Add support of NFP3800 chip and firmware with NFDk
In reply to Jin LiuNFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.
* Changes since v1
- Added updated documentation for NFP to cover NFD.
- Documented the addition of NFD in the release notes.
- Added nfp_netvf_ethdev_ops_mount() to make code better.
- Used capability instead of version to select RSS.
- Adjusted nfp_net_txq struct,just keep one txbuf.
* Changes since v2
- Squashed doc update commit to feature commit.
- Adjusted doc comment postion and order.
- Modified function definition Format.
Jin Liu (13):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration net/nfp: remove pessimistic limit
net/nfp: rename set MAC function
net/nfp: rename function and struct
net/nfp: support NFP3800 card
net/nfp: support firmware with NFDk
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function
net/nfp: modify RSS logic
doc/guides/nics/nfp.rst | 10 +- doc/guides/rel_notes/release_22_07.rst | 5 + drivers/net/nfp/nfp_common.c | 64 +++- drivers/net/nfp/nfp_common.h | 52 ++- drivers/net/nfp/nfp_ctrl.h | 3 + drivers/net/nfp/nfp_ethdev.c | 315 +++++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 153 +++++---- drivers/net/nfp/nfp_rxtx.c | 451 +++++++++++++++++++++++-- drivers/net/nfp/nfp_rxtx.h | 72 +++- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 ++ 13 files changed, 896 insertions(+), 289 deletions(-)
Signature · 1 line
2.27.0
PATCH v3 1/13 net/nfp: change the coding style
Change the coding style of some logics, to make it more compatible with the DPDK coding style.
--- drivers/net/nfp/nfp_ethdev.c | 149 ++++++++++++++++---------------- drivers/net/nfp/nfp_ethdev_vf.c | 8 +- 2 files changed, 77 insertions(+), 80 deletions(-)
drivers/net/nfp/nfp_ethdev.c +73 -76
@@ -340,8 +340,7 @@ nfp_net_close(struct rte_eth_dev *dev)/* unregister callback func from eal lib */ rte_intr_callback_unregister (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)dev); + nfp_net_dev_interrupt_handler, (void *)dev);/* * The ixgbe PMD disables the pcie master on the
@@ -388,8 +387,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)struct nfp_pf_dev *pf_dev;struct nfp_net_hw *hw;struct rte_ether_addr *tmp_ether_addr; - -uint64_t tx_bar_off =0 , rx_bar_off =0 ; +uint64_t rx_bar_off =0 ; +uint64_t tx_bar_off =0 ;uint32_t start_q;int stride =4 ;int port =0 ;
@@ -404,11 +403,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD , +"device %s can not be used: restricted dma mask to 40 bits!\n" , + pci_dev->device.name);return -ENODEV ; - }; + } port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx;if (port <0 || port >7 ) {
@@ -416,14 +415,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev)return -ENODEV ; } -/* Use PF array of physical ports to get pointer to +/* +* Use PF array of physical ports to get pointer to * this specific port */ hw = pf_dev->ports[port];PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " -"NFP internal port number: %d" , - port, hw->nfp_idx); +"NFP internal port number: %d" , port, hw->nfp_idx); eth_dev->dev_ops = &nfp_net_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count;
@@ -456,13 +455,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (port ==0 ) { hw->ctrl_bar = pf_dev->ctrl_bar; }else { -if (!pf_dev->ctrl_bar) +if (pf_dev->ctrl_bar ==NULL )return -ENODEV ; -/* Use port offset in pf ctrl_bar for this -* ports control bar -*/ - hw->ctrl_bar = pf_dev->ctrl_bar + - (port *NFP_PF_CSR_SLICE_SIZE ); +/* Use port offset in pf ctrl_bar for this ports control bar */ + hw->ctrl_bar = pf_dev->ctrl_bar + (port *NFP_PF_CSR_SLICE_SIZE ); }PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar);
@@ -557,8 +553,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) tmp_ether_addr = (struct rte_ether_addr *)&hw->mac_addr;if (!rte_is_valid_assigned_ether_addr (tmp_ether_addr)) { -PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , - port); +PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , port);/* Using random mac addresses for VFs */ rte_eth_random_addr (&hw->mac_addr[0 ]);nfp_net_write_mac (hw, (uint8_t *)&hw->mac_addr);
@@ -583,8 +578,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {/* Registering LSC interrupt handler */ rte_intr_callback_register (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)eth_dev); + nfp_net_dev_interrupt_handler, (void *)eth_dev);/* Telling the firmware about the LSC interrupt entry */ nn_cfg_writeb (hw,NFP_NET_CFG_LSC ,NFP_NET_IRQ_LSC_IDX );/* Recording current stats counters values */
@@ -656,8 +650,10 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) }static int -nfp_fw_setup (struct rte_pci_device *dev,struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table,struct nfp_hwinfo *hwinfo) +nfp_fw_setup (struct rte_pci_device *dev, +struct nfp_cpp *cpp, +struct nfp_eth_table *nfp_eth_table, +struct nfp_hwinfo *hwinfo) {struct nfp_nsp *nsp;const char *nfp_fw_model;
@@ -675,12 +671,12 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,if (nfp_eth_table->count ==0 || nfp_eth_table->count >8 ) {PMD_DRV_LOG (ERR ,"NFP ethernet table reports wrong ports: %u" , - nfp_eth_table->count); + nfp_eth_table->count);return -EIO ; }PMD_DRV_LOG (INFO ,"NFP ethernet port table reports %u ports" , - nfp_eth_table->count); + nfp_eth_table->count);PMD_DRV_LOG (INFO ,"Port speed: %u" , nfp_eth_table->ports[0 ].speed);
@@ -689,7 +685,7 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, nfp_eth_table->ports[0].speed / 1000); nsp =nfp_nsp_open (cpp); -if (!nsp) { +if (nsp ==NULL ) {PMD_DRV_LOG (ERR ,"NFP error when obtaining NSP handle" );return -EIO ; }
@@ -701,19 +697,19 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,return err; } -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev) +static int +nfp_init_phyports (struct nfp_pf_dev *pf_dev) { +int i; +int ret =0 ;struct nfp_net_hw *hw;struct rte_eth_dev *eth_dev; -struct nfp_eth_table *nfp_eth_table =NULL ; -int ret =0 ; -int i; +struct nfp_eth_table *nfp_eth_table; nfp_eth_table =nfp_eth_read_ports (pf_dev->cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); - ret = -EIO ; - goto error; +return -EIO ; }/* Loop through all physical ports on PF */
@@ -726,7 +722,7 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate a eth_dev for this phyport */ eth_dev =rte_eth_dev_allocate (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) { ret = -ENODEV ; goto port_cleanup; }
@@ -734,8 +730,8 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate memory for this phyport */ eth_dev->data->dev_private =rte_zmalloc_socket (port_name,sizeof (struct nfp_net_hw ), -RTE_CACHE_LINE_SIZE , numa_node); -if (!eth_dev->data->dev_private) { +RTE_CACHE_LINE_SIZE , numa_node); +if (eth_dev->data->dev_private ==NULL ) { ret = -ENOMEM ;rte_eth_dev_release_port (eth_dev); goto port_cleanup;
@@ -759,7 +755,6 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)* nfp_net_init */ ret =nfp_net_init (eth_dev); -if (ret) { ret = -ENODEV ; goto port_cleanup;
@@ -782,24 +777,25 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev) } eth_table_cleanup:free (nfp_eth_table); -error: +return ret; } -static int nfp_pf_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_init (struct rte_pci_device *pci_dev) { -struct nfp_pf_dev *pf_dev =NULL ; +int err; +int ret =0 ; +int total_ports;struct nfp_cpp *cpp; +struct nfp_pf_dev *pf_dev;struct nfp_hwinfo *hwinfo; -struct nfp_rtsym_table *sym_tbl; -struct nfp_eth_table *nfp_eth_table =NULL ;char name[RTE_ETH_NAME_MAX_LEN ]; -int total_ports; -int ret = -ENODEV ; -int err; +struct nfp_rtsym_table *sym_tbl; +struct nfp_eth_table *nfp_eth_table; -if (!pci_dev) -return ret; +if (pci_dev ==NULL ) +return -ENODEV ;/* * When device bound to UIO, the device could be used, by mistake,
@@ -813,21 +809,21 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" ); ret = -EIO ; goto error; } hwinfo =nfp_hwinfo_read (cpp); -if (!hwinfo) { +if (hwinfo ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading hwinfo table" ); ret = -EIO ; goto error; } nfp_eth_table =nfp_eth_read_ports (cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); ret = -EIO ; goto hwinfo_cleanup;
@@ -841,7 +837,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Now the symbol table should be there */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" ); ret = -EIO ;
@@ -865,7 +861,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Allocate memory for the PF "device" */ snprintf (name,sizeof (name),"nfp_pf%d" ,0 ); pf_dev =rte_zmalloc (name,sizeof (*pf_dev),0 ); -if (!pf_dev) { +if (pf_dev ==NULL ) { ret = -ENOMEM ; goto sym_tbl_cleanup; }
@@ -883,9 +879,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Map the symbol table */ pf_dev->ctrl_bar =nfp_rtsym_map (pf_dev->sym_tbl,"_pf0_net_bar0" , - pf_dev->total_phyports *32768 , - &pf_dev->ctrl_area); -if (!pf_dev->ctrl_bar) { + pf_dev->total_phyports *32768 , &pf_dev->ctrl_area); +if (pf_dev->ctrl_bar ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for _pf0_net_ctrl_bar" ); ret = -EIO ; goto pf_cleanup;
@@ -895,10 +890,9 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* configure access to tx/rx vNIC BARs */ pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ), -NFP_QCP_QUEUE_AREA_SZ , - &pf_dev->hwqueues_area); -if (!pf_dev->hw_queues) { +NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + &pf_dev->hwqueues_area); +if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" ); ret = -EIO ; goto ctrl_area_cleanup;
@@ -906,7 +900,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"tx/rx bar address: 0x%p" , pf_dev->hw_queues); -/* Initialize and prep physical ports now +/* +* Initialize and prep physical ports now * This will loop through all physical ports */ ret =nfp_init_phyports (pf_dev);
@@ -941,15 +936,16 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)* is no need to initialise the PF again. Only minimal work is required * here */ -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_secondary_init (struct rte_pci_device *pci_dev) { -struct nfp_cpp *cpp; -struct nfp_rtsym_table *sym_tbl; -int total_ports;int i;int err; +int total_ports; +struct nfp_cpp *cpp; +struct nfp_rtsym_table *sym_tbl; -if (!pci_dev) +if (pci_dev ==NULL )return -ENODEV ;/*
@@ -964,7 +960,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" );return -EIO ; }
@@ -974,7 +970,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)* here so we have to read the number of ports from firmware */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" );return -EIO ;
@@ -989,13 +985,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)snprintf (port_name,sizeof (port_name),"%s_port%d" , pci_dev->device.name, i); -PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , - port_name); +PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , port_name); eth_dev =rte_eth_dev_attach_secondary (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) {RTE_LOG (ERR ,EAL , -"secondary process attach failed, " -"ethdev doesn't exist" ); +"secondary process attach failed, ethdev doesn't exist" );return -ENODEV ; } eth_dev->process_private = cpp;
@@ -1012,8 +1006,9 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return 0 ; } -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev) +static int +nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +struct rte_pci_device *dev) {if (rte_eal_process_type () ==RTE_PROC_PRIMARY )return nfp_pf_init (dev);
@@ -1035,7 +1030,8 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { }, }; -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev) +static int +nfp_pci_uninit (struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev;uint16_t port_id;
@@ -1052,7 +1048,8 @@ static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)return -ENOTSUP ; } -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev) +static int +eth_nfp_pci_remove (struct rte_pci_device *pci_dev) {return rte_eth_dev_pci_generic_remove (pci_dev, nfp_pci_uninit); }
drivers/net/nfp/nfp_ethdev_vf.c +4 -4
@@ -296,11 +296,11 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD , +"device %s can not be used: restricted dma mask to 40 bits!\n" , + pci_dev->device.name);return -ENODEV ; - }; + } hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);
Signature · 1 line
2.27.0
PATCH v3 2/13 net/nfp: remove unnecessary forward function declaration
In reply to Jin LiuThis commit remove some unnecessary forward function declarations.
--- drivers/net/nfp/nfp_ethdev.c | 22 ---------------------- drivers/net/nfp/nfp_ethdev_vf.c | 12 ------------ drivers/net/nfp/nfp_rxtx.c | 21 --------------------- 3 files changed, 55 deletions(-)
drivers/net/nfp/nfp_ethdev.c +0 -22
@@ -38,28 +38,6 @@#include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" - -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port); -static int nfp_net_start (struct rte_eth_dev *dev); -static int nfp_net_stop (struct rte_eth_dev *dev); -static int nfp_net_set_link_up (struct rte_eth_dev *dev); -static int nfp_net_set_link_down (struct rte_eth_dev *dev); -static int nfp_net_close (struct rte_eth_dev *dev); -static int nfp_net_init (struct rte_eth_dev *eth_dev); -static int nfp_fw_upload (struct rte_pci_device *dev, -struct nfp_nsp *nsp,char *card); -static int nfp_fw_setup (struct rte_pci_device *dev, -struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table, -struct nfp_hwinfo *hwinfo); -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev); -static int nfp_pf_init (struct rte_pci_device *pci_dev); -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev); -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev); -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev); -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port) {
drivers/net/nfp/nfp_ethdev_vf.c +0 -12
@@ -23,18 +23,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -static void nfp_netvf_read_mac (struct nfp_net_hw *hw); -static int nfp_netvf_start (struct rte_eth_dev *dev); -static int nfp_netvf_stop (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_up (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_down (struct rte_eth_dev *dev); -static int nfp_netvf_close (struct rte_eth_dev *dev); -static int nfp_netvf_init (struct rte_eth_dev *eth_dev); -static int nfp_vf_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *pci_dev); -static int eth_nfp_vf_pci_remove (struct rte_pci_device *pci_dev); -static void nfp_netvf_read_mac (struct nfp_net_hw *hw) {
drivers/net/nfp/nfp_rxtx.c +0 -21
@@ -21,27 +21,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -/* Prototypes */ -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq); -static inline void nfp_net_mbuf_alloc_failed (struct nfp_net_rxq *rxq); -static inline void nfp_net_set_hash (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mbuf); -static inline void nfp_net_rx_cksum (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mb); -static void nfp_net_rx_queue_release_mbufs (struct nfp_net_rxq *rxq); -static int nfp_net_tx_free_bufs (struct nfp_net_txq *txq); -static void nfp_net_tx_queue_release_mbufs (struct nfp_net_txq *txq); -static inline uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq); -static inline uint32_t nfp_net_txq_full (struct nfp_net_txq *txq); -static inline void nfp_net_tx_tso (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static inline void nfp_net_tx_cksum (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq) {
Signature · 1 line
2.27.0
PATCH v3 3/13 net/nfp: remove pessimistic limit
In reply to Jin LiuMultiple writes cause intermediate pointer values that do not end on complete TX descriptors.
The QCP peripheral on the NFP provides a number of access modes. In some access modes, the maximum amount to add must be restricted to a 6bit value. The particular access mode used by _nfp_qcp_ptr_add() has no such restrictions, so the "NFP_QCP_MAX_ADD" test is unnecessary.
Note that trying to add more that the configured ring size in a single add will cause a QCP overflow, caught and handled by the QCP peripheral.
--- drivers/net/nfp/nfp_common.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/nfp/nfp_common.h +1 -11
@@ -44,9 +44,6 @@ struct nfp_net_adapter;/* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) -/* Maximum value which can be added to a queue with one transaction */ -#define NFP_QCP_MAX_ADD 0x7f -/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -307,8 +304,6 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val)* @q: Base address for queue structure * @ptr: Add to the Read or Write pointer * @val: Value to add to the queue pointer -* -* If @val is greater than @NFP_QCP_MAX_ADD multiple writes are performed. */ static inline void nfp_qcp_ptr_add (uint8_t *q,enum nfp_qcp_ptr ptr,uint32_t val)
@@ -320,12 +315,7 @@ nfp_qcp_ptr_add(uint8_t *q, enum nfp_qcp_ptr ptr, uint32_t val)else off =NFP_QCP_QUEUE_ADD_WPTR ; -while (val >NFP_QCP_MAX_ADD ) { -nn_writel (rte_cpu_to_le_32 (NFP_QCP_MAX_ADD ), q + off); - val -=NFP_QCP_MAX_ADD ; -} - -nn_writel (rte_cpu_to_le_32 (val), q + off); +nn_writel (rte_cpu_to_le_32 (val), q + off); }/*
Signature · 1 line
2.27.0
PATCH v3 4/13 net/nfp: rename set MAC function
In reply to Jin LiuThe NFP eth driver function name start with 'nfp_net', but set_mac function start with 'nfp' only, rename it, be consistent with others.
--- drivers/net/nfp/nfp_common.c | 2 +- drivers/net/nfp/nfp_common.h | 2 +- drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/nfp/nfp_common.c +1 -1
@@ -274,7 +274,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) }int -nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) +nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) {struct nfp_net_hw *hw;uint32_t update, ctrl;
drivers/net/nfp/nfp_common.h +1 -1
@@ -350,7 +350,7 @@ void nfp_net_disable_queues(struct rte_eth_dev *dev);void nfp_net_params_setup (struct nfp_net_hw *hw);void nfp_eth_copy_mac (uint8_t *dst,const uint8_t *src);void nfp_net_write_mac (struct nfp_net_hw *hw,uint8_t *mac); -int nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +int nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr);int nfp_configure_rx_interrupt (struct rte_eth_dev *dev,struct rte_intr_handle *intr_handle);uint32_t nfp_check_offloads (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +1 -1
@@ -344,7 +344,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
drivers/net/nfp/nfp_ethdev_vf.c +1 -1
@@ -251,7 +251,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
Signature · 1 line
2.27.0
PATCH v3 5/13 net/nfp: rename function and struct
In reply to Jin LiuAdd 'nfd3' into the firmware with NFD3 eth driver function name, preparation for the next work, as we will support another version firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 12 ++++++------ drivers/net/nfp/nfp_ethdev_vf.c | 8 ++++---- drivers/net/nfp/nfp_rxtx.c | 30 +++++++++++++++--------------- drivers/net/nfp/nfp_rxtx.h | 8 ++++---- 4 files changed, 29 insertions(+), 29 deletions(-)
drivers/net/nfp/nfp_ethdev.c +6 -6
@@ -329,7 +329,7 @@ nfp_net_close(struct rte_eth_dev *dev) }/* Initialise and register driver with DPDK Application */ -static const struct eth_dev_ops nfp_net_eth_dev_ops = { +static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, .dev_stop = nfp_net_stop,
@@ -352,7 +352,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -402,10 +402,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " "NFP internal port number: %d" , port, hw->nfp_idx); - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -971,10 +971,10 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return -ENODEV ; } eth_dev->process_private = cpp; - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;rte_eth_dev_probing_finish (eth_dev); }
drivers/net/nfp/nfp_ethdev_vf.c +4 -4
@@ -236,7 +236,7 @@ nfp_netvf_close(struct rte_eth_dev *dev) }/* Initialise and register VF driver with DPDK Application */ -static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { +static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_netvf_start, .dev_stop = nfp_netvf_stop,
@@ -259,7 +259,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -292,10 +292,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); - eth_dev->dev_ops = &nfp_netvf_eth_dev_ops; + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
drivers/net/nfp/nfp_rxtx.c +15 -15
@@ -655,7 +655,7 @@ nfp_net_reset_tx_queue(struct nfp_net_txq *txq) }int -nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf) {
@@ -670,7 +670,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,PMD_INIT_FUNC_TRACE ();/* Validating number of descriptors */ - tx_desc_sz = nb_desc *sizeof (struct nfp_net_tx_desc ); + tx_desc_sz = nb_desc *sizeof (struct nfp_net_nfd3_tx_desc );if (tx_desc_sz %NFP_ALIGN_RING_DESC !=0 || nb_desc >NFP_NET_MAX_TX_DESC || nb_desc <NFP_NET_MIN_TX_DESC ) {
@@ -718,7 +718,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,* resizing in later calls to the queue setup function. */ tz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_idx, -sizeof (struct nfp_net_tx_desc ) * +sizeof (struct nfp_net_nfd3_tx_desc ) *NFP_NET_MAX_TX_DESC ,NFP_MEMZONE_ALIGN , socket_id);if (tz ==NULL ) {
@@ -743,7 +743,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,/* Saving physical and virtual addresses for the TX ring */ txq->dma = (uint64_t )tz->iova; - txq->txds = (struct nfp_net_tx_desc *)tz->addr; + txq->txds = (struct nfp_net_nfd3_tx_desc *)tz->addr;/* mbuf pointers array for referencing mbufs linked to TX descriptors */ txq->txbufs = rte_zmalloc_socket("txq->txbufs",
@@ -773,7 +773,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,/* Leaving always free descriptors for avoiding wrapping confusion */ static inline -uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq) +uint32_t nfp_net_nfd3_free_tx_desc (struct nfp_net_txq *txq) {if (txq->wr_p >= txq->rd_p)return txq->tx_count - (txq->wr_p - txq->rd_p) -8 ;
@@ -790,14 +790,14 @@ uint32_t nfp_free_tx_desc(struct nfp_net_txq *txq)* This function uses the host copy* of read/write pointers */ static inline -uint32_t nfp_net_txq_full (struct nfp_net_txq *txq) +uint32_t nfp_net_nfd3_txq_full (struct nfp_net_txq *txq) { -return (nfp_free_tx_desc (txq) < txq->tx_free_thresh); +return (nfp_net_nfd3_free_tx_desc (txq) < txq->tx_free_thresh); }/* nfp_net_tx_tso - Set TX descriptor for TSO */ static inline void -nfp_net_tx_tso (struct nfp_net_txq *txq,struct nfp_net_tx_desc *txd, +nfp_net_nfd3_tx_tso (struct nfp_net_txq *txq,struct nfp_net_nfd3_tx_desc *txd,struct rte_mbuf *mb) {uint64_t ol_flags;
@@ -828,7 +828,7 @@ nfp_net_tx_tso(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd,/* nfp_net_tx_cksum - Set TX CSUM offload flags in TX descriptor */ static inline void -nfp_net_tx_cksum (struct nfp_net_txq *txq,struct nfp_net_tx_desc *txd, +nfp_net_nfd3_tx_cksum (struct nfp_net_txq *txq,struct nfp_net_nfd3_tx_desc *txd,struct rte_mbuf *mb) {uint64_t ol_flags;
@@ -857,11 +857,11 @@ nfp_net_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd, }uint16_t -nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) +nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct nfp_net_txq *txq;struct nfp_net_hw *hw; -struct nfp_net_tx_desc *txds, txd; +struct nfp_net_nfd3_tx_desc *txds, txd;struct rte_mbuf *pkt;uint64_t dma_addr;int pkt_size, dma_size;
@@ -876,10 +876,10 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)PMD_TX_LOG (DEBUG ,"working for queue %u at pos %d and %u packets" , txq->qidx, txq->wr_p, nb_pkts); -if ((nfp_free_tx_desc (txq) < nb_pkts) || (nfp_net_txq_full (txq))) +if ((nfp_net_nfd3_free_tx_desc (txq) < nb_pkts) || (nfp_net_nfd3_txq_full (txq)))nfp_net_tx_free_bufs (txq); - free_descs = (uint16_t )nfp_free_tx_desc (txq); + free_descs = (uint16_t )nfp_net_nfd3_free_tx_desc (txq);if (unlikely (free_descs ==0 ))return 0 ;
@@ -913,8 +913,8 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)* multisegment packet, but TSO info needs to be in all of them. */ txd.data_len = pkt->pkt_len; -nfp_net_tx_tso (txq, &txd, pkt); -nfp_net_tx_cksum (txq, &txd, pkt); +nfp_net_nfd3_tx_tso (txq, &txd, pkt); +nfp_net_nfd3_tx_cksum (txq, &txd, pkt);if ((pkt->ol_flags &RTE_MBUF_F_TX_VLAN ) && (hw->cap &NFP_NET_CFG_CTRL_TXVLAN )) {
drivers/net/nfp/nfp_rxtx.h +4 -4
@@ -53,7 +53,7 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) -struct nfp_net_tx_desc { +struct nfp_net_nfd3_tx_desc { union { struct { uint8_t dma_addr_hi; /* High bits of host buf address */
@@ -124,7 +124,7 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_tx_desc *txds; +struct nfp_net_nfd3_tx_desc *txds;/* * At this point 48 bytes have been used for all the fields in the
@@ -286,10 +286,10 @@ int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct rte_mempool *mp);void nfp_net_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx);void nfp_net_reset_tx_queue (struct nfp_net_txq *txq); -int nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +int nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf); -uint16_t nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */
Signature · 1 line
2.27.0
PATCH v3 6/13 net/nfp: support NFP3800 card
In reply to Jin LiuAdd support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
--- doc/guides/nics/nfp.rst | 3 ++- doc/guides/rel_notes/release_22_07.rst | 4 +++ drivers/net/nfp/nfp_common.h | 34 ++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 +++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +++++++++++---- 7 files changed, 86 insertions(+), 14 deletions(-)
doc/guides/nics/nfp.rst +2 -1
@@ -12,7 +12,8 @@ up to 400-Gb/s. This document explains how to use DPDK with the Netronome Poll Mode Driver (PMD) supporting Netronome's Network Flow Processor 6xxx -(NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx). +(NFP-6xxx), Netronome's Network Flow Processor 4xxx (NFP-4xxx) and +Netronome's Network Flow Processor 38xx (NFP-38xx). NFP is a SRIOV capable device and the PMD supports the physical function (PF) and the virtual functions (VFs).
doc/guides/rel_notes/release_22_07.rst +4 -0
@@ -108,6 +108,10 @@ New Features * Added support for MTU on Windows. * Added matching and RSS on IPsec ESP. +* **Updated Netronome nfp driver.** + + * Added support for NFP3800 NIC. + * **Updated VMware vmxnet3 networking driver.** * Added version 5 support.
drivers/net/nfp/nfp_common.h +32 -2
@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803#define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000#define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 -#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 +#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003/* Include NFP4000VF */ /* Forward declaration */ struct nfp_net_adapter ;
@@ -41,8 +43,16 @@ struct nfp_net_adapter;#define NFP_QCP_QUEUE_STS_HI 0x000c#define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask (0x3ffff) +#define NFP_PCIE_QCP_NFP3800_OFFSET 0x400000 +#define NFP_PCIE_QCP_NFP6000_OFFSET 0x80000 +#define NFP_PCIE_QUEUE_NFP3800_MASK 0x1ff +#define NFP_PCIE_QUEUE_NFP6000_MASK 0xff +#define NFP_PCIE_QCP_PF_OFFSET 0x0 +#define NFP_PCIE_QCP_VF_OFFSET 0x0 +/* The offset of the queue controller queues in the PCIe Target */ -#define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) +#define NFP_PCIE_QUEUE (_offset, _q, _mask) \ + ((_offset) + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & (_mask))))/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -342,6 +352,26 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr)return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +static inline uint32_t +nfp_pci_queue (struct rte_pci_device *pdev,uint16_t queue) +{ +switch (pdev->id.device_id) { +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +case PCI_DEVICE_ID_NFP3800_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); +case PCI_DEVICE_ID_NFP6000_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +default : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); + } +} +/* Prototypes for common NFP functions */ int nfp_net_reconfig (struct nfp_net_hw *hw,uint32_t ctrl,uint32_t update);int nfp_net_configure (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +25 -3
@@ -446,12 +446,13 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC :case PCI_DEVICE_ID_NFP4000_PF_NIC :case PCI_DEVICE_ID_NFP6000_PF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -764,6 +765,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) {int err;int ret =0 ; +uint64_t addr;int total_ports;struct nfp_cpp *cpp;struct nfp_pf_dev *pf_dev;
@@ -867,8 +869,24 @@ nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , pf_dev->ctrl_bar);/* configure access to tx/rx vNIC BARs */ +switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP3800_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP3800_MASK ); +break ; +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP6000_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP6000_MASK ); +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no device ID matching" ); + err = -ENODEV ; + goto ctrl_area_cleanup; + } + pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + addr,NFP_QCP_QUEUE_AREA_SZ , &pf_dev->hwqueues_area);if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" );
@@ -995,6 +1013,10 @@ nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_PF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP4000_PF_NIC )
drivers/net/nfp/nfp_ethdev_vf.c +7 -2
@@ -327,11 +327,12 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_VF_NIC :case PCI_DEVICE_ID_NFP6000_VF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -456,6 +457,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) }static const struct rte_pci_id pci_id_nfp_vf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_VF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP6000_VF_NIC )
drivers/net/nfp/nfpcore/nfp_cpp.h +1 -1
@@ -214,7 +214,7 @@ void nfp_cpp_free(struct nfp_cpp *cpp);* @return true if model is in the NFP6000 family, false otherwise. */ #define NFP_CPP_MODEL_IS_6000 (model) \ - ((NFP_CPP_MODEL_CHIP_of(model) >= 0x4000) && \ + ((NFP_CPP_MODEL_CHIP_of(model) >= 0x3800) && \ (NFP_CPP_MODEL_CHIP_of(model) < 0x7000))/*
drivers/net/nfp/nfpcore/nfp_nsp_eth.c +15 -5
@@ -266,6 +266,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)struct nfp_eth_table *table;uint32_t table_sz;int i, j, ret, cnt =0 ; +const struct rte_ether_addr *mac; entries =malloc (NSP_ETH_TABLE_SIZE );if (!entries)
@@ -278,9 +279,15 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) goto err; } -for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +/* The NFP3800 NIC support 8 ports, but only 2 ports are valid, +* the rest 6 ports mac are all 0, ensure we don't use these port +*/ +for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac))) cnt++; + }/* Some versions of flash will give us 0 instead of port count. For * those that give a port count, verify it against the value calculated
@@ -299,10 +306,13 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)memset (table,0 , table_sz); table->count = cnt; -for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac)))nfp_eth_port_translate (nsp, &entries[i], i, - &table->ports[j++]); + &table->ports[j++]); + }nfp_eth_calc_port_geometry (table);for (i =0 ; i < (int )table->count; i++)
Signature · 1 line
2.27.0
PATCH v3 7/13 net/nfp: support firmware with NFDk
In reply to Jin LiuModify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
--- doc/guides/nics/nfp.rst | 7 ++-- doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/nfp/nfp_ctrl.h | 2 + drivers/net/nfp/nfp_ethdev.c | 49 +++++++++++++++++++----- drivers/net/nfp/nfp_ethdev_vf.c | 53 +++++++++++++++++++------- 5 files changed, 85 insertions(+), 27 deletions(-)
doc/guides/nics/nfp.rst +4 -3
@@ -100,9 +100,10 @@ more than one SmartNIC, same type of SmartNIC or different ones, and to upload a different firmware to each SmartNIC. .. Note:: - Currently the NFP PMD supports using the PF with Agilio Basic Firmware. See - https://help.netronome.com/support/solutions for more information on the - various firmwares supported by the Netronome Agilio CX smartNIC. + Currently the NFP PMD supports using the PF with Agilio Firmware with NFD3 + and Agilio Firmware with NFDk. See https://help.netronome.com/support/solutions + for more information on the various firmwares supported by the Netronome + Agilio CX smartNIC. PF multiport support --------------------
doc/guides/rel_notes/release_22_07.rst +1 -0
@@ -111,6 +111,7 @@ New Features * **Updated Netronome nfp driver.** * Added support for NFP3800 NIC. + * Added support for firmware with NFDk. * **Updated VMware vmxnet3 networking driver.**
drivers/net/nfp/nfp_ctrl.h +2 -0
@@ -135,6 +135,8 @@* - define more STS bits */ #define NFP_NET_CFG_VERSION 0x0030 +#define NFP_NET_CFG_VERSION_DP_NFD3 0 +#define NFP_NET_CFG_VERSION_DP_NFDK 1#define NFP_NET_CFG_VERSION_RESERVED_MASK (0xff << 24)#define NFP_NET_CFG_VERSION_CLASS_MASK (0xff << 16)#define NFP_NET_CFG_VERSION_CLASS (x) (((x) & 0xff) << 16)
drivers/net/nfp/nfp_ethdev.c +39 -10
86 lines not on this page · raw message
drivers/net/nfp/nfp_ethdev_vf.c +39 -14
77 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v3 8/13 net/nfp: structure adjustment
In reply to Jin LiuAdd and modify the nfp PMD struct and macro that will be used by firmware with NFDk.
--- drivers/net/nfp/nfp_rxtx.h | 58 +++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-)
drivers/net/nfp/nfp_rxtx.h +57 -1
@@ -53,6 +53,31 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) +#define NFDK_TX_MAX_DATA_PER_HEAD 0x00001000 +#define NFDK_DESC_TX_DMA_LEN_HEAD 0x0fff +#define NFDK_DESC_TX_TYPE_HEAD 0xf000 +#define NFDK_DESC_TX_DMA_LEN 0x3fff +#define NFDK_TX_DESC_PER_SIMPLE_PKT 2 +#define NFDK_DESC_TX_TYPE_TSO 2 +#define NFDK_DESC_TX_TYPE_SIMPLE 8 +#define NFDK_DESC_TX_TYPE_GATHER 1 +#define NFDK_DESC_TX_EOP BIT(14) +#define NFDK_DESC_TX_L4_CSUM BIT(1) +#define NFDK_DESC_TX_L3_CSUM BIT(0) + +#define NFDK_TX_MAX_DATA_PER_DESC 0x00004000 +#define NFDK_TX_DESC_GATHER_MAX 17 +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) +#define NFDK_TX_DESC_BLOCK_SZ 256 +#define NFDK_TX_DESC_BLOCK_CNT (NFDK_TX_DESC_BLOCK_SZ / \ + sizeof(struct nfp_net_nfdk_tx_desc)) +#define NFDK_TX_DESC_STOP_CNT (NFDK_TX_DESC_BLOCK_CNT * \ + NFDK_TX_DESC_PER_SIMPLE_PKT) +#define NFDK_TX_MAX_DATA_PER_BLOCK 0x00010000 +#define D_BLOCK_CPL (idx) (NFDK_TX_DESC_BLOCK_CNT - \ + (idx) % NFDK_TX_DESC_BLOCK_CNT) +#define D_IDX (ring, idx) ((idx) & ((ring)->tx_count - 1)) + struct nfp_net_nfd3_tx_desc { union { struct {
@@ -84,6 +109,33 @@ struct nfp_net_nfd3_tx_desc { }; }; +struct nfp_net_nfdk_tx_desc { +union { +struct { +__le16 dma_addr_hi;/* High bits of host buf address */ +__le16 dma_len_type;/* Length to DMA for this desc */ +__le32 dma_addr_lo;/* Low 32bit of host buf addr */ + }; + +struct { +__le16 mss;/* MSS to be used for LSO */ +uint8_t lso_hdrlen;/* LSO, TCP payload offset */ +uint8_t lso_totsegs;/* LSO, total segments */ +uint8_t l3_offset;/* L3 header offset */ +uint8_t l4_offset;/* L4 header offset */ +__le16 lso_meta_res;/* Rsvd bits in TSO metadata */ + }; + +struct { +uint8_t flags;/* TX Flags, see @NFDK_DESC_TX_* */ +uint8_t reserved[7 ];/* meta byte placeholder */ + }; + +__le32 vals[2 ]; +__le64 raw; + }; +}; +struct nfp_net_txq {struct nfp_net_hw *hw;/* Backpointer to nfp_net structure */
@@ -124,7 +176,10 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_nfd3_tx_desc *txds; +union { +struct nfp_net_nfd3_tx_desc *txds; +struct nfp_net_nfdk_tx_desc *ktxds; + };/* * At this point 48 bytes have been used for all the fields in the
@@ -137,6 +192,7 @@ struct nfp_net_txq {uint32_t tx_hthresh;/* not used by now. Future? */ uint32_t tx_wthresh;/* not used by now. Future? */ uint16_t port_id; +uint16_t data_pending;/* used by nfdk only */ int qidx;int tx_qcidx;__le64 dma;
Signature · 1 line
2.27.0
PATCH v3 9/13 net/nfp: nfdk netdev option and queue function
In reply to Jin LiuAdd ethdev option for firmware with NFDk, implement tx_queue setup function for firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 32 ++++++++- drivers/net/nfp/nfp_ethdev_vf.c | 32 ++++++++- drivers/net/nfp/nfp_rxtx.c | 117 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 5 ++ 4 files changed, 184 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +31 -1
@@ -358,11 +358,41 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_net_start, + .dev_stop = nfp_net_stop, + .dev_set_link_up = nfp_net_set_link_up, + .dev_set_link_down = nfp_net_set_link_down, + .dev_close = nfp_net_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_net_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -370,13 +400,13 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_ethdev_vf.c +31 -1
@@ -265,11 +265,41 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_netvf_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_netvf_start, + .dev_stop = nfp_netvf_stop, + .dev_set_link_up = nfp_netvf_set_link_up, + .dev_set_link_down = nfp_netvf_set_link_down, + .dev_close = nfp_netvf_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_netvf_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -277,13 +307,13 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_rxtx.c +117 -0
120 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +5 -0
@@ -347,6 +347,11 @@ int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, const struct rte_eth_txconf *tx_conf);uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int nfp_net_nfdk_tx_queue_setup (struct rte_eth_dev *dev, +uint16_t queue_idx, +uint16_t nb_desc, +unsigned int socket_id, +const struct rte_eth_txconf *tx_conf);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH v3 10/13 net/nfp: add queue stop and close helper function
In reply to Jin LiuThis commit does not introduce new features, just integrate some common logic into helper functions to reduce the same logic and increase code reuse, include queue stop and queue close logic, will be used when NFP net stop and close.
queue stop: reset queue
queue close: reset and release queue
Modify NFP net stop and close function, use helper function to stop and close queue instead of before logic.
--- drivers/net/nfp/nfp_common.c | 50 +++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_common.h | 4 +++ drivers/net/nfp/nfp_ethdev.c | 27 +++--------------- drivers/net/nfp/nfp_ethdev_vf.c | 29 +++---------------- 4 files changed, 62 insertions(+), 48 deletions(-)
drivers/net/nfp/nfp_common.c +50 -0
@@ -1320,6 +1320,56 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev)return ret; } +void +nfp_net_stop_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); + } +} + +void +nfp_net_close_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); +nfp_net_rx_queue_release (dev, i); + } +} + +void +nfp_net_stop_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_reset_tx_queue (this_tx_q); + } +} + +void +nfp_net_close_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_reset_tx_queue (this_tx_q); +nfp_net_tx_queue_release (dev, i); + } +} +RTE_LOG_REGISTER_SUFFIX (nfp_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (nfp_logtype_driver, driver,NOTICE );/*
drivers/net/nfp/nfp_common.h +4 -0
@@ -413,6 +413,10 @@ int nfp_net_rss_hash_update(struct rte_eth_dev *dev,int nfp_net_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf);int nfp_net_rss_config_default (struct rte_eth_dev *dev); +void nfp_net_stop_rx_queue (struct rte_eth_dev *dev); +void nfp_net_close_rx_queue (struct rte_eth_dev *dev); +void nfp_net_stop_tx_queue (struct rte_eth_dev *dev); +void nfp_net_close_tx_queue (struct rte_eth_dev *dev);#define NFP_NET_DEV_PRIVATE_TO_HW (adapter)\ (&((struct nfp_net_adapter *)adapter)->hw)
drivers/net/nfp/nfp_ethdev.c +4 -23
@@ -181,10 +181,7 @@ nfp_net_start(struct rte_eth_dev *dev)static int nfp_net_stop (struct rte_eth_dev *dev) { -int i;struct nfp_net_hw *hw; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;PMD_INIT_LOG (DEBUG ,"Stop" );
@@ -193,15 +190,9 @@ nfp_net_stop(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); - } +nfp_net_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);if (rte_eal_process_type () ==RTE_PROC_PRIMARY )/* Configure the physical port down */
@@ -256,8 +247,6 @@ nfp_net_close(struct rte_eth_dev *dev)struct nfp_net_hw *hw;struct rte_pci_device *pci_dev;struct nfp_pf_dev *pf_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -277,17 +266,9 @@ nfp_net_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); - } +nfp_net_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);/* Cancel possible impending LSC work here before releasing the port*/ rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler,
drivers/net/nfp/nfp_ethdev_vf.c +4 -25
@@ -145,24 +145,14 @@ nfp_netvf_start(struct rte_eth_dev *dev)static int nfp_netvf_stop (struct rte_eth_dev *dev) { -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i; -PMD_INIT_LOG (DEBUG ,"Stop" );nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); - } +nfp_net_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);return 0 ; }
@@ -185,9 +175,6 @@ static int nfp_netvf_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ;
@@ -204,17 +191,9 @@ nfp_netvf_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); - } +nfp_net_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);rte_intr_disable (pci_dev->intr_handle);
Signature · 1 line
2.27.0
PATCH v3 11/13 net/nfp: move macro from C file to head file
In reply to Jin LiuMove macro __round_mask, round_up and round_down from C file to corresponding head file, will be used by TX function of nfp net firmware with NFDk.
--- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 ------------------- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/net/nfp/nfpcore/nfp_rtsym.c +0 -19
@@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp)return rtbl; } -/* -* This looks more complex than it should be. But we need to get the type for -* the ~ right in round_down (it needs to be as wide as the result!), and we -* want to evaluate the macro arguments just once each. -*/ -#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) - -#define round_up (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((((_x) - 1) | __round_mask(_x, y)) + 1); \ - })) - -#define round_down (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((_x) & ~__round_mask(_x, y)); \ - })) -struct nfp_rtsym_table *__nfp_rtsym_table_read (struct nfp_cpp *cpp,const struct nfp_mip *mip) {
drivers/net/nfp/nfpcore/nfp_rtsym.h +19 -0
@@ -15,6 +15,25 @@#define NFP_RTSYM_TARGET_LMEM -1#define NFP_RTSYM_TARGET_EMU_CACHE -7 +/* +* This looks more complex than it should be. But we need to get the type for +* the ~ right in round_down (it needs to be as wide as the result!), and we +* want to evaluate the macro arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) + +#define round_up (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((((_x) - 1) | __round_mask(_x, y)) + 1); \ + })) + +#define round_down (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((_x) & ~__round_mask(_x, y)); \ + })) +/* * Structure describing a run-time NFP symbol. *
Signature · 1 line
2.27.0
PATCH v3 12/13 net/nfp: nfdk packet xmit function
In reply to Jin LiuImplement NFP3800 card packet transmit function for firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 3 +- drivers/net/nfp/nfp_ethdev_vf.c | 3 +- drivers/net/nfp/nfp_rxtx.c | 281 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 3 + 4 files changed, 288 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +2 -1
@@ -374,6 +374,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -382,6 +383,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -390,7 +392,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_ethdev_vf.c +2 -1
@@ -279,6 +279,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -287,6 +288,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -295,7 +297,6 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_rxtx.c +281 -0
290 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +3 -0
@@ -352,6 +352,9 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); +uint16_t nfp_net_nfdk_xmit_pkts (void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
Re: [PATCH v3 12/13] net/nfp: nfdk packet xmit function
17/06/2022 11:34, Jin Liu:
Quoted 5 lines
drivers/net/nfp/nfp_rxtx.c +5
-0+if (unlikely (pkt->nb_segs >1 && + !(hw->cap &NFP_NET_CFG_CTRL_GATHER ))) { +PMD_INIT_LOG (INFO ,"NFP_NET_CFG_CTRL_GATHER not set" ); +rte_panic ("Multisegment packet unsupported\n" ); + }
[...]
drivers/net/nfp/nfp_rxtx.c nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, · line 1368
Quoted 4 lines
drivers/net/nfp/nfp_rxtx.c +4
-0+if (round_down (txq->wr_p,NFDK_TX_DESC_BLOCK_CNT ) != +round_down (txq->wr_p + used_descs -1 ,NFDK_TX_DESC_BLOCK_CNT )) { +rte_panic ("Used descs cross block boundary\n" ); + }
You cannot use rte_panic in a driver or library.
It will make the user experience terrible.
If there is a failure, please log an error and return appropriately.
There is a check in the CI to avoid such use:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
https://mails.dpdk.org/archives/test-report/2022-June/290206.html
It seems you've ignored this critical warning.
I don't want to let new occurences of rte_panic enter in drivers, so I'll drop this patch from the main branch.
Please re-submit without rte_panic.
Re: [PATCH v3 12/13] net/nfp: nfdk packet xmit function
Quoted 20 lines · Thomas Monjalon
17/06/2022 11:34, Jin Liu:
Quoted 5 lines
drivers/net/nfp/nfp_rxtx.c +5
-0+if (unlikely (pkt->nb_segs >1 && + !(hw->cap &NFP_NET_CFG_CTRL_GATHER ))) { +PMD_INIT_LOG (INFO ,"NFP_NET_CFG_CTRL_GATHER not set" ); +rte_panic ("Multisegment packet unsupported\n" ); + }[...]
drivers/net/nfp/nfp_rxtx.c nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev, · line 1368
Quoted 4 lines
drivers/net/nfp/nfp_rxtx.c +4
-0+if (round_down (txq->wr_p,NFDK_TX_DESC_BLOCK_CNT ) != +round_down (txq->wr_p + used_descs -1 ,NFDK_TX_DESC_BLOCK_CNT )) { +rte_panic ("Used descs cross block boundary\n" ); + }You cannot use
rte_panicin a driver or library.
It will make the user experience terrible.
If there is a failure, please log an error and return appropriately.There is a check in the CI to avoid such use:
https://patches.dpdk.org/project/dpdk/patch/[email protected]/
https://mails.dpdk.org/archives/test-report/2022-June/290206.html
Quoted 7 lines
It seems you've ignored this critical warning.
I don't want to let new occurences of
rte_panicenter in drivers, so I'll drop this patch from the main branch.
Please re-submit withoutrte_panic.
I also missed it, dropping patch from next-net.
PATCH v3 13/13 net/nfp: modify RSS logic
In reply to Jin LiuNow NFP NIC support two type of RSS logic, NFP_NET_CFG_CTRL_RSS and NFP_NET_CFG_CTRL_RSS2, use NFP_NET_CFG_CTRL_RSS2 if NIC capability support, otherwise use NFP_NET_CFG_CTRL_RSS.
--- drivers/net/nfp/nfp_common.c | 12 ++++++------ drivers/net/nfp/nfp_ctrl.h | 1 + drivers/net/nfp/nfp_ethdev.c | 5 ++++- drivers/net/nfp/nfp_ethdev_vf.c | 5 ++++- drivers/net/nfp/nfp_rxtx.c | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-)
drivers/net/nfp/nfp_common.c +6 -6
@@ -171,7 +171,7 @@ nfp_net_configure(struct rte_eth_dev *dev)/* Checking RX mode */ if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS && - !(hw->cap &NFP_NET_CFG_CTRL_RSS )) { + !(hw->cap &NFP_NET_CFG_CTRL_RSS_ANY )) {PMD_INIT_LOG (INFO ,"RSS not supported" );return -EINVAL ; }
@@ -769,7 +769,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG, }; -if (hw->cap &NFP_NET_CFG_CTRL_RSS ) { +if (hw->cap &NFP_NET_CFG_CTRL_RSS_ANY ) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 |
@@ -1080,7 +1080,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,uint32_t update;int ret; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; ret =nfp_net_rss_reta_write (dev, reta_conf, reta_size);
@@ -1108,7 +1108,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ;if (reta_size !=NFP_NET_CFG_RSS_ITBL_SZ ) {
@@ -1206,7 +1206,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, rss_hf = rss_conf->rss_hf;/* Checking if RSS is enabled */ -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) { +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY )) {if (rss_hf !=0 ) {/* Enable RSS? */ PMD_DRV_LOG (ERR ,"RSS unsupported" );return -EINVAL ;
@@ -1241,7 +1241,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; rss_hf = rss_conf->rss_hf;
drivers/net/nfp/nfp_ctrl.h +1 -0
@@ -119,6 +119,7 @@#define NFP_NET_CFG_MACADDR 0x0024#define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) +#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2)/* * Read-only words (0x0030 - 0x0050):
drivers/net/nfp/nfp_ethdev.c +4 -1
@@ -123,7 +123,10 @@ nfp_net_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +if (hw->cap &NFP_NET_CFG_CTRL_RSS2 ) + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +else + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; }/* Enable device */
drivers/net/nfp/nfp_ethdev_vf.c +4 -1
@@ -95,7 +95,10 @@ nfp_netvf_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +if (hw->cap &NFP_NET_CFG_CTRL_RSS2 ) + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +else + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; }/* Enable device */
drivers/net/nfp/nfp_rxtx.c +1 -1
@@ -138,7 +138,7 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,uint32_t hash =0 ;uint32_t hash_type =0 ; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return ;/* this is true for new firmwares */
Signature · 1 line
2.27.0
Quoted 17 lines · Jin Liu
NFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.* Changes since v1
- Added updated documentation for NFP to cover NFD.
- Documented the addition of NFD in the release notes.
- Addednfp_netvf_ethdev_ops_mount()to make code better.
- Used capability instead of version to select RSS.
- Adjustednfp_net_txqstruct,just keep one txbuf.* Changes since v2
- Squashed doc update commit to feature commit.
- Adjusted doc comment postion and order.
- Modified function definition Format.
Quoted 14 lines
Jin Liu (13):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration net/nfp: remove pessimistic limit
net/nfp: rename set MAC function
net/nfp: rename function and struct
net/nfp: support NFP3800 card
net/nfp: support firmware with NFDk
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function
net/nfp: modify RSS logic
Series applied to dpdk-next-net/main, thanks.
v4 cover Add support of NFP3800 chip and firmware with NFDk
In reply to Jin LiuNFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.
* Changes since v1
- Added updated documentation for NFP to cover NFD.
- Documented the addition of NFD in the release notes.
- Added nfp_netvf_ethdev_ops_mount() to make code better.
- Used capability instead of version to select RSS.
- Adjusted nfp_net_txq struct,just keep one txbuf.
* Changes since v2
- Squashed doc update commit to feature commit.
- Adjusted doc comment postion and order.
- Modified function definition format.
* Changes since v3
- No longer use rte_panic.
Jin Liu (13):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration net/nfp: remove pessimistic limit
net/nfp: rename set MAC function
net/nfp: rename function and struct
net/nfp: support NFP3800 card
net/nfp: support firmware with NFDk
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function
net/nfp: modify RSS logic
doc/guides/nics/nfp.rst | 10 +- doc/guides/rel_notes/release_22_07.rst | 5 + drivers/net/nfp/nfp_common.c | 64 +++- drivers/net/nfp/nfp_common.h | 52 ++- drivers/net/nfp/nfp_ctrl.h | 3 + drivers/net/nfp/nfp_ethdev.c | 315 +++++++++-------- drivers/net/nfp/nfp_ethdev_vf.c | 153 +++++---- drivers/net/nfp/nfp_rxtx.c | 453 +++++++++++++++++++++++-- drivers/net/nfp/nfp_rxtx.h | 72 +++- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 ++ 13 files changed, 898 insertions(+), 289 deletions(-)
Signature · 1 line
2.27.0
PATCH v4 1/13 net/nfp: change the coding style
Change the coding style of some logics, to make it more compatible with the DPDK coding style.
--- drivers/net/nfp/nfp_ethdev.c | 149 ++++++++++++++++---------------- drivers/net/nfp/nfp_ethdev_vf.c | 8 +- 2 files changed, 77 insertions(+), 80 deletions(-)
drivers/net/nfp/nfp_ethdev.c +73 -76
@@ -340,8 +340,7 @@ nfp_net_close(struct rte_eth_dev *dev)/* unregister callback func from eal lib */ rte_intr_callback_unregister (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)dev); + nfp_net_dev_interrupt_handler, (void *)dev);/* * The ixgbe PMD disables the pcie master on the
@@ -388,8 +387,8 @@ nfp_net_init(struct rte_eth_dev *eth_dev)struct nfp_pf_dev *pf_dev;struct nfp_net_hw *hw;struct rte_ether_addr *tmp_ether_addr; - -uint64_t tx_bar_off =0 , rx_bar_off =0 ; +uint64_t rx_bar_off =0 ; +uint64_t tx_bar_off =0 ;uint32_t start_q;int stride =4 ;int port =0 ;
@@ -404,11 +403,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD , +"device %s can not be used: restricted dma mask to 40 bits!\n" , + pci_dev->device.name);return -ENODEV ; - }; + } port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx;if (port <0 || port >7 ) {
@@ -416,14 +415,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev)return -ENODEV ; } -/* Use PF array of physical ports to get pointer to +/* +* Use PF array of physical ports to get pointer to * this specific port */ hw = pf_dev->ports[port];PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " -"NFP internal port number: %d" , - port, hw->nfp_idx); +"NFP internal port number: %d" , port, hw->nfp_idx); eth_dev->dev_ops = &nfp_net_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count;
@@ -456,13 +455,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (port ==0 ) { hw->ctrl_bar = pf_dev->ctrl_bar; }else { -if (!pf_dev->ctrl_bar) +if (pf_dev->ctrl_bar ==NULL )return -ENODEV ; -/* Use port offset in pf ctrl_bar for this -* ports control bar -*/ - hw->ctrl_bar = pf_dev->ctrl_bar + - (port *NFP_PF_CSR_SLICE_SIZE ); +/* Use port offset in pf ctrl_bar for this ports control bar */ + hw->ctrl_bar = pf_dev->ctrl_bar + (port *NFP_PF_CSR_SLICE_SIZE ); }PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , hw->ctrl_bar);
@@ -557,8 +553,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev) tmp_ether_addr = (struct rte_ether_addr *)&hw->mac_addr;if (!rte_is_valid_assigned_ether_addr (tmp_ether_addr)) { -PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , - port); +PMD_INIT_LOG (INFO ,"Using random mac address for port %d" , port);/* Using random mac addresses for VFs */ rte_eth_random_addr (&hw->mac_addr[0 ]);nfp_net_write_mac (hw, (uint8_t *)&hw->mac_addr);
@@ -583,8 +578,7 @@ nfp_net_init(struct rte_eth_dev *eth_dev)if (rte_eal_process_type () ==RTE_PROC_PRIMARY ) {/* Registering LSC interrupt handler */ rte_intr_callback_register (pci_dev->intr_handle, - nfp_net_dev_interrupt_handler, - (void *)eth_dev); + nfp_net_dev_interrupt_handler, (void *)eth_dev);/* Telling the firmware about the LSC interrupt entry */ nn_cfg_writeb (hw,NFP_NET_CFG_LSC ,NFP_NET_IRQ_LSC_IDX );/* Recording current stats counters values */
@@ -656,8 +650,10 @@ nfp_fw_upload(struct rte_pci_device *dev, struct nfp_nsp *nsp, char *card) }static int -nfp_fw_setup (struct rte_pci_device *dev,struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table,struct nfp_hwinfo *hwinfo) +nfp_fw_setup (struct rte_pci_device *dev, +struct nfp_cpp *cpp, +struct nfp_eth_table *nfp_eth_table, +struct nfp_hwinfo *hwinfo) {struct nfp_nsp *nsp;const char *nfp_fw_model;
@@ -675,12 +671,12 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,if (nfp_eth_table->count ==0 || nfp_eth_table->count >8 ) {PMD_DRV_LOG (ERR ,"NFP ethernet table reports wrong ports: %u" , - nfp_eth_table->count); + nfp_eth_table->count);return -EIO ; }PMD_DRV_LOG (INFO ,"NFP ethernet port table reports %u ports" , - nfp_eth_table->count); + nfp_eth_table->count);PMD_DRV_LOG (INFO ,"Port speed: %u" , nfp_eth_table->ports[0 ].speed);
@@ -689,7 +685,7 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp, nfp_eth_table->ports[0].speed / 1000); nsp =nfp_nsp_open (cpp); -if (!nsp) { +if (nsp ==NULL ) {PMD_DRV_LOG (ERR ,"NFP error when obtaining NSP handle" );return -EIO ; }
@@ -701,19 +697,19 @@ nfp_fw_setup(struct rte_pci_device *dev, struct nfp_cpp *cpp,return err; } -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev) +static int +nfp_init_phyports (struct nfp_pf_dev *pf_dev) { +int i; +int ret =0 ;struct nfp_net_hw *hw;struct rte_eth_dev *eth_dev; -struct nfp_eth_table *nfp_eth_table =NULL ; -int ret =0 ; -int i; +struct nfp_eth_table *nfp_eth_table; nfp_eth_table =nfp_eth_read_ports (pf_dev->cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); - ret = -EIO ; - goto error; +return -EIO ; }/* Loop through all physical ports on PF */
@@ -726,7 +722,7 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate a eth_dev for this phyport */ eth_dev =rte_eth_dev_allocate (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) { ret = -ENODEV ; goto port_cleanup; }
@@ -734,8 +730,8 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)/* Allocate memory for this phyport */ eth_dev->data->dev_private =rte_zmalloc_socket (port_name,sizeof (struct nfp_net_hw ), -RTE_CACHE_LINE_SIZE , numa_node); -if (!eth_dev->data->dev_private) { +RTE_CACHE_LINE_SIZE , numa_node); +if (eth_dev->data->dev_private ==NULL ) { ret = -ENOMEM ;rte_eth_dev_release_port (eth_dev); goto port_cleanup;
@@ -759,7 +755,6 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev)* nfp_net_init */ ret =nfp_net_init (eth_dev); -if (ret) { ret = -ENODEV ; goto port_cleanup;
@@ -782,24 +777,25 @@ static int nfp_init_phyports(struct nfp_pf_dev *pf_dev) } eth_table_cleanup:free (nfp_eth_table); -error: +return ret; } -static int nfp_pf_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_init (struct rte_pci_device *pci_dev) { -struct nfp_pf_dev *pf_dev =NULL ; +int err; +int ret =0 ; +int total_ports;struct nfp_cpp *cpp; +struct nfp_pf_dev *pf_dev;struct nfp_hwinfo *hwinfo; -struct nfp_rtsym_table *sym_tbl; -struct nfp_eth_table *nfp_eth_table =NULL ;char name[RTE_ETH_NAME_MAX_LEN ]; -int total_ports; -int ret = -ENODEV ; -int err; +struct nfp_rtsym_table *sym_tbl; +struct nfp_eth_table *nfp_eth_table; -if (!pci_dev) -return ret; +if (pci_dev ==NULL ) +return -ENODEV ;/* * When device bound to UIO, the device could be used, by mistake,
@@ -813,21 +809,21 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" ); ret = -EIO ; goto error; } hwinfo =nfp_hwinfo_read (cpp); -if (!hwinfo) { +if (hwinfo ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading hwinfo table" ); ret = -EIO ; goto error; } nfp_eth_table =nfp_eth_read_ports (cpp); -if (!nfp_eth_table) { +if (nfp_eth_table ==NULL ) {PMD_INIT_LOG (ERR ,"Error reading NFP ethernet table" ); ret = -EIO ; goto hwinfo_cleanup;
@@ -841,7 +837,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Now the symbol table should be there */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" ); ret = -EIO ;
@@ -865,7 +861,7 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Allocate memory for the PF "device" */ snprintf (name,sizeof (name),"nfp_pf%d" ,0 ); pf_dev =rte_zmalloc (name,sizeof (*pf_dev),0 ); -if (!pf_dev) { +if (pf_dev ==NULL ) { ret = -ENOMEM ; goto sym_tbl_cleanup; }
@@ -883,9 +879,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* Map the symbol table */ pf_dev->ctrl_bar =nfp_rtsym_map (pf_dev->sym_tbl,"_pf0_net_bar0" , - pf_dev->total_phyports *32768 , - &pf_dev->ctrl_area); -if (!pf_dev->ctrl_bar) { + pf_dev->total_phyports *32768 , &pf_dev->ctrl_area); +if (pf_dev->ctrl_bar ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for _pf0_net_ctrl_bar" ); ret = -EIO ; goto pf_cleanup;
@@ -895,10 +890,9 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)/* configure access to tx/rx vNIC BARs */ pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ), -NFP_QCP_QUEUE_AREA_SZ , - &pf_dev->hwqueues_area); -if (!pf_dev->hw_queues) { +NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + &pf_dev->hwqueues_area); +if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" ); ret = -EIO ; goto ctrl_area_cleanup;
@@ -906,7 +900,8 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"tx/rx bar address: 0x%p" , pf_dev->hw_queues); -/* Initialize and prep physical ports now +/* +* Initialize and prep physical ports now * This will loop through all physical ports */ ret =nfp_init_phyports (pf_dev);
@@ -941,15 +936,16 @@ static int nfp_pf_init(struct rte_pci_device *pci_dev)* is no need to initialise the PF again. Only minimal work is required * here */ -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev) +static int +nfp_pf_secondary_init (struct rte_pci_device *pci_dev) { -struct nfp_cpp *cpp; -struct nfp_rtsym_table *sym_tbl; -int total_ports;int i;int err; +int total_ports; +struct nfp_cpp *cpp; +struct nfp_rtsym_table *sym_tbl; -if (!pci_dev) +if (pci_dev ==NULL )return -ENODEV ;/*
@@ -964,7 +960,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)else cpp =nfp_cpp_from_device_name (pci_dev,1 ); -if (!cpp) { +if (cpp ==NULL ) {PMD_INIT_LOG (ERR ,"A CPP handle can not be obtained" );return -EIO ; }
@@ -974,7 +970,7 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)* here so we have to read the number of ports from firmware */ sym_tbl =nfp_rtsym_table_read (cpp); -if (!sym_tbl) { +if (sym_tbl ==NULL ) {PMD_INIT_LOG (ERR ,"Something is wrong with the firmware" " symbol table" );return -EIO ;
@@ -989,13 +985,11 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)snprintf (port_name,sizeof (port_name),"%s_port%d" , pci_dev->device.name, i); -PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , - port_name); +PMD_DRV_LOG (DEBUG ,"Secondary attaching to port %s" , port_name); eth_dev =rte_eth_dev_attach_secondary (port_name); -if (!eth_dev) { +if (eth_dev ==NULL ) {RTE_LOG (ERR ,EAL , -"secondary process attach failed, " -"ethdev doesn't exist" ); +"secondary process attach failed, ethdev doesn't exist" );return -ENODEV ; } eth_dev->process_private = cpp;
@@ -1012,8 +1006,9 @@ static int nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return 0 ; } -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev) +static int +nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, +struct rte_pci_device *dev) {if (rte_eal_process_type () ==RTE_PROC_PRIMARY )return nfp_pf_init (dev);
@@ -1035,7 +1030,8 @@ static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { }, }; -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev) +static int +nfp_pci_uninit (struct rte_eth_dev *eth_dev) {struct rte_pci_device *pci_dev;uint16_t port_id;
@@ -1052,7 +1048,8 @@ static int nfp_pci_uninit(struct rte_eth_dev *eth_dev)return -ENOTSUP ; } -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev) +static int +eth_nfp_pci_remove (struct rte_pci_device *pci_dev) {return rte_eth_dev_pci_generic_remove (pci_dev, nfp_pci_uninit); }
drivers/net/nfp/nfp_ethdev_vf.c +4 -4
@@ -296,11 +296,11 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* NFP can not handle DMA addresses requiring more than 40 bits */ if (rte_mem_check_dma_mask (40 )) { -RTE_LOG (ERR ,PMD ,"device %s can not be used:" , - pci_dev->device.name); -RTE_LOG (ERR ,PMD ,"\trestricted dma mask to 40 bits!\n" ); +RTE_LOG (ERR ,PMD , +"device %s can not be used: restricted dma mask to 40 bits!\n" , + pci_dev->device.name);return -ENODEV ; - }; + } hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private);
Signature · 1 line
2.27.0
PATCH v4 2/13 net/nfp: remove unnecessary forward function declaration
In reply to Jin LiuThis commit remove some unnecessary forward function declarations.
--- drivers/net/nfp/nfp_ethdev.c | 22 ---------------------- drivers/net/nfp/nfp_ethdev_vf.c | 12 ------------ drivers/net/nfp/nfp_rxtx.c | 21 --------------------- 3 files changed, 55 deletions(-)
drivers/net/nfp/nfp_ethdev.c +0 -22
@@ -38,28 +38,6 @@#include "nfp_ctrl.h" #include "nfp_cpp_bridge.h" - -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port); -static int nfp_net_start (struct rte_eth_dev *dev); -static int nfp_net_stop (struct rte_eth_dev *dev); -static int nfp_net_set_link_up (struct rte_eth_dev *dev); -static int nfp_net_set_link_down (struct rte_eth_dev *dev); -static int nfp_net_close (struct rte_eth_dev *dev); -static int nfp_net_init (struct rte_eth_dev *eth_dev); -static int nfp_fw_upload (struct rte_pci_device *dev, -struct nfp_nsp *nsp,char *card); -static int nfp_fw_setup (struct rte_pci_device *dev, -struct nfp_cpp *cpp, -struct nfp_eth_table *nfp_eth_table, -struct nfp_hwinfo *hwinfo); -static int nfp_init_phyports (struct nfp_pf_dev *pf_dev); -static int nfp_pf_init (struct rte_pci_device *pci_dev); -static int nfp_pf_secondary_init (struct rte_pci_device *pci_dev); -static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *dev); -static int nfp_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_pci_remove (struct rte_pci_device *pci_dev); -static int nfp_net_pf_read_mac (struct nfp_pf_dev *pf_dev,int port) {
drivers/net/nfp/nfp_ethdev_vf.c +0 -12
@@ -23,18 +23,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -static void nfp_netvf_read_mac (struct nfp_net_hw *hw); -static int nfp_netvf_start (struct rte_eth_dev *dev); -static int nfp_netvf_stop (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_up (struct rte_eth_dev *dev); -static int nfp_netvf_set_link_down (struct rte_eth_dev *dev); -static int nfp_netvf_close (struct rte_eth_dev *dev); -static int nfp_netvf_init (struct rte_eth_dev *eth_dev); -static int nfp_vf_pci_uninit (struct rte_eth_dev *eth_dev); -static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, -struct rte_pci_device *pci_dev); -static int eth_nfp_vf_pci_remove (struct rte_pci_device *pci_dev); -static void nfp_netvf_read_mac (struct nfp_net_hw *hw) {
drivers/net/nfp/nfp_rxtx.c +0 -21
@@ -21,27 +21,6 @@#include "nfp_logs.h" #include "nfp_ctrl.h" -/* Prototypes */ -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq); -static inline void nfp_net_mbuf_alloc_failed (struct nfp_net_rxq *rxq); -static inline void nfp_net_set_hash (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mbuf); -static inline void nfp_net_rx_cksum (struct nfp_net_rxq *rxq, -struct nfp_net_rx_desc *rxd, -struct rte_mbuf *mb); -static void nfp_net_rx_queue_release_mbufs (struct nfp_net_rxq *rxq); -static int nfp_net_tx_free_bufs (struct nfp_net_txq *txq); -static void nfp_net_tx_queue_release_mbufs (struct nfp_net_txq *txq); -static inline uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq); -static inline uint32_t nfp_net_txq_full (struct nfp_net_txq *txq); -static inline void nfp_net_tx_tso (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static inline void nfp_net_tx_cksum (struct nfp_net_txq *txq, -struct nfp_net_tx_desc *txd, -struct rte_mbuf *mb); -static int nfp_net_rx_fill_freelist (struct nfp_net_rxq *rxq) {
Signature · 1 line
2.27.0
PATCH v4 3/13 net/nfp: remove pessimistic limit
In reply to Jin LiuMultiple writes cause intermediate pointer values that do not end on complete TX descriptors.
The QCP peripheral on the NFP provides a number of access modes. In some access modes, the maximum amount to add must be restricted to a 6bit value. The particular access mode used by _nfp_qcp_ptr_add() has no such restrictions, so the "NFP_QCP_MAX_ADD" test is unnecessary.
Note that trying to add more that the configured ring size in a single add will cause a QCP overflow, caught and handled by the QCP peripheral.
--- drivers/net/nfp/nfp_common.h | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/net/nfp/nfp_common.h +1 -11
@@ -44,9 +44,6 @@ struct nfp_net_adapter;/* The offset of the queue controller queues in the PCIe Target */ #define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) -/* Maximum value which can be added to a queue with one transaction */ -#define NFP_QCP_MAX_ADD 0x7f -/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -307,8 +304,6 @@ nn_cfg_writeq(struct nfp_net_hw *hw, int off, uint64_t val)* @q: Base address for queue structure * @ptr: Add to the Read or Write pointer * @val: Value to add to the queue pointer -* -* If @val is greater than @NFP_QCP_MAX_ADD multiple writes are performed. */ static inline void nfp_qcp_ptr_add (uint8_t *q,enum nfp_qcp_ptr ptr,uint32_t val)
@@ -320,12 +315,7 @@ nfp_qcp_ptr_add(uint8_t *q, enum nfp_qcp_ptr ptr, uint32_t val)else off =NFP_QCP_QUEUE_ADD_WPTR ; -while (val >NFP_QCP_MAX_ADD ) { -nn_writel (rte_cpu_to_le_32 (NFP_QCP_MAX_ADD ), q + off); - val -=NFP_QCP_MAX_ADD ; -} - -nn_writel (rte_cpu_to_le_32 (val), q + off); +nn_writel (rte_cpu_to_le_32 (val), q + off); }/*
Signature · 1 line
2.27.0
PATCH v4 4/13 net/nfp: rename set MAC function
In reply to Jin LiuThe NFP eth driver function name start with 'nfp_net', but set_mac function start with 'nfp' only, rename it, be consistent with others.
--- drivers/net/nfp/nfp_common.c | 2 +- drivers/net/nfp/nfp_common.h | 2 +- drivers/net/nfp/nfp_ethdev.c | 2 +- drivers/net/nfp/nfp_ethdev_vf.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/nfp/nfp_common.c +1 -1
@@ -274,7 +274,7 @@ nfp_net_write_mac(struct nfp_net_hw *hw, uint8_t *mac) }int -nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) +nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr) {struct nfp_net_hw *hw;uint32_t update, ctrl;
drivers/net/nfp/nfp_common.h +1 -1
@@ -350,7 +350,7 @@ void nfp_net_disable_queues(struct rte_eth_dev *dev);void nfp_net_params_setup (struct nfp_net_hw *hw);void nfp_eth_copy_mac (uint8_t *dst,const uint8_t *src);void nfp_net_write_mac (struct nfp_net_hw *hw,uint8_t *mac); -int nfp_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr); +int nfp_net_set_mac_addr (struct rte_eth_dev *dev,struct rte_ether_addr *mac_addr);int nfp_configure_rx_interrupt (struct rte_eth_dev *dev,struct rte_intr_handle *intr_handle);uint32_t nfp_check_offloads (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +1 -1
@@ -344,7 +344,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
drivers/net/nfp/nfp_ethdev_vf.c +1 -1
@@ -251,7 +251,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .dev_infos_get = nfp_net_infos_get, .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, .mtu_set = nfp_net_dev_mtu_set, - .mac_addr_set = nfp_set_mac_addr, + .mac_addr_set = nfp_net_set_mac_addr, .vlan_offload_set = nfp_net_vlan_offload_set, .reta_update = nfp_net_reta_update, .reta_query = nfp_net_reta_query,
Signature · 1 line
2.27.0
PATCH v4 5/13 net/nfp: rename function and struct
In reply to Jin LiuAdd 'nfd3' into the firmware with NFD3 eth driver function name, preparation for the next work, as we will support another version firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 12 ++++++------ drivers/net/nfp/nfp_ethdev_vf.c | 8 ++++---- drivers/net/nfp/nfp_rxtx.c | 30 +++++++++++++++--------------- drivers/net/nfp/nfp_rxtx.h | 8 ++++---- 4 files changed, 29 insertions(+), 29 deletions(-)
drivers/net/nfp/nfp_ethdev.c +6 -6
@@ -329,7 +329,7 @@ nfp_net_close(struct rte_eth_dev *dev) }/* Initialise and register driver with DPDK Application */ -static const struct eth_dev_ops nfp_net_eth_dev_ops = { +static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_net_start, .dev_stop = nfp_net_stop,
@@ -352,7 +352,7 @@ static const struct eth_dev_ops nfp_net_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -402,10 +402,10 @@ nfp_net_init(struct rte_eth_dev *eth_dev)PMD_INIT_LOG (DEBUG ,"Working with physical port number: %d, " "NFP internal port number: %d" , port, hw->nfp_idx); - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -971,10 +971,10 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)return -ENODEV ; } eth_dev->process_private = cpp; - eth_dev->dev_ops = &nfp_net_eth_dev_ops; + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;rte_eth_dev_probing_finish (eth_dev); }
drivers/net/nfp/nfp_ethdev_vf.c +4 -4
@@ -236,7 +236,7 @@ nfp_netvf_close(struct rte_eth_dev *dev) }/* Initialise and register VF driver with DPDK Application */ -static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { +static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .dev_configure = nfp_net_configure, .dev_start = nfp_netvf_start, .dev_stop = nfp_netvf_stop,
@@ -259,7 +259,7 @@ static const struct eth_dev_ops nfp_netvf_eth_dev_ops = { .rss_hash_conf_get = nfp_net_rss_hash_conf_get, .rx_queue_setup = nfp_net_rx_queue_setup, .rx_queue_release = nfp_net_rx_queue_release, - .tx_queue_setup = nfp_net_tx_queue_setup, + .tx_queue_setup = nfp_net_nfd3_tx_queue_setup, .tx_queue_release = nfp_net_tx_queue_release, .rx_queue_intr_enable = nfp_rx_queue_intr_enable, .rx_queue_intr_disable = nfp_rx_queue_intr_disable,
@@ -292,10 +292,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) hw =NFP_NET_DEV_PRIVATE_TO_HW (eth_dev->data->dev_private); - eth_dev->dev_ops = &nfp_netvf_eth_dev_ops; + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_xmit_pkts; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;/* For secondary processes, the primary has done all the work */ if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
drivers/net/nfp/nfp_rxtx.c +15 -15
@@ -655,7 +655,7 @@ nfp_net_reset_tx_queue(struct nfp_net_txq *txq) }int -nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf) {
@@ -670,7 +670,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,PMD_INIT_FUNC_TRACE ();/* Validating number of descriptors */ - tx_desc_sz = nb_desc *sizeof (struct nfp_net_tx_desc ); + tx_desc_sz = nb_desc *sizeof (struct nfp_net_nfd3_tx_desc );if (tx_desc_sz %NFP_ALIGN_RING_DESC !=0 || nb_desc >NFP_NET_MAX_TX_DESC || nb_desc <NFP_NET_MIN_TX_DESC ) {
@@ -718,7 +718,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,* resizing in later calls to the queue setup function. */ tz =rte_eth_dma_zone_reserve (dev,"tx_ring" , queue_idx, -sizeof (struct nfp_net_tx_desc ) * +sizeof (struct nfp_net_nfd3_tx_desc ) *NFP_NET_MAX_TX_DESC ,NFP_MEMZONE_ALIGN , socket_id);if (tz ==NULL ) {
@@ -743,7 +743,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,/* Saving physical and virtual addresses for the TX ring */ txq->dma = (uint64_t )tz->iova; - txq->txds = (struct nfp_net_tx_desc *)tz->addr; + txq->txds = (struct nfp_net_nfd3_tx_desc *)tz->addr;/* mbuf pointers array for referencing mbufs linked to TX descriptors */ txq->txbufs = rte_zmalloc_socket("txq->txbufs",
@@ -773,7 +773,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,/* Leaving always free descriptors for avoiding wrapping confusion */ static inline -uint32_t nfp_free_tx_desc (struct nfp_net_txq *txq) +uint32_t nfp_net_nfd3_free_tx_desc (struct nfp_net_txq *txq) {if (txq->wr_p >= txq->rd_p)return txq->tx_count - (txq->wr_p - txq->rd_p) -8 ;
@@ -790,14 +790,14 @@ uint32_t nfp_free_tx_desc(struct nfp_net_txq *txq)* This function uses the host copy* of read/write pointers */ static inline -uint32_t nfp_net_txq_full (struct nfp_net_txq *txq) +uint32_t nfp_net_nfd3_txq_full (struct nfp_net_txq *txq) { -return (nfp_free_tx_desc (txq) < txq->tx_free_thresh); +return (nfp_net_nfd3_free_tx_desc (txq) < txq->tx_free_thresh); }/* nfp_net_tx_tso - Set TX descriptor for TSO */ static inline void -nfp_net_tx_tso (struct nfp_net_txq *txq,struct nfp_net_tx_desc *txd, +nfp_net_nfd3_tx_tso (struct nfp_net_txq *txq,struct nfp_net_nfd3_tx_desc *txd,struct rte_mbuf *mb) {uint64_t ol_flags;
@@ -828,7 +828,7 @@ nfp_net_tx_tso(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd,/* nfp_net_tx_cksum - Set TX CSUM offload flags in TX descriptor */ static inline void -nfp_net_tx_cksum (struct nfp_net_txq *txq,struct nfp_net_tx_desc *txd, +nfp_net_nfd3_tx_cksum (struct nfp_net_txq *txq,struct nfp_net_nfd3_tx_desc *txd,struct rte_mbuf *mb) {uint64_t ol_flags;
@@ -857,11 +857,11 @@ nfp_net_tx_cksum(struct nfp_net_txq *txq, struct nfp_net_tx_desc *txd, }uint16_t -nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) +nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts) {struct nfp_net_txq *txq;struct nfp_net_hw *hw; -struct nfp_net_tx_desc *txds, txd; +struct nfp_net_nfd3_tx_desc *txds, txd;struct rte_mbuf *pkt;uint64_t dma_addr;int pkt_size, dma_size;
@@ -876,10 +876,10 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)PMD_TX_LOG (DEBUG ,"working for queue %u at pos %d and %u packets" , txq->qidx, txq->wr_p, nb_pkts); -if ((nfp_free_tx_desc (txq) < nb_pkts) || (nfp_net_txq_full (txq))) +if ((nfp_net_nfd3_free_tx_desc (txq) < nb_pkts) || (nfp_net_nfd3_txq_full (txq)))nfp_net_tx_free_bufs (txq); - free_descs = (uint16_t )nfp_free_tx_desc (txq); + free_descs = (uint16_t )nfp_net_nfd3_free_tx_desc (txq);if (unlikely (free_descs ==0 ))return 0 ;
@@ -913,8 +913,8 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)* multisegment packet, but TSO info needs to be in all of them. */ txd.data_len = pkt->pkt_len; -nfp_net_tx_tso (txq, &txd, pkt); -nfp_net_tx_cksum (txq, &txd, pkt); +nfp_net_nfd3_tx_tso (txq, &txd, pkt); +nfp_net_nfd3_tx_cksum (txq, &txd, pkt);if ((pkt->ol_flags &RTE_MBUF_F_TX_VLAN ) && (hw->cap &NFP_NET_CFG_CTRL_TXVLAN )) {
drivers/net/nfp/nfp_rxtx.h +4 -4
@@ -53,7 +53,7 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) -struct nfp_net_tx_desc { +struct nfp_net_nfd3_tx_desc { union { struct { uint8_t dma_addr_hi; /* High bits of host buf address */
@@ -124,7 +124,7 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_tx_desc *txds; +struct nfp_net_nfd3_tx_desc *txds;/* * At this point 48 bytes have been used for all the fields in the
@@ -286,10 +286,10 @@ int nfp_net_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, struct rte_mempool *mp);void nfp_net_tx_queue_release (struct rte_eth_dev *dev,uint16_t queue_idx);void nfp_net_reset_tx_queue (struct nfp_net_txq *txq); -int nfp_net_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx, +int nfp_net_nfd3_tx_queue_setup (struct rte_eth_dev *dev,uint16_t queue_idx,uint16_t nb_desc,unsigned int socket_id,const struct rte_eth_txconf *tx_conf); -uint16_t nfp_net_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts, +uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */
Signature · 1 line
2.27.0
PATCH v4 6/13 net/nfp: support NFP3800 card
In reply to Jin LiuAdd support for a new type of NIC NFP3800 card, and update some network card data acquisition interface functions.
--- doc/guides/nics/nfp.rst | 3 ++- doc/guides/rel_notes/release_22_07.rst | 4 +++ drivers/net/nfp/nfp_common.h | 34 ++++++++++++++++++++++++-- drivers/net/nfp/nfp_ethdev.c | 28 ++++++++++++++++++--- drivers/net/nfp/nfp_ethdev_vf.c | 9 +++++-- drivers/net/nfp/nfpcore/nfp_cpp.h | 2 +- drivers/net/nfp/nfpcore/nfp_nsp_eth.c | 20 +++++++++++---- 7 files changed, 86 insertions(+), 14 deletions(-)
doc/guides/nics/nfp.rst +2 -1
@@ -12,7 +12,8 @@ up to 400-Gb/s. This document explains how to use DPDK with the Netronome Poll Mode Driver (PMD) supporting Netronome's Network Flow Processor 6xxx -(NFP-6xxx) and Netronome's Flow Processor 4xxx (NFP-4xxx). +(NFP-6xxx), Netronome's Network Flow Processor 4xxx (NFP-4xxx) and +Netronome's Network Flow Processor 38xx (NFP-38xx). NFP is a SRIOV capable device and the PMD supports the physical function (PF) and the virtual functions (VFs).
doc/guides/rel_notes/release_22_07.rst +4 -0
@@ -108,6 +108,10 @@ New Features * Added support for MTU on Windows. * Added matching and RSS on IPsec ESP. +* **Updated Netronome nfp driver.** + + * Added support for NFP3800 NIC. + * **Updated VMware vmxnet3 networking driver.** * Added version 5 support.
drivers/net/nfp/nfp_common.h +32 -2
@@ -16,9 +16,11 @@#define NFP_NET_PMD_VERSION "0.1"#define PCI_VENDOR_ID_NETRONOME 0x19ee +#define PCI_DEVICE_ID_NFP3800_PF_NIC 0x3800 +#define PCI_DEVICE_ID_NFP3800_VF_NIC 0x3803#define PCI_DEVICE_ID_NFP4000_PF_NIC 0x4000#define PCI_DEVICE_ID_NFP6000_PF_NIC 0x6000 -#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003 +#define PCI_DEVICE_ID_NFP6000_VF_NIC 0x6003/* Include NFP4000VF */ /* Forward declaration */ struct nfp_net_adapter ;
@@ -41,8 +43,16 @@ struct nfp_net_adapter;#define NFP_QCP_QUEUE_STS_HI 0x000c#define NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask (0x3ffff) +#define NFP_PCIE_QCP_NFP3800_OFFSET 0x400000 +#define NFP_PCIE_QCP_NFP6000_OFFSET 0x80000 +#define NFP_PCIE_QUEUE_NFP3800_MASK 0x1ff +#define NFP_PCIE_QUEUE_NFP6000_MASK 0xff +#define NFP_PCIE_QCP_PF_OFFSET 0x0 +#define NFP_PCIE_QCP_VF_OFFSET 0x0 +/* The offset of the queue controller queues in the PCIe Target */ -#define NFP_PCIE_QUEUE (_q) (0x80000 + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & 0xff))) +#define NFP_PCIE_QUEUE (_offset, _q, _mask) \ + ((_offset) + (NFP_QCP_QUEUE_ADDR_SZ * ((_q) & (_mask))))/* Interrupt definitions */ #define NFP_NET_IRQ_LSC_IDX 0
@@ -342,6 +352,26 @@ nfp_qcp_read(uint8_t *q, enum nfp_qcp_ptr ptr)return val & NFP_QCP_QUEUE_STS_HI_WRITEPTR_mask; } +static inline uint32_t +nfp_pci_queue (struct rte_pci_device *pdev,uint16_t queue) +{ +switch (pdev->id.device_id) { +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +case PCI_DEVICE_ID_NFP3800_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); +case PCI_DEVICE_ID_NFP6000_VF_NIC : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_VF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP6000_MASK ); +default : +return NFP_PCIE_QUEUE (NFP_PCIE_QCP_PF_OFFSET , queue, +NFP_PCIE_QUEUE_NFP3800_MASK ); + } +} +/* Prototypes for common NFP functions */ int nfp_net_reconfig (struct nfp_net_hw *hw,uint32_t ctrl,uint32_t update);int nfp_net_configure (struct rte_eth_dev *dev);
drivers/net/nfp/nfp_ethdev.c +25 -3
@@ -446,12 +446,13 @@ nfp_net_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC :case PCI_DEVICE_ID_NFP4000_PF_NIC :case PCI_DEVICE_ID_NFP6000_PF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -764,6 +765,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev) {int err;int ret =0 ; +uint64_t addr;int total_ports;struct nfp_cpp *cpp;struct nfp_pf_dev *pf_dev;
@@ -867,8 +869,24 @@ nfp_pf_init(struct rte_pci_device *pci_dev)PMD_INIT_LOG (DEBUG ,"ctrl bar: %p" , pf_dev->ctrl_bar);/* configure access to tx/rx vNIC BARs */ +switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP3800_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP3800_MASK ); +break ; +case PCI_DEVICE_ID_NFP4000_PF_NIC : +case PCI_DEVICE_ID_NFP6000_PF_NIC : + addr =NFP_PCIE_QUEUE (NFP_PCIE_QCP_NFP6000_OFFSET , +0 ,NFP_PCIE_QUEUE_NFP6000_MASK ); +break ; +default : +PMD_INIT_LOG (ERR ,"nfp_net: no device ID matching" ); + err = -ENODEV ; + goto ctrl_area_cleanup; + } + pf_dev->hw_queues =nfp_cpp_map_area (pf_dev->cpp,0 ,0 , -NFP_PCIE_QUEUE (0 ),NFP_QCP_QUEUE_AREA_SZ , + addr,NFP_QCP_QUEUE_AREA_SZ , &pf_dev->hwqueues_area);if (pf_dev->hw_queues ==NULL ) {PMD_INIT_LOG (ERR ,"nfp_rtsym_map fails for net.qc" );
@@ -995,6 +1013,10 @@ nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused, }static const struct rte_pci_id pci_id_nfp_pf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_PF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP4000_PF_NIC )
drivers/net/nfp/nfp_ethdev_vf.c +7 -2
@@ -327,11 +327,12 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)/* Work out where in the BAR the queues start. */ switch (pci_dev->id.device_id) { +case PCI_DEVICE_ID_NFP3800_VF_NIC :case PCI_DEVICE_ID_NFP6000_VF_NIC : start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_TXQ ); - tx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + tx_bar_off =nfp_pci_queue (pci_dev, start_q); start_q =nn_cfg_readl (hw,NFP_NET_CFG_START_RXQ ); - rx_bar_off = (uint64_t )start_q *NFP_QCP_QUEUE_ADDR_SZ ; + rx_bar_off =nfp_pci_queue (pci_dev, start_q);break ;default :PMD_DRV_LOG (ERR ,"nfp_net: no device ID matching" );
@@ -456,6 +457,10 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev) }static const struct rte_pci_id pci_id_nfp_vf_net_map[] = { + { +RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME , +PCI_DEVICE_ID_NFP3800_VF_NIC ) + }, {RTE_PCI_DEVICE (PCI_VENDOR_ID_NETRONOME ,PCI_DEVICE_ID_NFP6000_VF_NIC )
drivers/net/nfp/nfpcore/nfp_cpp.h +1 -1
@@ -214,7 +214,7 @@ void nfp_cpp_free(struct nfp_cpp *cpp);* @return true if model is in the NFP6000 family, false otherwise. */ #define NFP_CPP_MODEL_IS_6000 (model) \ - ((NFP_CPP_MODEL_CHIP_of(model) >= 0x4000) && \ + ((NFP_CPP_MODEL_CHIP_of(model) >= 0x3800) && \ (NFP_CPP_MODEL_CHIP_of(model) < 0x7000))/*
drivers/net/nfp/nfpcore/nfp_nsp_eth.c +15 -5
@@ -266,6 +266,7 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)struct nfp_eth_table *table;uint32_t table_sz;int i, j, ret, cnt =0 ; +const struct rte_ether_addr *mac; entries =malloc (NSP_ETH_TABLE_SIZE );if (!entries)
@@ -278,9 +279,15 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp) goto err; } -for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +/* The NFP3800 NIC support 8 ports, but only 2 ports are valid, +* the rest 6 ports mac are all 0, ensure we don't use these port +*/ +for (i =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac))) cnt++; + }/* Some versions of flash will give us 0 instead of port count. For * those that give a port count, verify it against the value calculated
@@ -299,10 +306,13 @@ __nfp_eth_read_ports(struct nfp_nsp *nsp)memset (table,0 , table_sz); table->count = cnt; -for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) -if (entries[i].port &NSP_ETH_PORT_LANES_MASK ) +for (i =0 , j =0 ; i <NSP_ETH_MAX_COUNT ; i++) { + mac = (const struct rte_ether_addr *)entries[i].mac_addr; +if ((entries[i].port &NSP_ETH_PORT_LANES_MASK ) && + (!rte_is_zero_ether_addr (mac)))nfp_eth_port_translate (nsp, &entries[i], i, - &table->ports[j++]); + &table->ports[j++]); + }nfp_eth_calc_port_geometry (table);for (i =0 ; i < (int )table->count; i++)
Signature · 1 line
2.27.0
PATCH v4 7/13 net/nfp: support firmware with NFDk
In reply to Jin LiuModify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will according to the firmware version, mount different driver functions.
--- doc/guides/nics/nfp.rst | 7 ++-- doc/guides/rel_notes/release_22_07.rst | 1 + drivers/net/nfp/nfp_ctrl.h | 2 + drivers/net/nfp/nfp_ethdev.c | 49 +++++++++++++++++++----- drivers/net/nfp/nfp_ethdev_vf.c | 53 +++++++++++++++++++------- 5 files changed, 85 insertions(+), 27 deletions(-)
doc/guides/nics/nfp.rst +4 -3
@@ -100,9 +100,10 @@ more than one SmartNIC, same type of SmartNIC or different ones, and to upload a different firmware to each SmartNIC. .. Note:: - Currently the NFP PMD supports using the PF with Agilio Basic Firmware. See - https://help.netronome.com/support/solutions for more information on the - various firmwares supported by the Netronome Agilio CX smartNIC. + Currently the NFP PMD supports using the PF with Agilio Firmware with NFD3 + and Agilio Firmware with NFDk. See https://help.netronome.com/support/solutions + for more information on the various firmwares supported by the Netronome + Agilio CX smartNIC. PF multiport support --------------------
doc/guides/rel_notes/release_22_07.rst +1 -0
@@ -111,6 +111,7 @@ New Features * **Updated Netronome nfp driver.** * Added support for NFP3800 NIC. + * Added support for firmware with NFDk. * **Updated VMware vmxnet3 networking driver.**
drivers/net/nfp/nfp_ctrl.h +2 -0
@@ -135,6 +135,8 @@* - define more STS bits */ #define NFP_NET_CFG_VERSION 0x0030 +#define NFP_NET_CFG_VERSION_DP_NFD3 0 +#define NFP_NET_CFG_VERSION_DP_NFDK 1#define NFP_NET_CFG_VERSION_RESERVED_MASK (0xff << 24)#define NFP_NET_CFG_VERSION_CLASS_MASK (0xff << 16)#define NFP_NET_CFG_VERSION_CLASS (x) (((x) & 0xff) << 16)
drivers/net/nfp/nfp_ethdev.c +39 -10
86 lines not on this page · raw message
drivers/net/nfp/nfp_ethdev_vf.c +39 -14
77 lines not on this page · raw message
Signature · 1 line
2.27.0
PATCH v4 8/13 net/nfp: structure adjustment
In reply to Jin LiuAdd and modify the nfp PMD struct and macro that will be used by firmware with NFDk.
--- drivers/net/nfp/nfp_rxtx.h | 58 +++++++++++++++++++++++++++++++++++++- 1 file changed, 57 insertions(+), 1 deletion(-)
drivers/net/nfp/nfp_rxtx.h +57 -1
@@ -53,6 +53,31 @@#define PCIE_DESC_TX_ENCAP_VXLAN (1 << 1)#define PCIE_DESC_TX_ENCAP_GRE (1 << 0) +#define NFDK_TX_MAX_DATA_PER_HEAD 0x00001000 +#define NFDK_DESC_TX_DMA_LEN_HEAD 0x0fff +#define NFDK_DESC_TX_TYPE_HEAD 0xf000 +#define NFDK_DESC_TX_DMA_LEN 0x3fff +#define NFDK_TX_DESC_PER_SIMPLE_PKT 2 +#define NFDK_DESC_TX_TYPE_TSO 2 +#define NFDK_DESC_TX_TYPE_SIMPLE 8 +#define NFDK_DESC_TX_TYPE_GATHER 1 +#define NFDK_DESC_TX_EOP BIT(14) +#define NFDK_DESC_TX_L4_CSUM BIT(1) +#define NFDK_DESC_TX_L3_CSUM BIT(0) + +#define NFDK_TX_MAX_DATA_PER_DESC 0x00004000 +#define NFDK_TX_DESC_GATHER_MAX 17 +#define DIV_ROUND_UP (n, d) (((n) + (d) - 1) / (d)) +#define NFDK_TX_DESC_BLOCK_SZ 256 +#define NFDK_TX_DESC_BLOCK_CNT (NFDK_TX_DESC_BLOCK_SZ / \ + sizeof(struct nfp_net_nfdk_tx_desc)) +#define NFDK_TX_DESC_STOP_CNT (NFDK_TX_DESC_BLOCK_CNT * \ + NFDK_TX_DESC_PER_SIMPLE_PKT) +#define NFDK_TX_MAX_DATA_PER_BLOCK 0x00010000 +#define D_BLOCK_CPL (idx) (NFDK_TX_DESC_BLOCK_CNT - \ + (idx) % NFDK_TX_DESC_BLOCK_CNT) +#define D_IDX (ring, idx) ((idx) & ((ring)->tx_count - 1)) + struct nfp_net_nfd3_tx_desc { union { struct {
@@ -84,6 +109,33 @@ struct nfp_net_nfd3_tx_desc { }; }; +struct nfp_net_nfdk_tx_desc { +union { +struct { +__le16 dma_addr_hi;/* High bits of host buf address */ +__le16 dma_len_type;/* Length to DMA for this desc */ +__le32 dma_addr_lo;/* Low 32bit of host buf addr */ + }; + +struct { +__le16 mss;/* MSS to be used for LSO */ +uint8_t lso_hdrlen;/* LSO, TCP payload offset */ +uint8_t lso_totsegs;/* LSO, total segments */ +uint8_t l3_offset;/* L3 header offset */ +uint8_t l4_offset;/* L4 header offset */ +__le16 lso_meta_res;/* Rsvd bits in TSO metadata */ + }; + +struct { +uint8_t flags;/* TX Flags, see @NFDK_DESC_TX_* */ +uint8_t reserved[7 ];/* meta byte placeholder */ + }; + +__le32 vals[2 ]; +__le64 raw; + }; +}; +struct nfp_net_txq {struct nfp_net_hw *hw;/* Backpointer to nfp_net structure */
@@ -124,7 +176,10 @@ struct nfp_net_txq {* of the queue and @size is the size in bytes for the queue * (needed for free) */ -struct nfp_net_nfd3_tx_desc *txds; +union { +struct nfp_net_nfd3_tx_desc *txds; +struct nfp_net_nfdk_tx_desc *ktxds; + };/* * At this point 48 bytes have been used for all the fields in the
@@ -137,6 +192,7 @@ struct nfp_net_txq {uint32_t tx_hthresh;/* not used by now. Future? */ uint32_t tx_wthresh;/* not used by now. Future? */ uint16_t port_id; +uint16_t data_pending;/* used by nfdk only */ int qidx;int tx_qcidx;__le64 dma;
Signature · 1 line
2.27.0
PATCH v4 9/13 net/nfp: nfdk netdev option and queue function
In reply to Jin LiuAdd ethdev option for firmware with NFDk, implement tx_queue setup function for firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 32 ++++++++- drivers/net/nfp/nfp_ethdev_vf.c | 32 ++++++++- drivers/net/nfp/nfp_rxtx.c | 117 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 5 ++ 4 files changed, 184 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +31 -1
@@ -358,11 +358,41 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_net_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_net_start, + .dev_stop = nfp_net_stop, + .dev_set_link_up = nfp_net_set_link_up, + .dev_set_link_down = nfp_net_set_link_down, + .dev_close = nfp_net_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_net_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -370,13 +400,13 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_ethdev_vf.c +31 -1
@@ -265,11 +265,41 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = { .rx_queue_intr_disable = nfp_rx_queue_intr_disable, }; +static const struct eth_dev_ops nfp_netvf_nfdk_eth_dev_ops = { + .dev_configure = nfp_net_configure, + .dev_start = nfp_netvf_start, + .dev_stop = nfp_netvf_stop, + .dev_set_link_up = nfp_netvf_set_link_up, + .dev_set_link_down = nfp_netvf_set_link_down, + .dev_close = nfp_netvf_close, + .promiscuous_enable = nfp_net_promisc_enable, + .promiscuous_disable = nfp_net_promisc_disable, + .link_update = nfp_net_link_update, + .stats_get = nfp_net_stats_get, + .stats_reset = nfp_net_stats_reset, + .dev_infos_get = nfp_net_infos_get, + .dev_supported_ptypes_get = nfp_net_supported_ptypes_get, + .mtu_set = nfp_net_dev_mtu_set, + .mac_addr_set = nfp_net_set_mac_addr, + .vlan_offload_set = nfp_net_vlan_offload_set, + .reta_update = nfp_net_reta_update, + .reta_query = nfp_net_reta_query, + .rss_hash_update = nfp_net_rss_hash_update, + .rss_hash_conf_get = nfp_net_rss_hash_conf_get, + .rx_queue_setup = nfp_net_rx_queue_setup, + .rx_queue_release = nfp_net_rx_queue_release, + .tx_queue_setup = nfp_net_nfdk_tx_queue_setup, + .tx_queue_release = nfp_net_tx_queue_release, + .rx_queue_intr_enable = nfp_rx_queue_intr_enable, + .rx_queue_intr_disable = nfp_rx_queue_intr_disable, +}; +static inline int nfp_netvf_ethdev_ops_mount (struct nfp_net_hw *hw,struct rte_eth_dev *eth_dev) {switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : + eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -277,13 +307,13 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) NFD_CFG_MAJOR_VERSION_of(hw->ver));return -EINVAL ; } + eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );return -EINVAL ; } - eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;
drivers/net/nfp/nfp_rxtx.c +117 -0
120 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +5 -0
@@ -347,6 +347,11 @@ int nfp_net_nfd3_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, const struct rte_eth_txconf *tx_conf);uint16_t nfp_net_nfd3_xmit_pkts (void *tx_queue,struct rte_mbuf **tx_pkts,uint16_t nb_pkts); +int nfp_net_nfdk_tx_queue_setup (struct rte_eth_dev *dev, +uint16_t queue_idx, +uint16_t nb_desc, +unsigned int socket_id, +const struct rte_eth_txconf *tx_conf);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH v4 10/13 net/nfp: add queue stop and close helper function
In reply to Jin LiuThis commit does not introduce new features, just integrate some common logic into helper functions to reduce the same logic and increase code reuse, include queue stop and queue close logic, will be used when NFP net stop and close.
queue stop: reset queue
queue close: reset and release queue
Modify NFP net stop and close function, use helper function to stop and close queue instead of before logic.
--- drivers/net/nfp/nfp_common.c | 50 +++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_common.h | 4 +++ drivers/net/nfp/nfp_ethdev.c | 27 +++--------------- drivers/net/nfp/nfp_ethdev_vf.c | 29 +++---------------- 4 files changed, 62 insertions(+), 48 deletions(-)
drivers/net/nfp/nfp_common.c +50 -0
@@ -1320,6 +1320,56 @@ nfp_net_rss_config_default(struct rte_eth_dev *dev)return ret; } +void +nfp_net_stop_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); + } +} + +void +nfp_net_close_rx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_rxq *this_rx_q; + +for (i =0 ; i < dev->data->nb_rx_queues; i++) { + this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; +nfp_net_reset_rx_queue (this_rx_q); +nfp_net_rx_queue_release (dev, i); + } +} + +void +nfp_net_stop_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_reset_tx_queue (this_tx_q); + } +} + +void +nfp_net_close_tx_queue (struct rte_eth_dev *dev) +{ +uint16_t i; +struct nfp_net_txq *this_tx_q; + +for (i =0 ; i < dev->data->nb_tx_queues; i++) { + this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; +nfp_net_reset_tx_queue (this_tx_q); +nfp_net_tx_queue_release (dev, i); + } +} +RTE_LOG_REGISTER_SUFFIX (nfp_logtype_init, init,NOTICE );RTE_LOG_REGISTER_SUFFIX (nfp_logtype_driver, driver,NOTICE );/*
drivers/net/nfp/nfp_common.h +4 -0
@@ -413,6 +413,10 @@ int nfp_net_rss_hash_update(struct rte_eth_dev *dev,int nfp_net_rss_hash_conf_get (struct rte_eth_dev *dev,struct rte_eth_rss_conf *rss_conf);int nfp_net_rss_config_default (struct rte_eth_dev *dev); +void nfp_net_stop_rx_queue (struct rte_eth_dev *dev); +void nfp_net_close_rx_queue (struct rte_eth_dev *dev); +void nfp_net_stop_tx_queue (struct rte_eth_dev *dev); +void nfp_net_close_tx_queue (struct rte_eth_dev *dev);#define NFP_NET_DEV_PRIVATE_TO_HW (adapter)\ (&((struct nfp_net_adapter *)adapter)->hw)
drivers/net/nfp/nfp_ethdev.c +4 -23
@@ -181,10 +181,7 @@ nfp_net_start(struct rte_eth_dev *dev)static int nfp_net_stop (struct rte_eth_dev *dev) { -int i;struct nfp_net_hw *hw; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;PMD_INIT_LOG (DEBUG ,"Stop" );
@@ -193,15 +190,9 @@ nfp_net_stop(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); - } +nfp_net_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);if (rte_eal_process_type () ==RTE_PROC_PRIMARY )/* Configure the physical port down */
@@ -256,8 +247,6 @@ nfp_net_close(struct rte_eth_dev *dev)struct nfp_net_hw *hw;struct rte_pci_device *pci_dev;struct nfp_pf_dev *pf_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q;int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )
@@ -277,17 +266,9 @@ nfp_net_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); - } +nfp_net_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);/* Cancel possible impending LSC work here before releasing the port*/ rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler,
drivers/net/nfp/nfp_ethdev_vf.c +4 -25
@@ -145,24 +145,14 @@ nfp_netvf_start(struct rte_eth_dev *dev)static int nfp_netvf_stop (struct rte_eth_dev *dev) { -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i; -PMD_INIT_LOG (DEBUG ,"Stop" );nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); - } +nfp_net_stop_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); - } +nfp_net_stop_rx_queue (dev);return 0 ; }
@@ -185,9 +175,6 @@ static int nfp_netvf_close(struct rte_eth_dev *dev) {struct rte_pci_device *pci_dev; -struct nfp_net_txq *this_tx_q; -struct nfp_net_rxq *this_rx_q; -int i;if (rte_eal_process_type () !=RTE_PROC_PRIMARY )return 0 ;
@@ -204,17 +191,9 @@ nfp_netvf_close(struct rte_eth_dev *dev)nfp_net_disable_queues (dev);/* Clear queues */ -for (i =0 ; i < dev->data->nb_tx_queues; i++) { - this_tx_q = (struct nfp_net_txq *)dev->data->tx_queues[i]; -nfp_net_reset_tx_queue (this_tx_q); -nfp_net_tx_queue_release (dev, i); - } +nfp_net_close_tx_queue (dev); -for (i =0 ; i < dev->data->nb_rx_queues; i++) { - this_rx_q = (struct nfp_net_rxq *)dev->data->rx_queues[i]; -nfp_net_reset_rx_queue (this_rx_q); -nfp_net_rx_queue_release (dev, i); - } +nfp_net_close_rx_queue (dev);rte_intr_disable (pci_dev->intr_handle);
Signature · 1 line
2.27.0
PATCH v4 11/13 net/nfp: move macro from C file to head file
In reply to Jin LiuMove macro __round_mask, round_up and round_down from C file to corresponding head file, will be used by TX function of nfp net firmware with NFDk.
--- drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 ------------------- drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++ 2 files changed, 19 insertions(+), 19 deletions(-)
drivers/net/nfp/nfpcore/nfp_rtsym.c +0 -19
@@ -94,25 +94,6 @@ nfp_rtsym_table_read(struct nfp_cpp *cpp)return rtbl; } -/* -* This looks more complex than it should be. But we need to get the type for -* the ~ right in round_down (it needs to be as wide as the result!), and we -* want to evaluate the macro arguments just once each. -*/ -#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) - -#define round_up (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((((_x) - 1) | __round_mask(_x, y)) + 1); \ - })) - -#define round_down (x, y) \ - (__extension__ ({ \ - typeof(x) _x = (x); \ - ((_x) & ~__round_mask(_x, y)); \ - })) -struct nfp_rtsym_table *__nfp_rtsym_table_read (struct nfp_cpp *cpp,const struct nfp_mip *mip) {
drivers/net/nfp/nfpcore/nfp_rtsym.h +19 -0
@@ -15,6 +15,25 @@#define NFP_RTSYM_TARGET_LMEM -1#define NFP_RTSYM_TARGET_EMU_CACHE -7 +/* +* This looks more complex than it should be. But we need to get the type for +* the ~ right in round_down (it needs to be as wide as the result!), and we +* want to evaluate the macro arguments just once each. +*/ +#define __round_mask (x, y) ((__typeof__(x))((y) - 1)) + +#define round_up (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((((_x) - 1) | __round_mask(_x, y)) + 1); \ + })) + +#define round_down (x, y) \ + (__extension__ ({ \ + typeof(x) _x = (x); \ + ((_x) & ~__round_mask(_x, y)); \ + })) +/* * Structure describing a run-time NFP symbol. *
Signature · 1 line
2.27.0
PATCH v4 12/13 net/nfp: nfdk packet xmit function
In reply to Jin LiuImplement NFP3800 card packet transmit function for firmware with NFDk.
--- drivers/net/nfp/nfp_ethdev.c | 3 +- drivers/net/nfp/nfp_ethdev_vf.c | 3 +- drivers/net/nfp/nfp_rxtx.c | 283 ++++++++++++++++++++++++++++++++ drivers/net/nfp/nfp_rxtx.h | 3 + 4 files changed, 290 insertions(+), 2 deletions(-)
drivers/net/nfp/nfp_ethdev.c +2 -1
@@ -374,6 +374,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_net_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -382,6 +383,7 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_net_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -390,7 +392,6 @@ nfp_net_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_ethdev_vf.c +2 -1
@@ -279,6 +279,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)switch (NFD_CFG_CLASS_VER_of (hw->ver)) {case NFP_NET_CFG_VERSION_DP_NFD3 : eth_dev->dev_ops = &nfp_netvf_nfd3_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;break ;case NFP_NET_CFG_VERSION_DP_NFDK :if (NFD_CFG_MAJOR_VERSION_of (hw->ver) <5 ) {
@@ -287,6 +288,7 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev)return -EINVAL ; } eth_dev->dev_ops = &nfp_netvf_nfdk_eth_dev_ops; + eth_dev->tx_pkt_burst = &nfp_net_nfdk_xmit_pkts;break ;default :PMD_DRV_LOG (ERR ,"The version of firmware is not correct." );
@@ -295,7 +297,6 @@ nfp_netvf_ethdev_ops_mount(struct nfp_net_hw *hw, struct rte_eth_dev *eth_dev) eth_dev->rx_queue_count = nfp_net_rx_queue_count; eth_dev->rx_pkt_burst = &nfp_net_recv_pkts; - eth_dev->tx_pkt_burst = &nfp_net_nfd3_xmit_pkts;return 0 ; }
drivers/net/nfp/nfp_rxtx.c +283 -0
292 lines not on this page · raw message
drivers/net/nfp/nfp_rxtx.h +3 -0
@@ -352,6 +352,9 @@ int nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,uint16_t nb_desc, unsigned int socket_id, const struct rte_eth_txconf *tx_conf); +uint16_t nfp_net_nfdk_xmit_pkts (void *tx_queue, +struct rte_mbuf **tx_pkts, +uint16_t nb_pkts);#endif /* _NFP_RXTX_H_ */ /*
Signature · 1 line
2.27.0
PATCH v4 13/13 net/nfp: modify RSS logic
In reply to Jin LiuNow NFP NIC support two type of RSS logic, NFP_NET_CFG_CTRL_RSS and NFP_NET_CFG_CTRL_RSS2, use NFP_NET_CFG_CTRL_RSS2 if NIC capability support, otherwise use NFP_NET_CFG_CTRL_RSS.
--- drivers/net/nfp/nfp_common.c | 12 ++++++------ drivers/net/nfp/nfp_ctrl.h | 1 + drivers/net/nfp/nfp_ethdev.c | 5 ++++- drivers/net/nfp/nfp_ethdev_vf.c | 5 ++++- drivers/net/nfp/nfp_rxtx.c | 2 +- 5 files changed, 16 insertions(+), 9 deletions(-)
drivers/net/nfp/nfp_common.c +6 -6
@@ -171,7 +171,7 @@ nfp_net_configure(struct rte_eth_dev *dev)/* Checking RX mode */ if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS && - !(hw->cap &NFP_NET_CFG_CTRL_RSS )) { + !(hw->cap &NFP_NET_CFG_CTRL_RSS_ANY )) {PMD_INIT_LOG (INFO ,"RSS not supported" );return -EINVAL ; }
@@ -769,7 +769,7 @@ nfp_net_infos_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) .nb_mtu_seg_max = NFP_TX_MAX_MTU_SEG, }; -if (hw->cap &NFP_NET_CFG_CTRL_RSS ) { +if (hw->cap &NFP_NET_CFG_CTRL_RSS_ANY ) { dev_info->rx_offload_capa |=RTE_ETH_RX_OFFLOAD_RSS_HASH ; dev_info->flow_type_rss_offloads = RTE_ETH_RSS_IPV4 |
@@ -1080,7 +1080,7 @@ nfp_net_reta_update(struct rte_eth_dev *dev,uint32_t update;int ret; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; ret =nfp_net_rss_reta_write (dev, reta_conf, reta_size);
@@ -1108,7 +1108,7 @@ nfp_net_reta_query(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ;if (reta_size !=NFP_NET_CFG_RSS_ITBL_SZ ) {
@@ -1206,7 +1206,7 @@ nfp_net_rss_hash_update(struct rte_eth_dev *dev, rss_hf = rss_conf->rss_hf;/* Checking if RSS is enabled */ -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) { +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY )) {if (rss_hf !=0 ) {/* Enable RSS? */ PMD_DRV_LOG (ERR ,"RSS unsupported" );return -EINVAL ;
@@ -1241,7 +1241,7 @@ nfp_net_rss_hash_conf_get(struct rte_eth_dev *dev, hw =NFP_NET_DEV_PRIVATE_TO_HW (dev->data->dev_private); -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return -EINVAL ; rss_hf = rss_conf->rss_hf;
drivers/net/nfp/nfp_ctrl.h +1 -0
@@ -119,6 +119,7 @@#define NFP_NET_CFG_MACADDR 0x0024#define NFP_NET_CFG_CTRL_LSO_ANY (NFP_NET_CFG_CTRL_LSO | NFP_NET_CFG_CTRL_LSO2) +#define NFP_NET_CFG_CTRL_RSS_ANY (NFP_NET_CFG_CTRL_RSS | NFP_NET_CFG_CTRL_RSS2)/* * Read-only words (0x0030 - 0x0050):
drivers/net/nfp/nfp_ethdev.c +4 -1
@@ -123,7 +123,10 @@ nfp_net_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +if (hw->cap &NFP_NET_CFG_CTRL_RSS2 ) + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +else + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; }/* Enable device */
drivers/net/nfp/nfp_ethdev_vf.c +4 -1
@@ -95,7 +95,10 @@ nfp_netvf_start(struct rte_eth_dev *dev)if (rxmode->mq_mode &RTE_ETH_MQ_RX_RSS ) {nfp_net_rss_config_default (dev); update |=NFP_NET_CFG_UPDATE_RSS ; - new_ctrl |=NFP_NET_CFG_CTRL_RSS ; +if (hw->cap &NFP_NET_CFG_CTRL_RSS2 ) + new_ctrl |=NFP_NET_CFG_CTRL_RSS2 ; +else + new_ctrl |=NFP_NET_CFG_CTRL_RSS ; }/* Enable device */
drivers/net/nfp/nfp_rxtx.c +1 -1
@@ -138,7 +138,7 @@ nfp_net_set_hash(struct nfp_net_rxq *rxq, struct nfp_net_rx_desc *rxd,uint32_t hash =0 ;uint32_t hash_type =0 ; -if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS )) +if (!(hw->ctrl &NFP_NET_CFG_CTRL_RSS_ANY ))return ;/* this is true for new firmwares */
Signature · 1 line
2.27.0
Quoted 20 lines · Jin Liu
NFD is part of NFP firmware, and there only exist a NFD3 version before this patch series.
This patch series mainly add the support of the new NFP3800 chip use firmware with NFD3/NFDk.* Changes since v1
- Added updated documentation for NFP to cover NFD.
- Documented the addition of NFD in the release notes.
- Addednfp_netvf_ethdev_ops_mount()to make code better.
- Used capability instead of version to select RSS.
- Adjustednfp_net_txqstruct,just keep one txbuf.* Changes since v2
- Squashed doc update commit to feature commit.
- Adjusted doc comment postion and order.
- Modified function definition format.* Changes since v3
- No longer userte_panic.
Quoted 15 lines
Jin Liu (13):
net/nfp: change the coding style
net/nfp: remove unnecessary forward function declaration net/nfp: remove pessimistic limit
net/nfp: rename set MAC function
net/nfp: rename function and struct
net/nfp: support NFP3800 card
net/nfp: support firmware with NFDk
net/nfp: structure adjustment
net/nfp: nfdk netdev option and queue function net/nfp: add queue stop and close helper function net/nfp: move macro from C file to head file net/nfp: nfdk packet xmit function
net/nfp: modify RSS logic
Series applied to dpdk-next-net/main, thanks.