X-Git-Url: http://git.droids-corp.org/?a=blobdiff_plain;f=drivers%2Fnet%2Fhns3%2Fhns3_flow.c;h=c7851b235c7717b5df07785cb0cd525c652aa039;hb=1256805dd54d;hp=bcd121f48b49c4316bf139df772936cf1e1bcfe8;hpb=c37ca66f2b27473b31de12d3dff66808753949ca;p=dpdk.git diff --git a/drivers/net/hns3/hns3_flow.c b/drivers/net/hns3/hns3_flow.c index bcd121f48b..c7851b235c 100644 --- a/drivers/net/hns3/hns3_flow.c +++ b/drivers/net/hns3/hns3_flow.c @@ -224,14 +224,19 @@ hns3_handle_action_queue(struct rte_eth_dev *dev, struct rte_flow_error *error) { struct hns3_adapter *hns = dev->data->dev_private; - struct hns3_hw *hw = &hns->hw; const struct rte_flow_action_queue *queue; + struct hns3_hw *hw = &hns->hw; queue = (const struct rte_flow_action_queue *)action->conf; - if (queue->index >= hw->data->nb_rx_queues) + if (queue->index >= hw->used_rx_queues) { + hns3_err(hw, "queue ID(%d) is greater than number of " + "available queue (%d) in driver.", + queue->index, hw->used_rx_queues); return rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, action, "Invalid queue ID in PF"); + } + rule->queue_id = queue->index; rule->action = HNS3_FD_ACTION_ACCEPT_PACKET; return 0; @@ -1328,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; } @@ -1469,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) @@ -1541,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) @@ -1822,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); @@ -1882,8 +1912,6 @@ hns3_dev_filter_ctrl(struct rte_eth_dev *dev, enum rte_filter_type filter_type, struct hns3_hw *hw; int ret = 0; - if (dev == NULL) - return -EINVAL; hw = HNS3_DEV_PRIVATE_TO_HW(dev->data->dev_private); switch (filter_type) { case RTE_ETH_FILTER_GENERIC: