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 B220FA0561; Tue, 21 Apr 2020 08:24:53 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 9C4B91D732; Tue, 21 Apr 2020 08:24:29 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id 34E0E1D718 for ; Tue, 21 Apr 2020 08:24:11 +0200 (CEST) IronPort-SDR: DmXCLxtgmGsbHByb+icHHPeZkl9y3MSjq5EyVhZnQJfsZZP7B0XALGLVtNs1XK2xwxNeXcMGNU vr51Nw7s7QVA== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Apr 2020 23:24:10 -0700 IronPort-SDR: JM4d/k6lV24H6vHZICl4KO3pPqjK21atSbxGi0gr7HqNdNpRYNaNQqpRiF4aeh0h0yyy1dQETe dtMfHDSozKMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.72,409,1580803200"; d="scan'208";a="273422204" Received: from unknown (HELO npg-dpdk-cvl-simeisu-118d193.sh.intel.com) ([10.67.110.183]) by orsmga002.jf.intel.com with ESMTP; 20 Apr 2020 23:24:09 -0700 From: Simei Su To: qi.z.zhang@intel.com, xiaolong.ye@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org, yahui.cao@intel.com, simei.su@intel.com Date: Tue, 21 Apr 2020 14:19:30 +0800 Message-Id: <1587449970-358397-6-git-send-email-simei.su@intel.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1587449970-358397-1-git-send-email-simei.su@intel.com> References: <1586919319-221220-1-git-send-email-simei.su@intel.com> <1587449970-358397-1-git-send-email-simei.su@intel.com> Subject: [dpdk-dev] [PATCH v5 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 Reviewed-by: Qi Zhang --- drivers/net/iavf/iavf.h | 1 + drivers/net/iavf/iavf_fdir.c | 45 +++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 45 insertions(+), 1 deletion(-) diff --git a/drivers/net/iavf/iavf.h b/drivers/net/iavf/iavf.h index 30208d4..5fb7881 100644 --- a/drivers/net/iavf/iavf.h +++ b/drivers/net/iavf/iavf.h @@ -97,6 +97,7 @@ struct iavf_fdir_conf { struct virtchnl_fdir_del del_fltr; 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 1e50a07..406622c 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 @@ -170,6 +171,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; @@ -198,6 +202,9 @@ return -rte_errno; } + if (filter->mark_flag == 1) + iavf_fdir_rx_proc_enable(ad, 0); + flow->rule = NULL; rte_free(filter); @@ -296,7 +303,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; @@ -362,6 +371,19 @@ filter->add_fltr.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->add_fltr.rule_cfg.action_set.actions[number]; + + filter_action->type = VIRTCHNL_ACTION_MARK; + filter_action->act_conf.mark_id = mark_spec->id; + + filter->add_fltr.rule_cfg.action_set.count = ++number; + break; + default: rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, actions, @@ -377,13 +399,34 @@ return -rte_errno; } - 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->add_fltr.rule_cfg.action_set.actions[number]; + filter_action->type = VIRTCHNL_ACTION_PASSTHRU; + filter->add_fltr.rule_cfg.action_set.count = ++number; + } + return 0; } -- 1.8.3.1