net/iavf: check RSS rule queue region size
authorTing Xu <ting.xu@intel.com>
Wed, 11 Nov 2020 06:42:50 +0000 (14:42 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Fri, 13 Nov 2020 18:43:26 +0000 (19:43 +0100)
When a rule is set to do RSS to redirect flows to a group of queues, the
queue region size should not be larger than the max RSS queue region
supported by HW. This patch added the step to check the queue region
size, and report failure if the size does not meet the requirement.

Fixes: e436cd43835b ("net/iavf: negotiate large VF and request more queues")
Cc: stable@dpdk.org
Signed-off-by: Ting Xu <ting.xu@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/iavf/iavf_fdir.c

index f584e56..d683a46 100644 (file)
@@ -256,6 +256,7 @@ iavf_fdir_parse_action_qregion(struct iavf_adapter *ad,
                        const struct rte_flow_action *act,
                        struct virtchnl_filter_action *filter_action)
 {
+       struct iavf_info *vf = IAVF_DEV_PRIVATE_TO_VF(ad);
        const struct rte_flow_action_rss *rss = act->conf;
        uint32_t i;
 
@@ -300,6 +301,13 @@ iavf_fdir_parse_action_qregion(struct iavf_adapter *ad,
                return -rte_errno;
        }
 
+       if (rss->queue_num > vf->max_rss_qregion) {
+               rte_flow_error_set(error, EINVAL,
+                               RTE_FLOW_ERROR_TYPE_ACTION, act,
+                               "The region size cannot be large than the supported max RSS queue region");
+               return -rte_errno;
+       }
+
        filter_action->act_conf.queue.index = rss->queue[0];
        filter_action->act_conf.queue.region = rte_fls_u32(rss->queue_num) - 1;