ethdev: fix VLAN offloads set if no relative capabilities
[dpdk.git] / drivers / net / dpaa2 / dpaa2_ethdev.c
index 492b658..e0833b7 100644 (file)
@@ -145,7 +145,7 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask)
 {
        struct dpaa2_dev_priv *priv = dev->data->dev_private;
        struct fsl_mc_io *dpni = dev->process_private;
-       int ret;
+       int ret = 0;
 
        PMD_INIT_FUNC_TRACE();
 
@@ -153,7 +153,7 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask)
                /* VLAN Filter not avaialble */
                if (!priv->max_vlan_filters) {
                        DPAA2_PMD_INFO("VLAN filter not available");
-                       goto next_mask;
+                       return -ENOTSUP;
                }
 
                if (dev->data->dev_conf.rxmode.offloads &
@@ -166,14 +166,8 @@ dpaa2_vlan_offload_set(struct rte_eth_dev *dev, int mask)
                if (ret < 0)
                        DPAA2_PMD_INFO("Unable to set vlan filter = %d", ret);
        }
-next_mask:
-       if (mask & ETH_VLAN_EXTEND_MASK) {
-               if (dev->data->dev_conf.rxmode.offloads &
-                       DEV_RX_OFFLOAD_VLAN_EXTEND)
-                       DPAA2_PMD_INFO("VLAN extend offload not supported");
-       }
 
-       return 0;
+       return ret;
 }
 
 static int
@@ -453,7 +447,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 +487,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 +753,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 +1982,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;
@@ -2392,6 +2399,10 @@ dpaa2_dev_init(struct rte_eth_dev *eth_dev)
        }
 
        priv->num_rx_tc = attr.num_rx_tcs;
+       priv->qos_entries = attr.qos_entries;
+       priv->fs_entries = attr.fs_entries;
+       priv->dist_queues = attr.num_queues;
+
        /* only if the custom CG is enabled */
        if (attr.options & DPNI_OPT_CUSTOM_CG)
                priv->max_cgs = attr.num_cgs;
@@ -2610,11 +2621,8 @@ dpaa2_dev_uninit(struct rte_eth_dev *eth_dev)
        eth_dev->process_private = NULL;
        rte_free(dpni);
 
-       for (i = 0; i < MAX_TCS; i++) {
-               if (priv->extract.tc_extract_param[i])
-                       rte_free((void *)
-                               (size_t)priv->extract.tc_extract_param[i]);
-       }
+       for (i = 0; i < MAX_TCS; i++)
+               rte_free((void *)(size_t)priv->extract.tc_extract_param[i]);
 
        if (priv->extract.qos_extract_param)
                rte_free((void *)(size_t)priv->extract.qos_extract_param);