DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 00/23] support flower firmware with multiple PF
@ 2024-06-19  9:58 Chaoyong He
  2024-06-19  9:58 ` [PATCH 01/23] net/nfp: fix dereference of null pointer Chaoyong He
                   ` (23 more replies)
  0 siblings, 24 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series refactor some data structure and logic in order
to support the flower firmware with multiple PF.

Peng Zhang (23):
  net/nfp: fix dereference of null pointer
  net/nfp: disable ctrl VNIC queues
  net/nfp: fix dereference of null pointer
  net/nfp: fix repeat disable the port
  net/nfp: fix repeat set the speed configure
  net/nfp: make the logic simpler by adding local variable
  net/nfp: rename the variable name
  net/nfp: export function ID get interface
  net/nfp: extract total phyports
  net/nfp: extract the initialize helper function
  net/nfp: get the VF configuration
  net/nfp: refactor the logic of flower service
  net/nfp: get the first VF ID of the PF
  net/nfp: add the helper function to map rtsym with offset
  net/nfp: add the VF table to record the VF information
  net/nfp: support configuration of VF numbers
  net/nfp: configure the VF queue
  net/nfp: add check for numbers of VF representor port
  net/nfp: add support of ring pop and push
  net/nfp: add resource share mode of host context
  net/nfp: add resource share mode of mask ID
  net/nfp: add device active command for nsp service
  net/nfp: add support of flower firmware with multiple PF

 drivers/common/nfp/nfp_common_ctrl.h          |  21 +
 drivers/net/nfp/flower/nfp_conntrack.c        |   2 +-
 drivers/net/nfp/flower/nfp_flower.c           |  25 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.c      |  10 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h      |   3 +-
 drivers/net/nfp/flower/nfp_flower_ctrl.c      |  28 +-
 drivers/net/nfp/flower/nfp_flower_ctrl.h      |   2 +-
 drivers/net/nfp/flower/nfp_flower_flow.c      | 241 +++++++--
 drivers/net/nfp/flower/nfp_flower_flow.h      |   4 +-
 .../net/nfp/flower/nfp_flower_representor.c   |  58 +-
 drivers/net/nfp/flower/nfp_flower_service.c   |  24 +-
 drivers/net/nfp/flower/nfp_flower_service.h   |   4 +-
 drivers/net/nfp/nfp_ethdev.c                  | 494 ++++++++++++++----
 drivers/net/nfp/nfp_net_common.c              | 183 +++++++
 drivers/net/nfp/nfp_net_common.h              |  27 +-
 drivers/net/nfp/nfpcore/nfp_nsp.c             |  10 +
 drivers/net/nfp/nfpcore/nfp_nsp.h             |   1 +
 drivers/net/nfp/nfpcore/nfp_rtsym.c           | 117 ++++-
 drivers/net/nfp/nfpcore/nfp_rtsym.h           |   6 +
 drivers/net/nfp/nfpcore/nfp_target.c          |   2 +
 20 files changed, 1053 insertions(+), 209 deletions(-)

-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 01/23] net/nfp: fix dereference of null pointer
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-07-07 18:56   ` Ferruh Yigit
  2024-06-19  9:58 ` [PATCH 02/23] net/nfp: disable ctrl VNIC queues Chaoyong He
                   ` (22 subsequent siblings)
  23 siblings, 1 reply; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, chaoyong.he, stable

From: Peng Zhang <peng.zhang@corigine.com>

The original logic can call the uninitialized parameter 'process_private'
to get 'struct nfp_net_hw_priv', so the null pointer will cause a segment
fault problem.

This commit will add the "struct nfp_repr_init" as the parameter,
it includes "struct nfp_net_hw_priv", it can fix this bug.

Fixes: 149850c5b8ec ("net/nfp: support xstats for flower firmware")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
---
 .../net/nfp/flower/nfp_flower_representor.c   | 19 +++++++++++++++----
 1 file changed, 15 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index e7550ce9ef..7f12a9dcaa 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -19,6 +19,11 @@ enum nfp_repr_type {
 	NFP_REPR_TYPE_MAX,          /*<< Number of representor types */
 };
 
+struct nfp_repr_init {
+	struct nfp_flower_representor *flower_repr;
+	struct nfp_net_hw_priv *hw_priv;
+};
+
 static int
 nfp_flower_repr_link_update(struct rte_eth_dev *dev,
 		__rte_unused int wait_to_complete)
@@ -603,6 +608,7 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
 	int ret;
 	uint16_t index;
 	unsigned int numa_node;
+	struct nfp_repr_init *repr_init;
 	struct nfp_net_hw_priv *hw_priv;
 	char ring_name[RTE_ETH_NAME_MAX_LEN];
 	struct nfp_app_fw_flower *app_fw_flower;
@@ -610,12 +616,13 @@ nfp_flower_repr_init(struct rte_eth_dev *eth_dev,
 	struct nfp_flower_representor *init_repr_data;
 
 	/* Cast the input representor data to the correct struct here */
-	init_repr_data = init_params;
+	repr_init = init_params;
+	init_repr_data = repr_init->flower_repr;
 	app_fw_flower = init_repr_data->app_fw_flower;
 
 	/* Memory has been allocated in the eth_dev_create() function */
 	repr = eth_dev->data->dev_private;
-	hw_priv = eth_dev->process_private;
+	hw_priv = repr_init->hw_priv;
 
 	/*
 	 * We need multiproduce rings as we can have multiple PF ports.
@@ -785,6 +792,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	int ret;
 	const char *pci_name;
 	struct rte_pci_device *pci_dev;
+	struct nfp_repr_init repr_init;
 	struct nfp_eth_table *nfp_eth_table;
 	struct nfp_eth_table_port *eth_port;
 	struct nfp_flower_representor flower_repr = {
@@ -793,6 +801,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	};
 
 	nfp_eth_table = hw_priv->pf_dev->nfp_eth_table;
+	repr_init.hw_priv = hw_priv;
 
 	/* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */
 	ret = nfp_flower_cmsg_mac_repr(app_fw_flower, nfp_eth_table);
@@ -840,9 +849,10 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 		 * Create a eth_dev for this representor.
 		 * This will also allocate private memory for the device.
 		 */
+		repr_init.flower_repr = &flower_repr;
 		ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name,
 				sizeof(struct nfp_flower_representor),
-				NULL, NULL, nfp_flower_repr_init, &flower_repr);
+				NULL, NULL, nfp_flower_repr_init, &repr_init);
 		if (ret != 0) {
 			PMD_INIT_LOG(ERR, "Cloud not create eth_dev for repr");
 			break;
@@ -868,10 +878,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 		snprintf(flower_repr.name, sizeof(flower_repr.name),
 				"%s_repr_vf%d", pci_name, i);
 
+		repr_init.flower_repr = &flower_repr;
 		/* This will also allocate private memory for the device */
 		ret = rte_eth_dev_create(&pci_dev->device, flower_repr.name,
 				sizeof(struct nfp_flower_representor),
-				NULL, NULL, nfp_flower_repr_init, &flower_repr);
+				NULL, NULL, nfp_flower_repr_init, &repr_init);
 		if (ret != 0) {
 			PMD_INIT_LOG(ERR, "Cloud not create eth_dev for repr");
 			break;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 02/23] net/nfp: disable ctrl VNIC queues
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
  2024-06-19  9:58 ` [PATCH 01/23] net/nfp: fix dereference of null pointer Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 03/23] net/nfp: fix dereference of null pointer Chaoyong He
                   ` (21 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, chaoyong.he, stable, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

The logic forgot to disable the ctrl VNIC queues when representor
port close, and this will cause DPDK application restart fail if
not force reload the flower firmware.

Fix this by adding the missing logic to disable the ctrl VNIC
queues.

Fixes: 945441ebdb9c ("net/nfp: add flower ctrl VNIC")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 0edebd574a..5caaf9d745 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -533,6 +533,8 @@ nfp_flower_cleanup_ctrl_vnic(struct nfp_app_fw_flower *app_fw_flower,
 
 	pci_name = strchr(hw_priv->pf_dev->pci_dev->name, ':') + 1;
 
+	nfp_net_disable_queues(eth_dev);
+
 	snprintf(ctrl_txring_name, sizeof(ctrl_txring_name), "%s_cttx_ring", pci_name);
 	for (i = 0; i < hw->max_tx_queues; i++) {
 		txq = eth_dev->data->tx_queues[i];
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 03/23] net/nfp: fix dereference of null pointer
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
  2024-06-19  9:58 ` [PATCH 01/23] net/nfp: fix dereference of null pointer Chaoyong He
  2024-06-19  9:58 ` [PATCH 02/23] net/nfp: disable ctrl VNIC queues Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 04/23] net/nfp: fix repeat disable the port Chaoyong He
                   ` (20 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, james.hershaw, stable, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

The original logic can not make sure the 'repr' pointer has
valid value and the dereference of null pointer will cause
a segment fault problem.

Fixes: eae7dadbe987 ("net/nfp: update link status reporting")
Cc: james.hershaw@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_ctrl.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index de6e419cac..8cfafe91c8 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -441,6 +441,11 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_app_fw_flower *app_fw_flower,
 		return -EINVAL;
 	}
 
+	if (repr == NULL) {
+		PMD_DRV_LOG(ERR, "Can not get 'repr' for port %#x", port);
+		return -EINVAL;
+	}
+
 	repr->link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
 	if ((msg->info & NFP_FLOWER_CMSG_PORT_MOD_INFO_LINK) != 0)
 		repr->link.link_status = RTE_ETH_LINK_UP;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 04/23] net/nfp: fix repeat disable the port
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (2 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 03/23] net/nfp: fix dereference of null pointer Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 05/23] net/nfp: fix repeat set the speed configure Chaoyong He
                   ` (19 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, stable, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

For firmware with multiple PFs, all the PFs share
the same 'nfp_eth_table' data structure. So the original
logic loop the ports in 'nfp_eth_table' will make other
PFs suddently down, which will cause problem.

Fix this by adding the special logic for firmware with
multiple PFs.

Fixes: 3b00109d2b65 ("net/nfp: add PF ID used to format symbols")
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c     | 35 ++++++++++++++++++++++++++------
 drivers/net/nfp/nfp_net_common.c | 10 +++++++++
 drivers/net/nfp/nfp_net_common.h |  2 ++
 3 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 181798e8e3..7479802a52 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1773,6 +1773,30 @@ nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev,
 	return 0;
 }
 
+/* Force the physical port down to clear the possible DMA error */
+static int
+nfp_net_force_port_down(struct nfp_pf_dev *pf_dev,
+		struct nfp_eth_table *nfp_eth_table,
+		struct nfp_cpp *cpp)
+{
+	int ret;
+	uint32_t i;
+	uint32_t id;
+	uint32_t index;
+	uint32_t count;
+
+	count = nfp_net_get_port_num(pf_dev, nfp_eth_table);
+	for (i = 0; i < count; i++) {
+		id = nfp_function_id_get(pf_dev, i);
+		index = nfp_eth_table->ports[id].index;
+		ret = nfp_eth_set_configured(cpp, index, 0);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
 static int
 nfp_pf_init(struct rte_pci_device *pci_dev)
 {
@@ -1781,7 +1805,6 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	uint32_t id;
 	int ret = 0;
 	uint64_t addr;
-	uint32_t index;
 	uint32_t cpp_id;
 	uint8_t function_id;
 	struct nfp_cpp *cpp;
@@ -1875,11 +1898,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	pf_dev->multi_pf.enabled = nfp_check_multi_pf_from_nsp(pci_dev, cpp);
 	pf_dev->multi_pf.function_id = function_id;
 
-	/* Force the physical port down to clear the possible DMA error */
-	for (i = 0; i < nfp_eth_table->count; i++) {
-		id = nfp_function_id_get(pf_dev, i);
-		index = nfp_eth_table->ports[id].index;
-		nfp_eth_set_configured(cpp, index, 0);
+	ret = nfp_net_force_port_down(pf_dev, nfp_eth_table, cpp);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to force port down");
+		ret = -EIO;
+		goto eth_table_cleanup;
 	}
 
 	ret = nfp_devargs_parse(&pf_dev->devargs, pci_dev->device.devargs);
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 107306a4e3..d8b7045c3a 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2554,3 +2554,13 @@ nfp_net_fec_set(struct rte_eth_dev *dev,
 
 	return nfp_eth_set_fec(hw_priv->pf_dev->cpp, eth_port->index, fec);
 }
+
+uint32_t
+nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
+		struct nfp_eth_table *nfp_eth_table)
+{
+	if (pf_dev->multi_pf.enabled)
+		return 1;
+	else
+		return nfp_eth_table->count;
+}
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 2feeb6f5bd..4016652cf9 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -326,6 +326,8 @@ void nfp_net_get_fw_version(struct nfp_cpp *cpp,
 		uint32_t *fw_version);
 int nfp_net_txrwb_alloc(struct rte_eth_dev *eth_dev);
 void nfp_net_txrwb_free(struct rte_eth_dev *eth_dev);
+uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
+		struct nfp_eth_table *nfp_eth_table);
 
 #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\
 	((struct nfp_app_fw_nic *)app_fw_priv)
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 05/23] net/nfp: fix repeat set the speed configure
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (3 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 04/23] net/nfp: fix repeat disable the port Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 06/23] net/nfp: make the logic simpler by adding local variable Chaoyong He
                   ` (18 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, zerun.fu, stable, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

For firmware with multiple PFs, all the PFs share the same
'nfp_eth_table' data structure. So the original logic loop the
ports in 'nfp_eth_table' will cause the speed capability field of
the 'struct nfp_pf_dev' be covered.

Fix this by adding the special logic for firmware with multiple PFs.

Fixes: 3110ab733862 ("net/nfp: support getting speed capability")
Cc: zerun.fu@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 39 +++++++++++++++++++++++++-----------
 1 file changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 7479802a52..2c1300350c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1741,7 +1741,7 @@ nfp_net_speed_capa_get_real(struct nfp_eth_media_buf *media_buf,
 }
 
 static int
-nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev,
+nfp_net_speed_cap_get_one(struct nfp_pf_dev *pf_dev,
 		uint32_t port_id)
 {
 	int ret;
@@ -1773,6 +1773,27 @@ nfp_net_speed_capa_get(struct nfp_pf_dev *pf_dev,
 	return 0;
 }
 
+static int
+nfp_net_speed_cap_get(struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+	uint32_t i;
+	uint32_t id;
+	uint32_t count;
+
+	count = nfp_net_get_port_num(pf_dev, pf_dev->nfp_eth_table);
+	for (i = 0; i < count; i++) {
+		id = nfp_function_id_get(pf_dev, i);
+		ret = nfp_net_speed_cap_get_one(pf_dev, id);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Failed to get port %d speed capability.", id);
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
 /* Force the physical port down to clear the possible DMA error */
 static int
 nfp_net_force_port_down(struct nfp_pf_dev *pf_dev,
@@ -1801,8 +1822,6 @@ static int
 nfp_pf_init(struct rte_pci_device *pci_dev)
 {
 	void *sync;
-	uint32_t i;
-	uint32_t id;
 	int ret = 0;
 	uint64_t addr;
 	uint32_t cpp_id;
@@ -1953,15 +1972,11 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	pf_dev->nfp_eth_table = nfp_eth_table;
 	pf_dev->sync = sync;
 
-	/* Get the speed capability */
-	for (i = 0; i < nfp_eth_table->count; i++) {
-		id = nfp_function_id_get(pf_dev, i);
-		ret = nfp_net_speed_capa_get(pf_dev, id);
-		if (ret != 0) {
-			PMD_INIT_LOG(ERR, "Failed to get speed capability.");
-			ret = -EIO;
-			goto sym_tbl_cleanup;
-		}
+	ret = nfp_net_speed_cap_get(pf_dev);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to get speed capability.");
+		ret = -EIO;
+		goto sym_tbl_cleanup;
 	}
 
 	/* Configure access to tx/rx vNIC BARs */
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 06/23] net/nfp: make the logic simpler by adding local variable
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (4 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 05/23] net/nfp: fix repeat set the speed configure Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 07/23] net/nfp: rename the variable name Chaoyong He
                   ` (17 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

The original function has long chain of pointer deference statements,
make the logic simpler by adding a local variable 'pf_dev'.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_representor.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 7f12a9dcaa..633e5d9eb6 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -791,6 +791,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	int i;
 	int ret;
 	const char *pci_name;
+	struct nfp_pf_dev *pf_dev;
 	struct rte_pci_device *pci_dev;
 	struct nfp_repr_init repr_init;
 	struct nfp_eth_table *nfp_eth_table;
@@ -800,7 +801,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 		.app_fw_flower    = app_fw_flower,
 	};
 
-	nfp_eth_table = hw_priv->pf_dev->nfp_eth_table;
+	pf_dev = hw_priv->pf_dev;
+	nfp_eth_table = pf_dev->nfp_eth_table;
 	repr_init.hw_priv = hw_priv;
 
 	/* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */
@@ -816,7 +818,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	/* PF vNIC reprs get a random MAC address */
 	rte_eth_random_addr(flower_repr.mac_addr.addr_bytes);
 
-	pci_dev = hw_priv->pf_dev->pci_dev;
+	pci_dev = pf_dev->pci_dev;
 
 	pci_name = strchr(pci_dev->name, ':') + 1;
 
@@ -868,7 +870,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	 */
 	for (i = 0; i < app_fw_flower->num_vf_reprs; i++) {
 		flower_repr.repr_type = NFP_REPR_TYPE_VF;
-		flower_repr.port_id = nfp_get_pcie_port_id(hw_priv->pf_dev->cpp,
+		flower_repr.port_id = nfp_get_pcie_port_id(pf_dev->cpp,
 				NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i, 0);
 		flower_repr.nfp_idx = 0;
 		flower_repr.vf_id = i;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 07/23] net/nfp: rename the variable name
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (5 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 06/23] net/nfp: make the logic simpler by adding local variable Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 08/23] net/nfp: export function ID get interface Chaoyong He
                   ` (16 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

In multiple PF case, add 'pci_name' as part of the
variable name to distinguish different PFs.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_flow.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index fad65c1785..d8feff634a 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -5138,11 +5138,15 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	char flow_name[RTE_HASH_NAMESIZE];
 	char pretun_name[RTE_HASH_NAMESIZE];
 	struct nfp_app_fw_flower *app_fw_flower;
+	char ct_map_table_name[RTE_HASH_NAMESIZE];
+	char ct_zone_table_name[RTE_HASH_NAMESIZE];
 	const char *pci_name = strchr(pf_dev->pci_dev->name, ':') + 1;
 
 	snprintf(mask_name, sizeof(mask_name), "%s_mask", pci_name);
 	snprintf(flow_name, sizeof(flow_name), "%s_flow", pci_name);
 	snprintf(pretun_name, sizeof(pretun_name), "%s_pretun", pci_name);
+	snprintf(ct_map_table_name, sizeof(ct_map_table_name), "%s_ct_map_table", pci_name);
+	snprintf(ct_zone_table_name, sizeof(ct_zone_table_name), "%s_ct_zone_table", pci_name);
 
 	struct rte_hash_parameters mask_hash_params = {
 		.name       = mask_name,
@@ -5171,7 +5175,7 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	};
 
 	struct rte_hash_parameters ct_zone_hash_params = {
-		.name       = "ct_zone_table",
+		.name       = ct_zone_table_name,
 		.entries    = 65536,
 		.hash_func  = rte_jhash,
 		.socket_id  = rte_socket_id(),
@@ -5180,7 +5184,7 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	};
 
 	struct rte_hash_parameters ct_map_hash_params = {
-		.name       = "ct_map_table",
+		.name       = ct_map_table_name,
 		.hash_func  = rte_jhash,
 		.socket_id  = rte_socket_id(),
 		.key_len    = sizeof(uint32_t),
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 08/23] net/nfp: export function ID get interface
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (6 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 07/23] net/nfp: rename the variable name Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 09/23] net/nfp: extract total phyports Chaoyong He
                   ` (15 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Export the function ID get interface, and adjust the logic
to make it also valid for the flower firmware with multi-PF.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c             | 11 +++++++++--
 drivers/net/nfp/flower/nfp_flower_cmsg.c        | 10 ++++++----
 drivers/net/nfp/flower/nfp_flower_cmsg.h        |  2 +-
 drivers/net/nfp/flower/nfp_flower_representor.c | 14 ++++++++++----
 drivers/net/nfp/nfp_ethdev.c                    | 10 ----------
 drivers/net/nfp/nfp_net_common.c                | 10 ++++++++++
 drivers/net/nfp/nfp_net_common.h                |  2 ++
 7 files changed, 38 insertions(+), 21 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 5caaf9d745..70135574d4 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -647,14 +647,18 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 {
 	int ret;
 	int err;
+	uint8_t id;
 	uint64_t ext_features;
 	unsigned int numa_node;
 	struct nfp_net_hw *pf_hw;
 	struct nfp_net_hw *ctrl_hw;
+	char bar_name[RTE_ETH_NAME_MAX_LEN];
+	char ctrl_name[RTE_ETH_NAME_MAX_LEN];
 	struct nfp_app_fw_flower *app_fw_flower;
 	struct nfp_pf_dev *pf_dev = hw_priv->pf_dev;
 
 	numa_node = rte_socket_id();
+	id = nfp_function_id_get(pf_dev, 0);
 
 	/* Allocate memory for the Flower app */
 	app_fw_flower = rte_zmalloc_socket("nfp_app_fw_flower", sizeof(*app_fw_flower),
@@ -688,7 +692,8 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 	}
 
 	/* Map the PF ctrl bar */
-	pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, "_pf0_net_bar0",
+	snprintf(bar_name, sizeof(bar_name), "_pf%u_net_bar0", id);
+	pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, bar_name,
 			NFP_NET_CFG_BAR_SZ, &pf_dev->ctrl_area);
 	if (pf_dev->ctrl_bar == NULL) {
 		PMD_INIT_LOG(ERR, "Cloud not map the PF vNIC ctrl bar");
@@ -711,6 +716,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 	/* Fill in the PF vNIC and populate app struct */
 	app_fw_flower->pf_hw = pf_hw;
 	pf_hw->super.ctrl_bar = pf_dev->ctrl_bar;
+	pf_hw->nfp_idx = pf_dev->nfp_eth_table->ports[id].index;
 
 	ret = nfp_flower_init_vnic_common(hw_priv, pf_hw, "pf_vnic");
 	if (ret != 0) {
@@ -725,7 +731,8 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 	ctrl_hw = app_fw_flower->ctrl_hw;
 
 	/* Map the ctrl vNIC ctrl bar */
-	ctrl_hw->super.ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, "_pf0_net_ctrl_bar",
+	snprintf(ctrl_name, sizeof(ctrl_name), "_pf%u_net_ctrl_bar", id);
+	ctrl_hw->super.ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, ctrl_name,
 			NFP_NET_CFG_BAR_SZ, &ctrl_hw->ctrl_area);
 	if (ctrl_hw->super.ctrl_bar == NULL) {
 		PMD_INIT_LOG(ERR, "Cloud not map the ctrl vNIC ctrl bar");
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.c b/drivers/net/nfp/flower/nfp_flower_cmsg.c
index 2a0e9afe90..9a5b5f52b8 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.c
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.c
@@ -82,9 +82,10 @@ nfp_flower_cmsg_mac_repr_fill(struct rte_mbuf *m,
 
 int
 nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower,
-		struct nfp_eth_table *nfp_eth_table)
+		struct nfp_pf_dev *pf_dev)
 {
 	uint8_t i;
+	uint8_t id;
 	uint16_t cnt;
 	uint32_t nbi;
 	uint32_t nbi_port;
@@ -101,9 +102,10 @@ nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower,
 
 	/* Fill in the mac repr cmsg */
 	for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) {
-		nbi = nfp_eth_table->ports[i].nbi;
-		nbi_port = nfp_eth_table->ports[i].base;
-		phys_port = nfp_eth_table->ports[i].index;
+		id = nfp_function_id_get(pf_dev, i);
+		nbi = pf_dev->nfp_eth_table->ports[id].nbi;
+		nbi_port =  pf_dev->nfp_eth_table->ports[id].base;
+		phys_port =  pf_dev->nfp_eth_table->ports[id].index;
 
 		nfp_flower_cmsg_mac_repr_fill(mbuf, i, nbi, nbi_port, phys_port);
 	}
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h
index afaf733ef7..bb03234035 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.h
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h
@@ -976,7 +976,7 @@ struct nfp_fl_act_mark {
 };
 
 int nfp_flower_cmsg_mac_repr(struct nfp_app_fw_flower *app_fw_flower,
-		struct nfp_eth_table *nfp_eth_table);
+		struct nfp_pf_dev *pf_dev);
 int nfp_flower_cmsg_repr_reify(struct nfp_app_fw_flower *app_fw_flower,
 		struct nfp_flower_representor *repr);
 int nfp_flower_cmsg_port_mod(struct nfp_app_fw_flower *app_fw_flower,
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 633e5d9eb6..1f34c4c263 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -790,6 +790,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 {
 	int i;
 	int ret;
+	uint8_t id;
 	const char *pci_name;
 	struct nfp_pf_dev *pf_dev;
 	struct rte_pci_device *pci_dev;
@@ -806,7 +807,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	repr_init.hw_priv = hw_priv;
 
 	/* Send a NFP_FLOWER_CMSG_TYPE_MAC_REPR cmsg to hardware */
-	ret = nfp_flower_cmsg_mac_repr(app_fw_flower, nfp_eth_table);
+	ret = nfp_flower_cmsg_mac_repr(app_fw_flower, pf_dev);
 	if (ret != 0) {
 		PMD_INIT_LOG(ERR, "Cloud not send mac repr cmsgs");
 		return ret;
@@ -822,7 +823,11 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 
 	pci_name = strchr(pci_dev->name, ':') + 1;
 
-	snprintf(flower_repr.name, sizeof(flower_repr.name),
+	if (pf_dev->multi_pf.enabled)
+		snprintf(flower_repr.name, sizeof(flower_repr.name),
+			"%s_repr_pf%d", pci_name, pf_dev->multi_pf.function_id);
+	else
+		snprintf(flower_repr.name, sizeof(flower_repr.name),
 			"%s_repr_pf", pci_name);
 
 	/* Create a eth_dev for this representor */
@@ -836,7 +841,8 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 
 	/* Create a rte_eth_dev for every phyport representor */
 	for (i = 0; i < app_fw_flower->num_phyport_reprs; i++) {
-		eth_port = &nfp_eth_table->ports[i];
+		id = nfp_function_id_get(pf_dev, i);
+		eth_port = &nfp_eth_table->ports[id];
 		flower_repr.repr_type = NFP_REPR_TYPE_PHYS_PORT;
 		flower_repr.port_id = nfp_flower_get_phys_port_id(eth_port->index);
 		flower_repr.nfp_idx = eth_port->eth_index;
@@ -845,7 +851,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 		/* Copy the real mac of the interface to the representor struct */
 		rte_ether_addr_copy(&eth_port->mac_addr, &flower_repr.mac_addr);
 		snprintf(flower_repr.name, sizeof(flower_repr.name),
-				"%s_repr_p%d", pci_name, i);
+				"%s_repr_p%d", pci_name, id);
 
 		/*
 		 * Create a eth_dev for this representor.
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 2c1300350c..469fa4602e 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -497,16 +497,6 @@ nfp_net_set_link_down(struct rte_eth_dev *dev)
 	return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
 }
 
-static uint8_t
-nfp_function_id_get(const struct nfp_pf_dev *pf_dev,
-		uint8_t phy_port)
-{
-	if (pf_dev->multi_pf.enabled)
-		return pf_dev->multi_pf.function_id;
-
-	return phy_port;
-}
-
 static void
 nfp_net_beat_timer(void *arg)
 {
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index d8b7045c3a..0bfe7a514c 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2564,3 +2564,13 @@ nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
 	else
 		return nfp_eth_table->count;
 }
+
+uint8_t
+nfp_function_id_get(const struct nfp_pf_dev *pf_dev,
+		uint8_t port_id)
+{
+	if (pf_dev->multi_pf.enabled)
+		return pf_dev->multi_pf.function_id;
+
+	return port_id;
+}
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 4016652cf9..cbf96e5ab5 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -328,6 +328,8 @@ int nfp_net_txrwb_alloc(struct rte_eth_dev *eth_dev);
 void nfp_net_txrwb_free(struct rte_eth_dev *eth_dev);
 uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
 		struct nfp_eth_table *nfp_eth_table);
+uint8_t nfp_function_id_get(const struct nfp_pf_dev *pf_dev,
+		uint8_t port_id);
 
 #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\
 	((struct nfp_app_fw_nic *)app_fw_priv)
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 09/23] net/nfp: extract total phyports
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (7 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 08/23] net/nfp: export function ID get interface Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 10/23] net/nfp: extract the initialize helper function Chaoyong He
                   ` (14 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Extract the 'total_phyports' data field into the 'pf_dev' structure, make
it also valid for the flower firmware.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 .../net/nfp/flower/nfp_flower_representor.c   |  8 +-
 drivers/net/nfp/nfp_ethdev.c                  | 75 +++++++++++--------
 drivers/net/nfp/nfp_net_common.h              |  3 +-
 3 files changed, 49 insertions(+), 37 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 1f34c4c263..a845253b01 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -917,7 +917,6 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower,
 	int ret;
 	struct nfp_pf_dev *pf_dev;
 	struct rte_pci_device *pci_dev;
-	struct nfp_eth_table *nfp_eth_table;
 	struct rte_eth_devargs eth_da = {
 		.nb_representor_ports = 0
 	};
@@ -945,8 +944,7 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower,
 	}
 
 	/* There always exist phy repr */
-	nfp_eth_table = pf_dev->nfp_eth_table;
-	if (eth_da.nb_representor_ports < nfp_eth_table->count + 1) {
+	if (eth_da.nb_representor_ports < pf_dev->total_phyports + 1) {
 		PMD_INIT_LOG(ERR, "Should also create repr port for phy port and PF vNIC.");
 		return -ERANGE;
 	}
@@ -958,9 +956,9 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower,
 	}
 
 	/* Fill in flower app with repr counts */
-	app_fw_flower->num_phyport_reprs = (uint8_t)nfp_eth_table->count;
+	app_fw_flower->num_phyport_reprs = pf_dev->total_phyports;
 	app_fw_flower->num_vf_reprs = eth_da.nb_representor_ports -
-			nfp_eth_table->count - 1;
+			pf_dev->total_phyports - 1;
 
 	PMD_INIT_LOG(INFO, "%d number of VF reprs", app_fw_flower->num_vf_reprs);
 	PMD_INIT_LOG(INFO, "%d number of phyport reprs", app_fw_flower->num_phyport_reprs);
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 469fa4602e..06811c7673 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -724,7 +724,7 @@ nfp_net_close(struct rte_eth_dev *dev)
 
 	nfp_cleanup_port_app_fw_nic(pf_dev, hw->idx, dev);
 
-	for (i = 0; i < app_fw_nic->total_phyports; i++) {
+	for (i = 0; i < pf_dev->total_phyports; i++) {
 		id = nfp_function_id_get(pf_dev, i);
 
 		/* Check to see if ports are still in use */
@@ -1492,18 +1492,52 @@ nfp_enable_multi_pf(struct nfp_pf_dev *pf_dev)
 	return err;
 }
 
+static bool
+nfp_app_fw_nic_total_phyports_check(struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+	uint8_t id;
+	uint8_t total_phyports;
+	char vnic_name[RTE_ETH_NAME_MAX_LEN];
+
+	/* Read the number of vNIC's created for the PF */
+	id = nfp_function_id_get(pf_dev, 0);
+	snprintf(vnic_name, sizeof(vnic_name), "nfd_cfg_pf%u_num_ports", id);
+	total_phyports = nfp_rtsym_read_le(pf_dev->sym_tbl, vnic_name, &ret);
+	if (ret != 0 || total_phyports == 0 || total_phyports > 8) {
+		PMD_INIT_LOG(ERR, "%s symbol with wrong value", vnic_name);
+		return false;
+	}
+
+	if (pf_dev->multi_pf.enabled) {
+		if (!nfp_check_multi_pf_from_fw(total_phyports)) {
+			PMD_INIT_LOG(ERR, "NSP report multipf, but FW report not multipf");
+			return false;
+		}
+	} else {
+		/*
+		 * For single PF the number of vNICs exposed should be the same as the
+		 * number of physical ports.
+		 */
+		if (total_phyports != pf_dev->nfp_eth_table->count) {
+			PMD_INIT_LOG(ERR, "Total physical ports do not match number of vNICs");
+			return false;
+		}
+	}
+
+	return true;
+}
+
 static int
 nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv)
 {
 	uint8_t i;
 	uint8_t id;
 	int ret = 0;
-	uint32_t total_vnics;
 	struct nfp_app_fw_nic *app_fw_nic;
 	struct nfp_eth_table *nfp_eth_table;
 	char bar_name[RTE_ETH_NAME_MAX_LEN];
 	char port_name[RTE_ETH_NAME_MAX_LEN];
-	char vnic_name[RTE_ETH_NAME_MAX_LEN];
 	struct nfp_pf_dev *pf_dev = hw_priv->pf_dev;
 	struct nfp_net_init hw_init = {
 		.hw_priv = hw_priv,
@@ -1521,42 +1555,20 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv)
 	/* Point the app_fw_priv pointer in the PF to the coreNIC app */
 	pf_dev->app_fw_priv = app_fw_nic;
 
-	/* Read the number of vNIC's created for the PF */
-	snprintf(vnic_name, sizeof(vnic_name), "nfd_cfg_pf%u_num_ports", id);
-	total_vnics = nfp_rtsym_read_le(pf_dev->sym_tbl, vnic_name, &ret);
-	if (ret != 0 || total_vnics == 0 || total_vnics > 8) {
-		PMD_INIT_LOG(ERR, "%s symbol with wrong value", vnic_name);
+	/* Check the number of vNIC's created for the PF */
+	if (!nfp_app_fw_nic_total_phyports_check(pf_dev)) {
 		ret = -ENODEV;
 		goto app_cleanup;
 	}
 
-	if (pf_dev->multi_pf.enabled) {
-		if (!nfp_check_multi_pf_from_fw(total_vnics)) {
-			PMD_INIT_LOG(ERR, "NSP report multipf, but FW report not multipf");
-			ret = -ENODEV;
-			goto app_cleanup;
-		}
-	} else {
-		/*
-		 * For coreNIC the number of vNICs exposed should be the same as the
-		 * number of physical ports.
-		 */
-		if (total_vnics != nfp_eth_table->count) {
-			PMD_INIT_LOG(ERR, "Total physical ports do not match number of vNICs");
-			ret = -ENODEV;
-			goto app_cleanup;
-		}
-	}
-
 	/* Populate coreNIC app properties */
-	app_fw_nic->total_phyports = total_vnics;
-	if (total_vnics > 1)
+	if (pf_dev->total_phyports > 1)
 		app_fw_nic->multiport = true;
 
 	/* Map the symbol table */
 	snprintf(bar_name, sizeof(bar_name), "_pf%u_net_bar0", id);
 	pf_dev->ctrl_bar = nfp_rtsym_map(pf_dev->sym_tbl, bar_name,
-			app_fw_nic->total_phyports * NFP_NET_CFG_BAR_SZ,
+			pf_dev->total_phyports * NFP_NET_CFG_BAR_SZ,
 			&pf_dev->ctrl_area);
 	if (pf_dev->ctrl_bar == NULL) {
 		PMD_INIT_LOG(ERR, "nfp_rtsym_map fails for %s", bar_name);
@@ -1567,7 +1579,7 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv)
 	PMD_INIT_LOG(DEBUG, "ctrl bar: %p", pf_dev->ctrl_bar);
 
 	/* Loop through all physical ports on PF */
-	for (i = 0; i < app_fw_nic->total_phyports; i++) {
+	for (i = 0; i < pf_dev->total_phyports; i++) {
 		if (pf_dev->multi_pf.enabled)
 			snprintf(port_name, sizeof(port_name), "%s",
 					pf_dev->pci_dev->device.name);
@@ -1589,7 +1601,7 @@ nfp_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv)
 	return 0;
 
 port_cleanup:
-	for (i = 0; i < app_fw_nic->total_phyports; i++) {
+	for (i = 0; i < pf_dev->total_phyports; i++) {
 		struct rte_eth_dev *eth_dev;
 
 		if (pf_dev->multi_pf.enabled)
@@ -1961,6 +1973,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	pf_dev->pci_dev = pci_dev;
 	pf_dev->nfp_eth_table = nfp_eth_table;
 	pf_dev->sync = sync;
+	pf_dev->total_phyports = nfp_net_get_port_num(pf_dev, nfp_eth_table);
 
 	ret = nfp_net_speed_cap_get(pf_dev);
 	if (ret != 0) {
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index cbf96e5ab5..5c48b94d38 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -140,6 +140,8 @@ struct nfp_pf_dev {
 
 	/** NFP devarg param */
 	struct nfp_devargs devargs;
+
+	uint8_t total_phyports;
 };
 
 #define NFP_NET_FLOW_LIMIT    1024
@@ -159,7 +161,6 @@ struct nfp_app_fw_nic {
 	struct nfp_net_hw *ports[NFP_MAX_PHYPORTS];
 
 	bool multiport;
-	uint8_t total_phyports;
 };
 
 struct nfp_net_hw_priv {
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 10/23] net/nfp: extract the initialize helper function
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (8 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 09/23] net/nfp: extract total phyports Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 11/23] net/nfp: get the VF configuration Chaoyong He
                   ` (13 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Extract the helper function of the firmware application initialization
for both primary and secondary process.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 122 ++++++++++++++++++++++-------------
 1 file changed, 76 insertions(+), 46 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 06811c7673..177e5d1e06 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1820,6 +1820,44 @@ nfp_net_force_port_down(struct nfp_pf_dev *pf_dev,
 	return 0;
 }
 
+static int
+nfp_fw_app_primary_init(struct nfp_net_hw_priv *hw_priv)
+{
+	int ret;
+	struct nfp_pf_dev *pf_dev = hw_priv->pf_dev;
+
+	switch (pf_dev->app_fw_id) {
+	case NFP_APP_FW_CORE_NIC:
+		if (pf_dev->multi_pf.enabled) {
+			ret = nfp_enable_multi_pf(pf_dev);
+			if (ret != 0)
+				return ret;
+		}
+
+		PMD_INIT_LOG(INFO, "Initializing coreNIC");
+		ret = nfp_init_app_fw_nic(hw_priv);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Could not initialize coreNIC!");
+			return ret;
+		}
+		break;
+	case NFP_APP_FW_FLOWER_NIC:
+		PMD_INIT_LOG(INFO, "Initializing Flower");
+		ret = nfp_init_app_fw_flower(hw_priv);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Could not initialize Flower!");
+			return ret;
+		}
+		break;
+	default:
+		PMD_INIT_LOG(ERR, "Unsupported Firmware loaded");
+		ret = -EINVAL;
+		return ret;
+	}
+
+	return 0;
+}
+
 static int
 nfp_pf_init(struct rte_pci_device *pci_dev)
 {
@@ -2011,32 +2049,9 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	 * PF initialization has been done at this point. Call app specific
 	 * init code now.
 	 */
-	switch (pf_dev->app_fw_id) {
-	case NFP_APP_FW_CORE_NIC:
-		if (pf_dev->multi_pf.enabled) {
-			ret = nfp_enable_multi_pf(pf_dev);
-			if (ret != 0)
-				goto mac_stats_cleanup;
-		}
-
-		PMD_INIT_LOG(INFO, "Initializing coreNIC");
-		ret = nfp_init_app_fw_nic(hw_priv);
-		if (ret != 0) {
-			PMD_INIT_LOG(ERR, "Could not initialize coreNIC!");
-			goto mac_stats_cleanup;
-		}
-		break;
-	case NFP_APP_FW_FLOWER_NIC:
-		PMD_INIT_LOG(INFO, "Initializing Flower");
-		ret = nfp_init_app_fw_flower(hw_priv);
-		if (ret != 0) {
-			PMD_INIT_LOG(ERR, "Could not initialize Flower!");
-			goto mac_stats_cleanup;
-		}
-		break;
-	default:
-		PMD_INIT_LOG(ERR, "Unsupported Firmware loaded");
-		ret = -EINVAL;
+	ret = nfp_fw_app_primary_init(hw_priv);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init hw app primary.");
 		goto mac_stats_cleanup;
 	}
 
@@ -2135,6 +2150,38 @@ nfp_secondary_init_app_fw_nic(struct nfp_net_hw_priv *hw_priv)
 	return ret;
 }
 
+static int
+nfp_fw_app_secondary_init(struct nfp_net_hw_priv *hw_priv)
+{
+	int ret;
+	struct nfp_pf_dev *pf_dev = hw_priv->pf_dev;
+
+	switch (pf_dev->app_fw_id) {
+	case NFP_APP_FW_CORE_NIC:
+		PMD_INIT_LOG(INFO, "Initializing coreNIC");
+		ret = nfp_secondary_init_app_fw_nic(hw_priv);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Could not initialize coreNIC!");
+			return ret;
+		}
+		break;
+	case NFP_APP_FW_FLOWER_NIC:
+		PMD_INIT_LOG(INFO, "Initializing Flower");
+		ret = nfp_secondary_init_app_fw_flower(hw_priv);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Could not initialize Flower!");
+			return ret;
+		}
+		break;
+	default:
+		PMD_INIT_LOG(ERR, "Unsupported Firmware loaded");
+		ret = -EINVAL;
+		return ret;
+	}
+
+	return 0;
+}
+
 /*
  * When attaching to the NFP4000/6000 PF on a secondary process there
  * is no need to initialise the PF again. Only minimal work is required
@@ -2241,26 +2288,9 @@ nfp_pf_secondary_init(struct rte_pci_device *pci_dev)
 	hw_priv->dev_info = dev_info;
 
 	/* Call app specific init code now */
-	switch (app_fw_id) {
-	case NFP_APP_FW_CORE_NIC:
-		PMD_INIT_LOG(INFO, "Initializing coreNIC");
-		ret = nfp_secondary_init_app_fw_nic(hw_priv);
-		if (ret != 0) {
-			PMD_INIT_LOG(ERR, "Could not initialize coreNIC!");
-			goto sym_tbl_cleanup;
-		}
-		break;
-	case NFP_APP_FW_FLOWER_NIC:
-		PMD_INIT_LOG(INFO, "Initializing Flower");
-		ret = nfp_secondary_init_app_fw_flower(hw_priv);
-		if (ret != 0) {
-			PMD_INIT_LOG(ERR, "Could not initialize Flower!");
-			goto sym_tbl_cleanup;
-		}
-		break;
-	default:
-		PMD_INIT_LOG(ERR, "Unsupported Firmware loaded");
-		ret = -EINVAL;
+	ret = nfp_fw_app_secondary_init(hw_priv);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init hw app primary.");
 		goto sym_tbl_cleanup;
 	}
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 11/23] net/nfp: get the VF configuration
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (9 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 10/23] net/nfp: extract the initialize helper function Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 12/23] net/nfp: refactor the logic of flower service Chaoyong He
                   ` (12 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Add the data field and related logic to get the VF configuration
from firmware and store them.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c     | 106 +++++++++++++++++++++++++++++++
 drivers/net/nfp/nfp_net_common.h |   5 ++
 2 files changed, 111 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 177e5d1e06..e67ff3a0a0 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -10,6 +10,7 @@
 #include <eal_firmware.h>
 #include <rte_alarm.h>
 #include <rte_kvargs.h>
+#include <rte_pci.h>
 
 #include "flower/nfp_flower.h"
 #include "nfd3/nfp_nfd3.h"
@@ -1858,6 +1859,103 @@ nfp_fw_app_primary_init(struct nfp_net_hw_priv *hw_priv)
 	return 0;
 }
 
+static int
+nfp_pf_get_max_vf(struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+	uint32_t max_vfs;
+
+	max_vfs = nfp_rtsym_read_le(pf_dev->sym_tbl, "nfd_vf_cfg_max_vfs", &ret);
+	if (ret != 0)
+		return ret;
+
+	pf_dev->max_vfs = max_vfs;
+
+	return 0;
+}
+
+static int
+nfp_pf_get_sriov_vf(struct nfp_pf_dev *pf_dev,
+		const struct nfp_dev_info *dev_info)
+{
+	int ret;
+	off_t pos;
+	uint16_t offset;
+	uint16_t sriov_vf;
+
+	/* For 3800 single-PF and 4000 card */
+	if (!pf_dev->multi_pf.enabled) {
+		pf_dev->sriov_vf = pf_dev->max_vfs;
+		return 0;
+	}
+
+	pos = rte_pci_find_ext_capability(pf_dev->pci_dev, RTE_PCI_EXT_CAP_ID_SRIOV);
+	if (pos == 0) {
+		PMD_INIT_LOG(ERR, "Can not get the pci sriov cap");
+		return -EIO;
+	}
+
+	/*
+	 * Management firmware ensures that sriov capability registers
+	 * are initialized correctly.
+	 */
+	ret = rte_pci_read_config(pf_dev->pci_dev, &sriov_vf, sizeof(sriov_vf),
+			pos + RTE_PCI_SRIOV_TOTAL_VF);
+	if (ret < 0) {
+		PMD_INIT_LOG(ERR, "Can not read the sriov toatl VF");
+		return -EIO;
+	}
+
+	/* Offset of first VF is relative to its PF. */
+	ret = rte_pci_read_config(pf_dev->pci_dev, &offset, sizeof(offset),
+			pos + RTE_PCI_SRIOV_VF_OFFSET);
+	if (ret < 0) {
+		PMD_INIT_LOG(ERR, "Can not get the VF offset");
+		return -EIO;
+	}
+
+	offset += pf_dev->multi_pf.function_id;
+	if (offset < dev_info->pf_num_per_unit)
+		return -ERANGE;
+
+	offset -= dev_info->pf_num_per_unit;
+	if (offset >= pf_dev->max_vfs || offset + sriov_vf > pf_dev->max_vfs) {
+		PMD_INIT_LOG(ERR, "The pci allocate VF is more than the MAX VF");
+		return -ERANGE;
+	}
+
+	pf_dev->sriov_vf = sriov_vf;
+
+	return 0;
+}
+
+static int
+nfp_net_get_vf_info(struct nfp_pf_dev *pf_dev,
+		const struct nfp_dev_info *dev_info)
+{
+	int ret;
+
+	ret = nfp_pf_get_max_vf(pf_dev);
+	if (ret != 0) {
+		if (ret != -ENOENT) {
+			PMD_INIT_LOG(ERR, "Read max VFs failed");
+			return ret;
+		}
+
+		PMD_INIT_LOG(WARNING, "The firmware can not support read max VFs");
+		return 0;
+	}
+
+	if (pf_dev->max_vfs == 0)
+		return 0;
+
+	ret = nfp_pf_get_sriov_vf(pf_dev, dev_info);
+	if (ret < 0)
+		return ret;
+
+	return 0;
+}
+
 static int
 nfp_pf_init(struct rte_pci_device *pci_dev)
 {
@@ -2020,6 +2118,14 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto sym_tbl_cleanup;
 	}
 
+	/* Get the VF info */
+	ret = nfp_net_get_vf_info(pf_dev, dev_info);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to get VF info.");
+		ret = -EIO;
+		goto sym_tbl_cleanup;
+	}
+
 	/* Configure access to tx/rx vNIC BARs */
 	addr = nfp_qcp_queue_offset(dev_info, 0);
 	cpp_id = NFP_CPP_ISLAND_ID(0, NFP_CPP_ACTION_RW, 0, 0);
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 5c48b94d38..7efd0161af 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -141,6 +141,11 @@ struct nfp_pf_dev {
 	/** NFP devarg param */
 	struct nfp_devargs devargs;
 
+	/** Number of VFs supported by firmware shared by all PFs */
+	uint16_t max_vfs;
+	/** Number of VFs supported by firmware for this PF */
+	uint16_t sriov_vf;
+
 	uint8_t total_phyports;
 };
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 12/23] net/nfp: refactor the logic of flower service
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (10 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 11/23] net/nfp: get the VF configuration Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 13/23] net/nfp: get the first VF ID of the PF Chaoyong He
                   ` (11 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

For flower firmware with multi-PF, the flower service needs to get
some information beyond the 'struct nfp_app_fw_flower', so refactor
the logic to use 'struct nfp_net_hw_priv' instead.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c           |  4 ++--
 drivers/net/nfp/flower/nfp_flower_ctrl.c      | 16 +++++++++----
 drivers/net/nfp/flower/nfp_flower_ctrl.h      |  2 +-
 .../net/nfp/flower/nfp_flower_representor.c   |  2 +-
 drivers/net/nfp/flower/nfp_flower_service.c   | 24 +++++++++----------
 drivers/net/nfp/flower/nfp_flower_service.h   |  4 ++--
 6 files changed, 28 insertions(+), 24 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 70135574d4..87bd9dda2e 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -754,7 +754,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 	}
 
 	/* Start up flower services */
-	ret = nfp_flower_service_start(app_fw_flower, hw_priv);
+	ret = nfp_flower_service_start(hw_priv);
 	if (ret != 0) {
 		PMD_INIT_LOG(ERR, "Could not enable flower services");
 		ret = -ESRCH;
@@ -770,7 +770,7 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 	return 0;
 
 ctrl_vnic_service_stop:
-	nfp_flower_service_stop(app_fw_flower, hw_priv);
+	nfp_flower_service_stop(hw_priv);
 ctrl_vnic_cleanup:
 	nfp_flower_cleanup_ctrl_vnic(app_fw_flower, hw_priv);
 ctrl_cpp_area_cleanup:
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 8cfafe91c8..01a680eb6d 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -415,13 +415,15 @@ nfp_flower_cmsg_rx_qos_stats(struct nfp_mtr_priv *mtr_priv,
 }
 
 static int
-nfp_flower_cmsg_port_mod_rx(struct nfp_app_fw_flower *app_fw_flower,
+nfp_flower_cmsg_port_mod_rx(struct nfp_net_hw_priv *hw_priv,
 		struct rte_mbuf *pkt_burst)
 {
 	uint32_t port;
 	struct nfp_flower_representor *repr;
 	struct nfp_flower_cmsg_port_mod *msg;
+	struct nfp_app_fw_flower *app_fw_flower;
 
+	app_fw_flower = hw_priv->pf_dev->app_fw_priv;
 	msg = rte_pktmbuf_mtod_offset(pkt_burst, struct nfp_flower_cmsg_port_mod *,
 			NFP_FLOWER_CMSG_HLEN);
 	port = rte_be_to_cpu_32(msg->portnum);
@@ -456,7 +458,7 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_app_fw_flower *app_fw_flower,
 }
 
 static void
-nfp_flower_cmsg_rx(struct nfp_app_fw_flower *app_fw_flower,
+nfp_flower_cmsg_rx(struct nfp_net_hw_priv *hw_priv,
 		struct rte_mbuf **pkts_burst,
 		uint16_t count)
 {
@@ -467,7 +469,9 @@ nfp_flower_cmsg_rx(struct nfp_app_fw_flower *app_fw_flower,
 	struct nfp_mtr_priv *mtr_priv;
 	struct nfp_flow_priv *flow_priv;
 	struct nfp_flower_cmsg_hdr *cmsg_hdr;
+	struct nfp_app_fw_flower *app_fw_flower;
 
+	app_fw_flower = hw_priv->pf_dev->app_fw_priv;
 	mtr_priv = app_fw_flower->mtr_priv;
 	flow_priv = app_fw_flower->flow_priv;
 
@@ -499,7 +503,7 @@ nfp_flower_cmsg_rx(struct nfp_app_fw_flower *app_fw_flower,
 			nfp_flower_cmsg_rx_qos_stats(mtr_priv, pkts_burst[i]);
 		} else if (cmsg_hdr->type == NFP_FLOWER_CMSG_TYPE_PORT_MOD) {
 			/* Handle changes to port configuration/status */
-			nfp_flower_cmsg_port_mod_rx(app_fw_flower, pkts_burst[i]);
+			nfp_flower_cmsg_port_mod_rx(hw_priv, pkts_burst[i]);
 		}
 
 		rte_pktmbuf_free(pkts_burst[i]);
@@ -507,13 +511,15 @@ nfp_flower_cmsg_rx(struct nfp_app_fw_flower *app_fw_flower,
 }
 
 void
-nfp_flower_ctrl_vnic_process(struct nfp_app_fw_flower *app_fw_flower)
+nfp_flower_ctrl_vnic_process(struct nfp_net_hw_priv *hw_priv)
 {
 	uint16_t count;
 	struct nfp_net_rxq *rxq;
 	struct rte_eth_dev *ctrl_eth_dev;
+	struct nfp_app_fw_flower *app_fw_flower;
 	struct rte_mbuf *pkts_burst[MAX_PKT_BURST];
 
+	app_fw_flower = hw_priv->pf_dev->app_fw_priv;
 	ctrl_eth_dev = app_fw_flower->ctrl_ethdev;
 
 	/* Ctrl vNIC only has a single Rx queue */
@@ -522,6 +528,6 @@ nfp_flower_ctrl_vnic_process(struct nfp_app_fw_flower *app_fw_flower)
 	if (count != 0) {
 		app_fw_flower->ctrl_vnic_rx_count += count;
 		/* Process cmsgs here */
-		nfp_flower_cmsg_rx(app_fw_flower, pkts_burst, count);
+		nfp_flower_cmsg_rx(hw_priv, pkts_burst, count);
 	}
 }
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.h b/drivers/net/nfp/flower/nfp_flower_ctrl.h
index 131d002ac6..b5d0036c01 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.h
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.h
@@ -8,7 +8,7 @@
 
 #include "nfp_flower.h"
 
-void nfp_flower_ctrl_vnic_process(struct nfp_app_fw_flower *app_fw_flower);
+void nfp_flower_ctrl_vnic_process(struct nfp_net_hw_priv *hw_priv);
 uint16_t nfp_flower_ctrl_vnic_xmit(struct nfp_app_fw_flower *app_fw_flower,
 		struct rte_mbuf *mbuf);
 void nfp_flower_ctrl_vnic_xmit_register(struct nfp_app_fw_flower *app_fw_flower);
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index a845253b01..59dc5854b5 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -460,7 +460,7 @@ nfp_flower_repr_dev_close(struct rte_eth_dev *dev)
 		return 0;
 
 	/* Stop flower service first */
-	nfp_flower_service_stop(app_fw_flower, hw_priv);
+	nfp_flower_service_stop(hw_priv);
 
 	/* Now it is safe to free all PF resources */
 	nfp_uninit_app_fw_flower(hw_priv);
diff --git a/drivers/net/nfp/flower/nfp_flower_service.c b/drivers/net/nfp/flower/nfp_flower_service.c
index 64753f5bf6..6353015c66 100644
--- a/drivers/net/nfp/flower/nfp_flower_service.c
+++ b/drivers/net/nfp/flower/nfp_flower_service.c
@@ -22,7 +22,7 @@ struct nfp_flower_service {
 	/** Flower service info */
 	struct nfp_service_info info;
 	/** Store flower cards' information */
-	struct nfp_app_fw_flower *slots[MAX_FLOWER_SERVICE_SLOT];
+	struct nfp_net_hw_priv *slots[MAX_FLOWER_SERVICE_SLOT];
 	/** Spinlock for sync slots when add/remove card */
 	rte_spinlock_t spinlock;
 };
@@ -37,7 +37,7 @@ static int
 nfp_flower_service_func(void *arg)
 {
 	uint16_t slot;
-	struct nfp_app_fw_flower *app;
+	struct nfp_net_hw_priv *hw_priv;
 	struct nfp_flower_service *service_handle;
 
 	service_handle = arg;
@@ -46,11 +46,11 @@ nfp_flower_service_func(void *arg)
 
 	rte_spinlock_lock(&service_handle->spinlock);
 	for (slot = 0; slot < MAX_FLOWER_SERVICE_SLOT; slot++) {
-		app = service_handle->slots[slot];
-		if (app == NULL)
+		hw_priv = service_handle->slots[slot];
+		if (hw_priv == NULL)
 			continue;
 
-		nfp_flower_ctrl_vnic_process(app);
+		nfp_flower_ctrl_vnic_process(hw_priv);
 	}
 	rte_spinlock_unlock(&service_handle->spinlock);
 
@@ -79,7 +79,7 @@ nfp_flower_service_enable(struct nfp_flower_service *service_handle)
 }
 
 static uint16_t
-nfp_flower_service_insert(struct nfp_app_fw_flower *app,
+nfp_flower_service_insert(struct nfp_net_hw_priv *hw_priv,
 		struct nfp_flower_service *service_handle)
 {
 	uint16_t slot;
@@ -87,7 +87,7 @@ nfp_flower_service_insert(struct nfp_app_fw_flower *app,
 	rte_spinlock_lock(&service_handle->spinlock);
 	for (slot = 0; slot < MAX_FLOWER_SERVICE_SLOT; slot++) {
 		if (service_handle->slots[slot] == NULL) {
-			service_handle->slots[slot] = app;
+			service_handle->slots[slot] = hw_priv;
 			break;
 		}
 	}
@@ -97,8 +97,7 @@ nfp_flower_service_insert(struct nfp_app_fw_flower *app,
 }
 
 int
-nfp_flower_service_start(void *app_fw_flower,
-		struct nfp_net_hw_priv *hw_priv)
+nfp_flower_service_start(struct nfp_net_hw_priv *hw_priv)
 {
 	int ret;
 	struct nfp_flower_service *service_handle;
@@ -119,7 +118,7 @@ nfp_flower_service_start(void *app_fw_flower,
 	}
 
 	/* Insert the NIC to flower service slot */
-	ret = nfp_flower_service_insert(app_fw_flower, service_handle);
+	ret = nfp_flower_service_insert(hw_priv, service_handle);
 	if (ret == MAX_FLOWER_SERVICE_SLOT) {
 		PMD_DRV_LOG(ERR, "Flower ctrl vnic service slot over %u",
 				MAX_FLOWER_SERVICE_SLOT);
@@ -130,8 +129,7 @@ nfp_flower_service_start(void *app_fw_flower,
 }
 
 void
-nfp_flower_service_stop(void *app_fw_flower,
-		struct nfp_net_hw_priv *hw_priv)
+nfp_flower_service_stop(struct nfp_net_hw_priv *hw_priv)
 {
 	uint16_t slot;
 	uint16_t count;
@@ -146,7 +144,7 @@ nfp_flower_service_stop(void *app_fw_flower,
 	rte_spinlock_lock(&service_handle->spinlock);
 	for (slot = 0; slot < MAX_FLOWER_SERVICE_SLOT; slot++) {
 		/* The app only in one slot */
-		if (service_handle->slots[slot] != app_fw_flower)
+		if (service_handle->slots[slot] != hw_priv)
 			continue;
 
 		service_handle->slots[slot] = NULL;
diff --git a/drivers/net/nfp/flower/nfp_flower_service.h b/drivers/net/nfp/flower/nfp_flower_service.h
index 2fbe4fa601..bca5f5240e 100644
--- a/drivers/net/nfp/flower/nfp_flower_service.h
+++ b/drivers/net/nfp/flower/nfp_flower_service.h
@@ -8,8 +8,8 @@
 
 #include "../nfp_net_common.h"
 
-int nfp_flower_service_start(void *app_fw_flower, struct nfp_net_hw_priv *hw_priv);
-void nfp_flower_service_stop(void *app_fw_flower, struct nfp_net_hw_priv *hw_priv);
+int nfp_flower_service_start(struct nfp_net_hw_priv *hw_priv);
+void nfp_flower_service_stop(struct nfp_net_hw_priv *hw_priv);
 
 int nfp_flower_service_sync_alloc(struct nfp_net_hw_priv *hw_priv);
 void nfp_flower_service_sync_free(struct nfp_net_hw_priv *hw_priv);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 13/23] net/nfp: get the first VF ID of the PF
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (11 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 12/23] net/nfp: refactor the logic of flower service Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 14/23] net/nfp: add the helper function to map rtsym with offset Chaoyong He
                   ` (10 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

In single PF case, all the VFs belong to the PF0, so the first VF ID
of the PF is always 0.
But in multiple PF case, VFs are shared by the PFs, and the first VF ID
of the PF is different, so it is necessary to get the right ID.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower.c             | 2 +-
 drivers/net/nfp/flower/nfp_flower_cmsg.h        | 1 +
 drivers/net/nfp/flower/nfp_flower_ctrl.c        | 7 +++++--
 drivers/net/nfp/flower/nfp_flower_representor.c | 2 +-
 drivers/net/nfp/nfp_ethdev.c                    | 1 +
 drivers/net/nfp/nfp_net_common.h                | 2 ++
 6 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 87bd9dda2e..602f45d1dd 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -116,7 +116,7 @@ nfp_flower_get_repr(struct nfp_net_hw_priv *hw_priv,
 		port =  NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(port_id);
 		return app_fw_flower->phy_reprs[port];
 	case NFP_FLOWER_CMSG_PORT_TYPE_PCIE_PORT:
-		port = NFP_FLOWER_CMSG_PORT_VNIC(port_id);
+		port = NFP_FLOWER_CMSG_PORT_VNIC_OFFSET(port_id, hw_priv->pf_dev->vf_base_id);
 		return app_fw_flower->vf_reprs[port];
 	default:
 		break;
diff --git a/drivers/net/nfp/flower/nfp_flower_cmsg.h b/drivers/net/nfp/flower/nfp_flower_cmsg.h
index bb03234035..93183153aa 100644
--- a/drivers/net/nfp/flower/nfp_flower_cmsg.h
+++ b/drivers/net/nfp/flower/nfp_flower_cmsg.h
@@ -422,6 +422,7 @@ enum nfp_flower_cmsg_port_vnic_type {
 #define NFP_FLOWER_CMSG_PORT_PCI(x)             (((x) >> 14) & 0x3)  /* [14,15] */
 #define NFP_FLOWER_CMSG_PORT_VNIC_TYPE(x)       (((x) >> 12) & 0x3)  /* [12,13] */
 #define NFP_FLOWER_CMSG_PORT_VNIC(x)            (((x) >> 6) & 0x3f)  /* [6,11] */
+#define NFP_FLOWER_CMSG_PORT_VNIC_OFFSET(x, offset)    (NFP_FLOWER_CMSG_PORT_VNIC(x) - (offset))
 #define NFP_FLOWER_CMSG_PORT_PCIE_Q(x)          ((x) & 0x3f)         /* [0,5] */
 #define NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(x)   ((x) & 0xff)         /* [0,7] */
 
diff --git a/drivers/net/nfp/flower/nfp_flower_ctrl.c b/drivers/net/nfp/flower/nfp_flower_ctrl.c
index 01a680eb6d..a46b849d1b 100644
--- a/drivers/net/nfp/flower/nfp_flower_ctrl.c
+++ b/drivers/net/nfp/flower/nfp_flower_ctrl.c
@@ -419,6 +419,7 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_net_hw_priv *hw_priv,
 		struct rte_mbuf *pkt_burst)
 {
 	uint32_t port;
+	uint32_t index;
 	struct nfp_flower_representor *repr;
 	struct nfp_flower_cmsg_port_mod *msg;
 	struct nfp_app_fw_flower *app_fw_flower;
@@ -430,11 +431,13 @@ nfp_flower_cmsg_port_mod_rx(struct nfp_net_hw_priv *hw_priv,
 
 	switch (NFP_FLOWER_CMSG_PORT_TYPE(port)) {
 	case NFP_FLOWER_CMSG_PORT_TYPE_PHYS_PORT:
-		repr = app_fw_flower->phy_reprs[NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(port)];
+		index = NFP_FLOWER_CMSG_PORT_PHYS_PORT_NUM(port);
+		repr = app_fw_flower->phy_reprs[index];
 		break;
 	case NFP_FLOWER_CMSG_PORT_TYPE_PCIE_PORT:
+		index = NFP_FLOWER_CMSG_PORT_VNIC_OFFSET(port, hw_priv->pf_dev->vf_base_id);
 		if (NFP_FLOWER_CMSG_PORT_VNIC_TYPE(port) == NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF)
-			repr =  app_fw_flower->vf_reprs[NFP_FLOWER_CMSG_PORT_VNIC(port)];
+			repr =  app_fw_flower->vf_reprs[index];
 		else
 			repr = app_fw_flower->pf_repr;
 		break;
diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index 59dc5854b5..e6fef45ddd 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -877,7 +877,7 @@ nfp_flower_repr_alloc(struct nfp_app_fw_flower *app_fw_flower,
 	for (i = 0; i < app_fw_flower->num_vf_reprs; i++) {
 		flower_repr.repr_type = NFP_REPR_TYPE_VF;
 		flower_repr.port_id = nfp_get_pcie_port_id(pf_dev->cpp,
-				NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i, 0);
+				NFP_FLOWER_CMSG_PORT_VNIC_TYPE_VF, i + pf_dev->vf_base_id, 0);
 		flower_repr.nfp_idx = 0;
 		flower_repr.vf_id = i;
 
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index e67ff3a0a0..482d23eb5c 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1924,6 +1924,7 @@ nfp_pf_get_sriov_vf(struct nfp_pf_dev *pf_dev,
 		return -ERANGE;
 	}
 
+	pf_dev->vf_base_id = offset;
 	pf_dev->sriov_vf = sriov_vf;
 
 	return 0;
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 7efd0161af..d3c70a21d4 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -147,6 +147,8 @@ struct nfp_pf_dev {
 	uint16_t sriov_vf;
 
 	uint8_t total_phyports;
+	/** Id of first VF that belongs to this PF */
+	uint8_t vf_base_id;
 };
 
 #define NFP_NET_FLOW_LIMIT    1024
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 14/23] net/nfp: add the helper function to map rtsym with offset
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (12 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 13/23] net/nfp: get the first VF ID of the PF Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 15/23] net/nfp: add the VF table to record the VF information Chaoyong He
                   ` (9 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Add the helper function to map rtsym with specified offset.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_rtsym.c | 14 ++++++++++++--
 drivers/net/nfp/nfpcore/nfp_rtsym.h |  2 ++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 5cefbace96..2fedd4d9af 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -658,8 +658,9 @@ nfp_rtsym_write_le(struct nfp_rtsym_table *rtbl,
 }
 
 uint8_t *
-nfp_rtsym_map(struct nfp_rtsym_table *rtbl,
+nfp_rtsym_map_offset(struct nfp_rtsym_table *rtbl,
 		const char *name,
+		uint32_t offset,
 		uint32_t min_size,
 		struct nfp_cpp_area **area)
 {
@@ -688,7 +689,7 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl,
 		return NULL;
 	}
 
-	mem = nfp_cpp_map_area(rtbl->cpp, cpp_id, addr, sym->size, area);
+	mem = nfp_cpp_map_area(rtbl->cpp, cpp_id, addr + offset, sym->size, area);
 	if (mem == NULL) {
 		PMD_DRV_LOG(ERR, "Failed to map symbol %s", name);
 		return NULL;
@@ -696,3 +697,12 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl,
 
 	return mem;
 }
+
+uint8_t *
+nfp_rtsym_map(struct nfp_rtsym_table *rtbl,
+		const char *name,
+		uint32_t min_size,
+		struct nfp_cpp_area **area)
+{
+	return nfp_rtsym_map_offset(rtbl, name, 0, min_size, area);
+}
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index f79637ac50..3e8acdd38e 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -40,5 +40,7 @@ int nfp_rtsym_write_le(struct nfp_rtsym_table *rtbl, const char *name,
 		uint64_t value);
 uint8_t *nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 		uint32_t min_size, struct nfp_cpp_area **area);
+uint8_t *nfp_rtsym_map_offset(struct nfp_rtsym_table *rtbl, const char *name,
+		uint32_t offset, uint32_t min_size, struct nfp_cpp_area **area);
 
 #endif /* __NFP_RTSYM_H__ */
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 15/23] net/nfp: add the VF table to record the VF information
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (13 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 14/23] net/nfp: add the helper function to map rtsym with offset Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 16/23] net/nfp: support configuration of VF numbers Chaoyong He
                   ` (8 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

In multiple PF case, different VF of different PF has
different VF configure, so need add the VF table to record
the VF information.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/common/nfp/nfp_common_ctrl.h |  8 ++++
 drivers/net/nfp/nfp_ethdev.c         | 64 +++++++++++++++++++++++++++-
 drivers/net/nfp/nfp_net_common.h     |  9 ++++
 3 files changed, 79 insertions(+), 2 deletions(-)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index 6badf769fc..e108720ff6 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -13,6 +13,14 @@
  */
 #define NFP_NET_CFG_BAR_SZ              (32 * 1024)
 
+/*
+ * Configuration sriov VF.
+ * The configuration memory begins with a mailbox region for communication with
+ * the firmware followed by individual VF entries.
+ */
+#define NFP_NET_VF_CFG_SZ               16
+#define NFP_NET_VF_CFG_MB_SZ            16
+
 /*
  * @NFP_NET_TXR_MAX:         Maximum number of TX rings
  * @NFP_NET_TXR_MASK:        Mask for TX rings
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 482d23eb5c..dc3890ef53 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -633,6 +633,16 @@ nfp_uninit_app_fw_nic(struct nfp_pf_dev *pf_dev)
 	rte_free(pf_dev->app_fw_priv);
 }
 
+static void
+nfp_net_vf_config_uninit(struct nfp_pf_dev *pf_dev)
+{
+	if (pf_dev->sriov_vf == 0)
+		return;
+
+	nfp_cpp_area_release_free(pf_dev->vf_cfg_tbl_area);
+	nfp_cpp_area_release_free(pf_dev->vf_area);
+}
+
 void
 nfp_pf_uninit(struct nfp_net_hw_priv *hw_priv)
 {
@@ -640,6 +650,7 @@ nfp_pf_uninit(struct nfp_net_hw_priv *hw_priv)
 
 	if (pf_dev->devargs.cpp_service_enable)
 		nfp_disable_cpp_service(pf_dev);
+	nfp_net_vf_config_uninit(pf_dev);
 	nfp_cpp_area_release_free(pf_dev->mac_stats_area);
 	nfp_cpp_area_release_free(pf_dev->qc_area);
 	free(pf_dev->sym_tbl);
@@ -1957,6 +1968,47 @@ nfp_net_get_vf_info(struct nfp_pf_dev *pf_dev,
 	return 0;
 }
 
+static int
+nfp_net_vf_config_init(struct nfp_pf_dev *pf_dev)
+{
+	int ret = 0;
+	uint32_t min_size;
+	char vf_bar_name[RTE_ETH_NAME_MAX_LEN];
+	char vf_cfg_name[RTE_ETH_NAME_MAX_LEN];
+
+	if (pf_dev->sriov_vf == 0)
+		return 0;
+
+	min_size = NFP_NET_CFG_BAR_SZ * pf_dev->sriov_vf;
+	snprintf(vf_bar_name, sizeof(vf_bar_name), "_pf%d_net_vf_bar",
+			pf_dev->multi_pf.function_id);
+	pf_dev->vf_bar = nfp_rtsym_map_offset(pf_dev->sym_tbl, vf_bar_name,
+			NFP_NET_CFG_BAR_SZ * pf_dev->vf_base_id,
+			min_size, &pf_dev->vf_area);
+	if (pf_dev->vf_bar == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to get vf cfg.");
+		return -EIO;
+	}
+
+	min_size = NFP_NET_VF_CFG_SZ * pf_dev->sriov_vf + NFP_NET_VF_CFG_MB_SZ;
+	snprintf(vf_cfg_name, sizeof(vf_cfg_name), "_pf%d_net_vf_cfg2",
+			pf_dev->multi_pf.function_id);
+	pf_dev->vf_cfg_tbl_bar = nfp_rtsym_map(pf_dev->sym_tbl, vf_cfg_name,
+			min_size, &pf_dev->vf_cfg_tbl_area);
+	if (pf_dev->vf_cfg_tbl_bar == NULL) {
+		PMD_INIT_LOG(ERR, "Failed to get vf configure table.");
+		ret = -EIO;
+		goto vf_bar_cleanup;
+	}
+
+	return 0;
+
+vf_bar_cleanup:
+	nfp_cpp_area_release_free(pf_dev->vf_area);
+
+	return ret;
+}
+
 static int
 nfp_pf_init(struct rte_pci_device *pci_dev)
 {
@@ -2149,6 +2201,12 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto hwqueues_cleanup;
 	}
 
+	ret = nfp_net_vf_config_init(pf_dev);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init VF config.");
+		goto mac_stats_cleanup;
+	}
+
 	hw_priv->pf_dev = pf_dev;
 	hw_priv->dev_info = dev_info;
 
@@ -2159,7 +2217,7 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 	ret = nfp_fw_app_primary_init(hw_priv);
 	if (ret != 0) {
 		PMD_INIT_LOG(ERR, "Failed to init hw app primary.");
-		goto mac_stats_cleanup;
+		goto vf_cfg_tbl_cleanup;
 	}
 
 	/* Register the CPP bridge service here for primary use */
@@ -2167,12 +2225,14 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		ret = nfp_enable_cpp_service(pf_dev);
 		if (ret != 0) {
 			PMD_INIT_LOG(ERR, "Enable CPP service failed.");
-			goto hwqueues_cleanup;
+			goto vf_cfg_tbl_cleanup;
 		}
 	}
 
 	return 0;
 
+vf_cfg_tbl_cleanup:
+	nfp_net_vf_config_uninit(pf_dev);
 mac_stats_cleanup:
 	nfp_cpp_area_release_free(pf_dev->mac_stats_area);
 hwqueues_cleanup:
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index d3c70a21d4..c4d469599f 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -117,6 +117,15 @@ struct nfp_pf_dev {
 	struct nfp_cpp_area *ctrl_area;
 	struct nfp_cpp_area *qc_area;
 
+	/** Pointer to the CPP area for the VF configuration BAR */
+	struct nfp_cpp_area *vf_area;
+	/** Pointer to mapped VF configuration area */
+	uint8_t *vf_bar;
+	/** Pointer to the CPP area for the VF config table */
+	struct nfp_cpp_area *vf_cfg_tbl_area;
+	/** Pointer to mapped VF config table */
+	uint8_t *vf_cfg_tbl_bar;
+
 	uint8_t *qc_bar;
 
 	struct nfp_cpp_area *mac_stats_area;
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 16/23] net/nfp: support configuration of VF numbers
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (14 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 15/23] net/nfp: add the VF table to record the VF information Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 17/23] net/nfp: configure the VF queue Chaoyong He
                   ` (7 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

The firmware uses the VF split capacity to identify the
feature of PF can has different number of VFs.
Add the logic to write the VF count and the first VF ID
into firmware, so that the firmware can initialize and
allocate relevant resource accordingly.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/common/nfp/nfp_common_ctrl.h |  11 +++
 drivers/net/nfp/flower/nfp_flower.c  |   6 ++
 drivers/net/nfp/nfp_ethdev.c         |   8 ++
 drivers/net/nfp/nfp_net_common.c     | 125 +++++++++++++++++++++++++++
 drivers/net/nfp/nfp_net_common.h     |   2 +
 5 files changed, 152 insertions(+)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index e108720ff6..a52c33508e 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -21,6 +21,16 @@
 #define NFP_NET_VF_CFG_SZ               16
 #define NFP_NET_VF_CFG_MB_SZ            16
 
+/* VF config mailbox */
+#define NFP_NET_VF_CFG_MB               0x0
+#define NFP_NET_VF_CFG_MB_CAP           0x0
+#define   NFP_NET_VF_CFG_MB_CAP_SPLIT             (0x1 << 8)
+#define NFP_NET_VF_CFG_MB_RET           0x2
+#define NFP_NET_VF_CFG_MB_UPD           0x4
+#define   NFP_NET_VF_CFG_MB_UPD_SPLIT             (0x1 << 8)
+#define NFP_NET_VF_CFG_MB_VF_CNT        0x6
+#define NFP_NET_VF_CFG_MB_VF_NUM        0x7
+
 /*
  * @NFP_NET_TXR_MAX:         Maximum number of TX rings
  * @NFP_NET_TXR_MASK:        Mask for TX rings
@@ -89,6 +99,7 @@
 #define   NFP_NET_CFG_UPDATE_VXLAN        (0x1 <<  9) /* VXLAN port change */
 #define   NFP_NET_CFG_UPDATE_MACADDR      (0x1 << 11) /* MAC address change */
 #define   NFP_NET_CFG_UPDATE_MBOX         (0x1 << 12) /* Mailbox update */
+#define   NFP_NET_CFG_UPDATE_VF           (0x1 << 13) /* VF settings change */
 #define   NFP_NET_CFG_UPDATE_ERR          (0x1U << 31) /* A error occurred */
 #define NFP_NET_CFG_TXRS_ENABLE         0x0008
 #define NFP_NET_CFG_RXRS_ENABLE         0x0010
diff --git a/drivers/net/nfp/flower/nfp_flower.c b/drivers/net/nfp/flower/nfp_flower.c
index 602f45d1dd..fa272790bc 100644
--- a/drivers/net/nfp/flower/nfp_flower.c
+++ b/drivers/net/nfp/flower/nfp_flower.c
@@ -724,6 +724,12 @@ nfp_init_app_fw_flower(struct nfp_net_hw_priv *hw_priv)
 		goto pf_cpp_area_cleanup;
 	}
 
+	ret = nfp_net_vf_config_app_init(pf_hw, pf_dev);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init sriov module");
+		goto pf_cpp_area_cleanup;
+	}
+
 	nfp_flower_nfd_func_register(app_fw_flower);
 
 	/* The ctrl vNIC struct comes directly after the PF one */
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index dc3890ef53..f9f0884c88 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1030,6 +1030,14 @@ nfp_net_init(struct rte_eth_dev *eth_dev,
 	/* Initializing spinlock for reconfigs */
 	rte_spinlock_init(&hw->reconfig_lock);
 
+	if ((port == 0 || pf_dev->multi_pf.enabled)) {
+		err = nfp_net_vf_config_app_init(net_hw, pf_dev);
+		if (err != 0) {
+			PMD_INIT_LOG(ERR, "Failed to init sriov module");
+			goto xstats_free;
+		}
+	}
+
 	/* Allocating memory for mac addr */
 	eth_dev->data->mac_addrs = rte_zmalloc("mac_addr", RTE_ETHER_ADDR_LEN, 0);
 	if (eth_dev->data->mac_addrs == NULL) {
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index 0bfe7a514c..e1cae983b2 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -196,6 +196,54 @@ nfp_net_notify_port_speed(struct nfp_net_hw *hw,
 /* The length of firmware version string */
 #define FW_VER_LEN        32
 
+/**
+ * Reconfigure the firmware of VF configure
+ *
+ * @param net_hw
+ *   Device to reconfigure
+ * @param pf_dev
+ *   Get the Device info
+ * @param update
+ *   The value for the mailbox VF command
+ * @param value
+ *   The value of update
+ * @param offset
+ *   The offset in the VF configure table
+ *
+ * @return
+ *   - (0) if OK to reconfigure vf configure.
+ *   - (-EIO) if I/O err and fail to configure the vf configure
+ */
+static int
+nfp_net_vf_reconfig(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev,
+		uint16_t update,
+		uint8_t value,
+		uint32_t offset)
+{
+	int ret;
+	struct nfp_hw *hw;
+
+	hw = &net_hw->super;
+	rte_spinlock_lock(&hw->reconfig_lock);
+
+	/* Write update info to mailbox in VF config symbol */
+	nn_writeb(value, pf_dev->vf_cfg_tbl_bar + offset);
+	nn_writew(update, pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_UPD);
+	nn_cfg_writel(hw, NFP_NET_CFG_UPDATE, NFP_NET_CFG_UPDATE_VF);
+
+	rte_wmb();
+
+	ret = nfp_reconfig_real(hw, NFP_NET_CFG_UPDATE_VF);
+
+	rte_spinlock_unlock(&hw->reconfig_lock);
+
+	if (ret != 0)
+		return -EIO;
+
+	return nn_readw(pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_RET);
+}
+
 /**
  * Reconfigure the firmware via the mailbox
  *
@@ -2574,3 +2622,80 @@ nfp_function_id_get(const struct nfp_pf_dev *pf_dev,
 
 	return port_id;
 }
+
+static int
+nfp_net_sriov_check(struct nfp_pf_dev *pf_dev,
+		uint16_t cap)
+{
+	uint16_t cap_vf;
+
+	cap_vf = nn_readw(pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_CAP);
+	if ((cap_vf & cap) != cap)
+		return -ENOTSUP;
+
+	return 0;
+}
+
+static int
+nfp_net_sriov_update(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev,
+		uint16_t update)
+{
+	int ret;
+
+	/* Reuse NFP_NET_VF_CFG_MB_VF_NUM to pass vf_base_id to FW. */
+	ret = nfp_net_vf_reconfig(net_hw, pf_dev, update, pf_dev->vf_base_id,
+			NFP_NET_VF_CFG_MB_VF_NUM);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Error nfp VF reconfig");
+		return ret;
+	}
+
+	return 0;
+}
+
+static int
+nfp_net_sriov_init(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+
+	ret = nfp_net_sriov_check(pf_dev, NFP_NET_VF_CFG_MB_CAP_SPLIT);
+	if (ret != 0) {
+		if (ret == -ENOTSUP) {
+			PMD_INIT_LOG(WARNING, "Set VF split not supported");
+			return 0;
+		}
+
+		PMD_INIT_LOG(ERR, "Set VF split failed");
+		return ret;
+	}
+
+	nn_writeb(pf_dev->sriov_vf, pf_dev->vf_cfg_tbl_bar + NFP_NET_VF_CFG_MB_VF_CNT);
+
+	ret = nfp_net_sriov_update(net_hw, pf_dev, NFP_NET_VF_CFG_MB_UPD_SPLIT);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "The nfp sriov update spilt failed");
+		return ret;
+	}
+
+	return 0;
+}
+
+int
+nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+
+	if (pf_dev->sriov_vf == 0)
+		return 0;
+
+	ret = nfp_net_sriov_init(net_hw, pf_dev);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to init sriov module");
+		return ret;
+	}
+
+	return 0;
+}
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index c4d469599f..4b5029f3f4 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -347,6 +347,8 @@ uint32_t nfp_net_get_port_num(struct nfp_pf_dev *pf_dev,
 		struct nfp_eth_table *nfp_eth_table);
 uint8_t nfp_function_id_get(const struct nfp_pf_dev *pf_dev,
 		uint8_t port_id);
+int nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev);
 
 #define NFP_PRIV_TO_APP_FW_NIC(app_fw_priv)\
 	((struct nfp_app_fw_nic *)app_fw_priv)
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 17/23] net/nfp: configure the VF queue
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (15 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 16/23] net/nfp: support configuration of VF numbers Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 18/23] net/nfp: add check for numbers of VF representor port Chaoyong He
                   ` (6 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Configure the VF queue, now every VF just have one queue.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/common/nfp/nfp_common_ctrl.h |  2 ++
 drivers/net/nfp/nfp_ethdev.c         |  3 +++
 drivers/net/nfp/nfp_net_common.c     | 38 ++++++++++++++++++++++++++++
 drivers/net/nfp/nfp_net_common.h     |  2 ++
 4 files changed, 45 insertions(+)

diff --git a/drivers/common/nfp/nfp_common_ctrl.h b/drivers/common/nfp/nfp_common_ctrl.h
index a52c33508e..69596dd6f5 100644
--- a/drivers/common/nfp/nfp_common_ctrl.h
+++ b/drivers/common/nfp/nfp_common_ctrl.h
@@ -24,9 +24,11 @@
 /* VF config mailbox */
 #define NFP_NET_VF_CFG_MB               0x0
 #define NFP_NET_VF_CFG_MB_CAP           0x0
+#define   NFP_NET_VF_CFG_MB_CAP_QUEUE_CONFIG      (0x1 << 7)
 #define   NFP_NET_VF_CFG_MB_CAP_SPLIT             (0x1 << 8)
 #define NFP_NET_VF_CFG_MB_RET           0x2
 #define NFP_NET_VF_CFG_MB_UPD           0x4
+#define   NFP_NET_VF_CFG_MB_UPD_QUEUE_CONFIG      (0x1 << 7)
 #define   NFP_NET_VF_CFG_MB_UPD_SPLIT             (0x1 << 8)
 #define NFP_NET_VF_CFG_MB_VF_CNT        0x6
 #define NFP_NET_VF_CFG_MB_VF_NUM        0x7
diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index f9f0884c88..1d88f33756 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -36,6 +36,7 @@
 #define NFP_PF_DRIVER_NAME net_nfp_pf
 #define NFP_PF_FORCE_RELOAD_FW   "force_reload_fw"
 #define NFP_CPP_SERVICE_ENABLE   "cpp_service_enable"
+#define NFP_QUEUE_PER_VF     1
 
 struct nfp_net_init {
 	/** Sequential physical port number, only valid for CoreNIC firmware */
@@ -1973,6 +1974,8 @@ nfp_net_get_vf_info(struct nfp_pf_dev *pf_dev,
 	if (ret < 0)
 		return ret;
 
+	pf_dev->queue_per_vf = NFP_QUEUE_PER_VF;
+
 	return 0;
 }
 
diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index e1cae983b2..f8566d94d7 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -2654,6 +2654,38 @@ nfp_net_sriov_update(struct nfp_net_hw *net_hw,
 	return 0;
 }
 
+static int
+nfp_net_vf_queues_config(struct nfp_net_hw *net_hw,
+		struct nfp_pf_dev *pf_dev)
+{
+	int ret;
+	uint32_t i;
+	uint32_t offset;
+
+	ret = nfp_net_sriov_check(pf_dev, NFP_NET_VF_CFG_MB_CAP_QUEUE_CONFIG);
+	if (ret != 0) {
+		if (ret == -ENOTSUP) {
+			PMD_INIT_LOG(WARNING, "Set VF max queue not supported");
+			return 0;
+		}
+
+		PMD_INIT_LOG(ERR, "Set VF max queue failed");
+		return ret;
+	}
+
+	offset = NFP_NET_VF_CFG_MB_SZ + pf_dev->max_vfs * NFP_NET_VF_CFG_SZ;
+	for (i = 0; i < pf_dev->sriov_vf; i++) {
+		ret = nfp_net_vf_reconfig(net_hw, pf_dev, NFP_NET_VF_CFG_MB_UPD_QUEUE_CONFIG,
+				pf_dev->queue_per_vf, pf_dev->vf_base_id + offset + i);
+		if (ret != 0) {
+			PMD_INIT_LOG(ERR, "Set VF max_queue failed");
+			return ret;
+		}
+	}
+
+	return 0;
+}
+
 static int
 nfp_net_sriov_init(struct nfp_net_hw *net_hw,
 		struct nfp_pf_dev *pf_dev)
@@ -2697,5 +2729,11 @@ nfp_net_vf_config_app_init(struct nfp_net_hw *net_hw,
 		return ret;
 	}
 
+	ret = nfp_net_vf_queues_config(net_hw, pf_dev);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to config vf queue");
+		return ret;
+	}
+
 	return 0;
 }
diff --git a/drivers/net/nfp/nfp_net_common.h b/drivers/net/nfp/nfp_net_common.h
index 4b5029f3f4..b5c6152857 100644
--- a/drivers/net/nfp/nfp_net_common.h
+++ b/drivers/net/nfp/nfp_net_common.h
@@ -158,6 +158,8 @@ struct nfp_pf_dev {
 	uint8_t total_phyports;
 	/** Id of first VF that belongs to this PF */
 	uint8_t vf_base_id;
+	/** Number of queues per VF */
+	uint32_t queue_per_vf;
 };
 
 #define NFP_NET_FLOW_LIMIT    1024
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 18/23] net/nfp: add check for numbers of VF representor port
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (16 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 17/23] net/nfp: configure the VF queue Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 19/23] net/nfp: add support of ring pop and push Chaoyong He
                   ` (5 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, chaoyong.he, stable, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

When the number of VF representor ports is bigger than
the number of VF ports, there will be segment fault.

Fix this by adding the check logic.

Fixes: e1124c4f8a45 ("net/nfp: add flower representor framework")
Cc: chaoyong.he@corigine.com
Cc: stable@dpdk.org

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_representor.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/net/nfp/flower/nfp_flower_representor.c b/drivers/net/nfp/flower/nfp_flower_representor.c
index e6fef45ddd..086dbc58e3 100644
--- a/drivers/net/nfp/flower/nfp_flower_representor.c
+++ b/drivers/net/nfp/flower/nfp_flower_representor.c
@@ -959,6 +959,11 @@ nfp_flower_repr_create(struct nfp_app_fw_flower *app_fw_flower,
 	app_fw_flower->num_phyport_reprs = pf_dev->total_phyports;
 	app_fw_flower->num_vf_reprs = eth_da.nb_representor_ports -
 			pf_dev->total_phyports - 1;
+	if (pf_dev->max_vfs != 0 && pf_dev->sriov_vf < app_fw_flower->num_vf_reprs) {
+		PMD_INIT_LOG(ERR, "The VF repr nums %d is bigger than VF nums %d",
+				app_fw_flower->num_vf_reprs, pf_dev->sriov_vf);
+		return -ERANGE;
+	}
 
 	PMD_INIT_LOG(INFO, "%d number of VF reprs", app_fw_flower->num_vf_reprs);
 	PMD_INIT_LOG(INFO, "%d number of phyport reprs", app_fw_flower->num_phyport_reprs);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 19/23] net/nfp: add support of ring pop and push
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (17 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 18/23] net/nfp: add check for numbers of VF representor port Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 20/23] net/nfp: add resource share mode of host context Chaoyong He
                   ` (4 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Add support of ring pop and push, the ring memory is in firmware
side, we add this support to make it is possible to share resource
between PFs.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfpcore/nfp_rtsym.c  | 103 +++++++++++++++++++++++++++
 drivers/net/nfp/nfpcore/nfp_rtsym.h  |   4 ++
 drivers/net/nfp/nfpcore/nfp_target.c |   2 +
 3 files changed, 109 insertions(+)

diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.c b/drivers/net/nfp/nfpcore/nfp_rtsym.c
index 2fedd4d9af..7d9cfb0d42 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.c
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.c
@@ -706,3 +706,106 @@ nfp_rtsym_map(struct nfp_rtsym_table *rtbl,
 {
 	return nfp_rtsym_map_offset(rtbl, name, 0, min_size, area);
 }
+
+/**
+ * Pop a simple unsigned scalar value from ring
+ *
+ * Lookup the symbol table for ring base and address, then pop value base on
+ * the ring with cpp read and write operation.
+ *
+ * @param rtbl
+ *    NFP run-time symbol table
+ * @param aux_name
+ *    The auxiliary rtsym table name which can ensure ring base and address
+ * @param name
+ *    The rtsym table name which can handle the ring
+ * @param value
+ *    Pop this value from ring
+ *
+ * @return
+ *    0 on success, negative errno otherwise.
+ */
+int
+nfp_rtsym_readl_indirect(struct nfp_rtsym_table *rtbl,
+		const char *aux_name,
+		const char *name,
+		uint32_t *value)
+{
+	int ret;
+	uint32_t cpp_id;
+	const struct nfp_rtsym *sym;
+	const struct nfp_rtsym *aux_sym;
+
+	if (value == NULL)
+		return -EINVAL;
+
+	aux_sym = nfp_rtsym_lookup(rtbl, aux_name);
+	if (aux_sym == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to find symbol %s", aux_name);
+		return -ENOENT;
+	}
+
+	sym = nfp_rtsym_lookup(rtbl, name);
+	if (sym == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to find symbol %s", name);
+		return -ENOENT;
+	}
+
+	/* Ring Pop */
+	cpp_id = NFP_CPP_ISLAND_ID(aux_sym->target, 22, 0, aux_sym->domain);
+	ret = nfp_cpp_readl(rtbl->cpp, cpp_id, sym->addr, value);
+	if (ret != 0)
+		return -EIO;
+
+	return 0;
+}
+
+/**
+ * Push a simple unsigned scalar value to ring
+ *
+ * Lookup the symbol table for ring base and address, then Push value base on
+ * the ring with cpp read and write operation.
+ *
+ * @param rtbl
+ *    NFP run-time symbol table
+ * @param aux_name
+ *    The auxiliary rtsym table name which can ensure ring base and address
+ * @param name
+ *    The rtsym table name which can handle the ring
+ * @param value
+ *    Push this value to ring
+ *
+ * @return
+ *    0 on success, negative errno otherwise.
+ */
+int
+nfp_rtsym_writel_indirect(struct nfp_rtsym_table *rtbl,
+		const char *aux_name,
+		const char *name,
+		uint32_t value)
+{
+	int ret;
+	uint32_t cpp_id;
+	const struct nfp_rtsym *sym;
+	const struct nfp_rtsym *aux_sym;
+
+	aux_sym = nfp_rtsym_lookup(rtbl, aux_name);
+	if (aux_sym == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to find symbol %s", aux_name);
+		return -ENOENT;
+	}
+
+	sym = nfp_rtsym_lookup(rtbl, name);
+	if (sym == NULL) {
+		PMD_DRV_LOG(ERR, "Failed to find symbol %s", name);
+		return -ENOENT;
+	}
+
+	/* Ring Put */
+	cpp_id = NFP_CPP_ISLAND_ID(aux_sym->target, 20, 0, aux_sym->domain);
+	ret = nfp_cpp_writel(rtbl->cpp, cpp_id, sym->addr, value);
+	if (ret != 0)
+		return -EIO;
+
+	return 0;
+}
diff --git a/drivers/net/nfp/nfpcore/nfp_rtsym.h b/drivers/net/nfp/nfpcore/nfp_rtsym.h
index 3e8acdd38e..5b1ea53bea 100644
--- a/drivers/net/nfp/nfpcore/nfp_rtsym.h
+++ b/drivers/net/nfp/nfpcore/nfp_rtsym.h
@@ -42,5 +42,9 @@ uint8_t *nfp_rtsym_map(struct nfp_rtsym_table *rtbl, const char *name,
 		uint32_t min_size, struct nfp_cpp_area **area);
 uint8_t *nfp_rtsym_map_offset(struct nfp_rtsym_table *rtbl, const char *name,
 		uint32_t offset, uint32_t min_size, struct nfp_cpp_area **area);
+int nfp_rtsym_readl_indirect(struct nfp_rtsym_table *rtbl, const char *aux_name,
+		const char *name, uint32_t *value);
+int nfp_rtsym_writel_indirect(struct nfp_rtsym_table *rtbl, const char *aux_name,
+		const char *name, uint32_t value);
 
 #endif /* __NFP_RTSYM_H__ */
diff --git a/drivers/net/nfp/nfpcore/nfp_target.c b/drivers/net/nfp/nfpcore/nfp_target.c
index ea5b39a4b9..0e7a5cbb05 100644
--- a/drivers/net/nfp/nfpcore/nfp_target.c
+++ b/drivers/net/nfp/nfpcore/nfp_target.c
@@ -264,6 +264,8 @@ nfp6000_mu_emu(uint32_t cpp_id)
 		return PUSHPULL(P32, 0);
 	case NFP_CPP_ID(0, 18, 3): /* write_queue_ring */
 		return PUSHPULL(P32, 0);
+	case NFP_CPP_ID(0, 20, 0): /* put */
+		return PUSHPULL(P32, 0);
 	case NFP_CPP_ID(0, 20, 2): /* journal */
 		return PUSHPULL(P32, 0);
 	case NFP_CPP_ID(0, 21, 0): /* get */
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 20/23] net/nfp: add resource share mode of host context
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (18 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 19/23] net/nfp: add support of ring pop and push Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 21/23] net/nfp: add resource share mode of mask ID Chaoyong He
                   ` (3 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

For multiple PFs flower firmware, host context resource should be
shared between PFs, so change this resource allocation from driver
to firmware.

In application start stage, the resource initialization
is not necessary anymore since PMD will allocate resource
from hardware for multiple PFs flower firmware.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_conntrack.c   |  2 +-
 drivers/net/nfp/flower/nfp_flower_flow.c | 89 ++++++++++++++++++++----
 drivers/net/nfp/flower/nfp_flower_flow.h |  4 +-
 3 files changed, 81 insertions(+), 14 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_conntrack.c b/drivers/net/nfp/flower/nfp_conntrack.c
index f89003be8b..b0641b03d2 100644
--- a/drivers/net/nfp/flower/nfp_conntrack.c
+++ b/drivers/net/nfp/flower/nfp_conntrack.c
@@ -1020,7 +1020,7 @@ nfp_ct_offload_add(struct nfp_flower_representor *repr,
 	return 0;
 
 flow_teardown:
-	nfp_flow_teardown(priv, nfp_flow, false);
+	nfp_flow_teardown(repr->app_fw_flower, nfp_flow, false);
 	nfp_flow_free(nfp_flow);
 
 	return ret;
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index d8feff634a..215d655a18 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -487,7 +487,29 @@ nfp_flow_free(struct rte_flow *nfp_flow)
 }
 
 static int
-nfp_stats_id_alloc(struct nfp_flow_priv *priv, uint32_t *ctx)
+nfp_stats_id_alloc_from_hw(struct nfp_app_fw_flower *app_fw_flower,
+		uint32_t *stats_context_id)
+{
+	int ret;
+	struct nfp_net_hw_priv *hw_priv;
+
+	hw_priv = app_fw_flower->pf_ethdev->process_private;
+	ret = nfp_rtsym_readl_indirect(hw_priv->pf_dev->sym_tbl,
+			"_FC_WC_EMU_0_HOST_CTX_RING_BASE",
+			"_FC_WC_HOST_CTX_RING_EMU_0", stats_context_id);
+	if (ret != 0)
+		return ret;
+
+	/* Check if context id is an invalid value */
+	if (*stats_context_id >= app_fw_flower->flow_priv->ctx_count)
+		return -ENOENT;
+
+	return 0;
+}
+
+static int
+nfp_stats_id_alloc_from_driver(struct nfp_flow_priv *priv,
+		uint32_t *ctx)
 {
 	struct circ_buf *ring;
 	uint32_t temp_stats_id;
@@ -523,7 +545,35 @@ nfp_stats_id_alloc(struct nfp_flow_priv *priv, uint32_t *ctx)
 }
 
 static int
-nfp_stats_id_free(struct nfp_flow_priv *priv, uint32_t ctx)
+nfp_stats_id_alloc(struct nfp_app_fw_flower *app_fw_flower,
+		uint32_t *stats_context_id)
+{
+	struct nfp_net_hw_priv *hw_priv;
+
+	hw_priv = app_fw_flower->pf_ethdev->process_private;
+	if (hw_priv->pf_dev->multi_pf.enabled)
+		return nfp_stats_id_alloc_from_hw(app_fw_flower, stats_context_id);
+	else
+		return nfp_stats_id_alloc_from_driver(app_fw_flower->flow_priv,
+				stats_context_id);
+}
+
+static int
+nfp_stats_id_free_to_hw(struct nfp_net_hw_priv *hw_priv,
+		uint32_t stats_context_id)
+{
+	int ret;
+
+	ret = nfp_rtsym_writel_indirect(hw_priv->pf_dev->sym_tbl,
+			"_FC_WC_EMU_0_HOST_CTX_RING_BASE",
+			"_FC_WC_HOST_CTX_RING_EMU_0", stats_context_id);
+
+	return ret;
+}
+
+static int
+nfp_stats_id_free_to_driver(struct nfp_flow_priv *priv,
+		uint32_t ctx)
 {
 	struct circ_buf *ring;
 
@@ -540,6 +590,20 @@ nfp_stats_id_free(struct nfp_flow_priv *priv, uint32_t ctx)
 	return 0;
 }
 
+static int
+nfp_stats_id_free(struct nfp_app_fw_flower *app_fw_flower,
+		uint32_t stats_context_id)
+{
+	struct nfp_net_hw_priv *hw_priv;
+
+	hw_priv = app_fw_flower->pf_ethdev->process_private;
+	if (hw_priv->pf_dev->multi_pf.enabled)
+		return nfp_stats_id_free_to_hw(hw_priv, stats_context_id);
+	else
+		return nfp_stats_id_free_to_driver(app_fw_flower->flow_priv,
+				stats_context_id);
+}
+
 static int
 nfp_tun_add_ipv4_off(struct nfp_app_fw_flower *app_fw_flower,
 		rte_be32_t ipv4)
@@ -4570,8 +4634,7 @@ nfp_flow_process(struct nfp_flower_representor *representor,
 	if (key_layer.port == (uint32_t)~0)
 		key_layer.port = representor->port_id;
 
-	priv = representor->app_fw_flower->flow_priv;
-	ret = nfp_stats_id_alloc(priv, &stats_ctx);
+	ret = nfp_stats_id_alloc(representor->app_fw_flower, &stats_ctx);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "nfp stats id alloc failed.");
 		return NULL;
@@ -4586,6 +4649,7 @@ nfp_flow_process(struct nfp_flower_representor *representor,
 	nfp_flow->install_flag = install_flag;
 	nfp_flow->merge_flag = merge_flag;
 
+	priv = representor->app_fw_flower->flow_priv;
 	nfp_flow_compile_metadata(priv, nfp_flow, &key_layer, stats_ctx, cookie);
 
 	ret = nfp_flow_compile_items(representor, items, nfp_flow);
@@ -4636,7 +4700,7 @@ nfp_flow_process(struct nfp_flower_representor *representor,
 free_flow:
 	nfp_flow_free(nfp_flow);
 free_stats:
-	nfp_stats_id_free(priv, stats_ctx);
+	nfp_stats_id_free(representor->app_fw_flower, stats_ctx);
 
 	return NULL;
 }
@@ -4678,15 +4742,17 @@ nfp_flow_setup(struct nfp_flower_representor *representor,
 }
 
 int
-nfp_flow_teardown(struct nfp_flow_priv *priv,
+nfp_flow_teardown(struct nfp_app_fw_flower *app_fw_flower,
 		struct rte_flow *nfp_flow,
 		bool validate_flag)
 {
 	char *mask_data;
 	uint32_t mask_len;
 	uint32_t stats_ctx;
+	struct nfp_flow_priv *priv;
 	struct nfp_fl_rule_metadata *nfp_flow_meta;
 
+	priv = app_fw_flower->flow_priv;
 	nfp_flow_meta = nfp_flow->payload.meta;
 	mask_data = nfp_flow->payload.mask_data;
 	mask_len = nfp_flow_meta->mask_len << NFP_FL_LW_SIZ;
@@ -4704,7 +4770,7 @@ nfp_flow_teardown(struct nfp_flow_priv *priv,
 		priv->flower_version++;
 
 	stats_ctx = rte_be_to_cpu_32(nfp_flow_meta->host_ctx_id);
-	return nfp_stats_id_free(priv, stats_ctx);
+	return nfp_stats_id_free(app_fw_flower, stats_ctx);
 }
 
 static int
@@ -4716,11 +4782,9 @@ nfp_flow_validate(struct rte_eth_dev *dev,
 {
 	int ret;
 	struct rte_flow *nfp_flow;
-	struct nfp_flow_priv *priv;
 	struct nfp_flower_representor *representor;
 
 	representor = dev->data->dev_private;
-	priv = representor->app_fw_flower->flow_priv;
 
 	nfp_flow = nfp_flow_setup(representor, attr, items, actions, true);
 	if (nfp_flow == NULL) {
@@ -4729,7 +4793,7 @@ nfp_flow_validate(struct rte_eth_dev *dev,
 				NULL, "This flow can not be offloaded.");
 	}
 
-	ret = nfp_flow_teardown(priv, nfp_flow, true);
+	ret = nfp_flow_teardown(representor->app_fw_flower, nfp_flow, true);
 	if (ret != 0) {
 		return rte_flow_error_set(error, EINVAL,
 				RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
@@ -4799,7 +4863,7 @@ nfp_flow_create(struct rte_eth_dev *dev,
 	return nfp_flow;
 
 flow_teardown:
-	nfp_flow_teardown(priv, nfp_flow, false);
+	nfp_flow_teardown(app_fw_flower, nfp_flow, false);
 	nfp_flow_free(nfp_flow);
 
 	return NULL;
@@ -4838,7 +4902,7 @@ nfp_flow_destroy(struct rte_eth_dev *dev,
 	}
 
 	/* Update flow */
-	ret = nfp_flow_teardown(priv, nfp_flow, false);
+	ret = nfp_flow_teardown(app_fw_flower, nfp_flow, false);
 	if (ret != 0) {
 		rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_UNSPECIFIED,
 				NULL, "Flow teardown failed.");
@@ -5217,6 +5281,7 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	priv->hash_seed = (uint32_t)rte_rand();
 	priv->stats_ring_size = ctx_count;
 	priv->total_mem_units = ctx_split;
+	priv->ctx_count = ctx_count;
 
 	/* Init ring buffer and unallocated mask_ids. */
 	priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1;
diff --git a/drivers/net/nfp/flower/nfp_flower_flow.h b/drivers/net/nfp/flower/nfp_flower_flow.h
index 5d927edde9..5007438f67 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.h
+++ b/drivers/net/nfp/flower/nfp_flower_flow.h
@@ -7,6 +7,7 @@
 #define __NFP_FLOWER_FLOW_H__
 
 #include "../nfp_net_common.h"
+#include "nfp_flower.h"
 
 /* The firmware expects lengths in units of long words */
 #define NFP_FL_LW_SIZ                   2
@@ -145,6 +146,7 @@ struct nfp_flow_priv {
 	uint32_t active_mem_unit; /**< The size of active mem units. */
 	uint32_t total_mem_units; /**< The size of total mem units. */
 	uint32_t stats_ring_size; /**< The size of stats id ring. */
+	uint32_t ctx_count; /**< Maximum number of host context. */
 	struct nfp_fl_stats_id stats_ids; /**< The stats id ring. */
 	struct nfp_fl_stats *stats; /**< Store stats of flow. */
 	rte_spinlock_t stats_lock; /** < Lock the update of 'stats' field. */
@@ -202,7 +204,7 @@ struct rte_flow *nfp_flow_process(struct nfp_flower_representor *representor,
 		bool merge_flag);
 int nfp_flow_table_add_merge(struct nfp_flow_priv *priv,
 		struct rte_flow *nfp_flow);
-int nfp_flow_teardown(struct nfp_flow_priv *priv,
+int nfp_flow_teardown(struct nfp_app_fw_flower *app_fw_flower,
 		struct rte_flow *nfp_flow,
 		bool validate_flag);
 void nfp_flow_free(struct rte_flow *nfp_flow);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 21/23] net/nfp: add resource share mode of mask ID
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (19 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 20/23] net/nfp: add resource share mode of host context Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 22/23] net/nfp: add device active command for nsp service Chaoyong He
                   ` (2 subsequent siblings)
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

For multiple PFs flower firmware, mask ID resource should be
shared between PFs, so change this resource allocation from
driver to hardware.

In application start stage, the resource initialization
is not necessary anymore since PMD will allocate resource
from hardware for multiple PFs flower firmware.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/flower/nfp_flower_flow.c | 142 ++++++++++++++++++-----
 1 file changed, 111 insertions(+), 31 deletions(-)

diff --git a/drivers/net/nfp/flower/nfp_flower_flow.c b/drivers/net/nfp/flower/nfp_flower_flow.c
index 215d655a18..0fb63013d3 100644
--- a/drivers/net/nfp/flower/nfp_flower_flow.c
+++ b/drivers/net/nfp/flower/nfp_flower_flow.c
@@ -161,7 +161,51 @@ nfp_flow_dev_to_priv(struct rte_eth_dev *dev)
 }
 
 static int
-nfp_mask_id_alloc(struct nfp_flow_priv *priv,
+nfp_mask_id_alloc_from_hw(struct nfp_net_hw_priv *hw_priv,
+		uint8_t *mask_id)
+{
+	int ret;
+	uint8_t freed_id;
+	uint32_t mask = 0;
+
+	/* Checking if buffer is empty. */
+	freed_id = NFP_FLOWER_MASK_ENTRY_RS - 1;
+
+	ret = nfp_rtsym_readl_indirect(hw_priv->pf_dev->sym_tbl,
+			"_FC_WC_EMU_0_MASK_ID_RING_BASE",
+			"_FC_WC_MASK_ID_RING_EMU_0", &mask);
+	if (ret != 0) {
+		*mask_id = freed_id;
+		return ret;
+	}
+
+	/* 0 is an invalid value */
+	if (mask == 0 || mask >= NFP_FLOWER_MASK_ENTRY_RS) {
+		*mask_id = freed_id;
+		return -ENOENT;
+	}
+
+	*mask_id = (uint8_t)mask;
+
+	return 0;
+}
+
+static int
+nfp_mask_id_free_from_hw(struct nfp_net_hw_priv *hw_priv,
+		uint8_t mask_id)
+{
+	int ret;
+	uint32_t mask = mask_id;
+
+	ret = nfp_rtsym_writel_indirect(hw_priv->pf_dev->sym_tbl,
+			"_FC_WC_EMU_0_MASK_ID_RING_BASE",
+			"_FC_WC_MASK_ID_RING_EMU_0", mask);
+
+	return ret;
+}
+
+static int
+nfp_mask_id_alloc_from_driver(struct nfp_flow_priv *priv,
 		uint8_t *mask_id)
 {
 	uint8_t temp_id;
@@ -194,7 +238,7 @@ nfp_mask_id_alloc(struct nfp_flow_priv *priv,
 }
 
 static int
-nfp_mask_id_free(struct nfp_flow_priv *priv,
+nfp_mask_id_free_from_driver(struct nfp_flow_priv *priv,
 		uint8_t mask_id)
 {
 	struct circ_buf *ring;
@@ -213,7 +257,33 @@ nfp_mask_id_free(struct nfp_flow_priv *priv,
 }
 
 static int
-nfp_mask_table_add(struct nfp_flow_priv *priv,
+nfp_mask_id_alloc(struct nfp_app_fw_flower *app_fw_flower,
+		uint8_t *mask_id)
+{
+	struct nfp_net_hw_priv *hw_priv;
+
+	hw_priv = app_fw_flower->pf_ethdev->process_private;
+	if (hw_priv->pf_dev->multi_pf.enabled)
+		return nfp_mask_id_alloc_from_hw(hw_priv, mask_id);
+	else
+		return nfp_mask_id_alloc_from_driver(app_fw_flower->flow_priv, mask_id);
+}
+
+static int
+nfp_mask_id_free(struct nfp_app_fw_flower *app_fw_flower,
+		uint8_t mask_id)
+{
+	struct nfp_net_hw_priv *hw_priv;
+
+	hw_priv = app_fw_flower->pf_ethdev->process_private;
+	if (hw_priv->pf_dev->multi_pf.enabled)
+		return nfp_mask_id_free_from_hw(hw_priv, mask_id);
+	else
+		return nfp_mask_id_free_from_driver(app_fw_flower->flow_priv, mask_id);
+}
+
+static int
+nfp_mask_table_add(struct nfp_app_fw_flower *app_fw_flower,
 		char *mask_data,
 		uint32_t mask_len,
 		uint8_t *id)
@@ -221,6 +291,7 @@ nfp_mask_table_add(struct nfp_flow_priv *priv,
 	int ret;
 	uint8_t mask_id;
 	uint32_t hash_key;
+	struct nfp_flow_priv *priv;
 	struct nfp_mask_id_entry *mask_entry;
 
 	mask_entry = rte_zmalloc("mask_entry", sizeof(struct nfp_mask_id_entry), 0);
@@ -229,10 +300,11 @@ nfp_mask_table_add(struct nfp_flow_priv *priv,
 		goto exit;
 	}
 
-	ret = nfp_mask_id_alloc(priv, &mask_id);
+	ret = nfp_mask_id_alloc(app_fw_flower, &mask_id);
 	if (ret != 0)
 		goto mask_entry_free;
 
+	priv = app_fw_flower->flow_priv;
 	hash_key = rte_jhash(mask_data, mask_len, priv->hash_seed);
 	mask_entry->mask_id  = mask_id;
 	mask_entry->hash_key = hash_key;
@@ -250,7 +322,7 @@ nfp_mask_table_add(struct nfp_flow_priv *priv,
 	return 0;
 
 mask_id_free:
-	nfp_mask_id_free(priv, mask_id);
+	nfp_mask_id_free(app_fw_flower, mask_id);
 mask_entry_free:
 	rte_free(mask_entry);
 exit:
@@ -258,14 +330,16 @@ nfp_mask_table_add(struct nfp_flow_priv *priv,
 }
 
 static int
-nfp_mask_table_del(struct nfp_flow_priv *priv,
+nfp_mask_table_del(struct nfp_app_fw_flower *app_fw_flower,
 		char *mask_data,
 		uint32_t mask_len,
 		uint8_t id)
 {
 	int ret;
 	uint32_t hash_key;
+	struct nfp_flow_priv *priv;
 
+	priv = app_fw_flower->flow_priv;
 	hash_key = rte_jhash(mask_data, mask_len, priv->hash_seed);
 	ret = rte_hash_del_key(priv->mask_table, &hash_key);
 	if (ret < 0) {
@@ -273,7 +347,7 @@ nfp_mask_table_del(struct nfp_flow_priv *priv,
 		return ret;
 	}
 
-	ret = nfp_mask_id_free(priv, id);
+	ret = nfp_mask_id_free(app_fw_flower, id);
 	if (ret != 0) {
 		PMD_DRV_LOG(ERR, "Free mask id failed.");
 		return ret;
@@ -302,19 +376,21 @@ nfp_mask_table_search(struct nfp_flow_priv *priv,
 }
 
 static bool
-nfp_check_mask_add(struct nfp_flow_priv *priv,
+nfp_check_mask_add(struct nfp_app_fw_flower *app_fw_flower,
 		char *mask_data,
 		uint32_t mask_len,
 		uint8_t *meta_flags,
 		uint8_t *mask_id)
 {
 	int ret;
+	struct nfp_flow_priv *priv;
 	struct nfp_mask_id_entry *mask_entry;
 
+	priv = app_fw_flower->flow_priv;
 	mask_entry = nfp_mask_table_search(priv, mask_data, mask_len);
 	if (mask_entry == NULL) {
 		/* Mask entry does not exist, let's create one */
-		ret = nfp_mask_table_add(priv, mask_data, mask_len, mask_id);
+		ret = nfp_mask_table_add(app_fw_flower, mask_data, mask_len, mask_id);
 		if (ret != 0)
 			return false;
 
@@ -329,21 +405,23 @@ nfp_check_mask_add(struct nfp_flow_priv *priv,
 }
 
 static bool
-nfp_check_mask_remove(struct nfp_flow_priv *priv,
+nfp_check_mask_remove(struct nfp_app_fw_flower *app_fw_flower,
 		char *mask_data,
 		uint32_t mask_len,
 		uint8_t *meta_flags)
 {
 	int ret;
+	struct nfp_flow_priv *priv;
 	struct nfp_mask_id_entry *mask_entry;
 
+	priv = app_fw_flower->flow_priv;
 	mask_entry = nfp_mask_table_search(priv, mask_data, mask_len);
 	if (mask_entry == NULL)
 		return false;
 
 	mask_entry->ref_cnt--;
 	if (mask_entry->ref_cnt == 0) {
-		ret = nfp_mask_table_del(priv, mask_data, mask_len,
+		ret = nfp_mask_table_del(app_fw_flower, mask_data, mask_len,
 				mask_entry->mask_id);
 		if (ret != 0)
 			return false;
@@ -4667,7 +4745,7 @@ nfp_flow_process(struct nfp_flower_representor *representor,
 	nfp_flow_meta = nfp_flow->payload.meta;
 	mask_data = nfp_flow->payload.mask_data;
 	mask_len = key_layer.key_size;
-	if (!nfp_check_mask_add(priv, mask_data, mask_len,
+	if (!nfp_check_mask_add(representor->app_fw_flower, mask_data, mask_len,
 			&nfp_flow_meta->flags, &new_mask_id)) {
 		PMD_DRV_LOG(ERR, "nfp mask add check failed.");
 		goto free_flow;
@@ -4684,7 +4762,7 @@ nfp_flow_process(struct nfp_flower_representor *representor,
 	flow_find = nfp_flow_table_search(priv, nfp_flow);
 	if (flow_find != NULL && !nfp_flow->merge_flag && !flow_find->merge_flag) {
 		PMD_DRV_LOG(ERR, "This flow is already exist.");
-		if (!nfp_check_mask_remove(priv, mask_data, mask_len,
+		if (!nfp_check_mask_remove(representor->app_fw_flower, mask_data, mask_len,
 				&nfp_flow_meta->flags)) {
 			PMD_DRV_LOG(ERR, "nfp mask del check failed.");
 		}
@@ -4757,7 +4835,7 @@ nfp_flow_teardown(struct nfp_app_fw_flower *app_fw_flower,
 	mask_data = nfp_flow->payload.mask_data;
 	mask_len = nfp_flow_meta->mask_len << NFP_FL_LW_SIZ;
 	nfp_flow_meta->flags &= ~NFP_FL_META_FLAG_MANAGE_MASK;
-	if (!nfp_check_mask_remove(priv, mask_data, mask_len,
+	if (!nfp_check_mask_remove(app_fw_flower, mask_data, mask_len,
 			&nfp_flow_meta->flags)) {
 		PMD_DRV_LOG(ERR, "nfp mask del check failed.");
 		return -EINVAL;
@@ -5283,24 +5361,26 @@ nfp_flow_priv_init(struct nfp_pf_dev *pf_dev)
 	priv->total_mem_units = ctx_split;
 	priv->ctx_count = ctx_count;
 
-	/* Init ring buffer and unallocated mask_ids. */
-	priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1;
-	priv->mask_ids.free_list.buf = rte_zmalloc("nfp_app_mask_ids",
-			NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS, 0);
-	if (priv->mask_ids.free_list.buf == NULL) {
-		PMD_INIT_LOG(ERR, "mask id free list creation failed");
-		ret = -ENOMEM;
-		goto free_priv;
-	}
+	if (!pf_dev->multi_pf.enabled) {
+		/* Init ring buffer and unallocated mask_ids. */
+		priv->mask_ids.init_unallocated = NFP_FLOWER_MASK_ENTRY_RS - 1;
+		priv->mask_ids.free_list.buf = rte_zmalloc("nfp_app_mask_ids",
+				NFP_FLOWER_MASK_ENTRY_RS * NFP_FLOWER_MASK_ELEMENT_RS, 0);
+		if (priv->mask_ids.free_list.buf == NULL) {
+			PMD_INIT_LOG(ERR, "mask id free list creation failed");
+			ret = -ENOMEM;
+			goto free_priv;
+		}
 
-	/* Init ring buffer and unallocated stats_ids. */
-	priv->stats_ids.init_unallocated = ctx_count / ctx_split;
-	priv->stats_ids.free_list.buf = rte_zmalloc("nfp_app_stats_ids",
-			priv->stats_ring_size * NFP_FL_STATS_ELEM_RS, 0);
-	if (priv->stats_ids.free_list.buf == NULL) {
-		PMD_INIT_LOG(ERR, "stats id free list creation failed");
-		ret = -ENOMEM;
-		goto free_mask_id;
+		/* Init ring buffer and unallocated stats_ids. */
+		priv->stats_ids.init_unallocated = ctx_count / ctx_split;
+		priv->stats_ids.free_list.buf = rte_zmalloc("nfp_app_stats_ids",
+				priv->stats_ring_size * NFP_FL_STATS_ELEM_RS, 0);
+		if (priv->stats_ids.free_list.buf == NULL) {
+			PMD_INIT_LOG(ERR, "stats id free list creation failed");
+			ret = -ENOMEM;
+			goto free_mask_id;
+		}
 	}
 
 	/* Flow stats */
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 22/23] net/nfp: add device active command for nsp service
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (20 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 21/23] net/nfp: add resource share mode of mask ID Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-06-19  9:58 ` [PATCH 23/23] net/nfp: add support of flower firmware with multiple PF Chaoyong He
  2024-07-07 18:56 ` [PATCH 00/23] support " Ferruh Yigit
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

In multiple PF case, VFs belong to PFs except PF0
will not able to send traffic when PF0 is not activated.
So PMD add device active command to active the PF0 when
the probing PF is not PF0.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c      | 30 ++++++++++++++++++++++++++++++
 drivers/net/nfp/nfpcore/nfp_nsp.c | 10 ++++++++++
 drivers/net/nfp/nfpcore/nfp_nsp.h |  1 +
 3 files changed, 41 insertions(+)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 1d88f33756..d560bd695f 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1108,6 +1108,29 @@ nfp_net_init(struct rte_eth_dev *eth_dev,
 	return err;
 }
 
+static int
+nfp_net_device_activate(struct nfp_cpp *cpp,
+		struct nfp_multi_pf *multi_pf)
+{
+	int ret;
+	struct nfp_nsp *nsp;
+
+	if (multi_pf->enabled && multi_pf->function_id != 0) {
+		nsp = nfp_nsp_open(cpp);
+		if (nsp == NULL) {
+			PMD_DRV_LOG(ERR, "NFP error when obtaining NSP handle");
+			return -EIO;
+		}
+
+		ret = nfp_nsp_device_activate(nsp);
+		nfp_nsp_close(nsp);
+		if (ret != 0 && ret != -EOPNOTSUPP)
+			return ret;
+	}
+
+	return 0;
+}
+
 #define DEFAULT_FW_PATH       "/lib/firmware/netronome"
 
 static int
@@ -2133,6 +2156,13 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto eth_table_cleanup;
 	}
 
+	ret = nfp_net_device_activate(cpp, &pf_dev->multi_pf);
+	if (ret != 0) {
+		PMD_INIT_LOG(ERR, "Failed to activate the NFP device");
+		ret = -EIO;
+		goto eth_table_cleanup;
+	}
+
 	if (nfp_fw_setup(pci_dev, cpp, nfp_eth_table, hwinfo,
 			dev_info, &pf_dev->multi_pf, pf_dev->devargs.force_reload_fw) != 0) {
 		PMD_INIT_LOG(ERR, "Error when uploading firmware");
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.c b/drivers/net/nfp/nfpcore/nfp_nsp.c
index 6a2ba709ab..7dfb472723 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.c
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.c
@@ -80,6 +80,7 @@ enum nfp_nsp_cmd {
 	SPCODE_VERSIONS         = 21, /* Report FW versions */
 	SPCODE_READ_SFF_EEPROM  = 22, /* Read module EEPROM */
 	SPCODE_READ_MEDIA       = 23, /* Get the supported/advertised media for a port */
+	SPCODE_DEV_ACTIVATE	= 29, /* Activate hardware for multiple pfs case */
 };
 
 static const struct {
@@ -729,6 +730,15 @@ nfp_nsp_hwinfo_set(struct nfp_nsp *state,
 	return nfp_nsp_command_buf(state, &hwinfo_set);
 }
 
+int
+nfp_nsp_device_activate(struct nfp_nsp *state)
+{
+	if (nfp_nsp_get_abi_ver_minor(state) < 38)
+		return -EOPNOTSUPP;
+
+	return nfp_nsp_command(state, SPCODE_DEV_ACTIVATE);
+}
+
 int
 nfp_nsp_read_media(struct nfp_nsp *state,
 		void *buf,
diff --git a/drivers/net/nfp/nfpcore/nfp_nsp.h b/drivers/net/nfp/nfpcore/nfp_nsp.h
index 2ce05c2ec9..003cdc5fa3 100644
--- a/drivers/net/nfp/nfpcore/nfp_nsp.h
+++ b/drivers/net/nfp/nfpcore/nfp_nsp.h
@@ -16,6 +16,7 @@ uint16_t nfp_nsp_get_abi_ver_major(struct nfp_nsp *state);
 uint16_t nfp_nsp_get_abi_ver_minor(struct nfp_nsp *state);
 int nfp_nsp_wait(struct nfp_nsp *state);
 int nfp_nsp_device_soft_reset(struct nfp_nsp *state);
+int nfp_nsp_device_activate(struct nfp_nsp *state);
 int nfp_nsp_load_fw(struct nfp_nsp *state, void *buf, size_t size);
 int nfp_nsp_mac_reinit(struct nfp_nsp *state);
 int nfp_nsp_read_identify(struct nfp_nsp *state, void *buf, size_t size);
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 23/23] net/nfp: add support of flower firmware with multiple PF
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (21 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 22/23] net/nfp: add device active command for nsp service Chaoyong He
@ 2024-06-19  9:58 ` Chaoyong He
  2024-07-07 18:56 ` [PATCH 00/23] support " Ferruh Yigit
  23 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-06-19  9:58 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Peng Zhang, Chaoyong He, Long Wu

From: Peng Zhang <peng.zhang@corigine.com>

Adjust the logic to also support the flower firmware
with multiple PF.

Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>
Reviewed-by: Long Wu <long.wu@corigine.com>
---
 drivers/net/nfp/nfp_ethdev.c | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index d560bd695f..9867db9729 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -1504,6 +1504,9 @@ nfp_enable_multi_pf(struct nfp_pf_dev *pf_dev)
 	struct nfp_cpp_area *area;
 	char name[RTE_ETH_NAME_MAX_LEN];
 
+	if (!pf_dev->multi_pf.enabled)
+		return 0;
+
 	memset(&net_hw, 0, sizeof(struct nfp_net_hw));
 
 	/* Map the symbol table */
@@ -1872,12 +1875,6 @@ nfp_fw_app_primary_init(struct nfp_net_hw_priv *hw_priv)
 
 	switch (pf_dev->app_fw_id) {
 	case NFP_APP_FW_CORE_NIC:
-		if (pf_dev->multi_pf.enabled) {
-			ret = nfp_enable_multi_pf(pf_dev);
-			if (ret != 0)
-				return ret;
-		}
-
 		PMD_INIT_LOG(INFO, "Initializing coreNIC");
 		ret = nfp_init_app_fw_nic(hw_priv);
 		if (ret != 0) {
@@ -2248,6 +2245,10 @@ nfp_pf_init(struct rte_pci_device *pci_dev)
 		goto mac_stats_cleanup;
 	}
 
+	ret = nfp_enable_multi_pf(pf_dev);
+	if (ret != 0)
+		goto vf_cfg_tbl_cleanup;
+
 	hw_priv->pf_dev = pf_dev;
 	hw_priv->dev_info = dev_info;
 
-- 
2.39.1


^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 01/23] net/nfp: fix dereference of null pointer
  2024-06-19  9:58 ` [PATCH 01/23] net/nfp: fix dereference of null pointer Chaoyong He
@ 2024-07-07 18:56   ` Ferruh Yigit
  2024-07-08  1:35     ` Chaoyong He
  0 siblings, 1 reply; 27+ messages in thread
From: Ferruh Yigit @ 2024-07-07 18:56 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers, Peng Zhang, stable

On 6/19/2024 10:58 AM, Chaoyong He wrote:
> From: Peng Zhang <peng.zhang@corigine.com>
> 
> The original logic can call the uninitialized parameter 'process_private'
> to get 'struct nfp_net_hw_priv', so the null pointer will cause a segment
> fault problem.
> 
> This commit will add the "struct nfp_repr_init" as the parameter,
> it includes "struct nfp_net_hw_priv", it can fix this bug.
> 
> Fixes: 149850c5b8ec ("net/nfp: support xstats for flower firmware")
> Cc: chaoyong.he@corigine.com
> Cc: stable@dpdk.org
> 
> Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
>

Hi Chaoyong,

As maintainer of the driver, I expect your review on the patch, and
since whole series has it but not this one, I assume it is just missed,
I am adding and explicit review tag to the patch:

Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

If this was not the intention or you are not agree with the patch,
please let me know and I can drop the patch from next-net.

Also fixes tag is wrong, it should be:
  Fixes: 82a2c286f35a ("net/nfp: support xstats for flower firmware")

^ permalink raw reply	[flat|nested] 27+ messages in thread

* Re: [PATCH 00/23] support flower firmware with multiple PF
  2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
                   ` (22 preceding siblings ...)
  2024-06-19  9:58 ` [PATCH 23/23] net/nfp: add support of flower firmware with multiple PF Chaoyong He
@ 2024-07-07 18:56 ` Ferruh Yigit
  23 siblings, 0 replies; 27+ messages in thread
From: Ferruh Yigit @ 2024-07-07 18:56 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 6/19/2024 10:58 AM, Chaoyong He wrote:
> This patch series refactor some data structure and logic in order
> to support the flower firmware with multiple PF.
> 
> Peng Zhang (23):
>   net/nfp: fix dereference of null pointer
>   net/nfp: disable ctrl VNIC queues
>   net/nfp: fix dereference of null pointer
>   net/nfp: fix repeat disable the port
>   net/nfp: fix repeat set the speed configure
>   net/nfp: make the logic simpler by adding local variable
>   net/nfp: rename the variable name
>   net/nfp: export function ID get interface
>   net/nfp: extract total phyports
>   net/nfp: extract the initialize helper function
>   net/nfp: get the VF configuration
>   net/nfp: refactor the logic of flower service
>   net/nfp: get the first VF ID of the PF
>   net/nfp: add the helper function to map rtsym with offset
>   net/nfp: add the VF table to record the VF information
>   net/nfp: support configuration of VF numbers
>   net/nfp: configure the VF queue
>   net/nfp: add check for numbers of VF representor port
>   net/nfp: add support of ring pop and push
>   net/nfp: add resource share mode of host context
>   net/nfp: add resource share mode of mask ID
>   net/nfp: add device active command for nsp service
>   net/nfp: add support of flower firmware with multiple PF
>

Series applied to dpdk-next-net/main, thanks.

^ permalink raw reply	[flat|nested] 27+ messages in thread

* RE: [PATCH 01/23] net/nfp: fix dereference of null pointer
  2024-07-07 18:56   ` Ferruh Yigit
@ 2024-07-08  1:35     ` Chaoyong He
  0 siblings, 0 replies; 27+ messages in thread
From: Chaoyong He @ 2024-07-08  1:35 UTC (permalink / raw)
  To: Ferruh Yigit, dev; +Cc: oss-drivers, Nole Zhang, stable

> > Fixes: 149850c5b8ec ("net/nfp: support xstats for flower firmware")
> > Cc: chaoyong.he@corigine.com
> > Cc: stable@dpdk.org
> >
> > Signed-off-by: Peng Zhang <peng.zhang@corigine.com>
> >
> 
> Hi Chaoyong,
> 
> As maintainer of the driver, I expect your review on the patch, and since whole
> series has it but not this one, I assume it is just missed, I am adding and explicit
> review tag to the patch:
> 
> Reviewed-by: Chaoyong He <chaoyong.he@corigine.com>

Sorry, it's my fault. I will be more carefully check about the tags in the future.

> If this was not the intention or you are not agree with the patch, please let me
> know and I can drop the patch from next-net.
> 
> Also fixes tag is wrong, it should be:
>   Fixes: 82a2c286f35a ("net/nfp: support xstats for flower firmware")

Yes, it does my problem.
I  will check again with the script before I send out the patch next time.
Really thanks to point out a leak of my workflow!

^ permalink raw reply	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2024-07-08  1:35 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-06-19  9:58 [PATCH 00/23] support flower firmware with multiple PF Chaoyong He
2024-06-19  9:58 ` [PATCH 01/23] net/nfp: fix dereference of null pointer Chaoyong He
2024-07-07 18:56   ` Ferruh Yigit
2024-07-08  1:35     ` Chaoyong He
2024-06-19  9:58 ` [PATCH 02/23] net/nfp: disable ctrl VNIC queues Chaoyong He
2024-06-19  9:58 ` [PATCH 03/23] net/nfp: fix dereference of null pointer Chaoyong He
2024-06-19  9:58 ` [PATCH 04/23] net/nfp: fix repeat disable the port Chaoyong He
2024-06-19  9:58 ` [PATCH 05/23] net/nfp: fix repeat set the speed configure Chaoyong He
2024-06-19  9:58 ` [PATCH 06/23] net/nfp: make the logic simpler by adding local variable Chaoyong He
2024-06-19  9:58 ` [PATCH 07/23] net/nfp: rename the variable name Chaoyong He
2024-06-19  9:58 ` [PATCH 08/23] net/nfp: export function ID get interface Chaoyong He
2024-06-19  9:58 ` [PATCH 09/23] net/nfp: extract total phyports Chaoyong He
2024-06-19  9:58 ` [PATCH 10/23] net/nfp: extract the initialize helper function Chaoyong He
2024-06-19  9:58 ` [PATCH 11/23] net/nfp: get the VF configuration Chaoyong He
2024-06-19  9:58 ` [PATCH 12/23] net/nfp: refactor the logic of flower service Chaoyong He
2024-06-19  9:58 ` [PATCH 13/23] net/nfp: get the first VF ID of the PF Chaoyong He
2024-06-19  9:58 ` [PATCH 14/23] net/nfp: add the helper function to map rtsym with offset Chaoyong He
2024-06-19  9:58 ` [PATCH 15/23] net/nfp: add the VF table to record the VF information Chaoyong He
2024-06-19  9:58 ` [PATCH 16/23] net/nfp: support configuration of VF numbers Chaoyong He
2024-06-19  9:58 ` [PATCH 17/23] net/nfp: configure the VF queue Chaoyong He
2024-06-19  9:58 ` [PATCH 18/23] net/nfp: add check for numbers of VF representor port Chaoyong He
2024-06-19  9:58 ` [PATCH 19/23] net/nfp: add support of ring pop and push Chaoyong He
2024-06-19  9:58 ` [PATCH 20/23] net/nfp: add resource share mode of host context Chaoyong He
2024-06-19  9:58 ` [PATCH 21/23] net/nfp: add resource share mode of mask ID Chaoyong He
2024-06-19  9:58 ` [PATCH 22/23] net/nfp: add device active command for nsp service Chaoyong He
2024-06-19  9:58 ` [PATCH 23/23] net/nfp: add support of flower firmware with multiple PF Chaoyong He
2024-07-07 18:56 ` [PATCH 00/23] support " 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).