net/i40e: fix flow double mark action error check

Message ID 1564091449-34248-1-git-send-email-mesut.a.ergin@intel.com (mailing list archive)
State Accepted, archived
Delegated to: Qi Zhang
Headers
Series net/i40e: fix flow double mark action error check |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

Ergin, Mesut A July 25, 2019, 9:50 p.m. UTC
  This commit fixes an issue with the error checking in flow
MARK action. Previously, (ANY + MARK) would fail, as the
(mark_spec == 0) condition would cause an early error return,
however really it is (mark_spec != 0) that should cause the
early error return.

Flipping the binary comparison corrects the behaviour, and
(ANY + MARK) now succeeds, while (MARK + MARK) fails.

Fixes: 0bbcfc706a2b ("net/i40e: support MARK and RSS flow action")

Suggested-by: Harry van Haaren <harry.van.haaren@intel.com>
Signed-off-by: Mesut Ali Ergin <mesut.a.ergin@intel.com>
---
 drivers/net/i40e/i40e_flow.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
  

Comments

Qi Zhang July 26, 2019, 4:48 a.m. UTC | #1
> -----Original Message-----
> From: Ergin, Mesut A
> Sent: Friday, July 26, 2019 5:51 AM
> To: Xing, Beilei <beilei.xing@intel.com>; Zhang, Qi Z <qi.z.zhang@intel.com>
> Cc: dev@dpdk.org; Van Haaren, Harry <harry.van.haaren@intel.com>; Ergin,
> Mesut A <mesut.a.ergin@intel.com>
> Subject: [PATCH] net/i40e: fix flow double mark action error check
> 
> This commit fixes an issue with the error checking in flow MARK action.
> Previously, (ANY + MARK) would fail, as the (mark_spec == 0) condition
> would cause an early error return, however really it is (mark_spec != 0) that
> should cause the early error return.
> 
> Flipping the binary comparison corrects the behaviour, and (ANY + MARK)
> now succeeds, while (MARK + MARK) fails.
> 
> Fixes: 0bbcfc706a2b ("net/i40e: support MARK and RSS flow action")
> 
> Suggested-by: Harry van Haaren <harry.van.haaren@intel.com>
> Signed-off-by: Mesut Ali Ergin <mesut.a.ergin@intel.com>
> ---

Acked-by: Qi Zhang <qi.z.zhang@intel.com>

Applied to dpdk-next-net-intel.

Thanks
Qi
  

Patch

diff --git a/drivers/net/i40e/i40e_flow.c b/drivers/net/i40e/i40e_flow.c
index c60c9e2..e902a35 100644
--- a/drivers/net/i40e/i40e_flow.c
+++ b/drivers/net/i40e/i40e_flow.c
@@ -3105,7 +3105,7 @@  i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
 	NEXT_ITEM_OF_ACTION(act, actions, index);
 	switch (act->type) {
 	case RTE_FLOW_ACTION_TYPE_MARK:
-		if (!mark_spec) {
+		if (mark_spec) {
 			/* Double MARK actions requested */
 			rte_flow_error_set(error, EINVAL,
 			   RTE_FLOW_ERROR_TYPE_ACTION, act,
@@ -3117,7 +3117,7 @@  i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
 		filter->soft_id = mark_spec->id;
 		break;
 	case RTE_FLOW_ACTION_TYPE_FLAG:
-		if (!mark_spec) {
+		if (mark_spec) {
 			/* MARK + FLAG not supported */
 			rte_flow_error_set(error, EINVAL,
 					   RTE_FLOW_ERROR_TYPE_ACTION, act,