Skip to content

Commit

Permalink
net/nfp: fix link change return value
Browse files Browse the repository at this point in the history
[ upstream commit 0ca4f216b89162ce8142d665a98924bdf4a23a6e ]

The return value of 'nfp_eth_set_configured()' is three ways, the
original logic considered it as two ways wrongly.

Fixes: 61d4008 ("net/nfp: support setting link up/down")

Signed-off-by: Chaoyong He <[email protected]>
Reviewed-by: Long Wu <[email protected]>
Reviewed-by: Peng Zhang <[email protected]>
Acked-by: Stephen Hemminger <[email protected]>
  • Loading branch information
hechaoyong authored and kevintraynor committed Nov 27, 2024
1 parent 5c3cc79 commit f39ddff
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions drivers/net/nfp/nfp_ethdev.c
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ nfp_net_start(struct rte_eth_dev *dev)
static int
nfp_net_stop(struct rte_eth_dev *dev)
{
int ret;
int i;
struct nfp_net_hw *hw;
struct nfp_net_txq *this_tx_q;
Expand All @@ -240,10 +241,12 @@ nfp_net_stop(struct rte_eth_dev *dev)

if (rte_eal_process_type() == RTE_PROC_PRIMARY)
/* Configure the physical port down */
nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
ret = nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
else
nfp_eth_set_configured(dev->process_private,
ret = nfp_eth_set_configured(dev->process_private,
hw->nfp_idx, 0);
if (ret < 0)
return ret;

return 0;
}
Expand All @@ -252,6 +255,7 @@ nfp_net_stop(struct rte_eth_dev *dev)
static int
nfp_net_set_link_up(struct rte_eth_dev *dev)
{
int ret;
struct nfp_net_hw *hw;

PMD_DRV_LOG(DEBUG, "Set link up");
Expand All @@ -260,16 +264,21 @@ nfp_net_set_link_up(struct rte_eth_dev *dev)

if (rte_eal_process_type() == RTE_PROC_PRIMARY)
/* Configure the physical port down */
return nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 1);
ret = nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 1);
else
return nfp_eth_set_configured(dev->process_private,
ret = nfp_eth_set_configured(dev->process_private,
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;

PMD_DRV_LOG(DEBUG, "Set link down");
Expand All @@ -278,10 +287,14 @@ nfp_net_set_link_down(struct rte_eth_dev *dev)

if (rte_eal_process_type() == RTE_PROC_PRIMARY)
/* Configure the physical port down */
return nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
ret = nfp_eth_set_configured(hw->cpp, hw->nfp_idx, 0);
else
return nfp_eth_set_configured(dev->process_private,
ret = nfp_eth_set_configured(dev->process_private,
hw->nfp_idx, 0);
if (ret < 0)
return ret;

return 0;
}

/* Reset and stop device. The device can not be restarted. */
Expand Down

0 comments on commit f39ddff

Please sign in to comment.