Home | History | Annotate | Download | only in ic
History log of /src/sys/dev/ic/lan9118.c
RevisionDateAuthorComments
 1.36  29-Jan-2020  thorpej Adopt <net/if_stats.h>.
 1.35  30-May-2019  msaitoh branches: 1.35.4;
Simplify MII structure initialization and reference. No functional change.
 1.34  28-May-2019  msaitoh Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*.
 1.33  23-May-2019  msaitoh Whitespace fix (mainly tabify).
 1.32  23-May-2019  msaitoh -No functional change:
- KNF
- u_int*_t -> uint*_t.
 1.31  23-Apr-2019  msaitoh Fix compile error.
 1.30  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.29  22-Jan-2019  jmcneill Fix return type of lan9118_mii_readreg
 1.28  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.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  02-Jun-2017  jmcneill branches: 1.26.8;
Trigger a software interrupt if any packets were transmitted in
lan9118_start to workaround a possible issue where completion interrupts
are missed and the watchdog timer fires.
 1.25  01-Jun-2017  jmcneill Add flags to control IRQ polarity and buffer type. These can be set by
the bus glue to switch to active high and/or push-pull configurations.
 1.24  20-Feb-2017  ozaki-r Apply deferred if_start to more drivers
 1.23  15-Dec-2016  ozaki-r branches: 1.23.2;
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.22  10-Jun-2016  ozaki-r branches: 1.22.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.21  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.20  20-Apr-2015  kiyohara Backout r1.18.
Don't change IRQ porality. The Real-machines encounters interrupt storm.
OK slp@.

I assum configured it from boot-loader already. However need polarity
information, if not. Shall we implement to use prop_dictionary_{set,get}?

Also this case, re-initialized to LAN9118_IRQ_CFG without
LAN9118_IRQ_CFG_POL in lan9118_init(). I think, again interrupt storm on
QEMU.
 1.19  13-Apr-2015  riastradh Convert sys/dev to use <sys/rndsource.h>.
 1.18  09-Feb-2015  slp Configure interrupt polarity before enabling PHY.

This prevents a interrupt storm when running under QEMU.
 1.17  10-Aug-2014  tls branches: 1.17.4;
Merge tls-earlyentropy branch into HEAD.
 1.16  22-Jul-2012  matt branches: 1.16.2; 1.16.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.15  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.14  05-Apr-2010  joerg branches: 1.14.8; 1.14.12;
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.13  19-Jan-2010  pooka branches: 1.13.2; 1.13.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.12  20-Dec-2009  kiyohara Set filter at lan9118_init() and lan9118_ioctl with SIOCSIFFLAGS.
 1.11  06-Dec-2009  kiyohara Split internal phy. We can use ukphy(4).
SMSC manufactures some PHY. This PHY is built into LAN9x18 Family.
 1.10  02-Dec-2009  kiyohara Maybe supported LAN9218 Family.
 1.9  29-Nov-2009  kiyohara Fix "+ 0x100" instead of "| 0x100" in the case ID 0x11[5678]A.
 1.8  29-Nov-2009  kiyohara Change print messages.
1. Use aprint instead of DPRINTF in swap mode.
2. Locates and vendor/LSI names 1-line print.
3. Also print (and maybe support) LAN92xx.
 1.7  29-Nov-2009  kiyohara Set mii_media_active in lan9118_ifm_change(). This is like ukphy_status().
Also LAN9118_TXS_NC is valid when if FDX.
 1.6  29-Nov-2009  kiyohara Fix register access to MII in lan9118_mii_readreg()/lan9118_mii_writereg().
 1.5  28-Nov-2009  kiyohara Comment out interrupt for LAN9118_INT_PHY_INT and LAN9118_INT_PME_INT. These
not support yet...
 1.4  28-Nov-2009  kiyohara Check mbuf size and buffers.
 1.3  28-Nov-2009  kiyohara Support mii_tick().
Thanks tsubai@.
 1.2  23-Nov-2009  kiyohara - Wait the ready 5sec, not 5msec.
- Set IFM_ACTIVE to ifm_status instead of ifm_active. ifconfig(8) always said
'no carrier'...
 1.1  09-Aug-2009  kiyohara branches: 1.1.2;
Support SMSC LAN9118 Family Ethernet interfaces device driver.
It tested on GUMSTIX only.
 1.1.2.4  11-Aug-2010  yamt sync with head.
 1.1.2.3  11-Mar-2010  yamt sync with head
 1.1.2.2  19-Aug-2009  yamt sync with head.
 1.1.2.1  09-Aug-2009  yamt file lan9118.c was added on branch yamt-nfs-mp on 2009-08-19 18:47:07 +0000
 1.13.4.1  30-May-2010  rmind sync with head
 1.13.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.14.12.1  18-Feb-2012  mrg merge to -current.
 1.14.8.2  30-Oct-2012  yamt sync with head
 1.14.8.1  17-Apr-2012  yamt sync with head
 1.16.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.16.2.2  03-Dec-2017  jdolecek update from HEAD
 1.16.2.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.17.4.6  28-Aug-2017  skrll Sync with HEAD
 1.17.4.5  05-Feb-2017  skrll Sync with HEAD
 1.17.4.4  09-Jul-2016  skrll Sync with HEAD
 1.17.4.3  19-Mar-2016  skrll Sync with HEAD
 1.17.4.2  06-Jun-2015  skrll Sync with HEAD
 1.17.4.1  06-Apr-2015  skrll Sync with HEAD
 1.22.2.2  20-Mar-2017  pgoyette Sync with HEAD
 1.22.2.1  07-Jan-2017  pgoyette Sync with HEAD. (Note that most of these changes are simply $NetBSD$
tag issues.)
 1.23.2.1  21-Apr-2017  bouyer Sync with HEAD
 1.26.8.2  26-Jan-2019  pgoyette Sync with HEAD
 1.26.8.1  28-Jul-2018  pgoyette Sync with HEAD
 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.4.1  29-Feb-2020  ad Sync with head.

RSS XML Feed