RE: [PATCH v4 net-next 04/15] net: enetc: add link speed message support to PF driver
From: Claudiu Manoil <claudiu.manoil@nxp.com>
Date: 2026-09-11 20:17:00
Also in:
imx, lkml
NXP Confidential
-----Original Message----- From: Wei Fang (OSS) <redacted> Sent: Wednesday, September 9, 2026 1:07 PM
[...]
Subject: [PATCH v4 net-next 04/15] net: enetc: add link speed message support to PF driver From: Wei Fang <wei.fang@nxp.com> When a VF is driven by DPDK, its user space application needs accurate link speed information to make correct forwarding and configuration decisions. Add link speed message support so the PF replies with the current link speed when it receives a get-link-speed message from a VF. Use a new message class 0x81 (ENETC_MSG_CLASS_ID_LINK_SPEED). The PSI-to-VSI message is 16 bits: the high 8 bits are the class ID and the low 8 bits are the speed code, so up to 255 speed values are supported (ENETC_MSG_SPEED_MAX = 0xff). Instead of enumerating every speed above 5Gbps, use a formula so future high speeds need no enum or switch changes: speed_code = (link_speed - 5000) / 1000 + ENETC_MSG_SPEED_5G The speed is read via phylink_ethtool_ksettings_get() rather than the speed passed to the mac_link_up() callback. When the MAC has a PCS layer, mac_link_up() reports the PCS link speed, which may differ from the external PHY link speed; phylink_ethtool_ksettings_get() returns the actual external link speed. Unlike the link status message (class 0x80), the get-link-speed message is only permitted for trusted VFs. Reading the speed requires the PF to take rtnl_lock(), so an untrusted VF spamming this query could cause rtnl_lock contention and starve routine network configuration on the host. An untrusted VF therefore receives a permission-deny response; a VF can be marked trusted via 'ip link set <pf> vf N trust on'. Note that link speed change notification is not supported yet. Signed-off-by: Wei Fang <wei.fang@nxp.com>
Reviewed-by: Claudiu Manoil <claudiu.manoil@nxp.com>