diff options
author | Juli Mallett <jmallett@FreeBSD.org> | 2010-11-30 07:14:05 +0000 |
---|---|---|
committer | Juli Mallett <jmallett@FreeBSD.org> | 2010-11-30 07:14:05 +0000 |
commit | 074a0a8d575feeaee0221f19c55b045daa560dca (patch) | |
tree | 4c5344bbf35bae3cc5fca43410d9d8328203696e /sys/mips/cavium/octe/ethernet-common.c | |
parent | 5cb51b647c92cee4e95a69b51347fc1d42873d69 (diff) |
Run all poll requests through a single function that can either do the generic
link state polling or media-specific ones, while avoidiing changing link state
on interfaces that use miibus; this substantially speeds up link time on
interface (re)initialization.
Notes
Notes:
svn path=/head/; revision=216071
Diffstat (limited to 'sys/mips/cavium/octe/ethernet-common.c')
-rw-r--r-- | sys/mips/cavium/octe/ethernet-common.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/sys/mips/cavium/octe/ethernet-common.c b/sys/mips/cavium/octe/ethernet-common.c index 3526e80a1972..aa66b8fff074 100644 --- a/sys/mips/cavium/octe/ethernet-common.c +++ b/sys/mips/cavium/octe/ethernet-common.c @@ -188,7 +188,10 @@ int cvm_oct_common_open(struct ifnet *ifp) gmx_cfg.s.en = 1; cvmx_write_csr(CVMX_GMXX_PRTX_CFG(index, interface), gmx_cfg.u64); - if (!octeon_is_simulation()) { + /* + * Set the link state unless we are using MII. + */ + if (!octeon_is_simulation() && priv->miibus == NULL) { link_info = cvmx_helper_link_get(priv->port); if (!link_info.s.link_up) if_link_state_change(ifp, LINK_STATE_DOWN); @@ -224,6 +227,30 @@ void cvm_oct_common_poll(struct ifnet *ifp) cvm_oct_private_t *priv = (cvm_oct_private_t *)ifp->if_softc; cvmx_helper_link_info_t link_info; + /* + * If this is a simulation, do nothing. + */ + if (octeon_is_simulation()) + return; + + /* + * If there is a device-specific poll method, use it. + */ + if (priv->poll != NULL) { + priv->poll(ifp); + return; + } + + /* + * If an MII bus is attached, don't use the Simple Executive's link + * state routines. + */ + if (priv->miibus != NULL) + return; + + /* + * Use the Simple Executive's link state routines. + */ link_info = cvmx_helper_link_get(priv->port); if (link_info.u64 == priv->link_info) return; |