mpipe: fix link initialization ordering
authorLiming Sun <lsun@ezchip.com>
Fri, 8 Jan 2016 14:30:38 +0000 (09:30 -0500)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 16 Mar 2016 15:44:51 +0000 (16:44 +0100)
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().

Fixes: a8dd50513dea ("mpipe: add TILE-Gx mPIPE poll mode driver")

Signed-off-by: Liming Sun <lsun@ezchip.com>
Acked-by: Zhigang Lu <zlu@ezchip.com>
drivers/net/mpipe/mpipe_tilegx.c

index 6ecfec5..b887de6 100644 (file)
@@ -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",
@@ -1632,6 +1625,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;
 }