From patchwork Tue Mar 28 06:40:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Xing, Beilei" X-Patchwork-Id: 22490 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id 0D3EE37B7; Tue, 28 Mar 2017 08:41:44 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 8642F29C7 for ; Tue, 28 Mar 2017 08:41:17 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=intel.com; i=@intel.com; q=dns/txt; s=intel; t=1490683277; x=1522219277; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=i9n3s4L0q4WiUkLZDFk8LeMHkLIXOOrvZJCt30j3hPc=; b=KXBjZ1M6eeN+Zf/G5BdpSx73yptpLGwgISW1U5Olls94mN054Ft3J+22 RryA6Hlwuwklx7VkjlyOv2biCpa7Tw==; Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2017 23:41:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.36,235,1486454400"; d="scan'208";a="241093092" Received: from unknown (HELO dpdk9.sh.intel.com) ([10.239.129.31]) by fmsmga004.fm.intel.com with ESMTP; 27 Mar 2017 23:41:15 -0700 From: Beilei Xing To: jingjing.wu@intel.com Cc: helin.zhang@intel.com, bernard.iremonger@intel.com, dev@dpdk.org Date: Tue, 28 Mar 2017 14:40:06 +0800 Message-Id: <1490683208-38096-3-git-send-email-beilei.xing@intel.com> X-Mailer: git-send-email 2.5.5 In-Reply-To: <1490683208-38096-1-git-send-email-beilei.xing@intel.com> References: <1490266669-122137-1-git-send-email-beilei.xing@intel.com> <1490683208-38096-1-git-send-email-beilei.xing@intel.com> Subject: [dpdk-dev] [PATCH v3 2/4] app/testpmd: add MPLS and GRE fields to 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" This patch exposes the following item fields through the flow command: - MPLS label - GRE protocol Signed-off-by: Beilei Xing Acked-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 47 +++++++++++++++++++++++++++++ app/test-pmd/config.c | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 8 +++++ 3 files changed, 57 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index ff98690..2149df4 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -159,6 +159,10 @@ enum index { ITEM_SCTP_CKSUM, ITEM_VXLAN, ITEM_VXLAN_VNI, + ITEM_MPLS, + ITEM_MPLS_LABEL, + ITEM_GRE, + ITEM_GRE_PROTO, /* Validate/create actions. */ ACTIONS, @@ -432,6 +436,8 @@ static const enum index next_item[] = { ITEM_TCP, ITEM_SCTP, ITEM_VXLAN, + ITEM_MPLS, + ITEM_GRE, ZERO, }; @@ -538,6 +544,18 @@ static const enum index item_vxlan[] = { ZERO, }; +static const enum index item_mpls[] = { + ITEM_MPLS_LABEL, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_gre[] = { + ITEM_GRE_PROTO, + ITEM_NEXT, + ZERO, +}; + static const enum index next_action[] = { ACTION_END, ACTION_VOID, @@ -1279,6 +1297,35 @@ static const struct token token_list[] = { .next = NEXT(item_vxlan, NEXT_ENTRY(UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vxlan, vni)), }, + [ITEM_MPLS] = { + .name = "mpls", + .help = "match MPLS header", + .priv = PRIV_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), + .next = NEXT(item_mpls), + .call = parse_vc, + }, + [ITEM_MPLS_LABEL] = { + .name = "label", + .help = "MPLS label", + .next = NEXT(item_mpls, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_mpls, + label_tc_s, + "\xff\xff\xf0")), + }, + [ITEM_GRE] = { + .name = "gre", + .help = "match GRE header", + .priv = PRIV_ITEM(GRE, sizeof(struct rte_flow_item_gre)), + .next = NEXT(item_gre), + .call = parse_vc, + }, + [ITEM_GRE_PROTO] = { + .name = "protocol", + .help = "GRE protocol type", + .next = NEXT(item_gre, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_gre, + protocol)), + }, /* Validate/create actions. */ [ACTIONS] = { .name = "actions", diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c index eb3d572..90d153e 100644 --- a/app/test-pmd/config.c +++ b/app/test-pmd/config.c @@ -963,6 +963,8 @@ static const struct { MK_FLOW_ITEM(TCP, sizeof(struct rte_flow_item_tcp)), MK_FLOW_ITEM(SCTP, sizeof(struct rte_flow_item_sctp)), MK_FLOW_ITEM(VXLAN, sizeof(struct rte_flow_item_vxlan)), + MK_FLOW_ITEM(MPLS, sizeof(struct rte_flow_item_mpls)), + MK_FLOW_ITEM(GRE, sizeof(struct rte_flow_item_gre)), }; /** Compute storage space needed by item specification. */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index bdc6a14..1f4fd46 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2453,6 +2453,14 @@ This section lists supported pattern items and their attributes, if any. - ``vni {unsigned}``: VXLAN identifier. +- ``mpls``: match MPLS header. + + - ``label {unsigned}``: MPLS label. + +- ``gre``: match GRE header. + + - ``protocol {unsigned}``: protocol type. + Actions list ^^^^^^^^^^^^