[v3,08/12] net/ice/base: fix unexpected switch rule overwrite

Message ID 20191008015018.17086-9-qi.z.zhang@intel.com (mailing list archive)
State Accepted, archived
Delegated to: xiaolong ye
Headers
Series net/ice: base code update |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation success Compilation OK

Commit Message

Qi Zhang Oct. 8, 2019, 1:50 a.m. UTC
  A switch rule with "drop" action will be overwritten by a
rule with same pattern match but with a "to queue" action.
While in an inversed flow creation sequence, the "to queue"
can't be overwritten by the "drop" rule.

The inconsistent behavior is not expected, the patch
fix the issue by preventing rule overwrite in both cases.

Fixes: fed0c5ca5f19 ("net/ice/base: support programming a new switch recipe")

Signed-off-by: Qi Zhang <qi.z.zhang@intel.com>
Signed-off-by: Paul M Stillwell Jr <paul.m.stillwell.jr@intel.com>
Acked-by: Qiming Yang <qiming.yang@intel.com>
---
 drivers/net/ice/base/ice_switch.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)
  

Patch

diff --git a/drivers/net/ice/base/ice_switch.c b/drivers/net/ice/base/ice_switch.c
index 334f1b5e0..2c02021b1 100644
--- a/drivers/net/ice/base/ice_switch.c
+++ b/drivers/net/ice/base/ice_switch.c
@@ -5977,13 +5977,10 @@  ice_adv_add_update_vsi_list(struct ice_hw *hw,
 	u16 vsi_list_id = 0;
 
 	if (cur_fltr->sw_act.fltr_act == ICE_FWD_TO_Q ||
-	    cur_fltr->sw_act.fltr_act == ICE_FWD_TO_QGRP)
+	    cur_fltr->sw_act.fltr_act == ICE_FWD_TO_QGRP ||
+	    cur_fltr->sw_act.fltr_act == ICE_DROP_PACKET)
 		return ICE_ERR_NOT_IMPL;
 
-	if (cur_fltr->sw_act.fltr_act == ICE_DROP_PACKET &&
-	    new_fltr->sw_act.fltr_act == ICE_DROP_PACKET)
-		return ICE_ERR_ALREADY_EXISTS;
-
 	if ((new_fltr->sw_act.fltr_act == ICE_FWD_TO_Q ||
 	     new_fltr->sw_act.fltr_act == ICE_FWD_TO_QGRP) &&
 	    (cur_fltr->sw_act.fltr_act == ICE_FWD_TO_VSI ||