DPDK patches and discussions
 help / color / mirror / Atom feed
From: Xiaoyu Min <jackmin@mellanox.com>
To: ferruh.yigit@intel.com,
	Adrien Mazarguil <adrien.mazarguil@6wind.com>,
	Wenzhuo Lu <wenzhuo.lu@intel.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Bernard Iremonger <bernard.iremonger@intel.com>,
	John McNamara <john.mcnamara@intel.com>,
	Marko Kovacevic <marko.kovacevic@intel.com>
Cc: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v2 2/3] app/testpmd: add commands of modify TTL
Date: Tue, 25 Sep 2018 22:37:18 +0800	[thread overview]
Message-ID: <20180925143719.23339-3-jackmin@mellanox.com> (raw)
In-Reply-To: <20180925143719.23339-1-jackmin@mellanox.com>

add commands which supports following TTL actions:
- RTE_FLOW_ACTION_TYPE_DEC_TTL
- RTE_FLOW_ACTION_TYPE_SET_TTL

Signed-off-by: Xiaoyu Min <jackmin@mellanox.com>
---
 app/test-pmd/cmdline_flow.c                 | 34 +++++++++++++++++++++
 app/test-pmd/config.c                       |  3 ++
 doc/guides/testpmd_app_ug/testpmd_funcs.rst |  5 +++
 3 files changed, 42 insertions(+)

diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c
index 3935539cb..fae825462 100644
--- a/app/test-pmd/cmdline_flow.c
+++ b/app/test-pmd/cmdline_flow.c
@@ -255,6 +255,9 @@ enum index {
 	ACTION_SET_TP_SRC_TP_SRC,
 	ACTION_SET_TP_DST,
 	ACTION_SET_TP_DST_TP_DST,
+	ACTION_DEC_TTL,
+	ACTION_SET_TTL,
+	ACTION_SET_TTL_TTL,
 };
 
 /** Maximum size for pattern in struct rte_flow_item_raw. */
@@ -834,6 +837,8 @@ static const enum index next_action[] = {
 	ACTION_SET_IPV6_DST,
 	ACTION_SET_TP_SRC,
 	ACTION_SET_TP_DST,
+	ACTION_DEC_TTL,
+	ACTION_SET_TTL,
 	ZERO,
 };
 
@@ -972,6 +977,12 @@ static const enum index action_set_tp_dst[] = {
 	ZERO,
 };
 
+static const enum index action_set_ttl[] = {
+	ACTION_SET_TTL_TTL,
+	ACTION_NEXT,
+	ZERO,
+};
+
 static const enum index action_jump[] = {
 	ACTION_JUMP_GROUP,
 	ACTION_NEXT,
@@ -2620,6 +2631,29 @@ static const struct token token_list[] = {
 			     (struct rte_flow_action_set_tp, port)),
 		.call = parse_vc_conf,
 	},
+	[ACTION_DEC_TTL] = {
+		.name = "dec_ttl",
+		.help = "decrease network TTL if available",
+		.priv = PRIV_ACTION(DEC_TTL, 0),
+		.next = NEXT(NEXT_ENTRY(ACTION_NEXT)),
+		.call = parse_vc,
+	},
+	[ACTION_SET_TTL] = {
+		.name = "set_ttl",
+		.help = "set ttl value",
+		.priv = PRIV_ACTION(SET_TTL,
+			sizeof(struct rte_flow_action_set_ttl)),
+		.next = NEXT(action_set_ttl),
+		.call = parse_vc,
+	},
+	[ACTION_SET_TTL_TTL] = {
+		.name = "ttl_value",
+		.help = "new ttl value to set",
+		.next = NEXT(action_set_ttl, NEXT_ENTRY(UNSIGNED)),
+		.args = ARGS(ARGS_ENTRY_HTON
+			     (struct rte_flow_action_set_ttl, ttl_value)),
+		.call = parse_vc_conf,
+	},
 };
 
 /** Remove and return last entry from argument stack. */
diff --git a/app/test-pmd/config.c b/app/test-pmd/config.c
index d1028d03e..d28b6ed14 100644
--- a/app/test-pmd/config.c
+++ b/app/test-pmd/config.c
@@ -1174,6 +1174,9 @@ static const struct {
 		       sizeof(struct rte_flow_action_set_tp)),
 	MK_FLOW_ACTION(SET_TP_DST,
 		       sizeof(struct rte_flow_action_set_tp)),
+	MK_FLOW_ACTION(DEC_TTL, 0),
+	MK_FLOW_ACTION(SET_TTL,
+		       sizeof(struct rte_flow_action_set_ttl)),
 };
 
 /** Compute storage space needed by action configuration and copy it. */
diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
index f60be0862..db68c4346 100644
--- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst
+++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst
@@ -3721,6 +3721,11 @@ This section lists supported actions and their attributes, if any.
 
   - ``port``: New TCP/UDP destination port number.
 
+- ``dec_ttl``: Performs a decrease TTL value action
+
+- ``set_ttl``: Set TTL value with specificed value
+  - ``ttl_value {unsigned}``: The new TTL value to be set
+
 Destroying flow rules
 ~~~~~~~~~~~~~~~~~~~~~
 
-- 
2.17.1

  parent reply	other threads:[~2018-09-25 14:38 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-25 13:47 [dpdk-dev] [PATCH 0/3] ethdev: add generic TTL rewrite actions Xiaoyu Min
2018-09-25 13:47 ` [dpdk-dev] [PATCH 1/3] " Xiaoyu Min
2018-09-25 13:47 ` [dpdk-dev] [PATCH 2/3] app/testpmd: add commands of modify TTL Xiaoyu Min
2018-09-25 13:47 ` [dpdk-dev] [PATCH 3/3] net/mlx5: eswitch-modify TTL actions Xiaoyu Min
2018-10-03 20:07   ` Yongseok Koh
2018-10-08  6:57     ` Xiaoyu Min
2018-09-25 14:37 ` [dpdk-dev] [PATCH v2 0/3] ethdev: add generic TTL rewrite actions Xiaoyu Min
2018-09-25 14:37   ` [dpdk-dev] [PATCH v2 1/3] " Xiaoyu Min
2018-10-03 19:50     ` Yongseok Koh
2018-09-25 14:37   ` Xiaoyu Min [this message]
2018-10-03 19:51     ` [dpdk-dev] [PATCH v2 2/3] app/testpmd: add commands of modify TTL Yongseok Koh
2018-09-25 14:37   ` [dpdk-dev] [PATCH v2 3/3] net/mlx5: eswitch-modify TTL actions Xiaoyu Min
2018-10-05 12:48     ` Ferruh Yigit
2018-10-05 18:17       ` Yongseok Koh
2018-10-03 20:35   ` [dpdk-dev] [PATCH v2 0/3] ethdev: add generic TTL rewrite actions Thomas Monjalon
2018-10-05 12:52   ` Ferruh Yigit
2018-10-08  2:30     ` Xiaoyu Min
2018-10-10 13:05   ` [dpdk-dev] [PATCH v3 " Jack Min
2018-10-10 13:05     ` [dpdk-dev] [PATCH v3 1/3] " Jack Min
2018-10-10 13:05     ` [dpdk-dev] [PATCH v3 2/3] app/testpmd: add commands of modify TTL Jack Min
2018-10-10 13:06     ` [dpdk-dev] [PATCH v3 3/3] net/mlx5: rewrite TTL by E-Switch Jack Min
2018-10-11  5:47       ` Yongseok Koh
2018-10-11 13:27     ` [dpdk-dev] [PATCH v4 0/3] ethdev: add generic TTL rewrite actions Jack Min
2018-10-11 13:27       ` [dpdk-dev] [PATCH v4 1/3] " Jack Min
2018-10-12 14:12         ` Ferruh Yigit
2018-10-13  2:16           ` Jack Min
2018-10-11 13:27       ` [dpdk-dev] [PATCH v4 2/3] app/testpmd: add commands of modify TTL Jack Min
2018-10-11 13:27       ` [dpdk-dev] [PATCH v4 3/3] net/mlx5: rewrite TTL by E-Switch Jack Min
2018-10-13  3:24       ` [dpdk-dev] [PATCH v5 0/3] ethdev: add generic TTL rewrite actions Jack Min
2018-10-13  3:24         ` [dpdk-dev] [PATCH v5 1/3] " Jack Min
2018-10-14  7:35           ` Andrew Rybchenko
2018-10-16  2:03             ` Jack Min
2018-10-13  3:24         ` [dpdk-dev] [PATCH v5 2/3] app/testpmd: add commands of modify TTL Jack Min
2018-10-13  3:24         ` [dpdk-dev] [PATCH v5 3/3] net/mlx5: rewrite TTL by E-Switch Jack Min
2018-10-16  8:14         ` [dpdk-dev] [PATCH v6 0/3] ethdev: add generic TTL rewrite actions Jack Min
2018-10-16  8:14           ` [dpdk-dev] [PATCH v6 1/3] " Jack Min
2018-10-16  8:25             ` Andrew Rybchenko
2018-10-16  8:48               ` Ferruh Yigit
2018-10-16  8:14           ` [dpdk-dev] [PATCH v6 2/3] app/testpmd: add commands of modify TTL Jack Min
2018-10-16  8:14           ` [dpdk-dev] [PATCH v6 3/3] net/mlx5: rewrite TTL by E-Switch Jack Min

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180925143719.23339-3-jackmin@mellanox.com \
    --to=jackmin@mellanox.com \
    --cc=adrien.mazarguil@6wind.com \
    --cc=bernard.iremonger@intel.com \
    --cc=dev@dpdk.org \
    --cc=ferruh.yigit@intel.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.mcnamara@intel.com \
    --cc=marko.kovacevic@intel.com \
    --cc=wenzhuo.lu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).