From patchwork Mon Jul 1 15:43:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dekel Peled X-Patchwork-Id: 55777 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 [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id EC1271B9F6; Mon, 1 Jul 2019 17:45:24 +0200 (CEST) Received: from mellanox.co.il (mail-il-dmz.mellanox.com [193.47.165.129]) by dpdk.org (Postfix) with ESMTP id C40531B9F5 for ; Mon, 1 Jul 2019 17:45:23 +0200 (CEST) Received: from Internal Mail-Server by MTLPINE2 (envelope-from dekelp@mellanox.com) with ESMTPS (AES256-SHA encrypted); 1 Jul 2019 18:45:18 +0300 Received: from mtl-vdi-280.wap.labs.mlnx. (mtl-vdi-280.wap.labs.mlnx [10.128.130.87]) by labmailer.mlnx (8.13.8/8.13.8) with ESMTP id x61FieEq028876; Mon, 1 Jul 2019 18:45:18 +0300 From: Dekel Peled To: adrien.mazarguil@6wind.com, wenzhuo.lu@intel.com, jingjing.wu@intel.com, bernard.iremonger@intel.com, yskoh@mellanox.com, shahafs@mellanox.com, viacheslavo@mellanox.com, arybchenko@solarflare.com Cc: dev@dpdk.org, orika@mellanox.com Date: Mon, 1 Jul 2019 18:43:10 +0300 Message-Id: X-Mailer: git-send-email 1.7.1 In-Reply-To: References: <1553177917-43297-1-git-send-email-dekelp@mellanox.com> Subject: [dpdk-dev] [PATCH v9 2/3] app/testpmd: add actions to modify TCP header fields 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" Add actions: - INC_TCP_SEQ - Increase sequence number in the outermost TCP header. - DEC_TCP_SEQ - Decrease sequence number in the outermost TCP header. - INC_TCP_ACK - Increase acknowledgment number in the outermost TCP header. - DEC_TCP_ACK - Decrease acknowledgment number in the outermost TCP header. Original work by Xiaoyu Min. This patch uses the new approach introduced by [1], using the new macro ARG_ENTRY_HTON to pass a single integer argument to each of the new actions. [1] http://patches.dpdk.org/patch/55773/ Signed-off-by: Dekel Peled --- app/test-pmd/cmdline_flow.c | 92 +++++++++++++++++++++++++++++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 16 +++++ 2 files changed, 108 insertions(+) diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c index fa7bd13..e644efa 100644 --- a/app/test-pmd/cmdline_flow.c +++ b/app/test-pmd/cmdline_flow.c @@ -272,6 +272,14 @@ enum index { ACTION_SET_MAC_SRC_MAC_SRC, ACTION_SET_MAC_DST, ACTION_SET_MAC_DST_MAC_DST, + ACTION_INC_TCP_SEQ, + ACTION_INC_TCP_SEQ_VALUE, + ACTION_DEC_TCP_SEQ, + ACTION_DEC_TCP_SEQ_VALUE, + ACTION_INC_TCP_ACK, + ACTION_INC_TCP_ACK_VALUE, + ACTION_DEC_TCP_ACK, + ACTION_DEC_TCP_ACK_VALUE, }; /** Maximum size for pattern in struct rte_flow_item_raw. */ @@ -893,6 +901,10 @@ struct parse_action_priv { ACTION_SET_TTL, ACTION_SET_MAC_SRC, ACTION_SET_MAC_DST, + ACTION_INC_TCP_SEQ, + ACTION_DEC_TCP_SEQ, + ACTION_INC_TCP_ACK, + ACTION_DEC_TCP_ACK, ZERO, }; @@ -1055,6 +1067,30 @@ struct parse_action_priv { ZERO, }; +static const enum index action_inc_tcp_seq[] = { + ACTION_INC_TCP_SEQ_VALUE, + ACTION_NEXT, + ZERO, +}; + +static const enum index action_dec_tcp_seq[] = { + ACTION_DEC_TCP_SEQ_VALUE, + ACTION_NEXT, + ZERO, +}; + +static const enum index action_inc_tcp_ack[] = { + ACTION_INC_TCP_ACK_VALUE, + ACTION_NEXT, + ZERO, +}; + +static const enum index action_dec_tcp_ack[] = { + ACTION_DEC_TCP_ACK_VALUE, + ACTION_NEXT, + ZERO, +}; + static int parse_init(struct context *, const struct token *, const char *, unsigned int, void *, unsigned int); @@ -2862,6 +2898,62 @@ static int comp_vc_action_rss_queue(struct context *, const struct token *, (struct rte_flow_action_set_mac, mac_addr)), .call = parse_vc_conf, }, + [ACTION_INC_TCP_SEQ] = { + .name = "inc_tcp_seq", + .help = "increase TCP sequence number", + .priv = PRIV_ACTION(INC_TCP_SEQ, sizeof(rte_be32_t)), + .next = NEXT(action_inc_tcp_seq), + .call = parse_vc, + }, + [ACTION_INC_TCP_SEQ_VALUE] = { + .name = "value", + .help = "the value to increase TCP sequence number by", + .next = NEXT(action_inc_tcp_seq, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), + .call = parse_vc_conf, + }, + [ACTION_DEC_TCP_SEQ] = { + .name = "dec_tcp_seq", + .help = "decrease TCP sequence number", + .priv = PRIV_ACTION(DEC_TCP_SEQ, sizeof(rte_be32_t)), + .next = NEXT(action_dec_tcp_seq), + .call = parse_vc, + }, + [ACTION_DEC_TCP_SEQ_VALUE] = { + .name = "value", + .help = "the value to decrease TCP sequence number by", + .next = NEXT(action_dec_tcp_seq, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), + .call = parse_vc_conf, + }, + [ACTION_INC_TCP_ACK] = { + .name = "inc_tcp_ack", + .help = "increase TCP acknowledgment number", + .priv = PRIV_ACTION(INC_TCP_ACK, sizeof(rte_be32_t)), + .next = NEXT(action_inc_tcp_ack), + .call = parse_vc, + }, + [ACTION_INC_TCP_ACK_VALUE] = { + .name = "value", + .help = "the value to increase TCP acknowledgment number by", + .next = NEXT(action_inc_tcp_ack, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), + .call = parse_vc_conf, + }, + [ACTION_DEC_TCP_ACK] = { + .name = "dec_tcp_ack", + .help = "decrease TCP acknowledgment number", + .priv = PRIV_ACTION(DEC_TCP_ACK, sizeof(rte_be32_t)), + .next = NEXT(action_dec_tcp_ack), + .call = parse_vc, + }, + [ACTION_DEC_TCP_ACK_VALUE] = { + .name = "value", + .help = "the value to decrease TCP acknowledgment number by", + .next = NEXT(action_dec_tcp_ack, NEXT_ENTRY(UNSIGNED)), + .args = ARGS(ARG_ENTRY_HTON(rte_be32_t)), + .call = parse_vc_conf, + }, }; /** Remove and return last entry from argument stack. */ diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index cb83a3c..49a9e15 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -4106,6 +4106,22 @@ This section lists supported actions and their attributes, if any. - ``mac_addr {MAC-48}``: new destination MAC address +- ``inc_tcp_seq``: Increase sequence number in the outermost TCP header. + + - ``value {unsigned}``: Value to increase TCP sequence number by. + +- ``dec_tcp_seq``: Decrease sequence number in the outermost TCP header. + + - ``value {unsigned}``: Value to decrease TCP sequence number by. + +- ``inc_tcp_ack``: Increase acknowledgment number in the outermost TCP header. + + - ``value {unsigned}``: Value to increase TCP acknowledgment number by. + +- ``dec_tcp_ack``: Decrease acknowledgment number in the outermost TCP header. + + - ``value {unsigned}``: Value to decrease TCP acknowledgment number by. + Destroying flow rules ~~~~~~~~~~~~~~~~~~~~~