mirror of
https://git.openwrt.org/openwrt/openwrt.git
synced 2026-01-28 03:37:17 +01:00
kernel: net: phy: c45: check validity of 10GbE LPA
Only use link-partner advertisement bits for 10GbE modes if they are actually valid. Check LOCALOK and REMOTEOK bits and clear 10GbE modes unless both of them are set. Signed-off-by: Daniel Golle <daniel@makrotopia.org>
This commit is contained in:
parent
dfce21df96
commit
96ff31b94a
1 changed files with 29 additions and 0 deletions
|
|
@ -0,0 +1,29 @@
|
|||
From 7d719484930bc10c8472c0d43b94b68087541b24 Mon Sep 17 00:00:00 2001
|
||||
From: Daniel Golle <daniel@makrotopia.org>
|
||||
Date: Sat, 22 Apr 2023 01:25:39 +0100
|
||||
Subject: [PATCH] net: phy: c45: check validity of 10GbE link-partner
|
||||
advertisement
|
||||
|
||||
Only use link-partner advertisement bits for 10GbE modes if they are
|
||||
actually valid. Check LOCALOK and REMOTEOK bits and clear 10GbE modes
|
||||
unless both of them are set.
|
||||
|
||||
Signed-off-by: Daniel Golle <daniel@makrotopia.org>
|
||||
--- a/include/linux/mdio.h
|
||||
+++ b/include/linux/mdio.h
|
||||
@@ -323,8 +323,14 @@ static inline u32 linkmode_adv_to_mii_10
|
||||
* to linkmode advertisement settings. Other bits in advertising aren't changed.
|
||||
*/
|
||||
static inline void mii_10gbt_stat_mod_linkmode_lpa_t(unsigned long *advertising,
|
||||
- u32 lpa)
|
||||
+ u32 lpa_in)
|
||||
{
|
||||
+ u32 lpa = lpa_in;
|
||||
+
|
||||
+ if (!(lpa & MDIO_AN_10GBT_STAT_REMOK) ||
|
||||
+ !(lpa & MDIO_AN_10GBT_STAT_LOCOK))
|
||||
+ lpa = 0;
|
||||
+
|
||||
linkmode_mod_bit(ETHTOOL_LINK_MODE_2500baseT_Full_BIT,
|
||||
advertising, lpa & MDIO_AN_10GBT_STAT_LP2_5G);
|
||||
linkmode_mod_bit(ETHTOOL_LINK_MODE_5000baseT_Full_BIT,
|
||||
Loading…
Add table
Reference in a new issue