DPDK patches and discussions
 help / color / mirror / Atom feed
From: Ashish Gupta <ashishg@marvell.com>
To: <dev@dpdk.org>
Cc: <jerinj@marvell.com>, <shallyv@marvell.com>, <stable@dpdk.org>
Subject: [dpdk-dev] [dpdk-dev PATCH v1 1/1] net/octeontx2: update link information for loopback port
Date: Thu, 6 Feb 2020 18:00:58 +0530	[thread overview]
Message-ID: <20200206123058.9971-1-ashishg@marvell.com> (raw)

loopback devices are exposed as ethdev device in octeontx2.
dpdk link update APIs updating the link information for cgx
ports but skipping loopback ports.

When stack uses loopback port for forwarding, packets are
dropped as link status is down. Link information need to be
updated for loopback ports to avoid it.

Fixes: 38f566280a ("net/octeontx2: add link stats operations")
Cc: stable@dpdk.org

Signed-off-by: Ashish Gupta <ashishg@marvell.com>
---
 drivers/net/octeontx2/otx2_link.c | 49 +++++++++++++++++++++++++++++----------
 1 file changed, 37 insertions(+), 12 deletions(-)

diff --git a/drivers/net/octeontx2/otx2_link.c b/drivers/net/octeontx2/otx2_link.c
index f5679b06e..4128f56d9 100644
--- a/drivers/net/octeontx2/otx2_link.c
+++ b/drivers/net/octeontx2/otx2_link.c
@@ -82,32 +82,57 @@ otx2_eth_dev_link_status_update(struct otx2_dev *dev,
 	_rte_eth_dev_callback_process(eth_dev, RTE_ETH_EVENT_INTR_LSC, NULL);
 }
 
+static int
+lbk_link_update(struct rte_eth_link *link)
+{
+	link->link_status = ETH_LINK_UP;
+	link->link_speed = ETH_SPEED_NUM_100G;
+	link->link_autoneg = ETH_LINK_FIXED;
+	link->link_duplex = ETH_LINK_FULL_DUPLEX;
+	return 0;
+}
+
+static int
+cgx_link_update(struct otx2_eth_dev *dev, struct rte_eth_link *link)
+{
+	struct otx2_mbox *mbox = dev->mbox;
+	struct cgx_link_info_msg *rsp;
+	int rc;
+	otx2_mbox_alloc_msg_cgx_get_linkinfo(mbox);
+	rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
+	if (rc)
+		return rc;
+
+	link->link_status = rsp->link_info.link_up;
+	link->link_speed = rsp->link_info.speed;
+	link->link_autoneg = ETH_LINK_AUTONEG;
+
+	if (rsp->link_info.full_duplex)
+		link->link_duplex = rsp->link_info.full_duplex;
+	return 0;
+}
+
 int
 otx2_nix_link_update(struct rte_eth_dev *eth_dev, int wait_to_complete)
 {
 	struct otx2_eth_dev *dev = otx2_eth_pmd_priv(eth_dev);
-	struct otx2_mbox *mbox = dev->mbox;
-	struct cgx_link_info_msg *rsp;
 	struct rte_eth_link link;
 	int rc;
 
 	RTE_SET_USED(wait_to_complete);
+	memset(&link, 0, sizeof(struct rte_eth_link));
 
-	if (otx2_dev_is_lbk(dev) || otx2_dev_is_sdp(dev))
+	if (otx2_dev_is_sdp(dev))
 		return 0;
 
-	otx2_mbox_alloc_msg_cgx_get_linkinfo(mbox);
-	rc = otx2_mbox_process_msg(mbox, (void *)&rsp);
+	if (otx2_dev_is_lbk(dev))
+		rc = lbk_link_update(&link);
+	else
+		rc = cgx_link_update(dev, &link);
+
 	if (rc)
 		return rc;
 
-	link.link_status = rsp->link_info.link_up;
-	link.link_speed = rsp->link_info.speed;
-	link.link_autoneg = ETH_LINK_AUTONEG;
-
-	if (rsp->link_info.full_duplex)
-		link.link_duplex = rsp->link_info.full_duplex;
-
 	return rte_eth_linkstatus_set(eth_dev, &link);
 }
 
-- 
2.14.3


             reply	other threads:[~2020-02-06 12:06 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-06 12:30 Ashish Gupta [this message]
2020-02-27 11:13 ` Jerin Jacob

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=20200206123058.9971-1-ashishg@marvell.com \
    --to=ashishg@marvell.com \
    --cc=dev@dpdk.org \
    --cc=jerinj@marvell.com \
    --cc=shallyv@marvell.com \
    --cc=stable@dpdk.org \
    /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).