Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_et.c
RevisionDateAuthorComments
 1.36  01-Aug-2023  andvar s/diabled/disabled/ in comments.
 1.35  10-Sep-2021  jakllsch if_et.c: nothing in this driver needs netinet includes now,
so drop #include "opt_inet.h" and the includes of netinet headers
conditioned on it.
 1.34  10-Sep-2021  jakllsch No need to #include "vlan.h", as NVLAN is not used in these drivers now.
 1.33  08-May-2021  thorpej Use pci_compatible_match().
 1.32  01-Mar-2020  thorpej branches: 1.32.10;
Use the 64-bit PCI DMA tag if available.
 1.31  28-Feb-2020  msaitoh Move PHY_RESET() in the media change path from if_et.c to etphy.c.

I don't know if the reset is required or not. I tested some media
transitions without the reset and it worked. It might be OK to remove
but Linux does it only in et1011c_config_aneg(). So move the reset to
etphy_service(,,MII_MEDIACHG)'s autonego case. This change is also
required for future locking changes.
 1.30  04-Feb-2020  thorpej Use ifmedia_fini().
 1.29  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.28  28-Nov-2019  maxv branches: 1.28.2;
localify
 1.27  12-Oct-2019  msaitoh Fix a bug that multicast address filter doesn't work correctly.

XXX pullup-[789].
 1.26  01-Aug-2019  msaitoh Make et(4) work:
- Enabling TX/RX in et_init() will always fail when cable is not plugged in,
if this happens, we delay TX/RX enablement until link is up. From FreeBSD.
- Modify flow control stuff a little (from FrerBSD). It still doesn't work.
- KNF. Part of OpenBSD 1.12.
 1.25  31-Jul-2019  msaitoh Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags controllable.
 1.24  28-May-2019  msaitoh branches: 1.24.2;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.23  23-May-2019  msaitoh No functional change:
- Simplify MII structure initialization and reference.
- u_int*_t -> uint*_t.
- KNF
 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  22-Dec-2018  maxv Replace: M_COPY_PKTHDR -> m_copy_pkthdr. No functional change, since the
former is a macro to the latter.
 1.18  09-Dec-2018  jdolecek use pci_intr_establish_xname() everywhere
 1.17  26-Jun-2018  msaitoh branches: 1.17.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.16  08-Feb-2018  mrg branches: 1.16.2;
update for GCC 6:

- fix an array bounds violation and pass the right address to ether_crc32_be().

(i assume this actually makes et(4) multicast work.)
 1.15  29-Jul-2017  riastradh Check for MCLGET failure in et_newbuf.

From Ilja Van Sprundel.
 1.14  15-Dec-2016  ozaki-r branches: 1.14.8;
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.13  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.12  10-Jun-2016  ozaki-r branches: 1.12.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.11  17-Feb-2016  christos PR/50819: David Binderman: Delete dead code.
 1.10  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.9  29-Jun-2015  maxv Use-after-free.

ok christos@

Found by Brainy.
 1.8  29-Mar-2014  christos branches: 1.8.4; 1.8.6;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.7  30-Mar-2013  christos branches: 1.7.4;
remove trailing whitespace
 1.6  08-Nov-2012  dyoung Use native NetBSD macros instead of compatibility macros.

This change compiles, but I don't have an et(4) with which to test.
 1.5  29-Oct-2012  msaitoh Don't use old NBPFILTER macro and use new bpf_mtap() API.
It fixes a bug that et(4) can't use bpf.
 1.4  22-Jul-2012  matt branches: 1.4.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.3  30-Jan-2012  drochner branches: 1.3.2; 1.3.6;
Use pci_aprint_devinfo(9) instead of pci_devinfo+aprint_{normal,naive}
where it looks straightforward, and pci_aprint_devinfo_fancy in a few
others where drivers want to supply their own device names instead
of the pcidevs generated one. More complicated cases, where names
are composed at runtime, are left alone for now. It certainly makes
sense to simplify the drivers here rather than inventing a catch-all API.
This should serve as as example for new drivers, and also ensure
consistent output in the AB_QUIET ("boot -q") case. Also, it avoids
excessive stack usage where drivers attach child devices because the
buffer for the device name is not kept on the local stack anymore.
 1.2  18-May-2011  dyoung branches: 1.2.4; 1.2.8;
#include <sys/bus.h>, not <machine/bus.h>.
 1.1  13-Nov-2010  jnemeth branches: 1.1.2; 1.1.6;
PR/39094 - Kaspar Brand -- Add et (Agere ET1310/ET1301) network driver

The et(4) driver supports PCI Express Ethernet adapters based on
the Agere/LSI ET1310/ET1301 integrated MAC/PHY.

The et(4) driver was written by Sepherosa Ziehau for DragonFlyBSD,
ported to OpenBSD by Jonathan Gray and subsequently ported to NetBSD
by Kaspar Brand.
 1.1.6.3  31-May-2011  rmind sync with head
 1.1.6.2  05-Mar-2011  rmind sync with head
 1.1.6.1  13-Nov-2010  rmind file if_et.c was added on branch rmind-uvmplock on 2011-03-05 20:53:40 +0000
 1.1.2.1  06-Jun-2011  jruoho Sync with HEAD.
 1.2.8.1  18-Feb-2012  mrg merge to -current.
 1.2.4.4  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.2.4.3  16-Jan-2013  yamt sync with (a bit old) head
 1.2.4.2  30-Oct-2012  yamt sync with head
 1.2.4.1  17-Apr-2012  yamt sync with head
 1.3.6.1  18-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1474):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.3.2.2  18-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1474):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.3.2.1  19-Nov-2012  riz branches: 1.3.2.1.2;
Pull up following revision(s) (requested by msaitoh in ticket #655):
sys/dev/pci/if_et.c: revision 1.5
Don't use old NBPFILTER macro and use new bpf_mtap() API.
It fixes a bug that et(4) can't use bpf.
 1.3.2.1.2.1  18-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1474):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.4.2.4  03-Dec-2017  jdolecek update from HEAD
 1.4.2.3  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.4.2.2  23-Jun-2013  tls resync from head
 1.4.2.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.7.4.1  18-May-2014  rmind sync with head
 1.8.6.5  28-Aug-2017  skrll Sync with HEAD
 1.8.6.4  05-Feb-2017  skrll Sync with HEAD
 1.8.6.3  09-Jul-2016  skrll Sync with HEAD
 1.8.6.2  19-Mar-2016  skrll Sync with HEAD
 1.8.6.1  22-Sep-2015  skrll Sync with HEAD
 1.8.4.2  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.8.4.1  04-Aug-2015  snj branches: 1.8.4.1.2; 1.8.4.1.6;
Pull up following revision(s) (requested by maxv in ticket #914):
sys/dev/pci/if_et.c: revision 1.9
Use-after-free.
ok christos@
Found by Brainy.
 1.8.4.1.6.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.8.4.1.2.1  12-Aug-2017  snj Pull up following revision(s) (requested by mrg in ticket #1470):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.12.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.14.8.4  17-Oct-2019  martin Pull up the following revision, requested by msaitoh in ticket #1407:

sys/dev/pci/if_et.c 1.27 via patch

Fix a bug that multicast address filter doesn't work correctly.
 1.14.8.3  06-Aug-2019  martin Pull up the following revisions, requested by msaitoh in ticket #1329:

sys/dev/pci/if_etreg.h 1.2-1.3
sys/dev/pci/if_et.c 1.23,1.25 and 1.26
via patch

Make et(4) work:
- Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags
controllable.
- Enabling TX/RX in et_init() will always fail when cable is not
plugged in. If this happens, we delay TX/RX enablement until link is
up.
- Modify flow control stuff a little. It still doesn't work.
- Avoid undefined behavior when reset the chip.
- Code cleanup.
 1.14.8.2  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.14.8.1  05-Aug-2017  snj Pull up following revision(s) (requested by spz in ticket #183):
sys/dev/pci/if_et.c: revision 1.15
Check for MCLGET failure in et_newbuf.
From Ilja Van Sprundel.
 1.16.2.3  26-Jan-2019  pgoyette Sync with HEAD
 1.16.2.2  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.16.2.1  28-Jul-2018  pgoyette Sync with HEAD
 1.17.2.2  13-Apr-2020  martin Mostly merge changes from HEAD upto 20200411
 1.17.2.1  10-Jun-2019  christos Sync with HEAD
 1.24.2.2  17-Oct-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #346):

sys/dev/pci/if_et.c: revision 1.27

Fix a bug that multicast address filter doesn't work correctly.
XXX pullup-[789].
 1.24.2.1  09-Aug-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #36):

sys/dev/pci/if_et.c: revision 1.25
sys/dev/pci/if_et.c: revision 1.26
sys/dev/pci/if_etreg.h: revision 1.2
sys/dev/pci/if_etreg.h: revision 1.3

Avoid undefined behavior when reset the chip. found by kUBSan.

Add missing ifioctl_common() for SIOCSIFFLAGS to make if_flags controllable.

Make et(4) work:
- Enabling TX/RX in et_init() will always fail when cable is not plugged in,
if this happens, we delay TX/RX enablement until link is up. From FreeBSD.
- Modify flow control stuff a little (from FrerBSD). It still doesn't work.
- KNF. Part of OpenBSD 1.12.
 1.28.2.1  29-Feb-2020  ad Sync with head.
 1.32.10.1  13-May-2021  thorpej Sync with HEAD.

RSS XML Feed