Skip to content

Commit 4d94566

Browse files
tlendackydavem330
authored andcommitted
amd-xgbe: Add pre/post auto-negotiation phy hooks
Add hooks to the driver auto-negotiation (AN) flow to allow the different phy implementations to perform any steps necessary to improve AN. Signed-off-by: Tom Lendacky <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent a49e2f5 commit 4d94566

File tree

2 files changed

+19
-2
lines changed

2 files changed

+19
-2
lines changed

drivers/net/ethernet/amd/xgbe/xgbe-mdio.c

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,9 @@ static void xgbe_an73_disable(struct xgbe_prv_data *pdata)
437437

438438
static void xgbe_an_restart(struct xgbe_prv_data *pdata)
439439
{
440+
if (pdata->phy_if.phy_impl.an_pre)
441+
pdata->phy_if.phy_impl.an_pre(pdata);
442+
440443
switch (pdata->an_mode) {
441444
case XGBE_AN_MODE_CL73:
442445
case XGBE_AN_MODE_CL73_REDRV:
@@ -453,6 +456,9 @@ static void xgbe_an_restart(struct xgbe_prv_data *pdata)
453456

454457
static void xgbe_an_disable(struct xgbe_prv_data *pdata)
455458
{
459+
if (pdata->phy_if.phy_impl.an_post)
460+
pdata->phy_if.phy_impl.an_post(pdata);
461+
456462
switch (pdata->an_mode) {
457463
case XGBE_AN_MODE_CL73:
458464
case XGBE_AN_MODE_CL73_REDRV:
@@ -637,11 +643,11 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata)
637643
return XGBE_AN_NO_LINK;
638644
}
639645

640-
xgbe_an73_disable(pdata);
646+
xgbe_an_disable(pdata);
641647

642648
xgbe_switch_mode(pdata);
643649

644-
xgbe_an73_restart(pdata);
650+
xgbe_an_restart(pdata);
645651

646652
return XGBE_AN_INCOMPAT_LINK;
647653
}
@@ -820,6 +826,9 @@ static void xgbe_an37_state_machine(struct xgbe_prv_data *pdata)
820826
pdata->an_result = pdata->an_state;
821827
pdata->an_state = XGBE_AN_READY;
822828

829+
if (pdata->phy_if.phy_impl.an_post)
830+
pdata->phy_if.phy_impl.an_post(pdata);
831+
823832
netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n",
824833
xgbe_state_as_string(pdata->an_result));
825834
}
@@ -903,6 +912,9 @@ static void xgbe_an73_state_machine(struct xgbe_prv_data *pdata)
903912
pdata->kx_state = XGBE_RX_BPA;
904913
pdata->an_start = 0;
905914

915+
if (pdata->phy_if.phy_impl.an_post)
916+
pdata->phy_if.phy_impl.an_post(pdata);
917+
906918
netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n",
907919
xgbe_state_as_string(pdata->an_result));
908920
}

drivers/net/ethernet/amd/xgbe/xgbe.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -833,6 +833,7 @@ struct xgbe_hw_if {
833833
/* This structure represents implementation specific routines for an
834834
* implementation of a PHY. All routines are required unless noted below.
835835
* Optional routines:
836+
* an_pre, an_post
836837
* kr_training_pre, kr_training_post
837838
*/
838839
struct xgbe_phy_impl_if {
@@ -875,6 +876,10 @@ struct xgbe_phy_impl_if {
875876
/* Process results of auto-negotiation */
876877
enum xgbe_mode (*an_outcome)(struct xgbe_prv_data *);
877878

879+
/* Pre/Post auto-negotiation support */
880+
void (*an_pre)(struct xgbe_prv_data *);
881+
void (*an_post)(struct xgbe_prv_data *);
882+
878883
/* Pre/Post KR training enablement support */
879884
void (*kr_training_pre)(struct xgbe_prv_data *);
880885
void (*kr_training_post)(struct xgbe_prv_data *);

0 commit comments

Comments
 (0)