diff mbox series

ethtool.c: Report transceiver correctly

Message ID 1585959695-26523-1-git-send-email-f.fainelli@gmail.com
State Accepted
Delegated to: John Linville
Headers show
Series ethtool.c: Report transceiver correctly | expand

Commit Message

Florian Fainelli April 4, 2020, 12:21 a.m. UTC
After the transition to the extended link settings ioctl API, the
kernel, up until commit 9b3004953503462a4fab31b85e44ae446d48f0bd
("ethtool: drop get_settings and set_settings callbacks") would support
the legacy link settings operation and report the transceiver type.
After this commit, we lost that information although the Linux PHY
library populates it correctly even with get_link_ksettings() method.

Ensure that we report the transceiver type correctly for such cases.

Fixes: 33133abf3b77 ("ethtool.c: add support for ETHTOOL_xLINKSETTINGS ioctls")
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 ethtool.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

John W. Linville May 13, 2020, 7:57 p.m. UTC | #1
On Fri, Apr 03, 2020 at 05:21:35PM -0700, Florian Fainelli wrote:
> After the transition to the extended link settings ioctl API, the
> kernel, up until commit 9b3004953503462a4fab31b85e44ae446d48f0bd
> ("ethtool: drop get_settings and set_settings callbacks") would support
> the legacy link settings operation and report the transceiver type.
> After this commit, we lost that information although the Linux PHY
> library populates it correctly even with get_link_ksettings() method.
> 
> Ensure that we report the transceiver type correctly for such cases.
> 
> Fixes: 33133abf3b77 ("ethtool.c: add support for ETHTOOL_xLINKSETTINGS ioctls")
> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>

Thanks (belatedly) -- queued for next release!

John
diff mbox series

Patch

diff --git a/ethtool.c b/ethtool.c
index 1b4e08b6e60f..21748fc909eb 100644
--- a/ethtool.c
+++ b/ethtool.c
@@ -2497,8 +2497,8 @@  do_ioctl_glinksettings(struct cmd_context *ctx)
 	if (link_usettings == NULL)
 		return NULL;
 
-	/* keep transceiver 0 */
 	memcpy(&link_usettings->base, &ecmd.req, sizeof(link_usettings->base));
+	link_usettings->deprecated.transceiver = ecmd.req.transceiver;
 
 	/* copy link mode bitmaps */
 	u32_offs = 0;