Skip to content

Commit e80ed97

Browse files
committed
Merge branch 'net-phylink-fix-pcs-without-autoneg'
Russell King says: ==================== net: phylink: fix PCS without autoneg Eric Woudstra reported that a PCS attached using 2500base-X does not see link when phylink is using in-band mode, but autoneg is disabled, despite there being a valid 2500base-X signal being received. We have these settings: act_link_an_mode = MLO_AN_INBAND pcs_neg_mode = PHYLINK_PCS_NEG_INBAND_DISABLED Eric diagnosed it to phylink_decode_c37_word() setting state->link false because the full-duplex bit isn't set in the non-existent link partner advertisement word (which doesn't exist because in-band autoneg is disabled!) The test in phylink_mii_c22_pcs_decode_state() is supposed to catch this state, but since we converted PCS to use neg_mode, testing the Autoneg in the local advertisement is no longer sufficient - we need to be looking at the neg_mode, which currently isn't provided. We need to provide this via the .pcs_get_state() method, and this will require modifying all PCS implementations to add the extra argument to this method. Patch 1 uses the PCS neg_mode in phylink_mac_pcs_get_state() to correct the now obsolute usage of the Autoneg bit in the advertisement. Patch 2 passes neg_mode into the .pcs_get_state() method, and updates all users. Patch 3 adds neg_mode as an argument to the various clause 22 state decoder functions in phylink, modifying drivers to pass the neg_mode through. Patch 4 makes use of phylink_mii_c22_pcs_decode_state() rather than using the Autoneg bit in the advertising field. Patch 5 may be required for Eric's case - it ensures that we report the correct state for interface types that we support only one set of modes for when autoneg is disabled. ==================== Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
2 parents 9eb8069 + e432ffc commit e80ed97

File tree

22 files changed

+87
-42
lines changed

22 files changed

+87
-42
lines changed

drivers/net/dsa/b53/b53_serdes.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ static void b53_serdes_an_restart(struct phylink_pcs *pcs)
9999
SERDES_MII_BLK, reg);
100100
}
101101

102-
static void b53_serdes_get_state(struct phylink_pcs *pcs,
103-
struct phylink_link_state *state)
102+
static void b53_serdes_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
103+
struct phylink_link_state *state)
104104
{
105105
struct b53_device *dev = pcs_to_b53_pcs(pcs)->dev;
106106
u8 lane = pcs_to_b53_pcs(pcs)->lane;

drivers/net/dsa/mt7530.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2994,7 +2994,7 @@ static int mt753x_pcs_validate(struct phylink_pcs *pcs,
29942994
return 0;
29952995
}
29962996

2997-
static void mt7530_pcs_get_state(struct phylink_pcs *pcs,
2997+
static void mt7530_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
29982998
struct phylink_link_state *state)
29992999
{
30003000
struct mt7530_priv *priv = pcs_to_mt753x_pcs(pcs)->priv;

drivers/net/dsa/mv88e6xxx/pcs-6185.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ static irqreturn_t mv88e6185_pcs_handle_irq(int irq, void *dev_id)
5555
}
5656

5757
static void mv88e6185_pcs_get_state(struct phylink_pcs *pcs,
58+
unsigned int neg_mode,
5859
struct phylink_link_state *state)
5960
{
6061
struct mv88e6185_pcs *mpcs = pcs_to_mv88e6185_pcs(pcs);

drivers/net/dsa/mv88e6xxx/pcs-6352.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ static void marvell_c22_pcs_disable(struct phylink_pcs *pcs)
158158
}
159159

160160
static void marvell_c22_pcs_get_state(struct phylink_pcs *pcs,
161+
unsigned int neg_mode,
161162
struct phylink_link_state *state)
162163
{
163164
struct marvell_c22_pcs *mpcs = pcs_to_marvell_c22_pcs(pcs);

drivers/net/dsa/mv88e6xxx/pcs-639x.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,7 @@ static int mv88e639x_sgmii_pcs_post_config(struct phylink_pcs *pcs,
257257
}
258258

259259
static void mv88e639x_sgmii_pcs_get_state(struct phylink_pcs *pcs,
260+
unsigned int neg_mode,
260261
struct phylink_link_state *state)
261262
{
262263
struct mv88e639x_pcs *mpcs = sgmii_pcs_to_mv88e639x_pcs(pcs);
@@ -395,6 +396,7 @@ static void mv88e639x_xg_pcs_disable(struct mv88e639x_pcs *mpcs)
395396
}
396397

397398
static void mv88e639x_xg_pcs_get_state(struct phylink_pcs *pcs,
399+
unsigned int neg_mode,
398400
struct phylink_link_state *state)
399401
{
400402
struct mv88e639x_pcs *mpcs = xg_pcs_to_mv88e639x_pcs(pcs);
@@ -889,14 +891,15 @@ static int mv88e6393x_xg_pcs_post_config(struct phylink_pcs *pcs,
889891
}
890892

891893
static void mv88e6393x_xg_pcs_get_state(struct phylink_pcs *pcs,
894+
unsigned int neg_mode,
892895
struct phylink_link_state *state)
893896
{
894897
struct mv88e639x_pcs *mpcs = xg_pcs_to_mv88e639x_pcs(pcs);
895898
u16 status, lp_status;
896899
int err;
897900

898901
if (state->interface != PHY_INTERFACE_MODE_USXGMII)
899-
return mv88e639x_xg_pcs_get_state(pcs, state);
902+
return mv88e639x_xg_pcs_get_state(pcs, neg_mode, state);
900903

901904
state->link = false;
902905

drivers/net/dsa/qca/qca8k-8xxx.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1491,7 +1491,7 @@ static struct qca8k_pcs *pcs_to_qca8k_pcs(struct phylink_pcs *pcs)
14911491
return container_of(pcs, struct qca8k_pcs, pcs);
14921492
}
14931493

1494-
static void qca8k_pcs_get_state(struct phylink_pcs *pcs,
1494+
static void qca8k_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
14951495
struct phylink_link_state *state)
14961496
{
14971497
struct qca8k_priv *priv = pcs_to_qca8k_pcs(pcs)->priv;

drivers/net/ethernet/cadence/macb_main.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -568,6 +568,7 @@ static void macb_usx_pcs_link_up(struct phylink_pcs *pcs, unsigned int neg_mode,
568568
}
569569

570570
static void macb_usx_pcs_get_state(struct phylink_pcs *pcs,
571+
unsigned int neg_mode,
571572
struct phylink_link_state *state)
572573
{
573574
struct macb *bp = container_of(pcs, struct macb, phylink_usx_pcs);
@@ -598,7 +599,7 @@ static int macb_usx_pcs_config(struct phylink_pcs *pcs,
598599
return 0;
599600
}
600601

601-
static void macb_pcs_get_state(struct phylink_pcs *pcs,
602+
static void macb_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
602603
struct phylink_link_state *state)
603604
{
604605
state->link = 0;

drivers/net/ethernet/freescale/fman/fman_dtsec.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -755,12 +755,12 @@ static struct fman_mac *pcs_to_dtsec(struct phylink_pcs *pcs)
755755
return container_of(pcs, struct fman_mac, pcs);
756756
}
757757

758-
static void dtsec_pcs_get_state(struct phylink_pcs *pcs,
758+
static void dtsec_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
759759
struct phylink_link_state *state)
760760
{
761761
struct fman_mac *dtsec = pcs_to_dtsec(pcs);
762762

763-
phylink_mii_c22_pcs_get_state(dtsec->tbidev, state);
763+
phylink_mii_c22_pcs_get_state(dtsec->tbidev, neg_mode, state);
764764
}
765765

766766
static int dtsec_pcs_config(struct phylink_pcs *pcs, unsigned int neg_mode,

drivers/net/ethernet/marvell/mvneta.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3983,7 +3983,7 @@ static unsigned int mvneta_pcs_inband_caps(struct phylink_pcs *pcs,
39833983
return LINK_INBAND_DISABLE;
39843984
}
39853985

3986-
static void mvneta_pcs_get_state(struct phylink_pcs *pcs,
3986+
static void mvneta_pcs_get_state(struct phylink_pcs *pcs, unsigned int neg_mode,
39873987
struct phylink_link_state *state)
39883988
{
39893989
struct mvneta_port *pp = mvneta_pcs_to_port(pcs);

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6188,6 +6188,7 @@ static struct mvpp2_port *mvpp2_pcs_gmac_to_port(struct phylink_pcs *pcs)
61886188
}
61896189

61906190
static void mvpp2_xlg_pcs_get_state(struct phylink_pcs *pcs,
6191+
unsigned int neg_mode,
61916192
struct phylink_link_state *state)
61926193
{
61936194
struct mvpp2_port *port = mvpp2_pcs_xlg_to_port(pcs);
@@ -6247,6 +6248,7 @@ static unsigned int mvpp2_gmac_pcs_inband_caps(struct phylink_pcs *pcs,
62476248
}
62486249

62496250
static void mvpp2_gmac_pcs_get_state(struct phylink_pcs *pcs,
6251+
unsigned int neg_mode,
62506252
struct phylink_link_state *state)
62516253
{
62526254
struct mvpp2_port *port = mvpp2_pcs_gmac_to_port(pcs);

0 commit comments

Comments
 (0)