New upstream version 17.11-rc3
[deb_dpdk.git] / drivers / net / dpaa2 / base / dpaa2_hw_dpni.c
index 4c82aa8..e3ab90a 100644 (file)
 
 #include "../dpaa2_ethdev.h"
 
-static void
+static int
 dpaa2_distset_to_dpkg_profile_cfg(
-               uint32_t req_dist_set,
+               uint64_t req_dist_set,
                struct dpkg_profile_cfg *kg_cfg);
 
 int
 dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
-                     uint32_t req_dist_set)
+                     uint64_t req_dist_set)
 {
        struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
        struct fsl_mc_io *dpni = priv->hw;
@@ -68,20 +68,26 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
        p_params = rte_malloc(
                NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE);
        if (!p_params) {
-               RTE_LOG(ERR, PMD, "Memory unavaialble\n");
+               PMD_INIT_LOG(ERR, "Memory unavailable");
                return -ENOMEM;
        }
        memset(p_params, 0, DIST_PARAM_IOVA_SIZE);
        memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
 
-       dpaa2_distset_to_dpkg_profile_cfg(req_dist_set, &kg_cfg);
+       ret = dpaa2_distset_to_dpkg_profile_cfg(req_dist_set, &kg_cfg);
+       if (ret) {
+               PMD_INIT_LOG(ERR, "given rss_hf (%lx) not supported",
+                            req_dist_set);
+               rte_free(p_params);
+               return ret;
+       }
        tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params));
        tc_cfg.dist_size = eth_dev->data->nb_rx_queues;
        tc_cfg.dist_mode = DPNI_DIST_MODE_HASH;
 
-       ret = dpni_prepare_key_cfg(&kg_cfg, p_params);
+       ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
        if (ret) {
-               RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n");
+               PMD_INIT_LOG(ERR, "Unable to prepare extract parameters");
                rte_free(p_params);
                return ret;
        }
@@ -90,9 +96,9 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
                                  &tc_cfg);
        rte_free(p_params);
        if (ret) {
-               RTE_LOG(ERR, PMD,
-                       "Setting distribution for Rx failed with err: %d\n",
-                       ret);
+               PMD_INIT_LOG(ERR,
+                            "Setting distribution for Rx failed with err: %d",
+                            ret);
                return ret;
        }
 
@@ -113,19 +119,19 @@ int dpaa2_remove_flow_dist(
        p_params = rte_malloc(
                NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE);
        if (!p_params) {
-               RTE_LOG(ERR, PMD, "Memory unavaialble\n");
+               PMD_INIT_LOG(ERR, "Memory unavailable");
                return -ENOMEM;
        }
        memset(p_params, 0, DIST_PARAM_IOVA_SIZE);
        memset(&tc_cfg, 0, sizeof(struct dpni_rx_tc_dist_cfg));
-
+       kg_cfg.num_extracts = 0;
        tc_cfg.key_cfg_iova = (uint64_t)(DPAA2_VADDR_TO_IOVA(p_params));
        tc_cfg.dist_size = 0;
        tc_cfg.dist_mode = DPNI_DIST_MODE_NONE;
 
-       ret = dpni_prepare_key_cfg(&kg_cfg, p_params);
+       ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
        if (ret) {
-               RTE_LOG(ERR, PMD, "Unable to prepare extract parameters\n");
+               PMD_INIT_LOG(ERR, "Unable to prepare extract parameters");
                rte_free(p_params);
                return ret;
        }
@@ -133,18 +139,16 @@ int dpaa2_remove_flow_dist(
        ret = dpni_set_rx_tc_dist(dpni, CMD_PRI_LOW, priv->token, tc_index,
                                  &tc_cfg);
        rte_free(p_params);
-       if (ret) {
-               RTE_LOG(ERR, PMD,
-                       "Setting distribution for Rx failed with err: %d\n",
-                       ret);
-               return ret;
-       }
+       if (ret)
+               PMD_INIT_LOG(ERR,
+                            "Setting distribution for Rx failed with err:%d",
+                            ret);
        return ret;
 }
 
-static void
+static int
 dpaa2_distset_to_dpkg_profile_cfg(
-               uint32_t req_dist_set,
+               uint64_t req_dist_set,
                struct dpkg_profile_cfg *kg_cfg)
 {
        uint32_t loop = 0, i = 0, dist_field = 0;
@@ -278,14 +282,17 @@ dpaa2_distset_to_dpkg_profile_cfg(
                                break;
 
                        default:
-                               PMD_DRV_LOG(WARNING, "Bad flow distribution"
-                                           " option %x\n", dist_field);
+                               PMD_INIT_LOG(WARNING,
+                                            "Unsupported flow dist option %x",
+                                            dist_field);
+                               return -EINVAL;
                        }
                }
                req_dist_set = req_dist_set >> 1;
                loop++;
        }
        kg_cfg->num_extracts = i;
+       return 0;
 }
 
 int
@@ -337,6 +344,7 @@ dpaa2_attach_bp_list(struct dpaa2_dev_priv *priv,
        bpool_cfg.pools[0].backup_pool = 0;
        bpool_cfg.pools[0].buffer_size = RTE_ALIGN_CEIL(bp_list->buf_pool.size,
                                                DPAA2_PACKET_LAYOUT_ALIGN);
+       bpool_cfg.pools[0].priority_mask = 0;
 
        retcode = dpni_set_pools(dpni, CMD_PRI_LOW, priv->token, &bpool_cfg);
        if (retcode != 0) {