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: http://patches.dpdk.org/patch/85384/ > > 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. > + +---------------+-------------------------+ > + > +.. _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 | > + +---------------+------------------------------------------+ > +