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 6580DA00C2; Wed, 22 Apr 2020 15:44:23 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 3B25B1D65B; Wed, 22 Apr 2020 15:44:23 +0200 (CEST) Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-eopbgr80059.outbound.protection.outlook.com [40.107.8.59]) by dpdk.org (Postfix) with ESMTP id 8CFB01D65B for ; Wed, 22 Apr 2020 15:44:21 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WRiQiFyRllrQvbsLrWVbDoCYDAzFGKp+IUy3rbsFGkQxy0YmD0Gy8L9zvLn+EegzYKSEtPQwSZjk4cZnX4CJoNblyDFqQFuaUFPXHc9A9q3eD6KEMZFLi6QK+/zATj6VxC5nZmp4Jd5uWIoycbcbRoj3XaehUkWp82Z/pOq0Jze6sldFKrpcRlmLnqZV5hqcXYHL6JZ1+tT8JPgo2mlTyvsRvmv3qoybmpb68TuUrCwRTD0lQVt+7NMqezqlk6/bIvZ1HDh0Ygr74AGxq+5Z0NYvPlQjOMOc3xTCsKM6hEKTsez9rAsFFqAgna/qIHH09eEW5dcQ7g9ts46R/IZqMg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=imVFupyN7R1AJf2qP/WVmqQdYEaLfCCdmLkcgyliir0=; b=miqa7MiAXuWapUXdAEHsx+WkvAW4QmKNXqzv9Zj37TcsoOYqlSz5utielP4zQwXgQZDBOXq98c5nhWSgs96GYkvOHG485sX1RpYqiwfczE8lOy0RFHoT8nEV7YJeZflLOfztfZOkowHxk+MLr66sPDuQ01V6lA+ylu7nppJmIcEqcuYYLWdjbZN6lTCRccyA5BNAMPDfbvQQSpX5VG4wEeoZUcgftLMqNJ5peyw50rZkKC7Jle0ppfKpYBBUIIiEWAluVEPzrbHzwwGGR2HX/u0q7txt+nQqEFj5jOz1g2tn1WChZc8TVY+SirF3ikyenx9AUWGzNoFQuqDxc87X9w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=mellanox.com; dmarc=pass action=none header.from=mellanox.com; dkim=pass header.d=mellanox.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Mellanox.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=imVFupyN7R1AJf2qP/WVmqQdYEaLfCCdmLkcgyliir0=; b=JxXc2irVxKSMw/RDuPST1/4ValV5Qli1mz9bSgw6XvEtvL7V4qg8xSBWsanJ1FZOV2kR/2SOfD09/Ul8uj7WHl6LBDcTJARWMh9USunySvQpnBeal1mtOEENMfYhc93kfoiJkF6q7ZEjiPFGVQzIPdu7xgh/O76vUBrpLVuatoE= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; Received: from AM6PR05MB6567.eurprd05.prod.outlook.com (2603:10a6:20b:bc::23) by AM6PR05MB5989.eurprd05.prod.outlook.com (2603:10a6:20b:a7::31) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13; Wed, 22 Apr 2020 13:44:20 +0000 Received: from AM6PR05MB6567.eurprd05.prod.outlook.com ([fe80::5513:b664:af25:6551]) by AM6PR05MB6567.eurprd05.prod.outlook.com ([fe80::5513:b664:af25:6551%5]) with mapi id 15.20.2921.030; Wed, 22 Apr 2020 13:44:20 +0000 Date: Wed, 22 Apr 2020 21:43:56 +0800 From: Xiaoyu Min To: Kevin Traynor Cc: thomas@monjalon.net, asafp@mellanox.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , dev@dpdk.org Message-ID: <20200422134356.tmmtajhjhdha255r@mellanox.com> References: <47cf5b417fb3c74c04e5a020dba700c5d748383d.1586958002.git.jackmin@mellanox.com> Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-ClientProxiedBy: HK2PR0401CA0005.apcprd04.prod.outlook.com (2603:1096:202:2::15) To AM6PR05MB6567.eurprd05.prod.outlook.com (2603:10a6:20b:bc::23) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from mellanox.com (2408:8025:34c:6fe0:f492:17b0:f1f3:6e3c) by HK2PR0401CA0005.apcprd04.prod.outlook.com (2603:1096:202:2::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.26 via Frontend Transport; Wed, 22 Apr 2020 13:44:10 +0000 X-Originating-IP: [2408:8025:34c:6fe0:f492:17b0:f1f3:6e3c] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 1f8eb2c1-bdf0-43c8-5eb1-08d7e6c341af X-MS-TrafficTypeDiagnostic: AM6PR05MB5989:|AM6PR05MB5989: X-LD-Processed: a652971c-7d2e-4d9b-a6a4-d149256f461b,ExtAddr X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:10000; X-Forefront-PRVS: 03818C953D X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM6PR05MB6567.eurprd05.prod.outlook.com; PTR:; CAT:NONE; SFTY:; SFS:(4636009)(136003)(366004)(376002)(346002)(396003)(39860400002)(4326008)(66556008)(55016002)(8886007)(66946007)(66476007)(1076003)(6666004)(5660300002)(86362001)(8936002)(81156014)(8676002)(2616005)(7696005)(52116002)(36756003)(16526019)(2906002)(316002)(54906003)(478600001)(6916009)(53546011)(186003)(41533002); DIR:OUT; SFP:1101; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: bidwe2foHtXI5QQjA1AjpXWV+uRXI6E3HE/2Uw5IKnqkpRIQbBmTnHNVlXpKHag5FgIS+eImfatFpfIH9hSD2eUUpmzNyMSlwqZmy/mN3UpoyEAAQUqjzUvmruhA4yAM87UCWoAs6MRawX9XRHt6PBF/zF5qrbSXVMWN+VINdGEyCNEnGNLLrVzblxjycKL+p8x7+ijsLx2oj59RAzSMUtK5MyDKYGkdrF1/sE/1JlcOlL/TtFjxl8pI7CFfdsIWLMIEXHtJahmoVePWwn9mV8S2Uibyjw1RmrY7G4Grlh4Z/bZ3lZQChj5wrEu/SWvLOXAg7P1YJcdY3NA034OlX9NIEDG06IqIO0J8VhbZ/bORiqdW5gME5zfRaqSQ24d6+ihoQFPIKrlPY6Q89E3SUdwl/n9MTbqLXsD8KGn9nVBB5KqsVmA+jS/43eVsjwqaL/Uwcqfz/tD4EZcId5zansE3Cz2RNfxxDeC9iqyiFz3tneOxo1XKUrdChkUF+w1V X-MS-Exchange-AntiSpam-MessageData: uJtk0p8y1/quLIccOo6xVjHptSzKcu39VfQ94zU0nmFwzPC4XG2axKbQzLgwOPzg8aVFVn0N3ORMAjHEGBtXgvlxOrcCwVJxtOSg+v/Da2rilt89S1iXgk7Gd6h74H3uLdqExwUn1sRIV3Lo6kD7dLdpoMGkwODwcEF0Oim7+Wvwzn6dbCVBqBqA3kTGnfUuGCejMfd0NbEyfmoXQ1d3ew== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1f8eb2c1-bdf0-43c8-5eb1-08d7e6c341af X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2020 13:44:19.9573 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: qsjig5B9ibsVNz3qDmlnEbT4Ig9KiPUmLmZN1iDdTXGADpe82mEJ27M1YnCaq/VcZaS0XcexjI3M5hUWTtxECw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5989 Subject: Re: [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" On Wed, 20-04-22, 10:26, Kevin Traynor wrote: > On 15/04/2020 14:48, Xiaoyu Min wrote: > > 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. > > It's not an intuitive name and doesn't seem like it's really needed. > Selecting multiple items below is more explicit IMHO. Yes, it's not really needed. I'll remove it. > > > + > > + - ``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). > > I think 'port' would be clearer. Yes, it's more clearer. I'll change it to 'port'. Thank you. > > > + > > Example:: > > > > testpmd> set fwd rxonly > > >