From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-db5eur01on0060.outbound.protection.outlook.com [104.47.2.60]) by dpdk.org (Postfix) with ESMTP id A2D891B3A2 for ; Tue, 25 Sep 2018 05:06:34 +0200 (CEST) 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=/21y1bqXkPAZ3qmQyfUgzfNWxYz4zw+1rp8A3ZOJRJg=; b=RZbrrWulHipEE4E+7anovU0tmFauXSCzC7WJhnnB06RZ5497G6iRBaTT9JNIE8Cm/FDxjmrCcF0JfCXzULSVwuS7Ny9blfxWmLWPSr357nv7DW7veID9v44Ryc0VUiBQQWTJ/Cp1IEqdeXB7e5mPZ04+eyDyxuS6UwKTk90QiAs= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; Received: from MTBC-JACKMIN.mtl.com (114.91.153.4) by HE1PR0501MB2028.eurprd05.prod.outlook.com (2603:10a6:3:35::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1143.18; Tue, 25 Sep 2018 03:06:24 +0000 Date: Tue, 25 Sep 2018 11:06:00 +0800 From: Xiaoyu Min To: Rahul Lakkireddy Cc: dev@dpdk.org, indranil@chelsio.com, nirranjan@chelsio.com Message-ID: <20180925030600.vl3bz66xbykfr3eq@MTBC-JACKMIN.mtl.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20180716 X-Originating-IP: [114.91.153.4] X-ClientProxiedBy: HK0PR03CA0040.apcprd03.prod.outlook.com (2603:1096:203:2f::28) To HE1PR0501MB2028.eurprd05.prod.outlook.com (2603:10a6:3:35::18) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 6631d6c0-6c34-4709-ff0e-08d62293e179 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: BCL:0; PCL:0; RULEID:(7020095)(4652040)(8989299)(4534165)(4627221)(201703031133081)(201702281549075)(8990200)(5600074)(711020)(4618075)(2017052603328)(7153060)(7193020); SRVR:HE1PR0501MB2028; X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2028; 3:mSpZRGg2zOwx3PrPcha92OUYlloIrSwE6ifKrBbzjQfB0SzMAyS/nZFncbmsDxnz02TsDKExik2RRu3tumIIPsMRwQ5yMeJKuHniMtqgNAZz4OcZHb8PPMuRGYZljEkxSBwjXk2ccy7c/FKmCB1Q658/HcA1UVwd8fW+K8ZLH4yvpEsIEOMYoY6sB1WNlH782s8AAQWsENrJu7vwgJbIBfhcePh72BCA574UQ/x+LEgJ6YnEifXv2MV+NGQvPkTs; 25:9SDCLm0oVMO2zaq5GZAp3OxMhkcn4C+xelu/5y9kZ9i2LL4AkafNLNV6zG4PQS3Va6zn2tnTqN/kCqHapmzBjbTqvG56K1ipuhSnEMBNbtS6x0nsqytrlr+ZRJZKLmEBfexn12coeggdaHVF6tvPabPT4VGSsCF0559Zscoi7yq11yb4hzvg8MjSYFP+hicSSofIjEtpWCjCHH9yZzl2Hr49jLHK4tHm2Iahzd2ZNYvrQAE1bafwdpGj3yIID/RtdFinI0OBMv0AtTXxlRCTAMDvZpGlIen/gszX+EIWoTnDXFU+wSYdBUZdvfQyMfFAEEyWw+64sfE1u611aOd+mw==; 31:4yUp+MZ16aXbDh39QiNboEGqTcnEVEeVH9xC9xlL2n9HAXszuz9DkPrsHvVX8DBL2gVKXxMU8QIIwgY5z+ZmxtdZuHxmOaL0eD6P8XonfgF/4O6BkvI0aTZZiHvdAt0uFmhq+eI/60eEBXeGTaHpKw5/J74rvVF4YI2SX2V0rXQyTLyCb8s7B0mLpcMUSwgh6X3pjPMrBsKhpgLvbjM5mS/+R9Z1DCyY7GN03G9yuG8= X-MS-TrafficTypeDiagnostic: HE1PR0501MB2028: X-Microsoft-Exchange-Diagnostics: 1; HE1PR0501MB2028; 20:OLOkEv6tDwv7xiremY8DLb56mN1OGid2GLOORGXb1t7K5XN60gjGTGKP1TPQJ2PoUg8jnbfwiou9Szc5CKU8PnAY0fP10qsSnWu3fwYzXljifzhb7ra7G0feWo7WJhOj/OkKEEtDoUU0Lpe4a2ieFNGP7Yow4F8L1cE4sXq2p2DLxis9cp+OLx3qHCC84x6Riq86FJOO/BHFdnJk3vL1wjZKYSK8W8WqdiUuQc2yE6NTvA77NRs2BuVT/TlJGNFWO20T9wz5lQcLZfT6zA+y89G6jb6u2up7QO1so460ImbGEqlZjrOX1xKG0z+0+2/PByiklESzkBqXkAFKsewjSysOaxhKcppa+Dxzb5yZOLOrFk4Ke3UrEX6PpQniwlQe6EDnSGkxqKI/U0IH94uggBk2DRUoMG+Zj/uJRF2Xvuh20fPw1nKNujr+xOyqJjvd4N0pjxIZOkAYnH7VxqVhM0xaZZT/TtDZSGoPARNu8AtBLcbrURaYiMY1aQ60107H; 4:DPp29iq+igoCn2VOtI959BJxH896CGkNpDAgD2cTJuaFUfwXJ5m6XW52Jd7fW4U5UwVH7Rqy837O5DfnpLTTmg0qCrL1If4AuezQY3Q2GkJt9TqWwZ6xOV4g4OS0Q2G8s8w7OIKVfdjGFw+DGa/swEZvN53gBh6h6uZRrOLHfyZOAFhvp8HGqDSHWZm65CP7HuwJVfctnUNiTCYT4KtJDowDljhA1d7BofxXU/g1uQW+dvVkxay3lAvH2ZT0WLnhlpEOnZx8y/f1B/6FTPAWsg== X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231355)(944501410)(52105095)(93006095)(93001095)(3002001)(10201501046)(6055026)(149066)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123562045)(20161123564045)(20161123558120)(201708071742011)(7699051); SRVR:HE1PR0501MB2028; BCL:0; PCL:0; RULEID:; SRVR:HE1PR0501MB2028; X-Forefront-PRVS: 08062C429B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39860400002)(346002)(376002)(136003)(366004)(199004)(189003)(23726003)(47776003)(8936002)(305945005)(50466002)(81156014)(3846002)(53936002)(7736002)(2906002)(6116002)(1076002)(66066001)(81166006)(11346002)(58126008)(6246003)(316002)(478600001)(446003)(16586007)(476003)(956004)(486006)(97736004)(25786009)(26005)(14444005)(5660300001)(186003)(16526019)(86362001)(575784001)(105586002)(6666003)(6506007)(386003)(55016002)(8676002)(68736007)(9686003)(53416004)(76176011)(53546011)(106356001)(229853002)(52116002)(7696005)(6916009)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:HE1PR0501MB2028; H:MTBC-JACKMIN.mtl.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; HE1PR0501MB2028; 23:Ifv8BacxSReiWoBXggIIMh/5R2QpSWkP8G25C5r?= =?us-ascii?Q?e8oYHmBfdBu/zBatX4K44maNoXCSzhiEBUGXH56/5kSe126zChXzwfPzNZ6O?= =?us-ascii?Q?BNgIfgAbevBYjSP4XWyUNu6mW2FYmR22c1o/eANa09Vkk+Cflcr+h6FBN48C?= =?us-ascii?Q?4zLcMoeBdXiBlAOhMXonrE5Ig3REmWsTuKg1W4iUlC+KKBTrzurHKh2qU20Z?= =?us-ascii?Q?Sfio1Ikkj9t/0Oth5o9UzlZ9b12xx4P/LPd9Z7SsWwQuCXvcwsQJfRsAUnpF?= =?us-ascii?Q?1+EeHV7ZwjzrPAvQgLGiPF9GMoSEzWjvw4jim9A1ZZwwLX7tOsxXXPox74mZ?= =?us-ascii?Q?oAfIypb6OybKAIDGy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98hpzKc0NPK+iRVlhNSKq9RmJlBQFT5pM3H0PYG2PoSa6UVetiaE5K/IFvc=; 7:yw6GJ4qaFkc1TeYEeAjAdMroUanUO3JTQuE46PuHprpNCUsV4LuMmYY7eFqYe1C0fUOc6ZpK+RLeiX1ADAHcUikfS9pCi3awZ6BGWR8KyLkFKNoOGwfCBmaPtiCvka6ND5AId1FeMVPDORTEXktr+0HJOdsXBI85Xasp6p+bU3p5Cb43gE+78lEdV5KzpHjLrv0rcuaH7ZdBuLN3KbkBASeCLg/1GwhSrL25qypGLUFP8Dc91S5G1nGcDPZZ+rhL SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2018 03:06:24.1444 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 6631d6c0-6c34-4709-ff0e-08d62293e179 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1PR0501MB2028 Subject: Re: [dpdk-dev] [PATCH 2/3] ethdev: add flow api actions to modify TCP/UDP port numbers 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: , X-List-Received-Date: Tue, 25 Sep 2018 03:06:35 -0000 On 18-09-24 13:58:18, Rahul Lakkireddy wrote: > Add actions: > - SET_TP_SRC - set a new TCP/UDP source port number. > - SET_TP_DST - set a new TCP/UDP destination port number. > > Original work by Shagun Agrawal > > Signed-off-by: Rahul Lakkireddy > --- > Changes since RFC v2: > - Updated comments, help messages, and doc to indicate that IP/TCP/UDP > of the outermost headers are modified. > - Updated comments and doc to indicate that a corresponding valid flow > pattern item must be specified to offload corresponding header rewrite > action. > - Updated release notes. > > app/test-pmd/cmdline_flow.c | 52 +++++++++++++++++++++ > app/test-pmd/config.c | 4 ++ > doc/guides/prog_guide/rte_flow.rst | 36 ++++++++++++++ > doc/guides/rel_notes/release_18_11.rst | 2 + > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 10 ++++ > lib/librte_ethdev/rte_flow.c | 4 ++ > lib/librte_ethdev/rte_flow.h | 37 +++++++++++++++ > 7 files changed, 145 insertions(+) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index 1432498a3..a9888cacf 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -251,6 +251,10 @@ enum index { > ACTION_SET_IPV6_SRC_IPV6_SRC, > ACTION_SET_IPV6_DST, > ACTION_SET_IPV6_DST_IPV6_DST, > + ACTION_SET_TP_SRC, > + ACTION_SET_TP_SRC_TP_SRC, > + ACTION_SET_TP_DST, > + ACTION_SET_TP_DST_TP_DST, > }; > > /** Maximum size for pattern in struct rte_flow_item_raw. */ > @@ -828,6 +832,8 @@ static const enum index next_action[] = { > ACTION_SET_IPV4_DST, > ACTION_SET_IPV6_SRC, > ACTION_SET_IPV6_DST, > + ACTION_SET_TP_SRC, > + ACTION_SET_TP_DST, > ZERO, > }; > > @@ -954,6 +960,18 @@ static const enum index action_set_ipv6_dst[] = { > ZERO, > }; > > +static const enum index action_set_tp_src[] = { > + ACTION_SET_TP_SRC_TP_SRC, > + ACTION_NEXT, > + ZERO, > +}; > + > +static const enum index action_set_tp_dst[] = { > + ACTION_SET_TP_DST_TP_DST, > + ACTION_NEXT, > + ZERO, > +}; > + > static const enum index action_jump[] = { > ACTION_JUMP_GROUP, > ACTION_NEXT, > @@ -2574,6 +2592,40 @@ static const struct token token_list[] = { > (struct rte_flow_action_set_ipv6, ipv6_addr)), > .call = parse_vc_conf, > }, > + [ACTION_SET_TP_SRC] = { > + .name = "set_tp_src", > + .help = "set a new source port number in the outermost" > + " TCP/UDP header", > + .priv = PRIV_ACTION(SET_TP_SRC, > + sizeof(struct rte_flow_action_set_tp)), > + .next = NEXT(action_set_tp_src), > + .call = parse_vc, > + }, > + [ACTION_SET_TP_SRC_TP_SRC] = { > + .name = "port", > + .help = "new source port number to set", > + .next = NEXT(action_set_tp_src, NEXT_ENTRY(UNSIGNED)), > + .args = ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_tp, port)), > + .call = parse_vc_conf, > + }, > + [ACTION_SET_TP_DST] = { > + .name = "set_tp_dst", > + .help = "set a new destination port number in the outermost" > + " TCP/UDP header", > + .priv = PRIV_ACTION(SET_TP_DST, > + sizeof(struct rte_flow_action_set_tp)), > + .next = NEXT(action_set_tp_dst), > + .call = parse_vc, > + }, > + [ACTION_SET_TP_DST_TP_DST] = { > + .name = "port", > + .help = "new destination port number to set", > + .next = NEXT(action_set_tp_dst, NEXT_ENTRY(UNSIGNED)), > + .args = ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_tp, port)), > + .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 14dbdf7a3..1629a6d7a 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1180,6 +1180,10 @@ static const struct { > sizeof(struct rte_flow_action_set_ipv6)), > MK_FLOW_ACTION(SET_IPV6_DST, > sizeof(struct rte_flow_action_set_ipv6)), > + MK_FLOW_ACTION(SET_TP_SRC, > + sizeof(struct rte_flow_action_set_tp)), > + MK_FLOW_ACTION(SET_TP_DST, > + sizeof(struct rte_flow_action_set_tp)), > }; > > /** Compute storage space needed by action configuration and copy it. */ > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst > index b9bcaa3d1..4be160209 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -2148,6 +2148,42 @@ Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > | ``ipv6_addr`` | new IPv6 destination address | > +---------------+------------------------------+ > > +Action: ``SET_TP_SRC`` > +^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set a new source port number in the outermost TCP/UDP header. > + > +It must be used with a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP > +flow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_tp_src: > + > +.. table:: SET_TP_SRC > + > + +----------+-------------------------+ > + | Field | Value | > + +==========+=========================+ > + | ``port`` | new TCP/UDP source port | > + +---------------+--------------------+ > + > +Action: ``SET_TP_DST`` > +^^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set a new destination port number in the outermost TCP/UDP header. > + > +It must be used with a valid RTE_FLOW_ITEM_TYPE_TCP or RTE_FLOW_ITEM_TYPE_UDP > +flow pattern item. Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_tp_dst: > + > +.. table:: SET_TP_DST > + > + +----------+------------------------------+ > + | Field | Value | > + +==========+==============================+ > + | ``port`` | new TCP/UDP destination port | > + +---------------+-------------------------+ > + > Negative types > ~~~~~~~~~~~~~~ > > diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst > index 782722318..84b0a6a4b 100644 > --- a/doc/guides/rel_notes/release_18_11.rst > +++ b/doc/guides/rel_notes/release_18_11.rst > @@ -93,6 +93,8 @@ New Features > > * Modify source and destination IP addresses in the outermost IPv4/IPv6 > headers. > + * Modify source and destination port numbers in the outermost TCP/UDP > + headers. > > API Changes > ----------- > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 97d91f066..ffec7013b 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3722,6 +3722,16 @@ This section lists supported actions and their attributes, if any. > > - ``ipv6_addr``: New IPv6 destination address. > > +- ``of_set_tp_src``: Set a new source port number in the outermost TCP/UDP > + header. > + > + - ``port``: New TCP/UDP source port number. > + > +- ``of_set_tp_dst``: Set a new destination port number in the outermost TCP/UDP > + header. > + > + - ``port``: New TCP/UDP destination port number. > + > Destroying flow rules > ~~~~~~~~~~~~~~~~~~~~~ > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index d4f1b9a05..409c79741 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -117,6 +117,10 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { > sizeof(struct rte_flow_action_set_ipv6)), > MK_FLOW_ACTION(SET_IPV6_DST, > sizeof(struct rte_flow_action_set_ipv6)), > + MK_FLOW_ACTION(SET_TP_SRC, > + sizeof(struct rte_flow_action_set_tp)), > + MK_FLOW_ACTION(SET_TP_DST, > + sizeof(struct rte_flow_action_set_tp)), > }; > > static int > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index 0fe91ae89..cf5cecf42 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -1545,6 +1545,28 @@ enum rte_flow_action_type { > * See struct rte_flow_action_set_ipv6. > */ > RTE_FLOW_ACTION_TYPE_SET_IPV6_DST, > + > + /** > + * Modify source port number in the outermost TCP/UDP header. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP > + * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a > + * RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_tp. > + */ > + RTE_FLOW_ACTION_TYPE_SET_TP_SRC, > + > + /** > + * Modify destination port number in the outermost TCP/UDP header. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_TCP > + * or RTE_FLOW_ITEM_TYPE_UDP, then the PMD should return a > + * RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_tp. > + */ > + RTE_FLOW_ACTION_TYPE_SET_TP_DST, > }; > > /** > @@ -1938,6 +1960,21 @@ struct rte_flow_action_set_ipv6 { > uint8_t ipv6_addr[16]; > }; > > +/** > + * @warning > + * @b EXPERIMENTAL: this structure may change without prior notice > + * > + * RTE_FLOW_ACTION_TYPE_SET_TP_SRC > + * RTE_FLOW_ACTION_TYPE_SET_TP_DST > + * > + * Allows modification of source (RTE_FLOW_ACTION_TYPE_SET_TP_SRC) > + * and destination (RTE_FLOW_ACTION_TYPE_SET_TP_DST) port numbers > + * in the specified outermost TCP/UDP header. > + */ > +struct rte_flow_action_set_tp { > + uint16_t port; > +}; > + > /* > * Definition of a single action. > * > -- > 2.18.0 > Acked-by: Xiaoyu Min Thanks