From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id E694EA034F; Mon, 30 Aug 2021 11:24:11 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 88B7D4113E; Mon, 30 Aug 2021 11:24:11 +0200 (CEST) Received: from mail-io1-f41.google.com (mail-io1-f41.google.com [209.85.166.41]) by mails.dpdk.org (Postfix) with ESMTP id D7F914113D for ; Mon, 30 Aug 2021 11:24:09 +0200 (CEST) Received: by mail-io1-f41.google.com with SMTP id b7so18937145iob.4 for ; Mon, 30 Aug 2021 02:24:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=QQ98j0W/8WLZNNrTrVOT4P90mKPvgXS/symQWk0q6UM=; b=ji6YWZFzA3ohYKJ6IYfaa/3MDUKmVukmBRsS/00Sebz4DXhC4JcWi7A/mKst1EMT4r KoiTNLdxhleOaKjZknFp72zAI1UOcq7Nk6qozIAA5f8dIwo8X/xpHkTPyg4iGWJFfFL1 QkFnrPS0Dxe99K3WPHgGyNFaO9K7FENCzFAfARxyWIOWHAWqf8c228degawxYw5ju2um ElJXgUkFhWOAL7eyOS9M3I41czTAtQFQ9dBhl9pnovv69+J7S4+HUlQqGq/pB1P1sXu5 GMIs21Rkp9kOqXIpK1+bIy0kxSjvfr/34O6Uf6CeuNaKJZYWvychsJumLgGNTwEMSTzN 0EkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QQ98j0W/8WLZNNrTrVOT4P90mKPvgXS/symQWk0q6UM=; b=RhnbHLUAaAT6EfJPv+lSJ5hQ8C92uVJF6bUx6B5h1Y6NYdGdQyYIUdALznyOZCRGRS VFKUS9kL5UA0gdxTTN/56yGLSF4U1cxWuhrH4YNVLrkpZoUW7vnk7ejO10z7W2MtkwO8 2EyuZ6HIcloOS+d85IenRRjNfgC9oK0K/pKsIPkwRM8Z35n73k5OBfEGgfkiFsJzdWRw Th6bOE3BoWTXLuLVwJE3PLUeEuLyRxXzCWGS240cSZjUXsSHr94nuGloykaGxlTfo2ma PudX1k7n5YVl8JWLX1OM/28YNkZJr++ZcxKRO0kVW94n3vnEr3MqdMDTZbo4Fn17aYgn 8prQ== X-Gm-Message-State: AOAM530NViEyLz3nkr3Um5LgBqY40EHi7xsrbv8VObxDAMC4+wciGx5v HgaBDAPkXP3ukVx6dXG3UcpUZ4JclMP4YmQdscM= X-Google-Smtp-Source: ABdhPJwaRb2vavBk/9mvVTuNTtE/VaJgTtG6FfXdYUE1Di+xSuHZgUGwcD+V3Zsi2dXCs7thGzDV8A/Znr5pL8evBQQ= X-Received: by 2002:a02:9608:: with SMTP id c8mr6147170jai.133.1630315449114; Mon, 30 Aug 2021 02:24:09 -0700 (PDT) MIME-Version: 1.0 References: <20210820082401.3778736-1-jerinj@marvell.com> In-Reply-To: <20210820082401.3778736-1-jerinj@marvell.com> From: Jerin Jacob Date: Mon, 30 Aug 2021 14:53:43 +0530 Message-ID: To: Jerin Jacob Cc: Cristian Dumitrescu , Thomas Monjalon , Ferruh Yigit , Andrew Rybchenko , dpdk-dev , Andrew Rybchenko , Li Zhang , Ajit Khaparde , Jasvinder Singh , Matan Azrad , Nithin Dabilpuram , Sunil Kumar Kori , rkudurumalla@marvell.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [RFC PATCH] ethdev: mtr: enhance input color table features X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Ping On Fri, Aug 20, 2021 at 1:56 PM wrote: > > From: Jerin Jacob > > Currently, meter object supports only DSCP based on input color table, > The patch enhance that to support VLAN based input color table, > color table based on inner field for the tunnel use case, and support > for fallback color per meter if packet based on a different field. > > All of the above features are exposed through capability and added > additional capability to specify the implementation supports > more than one input color table per ethdev port. > > Signed-off-by: Jerin Jacob > --- > lib/ethdev/rte_mtr.h | 130 ++++++++++++++++++++++++++++++++++++++----- > 1 file changed, 116 insertions(+), 14 deletions(-) > > diff --git a/lib/ethdev/rte_mtr.h b/lib/ethdev/rte_mtr.h > index dc246dd7af..311e8754de 100644 > --- a/lib/ethdev/rte_mtr.h > +++ b/lib/ethdev/rte_mtr.h > @@ -213,6 +213,16 @@ struct rte_mtr_meter_policy_params { > const struct rte_flow_action *actions[RTE_COLORS]; > }; > > +/** > + * Input color table > + */ > +enum rte_mtr_input_color_tbl { > + /** DSCP based input color table */ > + RTE_MTR_INPUT_COLOR_TBL_DSCP, > + /** VLAN based input color table */ > + RTE_MTR_INPUT_COLOR_TBL_VLAN, > +}; > + > /** > * Parameters for each traffic metering & policing object > * > @@ -233,20 +243,44 @@ struct rte_mtr_params { > */ > int use_prev_mtr_color; > > - /** Meter input color. 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. > - */ > - enum rte_color *dscp_table; > - > + RTE_STD_C11 > + union { > + /** Meter input color based on DSCP. > + * Valid when rte_mtr_input_color_tbl::tbl_selector is > + * set to RTE_MTR_INPUT_COLOR_TBL_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. > + * @see struct rte_mtr_capabilities::input_color_dscp_supported > + */ > + enum rte_color *dscp_table; > + /** Meter input color based on VLAN. > + * Valid when rte_mtr_input_color_tbl::tbl_selector is > + * set to RTE_MTR_INPUT_COLOR_TBL_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 struct rte_mtr_capabilities::input_color_vlan_supported > + */ > + 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 +295,25 @@ struct rte_mtr_params { > > /** Meter policy ID. */ > uint32_t meter_policy_id; > + > + /** Select the input color table > + * @see struct rte_mtr_params::dscp_table > + * @see struct rte_mtr_capabilities::input_color_dscp_supported > + * @see struct rte_mtr_params::vlan_table > + * @see struct rte_mtr_capabilities::input_color_vlan_supported > + */ > + enum rte_mtr_input_color_tbl tbl_selector; > + /** Fallback input color for the meter, > + * when *use_prev_mtr_color* set to zero value and > + * when packet is not based on selected *tbl_selector*. > + * @see struct rte_mtr_capabilities::input_color_fallback_supported > + */ > + enum rte_color fallback_input_color; > + /** Input color table based on inner field of selected > + * of *tbl_selector*. > + * @see struct rte_mtr_capabilities::input_color_inner_supported > + */ > + int input_color_inner_enable; > }; > > /** > @@ -417,6 +470,31 @@ struct rte_mtr_capabilities { > * @see enum rte_mtr_stats_type > */ > uint64_t stats_mask; > + > + /** Input color based on DSCP. > + * When non-zero, it indicates that driver supports input color table > + * based on DSCP. > + */ > + int input_color_dscp_supported; > + /** Input color based on VLAN. > + * When non-zero, it indicates that driver supports input color table > + * based on VLAN. > + */ > + int input_color_vlan_supported; > + /** Input color fallback support. > + * When non-zero, it indicates that driver supports input color > + * fallback. > + */ > + int input_color_fallback_supported; > + /** Input color based on inner packet field. > + * When non-zero, it indicates that driver supports input color > + * based on inner field. > + */ > + int input_color_inner_supported; > + /** When non-zero, it indicates that driver supports separate > + * input color table for given ethdev port. > + */ > + int seperate_input_color_table_per_port; > }; > > /** > @@ -832,6 +910,30 @@ 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); > /** > * MTR object enabled statistics counters update > * > -- > 2.33.0 >