From patchwork Wed Oct 14 08:41:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: SimonX Lu X-Patchwork-Id: 80688 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 88341A04B7; Wed, 14 Oct 2020 10:43:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC7121DCF6; Wed, 14 Oct 2020 10:43:12 +0200 (CEST) Received: from mga04.intel.com (mga04.intel.com [192.55.52.120]) by dpdk.org (Postfix) with ESMTP id 0A61D1DCEF for ; Wed, 14 Oct 2020 10:43:11 +0200 (CEST) IronPort-SDR: BcNQ5IfJT//VKjnvQttgcsToZfNxOj3nDmvPRw2zcxwS+QaUs9ONQH+9A2MN9Yc8aGmezyzqsi kMzsKCy9fl+g== X-IronPort-AV: E=McAfee;i="6000,8403,9773"; a="163432194" X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="163432194" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 01:43:11 -0700 IronPort-SDR: GGnNkXdk7m4jusqCMcbUs2ysc7O6uEt90QkmSm4zDlsle9HPAxsvwxDN4J+PgPQJn9Jl13f9hA +DBX+PooelPw== X-IronPort-AV: E=Sophos;i="5.77,374,1596524400"; d="scan'208";a="299864531" Received: from intel-npg-odc-srv01.cd.intel.com ([10.240.178.136]) by fmsmga008-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Oct 2020 01:43:08 -0700 From: SimonX Lu To: dev@dpdk.org Cc: jia.guo@intel.com, haiyue.wang@intel.com, qiming.yang@intel.com, beilei.xing@intel.com, orika@nvidia.com, Simon Lu Date: Wed, 14 Oct 2020 08:41:25 +0000 Message-Id: <20201014084131.72035-3-simonx.lu@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201014084131.72035-1-simonx.lu@intel.com> References: <20201014084131.72035-1-simonx.lu@intel.com> Subject: [dpdk-dev] [PATCH v1 2/8] app/testpmd: support action mirror for flow command 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" From: Simon Lu Add mirror index: ACTION_MIRROR, ACTION_MIRROR_VF, ACTION_MIRROR_VF_ID. Append the mirror action to the token_list for flow parse. Signed-off-by: Simon Lu --- app/test-pmd/cmdline_flow.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 6e04d538e..3bf4293a7 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -276,6 +276,9 @@ enum index { ACTION_VF, ACTION_VF_ORIGINAL, ACTION_VF_ID, + ACTION_MIRROR, + ACTION_MIRROR_VF, + ACTION_MIRROR_VF_ID, ACTION_PHY_PORT, ACTION_PHY_PORT_ORIGINAL, ACTION_PHY_PORT_INDEX, @@ -1144,6 +1147,7 @@ static const enum index next_action[] = { ACTION_DROP, ACTION_COUNT, ACTION_RSS, + ACTION_MIRROR, ACTION_PF, ACTION_VF, ACTION_PHY_PORT, @@ -1233,6 +1237,17 @@ static const enum index action_vf[] = { ZERO, }; +static const enum index action_mirror[] = { + ACTION_PF, + ACTION_MIRROR_VF, + ZERO, +}; + +static const enum index action_mirror_vf[] = { + ACTION_MIRROR_VF_ID, + ZERO, +}; + static const enum index action_phy_port[] = { ACTION_PHY_PORT_ORIGINAL, ACTION_PHY_PORT_INDEX, @@ -3116,6 +3131,27 @@ static const struct token token_list[] = { .call = parse_vc_action_rss_queue, .comp = comp_vc_action_rss_queue, }, + [ACTION_MIRROR] = { + .name = "mirror", + .help = "mirror", + .priv = PRIV_ACTION(MIRROR, 0), + .next = NEXT(action_mirror), + .call = parse_vc, + }, + [ACTION_MIRROR_VF] = { + .name = "vf", + .help = "direct traffic to a virtual function ID", + .priv = PRIV_ACTION(VF, sizeof(struct rte_flow_action_vf)), + .next = NEXT(action_mirror_vf), + .call = parse_vc, + }, + [ACTION_MIRROR_VF_ID] = { + .name = "id", + .help = "VF ID", + .next = NEXT(NEXT_ENTRY(ACTION_NEXT), NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARGS_ENTRY(struct rte_flow_action_vf, id)), + .call = parse_vc_conf, + }, [ACTION_PF] = { .name = "pf", .help = "direct traffic to physical function",