net/mlx5: move Linux-specific functions
[dpdk.git] / drivers / net / hns3 / hns3_flow.c
index 98affa5..c7851b2 100644 (file)
@@ -1333,6 +1333,7 @@ hns3_disable_rss(struct hns3_hw *hw)
 
        /* Disable RSS */
        hw->rss_info.conf.types = 0;
+       hw->rss_dis_flag = true;
 
        return 0;
 }
@@ -1474,6 +1475,14 @@ hns3_config_rss_filter(struct rte_eth_dev *dev,
                return -EINVAL;
        }
 
+       if (rss_flow_conf.key_len &&
+           rss_flow_conf.key_len > RTE_DIM(rss_info->key)) {
+               hns3_err(hw,
+                       "input hash key(%u) greater than supported len(%zu)",
+                       rss_flow_conf.key_len, RTE_DIM(rss_info->key));
+               return -EINVAL;
+       }
+
        /* Filter the unsupported flow types */
        flow_types = rss_flow_conf.types & HNS3_ETH_RSS_SUPPORT;
        if (flow_types != rss_flow_conf.types)
@@ -1546,6 +1555,19 @@ hns3_clear_rss_filter(struct rte_eth_dev *dev)
        return hns3_config_rss_filter(dev, &hw->rss_info, false);
 }
 
+/* Restore the rss filter */
+int
+hns3_restore_rss_filter(struct rte_eth_dev *dev)
+{
+       struct hns3_adapter *hns = dev->data->dev_private;
+       struct hns3_hw *hw = &hns->hw;
+
+       if (hw->rss_info.conf.queue_num == 0)
+               return 0;
+
+       return hns3_config_rss_filter(dev, &hw->rss_info, true);
+}
+
 static int
 hns3_flow_parse_rss(struct rte_eth_dev *dev,
                    const struct hns3_rss_conf *conf, bool add)
@@ -1827,8 +1849,11 @@ hns3_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
        }
 
        ret = hns3_clear_rss_filter(dev);
-       if (ret)
+       if (ret) {
+               rte_flow_error_set(error, ret, RTE_FLOW_ERROR_TYPE_HANDLE,
+                                  NULL, "Failed to flush rss filter");
                return ret;
+       }
 
        hns3_filterlist_flush(dev);