net/bnxt: return -EBUSY if port is active during MTU change

Message ID 20220915112906.4487-1-benjamin.le_berre@6wind.com (mailing list archive)
State Accepted, archived
Delegated to: Ajit Khaparde
Headers
Series net/bnxt: return -EBUSY if port is active during MTU change |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-aarch64-unit-testing success Testing PASS
ci/iol-aarch64-compile-testing success Testing PASS
ci/iol-x86_64-unit-testing success Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/iol-x86_64-compile-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/github-robot: build success github build: passed
ci/Intel-compilation success Compilation OK
ci/intel-Testing success Testing PASS

Commit Message

Benjamin Le Berre Sept. 15, 2022, 11:29 a.m. UTC
  When the BNXT PMD was made to disallow MTU changes on active ports, the
error code chosen for the case in bnxt_set_mtu_op() was -EPERM.

The doc comment for rte_eth_dev_set_mtu() in lib/ethdev/rte_ethdev.h
lists -EBUSY as the value to be used if the port must be stopped before
applying an MTU change and does not list -EPERM as a possible return
value.

This patch makes bnxt_set_mtu_op() return -EBUSY instead of -EPERM so
that rte_eth_dev_set_mtu() behaves as expected.

Fixes: a42ab1eb33ff ("net/bnxt: disallow MTU change when device is started")

Signed-off-by: Benjamin Le Berre <benjamin.le_berre@6wind.com>
---
Hi,

Should I Cc stable@dpdk.org?

Thanks,
Benjamin.

 drivers/net/bnxt/bnxt_ethdev.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
  

Comments

Ajit Khaparde Oct. 4, 2022, 3:53 a.m. UTC | #1
On Thu, Sep 15, 2022 at 4:29 AM Benjamin Le Berre
<benjamin.le_berre@6wind.com> wrote:
>
> When the BNXT PMD was made to disallow MTU changes on active ports, the
> error code chosen for the case in bnxt_set_mtu_op() was -EPERM.
>
> The doc comment for rte_eth_dev_set_mtu() in lib/ethdev/rte_ethdev.h
> lists -EBUSY as the value to be used if the port must be stopped before
> applying an MTU change and does not list -EPERM as a possible return
> value.
>
> This patch makes bnxt_set_mtu_op() return -EBUSY instead of -EPERM so
> that rte_eth_dev_set_mtu() behaves as expected.
>
> Fixes: a42ab1eb33ff ("net/bnxt: disallow MTU change when device is started")
>
> Signed-off-by: Benjamin Le Berre <benjamin.le_berre@6wind.com>
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

> ---
> Hi,
>
> Should I Cc stable@dpdk.org?

I just added it to Cc. Hopefully it works.
Updated the commit headline to
net/bnxt: fix return status during MTU change

Patch merged to dpdk-next-net-brcm. Thanks

>
> Thanks,
> Benjamin.
>
>  drivers/net/bnxt/bnxt_ethdev.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index e275d3a53fda..c07a41c693da 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -3030,7 +3030,7 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
>         /* Return if port is active */
>         if (eth_dev->data->dev_started) {
>                 PMD_DRV_LOG(ERR, "Stop port before changing MTU\n");
> -               return -EPERM;
> +               return -EBUSY;
>         }
>
>         /* Exit if receive queues are not configured yet */
> --
> 2.30.2
>
  

Patch

diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e275d3a53fda..c07a41c693da 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -3030,7 +3030,7 @@  int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
 	/* Return if port is active */
 	if (eth_dev->data->dev_started) {
 		PMD_DRV_LOG(ERR, "Stop port before changing MTU\n");
-		return -EPERM;
+		return -EBUSY;
 	}
 
 	/* Exit if receive queues are not configured yet */