mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-03-02 18:59:54 -05:00
net/mlx5e: Separate extended link modes request from link modes type selection
The function ext_requested() serves two distinct purposes: it checks if extended link modes were requested, and it selects whether to use extended or legacy link modes. This change separates these two purposes. Now, ext_link_mode_requested() is used directly for checking if extended link modes are requested, while the selection of extended modes is handled independently based on the autonegotiation status. By making this distinction, the logic for determining whether to select extended or legacy link modes is clearer. Signed-off-by: Shahar Shitrit <shshitrit@nvidia.com> Reviewed-by: Carolina Jubran <cjubran@nvidia.com> Signed-off-by: Tariq Toukan <tariqt@nvidia.com> Link: https://patch.msgid.link/20250219114112.403808-6-tariqt@nvidia.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
committed by
Jakub Kicinski
parent
9ca3bf013a
commit
9c362aafda
@@ -1344,13 +1344,6 @@ static bool ext_link_mode_requested(const unsigned long *adver)
|
||||
return bitmap_intersects(modes, adver, __ETHTOOL_LINK_MODE_MASK_NBITS);
|
||||
}
|
||||
|
||||
static bool ext_requested(u8 autoneg, const unsigned long *adver, bool ext_supported)
|
||||
{
|
||||
bool ext_link_mode = ext_link_mode_requested(adver);
|
||||
|
||||
return autoneg == AUTONEG_ENABLE ? ext_link_mode : ext_supported;
|
||||
}
|
||||
|
||||
static int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
||||
const struct ethtool_link_ksettings *link_ksettings)
|
||||
{
|
||||
@@ -1360,6 +1353,7 @@ static int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
||||
bool an_changes = false;
|
||||
u8 an_disable_admin;
|
||||
bool ext_supported;
|
||||
bool ext_requested;
|
||||
u8 an_disable_cap;
|
||||
bool an_disable;
|
||||
u32 link_modes;
|
||||
@@ -1376,10 +1370,11 @@ static int mlx5e_ethtool_set_link_ksettings(struct mlx5e_priv *priv,
|
||||
speed = link_ksettings->base.speed;
|
||||
|
||||
ext_supported = mlx5_ptys_ext_supported(mdev);
|
||||
ext = ext_requested(autoneg, adver, ext_supported);
|
||||
if (!ext_supported && ext)
|
||||
ext_requested = ext_link_mode_requested(adver);
|
||||
if (!ext_supported && ext_requested)
|
||||
return -EOPNOTSUPP;
|
||||
|
||||
ext = autoneg == AUTONEG_ENABLE ? ext_requested : ext_supported;
|
||||
ethtool2ptys_adver_func = ext ? mlx5e_ethtool2ptys_ext_adver_link :
|
||||
mlx5e_ethtool2ptys_adver_link;
|
||||
err = mlx5_port_query_eth_proto(mdev, 1, ext, &eproto);
|
||||
|
||||
Reference in New Issue
Block a user