From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr0-f175.google.com (mail-wr0-f175.google.com [209.85.128.175]) by dpdk.org (Postfix) with ESMTP id 464955A8D for ; Mon, 24 Apr 2017 17:53:33 +0200 (CEST) Received: by mail-wr0-f175.google.com with SMTP id w50so70983603wrc.0 for ; Mon, 24 Apr 2017 08:53:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=6wind-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=r1NMw0z8LU6cYTA9flNBfN5CyOPzbWj1VZv31BWEoSg=; b=EIdyIX9gNf9xsYMsRdayRjcnQC56fTfIFq+hJLA6pXVIQ8g48uO2klBBsY3P3mB8SP URTJE4g8Ax+jULnEsV5qQgPiU/LdQB93EbqEazfjwajCndPbPrxaLw5sOri3mEZlv4A4 a0iQkzG5UmEUfuo0N/bxYVNzR4LE1xWs4cffEWyNt9h3l7uLsa+rr91x/+g0jac1Qu/O 6kfv3hF9F2VaL3ucXY3ReiOyKl3d+Mp62X/inhn5uvPs5+jnuPU7TQCxpUTz+6axe42Y eCMw2dhlyem+i3DhA2nIfLffoslXlbiJMlt44hdNVkWJWO4Yl1WgsCUI8eQA+fBFrPA4 aopg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=r1NMw0z8LU6cYTA9flNBfN5CyOPzbWj1VZv31BWEoSg=; b=O5yEh9Q+ZpWGSlmUpRPgkGJu2eaiSemv6XQYoV5bwL+u7bkieGy8LzfFsBrCXH18fs uvBJOYpyXK04HAAiSOWWPI6/32nZMyh1/Dty5ZqMK07zsi31cQxZigINMUkld/44QSRE eWY3vcFfUuktZIQMgL43SIpDMITt+Eg8QMprZGIQXf0m6pe6ZFLYeZRQ6RWO4lzkB+/l hUuzGWG8ij27Vaa2+Wb/tSqLXd+1sMPg+ynbN2j1AP3nq6lkfkr8pzucOlpHZ1HeATMg k+OqHiVhF2I3qT5TwjjzUdYJypBfQB3jPHxjQWZJHjQduzIWFA5luTzNCHNYU29H1GNZ 78UA== X-Gm-Message-State: AN3rC/78NMqa41DYocxxXGxJD935bcvoUc604YbO5QWTXT30fZ5wHr5A JvXFhC4jLZs9fqI6 X-Received: by 10.223.165.138 with SMTP id g10mr7316777wrc.19.1493049213050; Mon, 24 Apr 2017 08:53:33 -0700 (PDT) Received: from 6wind.com (host.78.145.23.62.rev.coltfrance.com. [62.23.145.78]) by smtp.gmail.com with ESMTPSA id a37sm22878287wra.17.2017.04.24.08.53.32 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Mon, 24 Apr 2017 08:53:32 -0700 (PDT) From: Adrien Mazarguil To: dev@dpdk.org Cc: stable@dpdk.org, Wei Zhao , Wenzhuo Lu Date: Mon, 24 Apr 2017 17:53:07 +0200 Message-Id: <383be13e94d062a1ba01e16cc949001e9fb6b90f.1493048352.git.adrien.mazarguil@6wind.com> X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH 13/13] ethdev: fix incomplete items in flow API 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: , X-List-Received-Date: Mon, 24 Apr 2017 15:53:33 -0000 E-Tag and NVGRE pattern items have been added hastily without updating documentation nor testpmd. This commit also adds default masks for these items based on the ixgbe implementation. Fixes: 99e7003831c3 ("net/ixgbe: parse L2 tunnel filter") Cc: stable@dpdk.org Cc: Wei Zhao Cc: Wenzhuo Lu Signed-off-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 46 +++++++++++++++++++++++++++++++++ doc/guides/prog_guide/rte_flow.rst | 19 ++++++++++++++ lib/librte_ether/rte_flow.h | 21 +++++++++++++++ 3 files changed, 86 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index 4e99f0f..5514ee4 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_E_TAG, + ITEM_E_TAG_ECID_B, + ITEM_NVGRE, + ITEM_NVGRE_TNI, ITEM_MPLS, ITEM_MPLS_LABEL, ITEM_GRE, @@ -436,6 +440,8 @@ static const enum index next_item[] = { ITEM_TCP, ITEM_SCTP, ITEM_VXLAN, + ITEM_E_TAG, + ITEM_NVGRE, ITEM_MPLS, ITEM_GRE, ZERO, @@ -544,6 +550,18 @@ static const enum index item_vxlan[] = { ZERO, }; +static const enum index item_e_tag[] = { + ITEM_E_TAG_ECID_B, + ITEM_NEXT, + ZERO, +}; + +static const enum index item_nvgre[] = { + ITEM_NVGRE_TNI, + ITEM_NEXT, + ZERO, +}; + static const enum index item_mpls[] = { ITEM_MPLS_LABEL, ITEM_NEXT, @@ -1297,6 +1315,34 @@ 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_E_TAG] = { + .name = "e_tag", + .help = "match E-Tag header", + .priv = PRIV_ITEM(E_TAG, sizeof(struct rte_flow_item_e_tag)), + .next = NEXT(item_e_tag), + .call = parse_vc, + }, + [ITEM_E_TAG_ECID_B] = { + .name = "ecid_b", + .help = "E-CID base", + .next = NEXT(item_e_tag, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_e_tag, + rsvd_grp_ecid_b, + "\x3f\xff")), + }, + [ITEM_NVGRE] = { + .name = "nvgre", + .help = "match NVGRE header", + .priv = PRIV_ITEM(NVGRE, sizeof(struct rte_flow_item_nvgre)), + .next = NEXT(item_nvgre), + .call = parse_vc, + }, + [ITEM_NVGRE_TNI] = { + .name = "tni", + .help = "Virtual subnet ID", + .next = NEXT(item_nvgre, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_nvgre, tni)), + }, [ITEM_MPLS] = { .name = "mpls", .help = "match MPLS header", diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst index 9bca9ec..5dfd8a2 100644 --- a/doc/guides/prog_guide/rte_flow.rst +++ b/doc/guides/prog_guide/rte_flow.rst @@ -863,6 +863,25 @@ Matches a VXLAN header (RFC 7348). - ``rsvd1``: reserved, normally 0x00. - Default ``mask`` matches VNI only. +Item: ``E_TAG`` +^^^^^^^^^^^^^^^ + +Matches an IEEE 802.1BR E-Tag header. + +- ``tpid``: tag protocol identifier (0x893F) +- ``epcp_edei_in_ecid_b``: E-Tag control information (E-TCI), E-PCP (3b), + E-DEI (1b), ingress E-CID base (12b). +- ``rsvd_grp_ecid_b``: reserved (2b), GRP (2b), E-CID base (12b). +- ``in_ecid_e``: ingress E-CID ext. +- ``ecid_e``: E-CID ext. + +Item: ``NVGRE`` +^^^^^^^^^^^^^^^ + +Matches a NVGRE header (RFC 7637). + +- ``c_k_s_rsvd0_ver`` + Item: ``MPLS`` ^^^^^^^^^^^^^^ diff --git a/lib/librte_ether/rte_flow.h b/lib/librte_ether/rte_flow.h index abd4c6a..c47edbc 100644 --- a/lib/librte_ether/rte_flow.h +++ b/lib/librte_ether/rte_flow.h @@ -49,6 +49,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { @@ -620,6 +621,19 @@ struct rte_flow_item_e_tag { uint8_t ecid_e; /**< E-CID ext. */ }; +/** Default mask for RTE_FLOW_ITEM_TYPE_E_TAG. */ +#ifndef __cplusplus +static const struct rte_flow_item_e_tag rte_flow_item_e_tag_mask = { +#if RTE_BYTE_ORDER == RTE_BIG_ENDIAN + .rsvd_grp_ecid_b = 0x3fff, +#elif RTE_BYTE_ORDER == RTE_LITTLE_ENDIAN + .rsvd_grp_ecid_b = 0xff3f, +#else +#error Unsupported endianness. +#endif +}; +#endif + /** * RTE_FLOW_ITEM_TYPE_NVGRE. * @@ -638,6 +652,13 @@ struct rte_flow_item_nvgre { uint8_t flow_id; /**< Flow ID. */ }; +/** Default mask for RTE_FLOW_ITEM_TYPE_NVGRE. */ +#ifndef __cplusplus +static const struct rte_flow_item_nvgre rte_flow_item_nvgre_mask = { + .tni = "\xff\xff\xff", +}; +#endif + /** * RTE_FLOW_ITEM_TYPE_MPLS. * -- 2.1.4