From mboxrd@z Thu Jan 1 00:00:00 1970 From: Yongseok Koh Subject: Re: [PATCH 1/3] ethdev: add generic MAC address rewrite actions Date: Wed, 3 Oct 2018 20:08:26 +0000 Message-ID: <20181003200800.GD26206@mtidpdk.mti.labs.mlnx> References: <20180925150340.25378-1-jackmin@mellanox.com> <20180925150340.25378-2-jackmin@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Cc: "ferruh.yigit@intel.com" , Adrien Mazarguil , John McNamara , Marko Kovacevic , Thomas Monjalon , Andrew Rybchenko , "dev@dpdk.org" To: Jack Min Return-path: Received: from EUR03-AM5-obe.outbound.protection.outlook.com (mail-eopbgr30045.outbound.protection.outlook.com [40.107.3.45]) by dpdk.org (Postfix) with ESMTP id 5E5121B3AA for ; Wed, 3 Oct 2018 22:08:28 +0200 (CEST) In-Reply-To: <20180925150340.25378-2-jackmin@mellanox.com> Content-Language: en-US Content-ID: <40B0B2F177647249B358205D3B920FD8@eurprd05.prod.outlook.com> 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, Sep 25, 2018 at 11:03:38PM +0800, Xiaoyu Min wrote: > rte_flow actions: > - RTE_FLOW_ACTION_TYPE_SET_MAC_SRC > - RTE_FLOW_ACTION_TYPE_SET_MAC_DST > added in order to offload to NIC >=20 > The rte_flow_itme_eth must be present in rte_flow pattern >=20 > Signed-off-by: Xiaoyu Min > --- Acked-by: Yongseok Koh Thanks > doc/guides/prog_guide/rte_flow.rst | 30 ++++++++++++++++++++++++++++++ > lib/librte_ethdev/rte_flow.c | 2 ++ > lib/librte_ethdev/rte_flow.h | 29 +++++++++++++++++++++++++++++ > 3 files changed, 61 insertions(+) >=20 > diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/r= te_flow.rst > index 3aec0834b..5ecf154b6 100644 > --- a/doc/guides/prog_guide/rte_flow.rst > +++ b/doc/guides/prog_guide/rte_flow.rst > @@ -2196,6 +2196,36 @@ Assigns a new TTL value. > | ``ttl_value`` | new TTL value | > +---------------+--------------------+ > =20 > +Action: ``SET_MAC_SRC`` > +^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set source MAC address > + > +.. _table_rte_flow_action_set_mac_src: > + > +.. table:: SET_MAC_SRC > + > + +--------------+---------------+ > + | Field | Value | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+ > + | ``mac_addr`` | MAC address | > + +--------------+---------------+ > + > +Action: ``SET_MAC_DST`` > +^^^^^^^^^^^^^^^^^^^^^^^ > + > +Set source MAC address > + > +.. _table_rte_flow_action_set_mac_dst: > + > +.. table:: SET_MAC_DST > + > + +--------------+---------------+ > + | Field | Value | > + +=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D+=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D+ > + | ``mac_addr`` | MAC address | > + +--------------+---------------+ > + > Negative types > ~~~~~~~~~~~~~~ > =20 > diff --git a/lib/librte_ethdev/rte_flow.c b/lib/librte_ethdev/rte_flow.c > index 631f80efd..1f4b67603 100644 > --- a/lib/librte_ethdev/rte_flow.c > +++ b/lib/librte_ethdev/rte_flow.c > @@ -123,6 +123,8 @@ static const struct rte_flow_desc_data rte_flow_desc_= action[] =3D { > sizeof(struct rte_flow_action_set_tp)), > MK_FLOW_ACTION(DEC_TTL, 0), > MK_FLOW_ACTION(SET_TTL, sizeof(struct rte_flow_action_set_ttl)), > + MK_FLOW_ACTION(SET_MAC_SRC, sizeof(struct rte_flow_action_set_mac)), > + MK_FLOW_ACTION(SET_MAC_DST, sizeof(struct rte_flow_action_set_mac)), > }; > =20 > static int > diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h > index b41e37a31..19552902a 100644 > --- a/lib/librte_ethdev/rte_flow.h > +++ b/lib/librte_ethdev/rte_flow.h > @@ -1567,6 +1567,26 @@ enum rte_flow_action_type { > * See struct rte_flow_action_set_ttl > */ > RTE_FLOW_ACTION_TYPE_SET_TTL, > + > + /** > + * Set source MAC address from matched flow. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, > + * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_mac. > + */ > + RTE_FLOW_ACTION_TYPE_SET_MAC_SRC, > + > + /** > + * Set destination MAC address from matched flow. > + * > + * If flow pattern does not define a valid RTE_FLOW_ITEM_TYPE_ETH, > + * the PMD should return a RTE_FLOW_ERROR_TYPE_ACTION error. > + * > + * See struct rte_flow_action_set_mac. > + */ > + RTE_FLOW_ACTION_TYPE_SET_MAC_DST, > }; > =20 > /** > @@ -1986,6 +2006,15 @@ struct rte_flow_action_set_ttl { > uint8_t ttl_value; > }; > =20 > +/** > + * RTE_FLOW_ACTION_TYPE_SET_MAC > + * > + * Set MAC address from the matched flow > + */ > +struct rte_flow_action_set_mac { > + uint8_t mac_addr[ETHER_ADDR_LEN]; > +}; > + > /* > * Definition of a single action. > * > --=20 > 2.17.1 >=20