summaryrefslogtreecommitdiffstats
path: root/sys/mips/cavium/octe/ethernet-common.c
diff options
context:
space:
mode:
authorjmallett <jmallett@FreeBSD.org>2010-11-30 07:14:05 +0000
committerjmallett <jmallett@FreeBSD.org>2010-11-30 07:14:05 +0000
commit03e47472e4b5d434e97d43f2366acf7e069ecd8f (patch)
tree4c5344bbf35bae3cc5fca43410d9d8328203696e /sys/mips/cavium/octe/ethernet-common.c
parentedeca9302ca716fcef451ad56b7b3003188e47ba (diff)
downloadFreeBSD-src-03e47472e4b5d434e97d43f2366acf7e069ecd8f.zip
FreeBSD-src-03e47472e4b5d434e97d43f2366acf7e069ecd8f.tar.gz
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.
Diffstat (limited to 'sys/mips/cavium/octe/ethernet-common.c')
-rw-r--r--sys/mips/cavium/octe/ethernet-common.c29
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 3526e80..aa66b8f 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;
OpenPOWER on IntegriCloud