From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 918EBA0579; Wed, 18 Mar 2020 06:44:26 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 09D0A1C0B6; Wed, 18 Mar 2020 06:43:55 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 8570A1C0B5 for ; Wed, 18 Mar 2020 06:43:53 +0100 (CET) IronPort-SDR: Pd3tXQ4Kl/RdNKoHNfaoq1TrhKb7QVQss0mp4sVaD7lradI7gUePyseUh5E8q1+gYwc34L7F3p CiMksRHqrErw== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Mar 2020 22:43:53 -0700 IronPort-SDR: 0SeAcj7Zew3gt7mPPFK6tGMY0o02ztLXvhA9de3hTXgBR9iuuF394TCkJlORK6nic/kCFcxDOc Yzi466rdV+og== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,566,1574150400"; d="scan'208";a="355592312" Received: from npg-dpdk-cvl-simeisu-118d193.sh.intel.com ([10.67.110.183]) by fmsmga001.fm.intel.com with ESMTP; 17 Mar 2020 22:43:51 -0700 From: Simei Su To: xiaolong.ye@intel.com, qi.z.zhang@intel.com Cc: dev@dpdk.org, yahui.cao@intel.com, jingjing.wu@intel.com, simei.su@intel.com Date: Wed, 18 Mar 2020 13:42:01 +0800 Message-Id: <1584510121-377747-6-git-send-email-simei.su@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1584510121-377747-1-git-send-email-simei.su@intel.com> References: <1584510121-377747-1-git-send-email-simei.su@intel.com> Subject: [dpdk-dev] [PATCH 5/5] net/iavf: add support for FDIR mark action X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch enables mark action support and takes mark only case into consideration. Signed-off-by: Simei Su --- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_fdir.c | 46 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 46 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 62a3eb8..178d481 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -103,6 +103,7 @@ struct iavf_fdir_conf { struct virtchnl_fdir_fltr input; uint64_t input_set; uint32_t flow_id; + uint32_t mark_flag; }; struct iavf_fdir_info { diff --git a/drivers/net/iavf/iavf_fdir.c b/drivers/net/iavf/iavf_fdir.c index 8d49c28..a03bc09 100644 --- a/drivers/net/iavf/iavf_fdir.c +++ b/drivers/net/iavf/iavf_fdir.c @@ -18,6 +18,7 @@ #include "iavf.h" #include "iavf_generic_flow.h" #include "virtchnl.h" +#include "iavf_rxtx.h" #define IAVF_FDIR_MAX_QREGION_SIZE 128 @@ -171,6 +172,9 @@ goto free_entry; } + if (filter->mark_flag == 1) + iavf_fdir_rx_proc_enable(ad, 1); + rte_memcpy(rule, filter, sizeof(*rule)); flow->rule = rule; @@ -199,6 +203,9 @@ return -rte_errno; } + if (filter->mark_flag == 1) + iavf_fdir_rx_proc_enable(ad, 0); + flow->rule = NULL; rte_free(filter); @@ -297,7 +304,9 @@ struct iavf_fdir_conf *filter) { 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; int ret; int number = 0; @@ -367,6 +376,20 @@ filter->input.rule_cfg.action_set.count = ++number; break; + case RTE_FLOW_ACTION_TYPE_MARK: + mark_num++; + + filter->mark_flag = 1; + mark_spec = actions->conf; + filter_action = &filter->input.rule_cfg. + action_set.actions[number]; + + filter_action->type = VIRTCHNL_FDIR_ACT_MARK; + filter_action->mark_id = mark_spec->id; + + filter->input.rule_cfg.action_set.count = ++number; + break; + default: rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions, @@ -375,13 +398,34 @@ } } - 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"); 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; + } + + if (dest_num + mark_num == 0) { + rte_flow_error_set(error, EINVAL, + RTE_FLOW_ERROR_TYPE_ACTION, actions, + "Emtpy action"); + return -rte_errno; + } + + /* Mark only is equal to mark + passthru. */ + if (dest_num == 0) { + filter_action = &filter->input.rule_cfg. + action_set.actions[number]; + filter_action->type = VIRTCHNL_FDIR_ACT_PASSTHRU; + } + return 0; } -- 1.8.3.1