Home | History | Annotate | Download | only in pci
History log of /src/sys/dev/pci/if_cas.c
RevisionDateAuthorComments
 1.48  29-Jun-2024  riastradh if_stats(9): Add ifp argument to if_stat..._ref.

This will enable us to pass the ifp through to a dtrace probe inside.

No functional change intended in this change, but this is an API
change visible to modules so it shouldn't be pulled up.

PR kern/58377
 1.47  24-Sep-2022  thorpej Remove unnecessary include of <sys/malloc.h>.
 1.46  30-May-2021  joerg Unindent code to match the logical structure, ignoring the commented out if.

This code should be rewritten to use BUS_DMA_WAITOK, but that's a
project of its own.
 1.45  08-May-2021  thorpej branches: 1.45.2;
Use pci_compatible_match().
 1.44  15-Sep-2020  mrg branches: 1.44.6;
mii_detach() must come before ifmedia_fini(), otherwise mii_detach()
will have a NULL mutex and fault.

this appears to have been introduced in february, and may be a problem
in other drivers converted to use ifmedia_fini(). i've only fixed the
two that were faulting for me on sunblade 2000 during reboot.
 1.43  02-Jul-2020  msaitoh prop_data_data_nocopy -> prop_data_value
 1.42  08-Mar-2020  thorpej Use BUS_ADDR_{HI,LO}32().
 1.41  01-Mar-2020  thorpej Use the 64-bit PCI DMA tag if avalable.
 1.40  07-Feb-2020  thorpej Use callout_setfunc() / callout_schedule().
 1.39  04-Feb-2020  thorpej Use ifmedia_fini().
 1.38  30-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.37  26-Dec-2019  msaitoh branches: 1.37.2;
Fix a bug that the driver sometimes incorrectly attach gentbi(4) instead of
gphyter(4) on non-fiber device.

Tested with Sun Quad GigaSwift Ethernet UTP (QGE) (part no. 501-6522) on
amd64. On this environment, the problem frequently had occurred. I also
tested with other 4 cas(4) variants.
 1.36  21-Nov-2019  msaitoh Fix a bug that IFF_ALLMULTI is almost always set.

OpenBSD's ac_multirangecnt is not NetBSD's ec_multicnt.
 1.35  28-May-2019  msaitoh branches: 1.35.2;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.34  23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.33  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.32  06-Feb-2019  msaitoh Fix a bug that all ports' MAC address become the last port's address on
Non-OF environment.

The Saturn multi port card has only one VPD ROM and all ports share it.
If the card has four port, it has four "local-mac-address" entries.
Before this commit, the code keep the last one and use it for all ports.
The Saturn four port card has three bridge.

e.g.
 1.31  05-Feb-2019  msaitoh Remove very old IFF_NOTRAILERS flag.
 1.30  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.29  09-Dec-2018  jdolecek use pci_intr_establish_xname() everywhere
 1.28  15-Nov-2018  maxv Remove the 'copy' argument from m_devget(), unused. While here rename
off0->off.
 1.27  26-Jun-2018  msaitoh branches: 1.27.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.26  15-Dec-2016  ozaki-r branches: 1.26.8; 1.26.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.25  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.24  09-Feb-2016  ozaki-r branches: 1.24.2;
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.23  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.22  10-Aug-2014  tls branches: 1.22.4;
Merge tls-earlyentropy branch into HEAD.
 1.21  29-Mar-2014  christos branches: 1.21.2;
make pci_intr_string and eisa_intr_string take a buffer and a length
instead of relying in local static storage.
 1.20  13-Sep-2013  martin Remove unused variables
 1.19  30-Mar-2013  christos branches: 1.19.4;
remove trailing whitespace
 1.18  22-Jul-2012  matt branches: 1.18.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.17  03-Feb-2012  martin Add missing <sys/rnd.h> include, ack: jdc@
 1.16  02-Feb-2012  tls Entropy-pool implementation move and cleanup.

1) Move core entropy-pool code and source/sink/sample management code
to sys/kern from sys/dev.

2) Remove use of NRND as test for presence of entropy-pool code throughout
source tree.

3) Remove use of RND_ENABLED in device drivers as microoptimization to
avoid expensive operations on disabled entropy sources; make the
rnd_add calls do this directly so all callers benefit.

4) Fix bug in recent rnd_add_data()/rnd_add_uint32() changes that might
have lead to slight entropy overestimation for some sources.

5) Add new source types for environmental sensors, power sensors, VM
system events, and skew between clocks, with a sample implementation
for each.

ok releng to go in before the branch due to the difficulty of later
pullup (widespread #ifdef removal and moved files). Tested with release
builds on amd64 and evbarm and live testing on amd64.
 1.15  30-Jan-2012  drochner 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.14  29-Aug-2011  jmcneill branches: 1.14.2; 1.14.6;
have pci register itself as a module, and make PCI driver modules depend on it
 1.13  07-Jan-2011  jmcneill support building cas(4) as a module
 1.12  13-Nov-2010  uebayasi Don't pull in the whole uvm(9) API to access only PAGE_SIZE and
some other constants. These are provided by sys/param.h now.
 1.11  14-Jul-2010  jnemeth When searching PROM data to get a MAC address, search for National
Semiconductor Saturn data as well as Sun Cassini data.
 1.10  14-Jul-2010  jnemeth Don't leak kernel stack data when an enaddr can't be found.
 1.9  17-Jun-2010  mrg disable interrupts when resetting the device.
 1.8  05-Apr-2010  joerg 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.7  11-Mar-2010  mrg branches: 1.7.2; 1.7.4;
various aprint_* fixes.
 1.6  24-Feb-2010  dyoung 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.
 1.5  22-Jan-2010  jdc branches: 1.5.2;
Remove port-specific code for determining MAC address, and use device
properties instead (c.f. gem(4) and hme(4)).
 1.4  19-Jan-2010  pooka 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.3  17-Jan-2010  jdc Mask out (disable) cas interrupts on detach and suspend.
(Re-)enable interrupts on resume.
 1.2  09-Jan-2010  martin adapt to recent pmf changes
 1.1  07-Jan-2010  jdc Driver for Sun Cassini/Cassini+ (GigaSwift) Ethernet (also known as
National Semiconductor Saturn).
Based on the OpenBSD driver written by Mark Kettenis:
detach support added
MAC address lookup modified (only tested on sparc64)

Tested on single GigaSwift (UTP and MMF) and quad GigaSwift PCI cards.
 1.5.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.5.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.7.4.3  05-Mar-2011  rmind sync with head
 1.7.4.2  03-Jul-2010  rmind sync with head
 1.7.4.1  30-May-2010  rmind sync with head
 1.7.2.3  11-Aug-2010  yamt sync with head.
 1.7.2.2  11-Mar-2010  yamt sync with head
 1.7.2.1  11-Mar-2010  yamt file if_cas.c was added on branch yamt-nfs-mp on 2010-03-11 15:03:45 +0000
 1.14.6.1  18-Feb-2012  mrg merge to -current.
 1.14.2.3  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.14.2.2  30-Oct-2012  yamt sync with head
 1.14.2.1  17-Apr-2012  yamt sync with head
 1.18.2.3  03-Dec-2017  jdolecek update from HEAD
 1.18.2.2  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.18.2.1  23-Jun-2013  tls resync from head
 1.19.4.1  18-May-2014  rmind sync with head
 1.21.2.1  07-Apr-2014  tls Be a little more clear and consistent about harvesting entropy from devices:

1) deprecate RND_FLAG_NO_ESTIMATE

2) define RND_FLAG_COLLECT_TIME, RND_FLAG_COLLECT_VALUE

3) define RND_FLAG_ESTIMATE_TIME, RND_FLAG_ESTIMATE_VALUE

4) define RND_FLAG_DEFAULT: RND_FLAG_COLLECT_TIME|
RND_FLAG_COLLECT_VALUE|RND_FLAG_ESTIMATE_TIME

5) Make entropy harvesting from environmental sensors a little more generic
and remove it from individual sensor drivers.

6) Remove individual open-coded delta-estimators for values from a few
places in the tree (uvm, environmental drivers).

7) 0 -> RND_FLAG_DEFAULT, actually gather entropy from various drivers
that had stubbed out code, other minor cleanups.
 1.22.4.3  05-Feb-2017  skrll Sync with HEAD
 1.22.4.2  19-Mar-2016  skrll Sync with HEAD
 1.22.4.1  06-Jun-2015  skrll Sync with HEAD
 1.24.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.26.14.4  26-Jan-2019  pgoyette Sync with HEAD
 1.26.14.3  26-Dec-2018  pgoyette Sync with HEAD, resolve a few conflicts
 1.26.14.2  26-Nov-2018  pgoyette Sync with HEAD, resolve a couple of conflicts
 1.26.14.1  28-Jul-2018  pgoyette Sync with HEAD
 1.26.8.1  05-Dec-2019  bouyer Pull up following revision(s) (requested by msaitoh in ticket #1464):
sys/dev/pci/if_alc.c 1.44 via patch
sys/dev/pci/if_ale.c 1.35-1.36 via patch
sys/dev/pci/if_cas.c 1.36 via patch
- Fix a bug that IFF_ALLMULTI is almost always set.
- Whitespace fixes.
 1.27.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.27.2.1  10-Jun-2019  christos Sync with HEAD
 1.35.2.2  21-Jan-2020  martin Pull up following revision(s) (requested by msaitoh in ticket #626):

sys/arch/amd64/conf/GENERIC: revision 1.552
sys/dev/pci/if_casreg.h: revision 1.2
sys/dev/pci/if_cas.c: revision 1.37
share/man/man4/cas.4: revision 1.4
sys/dev/pci/if_casvar.h: revision 1.7

Update supported device list with part number. From FreeBSD.

Fix a bug that the driver sometimes incorrectly attach gentbi(4) instead of
gphyter(4) on non-fiber device.

Tested with Sun Quad GigaSwift Ethernet UTP (QGE) (part no. 501-6522) on
amd64. On this environment, the problem frequently had occurred. I also
tested with other 4 cas(4) variants.

Add cas(4).
 1.35.2.1  26-Nov-2019  martin Pull up following revision(s) (requested by msaitoh in ticket #483):

sys/dev/pci/if_cas.c: revision 1.36
sys/dev/pci/if_alc.c: revision 1.44
sys/dev/pci/if_ale.c: revision 1.35
sys/dev/pci/if_ale.c: revision 1.36
sys/dev/pci/if_age.c: revision 1.64

Fix a bug that IFF_ALLMULTI is almost always set.
OpenBSD's ac_multirangecnt is not NetBSD's ec_multicnt.

Remove accidentally committed debug code. Sorry.
 1.37.2.1  29-Feb-2020  ad Sync with head.
 1.44.6.2  17-Jun-2021  thorpej Sync w/ HEAD.
 1.44.6.1  13-May-2021  thorpej Sync with HEAD.
 1.45.2.1  31-May-2021  cjep sync with head

RSS XML Feed