DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [dpdk-dev PATCH v1 1/1] net/octeontx2: update link information for loopback port
@ 2020-02-06 12:30 Ashish Gupta
  2020-02-27 11:13 ` Jerin Jacob
  0 siblings, 1 reply; 2+ messages in thread
From: Ashish Gupta @ 2020-02-06 12:30 UTC (permalink / raw)
  To: dev; +Cc: jerinj, shallyv, stable

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [dpdk-dev PATCH v1 1/1] net/octeontx2: update link information for loopback port
  2020-02-06 12:30 [dpdk-dev] [dpdk-dev PATCH v1 1/1] net/octeontx2: update link information for loopback port Ashish Gupta
@ 2020-02-27 11:13 ` Jerin Jacob
  0 siblings, 0 replies; 2+ messages in thread
From: Jerin Jacob @ 2020-02-27 11:13 UTC (permalink / raw)
  To: Ashish Gupta, Ferruh Yigit; +Cc: dpdk-dev, Jerin Jacob, shallyv, dpdk stable

On Thu, Feb 6, 2020 at 5:36 PM Ashish Gupta <ashishg@marvell.com> wrote:
>
> 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>

Thanks for the patch.

Acked-by: Jerin Jacob <jerinj@marvell.com>
Applied to dpdk-next-net-mrvl/master after minor rewording of the
commit message. Thanks

> ---
>  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
>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-02-27 11:13 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-02-06 12:30 [dpdk-dev] [dpdk-dev PATCH v1 1/1] net/octeontx2: update link information for loopback port Ashish Gupta
2020-02-27 11:13 ` Jerin Jacob

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).