[05/10] net/nfp: fix problem caused by configure function

Message ID 20241010091716.3631747-6-chaoyong.he@corigine.com (mailing list archive)
State Superseded
Delegated to: Ferruh Yigit
Headers
Series modify some logic of NFP PMD |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Chaoyong He Oct. 10, 2024, 9:17 a.m. UTC
The return value of 'nfp_eth_set_configured()' is three ways, the
original logic considered it as two ways wrongly.

Fixes: 61d4008fe6bb ("net/nfp: support setting link up/down")
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 | 14 ++++++++++++--
 1 file changed, 12 insertions(+), 2 deletions(-)
  

Comments

Stephen Hemminger Oct. 10, 2024, 3:13 p.m. UTC | #1
On Thu, 10 Oct 2024 17:17:11 +0800
Chaoyong He <chaoyong.he@corigine.com> wrote:

> The return value of 'nfp_eth_set_configured()' is three ways, the
> original logic considered it as two ways wrongly.
> 
> Fixes: 61d4008fe6bb ("net/nfp: support setting link up/down")
> 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>

Maybe refering to the return values in nfp_nsp_eth.c would be clearer
but makes sense.

Acked-by: Stephen Hemminger <stephen@networkplumber.org>
  

Patch

diff --git a/drivers/net/nfp/nfp_ethdev.c b/drivers/net/nfp/nfp_ethdev.c
index 405386e882..2fe6b1a292 100644
--- a/drivers/net/nfp/nfp_ethdev.c
+++ b/drivers/net/nfp/nfp_ethdev.c
@@ -527,26 +527,36 @@  nfp_net_start(struct rte_eth_dev *dev)
 static int
 nfp_net_set_link_up(struct rte_eth_dev *dev)
 {
+	int ret;
 	struct nfp_net_hw *hw;
 	struct nfp_net_hw_priv *hw_priv;
 
 	hw = dev->data->dev_private;
 	hw_priv = dev->process_private;
 
-	return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1);
+	ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 1);
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 /* Set the link down. */
 static int
 nfp_net_set_link_down(struct rte_eth_dev *dev)
 {
+	int ret;
 	struct nfp_net_hw *hw;
 	struct nfp_net_hw_priv *hw_priv;
 
 	hw = dev->data->dev_private;
 	hw_priv = dev->process_private;
 
-	return nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
+	ret = nfp_eth_set_configured(hw_priv->pf_dev->cpp, hw->nfp_idx, 0);
+	if (ret < 0)
+		return ret;
+
+	return 0;
 }
 
 static void