DPDK patches and discussions
 help / color / mirror / Atom feed
From: Wei Zhao <wei.zhao1@intel.com>
To: dev@dpdk.org
Cc: stable@dpdk.org, qi.z.zhang@intel.com, nannan.lu@intel.com,
	Wei Zhao <wei.zhao1@intel.com>
Subject: [dpdk-dev] [PATCH v2] net/ice: fix VF index check for DCF
Date: Wed, 12 Aug 2020 08:56:46 +0800
Message-ID: <20200812005646.58732-1-wei.zhao1@intel.com> (raw)
In-Reply-To: <20200810024123.23387-1-wei.zhao1@intel.com>

The vf index in rte_flow command need to check
in order that larger the actual number. Also
change some error log for wrong action.

Fixes: 829c3106812d ("net/ice: enable switch flow on DCF")
Cc: stable@dpdk.org

Signed-off-by: Wei Zhao <wei.zhao1@intel.com>

---
v2: change error log
---
 drivers/net/ice/ice_switch_filter.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ice/ice_switch_filter.c b/drivers/net/ice/ice_switch_filter.c
index c4b00b6a2..0e0267c04 100644
--- a/drivers/net/ice/ice_switch_filter.c
+++ b/drivers/net/ice/ice_switch_filter.c
@@ -1405,6 +1405,16 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 		case RTE_FLOW_ACTION_TYPE_VF:
 			rule_info->sw_act.fltr_act = ICE_FWD_TO_VSI;
 			act_vf = action->conf;
+
+			if (act_vf->id >= ad->real_hw.num_vfs &&
+				!act_vf->original) {
+				rte_flow_error_set(error,
+					EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
+					actions,
+					"Invalid vf id");
+				return -rte_errno;
+			}
+
 			if (act_vf->original)
 				rule_info->sw_act.vsi_handle =
 					ad->real_hw.avf.bus.func;
@@ -1415,7 +1425,7 @@ ice_switch_parse_dcf_action(struct ice_dcf_adapter *ad,
 			rte_flow_error_set(error,
 					   EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
 					   actions,
-					   "Invalid action type or queue number");
+					   "Invalid action type");
 			return -rte_errno;
 		}
 	}
@@ -1667,12 +1677,8 @@ ice_switch_parse_pattern_action(struct ice_adapter *ad,
 	else
 		ret = ice_switch_parse_action(pf, actions, error, &rule_info);
 
-	if (ret) {
-		rte_flow_error_set(error, EINVAL,
-				   RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
-				   "Invalid input action");
+	if (ret)
 		goto error;
-	}
 
 	if (meta) {
 		*meta = sw_meta_ptr;
-- 
2.19.1


  reply	other threads:[~2020-08-12  1:23 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10  2:41 [dpdk-dev] [PATCH] " Wei Zhao
2020-08-12  0:56 ` Wei Zhao [this message]
2020-08-12  2:43   ` [dpdk-dev] [PATCH v2] " Lu, Nannan
2020-08-12  2:53   ` [dpdk-dev] [PATCH v3] " Wei Zhao
2020-08-13  2:14     ` [dpdk-dev] [PATCH v4] " Wei Zhao
2020-08-31  4:09       ` Zhang, Qi Z

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200812005646.58732-1-wei.zhao1@intel.com \
    --to=wei.zhao1@intel.com \
    --cc=dev@dpdk.org \
    --cc=nannan.lu@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=stable@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

DPDK patches and discussions

This inbox may be cloned and mirrored by anyone:

	git clone --mirror https://inbox.dpdk.org/dev/0 dev/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 dev dev/ https://inbox.dpdk.org/dev \
		dev@dpdk.org
	public-inbox-index dev

Example config snippet for mirrors.
Newsgroup available over NNTP:
	nntp://inbox.dpdk.org/inbox.dpdk.dev


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git