[dpdk-dev] [PATCH v4 1/3] ethdev: support metadata as flow rule criteria

Dekel Peled dekelp at mellanox.com
Wed Oct 17 09:52:39 CEST 2018



From: Andrew Rybchenko <arybchenko at solarflare.com>
Sent: Wednesday, October 17, 2018 9:03 AM
To: Dekel Peled <dekelp at mellanox.com>; wenzhuo.lu at intel.com; jingjing.wu at intel.com; bernard.iremonger at intel.com; olivier.matz at 6wind.com; Adrien Mazarguil <adrien.mazarguil at 6wind.com>; Thomas Monjalon <thomas at monjalon.net>; ferruh.yigit at intel.com
Cc: Shahaf Shuler <shahafs at mellanox.com>; dev at dpdk.org; Ori Kam <orika at mellanox.com>; Nikhil Rao <nikhil.rao at intel.com>
Subject: Re: [dpdk-dev] [PATCH v4 1/3] ethdev: support metadata as flow rule criteria

On 10/17/18 8:27 AM, Dekel Peled wrote:
Thanks, PSB.

From: Andrew Rybchenko <arybchenko at solarflare.com><mailto:arybchenko at solarflare.com>
Sent: Tuesday, October 16, 2018 5:12 PM
To: Dekel Peled <dekelp at mellanox.com><mailto:dekelp at mellanox.com>; wenzhuo.lu at intel.com<mailto:wenzhuo.lu at intel.com>; jingjing.wu at intel.com<mailto:jingjing.wu at intel.com>; bernard.iremonger at intel.com<mailto:bernard.iremonger at intel.com>; olivier.matz at 6wind.com<mailto:olivier.matz at 6wind.com>; Adrien Mazarguil <adrien.mazarguil at 6wind.com><mailto:adrien.mazarguil at 6wind.com>; Thomas Monjalon <thomas at monjalon.net><mailto:thomas at monjalon.net>; ferruh.yigit at intel.com<mailto:ferruh.yigit at intel.com>
Cc: Shahaf Shuler <shahafs at mellanox.com><mailto:shahafs at mellanox.com>; dev at dpdk.org<mailto:dev at dpdk.org>; Ori Kam <orika at mellanox.com><mailto:orika at mellanox.com>; Nikhil Rao <nikhil.rao at intel.com><mailto:nikhil.rao at intel.com>
Subject: Re: [dpdk-dev] [PATCH v4 1/3] ethdev: support metadata as flow rule criteria

On 10/11/18 1:49 PM, Dekel Peled wrote:

As described in [1], a new rte_flow item is added to support metadata

to use as flow rule match pattern.

The metadata is an opaque item, fully controlled by the application.



The use of metadata is relevant for egress rules only.

It can be set in the flow rule using the RTE_FLOW_ITEM_META.



An additional item 'tx_metadata' is added in union with existing member

'hash' of struct 'rte_mbuf'.

It is used to carry the metadata item.

Currently this union is used only for ingress packets, so using it for

egress metadata will not cause conflicts.



Application should set the packet metadata in the mbuf dedicated field,

and set the PKT_TX_METADATA flag in the mbuf->ol_flags.

The NIC will use the packet metadata as match criteria for relevant

flow rules.



This patch introduces metadata item type for rte_flow RTE_FLOW_ITEM_META,

along with corresponding struct rte_flow_item_meta and ol_flag

PKT_TX_METADATA.



[1] "[RFC,v2] ethdev: support metadata as flow rule criteria"



Signed-off-by: Dekel Peled <dekelp at mellanox.com><mailto:dekelp at mellanox.com>

[...]




diff --git a/doc/guides/prog_guide/rte_flow.rst b/doc/guides/prog_guide/rte_flow.rst

index b600b2d..8643722 100644

--- a/doc/guides/prog_guide/rte_flow.rst

+++ b/doc/guides/prog_guide/rte_flow.rst

@@ -1191,6 +1191,27 @@ Normally preceded by any of:

 - `Item: ICMP6_ND_NS`_

 - `Item: ICMP6_ND_OPT`_



+Item: ``META``

+^^^^^^^^^^^^^^

+

+Matches an application specific 32 bit metadata item.

+

+- Default ``mask`` matches any 32 bit value.

+

+.. _table_rte_flow_item_meta:

+

+.. table:: META

+

+   +----------+----------+---------------------------+

+   | Field    | Subfield | Value                     |

+   +==========+==========+===========================+

+   | ``spec`` | ``data`` | 32 bit metadata value     |

+   +----------+--------------------------------------+

+   | ``last`` | ``data`` | upper range value         |

+   +----------+----------+---------------------------+

+   | ``mask`` | ``data`` | zeroed to match any value |

+   +----------+----------+---------------------------+

+

Is there a difference between any metadata value and
no metadata value at all?



<DP> Value Zero is considered as no metadata value.

Not sure that I understand.
Is flow rule with no META item equivalent to flow rule with
META item and mask.data==0?
Flow rule with no META item matches packets with and
without metadata.
Flow rule with META item and mask.data==0 could match
packets with metadata provided and any value, or could
be equivalent to no META item at all.
(I'm asking since no IPv4 item and empty IPv4 item are
different things).
<DP> mask is not relevant for this item.
I will rephrase the text:
Item: ``META``
^^^^^^^^^^^^^^
Matches an application specific 32 bit metadata item.
- Default ``mask`` matches the specified metadata value.
.. _table_rte_flow_item_meta:
.. table:: META
   +----------+----------+--------------------------------------+
   | Field    | Subfield | Value                                |   +==========+==========+=======================================+
   | ``spec`` | ``data`` | 32 bit metadata value                |
   +----------+-------------------------------------------------+
   | ``last`` | ``data`` | upper range value                    |
   +----------+----------+--------------------------------------+
   | ``mask`` | ``data`` | ignored, default mask matches "spec" |
   +----------+----------+--------------------------------------+



More information about the dev mailing list