[1/3] net/octeontx2: handle link status when device stopped

Message ID 1625676557-2269-1-git-send-email-skoteshwar@marvell.com (mailing list archive)
State Accepted, archived
Delegated to: Jerin Jacob
Headers
Series [1/3] net/octeontx2: handle link status when device stopped |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Satha Koteswara Rao Kottidi July 7, 2021, 4:49 p.m. UTC
  From: Satha Rao <skoteshwar@marvell.com>

Set link status to down and don't fetch link status from kernel
when device in stopped state.

Signed-off-by: Satha Rao <skoteshwar@marvell.com>
---
 drivers/net/octeontx2/otx2_ethdev.c | 5 +++++
 drivers/net/octeontx2/otx2_link.c   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
  

Comments

Jerin Jacob July 13, 2021, 9:32 a.m. UTC | #1
On Wed, Jul 7, 2021 at 10:20 PM <skoteshwar@marvell.com> wrote:
>
> From: Satha Rao <skoteshwar@marvell.com>
>
> Set link status to down and don't fetch link status from kernel
> when device in stopped state.
>
> Signed-off-by: Satha Rao <skoteshwar@marvell.com>


Series Acked-by: Jerin Jacob <jerinj@marvell.com>
Series applied to dpdk-next-net-mrvl/for-dpdk-main. Thanks.

> ---
>  drivers/net/octeontx2/otx2_ethdev.c | 5 +++++
>  drivers/net/octeontx2/otx2_link.c   | 2 +-
>  2 files changed, 6 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
> index 84225f4..ac53d8c 100644
> --- a/drivers/net/octeontx2/otx2_ethdev.c
> +++ b/drivers/net/octeontx2/otx2_ethdev.c
> @@ -2171,6 +2171,7 @@
>         struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
>         struct rte_mbuf *rx_pkts[32];
>         struct otx2_eth_rxq *rxq;
> +       struct rte_eth_link link;
>         int count, i, j, rc;
>
>         nix_lf_switch_header_type_enable(dev, false);
> @@ -2196,6 +2197,10 @@
>         for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
>                 otx2_nix_tx_queue_stop(eth_dev, i);
>
> +       /* Bring down link status internally */
> +       memset(&link, 0, sizeof(link));
> +       rte_eth_linkstatus_set(eth_dev, &link);
> +
>         return 0;
>  }
>
> diff --git a/drivers/net/octeontx2/otx2_link.c b/drivers/net/octeontx2/otx2_link.c
> index 5378e5c..81dd624 100644
> --- a/drivers/net/octeontx2/otx2_link.c
> +++ b/drivers/net/octeontx2/otx2_link.c
> @@ -148,7 +148,7 @@
>         RTE_SET_USED(wait_to_complete);
>         memset(&link, 0, sizeof(struct rte_eth_link));
>
> -       if (otx2_dev_is_sdp(dev))
> +       if (!eth_dev->data->dev_started || otx2_dev_is_sdp(dev))
>                 return 0;
>
>         if (otx2_dev_is_lbk(dev))
> --
> 1.8.3.1
>
  

Patch

diff --git a/drivers/net/octeontx2/otx2_ethdev.c b/drivers/net/octeontx2/otx2_ethdev.c
index 84225f4..ac53d8c 100644
--- a/drivers/net/octeontx2/otx2_ethdev.c
+++ b/drivers/net/octeontx2/otx2_ethdev.c
@@ -2171,6 +2171,7 @@ 
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
 	struct rte_mbuf *rx_pkts[32];
 	struct otx2_eth_rxq *rxq;
+	struct rte_eth_link link;
 	int count, i, j, rc;
 
 	nix_lf_switch_header_type_enable(dev, false);
@@ -2196,6 +2197,10 @@ 
 	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
 		otx2_nix_tx_queue_stop(eth_dev, i);
 
+	/* Bring down link status internally */
+	memset(&link, 0, sizeof(link));
+	rte_eth_linkstatus_set(eth_dev, &link);
+
 	return 0;
 }
 
diff --git a/drivers/net/octeontx2/otx2_link.c b/drivers/net/octeontx2/otx2_link.c
index 5378e5c..81dd624 100644
--- a/drivers/net/octeontx2/otx2_link.c
+++ b/drivers/net/octeontx2/otx2_link.c
@@ -148,7 +148,7 @@ 
 	RTE_SET_USED(wait_to_complete);
 	memset(&link, 0, sizeof(struct rte_eth_link));
 
-	if (otx2_dev_is_sdp(dev))
+	if (!eth_dev->data->dev_started || otx2_dev_is_sdp(dev))
 		return 0;
 
 	if (otx2_dev_is_lbk(dev))