net/ice: support mark only action for flow director
authorSimei Su <simei.su@intel.com>
Tue, 14 Apr 2020 15:11:13 +0000 (23:11 +0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 11 May 2020 20:27:39 +0000 (22:27 +0200)
This patch fixes issue that doesn't support mark only case.
Mark only action is equal to mark + passthru action.

Fixes: f5cafa961fae ("net/ice: add flow director create and destroy")
Cc: stable@dpdk.org
Signed-off-by: Simei Su <simei.su@intel.com>
Acked-by: Qi Zhang <qi.z.zhang@intel.com>
drivers/net/ice/ice_fdir_filter.c

index 1a85d6c..69c714c 100644 (file)
@@ -1539,7 +1539,7 @@ ice_fdir_parse_action(struct ice_adapter *ad,
                }
        }
 
-       if (dest_num == 0 || dest_num >= 2) {
+       if (dest_num >= 2) {
                rte_flow_error_set(error, EINVAL,
                           RTE_FLOW_ERROR_TYPE_ACTION, actions,
                           "Unsupported action combination");
@@ -1560,6 +1560,18 @@ ice_fdir_parse_action(struct ice_adapter *ad,
                return -rte_errno;
        }
 
+       if (dest_num + mark_num + counter_num == 0) {
+               rte_flow_error_set(error, EINVAL,
+                          RTE_FLOW_ERROR_TYPE_ACTION, actions,
+                          "Empty action");
+               return -rte_errno;
+       }
+
+       /* set default action to PASSTHRU mode, in "mark/count only" case. */
+       if (dest_num == 0)
+               filter->input.dest_ctl =
+                       ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_OTHER;
+
        return 0;
 }