ethdev: return diagnostic when setting MAC address
[dpdk.git] / drivers / net / dpaa / dpaa_ethdev.c
index 453c9f6..9242f5a 100644 (file)
@@ -275,9 +275,9 @@ static int dpaa_eth_link_update(struct rte_eth_dev *dev,
        PMD_INIT_FUNC_TRACE();
 
        if (dpaa_intf->fif->mac_type == fman_mac_1g)
-               link->link_speed = 1000;
+               link->link_speed = ETH_SPEED_NUM_1G;
        else if (dpaa_intf->fif->mac_type == fman_mac_10g)
-               link->link_speed = 10000;
+               link->link_speed = ETH_SPEED_NUM_10G;
        else
                DPAA_PMD_ERR("invalid link_speed: %s, %d",
                             dpaa_intf->name, dpaa_intf->fif->mac_type);
@@ -335,10 +335,13 @@ dpaa_dev_xstats_get(struct rte_eth_dev *dev, struct rte_eth_xstat *xstats,
 static int
 dpaa_xstats_get_names(__rte_unused struct rte_eth_dev *dev,
                      struct rte_eth_xstat_name *xstats_names,
-                     __rte_unused unsigned int limit)
+                     unsigned int limit)
 {
        unsigned int i, stat_cnt = RTE_DIM(dpaa_xstats_strings);
 
+       if (limit < stat_cnt)
+               return stat_cnt;
+
        if (xstats_names != NULL)
                for (i = 0; i < stat_cnt; i++)
                        snprintf(xstats_names[i].name,
@@ -366,7 +369,7 @@ dpaa_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
                        return 0;
 
                fman_if_stats_get_all(dpaa_intf->fif, values_copy,
-                                     sizeof(struct dpaa_if_stats));
+                                     sizeof(struct dpaa_if_stats) / 8);
 
                for (i = 0; i < stat_cnt; i++)
                        values[i] =
@@ -503,7 +506,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 +533,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;
@@ -808,7 +816,7 @@ dpaa_dev_remove_mac_addr(struct rte_eth_dev *dev,
        fman_if_clear_mac_addr(dpaa_intf->fif, index);
 }
 
-static void
+static int
 dpaa_dev_set_mac_addr(struct rte_eth_dev *dev,
                       struct ether_addr *addr)
 {
@@ -820,6 +828,8 @@ dpaa_dev_set_mac_addr(struct rte_eth_dev *dev,
        ret = fman_if_add_mac_addr(dpaa_intf->fif, addr->addr_bytes, 0);
        if (ret)
                RTE_LOG(ERR, PMD, "error: Setting the MAC ADDR failed %d", ret);
+
+       return ret;
 }
 
 static struct eth_dev_ops dpaa_devops = {
@@ -1100,10 +1110,10 @@ dpaa_dev_init(struct rte_eth_dev *eth_dev)
                        dpaa_push_mode_max_queue = DPAA_MAX_PUSH_MODE_QUEUE;
        }
 
-       /* Each device can not have more than DPAA_PCD_FQID_MULTIPLIER RX
+       /* Each device can not have more than DPAA_MAX_NUM_PCD_QUEUES RX
         * queues.
         */
-       if (num_rx_fqs <= 0 || num_rx_fqs > DPAA_PCD_FQID_MULTIPLIER) {
+       if (num_rx_fqs <= 0 || num_rx_fqs > DPAA_MAX_NUM_PCD_QUEUES) {
                DPAA_PMD_ERR("Invalid number of RX queues\n");
                return -EINVAL;
        }
@@ -1333,10 +1343,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);