[PATCH] net/cnxk: toggle link status for representors
Harman Kalra
hkalra at marvell.com
Thu Nov 14 10:39:15 CET 2024
Representor port link status should be toggled based on representee
state i.e. if representee comes up representor link status should be
up while when representee goes down representor port should indicate
the same.
Signed-off-by: Harman Kalra <hkalra at marvell.com>
---
drivers/net/cnxk/cnxk_rep_ops.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
diff --git a/drivers/net/cnxk/cnxk_rep_ops.c b/drivers/net/cnxk/cnxk_rep_ops.c
index 888842fa90..c88d28ff72 100644
--- a/drivers/net/cnxk/cnxk_rep_ops.c
+++ b/drivers/net/cnxk/cnxk_rep_ops.c
@@ -80,14 +80,12 @@ cnxk_rep_link_update(struct rte_eth_dev *ethdev, int wait_to_complete)
PLT_SET_USED(wait_to_complete);
memset(&link, 0, sizeof(link));
- if (ethdev->data->dev_started)
+ if (ethdev->data->dev_started) {
link.link_status = RTE_ETH_LINK_UP;
- else
- link.link_status = RTE_ETH_LINK_DOWN;
-
- link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
- link.link_autoneg = RTE_ETH_LINK_FIXED;
- link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
+ link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+ link.link_autoneg = RTE_ETH_LINK_FIXED;
+ link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
+ }
return rte_eth_linkstatus_set(ethdev, &link);
}
@@ -234,6 +232,7 @@ int
cnxk_rep_dev_start(struct rte_eth_dev *ethdev)
{
struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(ethdev);
+ struct rte_eth_link link;
int rc = 0, qid;
ethdev->rx_pkt_burst = cnxk_rep_rx_burst;
@@ -278,6 +277,13 @@ cnxk_rep_dev_start(struct rte_eth_dev *ethdev)
rep_dev->parent_dev->repr_cnt.nb_repr_started++;
+ link.link_status = RTE_ETH_LINK_UP;
+ link.link_duplex = RTE_ETH_LINK_FULL_DUPLEX;
+ link.link_autoneg = RTE_ETH_LINK_FIXED;
+ link.link_speed = RTE_ETH_SPEED_NUM_UNKNOWN;
+ rte_eth_linkstatus_set(ethdev, &link);
+ ethdev->data->dev_started = 1;
+
return 0;
fail:
return rc;
@@ -293,6 +299,7 @@ int
cnxk_rep_dev_stop(struct rte_eth_dev *ethdev)
{
struct cnxk_rep_dev *rep_dev = cnxk_rep_pmd_priv(ethdev);
+ struct rte_eth_link link;
ethdev->rx_pkt_burst = cnxk_rep_rx_burst_dummy;
ethdev->tx_pkt_burst = cnxk_rep_tx_burst_dummy;
@@ -300,6 +307,11 @@ cnxk_rep_dev_stop(struct rte_eth_dev *ethdev)
cnxk_rep_tx_queue_stop(ethdev, 0);
rep_dev->parent_dev->repr_cnt.nb_repr_started--;
+ /* Bring down link status internally */
+ memset(&link, 0, sizeof(link));
+ rte_eth_linkstatus_set(ethdev, &link);
+ ethdev->data->dev_started = 0;
+
return 0;
}
--
2.46.0.469.g4590f2e941
More information about the dev
mailing list