net/ice: handle flow mark offload properly

Message ID 20191105070400.40511-1-qi.z.zhang@intel.com (mailing list archive)
State Superseded, archived
Delegated to: xiaolong ye
Headers
Series net/ice: handle flow mark offload properly |

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues
ci/travis-robot warning Travis build: failed
ci/Performance-Testing fail build patch failure

Commit Message

Qi Zhang Nov. 5, 2019, 7:04 a.m. UTC
  1. Do not select vector path if DEV_RX_OFFLOAD_FLOW_MARK is required.
2. return error when a rte_flow rule require software mark action while
   DEV_RX_OFFLOAD_FLOW_MARK is not configured.

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

This patch depends on patchset:
http://patchwork.dpdk.org/project/dpdk/list/?series=7076

 drivers/net/ice/ice_fdir_filter.c     | 8 +++++++-
 drivers/net/ice/ice_rxtx_vec_common.h | 6 +++++-
 2 files changed, 12 insertions(+), 2 deletions(-)
  

Patch

diff --git a/drivers/net/ice/ice_fdir_filter.c b/drivers/net/ice/ice_fdir_filter.c
index fbbc41ff0..83d3adab9 100644
--- a/drivers/net/ice/ice_fdir_filter.c
+++ b/drivers/net/ice/ice_fdir_filter.c
@@ -1254,6 +1254,7 @@  ice_fdir_parse_action(struct ice_adapter *ad,
 		      struct rte_flow_error *error,
 		      struct ice_fdir_filter_conf *filter)
 {
+	struct rte_eth_rxmode *rxmode = &ad->eth_dev->data->dev_conf.rxmode;
 	struct ice_pf *pf = &ad->pf;
 	const struct rte_flow_action_queue *act_q;
 	const struct rte_flow_action_mark *mark_spec = NULL;
@@ -1305,8 +1306,13 @@  ice_fdir_parse_action(struct ice_adapter *ad,
 				return ret;
 			break;
 		case RTE_FLOW_ACTION_TYPE_MARK:
+			if (!(rxmode->offloads & DEV_RX_OFFLOAD_FLOW_MARK)) {
+				rte_flow_error_set(error, EINVAL,
+					RTE_FLOW_ERROR_TYPE_ACTION, actions,
+					"DEV_RX_OFFLOAD_FLOW_MARK is not enabled");
+				return -rte_errno;
+			}
 			mark_num++;
-
 			mark_spec = actions->conf;
 			filter->input.fltr_id = mark_spec->id;
 			break;
diff --git a/drivers/net/ice/ice_rxtx_vec_common.h b/drivers/net/ice/ice_rxtx_vec_common.h
index 080ca4175..9d8918928 100644
--- a/drivers/net/ice/ice_rxtx_vec_common.h
+++ b/drivers/net/ice/ice_rxtx_vec_common.h
@@ -266,8 +266,12 @@  ice_tx_vec_queue_default(struct ice_tx_queue *txq)
 static inline int
 ice_rx_vec_dev_check_default(struct rte_eth_dev *dev)
 {
-	int i;
+	struct rte_eth_rxmode *rxmode = &dev->data->dev_conf.rxmode;
 	struct ice_rx_queue *rxq;
+	int i;
+
+	if (rxmode->offloads & DEV_RX_OFFLOAD_FLOW_MARK)
+		return -1;
 
 	for (i = 0; i < dev->data->nb_rx_queues; i++) {
 		rxq = dev->data->rx_queues[i];