[1/2] net/bnxt: fix link state operations
Checks
Commit Message
From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
VFs does not have the privilege to change link configuration.
But the driver silently returns success to these ethdev callbacks
without actually issuing the HWRM command to bring the link up/down.
Fixes: 5c206086feaa ("net/bnxt: add link state operations")
Cc: stable@dpdk.org
Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
---
drivers/net/bnxt/bnxt_ethdev.c | 6 ++++++
1 file changed, 6 insertions(+)
Comments
On Thu, Mar 18, 2021 at 2:13 AM Kalesh A P
<kalesh-anakkur.purayil@broadcom.com> wrote:
>
> From: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
>
> VFs does not have the privilege to change link configuration.
> But the driver silently returns success to these ethdev callbacks
> without actually issuing the HWRM command to bring the link up/down.
>
> Fixes: 5c206086feaa ("net/bnxt: add link state operations")
> Cc: stable@dpdk.org
>
> Signed-off-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com>
> Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com>
> Reviewed-by: Ajit Kumar Khaparde <ajit.khaparde@broadcom.com>
Patch applied to dpdk-next-net-brcm.
> ---
> drivers/net/bnxt/bnxt_ethdev.c | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
> index 1997783..3665f31 100644
> --- a/drivers/net/bnxt/bnxt_ethdev.c
> +++ b/drivers/net/bnxt/bnxt_ethdev.c
> @@ -1268,6 +1268,9 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
> struct bnxt *bp = eth_dev->data->dev_private;
> int rc = 0;
>
> + if (!BNXT_SINGLE_PF(bp))
> + return -ENOTSUP;
> +
> if (!bp->link_info->link_up)
> rc = bnxt_set_hwrm_link_config(bp, true);
> if (!rc)
> @@ -1281,6 +1284,9 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
> {
> struct bnxt *bp = eth_dev->data->dev_private;
>
> + if (!BNXT_SINGLE_PF(bp))
> + return -ENOTSUP;
> +
> eth_dev->data->dev_link.link_status = 0;
> bnxt_set_hwrm_link_config(bp, false);
> bp->link_info->link_up = 0;
> --
> 2.10.1
>
@@ -1268,6 +1268,9 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
struct bnxt *bp = eth_dev->data->dev_private;
int rc = 0;
+ if (!BNXT_SINGLE_PF(bp))
+ return -ENOTSUP;
+
if (!bp->link_info->link_up)
rc = bnxt_set_hwrm_link_config(bp, true);
if (!rc)
@@ -1281,6 +1284,9 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
{
struct bnxt *bp = eth_dev->data->dev_private;
+ if (!BNXT_SINGLE_PF(bp))
+ return -ENOTSUP;
+
eth_dev->data->dev_link.link_status = 0;
bnxt_set_hwrm_link_config(bp, false);
bp->link_info->link_up = 0;