[dpdk-dev,3/3] driver/net/mpipe: fix a mpipe link initialization ordering issue

Message ID 1450193851-9100-4-git-send-email-lsun@ezchip.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Liming Sun Dec. 15, 2015, 3:37 p.m. UTC
  Mpipe link structure is initialized in function mpipe_link_init().
Currently it's only called from the eth_dev_ops.dev_start, which
caused crashes when link mgmt APIs (like promiscuous_enable)
was called before eth_dev_ops.dev_start(). This submit fixed it
by calling mpipe_link_init() in rte_pmd_mpipe_devinit().

Signed-off-by: Liming Sun <lsun@ezchip.com>
---
 drivers/net/mpipe/mpipe_tilegx.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
  

Comments

Zhigang Lu Jan. 8, 2016, 3:08 a.m. UTC | #1
>-----Original Message-----
>From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Liming Sun
>Sent: Tuesday, December 15, 2015 11:38 PM
>To: dev@dpdk.org
>Subject: [dpdk-dev] [PATCH 3/3] driver/net/mpipe: fix a mpipe link
initialization
>ordering issue
>
>Mpipe link structure is initialized in function mpipe_link_init().
>Currently it's only called from the eth_dev_ops.dev_start, which
>caused crashes when link mgmt APIs (like promiscuous_enable)
>was called before eth_dev_ops.dev_start(). This submit fixed it
>by calling mpipe_link_init() in rte_pmd_mpipe_devinit().
>
>Signed-off-by: Liming Sun <lsun@ezchip.com>
>---
> drivers/net/mpipe/mpipe_tilegx.c |   14 +++++++-------
> 1 files changed, 7 insertions(+), 7 deletions(-)
>
>diff --git a/drivers/net/mpipe/mpipe_tilegx.c
>b/drivers/net/mpipe/mpipe_tilegx.c
>index be7b6f2..5845511 100644
>--- a/drivers/net/mpipe/mpipe_tilegx.c
>+++ b/drivers/net/mpipe/mpipe_tilegx.c
>@@ -752,13 +752,6 @@ mpipe_init(struct mpipe_dev_priv *priv)
> 	if (priv->initialized)
> 		return 0;
>
>-	rc = mpipe_link_init(priv);
>-	if (rc < 0) {
>-		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
>-			mpipe_name(priv));
>-		return rc;
>-	}
>-
> 	rc = mpipe_recv_init(priv);
> 	if (rc < 0) {
> 		RTE_LOG(ERR, PMD, "%s: Failed to init rx.\n",
>@@ -1633,6 +1626,13 @@ rte_pmd_mpipe_devinit(const char *ifname,
> 	eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
> 	eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
>
>+	rc = mpipe_link_init(priv);
>+	if (rc < 0) {
>+		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
>+			mpipe_name(priv));
>+		return rc;
>+	}
>+
> 	return 0;
> }
>
>--
>1.7.1

Acked-by: Zhigang Lu <zlu@ezchip.com>
  

Patch

diff --git a/drivers/net/mpipe/mpipe_tilegx.c b/drivers/net/mpipe/mpipe_tilegx.c
index be7b6f2..5845511 100644
--- a/drivers/net/mpipe/mpipe_tilegx.c
+++ b/drivers/net/mpipe/mpipe_tilegx.c
@@ -752,13 +752,6 @@  mpipe_init(struct mpipe_dev_priv *priv)
 	if (priv->initialized)
 		return 0;
 
-	rc = mpipe_link_init(priv);
-	if (rc < 0) {
-		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
-			mpipe_name(priv));
-		return rc;
-	}
-
 	rc = mpipe_recv_init(priv);
 	if (rc < 0) {
 		RTE_LOG(ERR, PMD, "%s: Failed to init rx.\n",
@@ -1633,6 +1626,13 @@  rte_pmd_mpipe_devinit(const char *ifname,
 	eth_dev->rx_pkt_burst = &mpipe_recv_pkts;
 	eth_dev->tx_pkt_burst = &mpipe_xmit_pkts;
 
+	rc = mpipe_link_init(priv);
+	if (rc < 0) {
+		RTE_LOG(ERR, PMD, "%s: Failed to init link.\n",
+			mpipe_name(priv));
+		return rc;
+	}
+
 	return 0;
 }