From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm0-f41.google.com (mail-wm0-f41.google.com [74.125.82.41]) by dpdk.org (Postfix) with ESMTP id 3F1AA10CA4 for ; Wed, 21 Dec 2016 15:53:14 +0100 (CET) Received: by mail-wm0-f41.google.com with SMTP id g23so150586268wme.1 for ; Wed, 21 Dec 2016 06:53:14 -0800 (PST) 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=+GYSRZZlMWXCSGOtpnMDAA5S1UVhEnsOsMSRodN5ai4=; b=PlsDkQHs9CgnqJRpQ0ikc77LRKD5/Uh9X0TRyHsJ3Mn74L4KZKeAtvHLWDykosOyEK L73llvFNV6Lt/UxxQdGtHgGJ894WB6Qj1TsOwrGF98MbprfQMTBK4wgRhB6KUf+b2J2p AHYguwMxhbUlP+X1teFml1W2rTxUH4WjkHQkSyZRnVuqXIxGJGyE2epiLl8PUyQkRhke Y33nr6GqQIo18dL2wGQiB3EI4eJvgxOk2ZDScTzWwI+cAJI+P41xdVKIXjsigziPrdw8 KpkepIljKk88l6a1bL/XJKyfI+l4IoS5DtBS/6yIl74gQbNifry6p+bX8/5z6U9scD46 XrRw== 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=+GYSRZZlMWXCSGOtpnMDAA5S1UVhEnsOsMSRodN5ai4=; b=sAnPYz9T+b8HyTe5uFviQHZPlYuwgtPv+QO90INapuiX/Q5Tk9689EJehUIQhujbLR y3jSGVYfRX/jshQU3y39TtXaOR7FdaWzTbgdFygKM5m/3XdfXtlwbV0nuXRw2zxawVuJ sD7EyeH9FH45nwhbwV0NtbzhBd3N1BBs9r2MEd7gYQiingVBjKkhN1Y18gHm3WnjAm6K m4MuJPMAxpUcMgqLfqHq0p730Y4ukS8RJal9TUuEO2lsz3wRBE3kvhR8n/L9LHbHUzfQ oL+h7ZcymgIADYnAjOHQekmG5Vyx4ImRM4jkMt5S+zQn7Wcl5ATFvUb1zAOTfKZAMvKk bk+g== X-Gm-Message-State: AIkVDXIuntoWo3dnRMl7wnX4jNYf4Q3Xx9AlKJhWRfeqGLuE3oSARaQl33HvUJMZ4+kR2KQu X-Received: by 10.28.127.20 with SMTP id a20mr4027379wmd.15.1482331994444; Wed, 21 Dec 2016 06:53:14 -0800 (PST) Received: from 6wind.com (guy78-3-82-239-227-177.fbx.proxad.net. [82.239.227.177]) by smtp.gmail.com with ESMTPSA id 81sm27508656wmw.7.2016.12.21.06.53.12 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 21 Dec 2016 06:53:13 -0800 (PST) From: Adrien Mazarguil To: dev@dpdk.org Cc: "Xing, Beilei" , "Pei, Yulong" , Nelio Laranjeiro Date: Wed, 21 Dec 2016 15:51:42 +0100 Message-Id: X-Mailer: git-send-email 2.1.4 In-Reply-To: References: Subject: [dpdk-dev] [PATCH v5 26/26] app/testpmd: add protocol 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: , X-List-Received-Date: Wed, 21 Dec 2016 14:53:15 -0000 This commit exposes the following item fields through the flow command: - VLAN priority code point, drop eligible indicator and VLAN identifier (all part of TCI). - IPv4 type of service, time to live and protocol. - IPv6 traffic class, flow label, next header and hop limit. - SCTP tag and checksum. Cc: Xing, Beilei Cc: Pei, Yulong Signed-off-by: Nelio Laranjeiro Signed-off-by: Adrien Mazarguil --- app/test-pmd/cmdline_flow.c | 127 +++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 12 +++ 2 files changed, 139 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index db680c6..7760c2d 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -126,10 +126,20 @@ enum index { ITEM_VLAN, ITEM_VLAN_TPID, ITEM_VLAN_TCI, + ITEM_VLAN_PCP, + ITEM_VLAN_DEI, + ITEM_VLAN_VID, ITEM_IPV4, + ITEM_IPV4_TOS, + ITEM_IPV4_TTL, + ITEM_IPV4_PROTO, ITEM_IPV4_SRC, ITEM_IPV4_DST, ITEM_IPV6, + ITEM_IPV6_TC, + ITEM_IPV6_FLOW, + ITEM_IPV6_PROTO, + ITEM_IPV6_HOP, ITEM_IPV6_SRC, ITEM_IPV6_DST, ITEM_ICMP, @@ -144,6 +154,8 @@ enum index { ITEM_SCTP, ITEM_SCTP_SRC, ITEM_SCTP_DST, + ITEM_SCTP_TAG, + ITEM_SCTP_CKSUM, ITEM_VXLAN, ITEM_VXLAN_VNI, @@ -281,6 +293,23 @@ struct token { .mask = (const void *)&(const s){ .f = (1 << (b)) - 1 }, \ }) +/** Static initializer for ARGS() to target an arbitrary bit-mask. */ +#define ARGS_ENTRY_MASK(s, f, m) \ + (&(const struct arg){ \ + .offset = offsetof(s, f), \ + .size = sizeof(((s *)0)->f), \ + .mask = (const void *)(m), \ + }) + +/** Same as ARGS_ENTRY_MASK() using network byte ordering for the value. */ +#define ARGS_ENTRY_MASK_HTON(s, f, m) \ + (&(const struct arg){ \ + .hton = 1, \ + .offset = offsetof(s, f), \ + .size = sizeof(((s *)0)->f), \ + .mask = (const void *)(m), \ + }) + /** Static initializer for ARGS() to target a pointer. */ #define ARGS_ENTRY_PTR(s, f) \ (&(const struct arg){ \ @@ -444,11 +473,17 @@ static const enum index item_eth[] = { static const enum index item_vlan[] = { ITEM_VLAN_TPID, ITEM_VLAN_TCI, + ITEM_VLAN_PCP, + ITEM_VLAN_DEI, + ITEM_VLAN_VID, ITEM_NEXT, ZERO, }; static const enum index item_ipv4[] = { + ITEM_IPV4_TOS, + ITEM_IPV4_TTL, + ITEM_IPV4_PROTO, ITEM_IPV4_SRC, ITEM_IPV4_DST, ITEM_NEXT, @@ -456,6 +491,10 @@ static const enum index item_ipv4[] = { }; static const enum index item_ipv6[] = { + ITEM_IPV6_TC, + ITEM_IPV6_FLOW, + ITEM_IPV6_PROTO, + ITEM_IPV6_HOP, ITEM_IPV6_SRC, ITEM_IPV6_DST, ITEM_NEXT, @@ -486,6 +525,8 @@ static const enum index item_tcp[] = { static const enum index item_sctp[] = { ITEM_SCTP_SRC, ITEM_SCTP_DST, + ITEM_SCTP_TAG, + ITEM_SCTP_CKSUM, ITEM_NEXT, ZERO, }; @@ -1012,6 +1053,27 @@ static const struct token token_list[] = { .next = NEXT(item_vlan, NEXT_ENTRY(UNSIGNED), item_param), .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_vlan, tci)), }, + [ITEM_VLAN_PCP] = { + .name = "pcp", + .help = "priority code point", + .next = NEXT(item_vlan, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_vlan, + tci, "\xe0\x00")), + }, + [ITEM_VLAN_DEI] = { + .name = "dei", + .help = "drop eligible indicator", + .next = NEXT(item_vlan, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_vlan, + tci, "\x10\x00")), + }, + [ITEM_VLAN_VID] = { + .name = "vid", + .help = "VLAN identifier", + .next = NEXT(item_vlan, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_vlan, + tci, "\x0f\xff")), + }, [ITEM_IPV4] = { .name = "ipv4", .help = "match IPv4 header", @@ -1019,6 +1081,27 @@ static const struct token token_list[] = { .next = NEXT(item_ipv4), .call = parse_vc, }, + [ITEM_IPV4_TOS] = { + .name = "tos", + .help = "type of service", + .next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4, + hdr.type_of_service)), + }, + [ITEM_IPV4_TTL] = { + .name = "ttl", + .help = "time to live", + .next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4, + hdr.time_to_live)), + }, + [ITEM_IPV4_PROTO] = { + .name = "proto", + .help = "next protocol ID", + .next = NEXT(item_ipv4, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv4, + hdr.next_proto_id)), + }, [ITEM_IPV4_SRC] = { .name = "src", .help = "source address", @@ -1040,6 +1123,36 @@ static const struct token token_list[] = { .next = NEXT(item_ipv6), .call = parse_vc, }, + [ITEM_IPV6_TC] = { + .name = "tc", + .help = "traffic class", + .next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_ipv6, + hdr.vtc_flow, + "\x0f\xf0\x00\x00")), + }, + [ITEM_IPV6_FLOW] = { + .name = "flow", + .help = "flow label", + .next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_MASK_HTON(struct rte_flow_item_ipv6, + hdr.vtc_flow, + "\x00\x0f\xff\xff")), + }, + [ITEM_IPV6_PROTO] = { + .name = "proto", + .help = "protocol (next header)", + .next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6, + hdr.proto)), + }, + [ITEM_IPV6_HOP] = { + .name = "hop", + .help = "hop limit", + .next = NEXT(item_ipv6, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_ipv6, + hdr.hop_limits)), + }, [ITEM_IPV6_SRC] = { .name = "src", .help = "source address", @@ -1138,6 +1251,20 @@ static const struct token token_list[] = { .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_sctp, hdr.dst_port)), }, + [ITEM_SCTP_TAG] = { + .name = "tag", + .help = "validation tag", + .next = NEXT(item_sctp, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_sctp, + hdr.tag)), + }, + [ITEM_SCTP_CKSUM] = { + .name = "cksum", + .help = "checksum", + .next = NEXT(item_sctp, NEXT_ENTRY(UNSIGNED), item_param), + .args = ARGS(ARGS_ENTRY_HTON(struct rte_flow_item_sctp, + hdr.cksum)), + }, [ITEM_VXLAN] = { .name = "vxlan", .help = "match VXLAN header", diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index 03b6fa9..cacdef1 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -2333,14 +2333,24 @@ This section lists supported pattern items and their attributes, if any. - ``tpid {unsigned}``: tag protocol identifier. - ``tci {unsigned}``: tag control information. + - ``pcp {unsigned}``: priority code point. + - ``dei {unsigned}``: drop eligible indicator. + - ``vid {unsigned}``: VLAN identifier. - ``ipv4``: match IPv4 header. + - ``tos {unsigned}``: type of service. + - ``ttl {unsigned}``: time to live. + - ``proto {unsigned}``: next protocol ID. - ``src {ipv4 address}``: source address. - ``dst {ipv4 address}``: destination address. - ``ipv6``: match IPv6 header. + - ``tc {unsigned}``: traffic class. + - ``flow {unsigned}``: flow label. + - ``proto {unsigned}``: protocol (next header). + - ``hop {unsigned}``: hop limit. - ``src {ipv6 address}``: source address. - ``dst {ipv6 address}``: destination address. @@ -2363,6 +2373,8 @@ This section lists supported pattern items and their attributes, if any. - ``src {unsigned}``: SCTP source port. - ``dst {unsigned}``: SCTP destination port. + - ``tag {unsigned}``: validation tag. + - ``cksum {unsigned}``: checksum. - ``vxlan``: match VXLAN header. -- 2.1.4