* [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk
@ 2022-06-02 1:52 Jin Liu
2022-06-02 1:52 ` [PATCH 01/14] net/nfp: change the coding style Jin Liu
` (15 more replies)
0 siblings, 16 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, 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.
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(-)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 01/14] net/nfp: change the coding style
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 22:52 ` Ferruh Yigit
2022-06-02 1:52 ` [PATCH 02/14] net/nfp: remove unnecessary forward function declaration Jin Liu
` (14 subsequent siblings)
15 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Chaoyong He, Jin Liu
From: Chaoyong He <chaoyong.he@corigine.com>
Change the coding style of some logics, to make it more
compatible with the DPDK coding style.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 150 ++++++++++++++++----------------
drivers/net/nfp/nfp_ethdev_vf.c | 5 +-
2 files changed, 75 insertions(+), 80 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 9166f65da3..ea92ca3f68 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0034d68ea6..4aaccc91df 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
};
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 02/14] net/nfp: remove unnecessary forward function declaration
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
2022-06-02 1:52 ` [PATCH 01/14] net/nfp: change the coding style Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 1:52 ` [PATCH 03/14] net/nfp: remove pessimistic limit Jin Liu
` (13 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Chaoyong He, Jin Liu
From: Chaoyong He <chaoyong.he@corigine.com>
This commit remove some unnecessary forward function
declarations.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index ea92ca3f68..790d575bb8 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 4aaccc91df..69d9e0ee47 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 335a90b2c9..cd7faa2c58 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)
{
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 03/14] net/nfp: remove pessimistic limit
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
2022-06-02 1:52 ` [PATCH 01/14] net/nfp: change the coding style Jin Liu
2022-06-02 1:52 ` [PATCH 02/14] net/nfp: remove unnecessary forward function declaration Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 1:52 ` [PATCH 04/14] net/nfp: rename set MAC function Jin Liu
` (12 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Yinjun Zhang, Chaoyong He
Multiple 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_common.h | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8b35fa119c..2ca3c0c30a 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
}
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 04/14] net/nfp: rename set MAC function
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (2 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 03/14] net/nfp: remove pessimistic limit Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 1:52 ` [PATCH 05/14] net/nfp: rename function and struct Jin Liu
` (11 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
The NFP eth driver function name start with 'nfp_net', but set_mac
function start with 'nfp' only, rename it, be consistent with others.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index b26770dbfb..6cd1085c1c 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 2ca3c0c30a..1dd230bcc6 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 790d575bb8..e491eee99a 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 69d9e0ee47..aa156ad162 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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,
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 05/14] net/nfp: rename function and struct
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (3 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 04/14] net/nfp: rename set MAC function Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 1:52 ` [PATCH 06/14] net/nfp: support NFP3800 card Jin Liu
` (10 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add 'nfd3' into the nfd3 firmware eth driver function name, preparation
for the next work, as we will support another nfdk firmware version.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e491eee99a..0d5caf94ea 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index aa156ad162..7d79a08041 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index cd7faa2c58..2c9875e829 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -618,7 +618,7 @@ nfp_net_tx_free_bufs(struct nfp_net_txq *txq)
}
static void
-nfp_net_tx_queue_release_mbufs(struct nfp_net_txq *txq)
+nfp_net_nfd3_tx_queue_release_mbufs(struct nfp_net_txq *txq)
{
unsigned int i;
@@ -634,12 +634,12 @@ nfp_net_tx_queue_release_mbufs(struct nfp_net_txq *txq)
}
void
-nfp_net_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx)
+nfp_net_nfd3_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx)
{
struct nfp_net_txq *txq = dev->data->tx_queues[queue_idx];
if (txq) {
- nfp_net_tx_queue_release_mbufs(txq);
+ nfp_net_nfd3_tx_queue_release_mbufs(txq);
rte_eth_dma_zone_free(dev, "tx_ring", queue_idx);
rte_free(txq->txbufs);
rte_free(txq);
@@ -647,15 +647,15 @@ 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)
+nfp_net_nfd3_reset_tx_queue(struct nfp_net_txq *txq)
{
- nfp_net_tx_queue_release_mbufs(txq);
+ nfp_net_nfd3_tx_queue_release_mbufs(txq);
txq->wr_p = 0;
txq->rd_p = 0;
}
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) {
@@ -698,7 +698,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
if (dev->data->tx_queues[queue_idx]) {
PMD_TX_LOG(DEBUG, "Freeing memory prior to re-allocation %d",
queue_idx);
- nfp_net_tx_queue_release(dev, queue_idx);
+ nfp_net_nfd3_tx_queue_release(dev, queue_idx);
dev->data->tx_queues[queue_idx] = NULL;
}
@@ -718,12 +718,12 @@ 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) {
PMD_DRV_LOG(ERR, "Error allocating tx dma");
- nfp_net_tx_queue_release(dev, queue_idx);
+ nfp_net_nfd3_tx_queue_release(dev, queue_idx);
dev->data->tx_queues[queue_idx] = NULL;
return -ENOMEM;
}
@@ -743,21 +743,21 @@ 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",
sizeof(*txq->txbufs) * nb_desc,
RTE_CACHE_LINE_SIZE, socket_id);
if (txq->txbufs == NULL) {
- nfp_net_tx_queue_release(dev, queue_idx);
+ nfp_net_nfd3_tx_queue_release(dev, queue_idx);
dev->data->tx_queues[queue_idx] = NULL;
return -ENOMEM;
}
PMD_TX_LOG(DEBUG, "txbufs=%p hw_ring=%p dma_addr=0x%" PRIx64,
txq->txbufs, txq->txds, (unsigned long)txq->dma);
- nfp_net_reset_tx_queue(txq);
+ nfp_net_nfd3_reset_tx_queue(txq);
txq->hw = hw;
@@ -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)) {
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index dec1857da3..87a9c59b3b 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 06/14] net/nfp: support NFP3800 card
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (4 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 05/14] net/nfp: rename function and struct Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 22:52 ` Ferruh Yigit
2022-06-02 1:52 ` [PATCH 07/14] net/nfp: support NFDK firmware Jin Liu
` (9 subsequent siblings)
15 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add support for a new type of NIC NFP3800 card, and update some
network card data acquisition interface functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 1dd230bcc6..346fece527 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 0d5caf94ea..4d2cd9b0b3 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 7d79a08041..f5a0406e7d 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h
index 720d3989e6..a04a68f546 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp.h
+++ b/drivers/net/nfp/nfpcore/nfp_cpp.h
@@ -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))
/*
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index 67946891ab..f8f3c372ac 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -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++)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 07/14] net/nfp: support NFDK firmware
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (5 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 06/14] net/nfp: support NFP3800 card Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 22:53 ` Ferruh Yigit
2022-06-02 1:52 ` [PATCH 08/14] net/nfp: structure adjustment Jin Liu
` (8 subsequent siblings)
15 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will
according to the firmware version, mount different driver functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index 4dd62ef194..e73715e2aa 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 4d2cd9b0b3..c09a035323 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -358,6 +358,32 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_net_init(struct rte_eth_dev *eth_dev)
{
@@ -384,7 +410,7 @@ nfp_net_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;
- };
+ }
port = ((struct nfp_net_hw *)eth_dev->data->dev_private)->idx;
if (port < 0 || port > 7) {
@@ -401,11 +427,6 @@ 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_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;
-
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -440,6 +461,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar);
+ hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
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);
@@ -472,7 +498,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
@@ -938,6 +963,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
int err;
int total_ports;
struct nfp_cpp *cpp;
+ struct nfp_net_hw *hw;
struct nfp_rtsym_table *sym_tbl;
if (pci_dev == NULL)
@@ -987,11 +1013,14 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
"ethdev doesn't exist");
return -ENODEV;
}
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
eth_dev->process_private = cpp;
- 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;
+
rte_eth_dev_probing_finish(eth_dev);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index f5a0406e7d..e83c9dbcaf 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 08/14] net/nfp: structure adjustment
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (6 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 07/14] net/nfp: support NFDK firmware Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 22:54 ` Ferruh Yigit
2022-06-02 1:52 ` [PATCH 09/14] net/nfp: nfdk netdev option and queue function Jin Liu
` (7 subsequent siblings)
15 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add and modify the nfp PMD struct and macro that will be used by NFDK
firmware.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_rxtx.h | 69 +++++++++++++++++++++++++++++++++++---
1 file changed, 65 insertions(+), 4 deletions(-)
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 87a9c59b3b..81e2f7560b 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 09/14] net/nfp: nfdk netdev option and queue function
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (7 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 08/14] net/nfp: structure adjustment Jin Liu
@ 2022-06-02 1:52 ` Jin Liu
2022-06-02 1:53 ` [PATCH 10/14] net/nfp: add queue stop and close helper function Jin Liu
` (6 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:52 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add ethdev option for NFDK firmware, implement tx_queue setup and
release function for NFDK firmware.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index c09a035323..2bf7a565bc 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index e83c9dbcaf..ee9ff977cc 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 2c9875e829..bf5817db4b 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -987,3 +987,156 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
return i;
}
+
+static void
+nfp_net_nfdk_tx_queue_release_mbufs(struct nfp_net_txq *txq)
+{
+ uint32_t i;
+
+ if (txq->ktxbufs == NULL)
+ return;
+
+ for (i = 0; i < txq->tx_count; i++) {
+ if (txq->ktxbufs[i].mbuf) {
+ rte_pktmbuf_free_seg(txq->ktxbufs[i].mbuf);
+ txq->ktxbufs[i].mbuf = NULL;
+ }
+ }
+}
+
+void
+nfp_net_nfdk_tx_queue_release(struct rte_eth_dev *dev, uint16_t queue_idx)
+{
+ struct nfp_net_txq *txq = dev->data->tx_queues[queue_idx];
+
+ if (txq) {
+ nfp_net_nfdk_tx_queue_release_mbufs(txq);
+ rte_free(txq->ktxbufs);
+ rte_free(txq);
+ }
+}
+
+void
+nfp_net_nfdk_reset_tx_queue(struct nfp_net_txq *txq)
+{
+ nfp_net_nfdk_tx_queue_release_mbufs(txq);
+ txq->wr_p = 0;
+ txq->rd_p = 0;
+}
+
+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)
+{
+ const struct rte_memzone *tz;
+ struct nfp_net_txq *txq;
+ uint16_t tx_free_thresh;
+ struct nfp_net_hw *hw;
+ uint32_t tx_desc_sz;
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Validating number of descriptors */
+ tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfdk_tx_desc);
+ if (((NFDK_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC) != 0 ||
+ ((NFDK_TX_DESC_PER_SIMPLE_PKT * nb_desc) % NFDK_TX_DESC_BLOCK_CNT) != 0 ||
+ nb_desc > NFP_NET_MAX_TX_DESC || nb_desc < NFP_NET_MIN_TX_DESC) {
+ PMD_DRV_LOG(ERR, "Wrong nb_desc value");
+ return -EINVAL;
+ }
+
+ tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
+ tx_conf->tx_free_thresh :
+ DEFAULT_TX_FREE_THRESH);
+
+ if (tx_free_thresh > (nb_desc)) {
+ PMD_DRV_LOG(ERR,
+ "tx_free_thresh must be less than the number of TX "
+ "descriptors. (tx_free_thresh=%u port=%d "
+ "queue=%d)", (unsigned int)tx_free_thresh,
+ dev->data->port_id, (int)queue_idx);
+ return -(EINVAL);
+ }
+
+ /*
+ * Free memory prior to re-allocation if needed. This is the case after
+ * calling nfp_net_stop
+ */
+ if (dev->data->tx_queues[queue_idx]) {
+ PMD_TX_LOG(DEBUG, "Freeing memory prior to re-allocation %d",
+ queue_idx);
+ nfp_net_nfdk_tx_queue_release(dev, queue_idx);
+ dev->data->tx_queues[queue_idx] = NULL;
+ }
+
+ /* Allocating tx queue data structure */
+ txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct nfp_net_txq),
+ RTE_CACHE_LINE_SIZE, socket_id);
+ if (txq == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ return -ENOMEM;
+ }
+
+ /*
+ * Allocate TX ring hardware descriptors. A memzone large enough to
+ * handle the maximum ring size is allocated in order to allow for
+ * resizing in later calls to the queue setup function.
+ */
+ tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
+ sizeof(struct nfp_net_nfdk_tx_desc) *
+ NFDK_TX_DESC_PER_SIMPLE_PKT *
+ NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ socket_id);
+ if (tz == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ nfp_net_nfdk_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+
+ txq->tx_count = nb_desc * NFDK_TX_DESC_PER_SIMPLE_PKT;
+ txq->tx_free_thresh = tx_free_thresh;
+ txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
+ txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
+ txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
+
+ /* queue mapping based on firmware configuration */
+ txq->qidx = queue_idx;
+ txq->tx_qcidx = queue_idx * hw->stride_tx;
+ txq->qcp_q = hw->tx_bar + NFP_QCP_QUEUE_OFF(txq->tx_qcidx);
+
+ txq->port_id = dev->data->port_id;
+
+ /* Saving physical and virtual addresses for the TX ring */
+ txq->dma = (uint64_t)tz->iova;
+ txq->ktxds = (struct nfp_net_nfdk_tx_desc *)tz->addr;
+
+ /* mbuf pointers array for referencing mbufs linked to TX descriptors */
+ txq->ktxbufs = rte_zmalloc_socket("txq->ktxbufs",
+ sizeof(*txq->ktxbufs) * txq->tx_count,
+ RTE_CACHE_LINE_SIZE, socket_id);
+
+ if (txq->ktxbufs == NULL) {
+ nfp_net_nfdk_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+ PMD_TX_LOG(DEBUG, "ktxbufs=%p hw_ring=%p dma_addr=0x%" PRIx64,
+ txq->ktxbufs, txq->ktxds, (unsigned long)txq->dma);
+
+ nfp_net_nfdk_reset_tx_queue(txq);
+
+ dev->data->tx_queues[queue_idx] = txq;
+ txq->hw = hw;
+ /*
+ * Telling the HW about the physical address of the TX ring and number
+ * of descriptors in log2 format
+ */
+ nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(queue_idx), txq->dma);
+ nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(queue_idx), rte_log2_u32(txq->tx_count));
+
+ return 0;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 81e2f7560b..cce3e0c0e5 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 10/14] net/nfp: add queue stop and close helper function
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (8 preceding siblings ...)
2022-06-02 1:52 ` [PATCH 09/14] net/nfp: nfdk netdev option and queue function Jin Liu
@ 2022-06-02 1:53 ` Jin Liu
2022-06-02 1:53 ` [PATCH 11/14] net/nfp: nfdk stop and close function Jin Liu
` (5 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:53 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
This 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 6cd1085c1c..58e20081fc 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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);
/*
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 346fece527..1489b2ac65 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 2bf7a565bc..0a5c703190 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index ee9ff977cc..d347c98134 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 11/14] net/nfp: nfdk stop and close function
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (9 preceding siblings ...)
2022-06-02 1:53 ` [PATCH 10/14] net/nfp: add queue stop and close helper function Jin Liu
@ 2022-06-02 1:53 ` Jin Liu
2022-06-02 1:53 ` [PATCH 12/14] net/nfp: move macro from C file to head file Jin Liu
` (4 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:53 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Implement NIC stop and close function for NFDK firmware.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 92 ++++++++++++++++++++++++++++++++-
drivers/net/nfp/nfp_ethdev_vf.c | 64 +++++++++++++++++++++--
2 files changed, 151 insertions(+), 5 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 0a5c703190..4e3a6a964d 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index d347c98134..a5c6aceb32 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -214,6 +214,58 @@ nfp_netvf_nfd3_close(struct rte_eth_dev *dev)
return 0;
}
+static int
+nfp_netvf_nfdk_stop(struct rte_eth_dev *dev)
+{
+ PMD_INIT_LOG(DEBUG, "Stop");
+
+ nfp_net_disable_queues(dev);
+
+ /* Clear queues */
+ nfp_net_nfdk_stop_tx_queue(dev);
+
+ nfp_net_stop_rx_queue(dev);
+
+ return 0;
+}
+
+static int
+nfp_netvf_nfdk_close(struct rte_eth_dev *dev)
+{
+ struct rte_pci_device *pci_dev;
+
+ if (rte_eal_process_type() != RTE_PROC_PRIMARY)
+ return 0;
+
+ PMD_INIT_LOG(DEBUG, "Close");
+
+ 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);
+
+ 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);
+
+ /* Cancel possible impending LSC work here before releasing the port*/
+ rte_eal_alarm_cancel(nfp_net_dev_interrupt_delayed_handler, (void *)dev);
+
+ return 0;
+}
+
/* Initialise and register VF driver with DPDK Application */
static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
.dev_configure = nfp_net_configure,
@@ -247,10 +299,10 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
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_stop = nfp_netvf_nfdk_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,
+ .dev_close = nfp_netvf_nfdk_close,
.promiscuous_enable = nfp_net_promisc_enable,
.promiscuous_disable = nfp_net_promisc_disable,
.link_update = nfp_net_link_update,
@@ -498,7 +550,13 @@ 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_nfd3_close(eth_dev);
+ struct nfp_net_hw *hw;
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+ if (NFD_CFG_CLASS_VER_of(hw->ver) == NFP_NET_CFG_VERSION_DP_NFD3)
+ return nfp_netvf_nfd3_close(eth_dev);
+ else
+ return nfp_netvf_nfdk_close(eth_dev);
}
static int eth_nfp_vf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 12/14] net/nfp: move macro from C file to head file
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (10 preceding siblings ...)
2022-06-02 1:53 ` [PATCH 11/14] net/nfp: nfdk stop and close function Jin Liu
@ 2022-06-02 1:53 ` Jin Liu
2022-06-02 1:53 ` [PATCH 13/14] net/nfp: nfdk packet xmit function Jin Liu
` (3 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:53 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Move 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -------------------
drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 2feca2ed81..56bbf05cd8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index 8b494211bc..d2856e19c3 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -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.
*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 13/14] net/nfp: nfdk packet xmit function
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (11 preceding siblings ...)
2022-06-02 1:53 ` [PATCH 12/14] net/nfp: move macro from C file to head file Jin Liu
@ 2022-06-02 1:53 ` Jin Liu
2022-06-02 1:53 ` [PATCH 14/14] net/nfp: modify RSS logic Jin Liu
` (2 subsequent siblings)
15 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:53 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Implement NFP3800 card packet transmit function for NFDK firmware.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 4e3a6a964d..238b2b5451 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index a5c6aceb32..bb8206c4f6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index bf5817db4b..fd3ee40aa5 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -20,6 +20,9 @@
#include "nfp_rxtx.h"
#include "nfp_logs.h"
#include "nfp_ctrl.h"
+#include "nfpcore/nfp_mip.h"
+#include "nfpcore/nfp_rtsym.h"
+#include "nfpcore/nfp-common/nfp_platform.h"
static int
nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq)
@@ -1140,3 +1143,281 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
+
+static inline uint32_t
+nfp_net_nfdk_free_tx_desc(struct nfp_net_txq *txq)
+{
+ uint32_t free_desc;
+
+ if (txq->wr_p >= txq->rd_p)
+ free_desc = txq->tx_count - (txq->wr_p - txq->rd_p);
+ else
+ free_desc = txq->rd_p - txq->wr_p;
+
+ return (free_desc > NFDK_TX_DESC_STOP_CNT) ?
+ (free_desc - NFDK_TX_DESC_STOP_CNT) : 0;
+}
+
+static inline uint32_t
+nfp_net_nfdk_txq_full(struct nfp_net_txq *txq)
+{
+ return (nfp_net_nfdk_free_tx_desc(txq) < txq->tx_free_thresh);
+}
+
+static inline int
+nfp_net_nfdk_headlen_to_segs(unsigned int headlen)
+{
+ return DIV_ROUND_UP(headlen +
+ NFDK_TX_MAX_DATA_PER_DESC -
+ NFDK_TX_MAX_DATA_PER_HEAD,
+ NFDK_TX_MAX_DATA_PER_DESC);
+}
+
+static int
+nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt)
+{
+ unsigned int n_descs, wr_p, i, nop_slots;
+ struct rte_mbuf *pkt_temp;
+
+ pkt_temp = pkt;
+ n_descs = nfp_net_nfdk_headlen_to_segs(pkt_temp->data_len);
+ while (pkt_temp->next) {
+ pkt_temp = pkt_temp->next;
+ n_descs += DIV_ROUND_UP(pkt_temp->data_len, NFDK_TX_MAX_DATA_PER_DESC);
+ }
+
+ if (unlikely(n_descs > NFDK_TX_DESC_GATHER_MAX))
+ return -EINVAL;
+
+ n_descs += !!(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG);
+
+ if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) !=
+ round_down(txq->wr_p + n_descs, NFDK_TX_DESC_BLOCK_CNT))
+ goto close_block;
+
+ if ((uint32_t)txq->data_pending + pkt->pkt_len > NFDK_TX_MAX_DATA_PER_BLOCK)
+ goto close_block;
+
+ return 0;
+
+close_block:
+ wr_p = txq->wr_p;
+ nop_slots = D_BLOCK_CPL(wr_p);
+
+ memset(&txq->ktxds[wr_p], 0, nop_slots * sizeof(struct nfp_net_nfdk_tx_desc));
+ for (i = wr_p; i < nop_slots + wr_p; i++) {
+ if (txq->ktxbufs[i].mbuf) {
+ rte_pktmbuf_free_seg(txq->ktxbufs[i].mbuf);
+ txq->ktxbufs[i].mbuf = NULL;
+ }
+ }
+ txq->data_pending = 0;
+ txq->wr_p = D_IDX(txq, txq->wr_p + nop_slots);
+
+ return nop_slots;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
+ uint64_t flags)
+{
+ uint64_t ol_flags;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
+ return flags;
+
+ ol_flags = mb->ol_flags;
+
+ /* IPv6 does not need checksum */
+ if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
+ flags |= NFDK_DESC_TX_L3_CSUM;
+
+ if (ol_flags & RTE_MBUF_F_TX_L4_MASK)
+ flags |= NFDK_DESC_TX_L4_CSUM;
+
+ return flags;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
+{
+ uint64_t ol_flags;
+ struct nfp_net_nfdk_tx_desc txd;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY))
+ goto clean_txd;
+
+ ol_flags = mb->ol_flags;
+
+ if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG))
+ goto clean_txd;
+
+ txd.l3_offset = mb->l2_len;
+ txd.l4_offset = mb->l2_len + mb->l3_len;
+ txd.lso_meta_res = 0;
+ txd.mss = rte_cpu_to_le_16(mb->tso_segsz);
+ txd.lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len;
+ txd.lso_totsegs = (mb->pkt_len + mb->tso_segsz) / mb->tso_segsz;
+
+clean_txd:
+ txd.l3_offset = 0;
+ txd.l4_offset = 0;
+ txd.lso_hdrlen = 0;
+ txd.mss = 0;
+ txd.lso_totsegs = 0;
+ txd.lso_meta_res = 0;
+
+ return txd.raw;
+}
+
+uint16_t
+nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ uint32_t buf_idx;
+ uint64_t dma_addr;
+ uint16_t free_descs;
+ uint32_t npkts = 0;
+ uint64_t metadata = 0;
+ uint16_t issued_descs = 0;
+ struct nfp_net_txq *txq;
+ struct nfp_net_hw *hw;
+ struct nfp_net_nfdk_tx_desc *ktxds;
+ struct rte_mbuf *pkt, *temp_pkt;
+ struct rte_mbuf **lmbuf;
+
+ txq = tx_queue;
+ hw = txq->hw;
+
+ PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
+ txq->qidx, txq->wr_p, nb_pkts);
+
+ if ((nfp_net_nfdk_free_tx_desc(txq) < NFDK_TX_DESC_PER_SIMPLE_PKT *
+ nb_pkts) || (nfp_net_nfdk_txq_full(txq)))
+ nfp_net_tx_free_bufs(txq);
+
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ if (unlikely(free_descs == 0))
+ return 0;
+
+ PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts);
+ /* Sending packets */
+ while ((npkts < nb_pkts) && free_descs) {
+ uint32_t type, dma_len, dlen_type, tmp_dlen;
+ int nop_descs, used_descs;
+
+ pkt = *(tx_pkts + npkts);
+ nop_descs = nfp_net_nfdk_tx_maybe_close_block(txq, pkt);
+ if (nop_descs < 0)
+ goto xmit_end;
+
+ issued_descs += nop_descs;
+ ktxds = &txq->ktxds[txq->wr_p];
+ /* Grabbing the mbuf linked to the current descriptor */
+ buf_idx = txq->wr_p;
+ lmbuf = &txq->ktxbufs[buf_idx++].mbuf;
+ /* Warming the cache for releasing the mbuf later on */
+ RTE_MBUF_PREFETCH_TO_FREE(*lmbuf);
+
+ temp_pkt = pkt;
+
+ 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");
+ }
+
+ /*
+ * Checksum and VLAN flags just in the first descriptor for a
+ * multisegment packet, but TSO info needs to be in all of them.
+ */
+
+ dma_len = pkt->data_len;
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ type = NFDK_DESC_TX_TYPE_TSO;
+ } else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+ type = NFDK_DESC_TX_TYPE_SIMPLE;
+ } else {
+ type = NFDK_DESC_TX_TYPE_GATHER;
+ }
+ dma_len -= 1;
+ dlen_type = (NFDK_DESC_TX_DMA_LEN_HEAD & dma_len) |
+ (NFDK_DESC_TX_TYPE_HEAD & (type << 12));
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ tmp_dlen = dlen_type & NFDK_DESC_TX_DMA_LEN_HEAD;
+ dma_len -= tmp_dlen;
+ dma_addr += tmp_dlen + 1;
+
+ while (pkt) {
+ if (*lmbuf)
+ rte_pktmbuf_free_seg(*lmbuf);
+ *lmbuf = pkt;
+ while (dma_len > 0) {
+ dma_len -= 1;
+ dlen_type = NFDK_DESC_TX_DMA_LEN & dma_len;
+
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ dma_len -= dlen_type;
+ dma_addr += dlen_type + 1;
+ }
+
+ if (!pkt->next)
+ break;
+
+ pkt = pkt->next;
+ dma_len = pkt->data_len;
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+
+ lmbuf = &txq->ktxbufs[buf_idx++].mbuf;
+ }
+
+ (ktxds - 1)->dma_len_type = rte_cpu_to_le_16(dlen_type | NFDK_DESC_TX_EOP);
+
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_cksum(txq, temp_pkt, metadata));
+ ktxds++;
+
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (temp_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_tso(txq, temp_pkt));
+ ktxds++;
+ }
+
+ used_descs = ktxds - txq->ktxds - txq->wr_p;
+ 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");
+ }
+
+ txq->wr_p = D_IDX(txq, txq->wr_p + used_descs);
+ if (txq->wr_p % NFDK_TX_DESC_BLOCK_CNT)
+ txq->data_pending += temp_pkt->pkt_len;
+ else
+ txq->data_pending = 0;
+
+ issued_descs += used_descs;
+ npkts++;
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ }
+
+xmit_end:
+ /* Increment write pointers. Force memory write before we let HW know */
+ rte_wmb();
+ nfp_qcp_ptr_add(txq->qcp_q, NFP_QCP_WRITE_PTR, issued_descs);
+
+ return npkts;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index cce3e0c0e5..e58127b66e 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH 14/14] net/nfp: modify RSS logic
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (12 preceding siblings ...)
2022-06-02 1:53 ` [PATCH 13/14] net/nfp: nfdk packet xmit function Jin Liu
@ 2022-06-02 1:53 ` Jin Liu
2022-06-02 22:56 ` Ferruh Yigit
2022-06-02 22:51 ` [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
15 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-02 1:53 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Modify RSS-related interface functions, as the NFDK firmware support
feature NFP_NET_CFG_CTRL_RSS2 rather than NFP_NET_CFG_CTRL_RSS.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 58e20081fc..c2515cf413 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index e73715e2aa..372d537462 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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):
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 238b2b5451..bd7dd30f10 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index bb8206c4f6..8769f07be4 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index fd3ee40aa5..43db8db7c3 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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 */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (13 preceding siblings ...)
2022-06-02 1:53 ` [PATCH 14/14] net/nfp: modify RSS logic Jin Liu
@ 2022-06-02 22:51 ` Ferruh Yigit
2022-06-14 8:48 ` Kevin Liu
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
15 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-02 22:51 UTC (permalink / raw)
To: Jin Liu; +Cc: niklas.soderlund, dev
On 6/2/2022 2:52 AM, Jin Liu wrote:
> 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.
> 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(-)
>
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 01/14] net/nfp: change the coding style
2022-06-02 1:52 ` [PATCH 01/14] net/nfp: change the coding style Jin Liu
@ 2022-06-02 22:52 ` Ferruh Yigit
2022-06-14 8:50 ` Kevin Liu
0 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-02 22:52 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Chaoyong He
On 6/2/2022 2:52 AM, Jin Liu wrote:
> From: Chaoyong He <chaoyong.he@corigine.com>
>
> Change the coding style of some logics, to make it more
> compatible with the DPDK coding style.
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> @@ -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);
<...>
> -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];
>
No need to increase the scope of the variable 'port_name', above is
valid for the coding convention.
<...>
> @@ -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");
Same here.
<...>
> @@ -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
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 06/14] net/nfp: support NFP3800 card
2022-06-02 1:52 ` [PATCH 06/14] net/nfp: support NFP3800 card Jin Liu
@ 2022-06-02 22:52 ` Ferruh Yigit
2022-06-14 8:50 ` Kevin Liu
0 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-02 22:52 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Diana Wang, Peng Zhang, Chaoyong He
On 6/2/2022 2:52 AM, Jin Liu wrote:
> Add support for a new type of NIC NFP3800 card, and update some
> network card data acquisition interface functions.
>
> Signed-off-by: Jin Liu<jin.liu@corigine.com>
> Signed-off-by: Diana Wang<na.wang@corigine.com>
> Signed-off-by: Peng Zhang<peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He<chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund<niklas.soderlund@corigine.com>
> ---
> 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(-)
>
> diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
> index 1dd230bcc6..346fece527 100644
> --- a/drivers/net/nfp/nfp_common.h
> +++ b/drivers/net/nfp/nfp_common.h
> @@ -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?
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 07/14] net/nfp: support NFDK firmware
2022-06-02 1:52 ` [PATCH 07/14] net/nfp: support NFDK firmware Jin Liu
@ 2022-06-02 22:53 ` Ferruh Yigit
2022-06-14 8:49 ` Kevin Liu
0 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-02 22:53 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Diana Wang, Peng Zhang, Chaoyong He
On 6/2/2022 2:52 AM, Jin Liu wrote:
> 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?
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> @@ -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;
> + }
> +
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.
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 08/14] net/nfp: structure adjustment
2022-06-02 1:52 ` [PATCH 08/14] net/nfp: structure adjustment Jin Liu
@ 2022-06-02 22:54 ` Ferruh Yigit
2022-06-14 8:49 ` Kevin Liu
0 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-02 22:54 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Diana Wang, Peng Zhang, Chaoyong He
On 6/2/2022 2:52 AM, Jin Liu wrote:
> Add and modify the nfp PMD struct and macro that will be used by NFDK
> firmware.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> @@ -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;
What is the point of this union? Both structs are same.
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 14/14] net/nfp: modify RSS logic
2022-06-02 1:53 ` [PATCH 14/14] net/nfp: modify RSS logic Jin Liu
@ 2022-06-02 22:56 ` Ferruh Yigit
2022-06-14 8:50 ` Kevin Liu
0 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-02 22:56 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Diana Wang, Peng Zhang, Chaoyong He
On 6/2/2022 2:53 AM, Jin Liu wrote:
> Modify RSS-related interface functions, as the NFDK firmware support
> feature NFP_NET_CFG_CTRL_RSS2 rather than NFP_NET_CFG_CTRL_RSS.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
> index e73715e2aa..372d537462 100644
> --- a/drivers/net/nfp/nfp_ctrl.h
> +++ b/drivers/net/nfp/nfp_ctrl.h
> @@ -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):
> diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
> index 238b2b5451..bd7dd30f10 100644
> --- a/drivers/net/nfp/nfp_ethdev.c
> +++ b/drivers/net/nfp/nfp_ethdev.c
> @@ -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 */
> diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
> index bb8206c4f6..8769f07be4 100644
> --- a/drivers/net/nfp/nfp_ethdev_vf.c
> +++ b/drivers/net/nfp/nfp_ethdev_vf.c
> @@ -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;
> + }
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)];
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk
2022-06-02 22:51 ` [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
@ 2022-06-14 8:48 ` Kevin Liu
0 siblings, 0 replies; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 8:48 UTC (permalink / raw)
To: Ferruh Yigit; +Cc: Niklas Soderlund, dev
Yes, I will update documentation and release notes, thanks
-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Sent: Friday, June 3, 2022 06:51
To: Kevin Liu <jin.liu@corigine.com>
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; dev@dpdk.org
Subject: Re: [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk
On 6/2/2022 2:52 AM, Jin Liu wrote:
> 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.
> 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(-)
>
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 07/14] net/nfp: support NFDK firmware
2022-06-02 22:53 ` Ferruh Yigit
@ 2022-06-14 8:49 ` Kevin Liu
2022-06-14 9:21 ` Ferruh Yigit
0 siblings, 1 reply; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 8:49 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Niklas Soderlund, Diana Wang, Nole Zhang, Chaoyong He
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 <ferruh.yigit@xilinx.com>
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware
On 6/2/2022 2:52 AM, Jin Liu wrote:
> 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?
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> @@ -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;
> + }
> +
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.
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 08/14] net/nfp: structure adjustment
2022-06-02 22:54 ` Ferruh Yigit
@ 2022-06-14 8:49 ` Kevin Liu
0 siblings, 0 replies; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 8:49 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Niklas Soderlund, Diana Wang, Nole Zhang, Chaoyong He
We want to distinguish between NFD3 and NFDk, and maybe it is not necessary, I will update it, thanks
-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Sent: Friday, June 3, 2022 06:54
To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
Subject: Re: [PATCH 08/14] net/nfp: structure adjustment
On 6/2/2022 2:52 AM, Jin Liu wrote:
> Add and modify the nfp PMD struct and macro that will be used by NFDK
> firmware.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> @@ -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;
What is the point of this union? Both structs are same.
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 14/14] net/nfp: modify RSS logic
2022-06-02 22:56 ` Ferruh Yigit
@ 2022-06-14 8:50 ` Kevin Liu
0 siblings, 0 replies; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 8:50 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Niklas Soderlund, Diana Wang, Nole Zhang, Chaoyong He
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 <ferruh.yigit@xilinx.com>
Sent: Friday, June 3, 2022 06:57
To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
Subject: Re: [PATCH 14/14] net/nfp: modify RSS logic
On 6/2/2022 2:53 AM, Jin Liu wrote:
> Modify RSS-related interface functions, as the NFDK firmware support
> feature NFP_NET_CFG_CTRL_RSS2 rather than NFP_NET_CFG_CTRL_RSS.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
> index e73715e2aa..372d537462 100644
> --- a/drivers/net/nfp/nfp_ctrl.h
> +++ b/drivers/net/nfp/nfp_ctrl.h
> @@ -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):
> diff --git a/drivers/net/nfp/nfp_ethdev.c
> b/drivers/net/nfp/nfp_ethdev.c index 238b2b5451..bd7dd30f10 100644
> --- a/drivers/net/nfp/nfp_ethdev.c
> +++ b/drivers/net/nfp/nfp_ethdev.c
> @@ -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 */
> diff --git a/drivers/net/nfp/nfp_ethdev_vf.c
> b/drivers/net/nfp/nfp_ethdev_vf.c index bb8206c4f6..8769f07be4 100644
> --- a/drivers/net/nfp/nfp_ethdev_vf.c
> +++ b/drivers/net/nfp/nfp_ethdev_vf.c
> @@ -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;
> + }
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)];
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 01/14] net/nfp: change the coding style
2022-06-02 22:52 ` Ferruh Yigit
@ 2022-06-14 8:50 ` Kevin Liu
0 siblings, 0 replies; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 8:50 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Niklas Soderlund, Chaoyong He
Will do, thanks
-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Sent: Friday, June 3, 2022 06:52
To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
Subject: Re: [PATCH 01/14] net/nfp: change the coding style
On 6/2/2022 2:52 AM, Jin Liu wrote:
> From: Chaoyong He <chaoyong.he@corigine.com>
>
> Change the coding style of some logics, to make it more compatible
> with the DPDK coding style.
>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
<...>
> @@ -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);
<...>
> -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];
>
No need to increase the scope of the variable 'port_name', above is valid for the coding convention.
<...>
> @@ -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");
Same here.
<...>
> @@ -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
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 06/14] net/nfp: support NFP3800 card
2022-06-02 22:52 ` Ferruh Yigit
@ 2022-06-14 8:50 ` Kevin Liu
0 siblings, 0 replies; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 8:50 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Niklas Soderlund, Diana Wang, Nole Zhang, Chaoyong He
Will do, thanks
-----Original Message-----
From: Ferruh Yigit <ferruh.yigit@xilinx.com>
Sent: Friday, June 3, 2022 06:53
To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
Subject: Re: [PATCH 06/14] net/nfp: support NFP3800 card
On 6/2/2022 2:52 AM, Jin Liu wrote:
> Add support for a new type of NIC NFP3800 card, and update some
> network card data acquisition interface functions.
>
> Signed-off-by: Jin Liu<jin.liu@corigine.com>
> Signed-off-by: Diana Wang<na.wang@corigine.com>
> Signed-off-by: Peng Zhang<peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He<chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund<niklas.soderlund@corigine.com>
> ---
> 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(-)
>
> diff --git a/drivers/net/nfp/nfp_common.h
> b/drivers/net/nfp/nfp_common.h index 1dd230bcc6..346fece527 100644
> --- a/drivers/net/nfp/nfp_common.h
> +++ b/drivers/net/nfp/nfp_common.h
> @@ -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?
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH 07/14] net/nfp: support NFDK firmware
2022-06-14 8:49 ` Kevin Liu
@ 2022-06-14 9:21 ` Ferruh Yigit
2022-06-14 9:30 ` Kevin Liu
0 siblings, 1 reply; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-14 9:21 UTC (permalink / raw)
To: Kevin Liu, dev; +Cc: Niklas Soderlund, Diana Wang, Nole Zhang, Chaoyong He
On 6/14/2022 9:49 AM, Kevin Liu wrote:
> 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.
> 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;
>
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()'.
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Sent: Friday, June 3, 2022 06:54
> To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
> Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
> Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware
>
> On 6/2/2022 2:52 AM, Jin Liu wrote:
>> 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?
>
>> Signed-off-by: Jin Liu <jin.liu@corigine.com>
>> Signed-off-by: Diana Wang <na.wang@corigine.com>
>> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
>> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>
> <...>
>
>> @@ -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;
>> + }
>> +
>
> 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.
>
>
^ permalink raw reply [flat|nested] 81+ messages in thread
* RE: [PATCH 07/14] net/nfp: support NFDK firmware
2022-06-14 9:21 ` Ferruh Yigit
@ 2022-06-14 9:30 ` Kevin Liu
0 siblings, 0 replies; 81+ messages in thread
From: Kevin Liu @ 2022-06-14 9:30 UTC (permalink / raw)
To: Ferruh Yigit, dev; +Cc: Niklas Soderlund, Diana Wang, Nole Zhang, Chaoyong He
Now, I modify logic, just keep 'nfp_net_tx_queue_release()', delete 'nfp_net_nfdk_tx_queue_release()' & 'nfp_net_nfd3_tx_queue_release()'
>>> 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 <ferruh.yigit@xilinx.com>
Sent: Tuesday, June 14, 2022 17:22
To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware
On 6/14/2022 9:49 AM, Kevin Liu wrote:
> 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.
> 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;
>
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()'.
> -----Original Message-----
> From: Ferruh Yigit <ferruh.yigit@xilinx.com>
> Sent: Friday, June 3, 2022 06:54
> To: Kevin Liu <jin.liu@corigine.com>; dev@dpdk.org
> Cc: Niklas Soderlund <niklas.soderlund@corigine.com>; Diana Wang <na.wang@corigine.com>; Nole Zhang <peng.zhang@corigine.com>; Chaoyong He <chaoyong.he@corigine.com>
> Subject: Re: [PATCH 07/14] net/nfp: support NFDK firmware
>
> On 6/2/2022 2:52 AM, Jin Liu wrote:
>> 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?
>
>> Signed-off-by: Jin Liu <jin.liu@corigine.com>
>> Signed-off-by: Diana Wang <na.wang@corigine.com>
>> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
>> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
>> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
>
> <...>
>
>> @@ -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;
>> + }
>> +
>
> 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.
>
>
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 00/15] Add support of NFP3800 chip and firmware with NFDk
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
` (14 preceding siblings ...)
2022-06-02 22:51 ` [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 01/15] doc: update release note Jin Liu
` (16 more replies)
15 siblings, 17 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, 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.
- 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(-)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 01/15] doc: update release note
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 15:04 ` Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 02/15] doc: update nfp documentation Jin Liu
` (15 subsequent siblings)
16 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
Add support for a new type NFP NIC NFP3800 and firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
doc/guides/rel_notes/release_22_07.rst | 3 +++
1 file changed, 3 insertions(+)
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index 7d5e3fac77..d5274c9e3d 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -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
-------------
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 02/15] doc: update nfp documentation
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
2022-06-16 2:39 ` [PATCH v2 01/15] doc: update release note Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 15:04 ` Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 03/15] net/nfp: change the coding style Jin Liu
` (14 subsequent siblings)
16 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
This set patches add support for a new type of NFP nic NFP3800 and
the firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
doc/guides/nics/nfp.rst | 10 ++++++----
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index 30cdc69202..2d2b6d283a 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -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
--------------------
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 03/15] net/nfp: change the coding style
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
2022-06-16 2:39 ` [PATCH v2 01/15] doc: update release note Jin Liu
2022-06-16 2:39 ` [PATCH v2 02/15] doc: update nfp documentation Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 04/15] net/nfp: remove unnecessary forward function declaration Jin Liu
` (13 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
Change the coding style of some logics, to make it more
compatible with the DPDK coding style.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 149 ++++++++++++++++----------------
drivers/net/nfp/nfp_ethdev_vf.c | 8 +-
2 files changed, 77 insertions(+), 80 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 9166f65da3..eb0d92a98c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0034d68ea6..381a25c03c 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 04/15] net/nfp: remove unnecessary forward function declaration
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (2 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 03/15] net/nfp: change the coding style Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 05/15] net/nfp: remove pessimistic limit Jin Liu
` (12 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
This commit remove some unnecessary forward function
declarations.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index eb0d92a98c..36ab31b688 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 381a25c03c..8d68ccbc95 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 335a90b2c9..cd7faa2c58 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)
{
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 05/15] net/nfp: remove pessimistic limit
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (3 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 04/15] net/nfp: remove unnecessary forward function declaration Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 06/15] net/nfp: rename set MAC function Jin Liu
` (11 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Yinjun Zhang, Chaoyong He
Multiple 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_common.h | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8db5ec23f8..49d6bb6ad5 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
}
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 06/15] net/nfp: rename set MAC function
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (4 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 05/15] net/nfp: remove pessimistic limit Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 07/15] net/nfp: rename function and struct Jin Liu
` (10 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
The NFP eth driver function name start with 'nfp_net', but set_mac
function start with 'nfp' only, rename it, be consistent with others.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 34e3a03edd..9903a1bd5a 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 49d6bb6ad5..8e1b4fb6a4 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 36ab31b688..b80109ec37 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 8d68ccbc95..08077632c6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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,
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 07/15] net/nfp: rename function and struct
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (5 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 06/15] net/nfp: rename set MAC function Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 08/15] net/nfp: support NFP3800 card Jin Liu
` (9 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add 'nfd3' into the firmware with NFD3 eth driver function name,
preparation for the next work, as we will support another version
firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index b80109ec37..ae6cb5943f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 08077632c6..d0fa1df24d 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index cd7faa2c58..9b769c9775 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)) {
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index dec1857da3..d784f52b66 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 08/15] net/nfp: support NFP3800 card
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (6 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 07/15] net/nfp: rename function and struct Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 15:04 ` Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 09/15] net/nfp: support firmware with NFDk Jin Liu
` (8 subsequent siblings)
16 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add support for a new type of NIC NFP3800 card, and update some
network card data acquisition interface functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8e1b4fb6a4..274d188527 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index ae6cb5943f..cb84dc3188 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index d0fa1df24d..c46ee0f913 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h
index 720d3989e6..a04a68f546 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp.h
+++ b/drivers/net/nfp/nfpcore/nfp_cpp.h
@@ -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))
/*
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index 67946891ab..f8f3c372ac 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -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++)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 09/15] net/nfp: support firmware with NFDk
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (7 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 08/15] net/nfp: support NFP3800 card Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 10/15] net/nfp: structure adjustment Jin Liu
` (7 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will
according to the firmware version, mount different driver functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index 4dd62ef194..e73715e2aa 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index cb84dc3188..1bbba9187e 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -358,6 +358,32 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_net_init(struct rte_eth_dev *eth_dev)
{
@@ -402,11 +428,6 @@ 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_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;
-
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -441,6 +462,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar);
+ hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
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);
@@ -473,7 +499,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
@@ -939,6 +964,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
int err;
int total_ports;
struct nfp_cpp *cpp;
+ struct nfp_net_hw *hw;
struct nfp_rtsym_table *sym_tbl;
if (pci_dev == NULL)
@@ -988,11 +1014,14 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
"secondary process attach failed, ethdev doesn't exist");
return -ENODEV;
}
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
eth_dev->process_private = cpp;
- 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;
+
rte_eth_dev_probing_finish(eth_dev);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index c46ee0f913..0b4660aba6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -265,6 +265,32 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_netvf_init(struct rte_eth_dev *eth_dev)
{
@@ -292,10 +318,19 @@ 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,
+ "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);
+
+ if (nfp_netvf_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
@@ -313,15 +348,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);
@@ -354,7 +380,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 10/15] net/nfp: structure adjustment
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (8 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 09/15] net/nfp: support firmware with NFDk Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 11/15] net/nfp: nfdk netdev option and queue function Jin Liu
` (6 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add and modify the nfp PMD struct and macro that will be used by firmware
with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_rxtx.h | 58 +++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index d784f52b66..106980b9a7 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 11/15] net/nfp: nfdk netdev option and queue function
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (9 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 10/15] net/nfp: structure adjustment Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 12/15] net/nfp: add queue stop and close helper function Jin Liu
` (5 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add ethdev option for firmware with NFDk, implement tx_queue setup
function for firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 1bbba9187e..0d650efd27 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0b4660aba6..2342f44523 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 9b769c9775..4f422c5090 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -987,3 +987,120 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
return i;
}
+
+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)
+{
+ const struct rte_memzone *tz;
+ struct nfp_net_txq *txq;
+ uint16_t tx_free_thresh;
+ struct nfp_net_hw *hw;
+ uint32_t tx_desc_sz;
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Validating number of descriptors */
+ tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfdk_tx_desc);
+ if (((NFDK_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC) != 0 ||
+ ((NFDK_TX_DESC_PER_SIMPLE_PKT * nb_desc) % NFDK_TX_DESC_BLOCK_CNT) != 0 ||
+ nb_desc > NFP_NET_MAX_TX_DESC || nb_desc < NFP_NET_MIN_TX_DESC) {
+ PMD_DRV_LOG(ERR, "Wrong nb_desc value");
+ return -EINVAL;
+ }
+
+ tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
+ tx_conf->tx_free_thresh :
+ DEFAULT_TX_FREE_THRESH);
+
+ if (tx_free_thresh > (nb_desc)) {
+ PMD_DRV_LOG(ERR,
+ "tx_free_thresh must be less than the number of TX "
+ "descriptors. (tx_free_thresh=%u port=%d "
+ "queue=%d)", (unsigned int)tx_free_thresh,
+ dev->data->port_id, (int)queue_idx);
+ return -(EINVAL);
+ }
+
+ /*
+ * Free memory prior to re-allocation if needed. This is the case after
+ * calling nfp_net_stop
+ */
+ if (dev->data->tx_queues[queue_idx]) {
+ PMD_TX_LOG(DEBUG, "Freeing memory prior to re-allocation %d",
+ queue_idx);
+ nfp_net_tx_queue_release(dev, queue_idx);
+ dev->data->tx_queues[queue_idx] = NULL;
+ }
+
+ /* Allocating tx queue data structure */
+ txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct nfp_net_txq),
+ RTE_CACHE_LINE_SIZE, socket_id);
+ if (txq == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ return -ENOMEM;
+ }
+
+ /*
+ * Allocate TX ring hardware descriptors. A memzone large enough to
+ * handle the maximum ring size is allocated in order to allow for
+ * resizing in later calls to the queue setup function.
+ */
+ tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
+ sizeof(struct nfp_net_nfdk_tx_desc) *
+ NFDK_TX_DESC_PER_SIMPLE_PKT *
+ NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ socket_id);
+ if (tz == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ nfp_net_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+
+ txq->tx_count = nb_desc * NFDK_TX_DESC_PER_SIMPLE_PKT;
+ txq->tx_free_thresh = tx_free_thresh;
+ txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
+ txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
+ txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
+
+ /* queue mapping based on firmware configuration */
+ txq->qidx = queue_idx;
+ txq->tx_qcidx = queue_idx * hw->stride_tx;
+ txq->qcp_q = hw->tx_bar + NFP_QCP_QUEUE_OFF(txq->tx_qcidx);
+
+ txq->port_id = dev->data->port_id;
+
+ /* Saving physical and virtual addresses for the TX ring */
+ txq->dma = (uint64_t)tz->iova;
+ txq->ktxds = (struct nfp_net_nfdk_tx_desc *)tz->addr;
+
+ /* mbuf pointers array for referencing mbufs linked to TX descriptors */
+ txq->txbufs = rte_zmalloc_socket("txq->txbufs",
+ sizeof(*txq->txbufs) * txq->tx_count,
+ RTE_CACHE_LINE_SIZE, socket_id);
+
+ if (txq->txbufs == NULL) {
+ nfp_net_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+ PMD_TX_LOG(DEBUG, "txbufs=%p hw_ring=%p dma_addr=0x%" PRIx64,
+ txq->txbufs, txq->ktxds, (unsigned long)txq->dma);
+
+ nfp_net_reset_tx_queue(txq);
+
+ dev->data->tx_queues[queue_idx] = txq;
+ txq->hw = hw;
+ /*
+ * Telling the HW about the physical address of the TX ring and number
+ * of descriptors in log2 format
+ */
+ nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(queue_idx), txq->dma);
+ nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(queue_idx), rte_log2_u32(txq->tx_count));
+
+ return 0;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 106980b9a7..ba8ffbd1ff 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 12/15] net/nfp: add queue stop and close helper function
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (10 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 11/15] net/nfp: nfdk netdev option and queue function Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 13/15] net/nfp: move macro from C file to head file Jin Liu
` (4 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
This 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 9903a1bd5a..755c5ec4d9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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);
/*
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 274d188527..5bbe0f8db0 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 0d650efd27..e8a8368d0f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 2342f44523..56428814b7 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 13/15] net/nfp: move macro from C file to head file
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (11 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 12/15] net/nfp: add queue stop and close helper function Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 14/15] net/nfp: nfdk packet xmit function Jin Liu
` (3 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Move 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -------------------
drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 2feca2ed81..56bbf05cd8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index 8b494211bc..d2856e19c3 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -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.
*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 14/15] net/nfp: nfdk packet xmit function
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (12 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 13/15] net/nfp: move macro from C file to head file Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 2:39 ` [PATCH v2 15/15] net/nfp: modify RSS logic Jin Liu
` (2 subsequent siblings)
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Implement NFP3800 card packet transmit function for firmware
with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e8a8368d0f..b6817c10da 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 56428814b7..66a1c0a36b 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 4f422c5090..1b00f96ed3 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -20,6 +20,9 @@
#include "nfp_rxtx.h"
#include "nfp_logs.h"
#include "nfp_ctrl.h"
+#include "nfpcore/nfp_mip.h"
+#include "nfpcore/nfp_rtsym.h"
+#include "nfpcore/nfp-common/nfp_platform.h"
static int
nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq)
@@ -1104,3 +1107,281 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
+
+static inline uint32_t
+nfp_net_nfdk_free_tx_desc(struct nfp_net_txq *txq)
+{
+ uint32_t free_desc;
+
+ if (txq->wr_p >= txq->rd_p)
+ free_desc = txq->tx_count - (txq->wr_p - txq->rd_p);
+ else
+ free_desc = txq->rd_p - txq->wr_p;
+
+ return (free_desc > NFDK_TX_DESC_STOP_CNT) ?
+ (free_desc - NFDK_TX_DESC_STOP_CNT) : 0;
+}
+
+static inline uint32_t
+nfp_net_nfdk_txq_full(struct nfp_net_txq *txq)
+{
+ return (nfp_net_nfdk_free_tx_desc(txq) < txq->tx_free_thresh);
+}
+
+static inline int
+nfp_net_nfdk_headlen_to_segs(unsigned int headlen)
+{
+ return DIV_ROUND_UP(headlen +
+ NFDK_TX_MAX_DATA_PER_DESC -
+ NFDK_TX_MAX_DATA_PER_HEAD,
+ NFDK_TX_MAX_DATA_PER_DESC);
+}
+
+static int
+nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt)
+{
+ unsigned int n_descs, wr_p, i, nop_slots;
+ struct rte_mbuf *pkt_temp;
+
+ pkt_temp = pkt;
+ n_descs = nfp_net_nfdk_headlen_to_segs(pkt_temp->data_len);
+ while (pkt_temp->next) {
+ pkt_temp = pkt_temp->next;
+ n_descs += DIV_ROUND_UP(pkt_temp->data_len, NFDK_TX_MAX_DATA_PER_DESC);
+ }
+
+ if (unlikely(n_descs > NFDK_TX_DESC_GATHER_MAX))
+ return -EINVAL;
+
+ n_descs += !!(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG);
+
+ if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) !=
+ round_down(txq->wr_p + n_descs, NFDK_TX_DESC_BLOCK_CNT))
+ goto close_block;
+
+ if ((uint32_t)txq->data_pending + pkt->pkt_len > NFDK_TX_MAX_DATA_PER_BLOCK)
+ goto close_block;
+
+ return 0;
+
+close_block:
+ wr_p = txq->wr_p;
+ nop_slots = D_BLOCK_CPL(wr_p);
+
+ memset(&txq->ktxds[wr_p], 0, nop_slots * sizeof(struct nfp_net_nfdk_tx_desc));
+ for (i = wr_p; i < nop_slots + wr_p; i++) {
+ if (txq->txbufs[i].mbuf) {
+ rte_pktmbuf_free_seg(txq->txbufs[i].mbuf);
+ txq->txbufs[i].mbuf = NULL;
+ }
+ }
+ txq->data_pending = 0;
+ txq->wr_p = D_IDX(txq, txq->wr_p + nop_slots);
+
+ return nop_slots;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
+ uint64_t flags)
+{
+ uint64_t ol_flags;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
+ return flags;
+
+ ol_flags = mb->ol_flags;
+
+ /* IPv6 does not need checksum */
+ if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
+ flags |= NFDK_DESC_TX_L3_CSUM;
+
+ if (ol_flags & RTE_MBUF_F_TX_L4_MASK)
+ flags |= NFDK_DESC_TX_L4_CSUM;
+
+ return flags;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
+{
+ uint64_t ol_flags;
+ struct nfp_net_nfdk_tx_desc txd;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY))
+ goto clean_txd;
+
+ ol_flags = mb->ol_flags;
+
+ if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG))
+ goto clean_txd;
+
+ txd.l3_offset = mb->l2_len;
+ txd.l4_offset = mb->l2_len + mb->l3_len;
+ txd.lso_meta_res = 0;
+ txd.mss = rte_cpu_to_le_16(mb->tso_segsz);
+ txd.lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len;
+ txd.lso_totsegs = (mb->pkt_len + mb->tso_segsz) / mb->tso_segsz;
+
+clean_txd:
+ txd.l3_offset = 0;
+ txd.l4_offset = 0;
+ txd.lso_hdrlen = 0;
+ txd.mss = 0;
+ txd.lso_totsegs = 0;
+ txd.lso_meta_res = 0;
+
+ return txd.raw;
+}
+
+uint16_t
+nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ uint32_t buf_idx;
+ uint64_t dma_addr;
+ uint16_t free_descs;
+ uint32_t npkts = 0;
+ uint64_t metadata = 0;
+ uint16_t issued_descs = 0;
+ struct nfp_net_txq *txq;
+ struct nfp_net_hw *hw;
+ struct nfp_net_nfdk_tx_desc *ktxds;
+ struct rte_mbuf *pkt, *temp_pkt;
+ struct rte_mbuf **lmbuf;
+
+ txq = tx_queue;
+ hw = txq->hw;
+
+ PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
+ txq->qidx, txq->wr_p, nb_pkts);
+
+ if ((nfp_net_nfdk_free_tx_desc(txq) < NFDK_TX_DESC_PER_SIMPLE_PKT *
+ nb_pkts) || (nfp_net_nfdk_txq_full(txq)))
+ nfp_net_tx_free_bufs(txq);
+
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ if (unlikely(free_descs == 0))
+ return 0;
+
+ PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts);
+ /* Sending packets */
+ while ((npkts < nb_pkts) && free_descs) {
+ uint32_t type, dma_len, dlen_type, tmp_dlen;
+ int nop_descs, used_descs;
+
+ pkt = *(tx_pkts + npkts);
+ nop_descs = nfp_net_nfdk_tx_maybe_close_block(txq, pkt);
+ if (nop_descs < 0)
+ goto xmit_end;
+
+ issued_descs += nop_descs;
+ ktxds = &txq->ktxds[txq->wr_p];
+ /* Grabbing the mbuf linked to the current descriptor */
+ buf_idx = txq->wr_p;
+ lmbuf = &txq->txbufs[buf_idx++].mbuf;
+ /* Warming the cache for releasing the mbuf later on */
+ RTE_MBUF_PREFETCH_TO_FREE(*lmbuf);
+
+ temp_pkt = pkt;
+
+ 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");
+ }
+
+ /*
+ * Checksum and VLAN flags just in the first descriptor for a
+ * multisegment packet, but TSO info needs to be in all of them.
+ */
+
+ dma_len = pkt->data_len;
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ type = NFDK_DESC_TX_TYPE_TSO;
+ } else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+ type = NFDK_DESC_TX_TYPE_SIMPLE;
+ } else {
+ type = NFDK_DESC_TX_TYPE_GATHER;
+ }
+ dma_len -= 1;
+ dlen_type = (NFDK_DESC_TX_DMA_LEN_HEAD & dma_len) |
+ (NFDK_DESC_TX_TYPE_HEAD & (type << 12));
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ tmp_dlen = dlen_type & NFDK_DESC_TX_DMA_LEN_HEAD;
+ dma_len -= tmp_dlen;
+ dma_addr += tmp_dlen + 1;
+
+ while (pkt) {
+ if (*lmbuf)
+ rte_pktmbuf_free_seg(*lmbuf);
+ *lmbuf = pkt;
+ while (dma_len > 0) {
+ dma_len -= 1;
+ dlen_type = NFDK_DESC_TX_DMA_LEN & dma_len;
+
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ dma_len -= dlen_type;
+ dma_addr += dlen_type + 1;
+ }
+
+ if (!pkt->next)
+ break;
+
+ pkt = pkt->next;
+ dma_len = pkt->data_len;
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+
+ lmbuf = &txq->txbufs[buf_idx++].mbuf;
+ }
+
+ (ktxds - 1)->dma_len_type = rte_cpu_to_le_16(dlen_type | NFDK_DESC_TX_EOP);
+
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_cksum(txq, temp_pkt, metadata));
+ ktxds++;
+
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (temp_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_tso(txq, temp_pkt));
+ ktxds++;
+ }
+
+ used_descs = ktxds - txq->ktxds - txq->wr_p;
+ 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");
+ }
+
+ txq->wr_p = D_IDX(txq, txq->wr_p + used_descs);
+ if (txq->wr_p % NFDK_TX_DESC_BLOCK_CNT)
+ txq->data_pending += temp_pkt->pkt_len;
+ else
+ txq->data_pending = 0;
+
+ issued_descs += used_descs;
+ npkts++;
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ }
+
+xmit_end:
+ /* Increment write pointers. Force memory write before we let HW know */
+ rte_wmb();
+ nfp_qcp_ptr_add(txq->qcp_q, NFP_QCP_WRITE_PTR, issued_descs);
+
+ return npkts;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index ba8ffbd1ff..5c005d74e7 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v2 15/15] net/nfp: modify RSS logic
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (13 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 14/15] net/nfp: nfdk packet xmit function Jin Liu
@ 2022-06-16 2:39 ` Jin Liu
2022-06-16 15:06 ` [PATCH v2 00/15] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
16 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-16 2:39 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Now 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 755c5ec4d9..0e55f0c792 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index e73715e2aa..372d537462 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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):
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index b6817c10da..673a17c26c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 66a1c0a36b..3f4ad3e7ab 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 1b00f96ed3..7414c5167d 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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 */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v2 01/15] doc: update release note
2022-06-16 2:39 ` [PATCH v2 01/15] doc: update release note Jin Liu
@ 2022-06-16 15:04 ` Ferruh Yigit
0 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-16 15:04 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Chaoyong He
On 6/16/2022 3:39 AM, Jin Liu wrote:
> Add support for a new type NFP NIC NFP3800 and firmware with NFDk.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
> doc/guides/rel_notes/release_22_07.rst | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
> index 7d5e3fac77..d5274c9e3d 100644
> --- a/doc/guides/rel_notes/release_22_07.rst
> +++ b/doc/guides/rel_notes/release_22_07.rst
> @@ -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.
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v2 02/15] doc: update nfp documentation
2022-06-16 2:39 ` [PATCH v2 02/15] doc: update nfp documentation Jin Liu
@ 2022-06-16 15:04 ` Ferruh Yigit
0 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-16 15:04 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Chaoyong He
On 6/16/2022 3:39 AM, Jin Liu wrote:
> This set patches add support for a new type of NFP nic NFP3800 and
> the firmware with NFDk.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
> doc/guides/nics/nfp.rst | 10 ++++++----
> 1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
> index 30cdc69202..2d2b6d283a 100644
> --- a/doc/guides/nics/nfp.rst
> +++ b/doc/guides/nics/nfp.rst
> @@ -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.
> 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
> --------------------
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v2 08/15] net/nfp: support NFP3800 card
2022-06-16 2:39 ` [PATCH v2 08/15] net/nfp: support NFP3800 card Jin Liu
@ 2022-06-16 15:04 ` Ferruh Yigit
0 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-16 15:04 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund, Diana Wang, Peng Zhang, Chaoyong He
On 6/16/2022 3:39 AM, Jin Liu wrote:
> Add support for a new type of NIC NFP3800 card, and update some
> network card data acquisition interface functions.
>
> Signed-off-by: Jin Liu <jin.liu@corigine.com>
> Signed-off-by: Diana Wang <na.wang@corigine.com>
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
> Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
> ---
> 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(-)
>
> diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
> index 8e1b4fb6a4..274d188527 100644
> --- a/drivers/net/nfp/nfp_common.h
> +++ b/drivers/net/nfp/nfp_common.h
> @@ -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)
> +{
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_t
nfp_pci_queue(struct rte_pci_device *pdev, uint16_t queue)
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v2 00/15] Add support of NFP3800 chip and firmware with NFDk
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (14 preceding siblings ...)
2022-06-16 2:39 ` [PATCH v2 15/15] net/nfp: modify RSS logic Jin Liu
@ 2022-06-16 15:06 ` Ferruh Yigit
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
16 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-16 15:06 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund
On 6/16/2022 3:39 AM, Jin Liu wrote:
> 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.
> - 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
Hi Jin,
Patches good except doc update organization and minor syntax issue, can
you please send a new version with these addressed?
Thanks,
ferruh
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 00/13] Add support of NFP3800 chip and firmware with NFDk
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
` (15 preceding siblings ...)
2022-06-16 15:06 ` [PATCH v2 00/15] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 01/13] net/nfp: change the coding style Jin Liu
` (14 more replies)
16 siblings, 15 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, 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.
- 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(-)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 01/13] net/nfp: change the coding style
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 02/13] net/nfp: remove unnecessary forward function declaration Jin Liu
` (13 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
Change the coding style of some logics, to make it more
compatible with the DPDK coding style.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 149 ++++++++++++++++----------------
drivers/net/nfp/nfp_ethdev_vf.c | 8 +-
2 files changed, 77 insertions(+), 80 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 9166f65da3..eb0d92a98c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0034d68ea6..381a25c03c 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 02/13] net/nfp: remove unnecessary forward function declaration
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
2022-06-17 9:34 ` [PATCH v3 01/13] net/nfp: change the coding style Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 03/13] net/nfp: remove pessimistic limit Jin Liu
` (12 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
This commit remove some unnecessary forward function
declarations.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index eb0d92a98c..36ab31b688 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 381a25c03c..8d68ccbc95 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 335a90b2c9..cd7faa2c58 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)
{
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 03/13] net/nfp: remove pessimistic limit
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
2022-06-17 9:34 ` [PATCH v3 01/13] net/nfp: change the coding style Jin Liu
2022-06-17 9:34 ` [PATCH v3 02/13] net/nfp: remove unnecessary forward function declaration Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 04/13] net/nfp: rename set MAC function Jin Liu
` (11 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Yinjun Zhang, Chaoyong He
Multiple 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_common.h | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8db5ec23f8..49d6bb6ad5 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
}
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 04/13] net/nfp: rename set MAC function
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (2 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 03/13] net/nfp: remove pessimistic limit Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 05/13] net/nfp: rename function and struct Jin Liu
` (10 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
The NFP eth driver function name start with 'nfp_net', but set_mac
function start with 'nfp' only, rename it, be consistent with others.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 34e3a03edd..9903a1bd5a 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 49d6bb6ad5..8e1b4fb6a4 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 36ab31b688..b80109ec37 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 8d68ccbc95..08077632c6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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,
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 05/13] net/nfp: rename function and struct
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (3 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 04/13] net/nfp: rename set MAC function Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 06/13] net/nfp: support NFP3800 card Jin Liu
` (9 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add 'nfd3' into the firmware with NFD3 eth driver function name,
preparation for the next work, as we will support another version
firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index b80109ec37..ae6cb5943f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 08077632c6..d0fa1df24d 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index cd7faa2c58..9b769c9775 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)) {
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index dec1857da3..d784f52b66 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 06/13] net/nfp: support NFP3800 card
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (4 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 05/13] net/nfp: rename function and struct Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 07/13] net/nfp: support firmware with NFDk Jin Liu
` (8 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add support for a new type of NIC NFP3800 card, and update some
network card data acquisition interface functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index 30cdc69202..dcefac3ef6 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -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).
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index 7d5e3fac77..d5d8c735b1 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -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.
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8e1b4fb6a4..19e96414e3 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index ae6cb5943f..cb84dc3188 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index d0fa1df24d..c46ee0f913 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h
index 720d3989e6..a04a68f546 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp.h
+++ b/drivers/net/nfp/nfpcore/nfp_cpp.h
@@ -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))
/*
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index 67946891ab..f8f3c372ac 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -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++)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 07/13] net/nfp: support firmware with NFDk
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (5 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 06/13] net/nfp: support NFP3800 card Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 08/13] net/nfp: structure adjustment Jin Liu
` (7 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will
according to the firmware version, mount different driver functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index dcefac3ef6..55539accc2 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -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
--------------------
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index d5d8c735b1..64308e6c1a 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -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.**
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index 4dd62ef194..e73715e2aa 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index cb84dc3188..1bbba9187e 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -358,6 +358,32 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_net_init(struct rte_eth_dev *eth_dev)
{
@@ -402,11 +428,6 @@ 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_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;
-
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -441,6 +462,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar);
+ hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
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);
@@ -473,7 +499,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
@@ -939,6 +964,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
int err;
int total_ports;
struct nfp_cpp *cpp;
+ struct nfp_net_hw *hw;
struct nfp_rtsym_table *sym_tbl;
if (pci_dev == NULL)
@@ -988,11 +1014,14 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
"secondary process attach failed, ethdev doesn't exist");
return -ENODEV;
}
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
eth_dev->process_private = cpp;
- 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;
+
rte_eth_dev_probing_finish(eth_dev);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index c46ee0f913..0b4660aba6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -265,6 +265,32 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_netvf_init(struct rte_eth_dev *eth_dev)
{
@@ -292,10 +318,19 @@ 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,
+ "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);
+
+ if (nfp_netvf_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
@@ -313,15 +348,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);
@@ -354,7 +380,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 08/13] net/nfp: structure adjustment
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (6 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 07/13] net/nfp: support firmware with NFDk Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 09/13] net/nfp: nfdk netdev option and queue function Jin Liu
` (6 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add and modify the nfp PMD struct and macro that will be used by firmware
with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_rxtx.h | 58 +++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index d784f52b66..106980b9a7 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 09/13] net/nfp: nfdk netdev option and queue function
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (7 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 08/13] net/nfp: structure adjustment Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 10/13] net/nfp: add queue stop and close helper function Jin Liu
` (5 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add ethdev option for firmware with NFDk, implement tx_queue setup
function for firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 1bbba9187e..0d650efd27 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0b4660aba6..2342f44523 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 9b769c9775..4f422c5090 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -987,3 +987,120 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
return i;
}
+
+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)
+{
+ const struct rte_memzone *tz;
+ struct nfp_net_txq *txq;
+ uint16_t tx_free_thresh;
+ struct nfp_net_hw *hw;
+ uint32_t tx_desc_sz;
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Validating number of descriptors */
+ tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfdk_tx_desc);
+ if (((NFDK_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC) != 0 ||
+ ((NFDK_TX_DESC_PER_SIMPLE_PKT * nb_desc) % NFDK_TX_DESC_BLOCK_CNT) != 0 ||
+ nb_desc > NFP_NET_MAX_TX_DESC || nb_desc < NFP_NET_MIN_TX_DESC) {
+ PMD_DRV_LOG(ERR, "Wrong nb_desc value");
+ return -EINVAL;
+ }
+
+ tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
+ tx_conf->tx_free_thresh :
+ DEFAULT_TX_FREE_THRESH);
+
+ if (tx_free_thresh > (nb_desc)) {
+ PMD_DRV_LOG(ERR,
+ "tx_free_thresh must be less than the number of TX "
+ "descriptors. (tx_free_thresh=%u port=%d "
+ "queue=%d)", (unsigned int)tx_free_thresh,
+ dev->data->port_id, (int)queue_idx);
+ return -(EINVAL);
+ }
+
+ /*
+ * Free memory prior to re-allocation if needed. This is the case after
+ * calling nfp_net_stop
+ */
+ if (dev->data->tx_queues[queue_idx]) {
+ PMD_TX_LOG(DEBUG, "Freeing memory prior to re-allocation %d",
+ queue_idx);
+ nfp_net_tx_queue_release(dev, queue_idx);
+ dev->data->tx_queues[queue_idx] = NULL;
+ }
+
+ /* Allocating tx queue data structure */
+ txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct nfp_net_txq),
+ RTE_CACHE_LINE_SIZE, socket_id);
+ if (txq == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ return -ENOMEM;
+ }
+
+ /*
+ * Allocate TX ring hardware descriptors. A memzone large enough to
+ * handle the maximum ring size is allocated in order to allow for
+ * resizing in later calls to the queue setup function.
+ */
+ tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
+ sizeof(struct nfp_net_nfdk_tx_desc) *
+ NFDK_TX_DESC_PER_SIMPLE_PKT *
+ NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ socket_id);
+ if (tz == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ nfp_net_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+
+ txq->tx_count = nb_desc * NFDK_TX_DESC_PER_SIMPLE_PKT;
+ txq->tx_free_thresh = tx_free_thresh;
+ txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
+ txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
+ txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
+
+ /* queue mapping based on firmware configuration */
+ txq->qidx = queue_idx;
+ txq->tx_qcidx = queue_idx * hw->stride_tx;
+ txq->qcp_q = hw->tx_bar + NFP_QCP_QUEUE_OFF(txq->tx_qcidx);
+
+ txq->port_id = dev->data->port_id;
+
+ /* Saving physical and virtual addresses for the TX ring */
+ txq->dma = (uint64_t)tz->iova;
+ txq->ktxds = (struct nfp_net_nfdk_tx_desc *)tz->addr;
+
+ /* mbuf pointers array for referencing mbufs linked to TX descriptors */
+ txq->txbufs = rte_zmalloc_socket("txq->txbufs",
+ sizeof(*txq->txbufs) * txq->tx_count,
+ RTE_CACHE_LINE_SIZE, socket_id);
+
+ if (txq->txbufs == NULL) {
+ nfp_net_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+ PMD_TX_LOG(DEBUG, "txbufs=%p hw_ring=%p dma_addr=0x%" PRIx64,
+ txq->txbufs, txq->ktxds, (unsigned long)txq->dma);
+
+ nfp_net_reset_tx_queue(txq);
+
+ dev->data->tx_queues[queue_idx] = txq;
+ txq->hw = hw;
+ /*
+ * Telling the HW about the physical address of the TX ring and number
+ * of descriptors in log2 format
+ */
+ nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(queue_idx), txq->dma);
+ nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(queue_idx), rte_log2_u32(txq->tx_count));
+
+ return 0;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 106980b9a7..ba8ffbd1ff 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 10/13] net/nfp: add queue stop and close helper function
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (8 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 09/13] net/nfp: nfdk netdev option and queue function Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 11/13] net/nfp: move macro from C file to head file Jin Liu
` (4 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
This 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 9903a1bd5a..755c5ec4d9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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);
/*
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 19e96414e3..6d917e4b4a 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 0d650efd27..e8a8368d0f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 2342f44523..56428814b7 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 11/13] net/nfp: move macro from C file to head file
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (9 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 10/13] net/nfp: add queue stop and close helper function Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 9:34 ` [PATCH v3 12/13] net/nfp: nfdk packet xmit function Jin Liu
` (3 subsequent siblings)
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Move 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -------------------
drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 2feca2ed81..56bbf05cd8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index 8b494211bc..d2856e19c3 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -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.
*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 12/13] net/nfp: nfdk packet xmit function
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (10 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 11/13] net/nfp: move macro from C file to head file Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-22 16:03 ` Thomas Monjalon
2022-06-17 9:34 ` [PATCH v3 13/13] net/nfp: modify RSS logic Jin Liu
` (2 subsequent siblings)
14 siblings, 1 reply; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Implement NFP3800 card packet transmit function for firmware
with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e8a8368d0f..b6817c10da 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 56428814b7..66a1c0a36b 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 4f422c5090..1b00f96ed3 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -20,6 +20,9 @@
#include "nfp_rxtx.h"
#include "nfp_logs.h"
#include "nfp_ctrl.h"
+#include "nfpcore/nfp_mip.h"
+#include "nfpcore/nfp_rtsym.h"
+#include "nfpcore/nfp-common/nfp_platform.h"
static int
nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq)
@@ -1104,3 +1107,281 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
+
+static inline uint32_t
+nfp_net_nfdk_free_tx_desc(struct nfp_net_txq *txq)
+{
+ uint32_t free_desc;
+
+ if (txq->wr_p >= txq->rd_p)
+ free_desc = txq->tx_count - (txq->wr_p - txq->rd_p);
+ else
+ free_desc = txq->rd_p - txq->wr_p;
+
+ return (free_desc > NFDK_TX_DESC_STOP_CNT) ?
+ (free_desc - NFDK_TX_DESC_STOP_CNT) : 0;
+}
+
+static inline uint32_t
+nfp_net_nfdk_txq_full(struct nfp_net_txq *txq)
+{
+ return (nfp_net_nfdk_free_tx_desc(txq) < txq->tx_free_thresh);
+}
+
+static inline int
+nfp_net_nfdk_headlen_to_segs(unsigned int headlen)
+{
+ return DIV_ROUND_UP(headlen +
+ NFDK_TX_MAX_DATA_PER_DESC -
+ NFDK_TX_MAX_DATA_PER_HEAD,
+ NFDK_TX_MAX_DATA_PER_DESC);
+}
+
+static int
+nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt)
+{
+ unsigned int n_descs, wr_p, i, nop_slots;
+ struct rte_mbuf *pkt_temp;
+
+ pkt_temp = pkt;
+ n_descs = nfp_net_nfdk_headlen_to_segs(pkt_temp->data_len);
+ while (pkt_temp->next) {
+ pkt_temp = pkt_temp->next;
+ n_descs += DIV_ROUND_UP(pkt_temp->data_len, NFDK_TX_MAX_DATA_PER_DESC);
+ }
+
+ if (unlikely(n_descs > NFDK_TX_DESC_GATHER_MAX))
+ return -EINVAL;
+
+ n_descs += !!(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG);
+
+ if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) !=
+ round_down(txq->wr_p + n_descs, NFDK_TX_DESC_BLOCK_CNT))
+ goto close_block;
+
+ if ((uint32_t)txq->data_pending + pkt->pkt_len > NFDK_TX_MAX_DATA_PER_BLOCK)
+ goto close_block;
+
+ return 0;
+
+close_block:
+ wr_p = txq->wr_p;
+ nop_slots = D_BLOCK_CPL(wr_p);
+
+ memset(&txq->ktxds[wr_p], 0, nop_slots * sizeof(struct nfp_net_nfdk_tx_desc));
+ for (i = wr_p; i < nop_slots + wr_p; i++) {
+ if (txq->txbufs[i].mbuf) {
+ rte_pktmbuf_free_seg(txq->txbufs[i].mbuf);
+ txq->txbufs[i].mbuf = NULL;
+ }
+ }
+ txq->data_pending = 0;
+ txq->wr_p = D_IDX(txq, txq->wr_p + nop_slots);
+
+ return nop_slots;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
+ uint64_t flags)
+{
+ uint64_t ol_flags;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
+ return flags;
+
+ ol_flags = mb->ol_flags;
+
+ /* IPv6 does not need checksum */
+ if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
+ flags |= NFDK_DESC_TX_L3_CSUM;
+
+ if (ol_flags & RTE_MBUF_F_TX_L4_MASK)
+ flags |= NFDK_DESC_TX_L4_CSUM;
+
+ return flags;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
+{
+ uint64_t ol_flags;
+ struct nfp_net_nfdk_tx_desc txd;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY))
+ goto clean_txd;
+
+ ol_flags = mb->ol_flags;
+
+ if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG))
+ goto clean_txd;
+
+ txd.l3_offset = mb->l2_len;
+ txd.l4_offset = mb->l2_len + mb->l3_len;
+ txd.lso_meta_res = 0;
+ txd.mss = rte_cpu_to_le_16(mb->tso_segsz);
+ txd.lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len;
+ txd.lso_totsegs = (mb->pkt_len + mb->tso_segsz) / mb->tso_segsz;
+
+clean_txd:
+ txd.l3_offset = 0;
+ txd.l4_offset = 0;
+ txd.lso_hdrlen = 0;
+ txd.mss = 0;
+ txd.lso_totsegs = 0;
+ txd.lso_meta_res = 0;
+
+ return txd.raw;
+}
+
+uint16_t
+nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ uint32_t buf_idx;
+ uint64_t dma_addr;
+ uint16_t free_descs;
+ uint32_t npkts = 0;
+ uint64_t metadata = 0;
+ uint16_t issued_descs = 0;
+ struct nfp_net_txq *txq;
+ struct nfp_net_hw *hw;
+ struct nfp_net_nfdk_tx_desc *ktxds;
+ struct rte_mbuf *pkt, *temp_pkt;
+ struct rte_mbuf **lmbuf;
+
+ txq = tx_queue;
+ hw = txq->hw;
+
+ PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
+ txq->qidx, txq->wr_p, nb_pkts);
+
+ if ((nfp_net_nfdk_free_tx_desc(txq) < NFDK_TX_DESC_PER_SIMPLE_PKT *
+ nb_pkts) || (nfp_net_nfdk_txq_full(txq)))
+ nfp_net_tx_free_bufs(txq);
+
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ if (unlikely(free_descs == 0))
+ return 0;
+
+ PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts);
+ /* Sending packets */
+ while ((npkts < nb_pkts) && free_descs) {
+ uint32_t type, dma_len, dlen_type, tmp_dlen;
+ int nop_descs, used_descs;
+
+ pkt = *(tx_pkts + npkts);
+ nop_descs = nfp_net_nfdk_tx_maybe_close_block(txq, pkt);
+ if (nop_descs < 0)
+ goto xmit_end;
+
+ issued_descs += nop_descs;
+ ktxds = &txq->ktxds[txq->wr_p];
+ /* Grabbing the mbuf linked to the current descriptor */
+ buf_idx = txq->wr_p;
+ lmbuf = &txq->txbufs[buf_idx++].mbuf;
+ /* Warming the cache for releasing the mbuf later on */
+ RTE_MBUF_PREFETCH_TO_FREE(*lmbuf);
+
+ temp_pkt = pkt;
+
+ 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");
+ }
+
+ /*
+ * Checksum and VLAN flags just in the first descriptor for a
+ * multisegment packet, but TSO info needs to be in all of them.
+ */
+
+ dma_len = pkt->data_len;
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ type = NFDK_DESC_TX_TYPE_TSO;
+ } else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+ type = NFDK_DESC_TX_TYPE_SIMPLE;
+ } else {
+ type = NFDK_DESC_TX_TYPE_GATHER;
+ }
+ dma_len -= 1;
+ dlen_type = (NFDK_DESC_TX_DMA_LEN_HEAD & dma_len) |
+ (NFDK_DESC_TX_TYPE_HEAD & (type << 12));
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ tmp_dlen = dlen_type & NFDK_DESC_TX_DMA_LEN_HEAD;
+ dma_len -= tmp_dlen;
+ dma_addr += tmp_dlen + 1;
+
+ while (pkt) {
+ if (*lmbuf)
+ rte_pktmbuf_free_seg(*lmbuf);
+ *lmbuf = pkt;
+ while (dma_len > 0) {
+ dma_len -= 1;
+ dlen_type = NFDK_DESC_TX_DMA_LEN & dma_len;
+
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ dma_len -= dlen_type;
+ dma_addr += dlen_type + 1;
+ }
+
+ if (!pkt->next)
+ break;
+
+ pkt = pkt->next;
+ dma_len = pkt->data_len;
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+
+ lmbuf = &txq->txbufs[buf_idx++].mbuf;
+ }
+
+ (ktxds - 1)->dma_len_type = rte_cpu_to_le_16(dlen_type | NFDK_DESC_TX_EOP);
+
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_cksum(txq, temp_pkt, metadata));
+ ktxds++;
+
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (temp_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_tso(txq, temp_pkt));
+ ktxds++;
+ }
+
+ used_descs = ktxds - txq->ktxds - txq->wr_p;
+ 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");
+ }
+
+ txq->wr_p = D_IDX(txq, txq->wr_p + used_descs);
+ if (txq->wr_p % NFDK_TX_DESC_BLOCK_CNT)
+ txq->data_pending += temp_pkt->pkt_len;
+ else
+ txq->data_pending = 0;
+
+ issued_descs += used_descs;
+ npkts++;
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ }
+
+xmit_end:
+ /* Increment write pointers. Force memory write before we let HW know */
+ rte_wmb();
+ nfp_qcp_ptr_add(txq->qcp_q, NFP_QCP_WRITE_PTR, issued_descs);
+
+ return npkts;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index ba8ffbd1ff..5c005d74e7 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v3 13/13] net/nfp: modify RSS logic
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (11 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 12/13] net/nfp: nfdk packet xmit function Jin Liu
@ 2022-06-17 9:34 ` Jin Liu
2022-06-17 13:33 ` [PATCH v3 00/13] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
14 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-17 9:34 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Now 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 755c5ec4d9..0e55f0c792 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index e73715e2aa..372d537462 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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):
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index b6817c10da..673a17c26c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 66a1c0a36b..3f4ad3e7ab 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 1b00f96ed3..7414c5167d 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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 */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v3 00/13] Add support of NFP3800 chip and firmware with NFDk
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (12 preceding siblings ...)
2022-06-17 9:34 ` [PATCH v3 13/13] net/nfp: modify RSS logic Jin Liu
@ 2022-06-17 13:33 ` Ferruh Yigit
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
14 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-17 13:33 UTC (permalink / raw)
To: Jin Liu; +Cc: niklas.soderlund, dev
On 6/17/2022 10:34 AM, Jin Liu wrote:
> 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.
> - 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
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v3 12/13] net/nfp: nfdk packet xmit function
2022-06-17 9:34 ` [PATCH v3 12/13] net/nfp: nfdk packet xmit function Jin Liu
@ 2022-06-22 16:03 ` Thomas Monjalon
2022-06-22 16:29 ` Ferruh Yigit
0 siblings, 1 reply; 81+ messages in thread
From: Thomas Monjalon @ 2022-06-22 16:03 UTC (permalink / raw)
To: Jin Liu
Cc: dev, niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang,
Chaoyong He, ferruh.yigit, david.marchand, andrew.rybchenko
17/06/2022 11:34, Jin Liu:
> + 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");
> + }
[...]
> + 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/20220617093444.2004000-13-jin.liu@corigine.com/
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.
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v3 12/13] net/nfp: nfdk packet xmit function
2022-06-22 16:03 ` Thomas Monjalon
@ 2022-06-22 16:29 ` Ferruh Yigit
0 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-22 16:29 UTC (permalink / raw)
To: Thomas Monjalon, Jin Liu
Cc: dev, niklas.soderlund, Diana Wang, Peng Zhang, Chaoyong He,
ferruh.yigit, david.marchand, andrew.rybchenko
On 6/22/2022 5:03 PM, Thomas Monjalon wrote:
> 17/06/2022 11:34, Jin Liu:
>> + 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");
>> + }
> [...]
>> + 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/20220617093444.2004000-13-jin.liu@corigine.com/
> 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.
>
>
I also missed it, dropping patch from next-net.
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 00/13] Add support of NFP3800 chip and firmware with NFDk
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
` (13 preceding siblings ...)
2022-06-17 13:33 ` [PATCH v3 00/13] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 01/13] net/nfp: change the coding style Jin Liu
` (13 more replies)
14 siblings, 14 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, 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.
- 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(-)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 01/13] net/nfp: change the coding style
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 02/13] net/nfp: remove unnecessary forward function declaration Jin Liu
` (12 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
Change the coding style of some logics, to make it more
compatible with the DPDK coding style.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_ethdev.c | 149 ++++++++++++++++----------------
drivers/net/nfp/nfp_ethdev_vf.c | 8 +-
2 files changed, 77 insertions(+), 80 deletions(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 9166f65da3..eb0d92a98c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0034d68ea6..381a25c03c 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 02/13] net/nfp: remove unnecessary forward function declaration
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
2022-06-23 2:26 ` [PATCH v4 01/13] net/nfp: change the coding style Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 03/13] net/nfp: remove pessimistic limit Jin Liu
` (11 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Chaoyong He
This commit remove some unnecessary forward function
declarations.
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index eb0d92a98c..36ab31b688 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 381a25c03c..8d68ccbc95 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 335a90b2c9..cd7faa2c58 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)
{
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 03/13] net/nfp: remove pessimistic limit
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
2022-06-23 2:26 ` [PATCH v4 01/13] net/nfp: change the coding style Jin Liu
2022-06-23 2:26 ` [PATCH v4 02/13] net/nfp: remove unnecessary forward function declaration Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 04/13] net/nfp: rename set MAC function Jin Liu
` (10 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Yinjun Zhang, Chaoyong He
Multiple 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Yinjun Zhang <yinjun.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_common.h | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8db5ec23f8..49d6bb6ad5 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
}
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 04/13] net/nfp: rename set MAC function
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (2 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 03/13] net/nfp: remove pessimistic limit Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 05/13] net/nfp: rename function and struct Jin Liu
` (9 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
The NFP eth driver function name start with 'nfp_net', but set_mac
function start with 'nfp' only, rename it, be consistent with others.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 34e3a03edd..9903a1bd5a 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 49d6bb6ad5..8e1b4fb6a4 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 36ab31b688..b80109ec37 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 8d68ccbc95..08077632c6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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,
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 05/13] net/nfp: rename function and struct
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (3 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 04/13] net/nfp: rename set MAC function Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 06/13] net/nfp: support NFP3800 card Jin Liu
` (8 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add 'nfd3' into the firmware with NFD3 eth driver function name,
preparation for the next work, as we will support another version
firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index b80109ec37..ae6cb5943f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 08077632c6..d0fa1df24d 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index cd7faa2c58..9b769c9775 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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)) {
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index dec1857da3..d784f52b66 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 06/13] net/nfp: support NFP3800 card
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (4 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 05/13] net/nfp: rename function and struct Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 07/13] net/nfp: support firmware with NFDk Jin Liu
` (7 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add support for a new type of NIC NFP3800 card, and update some
network card data acquisition interface functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index 30cdc69202..dcefac3ef6 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -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).
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index 7d5e3fac77..d5d8c735b1 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -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.
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 8e1b4fb6a4..19e96414e3 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index ae6cb5943f..cb84dc3188 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index d0fa1df24d..c46ee0f913 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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)
diff --git a/drivers/net/nfp/nfpcore/nfp_cpp.h b/drivers/net/nfp/nfpcore/nfp_cpp.h
index 720d3989e6..a04a68f546 100644
--- a/drivers/net/nfp/nfpcore/nfp_cpp.h
+++ b/drivers/net/nfp/nfpcore/nfp_cpp.h
@@ -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))
/*
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
index 67946891ab..f8f3c372ac 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp_eth.c
@@ -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++)
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 07/13] net/nfp: support firmware with NFDk
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (5 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 06/13] net/nfp: support NFP3800 card Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 08/13] net/nfp: structure adjustment Jin Liu
` (6 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Modify nfp driver logic, add firmware version (NFD3 or NFDK) judgment, will
according to the firmware version, mount different driver functions.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/doc/guides/nics/nfp.rst b/doc/guides/nics/nfp.rst
index dcefac3ef6..55539accc2 100644
--- a/doc/guides/nics/nfp.rst
+++ b/doc/guides/nics/nfp.rst
@@ -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
--------------------
diff --git a/doc/guides/rel_notes/release_22_07.rst b/doc/guides/rel_notes/release_22_07.rst
index d5d8c735b1..64308e6c1a 100644
--- a/doc/guides/rel_notes/release_22_07.rst
+++ b/doc/guides/rel_notes/release_22_07.rst
@@ -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.**
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index 4dd62ef194..e73715e2aa 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index cb84dc3188..1bbba9187e 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -358,6 +358,32 @@ static const struct eth_dev_ops nfp_net_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_net_init(struct rte_eth_dev *eth_dev)
{
@@ -402,11 +428,6 @@ 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_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;
-
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
return 0;
@@ -441,6 +462,11 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
PMD_INIT_LOG(DEBUG, "ctrl bar: %p", hw->ctrl_bar);
+ hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
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);
@@ -473,7 +499,6 @@ nfp_net_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
@@ -939,6 +964,7 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
int err;
int total_ports;
struct nfp_cpp *cpp;
+ struct nfp_net_hw *hw;
struct nfp_rtsym_table *sym_tbl;
if (pci_dev == NULL)
@@ -988,11 +1014,14 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
"secondary process attach failed, ethdev doesn't exist");
return -ENODEV;
}
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(eth_dev->data->dev_private);
+
+ if (nfp_net_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
+
eth_dev->process_private = cpp;
- 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;
+
rte_eth_dev_probing_finish(eth_dev);
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index c46ee0f913..0b4660aba6 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -265,6 +265,32 @@ static const struct eth_dev_ops nfp_netvf_nfd3_eth_dev_ops = {
.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:
+ 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;
+ }
+
+ 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;
+
+ return 0;
+}
+
static int
nfp_netvf_init(struct rte_eth_dev *eth_dev)
{
@@ -292,10 +318,19 @@ 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,
+ "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);
+
+ if (nfp_netvf_ethdev_ops_mount(hw, eth_dev))
+ return -EINVAL;
/* For secondary processes, the primary has done all the work */
if (rte_eal_process_type() != RTE_PROC_PRIMARY)
@@ -313,15 +348,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);
@@ -354,7 +380,6 @@ nfp_netvf_init(struct rte_eth_dev *eth_dev)
nfp_net_cfg_queue_setup(hw);
/* Get some of the read-only fields from the config BAR */
- hw->ver = nn_cfg_readl(hw, NFP_NET_CFG_VERSION);
hw->cap = nn_cfg_readl(hw, NFP_NET_CFG_CAP);
hw->max_mtu = nn_cfg_readl(hw, NFP_NET_CFG_MAX_MTU);
hw->mtu = RTE_ETHER_MTU;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 08/13] net/nfp: structure adjustment
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (6 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 07/13] net/nfp: support firmware with NFDk Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 09/13] net/nfp: nfdk netdev option and queue function Jin Liu
` (5 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add and modify the nfp PMD struct and macro that will be used by firmware
with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfp_rxtx.h | 58 +++++++++++++++++++++++++++++++++++++-
1 file changed, 57 insertions(+), 1 deletion(-)
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index d784f52b66..106980b9a7 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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;
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 09/13] net/nfp: nfdk netdev option and queue function
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (7 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 08/13] net/nfp: structure adjustment Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 10/13] net/nfp: add queue stop and close helper function Jin Liu
` (4 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Add ethdev option for firmware with NFDk, implement tx_queue setup
function for firmware with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 1bbba9187e..0d650efd27 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 0b4660aba6..2342f44523 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 9b769c9775..4f422c5090 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -987,3 +987,120 @@ nfp_net_nfd3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pk
return i;
}
+
+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)
+{
+ const struct rte_memzone *tz;
+ struct nfp_net_txq *txq;
+ uint16_t tx_free_thresh;
+ struct nfp_net_hw *hw;
+ uint32_t tx_desc_sz;
+
+ hw = NFP_NET_DEV_PRIVATE_TO_HW(dev->data->dev_private);
+
+ PMD_INIT_FUNC_TRACE();
+
+ /* Validating number of descriptors */
+ tx_desc_sz = nb_desc * sizeof(struct nfp_net_nfdk_tx_desc);
+ if (((NFDK_TX_DESC_PER_SIMPLE_PKT * tx_desc_sz) % NFP_ALIGN_RING_DESC) != 0 ||
+ ((NFDK_TX_DESC_PER_SIMPLE_PKT * nb_desc) % NFDK_TX_DESC_BLOCK_CNT) != 0 ||
+ nb_desc > NFP_NET_MAX_TX_DESC || nb_desc < NFP_NET_MIN_TX_DESC) {
+ PMD_DRV_LOG(ERR, "Wrong nb_desc value");
+ return -EINVAL;
+ }
+
+ tx_free_thresh = (uint16_t)((tx_conf->tx_free_thresh) ?
+ tx_conf->tx_free_thresh :
+ DEFAULT_TX_FREE_THRESH);
+
+ if (tx_free_thresh > (nb_desc)) {
+ PMD_DRV_LOG(ERR,
+ "tx_free_thresh must be less than the number of TX "
+ "descriptors. (tx_free_thresh=%u port=%d "
+ "queue=%d)", (unsigned int)tx_free_thresh,
+ dev->data->port_id, (int)queue_idx);
+ return -(EINVAL);
+ }
+
+ /*
+ * Free memory prior to re-allocation if needed. This is the case after
+ * calling nfp_net_stop
+ */
+ if (dev->data->tx_queues[queue_idx]) {
+ PMD_TX_LOG(DEBUG, "Freeing memory prior to re-allocation %d",
+ queue_idx);
+ nfp_net_tx_queue_release(dev, queue_idx);
+ dev->data->tx_queues[queue_idx] = NULL;
+ }
+
+ /* Allocating tx queue data structure */
+ txq = rte_zmalloc_socket("ethdev TX queue", sizeof(struct nfp_net_txq),
+ RTE_CACHE_LINE_SIZE, socket_id);
+ if (txq == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ return -ENOMEM;
+ }
+
+ /*
+ * Allocate TX ring hardware descriptors. A memzone large enough to
+ * handle the maximum ring size is allocated in order to allow for
+ * resizing in later calls to the queue setup function.
+ */
+ tz = rte_eth_dma_zone_reserve(dev, "tx_ring", queue_idx,
+ sizeof(struct nfp_net_nfdk_tx_desc) *
+ NFDK_TX_DESC_PER_SIMPLE_PKT *
+ NFP_NET_MAX_TX_DESC, NFP_MEMZONE_ALIGN,
+ socket_id);
+ if (tz == NULL) {
+ PMD_DRV_LOG(ERR, "Error allocating tx dma");
+ nfp_net_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+
+ txq->tx_count = nb_desc * NFDK_TX_DESC_PER_SIMPLE_PKT;
+ txq->tx_free_thresh = tx_free_thresh;
+ txq->tx_pthresh = tx_conf->tx_thresh.pthresh;
+ txq->tx_hthresh = tx_conf->tx_thresh.hthresh;
+ txq->tx_wthresh = tx_conf->tx_thresh.wthresh;
+
+ /* queue mapping based on firmware configuration */
+ txq->qidx = queue_idx;
+ txq->tx_qcidx = queue_idx * hw->stride_tx;
+ txq->qcp_q = hw->tx_bar + NFP_QCP_QUEUE_OFF(txq->tx_qcidx);
+
+ txq->port_id = dev->data->port_id;
+
+ /* Saving physical and virtual addresses for the TX ring */
+ txq->dma = (uint64_t)tz->iova;
+ txq->ktxds = (struct nfp_net_nfdk_tx_desc *)tz->addr;
+
+ /* mbuf pointers array for referencing mbufs linked to TX descriptors */
+ txq->txbufs = rte_zmalloc_socket("txq->txbufs",
+ sizeof(*txq->txbufs) * txq->tx_count,
+ RTE_CACHE_LINE_SIZE, socket_id);
+
+ if (txq->txbufs == NULL) {
+ nfp_net_tx_queue_release(dev, queue_idx);
+ return -ENOMEM;
+ }
+ PMD_TX_LOG(DEBUG, "txbufs=%p hw_ring=%p dma_addr=0x%" PRIx64,
+ txq->txbufs, txq->ktxds, (unsigned long)txq->dma);
+
+ nfp_net_reset_tx_queue(txq);
+
+ dev->data->tx_queues[queue_idx] = txq;
+ txq->hw = hw;
+ /*
+ * Telling the HW about the physical address of the TX ring and number
+ * of descriptors in log2 format
+ */
+ nn_cfg_writeq(hw, NFP_NET_CFG_TXR_ADDR(queue_idx), txq->dma);
+ nn_cfg_writeb(hw, NFP_NET_CFG_TXR_SZ(queue_idx), rte_log2_u32(txq->tx_count));
+
+ return 0;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index 106980b9a7..ba8ffbd1ff 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 10/13] net/nfp: add queue stop and close helper function
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (8 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 09/13] net/nfp: nfdk netdev option and queue function Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 11/13] net/nfp: move macro from C file to head file Jin Liu
` (3 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
This 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 9903a1bd5a..755c5ec4d9 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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);
/*
diff --git a/drivers/net/nfp/nfp_common.h b/drivers/net/nfp/nfp_common.h
index 19e96414e3..6d917e4b4a 100644
--- a/drivers/net/nfp/nfp_common.h
+++ b/drivers/net/nfp/nfp_common.h
@@ -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)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 0d650efd27..e8a8368d0f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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,
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 2342f44523..56428814b7 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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);
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 11/13] net/nfp: move macro from C file to head file
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (9 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 10/13] net/nfp: add queue stop and close helper function Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 12/13] net/nfp: nfdk packet xmit function Jin Liu
` (2 subsequent siblings)
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Move 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
drivers/net/nfp/nfpcore/nfp_rtsym.c | 19 -------------------
drivers/net/nfp/nfpcore/nfp_rtsym.h | 19 +++++++++++++++++++
2 files changed, 19 insertions(+), 19 deletions(-)
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 2feca2ed81..56bbf05cd8 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -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)
{
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index 8b494211bc..d2856e19c3 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -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.
*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 12/13] net/nfp: nfdk packet xmit function
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (10 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 11/13] net/nfp: move macro from C file to head file Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 2:26 ` [PATCH v4 13/13] net/nfp: modify RSS logic Jin Liu
2022-06-23 9:11 ` [PATCH v4 00/13] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Implement NFP3800 card packet transmit function for firmware
with NFDk.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e8a8368d0f..b6817c10da 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 56428814b7..66a1c0a36b 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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;
}
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 4f422c5090..63729261c8 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -20,6 +20,9 @@
#include "nfp_rxtx.h"
#include "nfp_logs.h"
#include "nfp_ctrl.h"
+#include "nfpcore/nfp_mip.h"
+#include "nfpcore/nfp_rtsym.h"
+#include "nfpcore/nfp-common/nfp_platform.h"
static int
nfp_net_rx_fill_freelist(struct nfp_net_rxq *rxq)
@@ -1104,3 +1107,283 @@ nfp_net_nfdk_tx_queue_setup(struct rte_eth_dev *dev,
return 0;
}
+
+static inline uint32_t
+nfp_net_nfdk_free_tx_desc(struct nfp_net_txq *txq)
+{
+ uint32_t free_desc;
+
+ if (txq->wr_p >= txq->rd_p)
+ free_desc = txq->tx_count - (txq->wr_p - txq->rd_p);
+ else
+ free_desc = txq->rd_p - txq->wr_p;
+
+ return (free_desc > NFDK_TX_DESC_STOP_CNT) ?
+ (free_desc - NFDK_TX_DESC_STOP_CNT) : 0;
+}
+
+static inline uint32_t
+nfp_net_nfdk_txq_full(struct nfp_net_txq *txq)
+{
+ return (nfp_net_nfdk_free_tx_desc(txq) < txq->tx_free_thresh);
+}
+
+static inline int
+nfp_net_nfdk_headlen_to_segs(unsigned int headlen)
+{
+ return DIV_ROUND_UP(headlen +
+ NFDK_TX_MAX_DATA_PER_DESC -
+ NFDK_TX_MAX_DATA_PER_HEAD,
+ NFDK_TX_MAX_DATA_PER_DESC);
+}
+
+static int
+nfp_net_nfdk_tx_maybe_close_block(struct nfp_net_txq *txq, struct rte_mbuf *pkt)
+{
+ unsigned int n_descs, wr_p, i, nop_slots;
+ struct rte_mbuf *pkt_temp;
+
+ pkt_temp = pkt;
+ n_descs = nfp_net_nfdk_headlen_to_segs(pkt_temp->data_len);
+ while (pkt_temp->next) {
+ pkt_temp = pkt_temp->next;
+ n_descs += DIV_ROUND_UP(pkt_temp->data_len, NFDK_TX_MAX_DATA_PER_DESC);
+ }
+
+ if (unlikely(n_descs > NFDK_TX_DESC_GATHER_MAX))
+ return -EINVAL;
+
+ n_descs += !!(pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG);
+
+ if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) !=
+ round_down(txq->wr_p + n_descs, NFDK_TX_DESC_BLOCK_CNT))
+ goto close_block;
+
+ if ((uint32_t)txq->data_pending + pkt->pkt_len > NFDK_TX_MAX_DATA_PER_BLOCK)
+ goto close_block;
+
+ return 0;
+
+close_block:
+ wr_p = txq->wr_p;
+ nop_slots = D_BLOCK_CPL(wr_p);
+
+ memset(&txq->ktxds[wr_p], 0, nop_slots * sizeof(struct nfp_net_nfdk_tx_desc));
+ for (i = wr_p; i < nop_slots + wr_p; i++) {
+ if (txq->txbufs[i].mbuf) {
+ rte_pktmbuf_free_seg(txq->txbufs[i].mbuf);
+ txq->txbufs[i].mbuf = NULL;
+ }
+ }
+ txq->data_pending = 0;
+ txq->wr_p = D_IDX(txq, txq->wr_p + nop_slots);
+
+ return nop_slots;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_cksum(struct nfp_net_txq *txq, struct rte_mbuf *mb,
+ uint64_t flags)
+{
+ uint64_t ol_flags;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_TXCSUM))
+ return flags;
+
+ ol_flags = mb->ol_flags;
+
+ /* IPv6 does not need checksum */
+ if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM)
+ flags |= NFDK_DESC_TX_L3_CSUM;
+
+ if (ol_flags & RTE_MBUF_F_TX_L4_MASK)
+ flags |= NFDK_DESC_TX_L4_CSUM;
+
+ return flags;
+}
+
+static inline uint64_t
+nfp_net_nfdk_tx_tso(struct nfp_net_txq *txq, struct rte_mbuf *mb)
+{
+ uint64_t ol_flags;
+ struct nfp_net_nfdk_tx_desc txd;
+ struct nfp_net_hw *hw = txq->hw;
+
+ if (!(hw->cap & NFP_NET_CFG_CTRL_LSO_ANY))
+ goto clean_txd;
+
+ ol_flags = mb->ol_flags;
+
+ if (!(ol_flags & RTE_MBUF_F_TX_TCP_SEG))
+ goto clean_txd;
+
+ txd.l3_offset = mb->l2_len;
+ txd.l4_offset = mb->l2_len + mb->l3_len;
+ txd.lso_meta_res = 0;
+ txd.mss = rte_cpu_to_le_16(mb->tso_segsz);
+ txd.lso_hdrlen = mb->l2_len + mb->l3_len + mb->l4_len;
+ txd.lso_totsegs = (mb->pkt_len + mb->tso_segsz) / mb->tso_segsz;
+
+clean_txd:
+ txd.l3_offset = 0;
+ txd.l4_offset = 0;
+ txd.lso_hdrlen = 0;
+ txd.mss = 0;
+ txd.lso_totsegs = 0;
+ txd.lso_meta_res = 0;
+
+ return txd.raw;
+}
+
+uint16_t
+nfp_net_nfdk_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)
+{
+ uint32_t buf_idx;
+ uint64_t dma_addr;
+ uint16_t free_descs;
+ uint32_t npkts = 0;
+ uint64_t metadata = 0;
+ uint16_t issued_descs = 0;
+ struct nfp_net_txq *txq;
+ struct nfp_net_hw *hw;
+ struct nfp_net_nfdk_tx_desc *ktxds;
+ struct rte_mbuf *pkt, *temp_pkt;
+ struct rte_mbuf **lmbuf;
+
+ txq = tx_queue;
+ hw = txq->hw;
+
+ PMD_TX_LOG(DEBUG, "working for queue %u at pos %d and %u packets",
+ txq->qidx, txq->wr_p, nb_pkts);
+
+ if ((nfp_net_nfdk_free_tx_desc(txq) < NFDK_TX_DESC_PER_SIMPLE_PKT *
+ nb_pkts) || (nfp_net_nfdk_txq_full(txq)))
+ nfp_net_tx_free_bufs(txq);
+
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ if (unlikely(free_descs == 0))
+ return 0;
+
+ PMD_TX_LOG(DEBUG, "queue: %u. Sending %u packets", txq->qidx, nb_pkts);
+ /* Sending packets */
+ while ((npkts < nb_pkts) && free_descs) {
+ uint32_t type, dma_len, dlen_type, tmp_dlen;
+ int nop_descs, used_descs;
+
+ pkt = *(tx_pkts + npkts);
+ nop_descs = nfp_net_nfdk_tx_maybe_close_block(txq, pkt);
+ if (nop_descs < 0)
+ goto xmit_end;
+
+ issued_descs += nop_descs;
+ ktxds = &txq->ktxds[txq->wr_p];
+ /* Grabbing the mbuf linked to the current descriptor */
+ buf_idx = txq->wr_p;
+ lmbuf = &txq->txbufs[buf_idx++].mbuf;
+ /* Warming the cache for releasing the mbuf later on */
+ RTE_MBUF_PREFETCH_TO_FREE(*lmbuf);
+
+ temp_pkt = pkt;
+
+ if (unlikely(pkt->nb_segs > 1 &&
+ !(hw->cap & NFP_NET_CFG_CTRL_GATHER))) {
+ PMD_INIT_LOG(INFO, "NFP_NET_CFG_CTRL_GATHER not set");
+ PMD_INIT_LOG(INFO, "Multisegment packet unsupported");
+ goto xmit_end;
+ }
+
+ /*
+ * Checksum and VLAN flags just in the first descriptor for a
+ * multisegment packet, but TSO info needs to be in all of them.
+ */
+
+ dma_len = pkt->data_len;
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ type = NFDK_DESC_TX_TYPE_TSO;
+ } else if (!pkt->next && dma_len < NFDK_TX_MAX_DATA_PER_HEAD) {
+ type = NFDK_DESC_TX_TYPE_SIMPLE;
+ } else {
+ type = NFDK_DESC_TX_TYPE_GATHER;
+ }
+ dma_len -= 1;
+ dlen_type = (NFDK_DESC_TX_DMA_LEN_HEAD & dma_len) |
+ (NFDK_DESC_TX_TYPE_HEAD & (type << 12));
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ tmp_dlen = dlen_type & NFDK_DESC_TX_DMA_LEN_HEAD;
+ dma_len -= tmp_dlen;
+ dma_addr += tmp_dlen + 1;
+
+ while (pkt) {
+ if (*lmbuf)
+ rte_pktmbuf_free_seg(*lmbuf);
+ *lmbuf = pkt;
+ while (dma_len > 0) {
+ dma_len -= 1;
+ dlen_type = NFDK_DESC_TX_DMA_LEN & dma_len;
+
+ ktxds->dma_len_type = rte_cpu_to_le_16(dlen_type);
+ ktxds->dma_addr_hi = rte_cpu_to_le_16(dma_addr >> 32);
+ ktxds->dma_addr_lo = rte_cpu_to_le_32(dma_addr & 0xffffffff);
+ ktxds++;
+
+ dma_len -= dlen_type;
+ dma_addr += dlen_type + 1;
+ }
+
+ if (!pkt->next)
+ break;
+
+ pkt = pkt->next;
+ dma_len = pkt->data_len;
+ dma_addr = rte_mbuf_data_iova(pkt);
+ PMD_TX_LOG(DEBUG, "Working with mbuf at dma address:"
+ "%" PRIx64 "", dma_addr);
+
+ lmbuf = &txq->txbufs[buf_idx++].mbuf;
+ }
+
+ (ktxds - 1)->dma_len_type = rte_cpu_to_le_16(dlen_type | NFDK_DESC_TX_EOP);
+
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_cksum(txq, temp_pkt, metadata));
+ ktxds++;
+
+ if ((hw->cap & NFP_NET_CFG_CTRL_LSO_ANY) &&
+ (temp_pkt->ol_flags & RTE_MBUF_F_TX_TCP_SEG)) {
+ ktxds->raw = rte_cpu_to_le_64(nfp_net_nfdk_tx_tso(txq, temp_pkt));
+ ktxds++;
+ }
+
+ used_descs = ktxds - txq->ktxds - txq->wr_p;
+ if (round_down(txq->wr_p, NFDK_TX_DESC_BLOCK_CNT) !=
+ round_down(txq->wr_p + used_descs - 1, NFDK_TX_DESC_BLOCK_CNT)) {
+ PMD_INIT_LOG(INFO, "Used descs cross block boundary");
+ goto xmit_end;
+ }
+
+ txq->wr_p = D_IDX(txq, txq->wr_p + used_descs);
+ if (txq->wr_p % NFDK_TX_DESC_BLOCK_CNT)
+ txq->data_pending += temp_pkt->pkt_len;
+ else
+ txq->data_pending = 0;
+
+ issued_descs += used_descs;
+ npkts++;
+ free_descs = (uint16_t)nfp_net_nfdk_free_tx_desc(txq);
+ }
+
+xmit_end:
+ /* Increment write pointers. Force memory write before we let HW know */
+ rte_wmb();
+ nfp_qcp_ptr_add(txq->qcp_q, NFP_QCP_WRITE_PTR, issued_descs);
+
+ return npkts;
+}
diff --git a/drivers/net/nfp/nfp_rxtx.h b/drivers/net/nfp/nfp_rxtx.h
index ba8ffbd1ff..5c005d74e7 100644
--- a/drivers/net/nfp/nfp_rxtx.h
+++ b/drivers/net/nfp/nfp_rxtx.h
@@ -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_ */
/*
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* [PATCH v4 13/13] net/nfp: modify RSS logic
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (11 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 12/13] net/nfp: nfdk packet xmit function Jin Liu
@ 2022-06-23 2:26 ` Jin Liu
2022-06-23 9:11 ` [PATCH v4 00/13] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
13 siblings, 0 replies; 81+ messages in thread
From: Jin Liu @ 2022-06-23 2:26 UTC (permalink / raw)
To: dev; +Cc: niklas.soderlund, Jin Liu, Diana Wang, Peng Zhang, Chaoyong He
Now 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.
Signed-off-by: Jin Liu <jin.liu@corigine.com>
Signed-off-by: Diana Wang <na.wang@corigine.com>
Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Signed-off-by: Chaoyong He <chaoyong.he@corigine.com>
Signed-off-by: Niklas Söderlund <niklas.soderlund@corigine.com>
---
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(-)
diff --git a/drivers/net/nfp/nfp_common.c b/drivers/net/nfp/nfp_common.c
index 755c5ec4d9..0e55f0c792 100644
--- a/drivers/net/nfp/nfp_common.c
+++ b/drivers/net/nfp/nfp_common.c
@@ -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;
diff --git a/drivers/net/nfp/nfp_ctrl.h b/drivers/net/nfp/nfp_ctrl.h
index e73715e2aa..372d537462 100644
--- a/drivers/net/nfp/nfp_ctrl.h
+++ b/drivers/net/nfp/nfp_ctrl.h
@@ -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):
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index b6817c10da..673a17c26c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index 66a1c0a36b..3f4ad3e7ab 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -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 */
diff --git a/drivers/net/nfp/nfp_rxtx.c b/drivers/net/nfp/nfp_rxtx.c
index 63729261c8..8429b44de0 100644
--- a/drivers/net/nfp/nfp_rxtx.c
+++ b/drivers/net/nfp/nfp_rxtx.c
@@ -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 */
--
2.27.0
^ permalink raw reply [flat|nested] 81+ messages in thread
* Re: [PATCH v4 00/13] Add support of NFP3800 chip and firmware with NFDk
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
` (12 preceding siblings ...)
2022-06-23 2:26 ` [PATCH v4 13/13] net/nfp: modify RSS logic Jin Liu
@ 2022-06-23 9:11 ` Ferruh Yigit
13 siblings, 0 replies; 81+ messages in thread
From: Ferruh Yigit @ 2022-06-23 9:11 UTC (permalink / raw)
To: Jin Liu, dev; +Cc: niklas.soderlund
On 6/23/2022 3:26 AM, Jin Liu wrote:
> 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.
> - 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
>
Series applied to dpdk-next-net/main, thanks.
^ permalink raw reply [flat|nested] 81+ messages in thread
end of thread, other threads:[~2022-06-23 9:11 UTC | newest]
Thread overview: 81+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-02 1:52 [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Jin Liu
2022-06-02 1:52 ` [PATCH 01/14] net/nfp: change the coding style Jin Liu
2022-06-02 22:52 ` Ferruh Yigit
2022-06-14 8:50 ` Kevin Liu
2022-06-02 1:52 ` [PATCH 02/14] net/nfp: remove unnecessary forward function declaration Jin Liu
2022-06-02 1:52 ` [PATCH 03/14] net/nfp: remove pessimistic limit Jin Liu
2022-06-02 1:52 ` [PATCH 04/14] net/nfp: rename set MAC function Jin Liu
2022-06-02 1:52 ` [PATCH 05/14] net/nfp: rename function and struct Jin Liu
2022-06-02 1:52 ` [PATCH 06/14] net/nfp: support NFP3800 card Jin Liu
2022-06-02 22:52 ` Ferruh Yigit
2022-06-14 8:50 ` Kevin Liu
2022-06-02 1:52 ` [PATCH 07/14] net/nfp: support NFDK firmware Jin Liu
2022-06-02 22:53 ` Ferruh Yigit
2022-06-14 8:49 ` Kevin Liu
2022-06-14 9:21 ` Ferruh Yigit
2022-06-14 9:30 ` Kevin Liu
2022-06-02 1:52 ` [PATCH 08/14] net/nfp: structure adjustment Jin Liu
2022-06-02 22:54 ` Ferruh Yigit
2022-06-14 8:49 ` Kevin Liu
2022-06-02 1:52 ` [PATCH 09/14] net/nfp: nfdk netdev option and queue function Jin Liu
2022-06-02 1:53 ` [PATCH 10/14] net/nfp: add queue stop and close helper function Jin Liu
2022-06-02 1:53 ` [PATCH 11/14] net/nfp: nfdk stop and close function Jin Liu
2022-06-02 1:53 ` [PATCH 12/14] net/nfp: move macro from C file to head file Jin Liu
2022-06-02 1:53 ` [PATCH 13/14] net/nfp: nfdk packet xmit function Jin Liu
2022-06-02 1:53 ` [PATCH 14/14] net/nfp: modify RSS logic Jin Liu
2022-06-02 22:56 ` Ferruh Yigit
2022-06-14 8:50 ` Kevin Liu
2022-06-02 22:51 ` [PATCH 00/14] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
2022-06-14 8:48 ` Kevin Liu
2022-06-16 2:39 ` [PATCH v2 00/15] " Jin Liu
2022-06-16 2:39 ` [PATCH v2 01/15] doc: update release note Jin Liu
2022-06-16 15:04 ` Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 02/15] doc: update nfp documentation Jin Liu
2022-06-16 15:04 ` Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 03/15] net/nfp: change the coding style Jin Liu
2022-06-16 2:39 ` [PATCH v2 04/15] net/nfp: remove unnecessary forward function declaration Jin Liu
2022-06-16 2:39 ` [PATCH v2 05/15] net/nfp: remove pessimistic limit Jin Liu
2022-06-16 2:39 ` [PATCH v2 06/15] net/nfp: rename set MAC function Jin Liu
2022-06-16 2:39 ` [PATCH v2 07/15] net/nfp: rename function and struct Jin Liu
2022-06-16 2:39 ` [PATCH v2 08/15] net/nfp: support NFP3800 card Jin Liu
2022-06-16 15:04 ` Ferruh Yigit
2022-06-16 2:39 ` [PATCH v2 09/15] net/nfp: support firmware with NFDk Jin Liu
2022-06-16 2:39 ` [PATCH v2 10/15] net/nfp: structure adjustment Jin Liu
2022-06-16 2:39 ` [PATCH v2 11/15] net/nfp: nfdk netdev option and queue function Jin Liu
2022-06-16 2:39 ` [PATCH v2 12/15] net/nfp: add queue stop and close helper function Jin Liu
2022-06-16 2:39 ` [PATCH v2 13/15] net/nfp: move macro from C file to head file Jin Liu
2022-06-16 2:39 ` [PATCH v2 14/15] net/nfp: nfdk packet xmit function Jin Liu
2022-06-16 2:39 ` [PATCH v2 15/15] net/nfp: modify RSS logic Jin Liu
2022-06-16 15:06 ` [PATCH v2 00/15] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
2022-06-17 9:34 ` [PATCH v3 00/13] " Jin Liu
2022-06-17 9:34 ` [PATCH v3 01/13] net/nfp: change the coding style Jin Liu
2022-06-17 9:34 ` [PATCH v3 02/13] net/nfp: remove unnecessary forward function declaration Jin Liu
2022-06-17 9:34 ` [PATCH v3 03/13] net/nfp: remove pessimistic limit Jin Liu
2022-06-17 9:34 ` [PATCH v3 04/13] net/nfp: rename set MAC function Jin Liu
2022-06-17 9:34 ` [PATCH v3 05/13] net/nfp: rename function and struct Jin Liu
2022-06-17 9:34 ` [PATCH v3 06/13] net/nfp: support NFP3800 card Jin Liu
2022-06-17 9:34 ` [PATCH v3 07/13] net/nfp: support firmware with NFDk Jin Liu
2022-06-17 9:34 ` [PATCH v3 08/13] net/nfp: structure adjustment Jin Liu
2022-06-17 9:34 ` [PATCH v3 09/13] net/nfp: nfdk netdev option and queue function Jin Liu
2022-06-17 9:34 ` [PATCH v3 10/13] net/nfp: add queue stop and close helper function Jin Liu
2022-06-17 9:34 ` [PATCH v3 11/13] net/nfp: move macro from C file to head file Jin Liu
2022-06-17 9:34 ` [PATCH v3 12/13] net/nfp: nfdk packet xmit function Jin Liu
2022-06-22 16:03 ` Thomas Monjalon
2022-06-22 16:29 ` Ferruh Yigit
2022-06-17 9:34 ` [PATCH v3 13/13] net/nfp: modify RSS logic Jin Liu
2022-06-17 13:33 ` [PATCH v3 00/13] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
2022-06-23 2:26 ` [PATCH v4 " Jin Liu
2022-06-23 2:26 ` [PATCH v4 01/13] net/nfp: change the coding style Jin Liu
2022-06-23 2:26 ` [PATCH v4 02/13] net/nfp: remove unnecessary forward function declaration Jin Liu
2022-06-23 2:26 ` [PATCH v4 03/13] net/nfp: remove pessimistic limit Jin Liu
2022-06-23 2:26 ` [PATCH v4 04/13] net/nfp: rename set MAC function Jin Liu
2022-06-23 2:26 ` [PATCH v4 05/13] net/nfp: rename function and struct Jin Liu
2022-06-23 2:26 ` [PATCH v4 06/13] net/nfp: support NFP3800 card Jin Liu
2022-06-23 2:26 ` [PATCH v4 07/13] net/nfp: support firmware with NFDk Jin Liu
2022-06-23 2:26 ` [PATCH v4 08/13] net/nfp: structure adjustment Jin Liu
2022-06-23 2:26 ` [PATCH v4 09/13] net/nfp: nfdk netdev option and queue function Jin Liu
2022-06-23 2:26 ` [PATCH v4 10/13] net/nfp: add queue stop and close helper function Jin Liu
2022-06-23 2:26 ` [PATCH v4 11/13] net/nfp: move macro from C file to head file Jin Liu
2022-06-23 2:26 ` [PATCH v4 12/13] net/nfp: nfdk packet xmit function Jin Liu
2022-06-23 2:26 ` [PATCH v4 13/13] net/nfp: modify RSS logic Jin Liu
2022-06-23 9:11 ` [PATCH v4 00/13] Add support of NFP3800 chip and firmware with NFDk Ferruh Yigit
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).