diff mbox series

[05/12] net/ice: add FDIR mark action support

Message ID 20190906120058.108073-6-yahui.cao@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers show
Series net/ice: add ice Flow Director driver | expand

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail apply issues

Commit Message

Cao, Yahui Sept. 6, 2019, noon UTC
FDIR will add mark id in the packet mbuf when flow rule hits.

Signed-off-by: Yahui Cao <yahui.cao@intel.com>
---
 drivers/net/ice/ice_fdir_filter.c | 15 +++++++++++++++
 1 file changed, 15 insertions(+)
diff mbox series

Patch

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index 98bc1be49..294678075 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -577,7 +577,9 @@  ice_fdir_parse_action(struct ice_adapter *ad,
 {
 	struct ice_pf *pf = &ad->pf;
 	const struct rte_flow_action_queue *act_q;
+	const struct rte_flow_action_mark *mark_spec = NULL;
 	uint32_t dest_num = 0;
+	uint32_t mark_num = 0;
 
 	for (; actions->type != RTE_FLOW_ACTION_TYPE_END; actions++) {
 		switch (actions->type) {
@@ -611,6 +613,12 @@  ice_fdir_parse_action(struct ice_adapter *ad,
 				ICE_FLTR_PRGM_DESC_DEST_DIRECT_PKT_QINDEX;
 			filter->input.q_index = 0;
 			break;
+		case RTE_FLOW_ACTION_TYPE_MARK:
+			mark_num++;
+
+			mark_spec = actions->conf;
+			filter->input.fltr_id = mark_spec->id;
+			break;
 		default:
 			rte_flow_error_set(error, EINVAL,
 				   RTE_FLOW_ERROR_TYPE_ACTION, actions,
@@ -626,6 +634,13 @@  ice_fdir_parse_action(struct ice_adapter *ad,
 		return -rte_errno;
 	}
 
+	if (mark_num >= 2) {
+		rte_flow_error_set(error, EINVAL,
+			   RTE_FLOW_ERROR_TYPE_ACTION, actions,
+			   "Too many mark actions");
+		return -rte_errno;
+	}
+
 	return 0;
 }