> From: Jerin Jacob <jerinjac...@gmail.com> on Friday, January 15, 2021 9:01 > Subject: Re: [dpdk-dev] [PATCH] ethdev: introduce generic copy rte flow > action > > On Thu, Jan 14, 2021 at 8:32 PM Ori Kam <or...@nvidia.com> wrote: > > > > Hi Jerin, > > > > > -----Original Message----- > > > From: Jerin Jacob <jerinjac...@gmail.com> > > > Sent: Thursday, January 14, 2021 4:00 PM > > > Subject: Re: [dpdk-dev] [PATCH] ethdev: introduce generic copy rte flow > action > > > > > > On Fri, Jan 8, 2021 at 12:02 PM Alexander Kozyrev > <akozy...@nvidia.com> > > > wrote: > > > > > > > > Implement a generic copy flow API to allow copying of an arbitrary > > > > header field (as well as mark, metadata or tag) to another item. > > > > > > > > This generic copy mechanism removes the necessity to implement a > > > > separate RTE Flow action every time we need to modify a new packet > > > > field in the future. A user-provided value can be used from a > > > > specified tag/metadata or directly copied from other packet field. > > > > > > > > The number of bits to copy as well as the offset to start from can > > > > be specified to allow a partial copy or copy into an arbitrary > > > > place in a packet for greater flexibility. > > > > > > > > RFC: > > > > https://nam11.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch > es.d > > > > pdk.org%2Fpatch%2F85384%2F&data=04%7C01%7Corika%40nvidia.com > % > > > > 7C62ab41b9ed5948d056c308d8b894af02%7C43083d15727340c1b7db39efd9cc > > > > c17a%7C0%7C0%7C637462296023413253%7CUnknown%7CTWFpbGZsb3d8ey > J > > > > WIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D% > 7C > > > > 1000&sdata=ovpEss3%2B7TgZRYFiDkrvuMFW52747Gno5oOIeDLwrBQ% > 3D > > > &reserved=0 > > > > > > > > Signed-off-by: Alexander Kozyrev <akozy...@nvidia.com> > > > > --- > > > > > > > > > > > +Action: ``COPY_ITEM`` > > > > +^^^^^^^^^^^^^^^^^^^^^ > > > > + > > > > +Copy ``width`` bits from ``src`` item to ``dst`` item. > > > > + > > > > +An arbitrary header field (as well as mark, metadata or tag values) > > > > +can be used as both source and destination items as set by ``item``. > > > > + > > > > +Inner packet header fields can be accessed using the ``index`` and > > > > +it is possible to start the copy from the ``offset`` bits in an item. > > > > + > > > > +.. _table_rte_flow_action_copy_item: > > > > + > > > > +.. table:: COPY_ITEM > > > > + > > > > + +-----------------------------------------+ > > > > + | Field | Value | > > > > + +===============+=========================+ > > > > + | ``dst`` | destination item | > > > > + | ``src`` | source item | > > > > + | ``width`` | number of bits to copy | > > > > > > > > > > > > Overall it is a good improvement. > > > > > > I think, if we add transform "op" here then it can be more generic. In > > > other words, A generic packet transform and copy operation is just one > > > of the operations. > > > ie.. making it as rte_flow_action_xform_item and introduce COPY, ADD, > > > SUB, etc transform along with existing rte_flow_action_copy_item > > > fields. > > > > > > It may useful for expressing P4 packet transforms to rte_flow. > > > > > > The current generation of Marvell HW does not have COPY transform so I > > > am leaving suggestions to vendors with this HW capablity. > > > > > > > > > > +1 > > Lest have dst, src, width, op members, > > and change the action name to rte_flow_action_modify_field() > > > > also lest add new field name immediate so the copy can be used as set. > > (copy of an immediate value is a set) > > > > Possible op = copy / add / sub > > +1 Thank you, Jerin, for a great idea. I'm issuing a v4 patch with generic modify_field design.
> > > > > > > + +---------------+-------------------------+ > > > > > > > > > > > > > > > > + > > > > +.. _table_rte_flow_action_copy_data: > > > > + > > > > +.. table:: destination/source item definition > > > > + > > > > + +----------------------------------------------------------+ > > > > + | Field | Value | > > > > + > +===============+========================================= > =+ > > > > + | ``item`` | ID of a packet field/mark/metadata/tag | > > > > + | ``index`` | index of outer/inner header or tag array | > > > > + | ``offset`` | number of bits to skip during the copy | > > > > + +---------------+------------------------------------------+ > > > > +