net/hns3: fix return value for unsupported tuple
[dpdk.git] / drivers / net / dpaa2 / dpaa2_ethdev.c
index 361fd9f..52eb6df 100644 (file)
@@ -399,6 +399,8 @@ dpaa2_alloc_rx_tx_queues(struct rte_eth_dev *dev)
        if (dpaa2_enable_err_queue) {
                priv->rx_err_vq = rte_zmalloc("dpni_rx_err",
                        sizeof(struct dpaa2_queue), 0);
+               if (!priv->rx_err_vq)
+                       goto fail;
 
                dpaa2_q = (struct dpaa2_queue *)priv->rx_err_vq;
                dpaa2_q->q_storage = rte_malloc("err_dq_storage",
@@ -508,8 +510,7 @@ dpaa2_free_rx_tx_queues(struct rte_eth_dev *dev)
                /* cleaning up queue storage */
                for (i = 0; i < priv->nb_rx_queues; i++) {
                        dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[i];
-                       if (dpaa2_q->q_storage)
-                               rte_free(dpaa2_q->q_storage);
+                       rte_free(dpaa2_q->q_storage);
                }
                /* cleanup tx queue cscn */
                for (i = 0; i < priv->nb_tx_queues; i++) {
@@ -668,6 +669,30 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
        if (rx_offloads & RTE_ETH_RX_OFFLOAD_VLAN_FILTER)
                dpaa2_vlan_offload_set(dev, RTE_ETH_VLAN_FILTER_MASK);
 
+       if (eth_conf->lpbk_mode) {
+               ret = dpaa2_dev_recycle_config(dev);
+               if (ret) {
+                       DPAA2_PMD_ERR("Error to configure %s to recycle port.",
+                               dev->data->name);
+
+                       return ret;
+               }
+       } else {
+               /** User may disable loopback mode by calling
+                * "dev_configure" with lpbk_mode cleared.
+                * No matter the port was configured recycle or not,
+                * recycle de-configure is called here.
+                * If port is not recycled, the de-configure will return directly.
+                */
+               ret = dpaa2_dev_recycle_deconfig(dev);
+               if (ret) {
+                       DPAA2_PMD_ERR("Error to de-configure recycle port %s.",
+                               dev->data->name);
+
+                       return ret;
+               }
+       }
+
        dpaa2_tm_init(dev);
 
        return 0;
@@ -1979,7 +2004,7 @@ dpaa2_dev_set_link_down(struct rte_eth_dev *dev)
        }
 
        /*changing  tx burst function to avoid any more enqueues */
-       dev->tx_pkt_burst = dummy_dev_tx;
+       dev->tx_pkt_burst = rte_eth_pkt_burst_dummy;
 
        /* Loop while dpni_disable() attempts to drain the egress FQs
         * and confirm them back to us.
@@ -2601,6 +2626,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
                return -1;
        }
 
+       if (eth_dev->data->dev_conf.lpbk_mode)
+               dpaa2_dev_recycle_deconfig(eth_dev);
+
        /* Clean the device first */
        ret = dpni_reset(dpni_dev, CMD_PRI_LOW, priv->token);
        if (ret) {
@@ -2624,6 +2652,7 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
        priv->dist_queues = attr.num_queues;
        priv->num_channels = attr.num_channels;
        priv->channel_inuse = 0;
+       rte_spinlock_init(&priv->lpbk_qp_lock);
 
        /* only if the custom CG is enabled */
        if (attr.options & DPNI_OPT_CUSTOM_CG)
@@ -2808,7 +2837,9 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
                        return ret;
                }
        }
-       RTE_LOG(INFO, PMD, "%s: netdev created\n", eth_dev->data->name);
+       RTE_LOG(INFO, PMD, "%s: netdev created, connected to %s\n",
+               eth_dev->data->name, dpaa2_dev->ep_name);
+
        return 0;
 init_err:
        dpaa2_dev_close(eth_dev);