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 9AE59A05A1; Wed, 22 Apr 2020 04:15:57 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 15EAC1C2BB; Wed, 22 Apr 2020 04:15:57 +0200 (CEST) Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-eopbgr60079.outbound.protection.outlook.com [40.107.6.79]) by dpdk.org (Postfix) with ESMTP id C9A901C2B7 for ; Wed, 22 Apr 2020 04:15:55 +0200 (CEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Txp8ZpfAgiHi/efzFKMt3SMBrInAd+hmifLqGf8j0+Z+l9JS6BRiYKkAqDjuvI6JtFmpSCN7cLK6jCDfqawp8Z4cCg7SFVk3kS+4SHUOQP33zYDLT9iOaGF50vkDK0z2XX7uZ9VtmMvrWCrsjPIQEyx2xbN42nW4P+FpKlMZNxd6FbW85x8WEz4HL46n8cPzjNGwSy02xMAKrYNQhEw4V/rLYr3JOCQYxUde0tQLI4fw5Slg/ioCoFWptKoXooiW4yO4NC3l8xpbu7XD5eVoblNKpI2GEqF7CVY7YwiyG9fuh9hb4zYxqWxDaz3+DlOYV1+SjDo9kEv5kVfapAlDgA== 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=b7sA547IKgu/1+aq31HYcgyfQNitHEAkdoyf4p14J7U=; b=Uguq8B6U11x70iydvDXcK1e4fbHiACjnSZJPwXN1P274RJIn9jJ9JnfMEV7q5o1kIOWz/63he0FoaZ1KpEwJlKTNyDnraLAKnHbddGBvTesVTQ/CxT0LlNf3k1mFMgsb9Shmjf8Y7tpA8QifQmhh0Cu8onc2UcMtL6n+QkGgU1pIWzxzsZKRV5K/89jTZI7B034ZTdgsA3ynbB+j5jEllHQUCu6LPVkdxg3a8/li9l178sLGnGnX6XpSws8rET1ua79Py4ScuPO+L6I7yaJXxUpoB5Y6y5H1H1++HkU6tARCN14lNEGQ+rNK3voZDCR+n8Lt5UgQOEBL4tu588AWcQ== 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=b7sA547IKgu/1+aq31HYcgyfQNitHEAkdoyf4p14J7U=; b=ccTIS7eDCUzn5NY1KlBr+sSg1yqvKsKzCUbsr+gcpQPl7ClcjhCXHNPgwqCL8p3M6TdzPgWamu5gGyUy/hGzJcAGMipBUqXaptHB7DKxSVGCHNoq6B9ljZOQMzJV2g5eGqE/Ajmmt7V1IdZEZ5F+ij0+ibYHZmBKUgOJfTzScE0= 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 AM6PR05MB5975.eurprd05.prod.outlook.com (2603:10a6:20b:ac::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2921.27; Wed, 22 Apr 2020 02:15:54 +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 02:15:54 +0000 Date: Wed, 22 Apr 2020 10:15:32 +0800 From: Xiaoyu Min To: Ferruh Yigit Cc: thomas@monjalon.net, asafp@mellanox.com, Wenzhuo Lu , Jingjing Wu , Bernard Iremonger , John McNamara , Marko Kovacevic , dev@dpdk.org Message-ID: <20200422021532.eepiedzk24zgxgid@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: HK2PR02CA0199.apcprd02.prod.outlook.com (2603:1096:201:20::11) 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 HK2PR02CA0199.apcprd02.prod.outlook.com (2603:1096:201:20::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2937.13 via Frontend Transport; Wed, 22 Apr 2020 02:15:46 +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: c7d14d63-1eb9-4b9c-0dc6-08d7e66315f9 X-MS-TrafficTypeDiagnostic: AM6PR05MB5975:|AM6PR05MB5975: 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:(10009020)(4636009)(366004)(396003)(136003)(39850400004)(376002)(346002)(66556008)(36756003)(52116002)(53546011)(7696005)(4326008)(55016002)(186003)(54906003)(5660300002)(16526019)(66946007)(316002)(86362001)(2616005)(1076003)(8886007)(2906002)(66476007)(6666004)(6916009)(8676002)(478600001)(81156014)(8936002)(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: y2cDmZgDq9gRUy0UKofwyRLWRLmYNH5m+cSJvz9iVpupVqsM0baGjMKOEFi39yaTXLbs+AkaT5/PzPAfpUTmm5vnT3yccXTKkyS6q4XWV7WyLcuqrE5z1UzuYrM76Ez9QZHuxjnJ1N0da898zduC69ysfcantGc4zcTsv9xYOoVZji2StnYvb9jY8mzLhYYh5GovRISnOIaOmk5WtUOJgp9QZVSVZlgCliWYkjixeyzRFX8XzUlCTnH68vEWI1BiQlEyN7PYcWJVO2Ca384GEgmMSDc+jKU+pX7hxFwQ9upJezoGwi2ykczdkguMMle37XlPAaVNfuqZroCEpjXP3SCnsFSl1AnEHSvJNgVoV86IHvgFhdeJbZs+pjS8DqioCPf4BvhNqo4QdCbxZYzvr0qxnL9BEtVrjh23wuciqqhATLJTIKqT7M10TvJ/kgH4CIbb/JaIUCunv8NZPo3E/i4dfteFxzQ5l09Hhz9A9tJZaMy4YC8mZa8Nc1zih9Vk X-MS-Exchange-AntiSpam-MessageData: Y7aUYsbhFQuvXcTxQIDUZ4IaOArbbgWtQuHi7mcuc3tzSD3Aba2xz5wzv3wnbIl0oEHPcoMxhdSGIgZj9B5ufwrYdrMvaCXTMR/MDhstYCln4g1GugAfptlC05lpX2/CerQ919RxZUSF4ZW8i8JQcnjL1vzTRuhIsoyMq3suvCsDTZCoIXt6cWO2hwi1vi1RoZAd8gx1XUDgS+NQnpSkWg== X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-Network-Message-Id: c7d14d63-1eb9-4b9c-0dc6-08d7e66315f9 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 22 Apr 2020 02:15:54.7325 (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: FogdXJsdxeQpvfWwZJtf4VlLwPLiVJlVLR5ZRP6qlHj0BjvKH5O2VH+11AjvQ3GkDVNIjtVm1JbHCK3fhsDMkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR05MB5975 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 Tue, 20-04-21, 21:56, Ferruh Yigit wrote: > On 4/15/2020 2:48 PM, 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. > > Why not, if this will be an additional forwarding engine, I am OK with it. It > increases the testpmd capabilities. Yes, it increases the capabilities. > > > > > 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 > > >