Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 96f4d430 authored by Tom Lendacky's avatar Tom Lendacky Committed by David S. Miller
Browse files

amd-xgbe: Improve KR auto-negotiation and training



Update xgbe-phy-v2.c to make use of the auto-negotiation (AN) phy hooks
to improve the ability to successfully complete Clause 73 AN when running
at 10gbps.  Hardware can sometimes have issues with CDR lock when the
AN DME page exchange is being performed.

The AN and KR training hooks are used as follows:
- The pre AN hook is used to disable CDR tracking in the PHY so that the
  DME page exchange can be successfully and consistently completed.
- The post KR training hook is used to re-enable the CDR tracking so that
  KR training can successfully complete.
- The post AN hook is used to check for an unsuccessful AN which will
  increase a CDR tracking enablement delay (up to a maximum value).

Add two debugfs entries to allow control over use of the CDR tracking
workaround.  The debugfs entries allow the CDR tracking workaround to
be disabled and determine whether to re-enable CDR tracking before or
after link training has been initiated.

Also, with these changes the receiver reset cycle that is performed during
the link status check can be performed less often.

Signed-off-by: default avatarTom Lendacky <thomas.lendacky@amd.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 4d945663
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -1321,6 +1321,10 @@
#define MDIO_VEND2_AN_STAT		0x8002
#endif

#ifndef MDIO_VEND2_PMA_CDR_CONTROL
#define MDIO_VEND2_PMA_CDR_CONTROL	0x8056
#endif

#ifndef MDIO_CTRL1_SPEED1G
#define MDIO_CTRL1_SPEED1G		(MDIO_CTRL1_SPEED10G & ~BMCR_SPEED100)
#endif
@@ -1369,6 +1373,10 @@
#define XGBE_AN_CL37_TX_CONFIG_MASK	0x08
#define XGBE_AN_CL37_MII_CTRL_8BIT	0x0100

#define XGBE_PMA_CDR_TRACK_EN_MASK	0x01
#define XGBE_PMA_CDR_TRACK_EN_OFF	0x00
#define XGBE_PMA_CDR_TRACK_EN_ON	0x01

/* Bit setting and getting macros
 *  The get macro will extract the current bit field value from within
 *  the variable
+16 −0
Original line number Diff line number Diff line
@@ -519,6 +519,22 @@ void xgbe_debugfs_init(struct xgbe_prv_data *pdata)
				   "debugfs_create_file failed\n");
	}

	if (pdata->vdata->an_cdr_workaround) {
		pfile = debugfs_create_bool("an_cdr_workaround", 0600,
					    pdata->xgbe_debugfs,
					    &pdata->debugfs_an_cdr_workaround);
		if (!pfile)
			netdev_err(pdata->netdev,
				   "debugfs_create_bool failed\n");

		pfile = debugfs_create_bool("an_cdr_track_early", 0600,
					    pdata->xgbe_debugfs,
					    &pdata->debugfs_an_cdr_track_early);
		if (!pfile)
			netdev_err(pdata->netdev,
				   "debugfs_create_bool failed\n");
	}

	kfree(buf);
}

+1 −0
Original line number Diff line number Diff line
@@ -349,6 +349,7 @@ int xgbe_config_netdev(struct xgbe_prv_data *pdata)
	XGMAC_SET_BITS(pdata->rss_options, MAC_RSSCR, UDP4TE, 1);

	/* Call MDIO/PHY initialization routine */
	pdata->debugfs_an_cdr_workaround = pdata->vdata->an_cdr_workaround;
	ret = pdata->phy_if.phy_init(pdata);
	if (ret)
		return ret;
+5 −3
Original line number Diff line number Diff line
@@ -432,6 +432,8 @@ static void xgbe_an73_disable(struct xgbe_prv_data *pdata)
	xgbe_an73_set(pdata, false, false);
	xgbe_an73_disable_interrupts(pdata);

	pdata->an_start = 0;

	netif_dbg(pdata, link, pdata->netdev, "CL73 AN disabled\n");
}

@@ -511,11 +513,11 @@ static enum xgbe_an xgbe_an73_tx_training(struct xgbe_prv_data *pdata,
		XMDIO_WRITE(pdata, MDIO_MMD_PMAPMD, MDIO_PMA_10GBR_PMD_CTRL,
			    reg);

		if (pdata->phy_if.phy_impl.kr_training_post)
			pdata->phy_if.phy_impl.kr_training_post(pdata);

		netif_dbg(pdata, link, pdata->netdev,
			  "KR training initiated\n");

		if (pdata->phy_if.phy_impl.kr_training_post)
			pdata->phy_if.phy_impl.kr_training_post(pdata);
	}

	return XGBE_AN_PAGE_RECEIVED;
+2 −0
Original line number Diff line number Diff line
@@ -456,6 +456,7 @@ static const struct xgbe_version_data xgbe_v2a = {
	.irq_reissue_support		= 1,
	.tx_desc_prefetch		= 5,
	.rx_desc_prefetch		= 5,
	.an_cdr_workaround		= 1,
};

static const struct xgbe_version_data xgbe_v2b = {
@@ -470,6 +471,7 @@ static const struct xgbe_version_data xgbe_v2b = {
	.irq_reissue_support		= 1,
	.tx_desc_prefetch		= 5,
	.rx_desc_prefetch		= 5,
	.an_cdr_workaround		= 1,
};

static const struct pci_device_id xgbe_pci_table[] = {
Loading