DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Dumitrescu, Cristian" <cristian.dumitrescu@intel.com>
To: "jerinj@marvell.com" <jerinj@marvell.com>,
	"dev@dpdk.org" <dev@dpdk.org>,
	 Thomas Monjalon <thomas@monjalon.net>,
	Ferruh Yigit <ferruh.yigit@xilinx.com>,
	Andrew Rybchenko <andrew.rybchenko@oktetlabs.ru>,
	Ray Kinsella <mdr@ashroe.eu>
Cc: "ajit.khaparde@broadcom.com" <ajit.khaparde@broadcom.com>,
	"aboyer@pensando.io" <aboyer@pensando.io>,
	"Xing, Beilei" <beilei.xing@intel.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>,
	"chas3@att.com" <chas3@att.com>,
	"Xia, Chenbo" <chenbo.xia@intel.com>,
	"Loftus, Ciara" <ciara.loftus@intel.com>,
	"dsinghrawat@marvell.com" <dsinghrawat@marvell.com>,
	"ed.czeck@atomicrules.com" <ed.czeck@atomicrules.com>,
	"evgenys@amazon.com" <evgenys@amazon.com>,
	"grive@u256.net" <grive@u256.net>,
	"g.singh@nxp.com" <g.singh@nxp.com>,
	"zhouguoyang@huawei.com" <zhouguoyang@huawei.com>,
	"Wang, Haiyue" <haiyue.wang@intel.com>,
	"hkalra@marvell.com" <hkalra@marvell.com>,
	"heinrich.kuhn@corigine.com" <heinrich.kuhn@corigine.com>,
	"hemant.agrawal@nxp.com" <hemant.agrawal@nxp.com>,
	"hyonkim@cisco.com" <hyonkim@cisco.com>,
	"igorch@amazon.com" <igorch@amazon.com>,
	"irusskikh@marvell.com" <irusskikh@marvell.com>,
	"jgrajcia@cisco.com" <jgrajcia@cisco.com>,
	"Singh, Jasvinder" <jasvinder.singh@intel.com>,
	"jianwang@trustnetic.com" <jianwang@trustnetic.com>,
	"jiawenwu@trustnetic.com" <jiawenwu@trustnetic.com>,
	"Wu, Jingjing" <jingjing.wu@intel.com>,
	"Daley, John" <johndale@cisco.com>,
	"john.miller@atomicrules.com" <john.miller@atomicrules.com>,
	"linville@tuxdriver.com" <linville@tuxdriver.com>,
	"Wiles, Keith" <keith.wiles@intel.com>,
	"kirankumark@marvell.com" <kirankumark@marvell.com>,
	 "oulijun@huawei.com" <oulijun@huawei.com>,
	"lironh@marvell.com" <lironh@marvell.com>,
	"longli@microsoft.com" <longli@microsoft.com>,
	"mw@semihalf.com" <mw@semihalf.com>,
	"spinler@cesnet.cz" <spinler@cesnet.cz>,
	 "matan@nvidia.com" <matan@nvidia.com>,
	"Peters, Matt" <matt.peters@windriver.com>,
	"maxime.coquelin@redhat.com" <maxime.coquelin@redhat.com>,
	"mk@semihalf.com" <mk@semihalf.com>,
	"humin29@huawei.com" <humin29@huawei.com>,
	"pnalla@marvell.com" <pnalla@marvell.com>,
	"ndabilpuram@marvell.com" <ndabilpuram@marvell.com>,
	"Yang, Qiming" <qiming.yang@intel.com>,
	"Zhang, Qi Z" <qi.z.zhang@intel.com>,
	 "radhac@marvell.com" <radhac@marvell.com>,
	"rahul.lakkireddy@chelsio.com" <rahul.lakkireddy@chelsio.com>,
	"rmody@marvell.com" <rmody@marvell.com>,
	"Xu,  Rosen" <rosen.xu@intel.com>,
	"sachin.saxena@oss.nxp.com" <sachin.saxena@oss.nxp.com>,
	"skoteshwar@marvell.com" <skoteshwar@marvell.com>,
	"shshaikh@marvell.com" <shshaikh@marvell.com>,
	"shaibran@amazon.com" <shaibran@amazon.com>,
	Shepard Siegel <shepard.siegel@atomicrules.com>,
	"asomalap@amd.com" <asomalap@amd.com>,
	"somnath.kotur@broadcom.com" <somnath.kotur@broadcom.com>,
	"sthemmin@microsoft.com" <sthemmin@microsoft.com>,
	"Webster, Steven" <steven.webster@windriver.com>,
	"skori@marvell.com" <skori@marvell.com>,
	"mtetsuyah@gmail.com" <mtetsuyah@gmail.com>,
	"vburru@marvell.com" <vburru@marvell.com>,
	"viacheslavo@nvidia.com" <viacheslavo@nvidia.com>,
	"Wang, Xiao W" <xiao.w.wang@intel.com>,
	"cloud.wangxiaoyun@huawei.com" <cloud.wangxiaoyun@huawei.com>,
	"yisen.zhuang@huawei.com" <yisen.zhuang@huawei.com>,
	"Wang, Yong" <yongwang@vmware.com>,
	"xuanziyang2@huawei.com" <xuanziyang2@huawei.com>
Subject: RE: [dpdk-dev] [PATCH v4] ethdev: mtr: support protocol based input color selection
Date: Tue, 26 Apr 2022 12:08:01 +0000	[thread overview]
Message-ID: <DM8PR11MB5670C98B3ABE2CBA4D5D134DEBFB9@DM8PR11MB5670.namprd11.prod.outlook.com> (raw)
In-Reply-To: <20220421180241.514767-1-jerinj@marvell.com>

Hi Jerin,

Thank you for implementing according to our agreement, I am happy to see that we are converging.

Here are some comments below:

<snip>

> diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h
> index 40df0888c8..76ffbcf724 100644
> --- a/lib/ethdev/rte_mtr.h
> +++ b/lib/ethdev/rte_mtr.h
> @@ -213,6 +213,52 @@ struct rte_mtr_meter_policy_params {
>  	const struct rte_flow_action *actions[RTE_COLORS];
>  };
> 
> +/**
> + * Input color protocol method

I suggest adding some more explanations here:
More than one method can be enabled for a given meter. Even if enabled, a method might not be applicable to each input packet, in case the associated protocol header is not present in the packet. The highest priority method that is both enabled for the meter and also applicable for the current input packet wins; if none is both enabled and applicable, the default input color is used. @see function rte_mtr_color_in_protocol_priority_set()

> + */
> +enum rte_mtr_color_in_protocol {
> +	/**
> +	 * If the input packet has at least one VLAN label, its input color is
> +	 * detected by the outermost VLAN DEI(1bit), PCP(3 bits)
> +	 * indexing into the struct rte_mtr_params::vlan_table.
> +	 * Otherwise, the *default_input_color* is applied.
> +	 *

The statement "Otherwise, the *default_input_color* is applied" is incorrect IMO and should be removed, as multiple methods might be enabled and also applicable to a specific input packet, in which case the highest priority method wins, as opposed to the default input color.

I suggest a simplification "Enable the detection of the packet input color based on the outermost VLAN header fields DEI (1 bit) and PCP (3 bits). These fields are used as index into the VLAN table"

> +	 * @see struct rte_mtr_params::default_input_color
> +	 * @see struct rte_mtr_params::vlan_table
> +	 */
> +	RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN = RTE_BIT64(0),
> +	/**
> +	 * If the input packet has at least one VLAN label, its input color is
> +	 * detected by the innermost VLAN DEI(1bit), PCP(3 bits)
> +	 * indexing into the struct rte_mtr_params::vlan_table.
> +	 * Otherwise, the *default_input_color* is applied.
> +	 *
> +	 * @see struct rte_mtr_params::default_input_color
> +	 * @see struct rte_mtr_params::vlan_table
> +	 */

Same simplification suggested here.

> +	RTE_MTR_COLOR_IN_PROTO_INNER_VLAN = RTE_BIT64(1),
> +	/**
> +	 * If the input packet is IPv4 or IPv6, its input color is detected by
> +	 * the outermost DSCP field indexing into the
> +	 * struct rte_mtr_params::dscp_table.
> +	 * Otherwise, the *default_input_color* is applied.
> +	 *
> +	 * @see struct rte_mtr_params::default_input_color
> +	 * @see struct rte_mtr_params::dscp_table
> +	 */

Same simplification suggested here.

> +	RTE_MTR_COLOR_IN_PROTO_OUTER_DSCP = RTE_BIT64(2),

I am OK to keep DSCP for the name of the table instead of renaming the table, as you suggested, but this method name should reflect the protocol, not the field: RTE_MTR_COLOR_IN_PROTO_OUTER_IP.

> +	/**
> +	 * If the input packet is IPv4 or IPv6, its input color is detected by
> +	 * the innermost DSCP field indexing into the
> +	 * struct rte_mtr_params::dscp_table.
> +	 * Otherwise, the *default_input_color* is applied.
> +	 *
> +	 * @see struct rte_mtr_params::default_input_color
> +	 * @see struct rte_mtr_params::dscp_table
> +	 */

Same simplification suggested here.

> +	RTE_MTR_COLOR_IN_PROTO_INNER_DSCP = RTE_BIT64(3),

I am OK to keep DSCP for the name of the table instead of renaming the table, as you suggested, but this method name should reflect the protocol, not the field: RTE_MTR_COLOR_IN_PROTO_INNER_IP.

> +
>  /**
>   * Parameters for each traffic metering & policing object
>   *
> @@ -233,20 +279,58 @@ struct rte_mtr_params {
>  	 */
>  	int use_prev_mtr_color;
> 
> -	/** Meter input color. When non-NULL: it points to a pre-allocated and
> +	/** Meter input color based on IP DSCP protocol field.
> +	 *
> +	 * Valid when *input_color_proto_mask* set to any of the following
> +	 * RTE_MTR_COLOR_IN_PROTO_OUTER_DSCP,
> +	 * RTE_MTR_COLOR_IN_PROTO_INNER_DSCP
> +	 *
> +	 * When non-NULL: it points to a pre-allocated and
>  	 * pre-populated table with exactly 64 elements providing the input
>  	 * color for each value of the IPv4/IPv6 Differentiated Services Code
> -	 * Point (DSCP) input packet field. When NULL: it is equivalent to
> -	 * setting this parameter to an all-green populated table (i.e. table
> -	 * with all the 64 elements set to green color). The color blind mode
> -	 * is configured by setting *use_prev_mtr_color* to 0 and *dscp_table*
> -	 * to either NULL or to an all-green populated table. When
> -	 * *use_prev_mtr_color* is non-zero value or when *dscp_table*
> contains
> -	 * at least one yellow or red color element, then the color aware mode
> -	 * is configured.
> +	 * Point (DSCP) input packet field.
> +	 *
> +	 * When NULL: it is equivalent to setting this parameter to an all-green
> +	 * populated table (i.e. table with all the 64 elements set to green
> +	 * color). The color blind mode is configured by setting
> +	 * *use_prev_mtr_color* to 0 and *dscp_table* to either NULL or to an
> +	 * all-green populated table.
> +	 *
> +	 * When *use_prev_mtr_color* is non-zero value or when
> *dscp_table*
> +	 * contains at least one yellow or red color element, then the color
> +	 * aware mode is configured.
> +	 *
> +	 * @see enum
> rte_mtr_color_in_protocol::RTE_MTR_COLOR_IN_PROTO_OUTER_DSCP
> +	 * @see enum
> rte_mtr_color_in_protocol::RTE_MTR_COLOR_IN_PROTO_INNER_DSCP
> +	 * @see struct rte_mtr_params::input_color_proto_mask
>  	 */
>  	enum rte_color *dscp_table;
> -
> +	/** Meter input color based on VLAN DEI(1bit), PCP(3 bits) protocol
> +	 * fields.
> +	 *
> +	 * Valid when *input_color_proto_mask* set to any of the following
> +	 * RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN,
> +	 * RTE_MTR_COLOR_IN_PROTO_INNER_VLAN
> +	 *
> +	 * When non-NULL: it points to a pre-allocated and pre-populated
> +	 * table with exactly 16 elements providing the input color for
> +	 * each value of the DEI(1bit), PCP(3 bits) input packet field.
> +	 *
> +	 * When NULL: it is equivalent to setting this parameter to an
> +	 * all-green populated table (i.e. table with
> +	 * all the 16 elements set to green color). The color blind mode
> +	 * is configured by setting *use_prev_mtr_color* to 0 and
> +	 * *vlan_table* to either NULL or to an all-green populated table.
> +	 *
> +	 * When *use_prev_mtr_color* is non-zero value
> +	 * or when *vlan_table* contains at least one yellow or
> +	 * red color element, then the color aware mode is configured.
> +	 *
> +	 * @see enum
> rte_mtr_color_in_protocol::RTE_MTR_COLOR_IN_PROTO_OUTER_VLAN
> +	 * @see enum
> rte_mtr_color_in_protocol::RTE_MTR_COLOR_IN_PROTO_INNER_VLAN
> +	 * @see struct rte_mtr_params::input_color_proto_mask
> +	 */
> +	enum rte_color *vlan_table;
>  	/** Non-zero to enable the meter, zero to disable the meter at the
> time
>  	 * of MTR object creation. Ignored when the meter profile indicated by
>  	 * *meter_profile_id* is set to NONE.
> @@ -261,6 +345,25 @@ struct rte_mtr_params {
> 
>  	/** Meter policy ID. @see rte_mtr_meter_policy_add() */
>  	uint32_t meter_policy_id;
> +
> +	/** Set of input color protocols to be enabled.
> +	 *
> +	 * Set value to zero to configure as color blind mode.
> +	 *
> +	 * When multiple bits set then rte_mtr_color_in_protocol_priority_set()
> +	 * shall be used to set the priority, in the order, in which protocol
> +	 * to be used to find the inpput color.
> +	 *
> +	 * @see enum rte_mtr_color_in_protocol
> +	 * @see rte_mtr_color_in_protocol_priority_set()
> +	 */
> +	uint64_t input_color_proto_mask;

We should not have this as an input parameter at all, please remove this field. This mask is implicitly created by the user by calling the rte_mtr_color_in_protocol_priority_set() API function. If this function is called for a given method, then that method is enabled with the given priority; when this function is not called for a given method, then that method is disabled.

> +
> +	/** Input color to be set for the input packet when none of the
> +	 * enabled input color methods is applicable to the input packet.
> +	 * Ignored when this when *input_color_proto_mask* set to zero.
> +	 */
> +	enum rte_color default_input_color;
>  };
> 
>  /**
> @@ -417,6 +520,16 @@ struct rte_mtr_capabilities {
>  	 * @see enum rte_mtr_stats_type
>  	 */
>  	uint64_t stats_mask;
> +
> +	/** Set of supported input color protocol.
> +	 * @see enum rte_mtr_color_in_protocol
> +	 */
> +	uint64_t input_color_proto_mask;

Agree.

> +
> +	/** When non-zero, it indicates that driver supports separate
> +	 * input color table for given ethdev port.
> +	 */
> +	int separate_input_color_table_per_port;

The input color tables are actually configured per meter object, do we also need a "separate_input_color_table_per_meter" capability flag?

>  };
> 
>  /**
> @@ -832,6 +945,59 @@ rte_mtr_meter_dscp_table_update(uint16_t port_id,
>  	enum rte_color *dscp_table,
>  	struct rte_mtr_error *error);
> 
> +/**
> + * MTR object VLAN table update
> + *
> + * @param[in] port_id
> + *   The port identifier of the Ethernet device.
> + * @param[in] mtr_id
> + *   MTR object ID. Needs to be valid.
> + * @param[in] vlan_table
> + *   When non-NULL: it points to a pre-allocated and pre-populated table with
> + *   exactly 16 elements providing the input color for each value of the
> + *   each value of the DEI(1bit), PCP(3 bits) input packet field.
> + *   When NULL: it is equivalent to setting this parameter to an "all-green"
> + *   populated table (i.e. table with all the 16 elements set to green color).
> + * @param[out] error
> + *   Error details. Filled in only on error, when not NULL.
> + * @return
> + *   0 on success, non-zero error code otherwise.
> + */
> +__rte_experimental
> +int
> +rte_mtr_meter_vlan_table_update(uint16_t port_id, uint32_t mtr_id,
> +				enum rte_color *vlan_table,
> +				struct rte_mtr_error *error);
> +/**
> + * Set the priority for input color protocol
> + *
> + * When multiple bits set in struct rte_mtr_params::input_color_proto_mask
> + * then this API shall be used to set the priority, in the order, in
> + * which protocol to be used to find the input color.

As stated above, we should remove struct rte_mtr_params::input_color_proto_mask, as it is build implicitly by calling this function.

I suggest reiterating the explanation from above:
More than one method can be enabled for a given meter. Even if enabled, a method might not be applicable to each input packet, in case the associated protocol header is not present in the packet. The highest priority method that is both enabled for the meter and also applicable for the current input packet wins; if none is both enabled and applicable, the default input color is used. @see function rte_mtr_color_in_protocol_priority_set()

> + *
> + * @param[in] port_id
> + *   The port identifier of the Ethernet device.
> + * @param[in] mtr_id
> + *   MTR object ID. Needs to be valid.
> + * @param[in] proto
> + *   Input color protocol to apply priority.
> + *   MTR object's *input_color_proto_mask* should be configured
> + *   with proto value.
> + * @param[in] priority
> + *   Input color protocol priority. Value zero indicates
> + *   the highest priority.

Agree.

> + * @param[out] error
> + *   Error details. Filled in only on error, when not NULL.
> + * @return
> + *   0 on success, non-zero error code otherwise.
> + *
> + * @see rte_mtr_params::input_color_proto_mask
> + */
> +__rte_experimental
> +int
> +rte_mtr_color_in_protocol_priority_set(uint16_t port_id, uint32_t mtr_id,
> +	enum rte_mtr_color_in_protocol proto, uint32_t priority,
> +	struct rte_mtr_error *error);
>  /**
>   * MTR object enabled statistics counters update
>   *

<snip>

Regards,
Cristian

  parent reply	other threads:[~2022-04-26 12:08 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-20  8:24 [dpdk-dev] [RFC PATCH] ethdev: mtr: enhance input color table features jerinj
2021-08-30  9:23 ` Jerin Jacob
2021-09-27 16:20   ` Ferruh Yigit
2021-10-11 15:14 ` Dumitrescu, Cristian
2021-11-17 12:00   ` Jerin Jacob
2021-12-07  9:55     ` Jerin Jacob
2021-12-07 18:00       ` Dumitrescu, Cristian
2022-01-10  9:35         ` Jerin Jacob
2022-02-14 11:56 ` [dpdk-dev] [v22.07] [PATCH] ethdev: mtr: support input color selection jerinj
2022-02-14 12:02   ` [dpdk-dev] [v22.07] [PATCH v2] " jerinj
2022-03-01  8:58     ` [PATCH v3 1/1] " skori
2022-03-01 10:49       ` [EXT] " Sunil Kumar Kori
2022-03-01 17:48       ` Dumitrescu, Cristian
2022-04-05 21:14         ` Dumitrescu, Cristian
2022-04-07 10:51         ` Jerin Jacob
2022-04-07 13:25           ` Dumitrescu, Cristian
2022-04-07 14:39             ` Jerin Jacob
2022-04-11 14:45               ` Dumitrescu, Cristian
2022-04-12  6:48                 ` Ori Kam
2022-04-21 18:02       ` [dpdk-dev] [PATCH v4] ethdev: mtr: support protocol based " jerinj
2022-04-26 10:19         ` Ray Kinsella
2022-05-01 12:52           ` Jerin Jacob
2022-04-26 12:08         ` Dumitrescu, Cristian [this message]
2022-05-01 12:56           ` Jerin Jacob
2022-05-01 14:46         ` [dpdk-dev] [PATCH v5] " jerinj
2022-05-04  8:52           ` Ray Kinsella
2022-05-05 10:56           ` Dumitrescu, Cristian
2022-05-12  7:36           ` Andrew Rybchenko
2022-05-12 11:03             ` Jerin Jacob
2022-05-19  7:05               ` Andrew Rybchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DM8PR11MB5670C98B3ABE2CBA4D5D134DEBFB9@DM8PR11MB5670.namprd11.prod.outlook.com \
    --to=cristian.dumitrescu@intel.com \
    --cc=aboyer@pensando.io \
    --cc=ajit.khaparde@broadcom.com \
    --cc=andrew.rybchenko@oktetlabs.ru \
    --cc=asomalap@amd.com \
    --cc=beilei.xing@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=chas3@att.com \
    --cc=chenbo.xia@intel.com \
    --cc=ciara.loftus@intel.com \
    --cc=cloud.wangxiaoyun@huawei.com \
    --cc=dev@dpdk.org \
    --cc=dsinghrawat@marvell.com \
    --cc=ed.czeck@atomicrules.com \
    --cc=evgenys@amazon.com \
    --cc=ferruh.yigit@xilinx.com \
    --cc=g.singh@nxp.com \
    --cc=grive@u256.net \
    --cc=haiyue.wang@intel.com \
    --cc=heinrich.kuhn@corigine.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=hkalra@marvell.com \
    --cc=humin29@huawei.com \
    --cc=hyonkim@cisco.com \
    --cc=igorch@amazon.com \
    --cc=irusskikh@marvell.com \
    --cc=jasvinder.singh@intel.com \
    --cc=jerinj@marvell.com \
    --cc=jgrajcia@cisco.com \
    --cc=jianwang@trustnetic.com \
    --cc=jiawenwu@trustnetic.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.miller@atomicrules.com \
    --cc=johndale@cisco.com \
    --cc=keith.wiles@intel.com \
    --cc=kirankumark@marvell.com \
    --cc=linville@tuxdriver.com \
    --cc=lironh@marvell.com \
    --cc=longli@microsoft.com \
    --cc=matan@nvidia.com \
    --cc=matt.peters@windriver.com \
    --cc=maxime.coquelin@redhat.com \
    --cc=mdr@ashroe.eu \
    --cc=mk@semihalf.com \
    --cc=mtetsuyah@gmail.com \
    --cc=mw@semihalf.com \
    --cc=ndabilpuram@marvell.com \
    --cc=oulijun@huawei.com \
    --cc=pnalla@marvell.com \
    --cc=qi.z.zhang@intel.com \
    --cc=qiming.yang@intel.com \
    --cc=radhac@marvell.com \
    --cc=rahul.lakkireddy@chelsio.com \
    --cc=rmody@marvell.com \
    --cc=rosen.xu@intel.com \
    --cc=sachin.saxena@oss.nxp.com \
    --cc=shaibran@amazon.com \
    --cc=shepard.siegel@atomicrules.com \
    --cc=shshaikh@marvell.com \
    --cc=skori@marvell.com \
    --cc=skoteshwar@marvell.com \
    --cc=somnath.kotur@broadcom.com \
    --cc=spinler@cesnet.cz \
    --cc=steven.webster@windriver.com \
    --cc=sthemmin@microsoft.com \
    --cc=thomas@monjalon.net \
    --cc=vburru@marvell.com \
    --cc=viacheslavo@nvidia.com \
    --cc=xiao.w.wang@intel.com \
    --cc=xuanziyang2@huawei.com \
    --cc=yisen.zhuang@huawei.com \
    --cc=yongwang@vmware.com \
    --cc=zhouguoyang@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).