> On Jun 6, 2019, at 3:35 AM, Jerin Jacob Kollanukkaran <jer...@marvell.com> 
> wrote:
> 
>> -----Original Message-----
>> From: dev <dev-boun...@dpdk.org> On Behalf Of Yongseok Koh
>> Sent: Tuesday, June 4, 2019 3:03 AM
>> To: shah...@mellanox.com; tho...@monjalon.net; ferruh.yi...@intel.com;
>> arybche...@solarflare.com; adrien.mazarg...@6wind.com;
>> olivier.m...@6wind.com
>> Cc: dev@dpdk.org
>> Subject: [dpdk-dev] [RFC 2/3] ethdev: add flow modify mark action
>> 
>> Mark ID can be modified when supporting multiple tables. Partial bit
>> alteration is supported to preserve some bit-fields set by previous match.
>> 
>> Signed-off-by: Yongseok Koh <ys...@mellanox.com>
>> ---
>> doc/guides/prog_guide/rte_flow.rst | 21 +++++++++++++++++++++
>> lib/librte_ethdev/rte_flow.h       | 24 ++++++++++++++++++++++++
>> 2 files changed, 45 insertions(+)
>> 
>> diff --git a/doc/guides/prog_guide/rte_flow.rst
>> b/doc/guides/prog_guide/rte_flow.rst
>> index 016cd90e52..2907edfff4 100644
>> --- a/doc/guides/prog_guide/rte_flow.rst
>> +++ b/doc/guides/prog_guide/rte_flow.rst
>> @@ -1463,6 +1463,27 @@ depends on the underlying implementation. It is
>> returned in the
>>    | ``id`` | integer value to return with packets |
>>    +--------+--------------------------------------+
>> 
>> +Action: ``MODIFY_MARK``
>> +^^^^^^^^^^^^^^^^^^^^^^^
>> +
>> +Alter partial bits of mark ID set by ``MARK`` action.
>> +
>> +``mask`` indicates which bits are modified. For bits which have never
>> +been set by ``MARK`` or ``MODIFY_MARK``, unpredictable value will be
>> +seen depending on driver implementation.
>> +
>> +.. _table_rte_flow_action_modify_mark:
>> +
>> +.. table:: MODIFY_MARK
>> +
>> +   +----------+--------------------------------------+
>> +   | Field    | Value                                |
>> +   +==========+======================================+
>> +   | ``id``   | integer value to return with packets |
>> +   +----------+--------------------------------------+
>> +   | ``mask`` | bit-mask applies to "id"             |
>> +   +----------+--------------------------------------+
>> +
>> Action: ``FLAG``
>> ^^^^^^^^^^^^^^^^
>> 
>> diff --git a/lib/librte_ethdev/rte_flow.h b/lib/librte_ethdev/rte_flow.h 
>> index
>> cda8628183..d811f8a06e 100644
>> --- a/lib/librte_ethdev/rte_flow.h
>> +++ b/lib/librte_ethdev/rte_flow.h
>> @@ -1316,6 +1316,13 @@ enum rte_flow_action_type {
>>       */
>>      RTE_FLOW_ACTION_TYPE_MARK,
>> 
>> +    /**
>> +     * Alter partial bits of mark ID set by
>> RTE_FLOW_ACTION_TYPE_MARK.
>> +     *
>> +     * See struct rte_flow_action_modify_mark.
>> +     */
>> +    RTE_FLOW_ACTION_TYPE_MODIFY_MARK,
>> +
> 
> I think, we need to define the case where application calls MODIFY_MARK first 
> on given pattern before MARK

Good input. 

> I think, either we can 
> # Introduce an error number for that?

Practically, it would be impossible to keep track of MARK action to check if it 
is set or not prior to MODIFY_MARK.
When creating flows with multiple tables, we can't say a flow having 
MODIFY_MARK action will have prior MARK action or not.

> # Treat first MODIFY_MARK as MARK

So, I took similar approach.
In the documentation above, unset bits would have arbitrary value depending on 
driver/device implementation.
User can't assume mark ID is initially zeroed but rather need to check it with 
vendors.

> Just to understand, in this absence of this new action, an application needs
> to destroy the given pattern with associated  existing MARK action and
> add the same pattern with updated value as MARK action? Right?

Application would have to override it by second MARK action.
But it has to be validated by user anyway to check if device allows override.

Thanks,
Yongseok


Reply via email to