net/dpaa2: support distribution size set on multiple TCs
authorJun Yang <jun.yang@nxp.com>
Tue, 7 Jul 2020 09:22:38 +0000 (14:52 +0530)
committerFerruh Yigit <ferruh.yigit@intel.com>
Sat, 11 Jul 2020 04:18:52 +0000 (06:18 +0200)
Default distribution size of TC is 1, which is limited by MC. We have to
set the distribution size for each TC to support multiple RXQs per TC.

Signed-off-by: Jun Yang <jun.yang@nxp.com>
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
drivers/net/dpaa2/base/dpaa2_hw_dpni.c
drivers/net/dpaa2/dpaa2_ethdev.c
drivers/net/dpaa2/dpaa2_ethdev.h

index 34de0d1..9f0dad6 100644 (file)
@@ -81,14 +81,14 @@ rte_pmd_dpaa2_set_custom_hash(uint16_t port_id,
 
 int
 dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
-                     uint64_t req_dist_set)
+       uint64_t req_dist_set, int tc_index)
 {
        struct dpaa2_dev_priv *priv = eth_dev->data->dev_private;
        struct fsl_mc_io *dpni = priv->hw;
        struct dpni_rx_tc_dist_cfg tc_cfg;
        struct dpkg_profile_cfg kg_cfg;
        void *p_params;
-       int ret, tc_index = 0;
+       int ret;
 
        p_params = rte_malloc(
                NULL, DIST_PARAM_IOVA_SIZE, RTE_CACHE_LINE_SIZE);
@@ -107,7 +107,7 @@ dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
                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_size = priv->dist_queues;
        tc_cfg.dist_mode = DPNI_DIST_MODE_HASH;
 
        ret = dpkg_prepare_key_cfg(&kg_cfg, p_params);
index 008e1c5..020af4b 100644 (file)
@@ -453,7 +453,7 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
        int rx_l4_csum_offload = false;
        int tx_l3_csum_offload = false;
        int tx_l4_csum_offload = false;
-       int ret;
+       int ret, tc_index;
 
        PMD_INIT_FUNC_TRACE();
 
@@ -493,12 +493,16 @@ dpaa2_eth_dev_configure(struct rte_eth_dev *dev)
        }
 
        if (eth_conf->rxmode.mq_mode == ETH_MQ_RX_RSS) {
-               ret = dpaa2_setup_flow_dist(dev,
-                               eth_conf->rx_adv_conf.rss_conf.rss_hf);
-               if (ret) {
-                       DPAA2_PMD_ERR("Unable to set flow distribution."
-                                     "Check queue config");
-                       return ret;
+               for (tc_index = 0; tc_index < priv->num_rx_tc; tc_index++) {
+                       ret = dpaa2_setup_flow_dist(dev,
+                                       eth_conf->rx_adv_conf.rss_conf.rss_hf,
+                                       tc_index);
+                       if (ret) {
+                               DPAA2_PMD_ERR(
+                                       "Unable to set flow distribution on tc%d."
+                                       "Check queue config", tc_index);
+                               return ret;
+                       }
                }
        }
 
@@ -755,11 +759,11 @@ dpaa2_dev_tx_queue_setup(struct rte_eth_dev *dev,
        flow_id = 0;
 
        ret = dpni_set_queue(dpni, CMD_PRI_LOW, priv->token, DPNI_QUEUE_TX,
-                            tc_id, flow_id, options, &tx_flow_cfg);
+                       tc_id, flow_id, options, &tx_flow_cfg);
        if (ret) {
                DPAA2_PMD_ERR("Error in setting the tx flow: "
-                             "tc_id=%d, flow=%d err=%d",
-                             tc_id, flow_id, ret);
+                       "tc_id=%d, flow=%d err=%d",
+                       tc_id, flow_id, ret);
                        return -1;
        }
 
@@ -1984,22 +1988,31 @@ dpaa2_dev_rss_hash_update(struct rte_eth_dev *dev,
                          struct rte_eth_rss_conf *rss_conf)
 {
        struct rte_eth_dev_data *data = dev->data;
+       struct dpaa2_dev_priv *priv = data->dev_private;
        struct rte_eth_conf *eth_conf = &data->dev_conf;
-       int ret;
+       int ret, tc_index;
 
        PMD_INIT_FUNC_TRACE();
 
        if (rss_conf->rss_hf) {
-               ret = dpaa2_setup_flow_dist(dev, rss_conf->rss_hf);
-               if (ret) {
-                       DPAA2_PMD_ERR("Unable to set flow dist");
-                       return ret;
+               for (tc_index = 0; tc_index < priv->num_rx_tc; tc_index++) {
+                       ret = dpaa2_setup_flow_dist(dev, rss_conf->rss_hf,
+                               tc_index);
+                       if (ret) {
+                               DPAA2_PMD_ERR("Unable to set flow dist on tc%d",
+                                       tc_index);
+                               return ret;
+                       }
                }
        } else {
-               ret = dpaa2_remove_flow_dist(dev, 0);
-               if (ret) {
-                       DPAA2_PMD_ERR("Unable to remove flow dist");
-                       return ret;
+               for (tc_index = 0; tc_index < priv->num_rx_tc; tc_index++) {
+                       ret = dpaa2_remove_flow_dist(dev, tc_index);
+                       if (ret) {
+                               DPAA2_PMD_ERR(
+                                       "Unable to remove flow dist on tc%d",
+                                       tc_index);
+                               return ret;
+                       }
                }
        }
        eth_conf->rx_adv_conf.rss_conf.rss_hf = rss_conf->rss_hf;
index b49b88a..52faeee 100644 (file)
@@ -179,7 +179,7 @@ int dpaa2_distset_to_dpkg_profile_cfg(uint64_t req_dist_set,
                                      struct dpkg_profile_cfg *kg_cfg);
 
 int dpaa2_setup_flow_dist(struct rte_eth_dev *eth_dev,
-                         uint64_t req_dist_set);
+               uint64_t req_dist_set, int tc_index);
 
 int dpaa2_remove_flow_dist(struct rte_eth_dev *eth_dev,
                           uint8_t tc_index);