net/i40e: check invalid VF queue id for FDIR
authorBeilei Xing <beilei.xing@intel.com>
Fri, 14 Jul 2017 06:51:36 +0000 (14:51 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Wed, 19 Jul 2017 08:09:13 +0000 (11:09 +0300)
There's only invalid queue id checking for PF when creating FDIR
rules, this patch adds checking invalid queue id for VF.

Signed-off-by: Beilei Xing <beilei.xing@intel.com>
drivers/net/i40e/i40e_flow.c

index 93ecee2..95af701 100644 (file)
@@ -2846,7 +2846,10 @@ i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
        case RTE_FLOW_ACTION_TYPE_QUEUE:
                act_q = (const struct rte_flow_action_queue *)act->conf;
                filter->action.rx_queue = act_q->index;
-               if (filter->action.rx_queue >= pf->dev_data->nb_rx_queues) {
+               if ((!filter->input.flow_ext.is_vf &&
+                    filter->action.rx_queue >= pf->dev_data->nb_rx_queues) ||
+                   (filter->input.flow_ext.is_vf &&
+                    filter->action.rx_queue >= pf->vf_nb_qps)) {
                        rte_flow_error_set(error, EINVAL,
                                           RTE_FLOW_ERROR_TYPE_ACTION, act,
                                           "Invalid queue ID for FDIR.");