From: Harman Kalra <hkalra@marvell.com>
To: Nithin Dabilpuram <ndabilpuram@marvell.com>,
Kiran Kumar K <kirankumark@marvell.com>,
Sunil Kumar Kori <skori@marvell.com>,
Satha Rao <skoteshwar@marvell.com>,
Harman Kalra <hkalra@marvell.com>
Cc: <dev@dpdk.org>
Subject: [PATCH] net/cnxk: toggle link status for representors
Date: Thu, 14 Nov 2024 15:09:15 +0530 [thread overview]
Message-ID: <20241114093915.180971-1-hkalra@marvell.com> (raw)
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@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
reply other threads:[~2024-11-14 9:39 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20241114093915.180971-1-hkalra@marvell.com \
--to=hkalra@marvell.com \
--cc=dev@dpdk.org \
--cc=kirankumark@marvell.com \
--cc=ndabilpuram@marvell.com \
--cc=skori@marvell.com \
--cc=skoteshwar@marvell.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).