From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from EUR02-HE1-obe.outbound.protection.outlook.com (mail-eopbgr10061.outbound.protection.outlook.com [40.107.1.61]) by dpdk.org (Postfix) with ESMTP id A54294CA5 for ; Tue, 25 Sep 2018 05:03:47 +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=V16PhexJH+kyNoFXvyjpmETlFFUDe4U3KF5ny3OUIW0=; b=jXf6nGhzTrYjphZ8s9RHknLcx7UNQMMzmfy9Nx9lcbFWJSafNvsW/RF3eFmQq/gneTSvEu7ocnoZ2eaRvsGRH4rFwfD5WGVa+5dZ/ALOiweDGYWVgno50T1ioIGXB65fvrMav4qKhPSlIREFJ4Hc5CIlfv1u1u6uv59swfNW9hU= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jackmin@mellanox.com; Received: from MTBC-JACKMIN.mtl.com (114.91.153.4) by AM5PR0501MB2018.eurprd05.prod.outlook.com (2603:10a6:203:1a::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1164.22; Tue, 25 Sep 2018 03:03:44 +0000 Date: Tue, 25 Sep 2018 11:03:21 +0800 From: Xiaoyu Min To: Rahul Lakkireddy Cc: dev@dpdk.org, indranil@chelsio.com, nirranjan@chelsio.com Message-ID: <20180925030321.xswpeiwv7ppepqfx@MTBC-JACKMIN.mtl.com> References: <05c072bcd94a9767d08b2ffdafb2f8f54b8dadc9.1537776502.git.rahul.lakkireddy@chelsio.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <05c072bcd94a9767d08b2ffdafb2f8f54b8dadc9.1537776502.git.rahul.lakkireddy@chelsio.com> User-Agent: NeoMutt/20180716 X-Originating-IP: [114.91.153.4] X-ClientProxiedBy: HK0P153CA0025.APCP153.PROD.OUTLOOK.COM (2603:1096:203:17::13) To AM5PR0501MB2018.eurprd05.prod.outlook.com (2603:10a6:203:1a::16) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: bb7e81fc-506f-441a-819e-08d622938200 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:AM5PR0501MB2018; X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2018; 3:MzGt7rp6f3K/PrlPw4OCKaauOKyZvTmzYmiS5AdE5LBh1QG00opySHVtDYsZ/aM569SjdVcSe26YSNhmhE4Fmd9ZfZiYP3jbnWvuJOu6Ouu9Ae49b+DWpOcAspTsudjVIhIaTjeg1gt9th7eLIKrZxpsPT2zUoN9vJfiBBYQLY03TmbolNk3K/MoxbwvZO2xh+J+A5j0aCHeq2O3sRJOXS7bQBNz2jJLoEgDF3lfsg+Cq+eQ/yYIRnrQsVKlqqaT; 25:Co2725LJ/QWo7GF4dw9Nm6zCstNpTW2pFjEfj8U7rJOrIJNpSu/kF7SGCgyXWk1ftmuJKetylbesO8eNwXWtZJlLnkRm54YxdMQ5OqU9+RHTwNxCI4A7/xiq6cGlpSeXZbq8ognbcMSP6JVu6jJgufI4PnQ/ppuvfUk9f2RqeQpC4xIdoYvpo6oo9IWxx8mVdmzXiHvj/IuoFpSFEuuk6myDAalvUyt4w7M5eWhBe3EceXJb6oBEveRwY22WbKcdTaEAVo9dFxN14R6TiKJMiG2dhbbD+YI7T3Q2mUV+dK5SF7zLHMtDy2tL17HICZEjcJgLkQqEBC2M2bJLSPO1EQ==; 31:guFRt2/Kn6wl+wA6Y6k5FAv6mkIwRXJNs10Nz6klJuGxvG2sv1LwPA12sACfTeatX7uD3kp7ZGVCZMWQDwdOX7oeOpEQl199c59r8po8FAem53uqfvxNUa68wLmJmomBBF2UB7fZWy7/JT15DZ2LrpMV7sOBUb+gi5+MIiggYDO87or5MhrDrO8ZKgVL/R4TVDrHUvOUUitVgmJNFesZfEFB/z1F+oGdKezXcdB8srE= X-MS-TrafficTypeDiagnostic: AM5PR0501MB2018: X-Microsoft-Exchange-Diagnostics: 1; AM5PR0501MB2018; 20:rxrNmhebgV37xG8DbNaR+76G0Yi+uIIycbqs2TT5Fx2rM0GrrH5zGhfYaTBiXRPzk+20joMnM82wyt67dylpgBtbFvet0UBetSbvY7xXQkHUCSgChQW00nPF0PGNernJkPPDG73yMMdbqcnXQpQ+eKYDWM5fPeyPWJ/RKJ3DvnRB509rzjZrUAojqzBAym5bXDm+UfofJtwdIm5PSlBxRlEXeBO63pG06Vr/UzDbPHvPEZIf/8ANNyAD88GJ6d2S4G2JIxX1LFJiaEhX1TkbCTbc1vGKQlsm451yT/34Lc3AvXHMQwPCoQ18JolFQWpjJEF6HCUTvASzz8+AUce9X0r8vm/2jP0NorNL+2IYRpUw03A1d2mug3FXa9rKpEFTFihFXY6ltX4Ap00GUIwVqxTinHG4BqsGMffbLIuYzX1eEFhTdvQJKiyrE0q3RA8CE4tGkGrT+iEVbVYOr1QDr3Fop6Jf1gjyny5xPSQKPuyXTn1gjKNS+EUGiADzn4VF; 4:aBAgiL27h4vttXYbNRT3JBaAUqxljbPgrlGe7EZHEv2KiyWkTX4q8uBoIDe/AC731bpxJxlkpFwMLv1KsXmHPoUeyKa5M9N/2+UX6TCxTweMF2AoMU4lholNN0mVaRIc7MTrjzrsV7+cxDi8bjhm2/oQODdWHfq5S5lEgedP6Qld2rebPlFm4WQEnSpNk4M5u9qTA/2W4f0EGQwZKcatAqDQhbUuVFRRCfmI+wNfzkajGmcppYGIW9SeMy9+s2uZiLov9ljE3Yv183U0MH+oqA== 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)(93006095)(93001095)(3002001)(3231355)(944501410)(52105095)(10201501046)(6055026)(149066)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(20161123562045)(20161123560045)(20161123558120)(201708071742011)(7699051); SRVR:AM5PR0501MB2018; BCL:0; PCL:0; RULEID:; SRVR:AM5PR0501MB2018; X-Forefront-PRVS: 08062C429B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(136003)(376002)(346002)(39860400002)(396003)(189003)(199004)(47776003)(66066001)(97736004)(16526019)(186003)(316002)(26005)(58126008)(478600001)(16586007)(386003)(105586002)(53546011)(6506007)(76176011)(5660300001)(53416004)(14444005)(7696005)(68736007)(229853002)(86362001)(6246003)(476003)(106356001)(52116002)(6916009)(6666003)(8676002)(81166006)(8936002)(486006)(81156014)(956004)(3846002)(6116002)(305945005)(7736002)(9686003)(2906002)(446003)(55016002)(50466002)(25786009)(53936002)(23726003)(1076002)(11346002)(4326008); DIR:OUT; SFP:1101; SCL:1; SRVR:AM5PR0501MB2018; H:MTBC-JACKMIN.mtl.com; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: mellanox.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; AM5PR0501MB2018; 23:2Rqh1jLAmnO0O6zpnwCfgkc3XrBl40Xj6dxh3ll?= =?us-ascii?Q?ZmehdpgpFXccuQHmXL0n/XS3lIKuYch28i61YEYocOYVB4WE7PleZiyuCxtJ?= =?us-ascii?Q?ZURhRN0MWtvobKbTIkkr5RmPQBgPwKBxuQBz548E6uzGqQd7wS3jyzXPXotJ?= =?us-ascii?Q?MOVN/Yx6nlpKpGF+A+3rWPWwpyVNdwYvPk/3+Rgl1/Pdr/d8ss4HGOw28uFC?= =?us-ascii?Q?8yj8ST+Y9T+uGrSAP0qpxsQDgNhzmUQGjMHbp0dgD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KNbIdZSdrqrI0fPOGdcWtXsyU7i9j4bUxAkQdz2dlPlr78/UHrkd4uPHBe9dfLm76A9IvPQ/KKqGnP3cSljGZ0lk/sWY+sJiPvemvZArGJ2qt/l6rZcMhKIlRX9RUS6esWG7iV0J7fkv6/7hinUk6YHyI=; 7:4wJltCRNsmTyIq55Bx4ULSxpX4vc655aYYRa36wUHKPlTxQS4CDOp/mFzyc6sqGcz947H+4Xz96DXRU2i8x2JsvtLe9Hnu6UNrn9HsBbXZ3S2A3NRUARgJO87SbL5ltJkEm49Vo+8I0XJKs4T6R94WsI5qShvpU7uwPGiRjFpyu8CF4nSSZJdbw3CS6DiglrScAB76xhgaP2txu05WrS3TtP4c1JogA/c5cbC85oH/O7kq7QP9c8kMJCf7v97Ab+ SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: Mellanox.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Sep 2018 03:03:44.0954 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bb7e81fc-506f-441a-819e-08d622938200 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: a652971c-7d2e-4d9b-a6a4-d149256f461b X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM5PR0501MB2018 Subject: Re: [dpdk-dev] [PATCH 1/3] ethdev: add flow api actions to modify IP addresses 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:03:48 -0000 On 18-09-24 13:58:17, Rahul Lakkireddy wrote: > Add actions: > - SET_IPV4_SRC - set a new IPv4 source address. > - SET_IPV4_DST - set a new IPv4 destination address. > - SET_IPV6_SRC - set a new IPv6 source address. > - SET_IPV6_DST - set a new IPv6 destination address. > > 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 | 104 ++++++++++++++++++++ > app/test-pmd/config.c | 8 ++ > doc/guides/prog_guide/rte_flow.rst | 72 ++++++++++++++ > doc/guides/rel_notes/release_18_11.rst | 6 ++ > doc/guides/testpmd_app_ug/testpmd_funcs.rst | 18 ++++ > lib/librte_ethdev/rte_flow.c | 8 ++ > lib/librte_ethdev/rte_flow.h | 70 +++++++++++++ > 7 files changed, 286 insertions(+) > > diff --git a/app/test-pmd/cmdline_flow.c b/app/test-pmd/cmdline_flow.c > index f9260600e..1432498a3 100644 > --- a/app/test-pmd/cmdline_flow.c > +++ b/app/test-pmd/cmdline_flow.c > @@ -243,6 +243,14 @@ enum index { > ACTION_VXLAN_DECAP, > ACTION_NVGRE_ENCAP, > ACTION_NVGRE_DECAP, > + ACTION_SET_IPV4_SRC, > + ACTION_SET_IPV4_SRC_IPV4_SRC, > + ACTION_SET_IPV4_DST, > + ACTION_SET_IPV4_DST_IPV4_DST, > + ACTION_SET_IPV6_SRC, > + ACTION_SET_IPV6_SRC_IPV6_SRC, > + ACTION_SET_IPV6_DST, > + ACTION_SET_IPV6_DST_IPV6_DST, > }; > > /** Maximum size for pattern in struct rte_flow_item_raw. */ > @@ -816,6 +824,10 @@ static const enum index next_action[] = { > ACTION_VXLAN_DECAP, > ACTION_NVGRE_ENCAP, > ACTION_NVGRE_DECAP, > + ACTION_SET_IPV4_SRC, > + ACTION_SET_IPV4_DST, > + ACTION_SET_IPV6_SRC, > + ACTION_SET_IPV6_DST, > ZERO, > }; > > @@ -918,6 +930,30 @@ static const enum index action_of_push_mpls[] = { > ZERO, > }; > > +static const enum index action_set_ipv4_src[] = { > + ACTION_SET_IPV4_SRC_IPV4_SRC, > + ACTION_NEXT, > + ZERO, > +}; > + > +static const enum index action_set_ipv4_dst[] = { > + ACTION_SET_IPV4_DST_IPV4_DST, > + ACTION_NEXT, > + ZERO, > +}; > + > +static const enum index action_set_ipv6_src[] = { > + ACTION_SET_IPV6_SRC_IPV6_SRC, > + ACTION_NEXT, > + ZERO, > +}; > + > +static const enum index action_set_ipv6_dst[] = { > + ACTION_SET_IPV6_DST_IPV6_DST, > + ACTION_NEXT, > + ZERO, > +}; > + > static const enum index action_jump[] = { > ACTION_JUMP_GROUP, > ACTION_NEXT, > @@ -2470,6 +2506,74 @@ static const struct token token_list[] = { > .next = NEXT(NEXT_ENTRY(ACTION_NEXT)), > .call = parse_vc, > }, > + [ACTION_SET_IPV4_SRC] = { > + .name = "set_ipv4_src", > + .help = "Set a new IPv4 source address in the outermost" > + " IPv4 header", > + .priv = PRIV_ACTION(SET_IPV4_SRC, > + sizeof(struct rte_flow_action_set_ipv4)), > + .next = NEXT(action_set_ipv4_src), > + .call = parse_vc, > + }, > + [ACTION_SET_IPV4_SRC_IPV4_SRC] = { > + .name = "ipv4_addr", > + .help = "new IPv4 source address to set", > + .next = NEXT(action_set_ipv4_src, NEXT_ENTRY(IPV4_ADDR)), > + .args = ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_ipv4, ipv4_addr)), > + .call = parse_vc_conf, > + }, > + [ACTION_SET_IPV4_DST] = { > + .name = "set_ipv4_dst", > + .help = "Set a new IPv4 destination address in the outermost" > + " IPv4 header", > + .priv = PRIV_ACTION(SET_IPV4_DST, > + sizeof(struct rte_flow_action_set_ipv4)), > + .next = NEXT(action_set_ipv4_dst), > + .call = parse_vc, > + }, > + [ACTION_SET_IPV4_DST_IPV4_DST] = { > + .name = "ipv4_addr", > + .help = "new IPv4 destination address to set", > + .next = NEXT(action_set_ipv4_dst, NEXT_ENTRY(IPV4_ADDR)), > + .args = ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_ipv4, ipv4_addr)), > + .call = parse_vc_conf, > + }, > + [ACTION_SET_IPV6_SRC] = { > + .name = "set_ipv6_src", > + .help = "Set a new IPv6 source address in the outermost" > + " IPv6 header", > + .priv = PRIV_ACTION(SET_IPV6_SRC, > + sizeof(struct rte_flow_action_set_ipv6)), > + .next = NEXT(action_set_ipv6_src), > + .call = parse_vc, > + }, > + [ACTION_SET_IPV6_SRC_IPV6_SRC] = { > + .name = "ipv6_addr", > + .help = "new IPv6 source address to set", > + .next = NEXT(action_set_ipv6_src, NEXT_ENTRY(IPV6_ADDR)), > + .args = ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_ipv6, ipv6_addr)), > + .call = parse_vc_conf, > + }, > + [ACTION_SET_IPV6_DST] = { > + .name = "set_ipv6_dst", > + .help = "Set a new IPv6 destination address in the outermost" > + " IPv6 header", > + .priv = PRIV_ACTION(SET_IPV6_DST, > + sizeof(struct rte_flow_action_set_ipv6)), > + .next = NEXT(action_set_ipv6_dst), > + .call = parse_vc, > + }, > + [ACTION_SET_IPV6_DST_IPV6_DST] = { > + .name = "ipv6_addr", > + .help = "new IPv6 destination address to set", > + .next = NEXT(action_set_ipv6_dst, NEXT_ENTRY(IPV6_ADDR)), > + .args = ARGS(ARGS_ENTRY_HTON > + (struct rte_flow_action_set_ipv6, ipv6_addr)), > + .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 794aa5268..14dbdf7a3 100644 > --- a/app/test-pmd/config.c > +++ b/app/test-pmd/config.c > @@ -1172,6 +1172,14 @@ static const struct { > sizeof(struct rte_flow_action_of_pop_mpls)), > MK_FLOW_ACTION(OF_PUSH_MPLS, > sizeof(struct rte_flow_action_of_push_mpls)), > + MK_FLOW_ACTION(SET_IPV4_SRC, > + sizeof(struct rte_flow_action_set_ipv4)), > + MK_FLOW_ACTION(SET_IPV4_DST, > + sizeof(struct rte_flow_action_set_ipv4)), > + MK_FLOW_ACTION(SET_IPV6_SRC, > + sizeof(struct rte_flow_action_set_ipv6)), > + MK_FLOW_ACTION(SET_IPV6_DST, > + sizeof(struct rte_flow_action_set_ipv6)), > }; > > /** 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 b305a72a5..b9bcaa3d1 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -2076,6 +2076,78 @@ RTE_FLOW_ERROR_TYPE_ACTION error should be returned. > > This action modifies the payload of matched flows. > > +Action: ``SET_IPV4_SRC`` > +^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set a new IPv4 source address in the outermost IPv4 header. > + > +It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV4 flow pattern item. > +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_ipv4_src: > + > +.. table:: SET_IPV4_SRC > + > + +-----------------------------------------+ > + | Field | Value | > + +===============+=========================+ > + | ``ipv4_addr`` | new IPv4 source address | > + +---------------+-------------------------+ > + > +Action: ``SET_IPV4_DST`` > +^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set a new IPv4 destination address in the outermost IPv4 header. > + > +It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV4 flow pattern item. > +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_ipv4_dst: > + > +.. table:: SET_IPV4_DST > + > + +---------------+------------------------------+ > + | Field | Value | > + +===============+==============================+ > + | ``ipv4_addr`` | new IPv4 destination address | > + +---------------+------------------------------+ > + > +Action: ``SET_IPV6_SRC`` > +^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set a new IPv6 source address in the outermost IPv6 header. > + > +It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV6 flow pattern item. > +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_ipv6_src: > + > +.. table:: SET_IPV6_SRC > + > + +---------------+-------------------------+ > + | Field | Value | > + +===============+=========================+ > + | ``ipv6_addr`` | new IPv6 source address | > + +---------------+-------------------------+ > + > +Action: ``SET_IPV6_DST`` > +^^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set a new IPv6 destination address in the outermost IPv6 header. > + > +It must be used with a valid RTE_FLOW_ITEM_TYPE_IPV6 flow pattern item. > +Otherwise, RTE_FLOW_ERROR_TYPE_ACTION error will be returned. > + > +.. _table_rte_flow_action_set_ipv6_dst: > + > +.. table:: SET_IPV6_DST > + > + +---------------+------------------------------+ > + | Field | Value | > + +===============+==============================+ > + | ``ipv6_addr`` | new IPv6 destination address | > + +---------------+------------------------------+ > + > Negative types > ~~~~~~~~~~~~~~ > > diff --git a/doc/guides/rel_notes/release_18_11.rst b/doc/guides/rel_notes/release_18_11.rst > index f39cb15d2..782722318 100644 > --- a/doc/guides/rel_notes/release_18_11.rst > +++ b/doc/guides/rel_notes/release_18_11.rst > @@ -87,6 +87,12 @@ New Features > the specified port. The port must be stopped before the command call in order > to reconfigure queues. > > +* **Added new Flow API actions to rewrite fields in packet headers.** > + > + Added new Flow API actions to: > + > + * Modify source and destination IP addresses in the outermost IPv4/IPv6 > + headers. > > API Changes > ----------- > diff --git a/doc/guides/testpmd_app_ug/testpmd_funcs.rst b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > index 3a73000a6..97d91f066 100644 > --- a/doc/guides/testpmd_app_ug/testpmd_funcs.rst > +++ b/doc/guides/testpmd_app_ug/testpmd_funcs.rst > @@ -3704,6 +3704,24 @@ This section lists supported actions and their attributes, if any. > - ``nvgre_decap``: Performs a decapsulation action by stripping all headers of > the NVGRE tunnel network overlay from the matched flow. > > +- ``set_ipv4_src``: Set a new IPv4 source address in the outermost IPv4 header. > + > + - ``ipv4_addr``: New IPv4 source address. > + > +- ``set_ipv4_dst``: Set a new IPv4 destination address in the outermost IPv4 > + header. > + > + - ``ipv4_addr``: New IPv4 destination address. > + > +- ``set_ipv6_src``: Set a new IPv6 source address in the outermost IPv6 header. > + > + - ``ipv6_addr``: New IPv6 source address. > + > +- ``set_ipv6_dst``: Set a new IPv6 destination address in the outermost IPv6 > + header. > + > + - ``ipv6_addr``: New IPv6 destination address. > + > Destroying flow rules > ~~~~~~~~~~~~~~~~~~~~~ > > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index cff4b5209..d4f1b9a05 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -109,6 +109,14 @@ static const struct rte_flow_desc_data rte_flow_desc_action[] = { > sizeof(struct rte_flow_action_of_pop_mpls)), > MK_FLOW_ACTION(OF_PUSH_MPLS, > sizeof(struct rte_flow_action_of_push_mpls)), > + MK_FLOW_ACTION(SET_IPV4_SRC, > + sizeof(struct rte_flow_action_set_ipv4)), > + MK_FLOW_ACTION(SET_IPV4_DST, > + sizeof(struct rte_flow_action_set_ipv4)), > + MK_FLOW_ACTION(SET_IPV6_SRC, > + sizeof(struct rte_flow_action_set_ipv6)), > + MK_FLOW_ACTION(SET_IPV6_DST, > + sizeof(struct rte_flow_action_set_ipv6)), > }; > > static int > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index f8ba71cdb..0fe91ae89 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -1505,6 +1505,46 @@ enum rte_flow_action_type { > * error. > */ > RTE_FLOW_ACTION_TYPE_NVGRE_DECAP, > + > + /** > + * Modify IPv4 source address in the outermost IPv4 header. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, > + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_ipv4. > + */ > + RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC, > + > + /** > + * Modify IPv4 destination address in the outermost IPv4 header. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV4, > + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_ipv4. > + */ > + RTE_FLOW_ACTION_TYPE_SET_IPV4_DST, > + > + /** > + * Modify IPv6 source address in the outermost IPv6 header. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, > + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_ipv6. > + */ > + RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC, > + > + /** > + * Modify IPv6 destination address in the outermost IPv6 header. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_IPV6, > + * then the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_ipv6. > + */ > + RTE_FLOW_ACTION_TYPE_SET_IPV6_DST, > }; > > /** > @@ -1868,6 +1908,36 @@ struct rte_flow_action_nvgre_encap { > struct rte_flow_item *definition; > }; > > +/** > + * @warning > + * @b EXPERIMENTAL: this structure may change without prior notice > + * > + * RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC > + * RTE_FLOW_ACTION_TYPE_SET_IPV4_DST > + * > + * Allows modification of IPv4 source (RTE_FLOW_ACTION_TYPE_SET_IPV4_SRC) > + * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV4_DST) in the > + * specified outermost IPv4 header. > + */ > +struct rte_flow_action_set_ipv4 { > + uint32_t ipv4_addr; > +}; > + > +/** > + * @warning > + * @b EXPERIMENTAL: this structure may change without prior notice > + * > + * RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC > + * RTE_FLOW_ACTION_TYPE_SET_IPV6_DST > + * > + * Allows modification of IPv6 source (RTE_FLOW_ACTION_TYPE_SET_IPV6_SRC) > + * and destination address (RTE_FLOW_ACTION_TYPE_SET_IPV6_DST) in the > + * specified outermost IPv6 header. > + */ > +struct rte_flow_action_set_ipv6 { > + uint8_t ipv6_addr[16]; > +}; > + > /* > * Definition of a single action. > * > -- > 2.18.0 > Acked-by: Xiaoyu Min Thanks