From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <rahul.lakkireddy@chelsio.com>
Received: from stargate.chelsio.com (stargate.chelsio.com [12.32.117.8])
 by dpdk.org (Postfix) with ESMTP id 317A81B4F7
 for <dev@dpdk.org>; Mon,  2 Jul 2018 14:05:29 +0200 (CEST)
Received: from localhost (scalar.blr.asicdesigners.com [10.193.185.94])
 by stargate.chelsio.com (8.13.8/8.13.8) with ESMTP id w62C5Ojx020285;
 Mon, 2 Jul 2018 05:05:25 -0700
Date: Mon, 2 Jul 2018 17:34:22 +0530
From: Rahul Lakkireddy <rahul.lakkireddy@chelsio.com>
To: Jack Min <jackmin@mellanox.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>, Shagun Agarwal <shaguna@chelsio.com>,
 Indranil Choudhury <indranil@chelsio.com>,
 Nirranjan Kirubaharan <nirranjan@chelsio.com>,
 Shahaf Shuler <shahafs@mellanox.com>,
 "Xueming(Steven) Li" <xuemingl@mellanox.com>
Message-ID: <20180702120421.GA28446@chelsio.com>
References: <cover.1529650435.git.rahul.lakkireddy@chelsio.com>
 <HE1PR05MB4617EFC7AEC5C38D2D0E43A4CC430@HE1PR05MB4617.eurprd05.prod.outlook.com>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <HE1PR05MB4617EFC7AEC5C38D2D0E43A4CC430@HE1PR05MB4617.eurprd05.prod.outlook.com>
User-Agent: Mutt/1.5.24 (2015-08-30)
Subject: Re: [dpdk-dev] [RFC 0/3] ethdev: add IP address and TCP/UDP port
 rewrite actions to flow API
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
X-List-Received-Date: Mon, 02 Jul 2018 12:05:30 -0000

Hi Jack,

On Monday, July 07/02/18, 2018 at 14:39:06 +0530, Jack Min wrote:
> Hey,
> 
> I've one question: 
> 
> Do those APIs support modify inner IP headers? 
> 

I'm afraid not. These API only modify outer IP addresses.

I can think of two ways to achieve this:

1. Enhance these API to accept an additional flag to indicate
   inner or outer. For example, to set inner IPv4 address, we can
   set inner to 1 in following structure.

   struct rte_flow_action_of_set_nw_ipv4 {
	   uint32_t inner:1; /* 1 - Inner, 0 - Outer */
	   uint32_t reserved:31;
	   uint32_t ipv4_addr;
   };

2. Add new actions to indicate inner IP addresses; i.e.

   RTE_FLOW_ACTION_TYPE_OF_SET_INNER_NW_IPV4_SRC
   RTE_FLOW_ACTION_TYPE_OF_SET_INNER_NW_IPV4_DST
   RTE_FLOW_ACTION_TYPE_OF_SET_INNER_NW_IPV6_SRC
   RTE_FLOW_ACTION_TYPE_OF_SET_INNER_NW_IPV6_DST

Thanks,
Rahul

> In our scenarios, we need to specific that  NAT action is on inner or outer IP header.
> 
> Thanks,
> -Jack
> 
> > -----Original Message-----
> > From: dev <dev-bounces@dpdk.org> On Behalf Of Rahul Lakkireddy
> > Sent: June 22, 2018 17:56
> > To: dev@dpdk.org
> > Cc: shaguna@chelsio.com; indranil@chelsio.com; nirranjan@chelsio.com
> > Subject: [dpdk-dev] [RFC 0/3] ethdev: add IP address and TCP/UDP port rewrite
> > actions to flow API
> > 
> > This series of patches add support for actions:
> > - OF_SET_NW_IPV4_SRC - set a new IPv4 source address.
> > - OF_SET_NW_IPV4_DST - set a new IPv4 destination address.
> > - OF_SET_NW_IPV6_SRC - set a new IPv6 source address.
> > - OF_SET_NW_IPV6_DST - set a new IPv6 destination address.
> > - OF_SET_TP_SRC - set a new TCP/UDP source port number.
> > - OF_SET_TP_DST - set a new TCP/UDP destination port number.
> > 
> > These actions are useful in Network Address Translation use case to edit IP
> > address and TCP/UDP port numbers before switching the packets out to the
> > destination device port.
> > 
> > The IP address and TCP/UDP port rewrite actions are based on
> > OFPAT_SET_NW_SRC, OFPAT_SET_NW_DST, OFPAT_SET_TP_SRC, and
> > OFPAT_SET_TP_DST actions from OpenFlow Specification [1].
> > 
> > Patch 1 adds support for IP address rewrite to rte_flow and testpmd.
> > 
> > Patch 2 adds support for TCP/UDP port rewrite to rte_flow and testpmd.
> > 
> > Patch 3 shows CXGBE PMD example to offload these actions to hardware.
> > 
> > Feedback and suggestions will be much appreciated.
> > 
> > Thanks,
> > Rahul
> > 
> > [1]
> > https://emea01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.open
> > networking.org%2Fimages%2Fopenflow-switch-
> > v1.5.1.pdf&data=02%7C01%7Cxuemingl%40mellanox.com%7C74c8ce3b79954b2f
> > 123208d5d8268617%7Ca652971c7d2e4d9ba6a4d149256f461b%7C0%7C1%7C636
> > 652582334142929&sdata=uoFc1KjVTkGI9fdaPNXvXYRmh%2F6HLMKT79IwgvDSH
> > 0k%3D&reserved=0
> > 
> > Shagun Agrawal (3):
> >   ethdev: add flow api actions to modify IP addresses
> >   ethdev: add flow api actions to modify TCP/UDP port numbers
> >   net/cxgbe: add flow actions to modify IP and TCP/UDP port address
> > 
> >  app/test-pmd/cmdline_flow.c                 | 150
> > ++++++++++++++++++++++++++++
> >  app/test-pmd/config.c                       |  12 +++
> >  doc/guides/prog_guide/rte_flow.rst          | 102 +++++++++++++++++++
> >  doc/guides/testpmd_app_ug/testpmd_funcs.rst |  24 +++++
> >  drivers/net/cxgbe/base/common.h             |   1 +
> >  drivers/net/cxgbe/base/t4fw_interface.h     |  50 ++++++++++
> >  drivers/net/cxgbe/cxgbe_filter.c            |  23 ++++-
> >  drivers/net/cxgbe/cxgbe_filter.h            |  26 ++++-
> >  drivers/net/cxgbe/cxgbe_flow.c              | 127 +++++++++++++++++++++++
> >  drivers/net/cxgbe/cxgbe_main.c              |  10 ++
> >  lib/librte_ethdev/rte_flow.c                |  12 +++
> >  lib/librte_ethdev/rte_flow.h                |  92 +++++++++++++++++
> >  12 files changed, 625 insertions(+), 4 deletions(-)
> > 
> > --
> > 2.14.1
>