Skip to contentSkip to conversation

net/octeontx2: handle link status when device stopped

PATCH In review [email protected] 2 participants 4 messages Jul 7, 2021 – Jul 13, 2021 Network drivers

lore
Share & tools
lore
#0 lore raw

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

From: Satha Rao <[email protected]>

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

---
 drivers/net/octeontx2/otx2_ethdev.c | 5 +++++
 drivers/net/octeontx2/otx2_link.c   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.c +5 -0
index 84225f4..ac53d8c 100644
@@ -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;
 }
 
drivers/net/octeontx2/otx2_link.c +1 -1
index 5378e5c..81dd624 100644
@@ -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))
Signature · 1 line
1.8.3.1
#1 lore raw

PATCH 2/3 net/octeontx2: get tm node stats after resource allocated

From: Satha Rao <[email protected]>

We are getting kernel crash while reading tm node stats when tm hierarchy is not committed. Until hierarchy committed hardware resources are not allocated for node, this causes mbox timeout. This patch check for status of HW resources before reading statistics.

---
 drivers/net/octeontx2/otx2_tm.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/net/octeontx2/otx2_tm.c +6 -0
index fdd5669..6aff1f9 100644
@@ -2769,6 +2769,12 @@ int otx2_nix_sq_enable(void *_txq)
 		return -EINVAL;
 	}
 
+	if (!(tm_node->flags & NIX_TM_NODE_HWRES)) {
+		error->type = RTE_TM_ERROR_TYPE_NODE_ID;
+		error->message = "HW resources not allocated";
+		return -EINVAL;
+	}
+
 	/* Stats support only for leaf node or TL1 root */
 	if (nix_tm_is_leaf(dev, tm_node->lvl)) {
 		reg = (((uint64_t)tm_node->id) << 32);
Signature · 1 line
1.8.3.1
#2 lore raw

PATCH 3/3 net/cnxk: update link status when device stopped

In reply to [email protected]

From: Satha Rao <[email protected]>

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

---
 drivers/net/cnxk/cnxk_ethdev.c | 5 +++++
 drivers/net/cnxk/cnxk_link.c   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/cnxk/cnxk_ethdev.c +5 -0
index 7adab46..0e3652e 100644
@@ -1096,6 +1096,7 @@
 	struct cnxk_eth_dev *dev = cnxk_eth_pmd_priv(eth_dev);
 	const struct eth_dev_ops *dev_ops = eth_dev->dev_ops;
 	struct rte_mbuf *rx_pkts[32];
+	struct rte_eth_link link;
 	int count, i, j, rc;
 	void *rxq;
 
@@ -1128,6 +1129,10 @@
 	for (i = 0; i < eth_dev->data->nb_tx_queues; i++)
 		dev_ops->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;
 }
 
drivers/net/cnxk/cnxk_link.c +1 -1
index caf35ee..3fdbdba 100644
@@ -90,7 +90,7 @@
 	RTE_SET_USED(wait_to_complete);
 	memset(&link, 0, sizeof(struct rte_eth_link));
 
-	if (roc_nix_is_sdp(&dev->nix))
+	if (!eth_dev->data->dev_started || roc_nix_is_sdp(&dev->nix))
 		return 0;
 
 	if (roc_nix_is_lbk(&dev->nix)) {
Signature · 1 line
1.8.3.1
#3 lore raw
In reply to [email protected]
Quoted 7 lines · On Wed, Jul 7, 2021 at 10:20 PM <[email protected]> wrote:

From: Satha Rao <[email protected]>

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

Series Acked-by: Jerin Jacob <[email protected]> Series applied to dpdk-next-net-mrvl/for-dpdk-main. Thanks.

Quoted 44 lines
---
 drivers/net/octeontx2/otx2_ethdev.c | 5 +++++
 drivers/net/octeontx2/otx2_link.c   | 2 +-
 2 files changed, 6 insertions(+), 1 deletion(-)
drivers/net/octeontx2/otx2_ethdev.c +5 -0
index 84225f4..ac53d8c 100644
@@ -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;
 }
 
drivers/net/octeontx2/otx2_link.c +1 -2
index 5378e5c..81dd624 100644
@@ -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