[1/3] net/nfp: fix the reconfigure logic in PF initialization

Message ID 20231028062315.1843075-2-chaoyong.he@corigine.com (mailing list archive)
State Accepted, archived
Delegated to: Ferruh Yigit
Headers
Series Fix some reconfigure problem |

Checks

Context Check Description
ci/checkpatch warning coding style issues

Commit Message

Chaoyong He Oct. 28, 2023, 6:23 a.m. UTC
  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(-)
  

Patch

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++)