From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 11917A0563; Wed, 15 Apr 2020 15:48:49 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 32A261D725; Wed, 15 Apr 2020 15:48:49 +0200 (CEST) Received: from git-send-mailer.rdmz.labs.mlnx (unknown [37.142.13.130]) by dpdk.org (Postfix) with ESMTP id 5B47E1D723 for ; Wed, 15 Apr 2020 15:48:48 +0200 (CEST) From: Xiaoyu Min To: thomas@monjalon.net, asafp@mellanox.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic Cc: dev@dpdk.org Date: Wed, 15 Apr 2020 16:48:44 +0300 Message-Id: <47cf5b417fb3c74c04e5a020dba700c5d748383d.1586958002.git.jackmin@mellanox.com> X-Mailer: git-send-email 2.21.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [RFC] app/testpmd: add generic swap forwarding engine 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 RFC propose a generic `swap` forwarding engine, which could be seen as an extension of existing `macswap` but provide more flexibility. With this generic `swap` forwarding engine, we can `swap` the source and destination of L2/L3 address as well as the source and destination port of L4 according to the user inputs. This will be very helpful for developer/tester in some test scenarios. For example, connection tracking functinality in OVS, which needs to swap UDP ports in addition to L2/L3 addresses in order to complete one connection. Signed-off-by: Xiaoyu Min --- app/test-pmd/parameters.c | 2 ++ doc/guides/testpmd_app_ug/testpmd_funcs.rst | 15 ++++++++++++++- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/app/test-pmd/parameters.c b/app/test-pmd/parameters.c index 404dba2b20..5c9aecd6cb 100644 --- a/app/test-pmd/parameters.c +++ b/app/test-pmd/parameters.c @@ -147,6 +147,8 @@ usage(char* progname) "is default).\n"); printf(" --forward-mode=N: set forwarding mode (N: %s).\n", list_pkt_forwarding_modes()); + printf(" --forward-mode=swap[:TYPE[,TYPE]]: set forwarding mode to swap " + "(TYPE: auto (default) or mac or ip or tp).\n"); printf(" --rss-ip: set RSS functions to IPv4/IPv6 only .\n"); printf(" --rss-udp: set RSS functions to IPv4/IPv6 + UDP.\n"); printf(" --rxq=N: set the number of RX queues per port to N.\n"); diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst index dcee5de455..27f0600493 100644 --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst @@ -298,7 +298,7 @@ set fwd Set the packet forwarding mode:: testpmd> set fwd (io|mac|macswap|flowgen| \ - rxonly|txonly|csum|icmpecho|noisy) (""|retry) + rxonly|txonly|csum|icmpecho|noisy|swap) (""|retry) ``retry`` can be specified for forwarding engines except ``rx_only``. @@ -336,6 +336,19 @@ The available information categories are: Simulate more realistic behavior of a guest machine engaged in receiving and sending packets performing Virtual Network Function (VNF). +* ``swap[:TYPE[,TYPE]*]``: Generic swap forwarding mode. + + Swap the source and destination address or/and source and destination port of packet according to ``TYPE`` before forwarding them. + ``TYPE`` could be: + + - ``auto``: swaps all supported fields (L2 to L4) if available, default. + + - ``mac``: swaps the source address and destination address of Ethernet, as same as ``macswap``. + + - ``ip``: swaps the source address and destination address of IP (v4 and v6). + + - ``tp``: swaps the source port and destination port of transport layer (TCP and UDP). + Example:: testpmd> set fwd rxonly -- 2.26.0