Skip to content

Commit 6cd968f

Browse files
committed
Merge branch 'amd-xgbe-fixes'
aTom Lendacky says: ==================== amd-xgbe: AMD XGBE driver fixes 2018-04-23 This patch series addresses some issues in the AMD XGBE driver. The following fixes are included in this driver update series: - Improve KR auto-negotiation and training (2 patches) - Add pre and post auto-negotiation hooks - Use the pre and post auto-negotiation hooks to disable CDR tracking during auto-negotiation page exchange in KR mode - Check for SFP tranceiver signal support and only use the signal if the SFP indicates that it is supported This patch series is based on net. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents a49e2f5 + 117df65 commit 6cd968f

File tree

7 files changed

+233
-23
lines changed

7 files changed

+233
-23
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1321,6 +1321,10 @@
13211321
#define MDIO_VEND2_AN_STAT 0x8002
13221322
#endif
13231323

1324+
#ifndef MDIO_VEND2_PMA_CDR_CONTROL
1325+
#define MDIO_VEND2_PMA_CDR_CONTROL 0x8056
1326+
#endif
1327+
13241328
#ifndef MDIO_CTRL1_SPEED1G
13251329
#define MDIO_CTRL1_SPEED1G (MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
13261330
#endif
@@ -1369,6 +1373,10 @@
13691373
#define XGBE_AN_CL37_TX_CONFIG_MASK 0x08
13701374
#define XGBE_AN_CL37_MII_CTRL_8BIT 0x0100
13711375

1376+
#define XGBE_PMA_CDR_TRACK_EN_MASK 0x01
1377+
#define XGBE_PMA_CDR_TRACK_EN_OFF 0x00
1378+
#define XGBE_PMA_CDR_TRACK_EN_ON 0x01
1379+
13721380
/* Bit setting and getting macros
13731381
* The get macro will extract the current bit field value from within
13741382
* the variable

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -519,6 +519,22 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
519519
"debugfs_create_file failed\n");
520520
}
521521

522+
if (pdata->vdata->an_cdr_workaround) {
523+
pfile = debugfs_create_bool("an_cdr_workaround", 0600,
524+
pdata->xgbe_debugfs,
525+
&pdata->debugfs_an_cdr_workaround);
526+
if (!pfile)
527+
netdev_err(pdata->netdev,
528+
"debugfs_create_bool failed\n");
529+
530+
pfile = debugfs_create_bool("an_cdr_track_early", 0600,
531+
pdata->xgbe_debugfs,
532+
&pdata->debugfs_an_cdr_track_early);
533+
if (!pfile)
534+
netdev_err(pdata->netdev,
535+
"debugfs_create_bool failed\n");
536+
}
537+
522538
kfree(buf);
523539
}
524540

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,7 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)
349349
XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);
350350

351351
/* Call MDIO/PHY initialization routine */
352+
pdata->debugfs_an_cdr_workaround = pdata->vdata->an_cdr_workaround;
352353
ret = pdata->phy_if.phy_init(pdata);
353354
if (ret)
354355
return ret;

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

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,11 +432,16 @@ static void xgbe_an73_disable(struct xgbe_prv_data *pdata)
432432
xgbe_an73_set(pdata, false, false);
433433
xgbe_an73_disable_interrupts(pdata);
434434

435+
pdata->an_start = 0;
436+
435437
netif_dbg(pdata, link, pdata->netdev, "CL73 AN disabled\n");
436438
}
437439

438440
static void xgbe_an_restart(struct xgbe_prv_data *pdata)
439441
{
442+
if (pdata->phy_if.phy_impl.an_pre)
443+
pdata->phy_if.phy_impl.an_pre(pdata);
444+
440445
switch (pdata->an_mode) {
441446
case XGBE_AN_MODE_CL73:
442447
case XGBE_AN_MODE_CL73_REDRV:
@@ -453,6 +458,9 @@ static void xgbe_an_restart(struct xgbe_prv_data *pdata)
453458

454459
static void xgbe_an_disable(struct xgbe_prv_data *pdata)
455460
{
461+
if (pdata->phy_if.phy_impl.an_post)
462+
pdata->phy_if.phy_impl.an_post(pdata);
463+
456464
switch (pdata->an_mode) {
457465
case XGBE_AN_MODE_CL73:
458466
case XGBE_AN_MODE_CL73_REDRV:
@@ -505,11 +513,11 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata,
505513
XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL,
506514
reg);
507515

508-
if (pdata->phy_if.phy_impl.kr_training_post)
509-
pdata->phy_if.phy_impl.kr_training_post(pdata);
510-
511516
netif_dbg(pdata, link, pdata->netdev,
512517
"KR training initiated\n");
518+
519+
if (pdata->phy_if.phy_impl.kr_training_post)
520+
pdata->phy_if.phy_impl.kr_training_post(pdata);
513521
}
514522

515523
return XGBE_AN_PAGE_RECEIVED;
@@ -637,11 +645,11 @@ static enum xgbe_an xgbe_an73_incompat_link(struct xgbe_prv_data *pdata)
637645
return XGBE_AN_NO_LINK;
638646
}
639647

640-
xgbe_an73_disable(pdata);
648+
xgbe_an_disable(pdata);
641649

642650
xgbe_switch_mode(pdata);
643651

644-
xgbe_an73_restart(pdata);
652+
xgbe_an_restart(pdata);
645653

646654
return XGBE_AN_INCOMPAT_LINK;
647655
}
@@ -820,6 +828,9 @@ static void xgbe_an37_state_machine(struct xgbe_prv_data *pdata)
820828
pdata->an_result = pdata->an_state;
821829
pdata->an_state = XGBE_AN_READY;
822830

831+
if (pdata->phy_if.phy_impl.an_post)
832+
pdata->phy_if.phy_impl.an_post(pdata);
833+
823834
netif_dbg(pdata, link, pdata->netdev, "CL37 AN result: %s\n",
824835
xgbe_state_as_string(pdata->an_result));
825836
}
@@ -903,6 +914,9 @@ static void xgbe_an73_state_machine(struct xgbe_prv_data *pdata)
903914
pdata->kx_state = XGBE_RX_BPA;
904915
pdata->an_start = 0;
905916

917+
if (pdata->phy_if.phy_impl.an_post)
918+
pdata->phy_if.phy_impl.an_post(pdata);
919+
906920
netif_dbg(pdata, link, pdata->netdev, "CL73 AN result: %s\n",
907921
xgbe_state_as_string(pdata->an_result));
908922
}

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -456,6 +456,7 @@ static const struct xgbe_version_data xgbe_v2a = {
456456
.irq_reissue_support = 1,
457457
.tx_desc_prefetch = 5,
458458
.rx_desc_prefetch = 5,
459+
.an_cdr_workaround = 1,
459460
};
460461

461462
static const struct xgbe_version_data xgbe_v2b = {
@@ -470,6 +471,7 @@ static const struct xgbe_version_data xgbe_v2b = {
470471
.irq_reissue_support = 1,
471472
.tx_desc_prefetch = 5,
472473
.rx_desc_prefetch = 5,
474+
.an_cdr_workaround = 1,
473475
};
474476

475477
static const struct pci_device_id xgbe_pci_table[] = {

0 commit comments

Comments
 (0)