Commit Graph

10 Commits

Author SHA1 Message Date
thorpej 7a9a30c5e7 Define and implement a locking protocol for the ifmedia / mii layers:
- MP-safe drivers provide a mutex to ifmedia that is used to serialize
  access to media-related structures / hardware regsiters.  Converted
  drivers use the new ifmedia_init_with_lock() function for this.  The
  new name is provided to ease the transition.
- Un-converted drivers continue to call ifmedia_init(), which will supply
  a compatibility lock to be used instead.  Several media-related entry
  points must be aware of this compatibility lock, and are able to acquire
  it recursively a limited number of times, if needed.  This is a SPIN
  mutex with priority IPL_NET.
- This same lock is used to serialize access to PHY registers and other
  MII-related data structures.

The PHY drivers are modified to acquire and release the lock, as needed,
and assert the lock is held as a diagnostic aid.

The "usbnet" framework has had an overhaul of its internal locking
protocols to fit in with the media / mii changes, and the drivers adapted.

USB wifi drivers have been changed to provide their own adaptive mutex
to the ifmedia later via a new ieee80211_media_init_with_lock() function.
This is required because the USB drivers need an adaptive mutex.

Besised "usbnet", a few other drivers are converted: vmx, wm, ixgbe / ixv.

mcx also now calls ifmedia_init_with_lock() because it needs to also use
an adaptive mutex.  The mcx driver still needs to be fully converted to
NET_MPSAFE.
2020-03-15 23:04:50 +00:00
msaitoh f8441706c9 No functional change:
- Move some definitions from if_stgereg.h to if_stge.c again because those are
  not chip (registers or descriptors) definitions.
- Use proplib to pass information that loading DSP code is required when
  PHY reset.
2020-01-14 09:49:26 +00:00
msaitoh 509697f3cf - Simplify sc->mii_anegticks setting. Same as FreeBSD.
Don't set the default value not in the attach function. Instead, set the
  default value (MII_ANEGTICKS) first in the beginning of the
  mii_phy_add_media(). The function already has the code to change the value to
  MII_ANEGTICKS_GIGE if it's gigabit capable.

- Remove extra pmf_device_register() call. It's done in mii_phy_add_media().
2019-11-27 10:19:20 +00:00
msaitoh cb48b5fbd4 Print dmesg correctly. 2019-11-27 08:53:32 +00:00
msaitoh a0db6e738a Whitespace. 2019-11-21 09:48:57 +00:00
msaitoh 4a70ff44ab Add missing NetBSD RCS Id. Reported by Andrius V. 2019-11-21 03:04:21 +00:00
msaitoh 0261fff81e - Use auto-negotiation when forcing 1000BASE-T.
- Add XXX comment for strange pause setting code. I suspect this is wrong.
- On my environments, 1000BASE-T half duplex doesn't work, so we might remove
  IFM_1000T_HDX from this device in future.
2019-11-14 09:06:21 +00:00
msaitoh 45485586e6 STGE_PhyCtrl is not PHY register but MAC register, so use ukphy_status()
for IP1000A device.
2019-11-14 09:00:23 +00:00
msaitoh e3b7337f95 KNF. No functional change. 2019-11-14 08:52:34 +00:00
msaitoh d3ce678f8d Add support IC Plus IP1000* PHYs. PR/kern 42314 first reported by
Tomokazu HARADA and patch provided by Andrius V.
2019-10-07 11:53:40 +00:00