DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH 0/3] Fix some reconfigure problem
@ 2023-10-28  6:23 Chaoyong He
  2023-10-28  6:23 ` [PATCH 1/3] net/nfp: fix the reconfigure logic in PF initialization Chaoyong He
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Chaoyong He @ 2023-10-28  6:23 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He

This patch series fix some problems about reconfiguration logic.

Chaoyong He (3):
  net/nfp: fix the reconfigure logic in PF initialization
  net/nfp: fix the reconfigure logic in VF initialization
  net/nfp: fix the reconfigure logic of set mac address

 drivers/net/nfp/nfp_ethdev.c     |  4 ++--
 drivers/net/nfp/nfp_ethdev_vf.c  |  4 ++--
 drivers/net/nfp/nfp_net_common.c | 10 ++++++----
 3 files changed, 10 insertions(+), 8 deletions(-)

-- 
2.39.1


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

* [PATCH 1/3] net/nfp: fix the reconfigure logic in PF initialization
  2023-10-28  6:23 [PATCH 0/3] Fix some reconfigure problem Chaoyong He
@ 2023-10-28  6:23 ` Chaoyong He
  2023-10-28  6:23 ` [PATCH 2/3] net/nfp: fix the reconfigure logic in VF initialization Chaoyong He
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2023-10-28  6:23 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

There exists exit point between the reconfigure logic and the stroe
logic of the PF initialization, this may lead one situation that value
in the config bar is not same with the value stored in the data
structure.

Fix this by move up the store statement.

Fixes: b812daadad0d ("nfp: add Rx and Tx")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 76317925ec..0a0e3d6375 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -141,6 +141,8 @@ nfp_net_start(struct rte_eth_dev *dev)
 	if (nfp_reconfig(hw, new_ctrl, update) != 0)
 		return -EIO;
 
+	hw->ctrl = new_ctrl;
+
 	/* Enable packet type offload by extend ctrl word1. */
 	cap_extend = hw->cap_ext;
 	if ((cap_extend & NFP_NET_CFG_CTRL_PKT_TYPE) != 0)
@@ -171,8 +173,6 @@ nfp_net_start(struct rte_eth_dev *dev)
 	else
 		nfp_eth_set_configured(dev->process_private, net_hw->nfp_idx, 1);
 
-	hw->ctrl = new_ctrl;
-
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
-- 
2.39.1


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

* [PATCH 2/3] net/nfp: fix the reconfigure logic in VF initialization
  2023-10-28  6:23 [PATCH 0/3] Fix some reconfigure problem Chaoyong He
  2023-10-28  6:23 ` [PATCH 1/3] net/nfp: fix the reconfigure logic in PF initialization Chaoyong He
@ 2023-10-28  6:23 ` Chaoyong He
  2023-10-28  6:23 ` [PATCH 3/3] net/nfp: fix the reconfigure logic of set mac address Chaoyong He
  2023-10-31 12:55 ` [PATCH 0/3] Fix some reconfigure problem Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2023-10-28  6:23 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

There exists exit point between the reconfigure logic and the stroe
logic of the VF initialization, this may lead one situation that value
in the config bar is not same with the value stored in the data
structure.

Fix this by move up the store statement.

Fixes: 7f8e73201dae ("net/nfp: move VF functions into its own file")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/nfp/nfp_ethdev_vf.c b/drivers/net/nfp/nfp_ethdev_vf.c
index b9cfb48021..2d08a07913 100644
--- a/drivers/net/nfp/nfp_ethdev_vf.c
+++ b/drivers/net/nfp/nfp_ethdev_vf.c
@@ -91,6 +91,8 @@ nfp_netvf_start(struct rte_eth_dev *dev)
 	if (nfp_reconfig(hw, new_ctrl, update) != 0)
 		return -EIO;
 
+	hw->ctrl = new_ctrl;
+
 	/*
 	 * Allocating rte mbufs for configured rx queues.
 	 * This requires queues being enabled before.
@@ -100,8 +102,6 @@ nfp_netvf_start(struct rte_eth_dev *dev)
 		goto error;
 	}
 
-	hw->ctrl = new_ctrl;
-
 	for (i = 0; i < dev->data->nb_rx_queues; i++)
 		dev->data->rx_queue_state[i] = RTE_ETH_QUEUE_STATE_STARTED;
 	for (i = 0; i < dev->data->nb_tx_queues; i++)
-- 
2.39.1


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

* [PATCH 3/3] net/nfp: fix the reconfigure logic of set mac address
  2023-10-28  6:23 [PATCH 0/3] Fix some reconfigure problem Chaoyong He
  2023-10-28  6:23 ` [PATCH 1/3] net/nfp: fix the reconfigure logic in PF initialization Chaoyong He
  2023-10-28  6:23 ` [PATCH 2/3] net/nfp: fix the reconfigure logic in VF initialization Chaoyong He
@ 2023-10-28  6:23 ` Chaoyong He
  2023-10-31 12:55 ` [PATCH 0/3] Fix some reconfigure problem Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Chaoyong He @ 2023-10-28  6:23 UTC (permalink / raw)
  To: dev; +Cc: oss-drivers, Chaoyong He, stable, Long Wu, Peng Zhang

If the reconfigure API exit abnormally, the value in the config bar
will not same with the value stored in the data structure.

Fix this by add a local variable to hold the temporary value and the
logic of store it when no error happen.

Fixes: 2fe669f4bcd2 ("net/nfp: support MAC address change")
Cc: stable@dpdk.org

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

diff --git a/drivers/net/nfp/nfp_net_common.c b/drivers/net/nfp/nfp_net_common.c
index ac97e3bed5..a4ba16445d 100644
--- a/drivers/net/nfp/nfp_net_common.c
+++ b/drivers/net/nfp/nfp_net_common.c
@@ -362,8 +362,8 @@ int
 nfp_net_set_mac_addr(struct rte_eth_dev *dev,
 		struct rte_ether_addr *mac_addr)
 {
-	uint32_t ctrl;
 	uint32_t update;
+	uint32_t new_ctrl;
 	struct nfp_hw *hw;
 	struct nfp_net_hw *net_hw;
 
@@ -379,17 +379,19 @@ nfp_net_set_mac_addr(struct rte_eth_dev *dev,
 	nfp_write_mac(hw, (uint8_t *)mac_addr);
 
 	update = NFP_NET_CFG_UPDATE_MACADDR;
-	ctrl = hw->ctrl;
+	new_ctrl = hw->ctrl;
 	if ((hw->ctrl & NFP_NET_CFG_CTRL_ENABLE) != 0 &&
 			(hw->cap & NFP_NET_CFG_CTRL_LIVE_ADDR) != 0)
-		ctrl |= NFP_NET_CFG_CTRL_LIVE_ADDR;
+		new_ctrl |= NFP_NET_CFG_CTRL_LIVE_ADDR;
 
 	/* Signal the NIC about the change */
-	if (nfp_reconfig(hw, ctrl, update) != 0) {
+	if (nfp_reconfig(hw, new_ctrl, update) != 0) {
 		PMD_DRV_LOG(ERR, "MAC address update failed");
 		return -EIO;
 	}
 
+	hw->ctrl = new_ctrl;
+
 	return 0;
 }
 
-- 
2.39.1


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

* Re: [PATCH 0/3] Fix some reconfigure problem
  2023-10-28  6:23 [PATCH 0/3] Fix some reconfigure problem Chaoyong He
                   ` (2 preceding siblings ...)
  2023-10-28  6:23 ` [PATCH 3/3] net/nfp: fix the reconfigure logic of set mac address Chaoyong He
@ 2023-10-31 12:55 ` Ferruh Yigit
  3 siblings, 0 replies; 5+ messages in thread
From: Ferruh Yigit @ 2023-10-31 12:55 UTC (permalink / raw)
  To: Chaoyong He, dev; +Cc: oss-drivers

On 10/28/2023 7:23 AM, Chaoyong He wrote:
> This patch series fix some problems about reconfiguration logic.
> 
> Chaoyong He (3):
>   net/nfp: fix the reconfigure logic in PF initialization
>   net/nfp: fix the reconfigure logic in VF initialization
>   net/nfp: fix the reconfigure logic of set mac address
> 
>  

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


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

end of thread, other threads:[~2023-10-31 12:55 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-10-28  6:23 [PATCH 0/3] Fix some reconfigure problem Chaoyong He
2023-10-28  6:23 ` [PATCH 1/3] net/nfp: fix the reconfigure logic in PF initialization Chaoyong He
2023-10-28  6:23 ` [PATCH 2/3] net/nfp: fix the reconfigure logic in VF initialization Chaoyong He
2023-10-28  6:23 ` [PATCH 3/3] net/nfp: fix the reconfigure logic of set mac address Chaoyong He
2023-10-31 12:55 ` [PATCH 0/3] Fix some reconfigure problem 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).