net/softnic: fix useless address check
[dpdk.git] / drivers / net / dpaa2 / dpaa2_ethdev.c
index 9011dcf..f2519f0 100644 (file)
@@ -226,9 +226,11 @@ dpaa2_fw_version_get(struct rte_eth_dev *dev,
                       mc_ver_info.major,
                       mc_ver_info.minor,
                       mc_ver_info.revision);
+       if (ret < 0)
+               return -EINVAL;
 
        ret += 1; /* add the size of '\0' */
-       if (fw_size < (uint32_t)ret)
+       if (fw_size < (size_t)ret)
                return ret;
        else
                return 0;
@@ -571,6 +573,8 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
                                dev->data->dev_conf.rxmode.max_rx_pkt_len -
                                RTE_ETHER_HDR_LEN - RTE_ETHER_CRC_LEN -
                                VLAN_TAG_SIZE;
+                               DPAA2_PMD_INFO("MTU configured for the device: %d",
+                                               dev->data->mtu);
                } else {
                        return -1;
                }
@@ -974,9 +978,9 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
 }
 
 static void
-dpaa2_dev_rx_queue_release(void *q __rte_unused)
+dpaa2_dev_rx_queue_release(struct rte_eth_dev *dev, uint16_t rx_queue_id)
 {
-       struct dpaa2_queue *dpaa2_q = (struct dpaa2_queue *)q;
+       struct dpaa2_queue *dpaa2_q = dev->data->rx_queues[rx_queue_id];
        struct dpaa2_dev_priv *priv = dpaa2_q->eth_data->dev_private;
        struct fsl_mc_io *dpni =
                (struct fsl_mc_io *)priv->eth_dev->process_private;
@@ -1002,17 +1006,10 @@ dpaa2_dev_rx_queue_release(void *q __rte_unused)
        }
 }
 
-static void
-dpaa2_dev_tx_queue_release(void *q __rte_unused)
-{
-       PMD_INIT_FUNC_TRACE();
-}
-
 static uint32_t
-dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
+dpaa2_dev_rx_queue_count(void *rx_queue)
 {
        int32_t ret;
-       struct dpaa2_dev_priv *priv = dev->data->dev_private;
        struct dpaa2_queue *dpaa2_q;
        struct qbman_swp *swp;
        struct qbman_fq_query_np_rslt state;
@@ -1029,12 +1026,12 @@ dpaa2_dev_rx_queue_count(struct rte_eth_dev *dev, uint16_t rx_queue_id)
        }
        swp = DPAA2_PER_LCORE_PORTAL;
 
-       dpaa2_q = (struct dpaa2_queue *)priv->rx_vq[rx_queue_id];
+       dpaa2_q = rx_queue;
 
        if (qbman_fq_query_state(swp, dpaa2_q->fqid, &state) == 0) {
                frame_cnt = qbman_fq_state_frame_count(&state);
-               DPAA2_PMD_DP_DEBUG("RX frame count for q(%d) is %u",
-                               rx_queue_id, frame_cnt);
+               DPAA2_PMD_DP_DEBUG("RX frame count for q(%p) is %u",
+                               rx_queue, frame_cnt);
        }
        return frame_cnt;
 }
@@ -1793,8 +1790,8 @@ dpaa2_xstats_get_by_id(struct rte_eth_dev *dev, const uint64_t *ids,
 static int
 dpaa2_xstats_get_names_by_id(
        struct rte_eth_dev *dev,
-       struct rte_eth_xstat_name *xstats_names,
        const uint64_t *ids,
+       struct rte_eth_xstat_name *xstats_names,
        unsigned int limit)
 {
        unsigned int i, stat_cnt = RTE_DIM(dpaa2_xstats_strings);
@@ -2271,7 +2268,7 @@ int dpaa2_eth_eventq_attach(const struct rte_eth_dev *dev,
 
                ret = dpni_set_opr(dpni, CMD_PRI_LOW, eth_priv->token,
                                   dpaa2_ethq->tc_index, flow_id,
-                                  OPR_OPT_CREATE, &ocfg);
+                                  OPR_OPT_CREATE, &ocfg, 0);
                if (ret) {
                        DPAA2_PMD_ERR("Error setting opr: ret: %d\n", ret);
                        return ret;
@@ -2380,6 +2377,22 @@ dpaa2_tm_ops_get(struct rte_eth_dev *dev __rte_unused, void *ops)
        return 0;
 }
 
+void
+rte_pmd_dpaa2_thread_init(void)
+{
+       int ret;
+
+       if (unlikely(!DPAA2_PER_LCORE_DPIO)) {
+               ret = dpaa2_affine_qbman_swp();
+               if (ret) {
+                       DPAA2_PMD_ERR(
+                               "Failed to allocate IO portal, tid: %d\n",
+                               rte_gettid());
+                       return;
+               }
+       }
+}
+
 static struct eth_dev_ops dpaa2_ethdev_ops = {
        .dev_configure    = dpaa2_eth_dev_configure,
        .dev_start            = dpaa2_dev_start,
@@ -2409,7 +2422,6 @@ static struct eth_dev_ops dpaa2_ethdev_ops = {
        .rx_queue_setup    = dpaa2_dev_rx_queue_setup,
        .rx_queue_release  = dpaa2_dev_rx_queue_release,
        .tx_queue_setup    = dpaa2_dev_tx_queue_setup,
-       .tx_queue_release  = dpaa2_dev_tx_queue_release,
        .rx_burst_mode_get = dpaa2_dev_rx_burst_mode_get,
        .tx_burst_mode_get = dpaa2_dev_tx_burst_mode_get,
        .flow_ctrl_get        = dpaa2_flow_ctrl_get,
@@ -2804,6 +2816,11 @@ init_err:
        return ret;
 }
 
+int dpaa2_dev_is_dpaa2(struct rte_eth_dev *dev)
+{
+       return dev->device->driver == &rte_dpaa2_pmd.driver;
+}
+
 static int
 rte_dpaa2_probe(struct rte_dpaa2_driver *dpaa2_drv,
                struct rte_dpaa2_device *dpaa2_dev)
@@ -2887,10 +2904,10 @@ static struct rte_dpaa2_driver rte_dpaa2_pmd = {
        .remove = rte_dpaa2_remove,
 };
 
-RTE_PMD_REGISTER_DPAA2(net_dpaa2, rte_dpaa2_pmd);
-RTE_PMD_REGISTER_PARAM_STRING(net_dpaa2,
+RTE_PMD_REGISTER_DPAA2(NET_DPAA2_PMD_DRIVER_NAME, rte_dpaa2_pmd);
+RTE_PMD_REGISTER_PARAM_STRING(NET_DPAA2_PMD_DRIVER_NAME,
                DRIVER_LOOPBACK_MODE "=<int> "
                DRIVER_NO_PREFETCH_MODE "=<int>"
                DRIVER_TX_CONF "=<int>"
                DRIVER_ERROR_QUEUE "=<int>");
-RTE_LOG_REGISTER(dpaa2_logtype_pmd, pmd.net.dpaa2, NOTICE);
+RTE_LOG_REGISTER_DEFAULT(dpaa2_logtype_pmd, NOTICE);