[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <97f3ac0d8b49305390ed799c1965fd665b755e77.camel@redhat.com>
Date: Thu, 05 Oct 2023 15:48:47 +0200
From: Paolo Abeni <pabeni@...hat.com>
To: Pawel Chmielewski <pawel.chmielewski@...el.com>, netdev@...r.kernel.org
Cc: andrew@...n.ch, aelior@...vell.com, manishc@...vell.com,
vladimir.oltean@....com, jdamato@...tly.com, edumazet@...gle.com,
intel-wired-lan@...ts.osuosl.org, Paul Greenwalt
<paul.greenwalt@...el.com>, horms@...nel.org, Przemek Kitszel
<przemyslaw.kitszel@...el.com>, Jacob Keller <jacob.e.keller@...el.com>,
kuba@...nel.org, d-tatianin@...dex-team.ru, davem@...emloft.net
Subject: Re: [Intel-wired-lan] [PATCH net-next v3 2/2] ice: Refactor finding
advertised link speed
On Mon, 2023-10-02 at 16:44 +0200, Pawel Chmielewski wrote:
> Refactor ice_get_link_ksettings to using forced speed to link modes mapping.
>
> Suggested-by : Alexander Lobakin <aleksander.lobakin@...el.com>
> Reviewed-by: Jacob Keller <jacob.e.keller@...el.com>
> Reviewed-by: Przemek Kitszel <przemyslaw.kitszel@...el.com>
> Signed-off-by: Paul Greenwalt <paul.greenwalt@...el.com>
> Signed-off-by: Pawel Chmielewski <pawel.chmielewski@...el.com>
> ---
> drivers/net/ethernet/intel/ice/ice.h | 1 +
> drivers/net/ethernet/intel/ice/ice_ethtool.c | 200 +++++++++++++------
> drivers/net/ethernet/intel/ice/ice_main.c | 2 +
> 3 files changed, 138 insertions(+), 65 deletions(-)
>
> diff --git a/drivers/net/ethernet/intel/ice/ice.h b/drivers/net/ethernet/intel/ice/ice.h
> index fcaa5c3b8ec0..988b177d9388 100644
> --- a/drivers/net/ethernet/intel/ice/ice.h
> +++ b/drivers/net/ethernet/intel/ice/ice.h
> @@ -960,6 +960,7 @@ int ice_stop(struct net_device *netdev);
> void ice_service_task_schedule(struct ice_pf *pf);
> int ice_load(struct ice_pf *pf);
> void ice_unload(struct ice_pf *pf);
> +void ice_adv_lnk_speed_maps_init(void);
>
> /**
> * ice_set_rdma_cap - enable RDMA support
> diff --git a/drivers/net/ethernet/intel/ice/ice_ethtool.c b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> index d3cb08e66dcb..b027788c42f6 100644
> --- a/drivers/net/ethernet/intel/ice/ice_ethtool.c
> +++ b/drivers/net/ethernet/intel/ice/ice_ethtool.c
> @@ -345,6 +345,86 @@ static const struct ice_priv_flag ice_gstrings_priv_flags[] = {
>
> #define ICE_PRIV_FLAG_ARRAY_SIZE ARRAY_SIZE(ice_gstrings_priv_flags)
>
> +static const u32 ice_adv_lnk_speed_100[] __initconst = {
> + ETHTOOL_LINK_MODE_100baseT_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_1000[] __initconst = {
> + ETHTOOL_LINK_MODE_1000baseX_Full_BIT,
> + ETHTOOL_LINK_MODE_1000baseT_Full_BIT,
> + ETHTOOL_LINK_MODE_1000baseKX_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_2500[] __initconst = {
> + ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
> + ETHTOOL_LINK_MODE_2500baseX_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_5000[] __initconst = {
> + ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_10000[] __initconst = {
> + ETHTOOL_LINK_MODE_10000baseT_Full_BIT,
> + ETHTOOL_LINK_MODE_10000baseKR_Full_BIT,
> + ETHTOOL_LINK_MODE_10000baseSR_Full_BIT,
> + ETHTOOL_LINK_MODE_10000baseLR_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_25000[] __initconst = {
> + ETHTOOL_LINK_MODE_25000baseCR_Full_BIT,
> + ETHTOOL_LINK_MODE_25000baseSR_Full_BIT,
> + ETHTOOL_LINK_MODE_25000baseKR_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_40000[] __initconst = {
> + ETHTOOL_LINK_MODE_40000baseCR4_Full_BIT,
> + ETHTOOL_LINK_MODE_40000baseSR4_Full_BIT,
> + ETHTOOL_LINK_MODE_40000baseLR4_Full_BIT,
> + ETHTOOL_LINK_MODE_40000baseKR4_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_50000[] __initconst = {
> + ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT,
> + ETHTOOL_LINK_MODE_50000baseKR2_Full_BIT,
> + ETHTOOL_LINK_MODE_50000baseSR2_Full_BIT,
> +};
> +
> +static const u32 ice_adv_lnk_speed_100000[] __initconst = {
> + ETHTOOL_LINK_MODE_100000baseCR4_Full_BIT,
> + ETHTOOL_LINK_MODE_100000baseSR4_Full_BIT,
> + ETHTOOL_LINK_MODE_100000baseLR4_ER4_Full_BIT,
> + ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT,
> + ETHTOOL_LINK_MODE_100000baseCR2_Full_BIT,
> + ETHTOOL_LINK_MODE_100000baseSR2_Full_BIT,
> + ETHTOOL_LINK_MODE_100000baseKR2_Full_BIT,
> +};
> +
> +#define ICE_ADV_LNK_SPEED_MAP(value) \
> +{ \
> + .speed = SPEED_##value, \
> + .cap_arr = ice_adv_lnk_speed_##value, \
> + .arr_size = ARRAY_SIZE(ice_adv_lnk_speed_##value), \
> +}
I think it could make sense move even the above macro definition to the
common APIs (adding a 'prefix' argument).
Cheers,
Paolo
Powered by blists - more mailing lists