From: Alexander Lobakin <aleksander.lobakin@intel.com>
To: Pawel Chmielewski <pawel.chmielewski@intel.com>
Cc: Andrew Lunn <andrew@lunn.ch>,
aelior@marvell.com, manishc@marvell.com, netdev@vger.kernel.org,
intel-wired-lan@lists.osuosl.org, "Greenwalt,
Paul" <paul.greenwalt@intel.com>
Subject: Re: [Intel-wired-lan] [PATCH iwl-next v2 2/9] ethtool: Add forced speed to supported link modes maps
Date: Fri, 25 Aug 2023 15:19:51 +0200 [thread overview]
Message-ID: <a9fee3a7-8c31-e048-32eb-ed82b8233aee@intel.com> (raw)
In-Reply-To: <ZOZISCYNWEKqBotb@baltimore>
From: Pawel Chmielewski <pawel.chmielewski@intel.com>
Date: Wed, 23 Aug 2023 19:56:24 +0200
> On Sun, Aug 20, 2023 at 12:20:43PM -0700, Greenwalt, Paul wrote:
>>
>>
>> On 8/20/2023 11:54 AM, Andrew Lunn wrote:
>>> On Sat, Aug 19, 2023 at 02:39:41AM -0700, Paul Greenwalt wrote:
>>>> The need to map Ethtool forced speeds to Ethtool supported link modes is
>>>> common among drivers. To support this move the supported link modes maps
>>>> implementation from the qede driver. This is an efficient solution
>>>> introduced in commit 1d4e4ecccb11 ("qede: populate supported link modes
>>>> maps on module init") for qede driver.
>>>>
>>>> ethtool_forced_speed_maps_init() should be called during driver init
>>>> with an array of struct ethtool_forced_speed_map to populate the
>>>> mapping. The macro ETHTOOL_FORCED_SPEED_MAP is a helper to initialized
>>>> the struct ethtool_forced_speed_map.
>>>
>>> Is there any way to reuse this table:
>>>
>>> https://elixir.bootlin.com/linux/latest/source/drivers/net/phy/phy-core.c#L161
>>>
>>> Seems silly to have multiple tables if this one can be made to work.
>>> It is also used a lot more than anything you will add, which has just
>>> two users so far, so problems with it a likely to be noticed faster.
>>>
>>> Andrew
>>
>> Yes, we'll can look into that.
BTW,
drivers/net/ethernet/qlogic/qed/qed_main.c
drivers/net/pcs/pcs-xpcs.c
also have similar stuff and could probably make use of the generic stuff
you're doing as well (qed_main was also done by me).
Not speaking of
drivers/net/phy/phylink.c
We probably should unify all that...
Let me think how we could do that.
Andrew's idea is good. But most high-speed NICs, which have a standalone
management firmware for PHY, don't use phylib/phylink.
So in order to be able to unify all that, they should have ->supported
bitmap somewhere else. Not sure struct net_device is the best place...
If I recall Phylink logics correctly (it's been a while since I last
time was working with my embedded project),
1) in the NIC (MAC) driver, you initialize ->supported with *speeds* and
stuff like duplex, no link modes;
2) Phylink core sets the corresponding link mode bits;
3) phylib core then clears the bits unsupported by the PHY IIRC
The third step in case with those NICs with FW-managed PHYs should be
done manually in the MAC driver somewhere. Like "I am qede and I don't
support mode XX at 50Gbps, but support the rest, so I clear that one bit".
Then the networking core should be able to play this association game
itself. That would remove a good amount of boilerplating.
>
> I think it would be better to leave the maps in the code of respective drivers, as they are too much hardware related.
> Even for a single speed, the sets of supported link modes may vary between the devices.
> _______________________________________________
> Intel-wired-lan mailing list
> Intel-wired-lan@osuosl.org
> https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
Thanks,
Olek
_______________________________________________
Intel-wired-lan mailing list
Intel-wired-lan@osuosl.org
https://lists.osuosl.org/mailman/listinfo/intel-wired-lan
next prev parent reply other threads:[~2023-08-25 13:22 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-08-19 9:39 [Intel-wired-lan] [PATCH iwl-next v2 2/9] ethtool: Add forced speed to supported link modes maps Paul Greenwalt
2023-08-20 14:45 ` Simon Horman
2023-08-20 17:29 ` Greenwalt, Paul
2023-08-20 18:54 ` Andrew Lunn
2023-08-20 19:20 ` Greenwalt, Paul
2023-08-23 17:56 ` Pawel Chmielewski
2023-08-23 18:09 ` Jacob Keller
2023-08-23 20:58 ` Andrew Lunn
2023-08-25 13:19 ` Alexander Lobakin [this message]
2023-08-25 13:47 ` Andrew Lunn
2023-08-25 13:57 ` Alexander Lobakin
2023-08-31 13:08 ` Pawel Chmielewski
2023-09-03 14:00 ` Andrew Lunn
2023-09-04 15:27 ` Pawel Chmielewski
2023-09-14 14:27 ` Pawel Chmielewski
2023-09-15 13:41 ` Alexander Lobakin
2023-09-15 13:58 ` Andrew Lunn
2023-09-15 13:53 ` Andrew Lunn
2023-08-21 13:00 ` Alexander Lobakin
2023-08-24 10:18 ` kernel test robot
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=a9fee3a7-8c31-e048-32eb-ed82b8233aee@intel.com \
--to=aleksander.lobakin@intel.com \
--cc=aelior@marvell.com \
--cc=andrew@lunn.ch \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=manishc@marvell.com \
--cc=netdev@vger.kernel.org \
--cc=paul.greenwalt@intel.com \
--cc=pawel.chmielewski@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