Home | History | Annotate | Download | only in dev
History log of /src/sys/arch/powerpc/ibm4xx/dev/if_emac.c
RevisionDateAuthorComments
 1.59  10-Feb-2024  andvar s/alloted/allotted/ in comments.
 1.58  02-Feb-2024  andvar fix typos, mainly s/unsupport/unsupported/ in log messages.
 1.57  18-Sep-2022  thorpej Eliminate use of IFF_OACTIVE.
 1.56  30-Mar-2021  rin Support OPB running @ 33MHz for 405GP based boards.
No need to modify EMAC_MR1 register this case
(STACR_OPBC fields are reserved for 405GP).
 1.55  27-Feb-2021  rin branches: 1.55.2;
Switch to intr_establish_xname().
 1.54  24-Jan-2021  rin Add rnd(9) support.
 1.53  06-Jul-2020  rin branches: 1.53.2;
Style and cosmetic changes. No binary changes intended.
 1.52  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.51  28-May-2019  msaitoh branches: 1.51.4;
Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.50  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.49  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.48  26-Jun-2018  msaitoh branches: 1.48.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.47  15-Dec-2016  ozaki-r branches: 1.47.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.46  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.45  10-Jun-2016  ozaki-r branches: 1.45.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.44  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.43  16-Oct-2014  snj branches: 1.43.2;
fix typo in comment
 1.42  26-Jun-2014  msaitoh Pass MIIF_DOPAUSE mask to mii_attach() in if_emac.c. emac(4) change a
register from IFM_FLOW flag, so this change is required to control the
setting via ifconfig. PR#48950. OK'd by matt@.
 1.41  22-Jul-2012  matt branches: 1.41.2; 1.41.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.40  24-Jun-2012  kiyohara Flush current empty descriptor in emac_rxeob_intr().
 1.39  18-Jun-2011  matt branches: 1.39.2;
Use <sys/foo.h> instead of <machine/foo.h> if such a file exists.
Don't assume <sys/cpu.h> includes <powerpc/subarch/cpu*.h>. Include it
explicitly.
 1.38  17-Jun-2011  matt struct device * -> device_t
struct cfdata * -> cfdata_t
split device/softc (CFATTACH_DECL_NEW)
use device_accessors and device_private
constify
 1.37  05-Apr-2010  joerg branches: 1.37.6;
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.36  18-Mar-2010  kiyohara Support PowerPC 405EX/EXr.
1. Add some new source and header files.
(MAL(split) and RGMII(new) relations for EMAC)
2. Create dcr4xx.h. Its moved from dcr405gp.h. Also remove dcr405xx.h.
3. intr.c supports MULTIUIC with virtual-irq. likes to oea.
support 32-virq/128-hwirq.
4. multiple emac support.
5. WALNUT and VIRTEX_* includes arch/powerpc/conf/files.ibm4xx.
6. WALNUT pci uses arch/powerpc/ibm4xx/pci/.
 1.35  22-Jan-2010  martin branches: 1.35.2; 1.35.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.34  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.33  08-Jul-2008  kiyohara Initialize the member sc_callout before call callout_reset().
 1.32  22-Jan-2008  he branches: 1.32.6; 1.32.10; 1.32.12; 1.32.14; 1.32.16;
Delete a now-unused local variable.
 1.31  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.30  17-Oct-2007  garbled branches: 1.30.2; 1.30.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.29  26-Aug-2007  dyoung branches: 1.29.2;
Constify.
 1.28  04-Mar-2007  christos branches: 1.28.2; 1.28.10; 1.28.14; 1.28.18;
Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.27  16-Oct-2006  kiyohara branches: 1.27.4;
do bus_space_map() to get bus space handle in emacs_attach()
 1.26  05-May-2006  thorpej branches: 1.26.8; 1.26.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.25  20-Feb-2006  thorpej branches: 1.25.2; 1.25.4; 1.25.6;
Use device_is_active() rather than testing dv_flags for DVF_ACTIVE
directly.
 1.24  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.23  11-Dec-2005  christos branches: 1.23.2; 1.23.4; 1.23.6;
merge ktrace-lwp.
 1.22  30-Jan-2005  thorpej branches: 1.22.6;
Eliminate use of M_HASFCS.
 1.21  21-Jan-2005  simonb branches: 1.21.2;
Set up last segment descriptor to send an interrupt after that
descriptor is transmitted, and bypass existing Tx descriptor reaping
method (for now...).

Fixes problems with bad NFS write performance.
 1.20  21-Jan-2005  simonb In emac_txeob_intr():
- return 1 if we processed any completed tx packets.
- try to get more packets going by calling emac_start().
 1.19  30-Oct-2004  thorpej branches: 1.19.4;
When adding/deleting multicast addresses, only whack the address
filter if the interface is marked RUNNING.

Fixes kern/27678.
 1.18  24-Mar-2004  simonb branches: 1.18.4;
Add promiscuous and multicast support.

From KIYOHARA Takashi in PR port-powerpc/23892.
 1.17  27-Oct-2003  simonb Keep bogus gcc -Wuninitialised warnings happy.
 1.16  15-Oct-2003  simonb Correct a test for setting IFF_OACTIVE on the interface.
 1.15  15-Jul-2003  lukem __KERNEL_RCSID()
 1.14  04-Jul-2003  thorpej Consult the "mac-addr" property associated with the emac device in
the dev_propdb rather than referencing board_data.
 1.13  02-Oct-2002  thorpej branches: 1.13.6;
Add trailing ; to CFATTACH_DECL.
 1.12  01-Oct-2002  thorpej Use CFATTACH_DECL().
 1.11  27-Sep-2002  thorpej Declare all cfattach structures const.
 1.10  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.9  13-Aug-2002  simonb Use the base space tag from the attach args, don't recreate it all the
time.
Clean up some include files.
 1.8  13-Aug-2002  simonb Use "ibm4xx" instead of "galaxy"; galaxy was an early code name for the
405GP.
 1.7  13-Aug-2002  simonb Fix include file location botch in previous.
 1.6  13-Aug-2002  simonb Split out device register definitions to their own files as the are
common across many of the 4xx parts. Leaves ibm405gp.h with device
address information specific to the 405GP CPU. Now allows opb.c to
support multiple 4xx CPU types.
 1.5  12-Aug-2002  simonb Reorganise the IBM 4xx bus layout, using terminology from the IBM
documentation:
- Remove "mainbus" altogether.
- The new root is "plb" - the Processor Local Bus.
- Attached to this is the "opb" - the On-chip Peripheral Bus, to which
all the on-chip devices are attached (except the cpu and pci host
bridge).
- Port-specific code can pass an array of 'struct plb_dev' to
config_rootfound() to attach extra devices to the plb. The walnut
port attaches a "pbus" (Peripheral Bus) in here for the RTC and
pc keyboard controller to attach to.
There is still much 405GP specific code; the next round of changes will
generalise this to enable easier support for other 4xx CPUs.
 1.4  09-Aug-2002  simonb Fix for when EMAC_EVENT_COUNTERS isn't defined. Problem reported by
Allen Briggs.
 1.3  09-Aug-2002  simonb Add a driver the for IBM 405gp (and possibly other IBM 4xx cpus) ethernet
MAC (emac). Much thanks to Jason Thorpe for debugging help writing this
driver. Tested on the walnut, and an earlier version of this driver works
on the OpenBlockSS.
 1.2  15-Mar-2002  eeh branches: 1.2.4;
Use new non-PCI mainbus.
 1.1  24-Jun-2001  simonb branches: 1.1.2; 1.1.8;
Move on-chip 405GP devices to powerpc/ibm4xx/dev.
 1.1.8.5  18-Oct-2002  nathanw Catch up to -current.
 1.1.8.4  27-Aug-2002  nathanw Catch up to -current.
 1.1.8.3  13-Aug-2002  nathanw Catch up to -current.
 1.1.8.2  01-Apr-2002  nathanw Catch up to -current.
(CVS: It's not just a program. It's an adventure!)
 1.1.8.1  24-Jun-2001  nathanw file if_emac.c was added on branch nathanw_sa on 2002-04-01 07:42:03 +0000
 1.1.2.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.1.2.2  06-Sep-2002  jdolecek sync kqueue branch with HEAD
 1.1.2.1  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.2.4.1  31-Aug-2002  gehenna catch up with -current.
 1.13.6.6  04-Feb-2005  skrll Sync with HEAD.
 1.13.6.5  24-Jan-2005  skrll Sync with HEAD.
 1.13.6.4  02-Nov-2004  skrll Sync with HEAD.
 1.13.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.13.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.13.6.1  03-Aug-2004  skrll Sync with HEAD
 1.18.4.1  24-Jan-2005  he Pull up revision 1.19 (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.19.4.1  29-Apr-2005  kent sync with -current
 1.21.2.1  12-Feb-2005  yamt sync with head.
 1.22.6.5  04-Feb-2008  yamt sync with head.
 1.22.6.4  21-Jan-2008  yamt sync with head
 1.22.6.3  03-Sep-2007  yamt sync with head.
 1.22.6.2  30-Dec-2006  yamt sync with head.
 1.22.6.1  21-Jun-2006  yamt sync with head.
 1.23.6.2  01-Jun-2006  kardel Sync with head.
 1.23.6.1  22-Apr-2006  simonb Sync with head.
 1.23.4.1  09-Sep-2006  rpaulo sync with head
 1.23.2.2  01-Mar-2006  yamt sync with head.
 1.23.2.1  18-Feb-2006  yamt sync with head.
 1.25.6.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.25.4.1  11-May-2006  elad sync with head
 1.25.2.1  24-May-2006  yamt sync with head.
 1.26.10.1  22-Oct-2006  yamt sync with head
 1.26.8.1  18-Nov-2006  ad Sync with head.
 1.27.4.1  12-Mar-2007  rmind Sync with HEAD.
 1.28.18.1  03-Sep-2007  jmcneill Sync with HEAD.
 1.28.14.1  03-Sep-2007  skrll Sync with HEAD.
 1.28.10.1  03-Oct-2007  garbled Sync with HEAD
 1.28.2.1  09-Oct-2007  ad Sync with head.
 1.29.2.2  23-Mar-2008  matt sync with HEAD
 1.29.2.1  06-Nov-2007  matt sync with HEAD
 1.30.8.2  23-Jan-2008  bouyer Sync with HEAD.
 1.30.8.1  20-Jan-2008  bouyer Sync with HEAD
 1.30.2.1  18-Feb-2008  mjf Sync with HEAD.
 1.32.16.1  19-Oct-2008  haad Sync with HEAD.
 1.32.14.1  18-Jul-2008  simonb Sync with head.
 1.32.12.1  18-Sep-2008  wrstuden Sync with wrstuden-revivesa-base-2.
 1.32.10.3  11-Aug-2010  yamt sync with head.
 1.32.10.2  11-Mar-2010  yamt sync with head
 1.32.10.1  04-May-2009  yamt sync with head.
 1.32.6.1  28-Sep-2008  mjf Sync with HEAD.
 1.35.4.1  30-May-2010  rmind sync with head
 1.35.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.37.6.1  23-Jun-2011  cherry Catchup with rmind-uvmplock merge.
 1.39.2.1  30-Oct-2012  yamt sync with head
 1.41.12.1  10-Aug-2014  tls Rebase.
 1.41.2.2  03-Dec-2017  jdolecek update from HEAD
 1.41.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.43.2.3  05-Feb-2017  skrll Sync with HEAD
 1.43.2.2  09-Jul-2016  skrll Sync with HEAD
 1.43.2.1  19-Mar-2016  skrll Sync with HEAD
 1.45.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.47.14.2  26-Jan-2019  pgoyette Sync with HEAD
 1.47.14.1  28-Jul-2018  pgoyette Sync with HEAD
 1.48.2.2  08-Apr-2020  martin Merge changes from current as of 20200406
 1.48.2.1  10-Jun-2019  christos Sync with HEAD
 1.51.4.1  29-Feb-2020  ad Sync with head.
 1.53.2.1  03-Apr-2021  thorpej Sync with HEAD.
 1.55.2.1  03-Apr-2021  thorpej Sync with HEAD.

RSS XML Feed