net/sfc/base: use correct name for frame truncation event
[dpdk.git] / drivers / net / dpaa / dpaa_ethdev.c
index 09f0a73..9b69ef4 100644 (file)
@@ -28,7 +28,7 @@
 #include <rte_eal.h>
 #include <rte_alarm.h>
 #include <rte_ether.h>
-#include <rte_ethdev.h>
+#include <rte_ethdev_driver.h>
 #include <rte_malloc.h>
 #include <rte_ring.h>
 
@@ -503,7 +503,11 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                                   QM_FQCTRL_CTXASTASHING |
                                   QM_FQCTRL_PREFERINCACHE;
                opts.fqd.context_a.stashing.exclusive = 0;
-               opts.fqd.context_a.stashing.annotation_cl =
+               /* In muticore scenario stashing becomes a bottleneck on LS1046.
+                * So do not enable stashing in this case
+                */
+               if (dpaa_svr_family != SVR_LS1046A_FAMILY)
+                       opts.fqd.context_a.stashing.annotation_cl =
                                                DPAA_IF_RX_ANNOTATION_STASH;
                opts.fqd.context_a.stashing.data_cl = DPAA_IF_RX_DATA_STASH;
                opts.fqd.context_a.stashing.context_cl =
@@ -526,7 +530,8 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
                if (ret)
                        DPAA_PMD_ERR("Channel/Queue association failed. fqid %d"
                                     " ret: %d", rxq->fqid, ret);
-               rxq->cb.dqrr_dpdk_cb = dpaa_rx_cb;
+               rxq->cb.dqrr_dpdk_pull_cb = dpaa_rx_cb;
+               rxq->cb.dqrr_prepare = dpaa_rx_cb_prepare;
                rxq->is_static = true;
        }
        dev->data->rx_queues[queue_idx] = rxq;
@@ -548,8 +553,9 @@ int dpaa_eth_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx,
        return 0;
 }
 
-int dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
-                          int eth_rx_queue_id,
+int __rte_experimental
+dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
+               int eth_rx_queue_id,
                u16 ch_id,
                const struct rte_event_eth_rx_adapter_queue_conf *queue_conf)
 {
@@ -610,8 +616,9 @@ int dpaa_eth_eventq_attach(const struct rte_eth_dev *dev,
        return ret;
 }
 
-int dpaa_eth_eventq_detach(const struct rte_eth_dev *dev,
-                          int eth_rx_queue_id)
+int __rte_experimental
+dpaa_eth_eventq_detach(const struct rte_eth_dev *dev,
+               int eth_rx_queue_id)
 {
        struct qm_mcc_initfq opts;
        int ret;
@@ -875,7 +882,7 @@ is_dpaa_supported(struct rte_eth_dev *dev)
        return is_device_supported(dev, &rte_dpaa_pmd);
 }
 
-int
+int __rte_experimental
 rte_pmd_dpaa_set_tx_loopback(uint8_t port, uint8_t on)
 {
        struct rte_eth_dev *dev;
@@ -1108,16 +1115,26 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
 
        dpaa_intf->rx_queues = rte_zmalloc(NULL,
                sizeof(struct qman_fq) * num_rx_fqs, MAX_CACHELINE);
+       if (!dpaa_intf->rx_queues) {
+               DPAA_PMD_ERR("Failed to alloc mem for RX queues\n");
+               return -ENOMEM;
+       }
 
        /* If congestion control is enabled globally*/
        if (td_threshold) {
                dpaa_intf->cgr_rx = rte_zmalloc(NULL,
                        sizeof(struct qman_cgr) * num_rx_fqs, MAX_CACHELINE);
+               if (!dpaa_intf->cgr_rx) {
+                       DPAA_PMD_ERR("Failed to alloc mem for cgr_rx\n");
+                       ret = -ENOMEM;
+                       goto free_rx;
+               }
 
                ret = qman_alloc_cgrid_range(&cgrid[0], num_rx_fqs, 1, 0);
                if (ret != num_rx_fqs) {
                        DPAA_PMD_WARN("insufficient CGRIDs available");
-                       return -EINVAL;
+                       ret = -EINVAL;
+                       goto free_rx;
                }
        } else {
                dpaa_intf->cgr_rx = NULL;
@@ -1134,23 +1151,26 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
                        dpaa_intf->cgr_rx ? &dpaa_intf->cgr_rx[loop] : NULL,
                        fqid);
                if (ret)
-                       return ret;
+                       goto free_rx;
                dpaa_intf->rx_queues[loop].dpaa_intf = dpaa_intf;
        }
        dpaa_intf->nb_rx_queues = num_rx_fqs;
 
-       /* Initialise Tx FQs. Have as many Tx FQ's as number of cores */
+       /* Initialise Tx FQs.free_rx Have as many Tx FQ's as number of cores */
        num_cores = rte_lcore_count();
        dpaa_intf->tx_queues = rte_zmalloc(NULL, sizeof(struct qman_fq) *
                num_cores, MAX_CACHELINE);
-       if (!dpaa_intf->tx_queues)
-               return -ENOMEM;
+       if (!dpaa_intf->tx_queues) {
+               DPAA_PMD_ERR("Failed to alloc mem for TX queues\n");
+               ret = -ENOMEM;
+               goto free_rx;
+       }
 
        for (loop = 0; loop < num_cores; loop++) {
                ret = dpaa_tx_queue_init(&dpaa_intf->tx_queues[loop],
                                         fman_intf);
                if (ret)
-                       return ret;
+                       goto free_tx;
                dpaa_intf->tx_queues[loop].dpaa_intf = dpaa_intf;
        }
        dpaa_intf->nb_tx_queues = num_cores;
@@ -1187,14 +1207,8 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
                DPAA_PMD_ERR("Failed to allocate %d bytes needed to "
                                                "store MAC addresses",
                                ETHER_ADDR_LEN * DPAA_MAX_MAC_FILTER);
-               rte_free(dpaa_intf->cgr_rx);
-               rte_free(dpaa_intf->rx_queues);
-               rte_free(dpaa_intf->tx_queues);
-               dpaa_intf->rx_queues = NULL;
-               dpaa_intf->tx_queues = NULL;
-               dpaa_intf->nb_rx_queues = 0;
-               dpaa_intf->nb_tx_queues = 0;
-               return -ENOMEM;
+               ret = -ENOMEM;
+               goto free_tx;
        }
 
        /* copy the primary mac address */
@@ -1220,6 +1234,18 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
        fman_if_stats_reset(fman_intf);
 
        return 0;
+
+free_tx:
+       rte_free(dpaa_intf->tx_queues);
+       dpaa_intf->tx_queues = NULL;
+       dpaa_intf->nb_tx_queues = 0;
+
+free_rx:
+       rte_free(dpaa_intf->cgr_rx);
+       rte_free(dpaa_intf->rx_queues);
+       dpaa_intf->rx_queues = NULL;
+       dpaa_intf->nb_rx_queues = 0;
+       return ret;
 }
 
 static int
@@ -1312,10 +1338,12 @@ rte_dpaa_probe(struct rte_dpaa_driver *dpaa_drv,
                is_global_init = 1;
        }
 
-       ret = rte_dpaa_portal_init((void *)1);
-       if (ret) {
-               DPAA_PMD_ERR("Unable to initialize portal");
-               return ret;
+       if (unlikely(!RTE_PER_LCORE(dpaa_io))) {
+               ret = rte_dpaa_portal_init((void *)1);
+               if (ret) {
+                       DPAA_PMD_ERR("Unable to initialize portal");
+                       return ret;
+               }
        }
 
        eth_dev = rte_eth_dev_allocate(dpaa_dev->name);