Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_lii.c
RevisionDateAuthorComments
 1.30  09-Feb-2024  andvar fix spelling mistakes, mainly in comments and log messages.
 1.29  16-Sep-2022  andvar s/Paket/Packet/
 1.28  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.27  18-Sep-2019  msaitoh branches: 1.27.2;
Use unsigned to avoid undefined behavior in lii_setmulti().
 1.26  30-May-2019  msaitoh branches: 1.26.2;
Simplify MII structure initialization and reference. No functional change.
 1.25  28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.24  23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.23  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.22  22-Apr-2019  msaitoh On drivers which use MII(4) and have hook SIOC[GS]IFMEDIA which just pass to
ifmedia_ioctl(), the hook is not required because ether_ioctl has it
(if_ethersubr.c rev. 1.160). These drivers don't return ENETRESET in
ifmedia_ioctl(), so no functional change.
 1.21  11-Apr-2019  msaitoh Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.20  22-Jan-2019  msaitoh Change MII PHY read/write API from:

int (*mii_readreg_t)(device_t, int, int);
void (*mii_writereg_t)(device_t, int, int, int);
to:

int (*mii_readreg_t)(device_t, int, int, uint16_t *);
int (*mii_writereg_t)(device_t, int, int, uint16_t);

Now we can test if a read/write operation failed or not by the return value.

In 802.3 spec says that the PHY shall not respond to read/write transaction
to the unimplemented register(22.2.4.3). Detecting timeout can be used to
check whether a register is implemented or not (if the register conforms to
the spec). ukphy(4) can be used this for MII_MMDACR and MII_MMDAADR.

Note that I noticed that the following code do infinite loop in the
read/wirte function. If it accesses unimplemented PHY register, it will hang.
It should be fixed:

arm/at91/at91emac.c
arm/ep93xx/epe.c
arm/omap/omapl1x_emac.c
mips/ralink/ralink_eth.c
arch/powerpc/booke/dev/pq3etsec.c(read)
dev/cadence/if_cemac.c <- hkenken
dev/ic/lan9118.c


Tested with the following device:

axe+ukphy
axe+rgephy
axen+rgephy (tested by Andrius V)
wm+atphy
wm+ukphy
wm+igphy
wm+ihphy
wm+makphy
sk+makphy
sk+brgphy
sk+gentbi
msk+makphy
sip+icsphy
sip+ukphy
re+rgephy
bge+brgphy
bnx+brgphy
gsip+gphyter
rtk+rlphy
fxp+inphy (tested by Andrius V)
tlp+acphy
ex+exphy
epic+qsphy
vge+ciphy (tested by Andrius V)
vr+ukphy (tested by Andrius V)
vte+ukphy (tested by Andrius V)

Not tested (MAC):
arm:at91emac
arm:cemac
arm:epe
arm:geminigmac
arm:enet
arm:cpsw
arm:emac(omac)
arm:emac(sunxi)
arm:npe
evbppc:temac
macppc:bm
macppc:gm
mips:aumac
mips:ae
mips:cnmac
mips:reth
mips:sbmac
playstation2:smap
powerpc:tsec
powerpc:emac(ibm4xx)
sgimips:mec
sparc:be
sf
ne(ax88190, dl10019)
awge
ep
gem
hme
smsh
mtd
sm
age
alc
ale
bce
cas
et
jme
lii
nfe
pcn
ste
stge
tl
xi
aue
mue
smsc
udav
url

Not tested (PHY):
amhphy
bmtphy
dmphy
etphy
glxtphy
ikphy
iophy
lxtphy
nsphyter
pnaphy
rdcphy
sqphy
tlphy
tqphy
urlphy
 1.19  09-Dec-2018  jdolecek use pci_intr_establish_xname() everywhere
 1.18  26-Jun-2018  msaitoh branches: 1.18.2;
Implement the BPF direction filter (BIOC[GS]DIRECTION). It provides backward
compatibility with BIOC[GS]SEESENT ioctl. The userland interface is the same
as FreeBSD.

This change also fixes a bug that the direction is misunderstand on some
environment by passing the direction to bpf_mtap*() instead of checking
m->m_pkthdr.rcvif.
 1.17  15-Dec-2016  ozaki-r branches: 1.17.8; 1.17.14;
Move bpf_mtap and if_ipackets++ on Rx of each driver to percpuq if_input

The benefits of the change are:
- We can reduce codes
- We can provide the same behavior between drivers
- Where/When if_ipackets is counted up
- Note that some drivers still update packet statistics in their own
way (periodical update)
- Moved bpf_mtap run in softint
- This makes it easy to MP-ify bpf

Proposed on tech-kern and tech-net
 1.16  08-Dec-2016  ozaki-r Apply deferred if_start framework

if_schedule_deferred_start checks if the if_snd queue contains packets,
so drivers don't need to check it by themselves.
 1.15  10-Jun-2016  ozaki-r branches: 1.15.2;
Introduce m_set_rcvif and m_reset_rcvif

The API is used to set (or reset) a received interface of a mbuf.
They are counterpart of m_get_rcvif, which will come in another
commit, hide internal of rcvif operation, and reduce the diff of
the upcoming change.

No functional change.
 1.14  09-Feb-2016  ozaki-r Introduce softint-based if_input

This change intends to run the whole network stack in softint context
(or normal LWP), not hardware interrupt context. Note that the work is
still incomplete by this change; to that end, we also have to softint-ify
if_link_state_change (and bpf) which can still run in hardware interrupt.

This change softint-ifies at ifp->if_input that is called from
each device driver (and ieee80211_input) to ensure Layer 2 runs
in softint (e.g., ether_input and bridge_input). To this end,
we provide a framework (called percpuq) that utlizes softint(9)
and percpu ifqueues. With this patch, rxintr of most drivers just
queues received packets and schedules a softint, and the softint
dequeues packets and does rest packet processing.

To minimize changes to each driver, percpuq is allocated in struct
ifnet for now and that is initialized by default (in if_attach).
We probably have to move percpuq to softc of each driver, but it's
future work. At this point, only wm(4) has percpuq in its softc
as a reference implementation.

Additional information including performance numbers can be found
in the thread at tech-kern@ and tech-net@:
http://mail-index.netbsd.org/tech-kern/2016/01/14/msg019997.html

Acknowledgment: riastradh@ greatly helped this work.
Thank you very much!
 1.13  29-Mar-2014  christos branches: 1.13.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.12  30-Mar-2013  christos branches: 1.12.4;
remove trailing whitespace
 1.11  22-Jul-2012  matt branches: 1.11.2;
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.
 1.10  20-Apr-2011  christos branches: 1.10.4;
PR/41258: Elias Benali: Try to get the ethernet address from the BIOS before
failing.
 1.9  05-Apr-2010  joerg branches: 1.9.2;
Push the bpf_ops usage back into bpf.h. Push the common ifp->if_bpf
check into the inline functions as well the fourth argument for
bpf_attach.
 1.8  19-Jan-2010  pooka branches: 1.8.2; 1.8.4;
Redefine bpf linkage through an always present op vector, i.e.
#if NBPFILTER is no longer required in the client. This change
doesn't yet add support for loading bpf as a module, since drivers
can register before bpf is attached. However, callers of bpf can
now be modularized.

Dynamically loadable bpf could probably be done fairly easily with
coordination from the stub driver and the real driver by registering
attachments in the stub before the real driver is loaded and doing
a handoff. ... and I'm not going to ponder the depths of unload
here.

Tested with i386/MONOLITHIC, modified MONOLITHIC without bpf and rump.
 1.7  05-Sep-2009  tsutsui Invert logic around nested pmf(9) registrations for readability.
 1.6  26-Apr-2009  cegger fix error handling in lii_attach()
ok jmcneill@
 1.5  08-Jul-2008  sborrill branches: 1.5.2; 1.5.4; 1.5.8;
Fix multicast (multicast hash table were calculated incorrectly).
 1.4  29-Apr-2008  martin branches: 1.4.2; 1.4.4; 1.4.6; 1.4.8;
Convert to new 2 clause license
 1.3  06-Apr-2008  mjf branches: 1.3.2; 1.3.4; 1.3.6;
Prevent packet header from being placed outside the TXD buffer. This
should stop the "mismatched status and packet" error messages that have
been plaguing the EeePC.

Fix provided by Joel Sing, thanks!
 1.2  31-Mar-2008  mjf branches: 1.2.2;
Register pmf handler.
 1.1  29-Mar-2008  cube Add a driver for the Atheros/Attansic L2 Fast-Ethernet chip found on a
series of hardware that includes Asus's famous EeePC.

The linux driver was used as documentation.

Many thanks to all the people who helped or at least supported me while I
was fighting that bug that made the EeePC freeze. At the top of that list,
Matt J. Fleming (mjf@) and David Gwynne (from the OpenBSD fame).
 1.2.2.4  28-Sep-2008  mjf Sync with HEAD.
 1.2.2.3  02-Jun-2008  mjf Sync with HEAD.
 1.2.2.2  03-Apr-2008  mjf Sync with HEAD.
 1.2.2.1  31-Mar-2008  mjf file if_lii.c was added on branch mjf-devfs2 on 2008-04-03 12:42:50 +0000
 1.3.6.5  11-Aug-2010  yamt sync with head.
 1.3.6.4  11-Mar-2010  yamt sync with head
 1.3.6.3  16-Sep-2009  yamt sync with head
 1.3.6.2  04-May-2009  yamt sync with head.
 1.3.6.1  16-May-2008  yamt sync with head.
 1.3.4.3  20-Aug-2008  bouyer Pull up following revision(s) (requested by sborrill in ticket #1164):
sys/dev/pci/if_lii.c: revision 1.5
Fix multicast (multicast hash table were calculated incorrectly).
 1.3.4.2  19-Apr-2008  bouyer Pull up following revision(s) (requested by sborrill in ticket #1128):
sys/dev/pci/if_lii.c: revisions 1.1, 1.3 via patch
sys/arch/i386/conf/ALL: revision 1.161 via patch
share/man/man4/lii.4: revision 1.1 via patch
sys/dev/pci/files.pci: revision 1.303 via patch
sys/dev/DEVNAMES: revision 1.238 via patch
sys/arch/i386/conf/GENERIC: revision 1.885 via patch
distrib/sets/lists/man/mi: revisions 1.1062, 1.1063 via patch
sys/arch/i386/conf/XEN2_DOM0: revision 1.43 via patch
share/man/man4/Makefile: revision 1.460 via patch
sys/arch/i386/conf/INSTALL: revision 1.323 via patch
sys/dev/pci/if_liireg.h: revision 1.1 via patch
Add a driver for the Atheros/Attansic L2 Fast-Ethernet chip found on a
series of hardware that includes Asus's famous EeePC.
 1.3.4.1  06-Apr-2008  bouyer file if_lii.c was added on branch netbsd-4 on 2008-04-19 15:57:56 +0000
 1.3.2.1  18-May-2008  yamt sync with head.
 1.4.8.1  19-Oct-2008  haad Sync with HEAD.
 1.4.6.1  18-Jul-2008  simonb Sync with head.
 1.4.4.3  04-Sep-2008  skrll Sync with netbsd-4.
 1.4.4.2  03-Jun-2008  skrll Sync with netbsd-4.
 1.4.4.1  29-Apr-2008  skrll file if_lii.c was added on branch wrstuden-fixsa on 2008-06-03 20:47:24 +0000
 1.4.2.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.5.8.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.5.4.1  20-May-2011  bouyer Pull up following revision(s) (requested by dholland in ticket #1612):
sys/dev/pci/if_lii.c: revision 1.10
PR/41258: Elias Benali: Try to get the ethernet address from the BIOS before
failing.
 1.5.2.1  28-Apr-2009  skrll Sync with HEAD.
 1.8.4.2  21-Apr-2011  rmind sync with head
 1.8.4.1  30-May-2010  rmind sync with head
 1.8.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.9.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.10.4.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.10.4.1  30-Oct-2012  yamt sync with head
 1.11.2.3  03-Dec-2017  jdolecek update from HEAD
 1.11.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.11.2.1  23-Jun-2013  tls resync from head
 1.12.4.1  18-May-2014  rmind sync with head
 1.13.6.3  05-Feb-2017  skrll Sync with HEAD
 1.13.6.2  09-Jul-2016  skrll Sync with HEAD
 1.13.6.1  19-Mar-2016  skrll Sync with HEAD
 1.15.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.17.14.3  26-Jan-2019  pgoyette Sync with HEAD
 1.17.14.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.17.14.1  28-Jul-2018  pgoyette Sync with HEAD
 1.17.8.1  13-May-2019  martin Pull up the following, via patch, requested by msaitoh in ticket #1263:

sys/dev/mii/brgphy.c 1.84
sys/dev/mii/ciphy.c 1.33 via patch
sys/dev/mii/rgephy.c 1.53
sys/arch/arm/imx/if_enet.c 1.18
sys/arch/mips/adm5120/dev/if_admsw.c 1.19-1.20
sys/dev/pci/if_bge.c 1.329
sys/dev/pci/if_bnx.c 1.81
sys/dev/pci/if_et.c 1.21
sys/dev/pci/if_lii.c 1.22
sys/dev/pci/if_msk.c 1.87
sys/dev/pci/if_nfe.c 1.68
sys/dev/pci/if_sk.c 1.95
sys/dev/pci/if_ti.c 1.107
sys/dev/pci/if_txp.c 1.52
sys/dev/pci/if_vge.c 1.69
sys/dev/usb/if_axen.c 1.38
sys/dev/usb/if_aue.c 1.149

Fix a bug that the duplex of manual media setting may be wrong
when the IFM_GMASK bit other than IFM_[FH]DX is set.
 1.18.2.3  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.18.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.18.2.1  10-Jun-2019  christos Sync with HEAD
 1.26.2.1  31-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #672):

sys/dev/ic/tulip.c: revision 1.198
sys/dev/pci/if_jme.c: revision 1.45
sys/dev/pci/agp.c: revision 1.86
sys/dev/pci/if_lii.c: revision 1.27
sys/dev/acpi/thinkpad_acpi.c: revision 1.47
sys/dev/scsipi/scsipi_base.c: revision 1.183
sys/dev/ic/aic6915reg.h: revision 1.6

Fix undefined behavior in thinkpad_mask_init(). Found by kUBSan.

Use unsigned when initialize the transmit completion ring to avoid undefined
behavior. Found by kUBSan.

Avoid undefined behavior when setting multicast address. found by kUBSan.

Use unsigned to avoid undefined behavior in agpattach(). Found by kUBSan.

Avoid undefined behavior in jme_mii_write(). Found by kUBSan.

Use unsigned to avoid undefined behavior in lii_setmulti().

Use unsigned to avoid undefined behavior in scsipi_{get,put}_tag().

Found by kUBSan.
 1.27.2.1  29-Feb-2020  ad Sync with head.

RSS XML Feed