#
331722 |
|
29-Mar-2018 |
eadler |
Revert r330897:
This was intended to be a non-functional change. It wasn't. The commit message was thus wrong. In addition it broke arm, and merged crypto related code.
Revert with prejudice.
This revert skips files touched in r316370 since that commit was since MFCed. This revert also skips files that require $FreeBSD$ property changes.
Thank you to those who helped me get out of this mess including but not limited to gonzo, kevans, rgrimes.
Requested by: gjb (re)
|
#
330897 |
|
14-Mar-2018 |
eadler |
Partial merge of the SPDX changes
These changes are incomplete but are making it difficult to determine what other changes can/should be merged.
No objections from: pfg
|
#
302408 |
|
07-Jul-2016 |
gjb |
Copy head@r302406 to stable/11 as part of the 11.0-RELEASE cycle. Prune svn:mergeinfo from the new branch, as nothing has been merged here.
Additional commits post-branch will follow.
Approved by: re (implicit) Sponsored by: The FreeBSD Foundation |
#
297793 |
|
10-Apr-2016 |
pfg |
Cleanup unnecessary semicolons from the kernel.
Found with devel/coccinelle.
|
#
281821 |
|
21-Apr-2015 |
glebius |
Instead of storing mii_media_table array index in ifm_data, determine it in mii_phy_setmedia() functionally.
Sponsored by: Nginx, Inc.
|
#
277176 |
|
14-Jan-2015 |
glebius |
Clean some dead code.
|
#
257184 |
|
26-Oct-2013 |
glebius |
The MII layer shouldn't care about administrative status of an interface. Make MII drivers forget about 'struct ifnet'.
Later plan is to provide an administrative downcall from ifnet layer into drivers, to inform them about administrative status change. If someone thinks that processing MII events for an administratively down interface is a big problem, then drivers would turn MII processing off.
The following MII drivers do evil things, like strcmp() on driver name, so they still need knowledge of ifnet and thus include if_var.h. They all need to be fixed:
sys/dev/mii/brgphy.c sys/dev/mii/e1000phy.c sys/dev/mii/ip1000phy.c sys/dev/mii/jmphy.c sys/dev/mii/nsphy.c sys/dev/mii/rgephy.c sys/dev/mii/truephy.c
Sponsored by: Netflix Sponsored by: Nginx, Inc.
|
#
225014 |
|
19-Aug-2011 |
marius |
r221812 reveals that at least some Broadcom PHYs default to being not only isolated but also powered down after a reset and while they just work fine [sic] when both is the case they don't if they are only deisolate but still powered down. So in order to put PHYs in an overall normal operation mode for the common case, ensure in mii_phy_reset() that they are not powered down after a reset. Unfortunately, this only helps in case of BCM5421, while BCM5709S apparently only work when they remain isolated and powered down after a reset. So don't call mii_phy_reset() in brgphy_reset() and implement the reset locally leaving the problematic bits alone. Effectively this bypasses r221812 for brgphy(4). Thanks to Justin Hibbits for doing a binary search in order to identify the problematic commit.
PR: 157405, 158156 Reviewed by: yongari (mii_phy_reset() part) Approved by: re (kib) MFC after: 3 days
|
#
221812 |
|
12-May-2011 |
marius |
Some PHYs like the Level One LXT970 optionally can default to isolation after rest, in which case we may need to deisolate it. Tested by: nwhitehorn
MFC after 1 week
|
#
221407 |
|
03-May-2011 |
marius |
- Remove attempts to implement setting of BMCR_LOOP/MIIF_NOLOOP (reporting IFM_LOOP based on BMCR_LOOP is left in place though as it might provide useful for debugging). For most mii(4) drivers it was unclear whether the PHYs driven by them actually support loopback or not. Moreover, typically loopback mode also needs to be activated on the MAC, which none of the Ethernet drivers using mii(4) implements. Given that loopback media has no real use (and obviously hardly had a chance to actually work) besides for driver development (which just loopback mode should be sufficient for though, i.e one doesn't necessary need support for loopback media) support for it is just dropped as both NetBSD and OpenBSD already did quite some time ago. - Let mii_phy_add_media() also announce the support of IFM_NONE. - Restructure the PHY entry points to use a structure of entry points instead of discrete function pointers, and extend this to include a "reset" entry point. Make sure any PHY-specific reset routine is always used, and provide one for lxtphy(4) which disables MII interrupts (as is done for a few other PHYs we have drivers for). This includes changing NIC drivers which previously just called the generic mii_phy_reset() to now actually call the PHY-specific reset routine, which might be crucial in some cases. While at it, the redundant checks in these NIC drivers for mii->mii_instance not being zero before calling the reset routines were removed because as soon as one PHY driver attaches mii->mii_instance is incremented and we hardly can end up in their media change callbacks etc if no PHY driver has attached as mii_attach() would have failed in that case and not attach a miibus(4) instance. Consequently, NIC drivers now no longer should call mii_phy_reset() directly, so it was removed from EXPORT_SYMS. - Add a mii_phy_dev_attach() as a companion helper to mii_phy_dev_probe(). The purpose of that function is to perform the common steps to attach a PHY driver instance and to hook it up to the miibus(4) instance and to optionally also handle the probing, addition and initialization of the supported media. So all a PHY driver without any special requirements has to do in its bus attach method is to call mii_phy_dev_attach() along with PHY-specific MIIF_* flags, a pointer to its PHY functions and the add_media set to one. All PHY drivers were updated to take advantage of mii_phy_dev_attach() as appropriate. Along with these changes the capability mask was added to the mii_softc structure so PHY drivers taking advantage of mii_phy_dev_attach() but still handling media on their own do not need to fiddle with the MII attach arguments anyway. - Keep track of the PHY offset in the mii_softc structure. This is done for compatibility with NetBSD/OpenBSD. - Keep track of the PHY's OUI, model and revision in the mii_softc structure. Several PHY drivers require this information also after attaching and previously had to wrap their own softc around mii_softc. NetBSD/OpenBSD also keep track of the model and revision on their mii_softc structure. All PHY drivers were updated to take advantage as appropriate. - Convert the mebers of the MII data structure to unsigned where appropriate. This is partly inspired by NetBSD/OpenBSD. - According to IEEE 802.3-2002 the bits actually have to be reversed when mapping an OUI to the MII ID registers. All PHY drivers and miidevs where changed as necessary. Actually this now again allows to largely share miidevs with NetBSD, which fixed this problem already 9 years ago. Consequently miidevs was synced as far as possible. - Add MIIF_NOMANPAUSE and mii_phy_flowstatus() calls to drivers that weren't explicitly converted to support flow control before. It's unclear whether flow control actually works with these but typically it should and their net behavior should be more correct with these changes in place than without if the MAC driver sets MIIF_DOPAUSE.
Obtained from: NetBSD (partially) Reviewed by: yongari (earlier version), silence on arch@ and net@
|
#
220938 |
|
22-Apr-2011 |
marius |
Correct spelling in comments.
Submitted by: brucec
|
#
217414 |
|
14-Jan-2011 |
marius |
- Don't announce PAUSE support for half-duplex when MIIF_FORCEPAUSE is set. - Let mii_phy_auto() also announce PAUSE support for 10baseT-FDX.
MFC after: 1 week
|
#
215297 |
|
14-Nov-2010 |
marius |
o Flesh out the generic IEEE 802.3 annex 31B full duplex flow control support in mii(4): - Merge generic flow control advertisement (which can be enabled by passing by MIIF_DOPAUSE to mii_attach(9)) and parsing support from NetBSD into mii_physubr.c and ukphy_subr.c. Unlike as in NetBSD, IFM_FLOW isn't implemented as a global option via the "don't care mask" but instead as a media specific option this. This has the following advantages: o allows flow control advertisement with autonegotiation to be turned on and off via ifconfig(8) with the default typically being off (though MIIF_FORCEPAUSE has been added causing flow control to be always advertised, allowing to easily MFC this changes for drivers that previously used home-grown support for flow control that behaved that way without breaking POLA) o allows to deal with PHY drivers where flow control advertisement with manual selection doesn't work or at least isn't implemented, like it's the case with brgphy(4), e1000phy(4) and ip1000phy(4), by setting MIIF_NOMANPAUSE o the available combinations of media options are readily available from the `ifconfig -m` output - Add IFM_FLOW to IFM_SHARED_OPTION_DESCRIPTIONS and IFM_ETH_RXPAUSE and IFM_ETH_TXPAUSE to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so these are understood by ifconfig(8). o Make the master/slave support in mii(4) actually usable: - Change IFM_ETH_MASTER from being implemented as a global option via the "don't care mask" to a media specific one as it actually is only applicable to IFM_1000_T to date. - Let mii_phy_setmedia() set GTCR_MAN_MS in IFM_1000_T slave mode to actually configure manually selected slave mode (like we also do in the PHY specific implementations). - Add IFM_ETH_MASTER to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS so it is understood by ifconfig(8). o Switch bge(4), bce(4), msk(4), nfe(4) and stge(4) along with brgphy(4), e1000phy(4) and ip1000phy(4) to use the generic flow control support instead of home-grown solutions via IFM_FLAGs. This includes changing these PHY drivers and smcphy(4) to no longer unconditionally advertise support for flow control but only if the selected media has IFM_FLOW set (or MIIF_FORCEPAUSE is set) and implemented for these media variants, i.e. typically only for copper. o Switch brgphy(4), ciphy(4), e1000phy(4) and ip1000phy(4) to report and set IFM_1000_T master mode via IFM_ETH_MASTER instead of via IFF_LINK0 and some IFM_FLAGn. o Switch brgphy(4) to add at least the the supported copper media based on the contents of the BMSR via mii_phy_add_media() instead of hardcoding them. The latter approach seems to have developed historically, besides causing unnecessary code duplication it was also undesirable because brgphy_mii_phy_auto() already based the capability advertisement on the contents of the BMSR though. o Let brgphy(4) set IFM_1000_T master mode on all supported PHY and not just BCM5701. Apparently this was a misinterpretation of a workaround in the Linux tg3 driver; BCM5701 seem to require RGPHY_1000CTL_MSE and BRGPHY_1000CTL_MSC to be set when configuring autonegotiation but this doesn't mean we can't set these as well on other PHYs for manual media selection. o Let ukphy_status() report IFM_1000_T master mode via IFM_ETH_MASTER so IFM_1000_T master mode support now is generally available with all PHY drivers. o Don't let e1000phy(4) set master/slave bits for IFM_1000_SX as it's not applicable there.
Reviewed by: yongari (plus additional testing) Obtained from: NetBSD (partially), OpenBSD (partially) MFC after: 2 weeks
|
#
214608 |
|
31-Oct-2010 |
marius |
Turn a panic into a printf so IFM_ETH_MASTER on !IFM_1000_T is complained about but otherwise ignored. When allowing the master to be set manually via ifconfig(8) by adding the former to IFM_SUBTYPE_ETHERNET_OPTION_DESCRIPTIONS (as it should be) it seems to be unfavorable that a machine can be made to panic with a simple ifconfig(8) invocation.
|
#
214606 |
|
31-Oct-2010 |
marius |
Try to make the style consistent (including regarding NetBSD bits not yet merged) and adhere style(9).
|
#
214265 |
|
24-Oct-2010 |
marius |
- Given that as of r214264 all PHY drivers using mii(4) finally have been converted to use the mii_phy_add_media()/mii_phy_setmedia() pair instead of mii_add_media()/mii_anar() remove the latter. - Declare mii_media mii_media_table static as it shouldn't be used outside of mii_physubr.c.
MFC after: never
|
#
213229 |
|
27-Sep-2010 |
marius |
Use the mii_data provided via mii_attach_args and mii_pdata respectively instead of reaching out for the softc of the parent.
|
#
204646 |
|
03-Mar-2010 |
joel |
The NetBSD Foundation has granted permission to remove clause 3 and 4 from the software.
Obtained from: NetBSD
|
#
165990 |
|
12-Jan-2007 |
marius |
Remove mii_media_from_bmcr(); all previous users have been converted to use mii_phy_add_media()/mii_phy_setmedia().
|
#
164827 |
|
02-Dec-2006 |
marius |
Add a helper function mii_phy_dev_probe(), which wraps around the mii_phy_match() API and takes care of the PHY device probe based on the struct mii_phydesc array and the match return value provided. Convert PHY drivers to take advantage of mii_phy_dev_probe(), converting drivers to provide a mii_phydesc table in the first place where necessary.
Reviewed by: yongari MFC after: 2 weeks
|
#
164703 |
|
27-Nov-2006 |
marius |
Analogous to mii_add_media(), factor out the code for checking whether the BMSR contains any media at all to mii_phy_add_media(). The majority of the drivers currently using mii_phy_add_media() were missing such a check anyway though.
MFC after: 2 weeks
|
#
164702 |
|
27-Nov-2006 |
marius |
- Add a MIIF_FORCEANEG flag which forces an auto-negotiation to always take place if IFM_AUTO is selected. This allows drivers like nsphy(4), which need to force writing the ANAR according to the BMSR, to take advantage of mii_phy_setmedia(). [1] - In mii_phy_reset() once the current media is set don't isolate the PHY corresponding to the instance of the currently selected media rather than unconditionally not isolating the PHY corresponding to instance 0. This saves a isolation-unisolation-cycle of the PHY corresponding to the currently selected media for the case were it isn't instance 0. - Fix some whitespace nits. [1]
Obtained from: NetBSD [1] MFC after: 2 weeks
|
#
160082 |
|
03-Jul-2006 |
oleg |
Reset autonegotiation timer if current media is not 'auto'.
Approved by: glebius (mentor) MFC after: 2 weeks
|
#
158649 |
|
16-May-2006 |
oleg |
1) Fix mii_phy_tick(): Current code does not report link loss correctly - when link goes down, mii_phy_tick() will notice that with up to mii_anegticks delay. If link goes up during this delay then link flapping will be unnoticed by driver.
2) mii_phy_add_media(): initialize sc->mii_anegticks for 10/100 media
3) Use MII_ANEGTICKS/MII_ANEGTICKS_GIGE defines instead of hardcoded values.
Approved by: glebius (mentor) MFC after: 1 month
|
#
150756 |
|
30-Sep-2005 |
imp |
Add a more generic version of the mii_phy_match routine (mii_phy_match_gen) which can be used for phy that want to piggy back other data with their table.
|
#
141937 |
|
15-Feb-2005 |
imp |
Use ANSI function definitions, in preference to the K&R definitions.
|
#
129844 |
|
29-May-2004 |
marius |
Remove double __FBSDID and move the remaining one into a common place after the license(s) and before the driver comment (the latter only in drivers not having __FBSDID at that location).
|
#
128870 |
|
03-May-2004 |
andre |
Correct the phy_service() routine case MII_TICK to correctly track the falling edge of a media state change.
This is in preparation for media state change notification to the routing socket.
No objections by: sam, wpaul, ru, bms Brucification by: bde
|
#
119418 |
|
24-Aug-2003 |
obrien |
Use __FBSDID(). Also some minor style cleanups.
|
#
115520 |
|
31-May-2003 |
phk |
Remove unnecessary breaks. Remove unused variables. Add XXX comment where a break may be missing. [lxtphy.c]
Found by: FlexeLint
|
#
113038 |
|
03-Apr-2003 |
obrien |
Use __FBSDID rather than rcsid[].
|
#
96027 |
|
04-May-2002 |
phk |
Increase gigE negotiation timeout to 17 seconds.
10 seconds is not enough to negotiate a gigE link with a cisco switch which holds carrier off for several seconds between tries.
|
#
96026 |
|
04-May-2002 |
phk |
Clean up mii/phy drivers: Remove the MIIF_DOINGAUTO which doesn't really do anything at the end of the day except bloat the drivers which has copy&pasted it.
|
#
95724 |
|
29-Apr-2002 |
phk |
Introduce NetBSD's mii_phy_match() API and use it in the nsgphy to get a description printed.
|
#
95722 |
|
29-Apr-2002 |
phk |
Make one generic mii_phy_detach() to replace 19 slightly different ones.
Rename mii_phy_auto_stop() mii_phy_down().
Introduce mii_down(), use it from nge. Do not indirect it to 19 identical case's in 19 switchstatements like NetBSD did.
|
#
95718 |
|
29-Apr-2002 |
phk |
Move a lot closer to NetBSDs MII support for GigE.
Move fxp and nge drivers over to use the new stuff.
|
#
95707 |
|
29-Apr-2002 |
phk |
Moving closer to being able to use NetBSD's generic mii_set_media() function.
|
#
95705 |
|
29-Apr-2002 |
phk |
Edging ever closer to NetBSD...
|
#
95667 |
|
28-Apr-2002 |
phk |
Don't pass three args when one will do just fine, and even prevent mistakes like the one brgphy.c (now corrected).
|
#
95665 |
|
28-Apr-2002 |
phk |
Improve an API by about 4 lines per driver.
|
#
92739 |
|
20-Mar-2002 |
alfred |
Remove __P.
|
#
84141 |
|
29-Sep-2001 |
jlemon |
Forced commit: common service routines mii_phy_update() and mii_phy_tick() have also been added, and can be used to factor out common code from the various mii drivers.
|
#
84140 |
|
29-Sep-2001 |
jlemon |
Add new device method miibus_linkchg, along with a service routine.
|
#
69925 |
|
12-Dec-2000 |
wpaul |
Grrrrr. That last commit was supposed to be to the head, not to -stable (even though I want the fixes in -stable anyway). I'm sure I'm going to get flamed now for committing to -stable and -current too quickly. *sigh*
|
#
67164 |
|
15-Oct-2000 |
phk |
Remove unneeded #include <machine/clock.h>
|
#
50477 |
|
27-Aug-1999 |
peter |
$Id$ -> $FreeBSD$
|
#
50120 |
|
21-Aug-1999 |
wpaul |
This commit adds support for the NetBSD MII abstraction layer and MII-compliant PHY drivers. Many 10/100 ethernet NICs available today either use an MII transceiver or have built-in transceivers that can be programmed using an MII interface. It makes sense then to separate this support out into common code instead of duplicating it in all of the NIC drivers. The mii code also handles all of the media detection, selection and reporting via the ifmedia interface.
This is basically the same code from NetBSD's /sys/dev/mii, except it's been adapted to FreeBSD's bus architecture. The advantage to this is that it automatically allows everything to be turned into a loadable module. There are some common functions for use in drivers once an miibus has been attached (mii_mediachg(), mii_pollstat(), mii_tick()) as well as individual PHY drivers. There is also a generic driver for all PHYs that aren't handled by a specific driver. It's possible to do this because all 10/100 PHYs implement the same general register set in addition to their vendor-specific register sets, so for the most part you can use one driver for pretty much any PHY. There are a couple of oddball exceptions though, hence the need to have specific drivers.
There are two layers: the generic "miibus" layer and the PHY driver layer. The drivers are child devices of "miibus" and the "miibus" is a child of a given NIC driver. The "miibus" code and the PHY drivers can actually be compiled and kldoaded as completely separate modules or compiled together into one module. For the moment I'm using the latter approach since the code is relatively small.
Currently there are only three PHY drivers here: the generic driver, the built-in 3Com XL driver and the NS DP83840 driver. I'll be adding others later as I convert various NIC drivers to use this code.
I realize that I'm cvs adding this stuff instead of importing it onto a separate vendor branch, but in my opinion the import approach doesn't really offer any significant advantage: I'm going to be maintaining this stuff and writing my own PHY drivers one way or the other.
|