Commit Graph

80 Commits

Author SHA1 Message Date
roy
3643d6b4fe Move the detaching and making tentative addresses out if in6_if_up
and into in6_if_link_up.

This fixes a possible panic where link is up but not the interface.
Note that a better solution would be to listen to the routing socket
in the kernel, but I don't know how to do that.

Reachable Router tests for IFF_UP as well.
2013-06-20 13:56:29 +00:00
msaitoh
d13f03981b The bit location of link ability is different between 1000Base-X and others
(See annex 28B.2 and 28D). The old mii.h defined ANAR_X_PAUSE_* macros. Those
macros were named for 1000Base-X, but the bit definitions were not for
1000Base-X but for others (e.g. 1000BaseT). So there was bug in auto
negotiation for 1000Base-X, but there was no bug for other media. Define new
macro named ANAR_PAUSE_* and ANLPAR_PAUSE_* for other than 1000Base-X and fix
the bit definitions of ANAR_X_PAUSE_* and ANLPPAR_X_*. Change some PHY drivers
to use true macro. Same as other *BSDs.
2013-06-16 06:29:08 +00:00
msaitoh
d060f6e507 Fix a bug in last commit that mii_ticks isn't inclemented. 2013-06-09 09:56:17 +00:00
msaitoh
307e621cc0 Update link status quickly. This change is a part of FreeBSD's mii_physubr.c
r158649.
2013-06-09 09:31:32 +00:00
msaitoh
5cbe9dd2fb Fix a bug that the auto negotiation timer isn't cleard as we expected.
To not to forget clearing the timer and to reduce the code duplication,
clear mii_ticks in *mii_phy_auto().
2013-06-06 03:10:48 +00:00
mlelstv
ec54e2b865 use media_table instead of replicating code 2012-10-03 07:08:58 +00:00
matt
0bc3200029 Fix mii_statchg to take a 'struct ifnet *' instead of device_t. This fixes
problem with a common MDIO bus used for multiple interfaces.
Some drivers converted to CFATTACL_DECL_NEW.
2012-07-22 14:32:49 +00:00
buhrow
a7162be315 Fixes PR kern/20700 reported by Darcy Cain
Make 1000baset connections work even when the user specifies media 1000baset
connections with ifconfig(8) rather then only when media auto is specified.

For a further discussion of this fix, see:
http://mail-index.NetBSD.org/current-users/2011/12/07/msg018561.html
2011-12-10 02:46:07 +00:00
pgoyette
f05cff10bd Update the various xxx_verbose modules to conform to the module subsystem's
new locking protocol.
2010-08-21 13:18:35 +00:00
pgoyette
3dcc05c105 Move setting of mii_verbose_loaded flag into the module's init routine.
This ensures that the flag is set even if the module was manually loaded
by the user rather than just auto-loaded.
2010-07-25 14:44:34 +00:00
pgoyette
90f0882b7a Update miiverbose module to use module_autoload() rather than module_load().
Load the module right before each attempt to use its features, and let the
module subsystem handle unloading.
2010-06-06 18:58:22 +00:00
martin
bcf37d6abe Move all miiverbose/module related functions from ukphy.c to mii_physubr.c -
ukphy is not included in all kernels, but mii_physubr.c should be in every
kernel that has a phy.
2010-06-02 19:47:34 +00:00
martin
9e8ef1a77b Before destroying a autonegotiation callout, make sure it is quiet 2010-03-02 08:30:40 +00:00
dyoung
c1b390d493 A pointer typedef entails trading too much flexibility to declare const
and non-const types, and the kernel uses both const and non-const
PMF qualifiers and device suspensors, so change the pmf_qual_t and
device_suspensor_t typedefs from "pointers to const" to non-pointer,
non-const types.
2010-02-24 22:37:54 +00:00
dyoung
cd6e1fbf91 Expand PMF_FN_* macros. 2010-01-08 19:53:10 +00:00
dyoung
1a15725cd0 Simplify mii_phy_activate(). Remark in mii_phy_activate() and
mii_phy_detach() comments that we may need to invalidate the parent's
media setting.  No functional change intended.
2009-11-06 18:41:25 +00:00
cegger
99747a8099 struct device * -> device_t, no functional changes intended. 2009-05-12 14:28:22 +00:00
dyoung
03c2f978e8 In mii_phy_detach(), destroy the NWay callout. 2009-04-07 18:05:02 +00:00
cegger
100faa2cd7 add mii_anar(). From OpenBSD. 2009-01-16 20:51:18 +00:00
dyoung
ddbd8176f9 Reduce code duplication: most PHY drivers call mii_phy_add_media()
when they attach to the device tree, so call pmf_device_register(9)
once there instead of once in more than twenty drivers.
2008-11-17 03:04:27 +00:00
xtraeme
7db0e57765 device_t/softc split for all mii(4) devices, and other related
cosmetic changes.
2008-05-04 17:06:09 +00:00
martin
ce099b4099 Remove clause 3 and 4 from TNF licenses 2008-04-28 20:22:51 +00:00
dyoung
f612df5fb6 Use PMF_FN_ARGS, PMF_FN_PROTO. 2008-02-29 06:38:28 +00:00
msaitoh
fae0af7902 mii_physubr.c::mii_phy_reset() has gphyter and nsphyter specific delay(500).
This delay cause 500us loops under splnet() per linkdown port per mii_tick.
It causes periodically drop packets. It's not acceptable for other devices.

Move gphyter and nsphyter specific delay(500) into the drivers from
mii_physubr.c.
2008-01-20 07:58:19 +00:00
dyoung
c329a611cb Add a helper routine for ethernet drivers, mii_ifmedia_change().
Remove an mii_softc from its mii_data in mii_phy_detach(), not in
mii_detach(), so that we do not leave dangling pointers to a PHY
in an mii_data.
2008-01-10 07:29:41 +00:00
dyoung
401b2c3477 Remove the device_is_active() check from each individual PHY's
service routine.  Add a wrapper for PHY_SERVICE(), called phy_service(),
and check device_is_active() there.  Make the mii_*() routines call
the PHY service routines thorugh phy_service() instead of PHY_SERVICE().

In mii_phy_resume(), restore a PHY's state after resetting it by
sending a MII_MEDIACHG command.  This change makes bnx(4) resume
more reliably and more quickly; it should help other NICs to resume,
too, if they attach PHYs through MII.
2007-12-29 19:34:55 +00:00
jmcneill
4c1d81b2b5 Merge jmcneill-pm branch. 2007-12-09 20:27:42 +00:00
christos
5e16b7787c - don't hardcode 5, 10 define and use MII_ANEGTICKS{,_GIGE}
- instead of != limit, use <= limit (conservative)
2006-11-16 21:24:06 +00:00
christos
168cd830d2 __unused removal on arguments; approved by core. 2006-11-16 01:32:37 +00:00
christos
4d595fd7b1 - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
2006-10-12 01:30:41 +00:00
christos
b5da945622 comment out unreachable code 2006-09-02 07:06:03 +00:00
thorpej
838ee1e0d9 Use device_private(). 2006-03-29 06:51:47 +00:00
thorpej
6e53f1366a Use device_parent(). 2006-03-25 23:14:58 +00:00
thorpej
3ddf26777f Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
2006-02-20 16:50:36 +00:00
joerg
d8f58dca75 Change the link status code in MII to use if_link_state_change instead
of calling rt_ifmsg directly. This allows other parts of the kernel
to change the behaviour depending on the link state and is a
prerequirement for CARP.

Hide mii_phy_statusmsg, mii_phy_update should be used instead.
Don't send routing messages for baudrate changes, if_baudrate is
currently not exported via this interface.

OK tls@
2006-02-18 19:51:07 +00:00
christos
95e1ffb156 merge ktrace-lwp. 2005-12-11 12:16:03 +00:00
perry
f31bd063e9 nuke trailing whitespace 2005-02-27 00:26:58 +00:00
thorpej
1efb3da0fb Make use of static. 2004-08-23 06:16:06 +00:00
thorpej
a85c2a8f12 mii_phy_flowstatus(): short-circuit processing if both sides advertise
symmetric pause capability.  From HITOSHI Osada.
2004-04-11 15:47:33 +00:00
thorpej
ad35f1d6fa Add a comment describing why we force renegotiation when PAUSE is being
used.  From HITOSHI Osada.
2004-04-11 15:42:48 +00:00
thorpej
08645d15fe gmii_phy_getflowcontrol() -> mii_phy_flowstatus(). From HITOSHI Osada. 2004-04-11 15:40:56 +00:00
thorpej
a6d603afd1 gmii_phy_getflowcontrol(): Bail out early if the MAC didn't tell us to
do flow control processing.
2004-04-10 18:54:46 +00:00
thorpej
44ec17557f Flow-control advertisement and parsing support. From HITOSHI Osada.
Slightly modified by me.
2004-04-10 02:32:10 +00:00
briggs
7f9445d14a It is best to allow a little time for the reset to settle in before
we start polling the BMCR again.  Greg Woods noted on tech-net@
that the DP83840A manual states that there should be a 500us delay
between asserting software reset and attempting MII serial operations.

I've also noted that a DP83815 can get into a bad state on cable
removal and reinsertion if we do not delay here.

This may well address PR/16346, and I seem to recall occasional
reports of auto-negotiation and flaky kinds of errors that this
might also alleviate.
2003-09-10 05:25:22 +00:00
thorpej
c31f87a5cb Use aprint*(). 2003-04-29 01:49:33 +00:00
matt
4630a8e7f3 Add a MIIF_FORCEANEG flag to be passed to mii_attach. This forces an
autonegotiation to take place if IFM_AUTO is selected in mii_media_set.
Make the gem driver use it.  (XXX hme probably should use it but I can't
test that).
2003-02-20 00:55:21 +00:00
thorpej
499a491929 Fix signed/unsigned comparison warnings. 2002-11-07 07:41:22 +00:00
thorpej
c1f51e00c0 Back out change accidentally committed. 2002-05-12 21:39:46 +00:00
thorpej
0cc96b0fbe Make sure ifp->if_baudrate is valid when the parent's statchg
callback is made.

Pointed out by Matt Thomas.
2002-05-10 20:45:05 +00:00
uwe
41e6fbc398 Delint somewhat. 2002-05-07 04:52:49 +00:00