Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/mips/alchemy/dev/if_aumac.c
RevisionDateAuthorComments
 1.53  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.52  29-Sep-2022  skrll Remove unnecessary include of <sys/malloc.h>.
 1.51  29-Sep-2022  skrll Trailing whitespace
 1.50  18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.49  29-Sep-2020  msaitoh s/occurence/occurrence/
 1.48  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.47  28-May-2019  msaitoh branches: 1.47.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.46  23-May-2019  msaitoh No functional change:
- Simplify MII structure initialization and reference.
- u_int*_t -> uint*_t.
- KNF
 1.45  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.44  26-Jun-2018  msaitoh branches: 1.44.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.43  15-Dec-2016  ozaki-r branches: 1.43.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.42  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.41  10-Jun-2016  ozaki-r branches: 1.41.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.40  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.39  13-Apr-2015  riastradh MD rnd.h cleanups. Please let me know if I broke anything!
 1.38  10-Aug-2014  tls branches: 1.38.4;
Merge tls-earlyentropy branch into HEAD.
 1.37  22-Jul-2012  matt branches: 1.37.2; 1.37.12;
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.36  07-Jun-2012  kiyohara Fix can't assign IPv6 address. Valiable error resets to 0, if error == ENETRESET in aumac_ioctl().
 1.35  19-May-2012  kiyohara Enable interrupt in aumac_init(). And disable in aumac_stop()/aumac_attach().
Interrupt storm happen if received packet and DMA not set.
 1.34  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.33  03-Jan-2012  kiyohara Use device_t instead of 'struct device *'.
Call aprint_* in auto-config time.
 1.32  19-Nov-2011  tls branches: 1.32.2;
First step of random number subsystem rework described in
<20111022023242.BA26F14A158@mail.netbsd.org>. This change includes
the following:

An initial cleanup and minor reorganization of the entropy pool
code in sys/dev/rnd.c and sys/dev/rndpool.c. Several bugs are
fixed. Some effort is made to accumulate entropy more quickly at
boot time.

A generic interface, "rndsink", is added, for stream generators to
request that they be re-keyed with good quality entropy from the pool
as soon as it is available.

The arc4random()/arc4randbytes() implementation in libkern is
adjusted to use the rndsink interface for rekeying, which helps
address the problem of low-quality keys at boot time.

An implementation of the FIPS 140-2 statistical tests for random
number generator quality is provided (libkern/rngtest.c). This
is based on Greg Rose's implementation from Qualcomm.

A new random stream generator, nist_ctr_drbg, is provided. It is
based on an implementation of the NIST SP800-90 CTR_DRBG by
Henric Jungheim. This generator users AES in a modified counter
mode to generate a backtracking-resistant random stream.

An abstraction layer, "cprng", is provided for in-kernel consumers
of randomness. The arc4random/arc4randbytes API is deprecated for
in-kernel use. It is replaced by "cprng_strong". The current
cprng_fast implementation wraps the existing arc4random
implementation. The current cprng_strong implementation wraps the
new CTR_DRBG implementation. Both interfaces are rekeyed from
the entropy pool automatically at intervals justifiable from best
current cryptographic practice.

In some quick tests, cprng_fast() is about the same speed as
the old arc4randbytes(), and cprng_strong() is about 20% faster
than rnd_extract_data(). Performance is expected to improve.

The AES code in src/crypto/rijndael is no longer an optional
kernel component, as it is required by cprng_strong, which is
not an optional kernel component.

The entropy pool output is subjected to the rngtest tests at
startup time; if it fails, the system will reboot. There is
approximately a 3/10000 chance of a false positive from these
tests. Entropy pool _input_ from hardware random numbers is
subjected to the rngtest tests at attach time, as well as the
FIPS continuous-output test, to detect bad or stuck hardware
RNGs; if any are detected, they are detached, but the system
continues to run.

A problem with rndctl(8) is fixed -- datastructures with
pointers in arrays are no longer passed to userspace (this
was not a security problem, but rather a major issue for
compat32). A new kernel will require a new rndctl.

The sysctl kern.arandom() and kern.urandom() nodes are hooked
up to the new generators, but the /dev/*random pseudodevices
are not, yet.

Manual pages for the new kernel interfaces are forthcoming.
 1.31  10-Jul-2011  matt branches: 1.31.2;
Fix machine/ includes
 1.30  01-Jul-2011  dyoung #include <sys/bus.h> instead of <machine/bus.h>.
 1.29  12-Nov-2010  uebayasi Pull in uvm/uvm.h for VM_PAGE_TO_PHYS().
 1.28  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.27  22-Jan-2010  martin branches: 1.27.2; 1.27.4;
Unify the name of the device property to hold a MAC address - there was
no clear majority for either "mac-addr" vs. "mac-address", but a quick
gallup poll among developers selected the latter.
 1.26  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.25  20-Jan-2008  dogcow branches: 1.25.10;
kill unused variable
 1.24  19-Jan-2008  dyoung Make many ethernet drivers share the common code for MII media
handling, ether_mediastatus() and ether_mediachange(). Check for
a non-ENXIO error return from mii_mediachg(). (ENXIO indicates
that a PHY is suspended.)

This patch shrinks the source code size by 979 lines. There was
a 5100-byte savings on the NetBSD/i386 kernel configuration, ALL.

I have made a few miscellaneous changes, too:

gem(4): use LIST_EMPTY(), LIST_FOREACH().
mtd(4): handle media ioctls, for a change!
axe(4): do not track link status in sc->axe_link any longer
nfe(4), aue(4), axe(4), udav(4), url(4): do not reset all PHYs
on a change of media

Except for the change to mtd(4), no functional changes are intended.

XXX This patch affects more architectures than I can feasibly
XXX compile and run. I have compiled macppc, sparc64, i386. I
XXX have run the patches on i386 boxen with bnx(4) and sip(4).
XXX Compiling and running on evbmips (MERAKI, ADM5120) is in
XXX progress.
 1.23  17-Oct-2007  garbled branches: 1.23.2; 1.23.8;
Merge the ppcoea-renovation branch to HEAD.

This branch was a major cleanup and rototill of many of the various OEA
cpu based PPC ports that focused on sharing as much code as possible
between the various ports to eliminate near-identical copies of files in
every tree. Additionally there is a new PIC system that unifies the
interface to interrupt code for all different OEA ppc arches. The work
for this branch was done by a variety of people, too long to list here.

TODO:
bebox still needs work to complete the transition to -renovation.
ofppc still needs a bunch of work, which I will be looking at.
ev64260 still needs to be renovated
amigappc was not attempted.

NOTES:
pmppc was removed as an arch, and moved to a evbppc target.
 1.22  26-Aug-2007  dyoung branches: 1.22.2;
Constify.
 1.21  09-Jul-2007  ad branches: 1.21.4; 1.21.8;
Merge some of the less invasive changes from the vmlocking branch:

- kthread, callout, devsw API changes
- select()/poll() improvements
- miscellaneous MT safety improvements
 1.20  06-Mar-2007  simonb branches: 1.20.2; 1.20.4; 1.20.10;
Fix some caddr_t rototill fallout.
 1.19  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.18  20-Sep-2006  gdamore branches: 1.18.4;
Get rid of annoying and useless missed frame message, no other driver
echos this "non-error" message (not even tulip.c). Included is an
explanatory message stating that these counters should probably all be
converted to evcnt counters.
 1.17  05-May-2006  thorpej branches: 1.17.8; 1.17.10;
Remove the devprop API and switch everthing over to the new proplib. Add
a new device_properties() accessor for device_t that returns the device's
property dictionary.
 1.16  03-Mar-2006  simonb branches: 1.16.2; 1.16.4; 1.16.6;
Oops, missed the call to rnd_attach_source() in previous.
 1.15  03-Mar-2006  simonb Contribute to the random pool. No measurable difference to network
speeds when measured with nttcp.
 1.14  18-Feb-2006  thorpej - Don't expose dev_propdb directly -- provide devprop_*() wrappers instead.
- Rework the ARMADILLO / epe device properties interaction so that it actually
associates the MAC address property with the epe device instance.
 1.13  08-Dec-2005  yamt branches: 1.13.2; 1.13.4; 1.13.6;
use VM_PAGE_TO_PHYS macro.
 1.12  30-Oct-2004  thorpej branches: 1.12.12;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.11  04-Jul-2003  thorpej branches: 1.11.4;
Nuke the "alchemy_info" stuff, and just use the dev_propdb to set
the mac-addr property for the Au1x00 on-chip MACs.
 1.10  27-Mar-2003  simonb branches: 1.10.2;
Use "rxintr" for the name of the receive interrupts evcnt instead
of "txintr". Much less confusing that way...
 1.9  17-Jan-2003  simonb Zero out the TX buffer when padding packet to ETHER_MIN_LEN-ETHER_CRC_LEN.
 1.8  16-Jan-2003  simonb Tidy up event counter increments a little.
 1.7  16-Jan-2003  simonb Removed unused register map; this info is now passed in with the attach
args.
 1.6  02-Oct-2002  thorpej Add trailing ; to CFATTACH_DECL.
 1.5  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.4  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.3  27-Sep-2002  thorpej Rather than referencing the cfdriver directly in the cfdata entries,
instead use a string naming the driver. The cfdriver is then looked
up in a list which is built at run-time.
 1.2  29-Jul-2002  simonb branches: 1.2.2; 1.2.4; 1.2.6;
Remove some debug code accidently left in.
 1.1  29-Jul-2002  simonb Add support for the the Alchemy Semiconductor Au1x00 series on-chip
devices. Currently the serial ports and ethernet MAC have working
drivers, and this has only been physically tested on the Au1000 CPU,
but these devices should work on the Au1100 and Au1500 CPUs too.
 1.2.6.3  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.2.6.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.2.6.1  29-Jul-2002  jdolecek file if_aumac.c was added on branch kqueue on 2002-09-06 08:37:24 +0000
 1.2.4.2  31-Aug-2002  gehenna catch up with -current.
 1.2.4.1  29-Jul-2002  gehenna file if_aumac.c was added on branch gehenna-devsw on 2002-08-31 13:45:15 +0000
 1.2.2.3  17-Jan-2003  thorpej Sync with HEAD.
 1.2.2.2  18-Oct-2002  nathanw Catch up to -current.
 1.2.2.1  29-Jul-2002  nathanw file if_aumac.c was added on branch nathanw_sa on 2002-10-18 02:38:43 +0000
 1.10.2.5  11-Dec-2005  christos Sync with head.
 1.10.2.4  02-Nov-2004  skrll Sync with HEAD.
 1.10.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.10.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.10.2.1  03-Aug-2004  skrll Sync with HEAD
 1.11.4.1  24-Jan-2005  he Pull up revision 1.12 (requested by thorpej in ticket #939):
When adding or deleting multicast addresses, only change
the address filter if the interface is marked RUNNING.
Fixes PR#27678.
 1.12.12.4  21-Jan-2008  yamt sync with head
 1.12.12.3  03-Sep-2007  yamt sync with head.
 1.12.12.2  30-Dec-2006  yamt sync with head.
 1.12.12.1  21-Jun-2006  yamt sync with head.
 1.13.6.2  01-Jun-2006  kardel Sync with head.
 1.13.6.1  22-Apr-2006  simonb Sync with head.
 1.13.4.1  09-Sep-2006  rpaulo sync with head
 1.13.2.1  18-Feb-2006  yamt sync with head.
 1.16.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.16.4.1  11-May-2006  elad sync with head
 1.16.2.1  24-May-2006  yamt sync with head.
 1.17.10.1  22-Oct-2006  yamt sync with head
 1.17.8.1  18-Nov-2006  ad Sync with head.
 1.18.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.20.10.1  03-Oct-2007  garbled Sync with HEAD
 1.20.4.1  11-Jul-2007  mjf Sync with head.
 1.20.2.2  09-Oct-2007  ad Sync with head.
 1.20.2.1  15-Jul-2007  ad Sync with head.
 1.21.8.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.21.4.1  03-Sep-2007  skrll Sync with HEAD.
 1.22.2.2  23-Mar-2008  matt sync with HEAD
 1.22.2.1  06-Nov-2007  matt sync with HEAD
 1.23.8.1  20-Jan-2008  bouyer Sync with HEAD
 1.23.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.25.10.2  11-Aug-2010  yamt sync with head.
 1.25.10.1  11-Mar-2010  yamt sync with head
 1.27.4.2  05-Mar-2011  rmind sync with head
 1.27.4.1  30-May-2010  rmind sync with head
 1.27.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.31.2.3  30-Oct-2012  yamt sync with head
 1.31.2.2  23-May-2012  yamt sync with head.
 1.31.2.1  17-Apr-2012  yamt sync with head
 1.32.2.2  02-Jun-2012  mrg sync to latest -current.
 1.32.2.1  18-Feb-2012  mrg merge to -current.
 1.37.12.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.37.2.2  03-Dec-2017  jdolecek update from HEAD
 1.37.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.38.4.4  05-Feb-2017  skrll Sync with HEAD
 1.38.4.3  09-Jul-2016  skrll Sync with HEAD
 1.38.4.2  19-Mar-2016  skrll Sync with HEAD
 1.38.4.1  06-Jun-2015  skrll Sync with HEAD
 1.41.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.43.14.2  26-Jan-2019  pgoyette Sync with HEAD
 1.43.14.1  28-Jul-2018  pgoyette Sync with HEAD
 1.44.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.44.2.1  10-Jun-2019  christos Sync with HEAD
 1.47.4.1  29-Feb-2020  ad Sync with head.

RSS XML Feed