DPDK patches and discussions
 help / color / mirror / Atom feed
From: Bruce Richardson <bruce.richardson@intel.com>
To: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Cc: <dev@dpdk.org>, <anatoly.burakov@intel.com>
Subject: Re: [PATCH v2 1/6] net/ice/base: add utility functions
Date: Mon, 11 Aug 2025 15:02:06 +0100	[thread overview]
Message-ID: <aJn33kGcl2dfTMDe@bricha3-mobl1.ger.corp.intel.com> (raw)
In-Reply-To: <20250811134301.459523-2-vladimir.medvedkin@intel.com>

On Mon, Aug 11, 2025 at 01:42:56PM +0000, Vladimir Medvedkin wrote:
> Add the following function related to DCB:
> 
> * Get number of Congestion Domains per port
> * Resolve Traffic Class(TC) by 802.1p VLAN User Priority(UP)
> * Get absolute index of the Congestion Domain by the TC
> 
> Signed-off-by: Vladimir Medvedkin <vladimir.medvedkin@intel.com>
> ---
>  drivers/net/intel/ice/base/ice_common.c | 28 +++++++++++++++++++++++++
>  drivers/net/intel/ice/base/ice_common.h |  8 +++++++
>  2 files changed, 36 insertions(+)
> 
> diff --git a/drivers/net/intel/ice/base/ice_common.c b/drivers/net/intel/ice/base/ice_common.c
> index dfc2fd69e7..8bca256b34 100644
> --- a/drivers/net/intel/ice/base/ice_common.c
> +++ b/drivers/net/intel/ice/base/ice_common.c
> @@ -6579,3 +6579,31 @@ bool ice_is_fw_auto_drop_supported(struct ice_hw *hw)
>  		return true;
>  	return false;
>  }
> +
> +enum ice_cgd_per_port
> +ice_get_port_max_cgd(struct ice_hw *hw)
> +{
> +#define ICE_8_PORTS_LINK_TOPO	0x2
> +	u32 link_topo = LE32_TO_CPU(rd32(hw, GLGEN_MAC_LINK_TOPO)) &
> +		GLGEN_MAC_LINK_TOPO_LINK_TOPO_M;
> +
> +	return (link_topo == ICE_8_PORTS_LINK_TOPO) ? ICE_4_CGD_PER_PORT : ICE_8_CGD_PER_PORT;
> +}

The term "cgd" is not very clear (at least to me) on reading this. I think
a comment at the start of the function to say what it does would be
helpful, e.g. "/* get the number of congestion domains (cgds) for a port */

> +
> +u8
> +ice_get_tc_by_up(struct ice_hw *hw, u8 up)
> +{
> +	struct ice_port_info *port_info = hw->port_info;
> +	struct ice_qos_cfg *qos_cfg = &port_info->qos_cfg;
> +	struct ice_dcbx_cfg *local_dcb_conf = &qos_cfg->local_dcbx_cfg;
> +
> +	up &= (ICE_MAX_TRAFFIC_CLASS - 1);
> +
> +	return local_dcb_conf->etscfg.prio_table[up];
> +}

Rather than "up" (which I assume is "user priority"), I think
"tc_by_priority" would be a better title. Again, a one-line comment at top
of the function can clarify that it's the user-priority field being
referred to.

> +
> +int
> +ice_get_cgd_idx(struct ice_hw *hw, u8 tc)
> +{
> +	return hw->port_info->lport * ice_get_port_max_cgd(hw) + tc;
> +}
Add comment here too - e.g. /* get congestion domain for traffic class */

> diff --git a/drivers/net/intel/ice/base/ice_common.h b/drivers/net/intel/ice/base/ice_common.h
> index f7e7ff5aaf..2d4f4871e6 100644
> --- a/drivers/net/intel/ice/base/ice_common.h
> +++ b/drivers/net/intel/ice/base/ice_common.h
> @@ -25,6 +25,11 @@ enum ice_fw_modes {
>  	ICE_FW_MODE_ROLLBACK
>  };
>  
> +enum ice_cgd_per_port {
> +	ICE_4_CGD_PER_PORT = 4,
> +	ICE_8_CGD_PER_PORT = 8
> +};
> +
>  int ice_init_fltr_mgmt_struct(struct ice_hw *hw);
>  void ice_cleanup_fltr_mgmt_struct(struct ice_hw *hw);
>  void ice_set_umac_shared(struct ice_hw *hw);
> @@ -335,4 +340,7 @@ ice_aq_write_i2c(struct ice_hw *hw, struct ice_aqc_link_topo_addr topo_addr,
>  bool ice_fw_supports_report_dflt_cfg(struct ice_hw *hw);
>  /* AQ API version for FW auto drop reports */
>  bool ice_is_fw_auto_drop_supported(struct ice_hw *hw);
> +enum ice_cgd_per_port ice_get_port_max_cgd(struct ice_hw *hw);
> +u8 ice_get_tc_by_up(struct ice_hw *hw, u8 up);
> +int ice_get_cgd_idx(struct ice_hw *hw, u8 tc);
>  #endif /* _ICE_COMMON_H_ */
> -- 
> 2.43.0
> 

  reply	other threads:[~2025-08-11 14:02 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-08-07 12:22 [PATCH 0/6] Enable DCB/PFC support for ICE PMD Vladimir Medvedkin
2025-08-07 12:22 ` [PATCH 1/6] net/ice/base: add utility functions Vladimir Medvedkin
2025-08-07 12:22 ` [PATCH 2/6] net/ice/base: make set MAC config TC aware Vladimir Medvedkin
2025-08-07 12:22 ` [PATCH 3/6] net/ice/base: add supports for assymetric PFC Vladimir Medvedkin
2025-08-07 12:22 ` [PATCH 4/6] net/ice: enable DCB support Vladimir Medvedkin
2025-08-07 12:22 ` [PATCH 5/6] net/ice: enable PFC support Vladimir Medvedkin
2025-08-07 12:22 ` [PATCH 6/6] net/ice: add PFC statistics Vladimir Medvedkin
2025-08-11 13:42 ` [PATCH v2 0/6] Enable DCB/PFC support for ICE PMD Vladimir Medvedkin
2025-08-11 13:42   ` [PATCH v2 1/6] net/ice/base: add utility functions Vladimir Medvedkin
2025-08-11 14:02     ` Bruce Richardson [this message]
2025-08-11 13:42   ` [PATCH v2 2/6] net/ice/base: make set MAC config TC aware Vladimir Medvedkin
2025-08-11 13:42   ` [PATCH v2 3/6] net/ice/base: add support for asymmetric PFC Vladimir Medvedkin
2025-08-11 13:42   ` [PATCH v2 4/6] net/ice: enable DCB support Vladimir Medvedkin
2025-08-11 16:09     ` Bruce Richardson
2025-08-11 13:43   ` [PATCH v2 5/6] net/ice: enable PFC support Vladimir Medvedkin
2025-08-11 13:43   ` [PATCH v2 6/6] net/ice: add PFC statistics Vladimir Medvedkin
2025-08-12 17:32   ` [PATCH v3 0/6] Enable DCB/PFC support for ICE PMD Vladimir Medvedkin
2025-08-12 17:32     ` [PATCH v3 1/6] net/ice/base: add utility functions Vladimir Medvedkin
2025-08-12 17:32     ` [PATCH v3 2/6] net/ice/base: make set MAC config TC aware Vladimir Medvedkin
2025-08-12 17:32     ` [PATCH v3 3/6] net/ice/base: add support for asymmetric PFC Vladimir Medvedkin
2025-08-12 17:32     ` [PATCH v3 4/6] net/ice: enable DCB support Vladimir Medvedkin
2025-08-12 17:32     ` [PATCH v3 5/6] net/ice: enable PFC support Vladimir Medvedkin
2025-08-12 17:32     ` [PATCH v3 6/6] net/ice: add PFC statistics Vladimir Medvedkin

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=aJn33kGcl2dfTMDe@bricha3-mobl1.ger.corp.intel.com \
    --to=bruce.richardson@intel.com \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=vladimir.medvedkin@intel.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).