Commit Graph

1454 Commits

Author SHA1 Message Date
thorpej
4947e861f2 Use ifmedia_fini(). 2020-02-04 05:44:14 +00:00
thorpej
c22abb987d - Adopt <net/if_stats.h>.
- Use ifmedia_fini().
2020-02-02 05:56:42 +00:00
thorpej
2d501ecfdc Adopt <net/if_stats.h>. 2020-01-29 13:54:41 +00:00
thorpej
ed469c22d6 Remove Token Ring support. 2020-01-19 20:00:35 +00:00
msaitoh
af30e39a49 Protect ec_multicnt. 2020-01-06 07:15:03 +00:00
msaitoh
3d490413f9 s/enty/entry/ in comment. 2019-12-27 08:01:58 +00:00
maxv
8d129e6ebf localify 2019-12-06 07:12:38 +00:00
maxv
28885f8e61 localify 2019-11-28 17:09:10 +00:00
msaitoh
6565c0bf2b Add missing initialization of sc_dev. 2019-11-12 13:17:43 +00:00
chs
d47bcd296c in many device attach paths, allocate memory with M_WAITOK instead of M_NOWAIT
and remove code to handle failures that can no longer happen.
2019-11-10 21:16:21 +00:00
msaitoh
ac1b2f144b ether_input() automatically add input bytes to if_ibytes, so it's not
required to do in the driver who use ether_input().
2019-10-30 10:12:37 +00:00
msaitoh
26dc6040af if_percpuq(9) automatically increments if_ipackets, so don't increment it in
the driver itself to prevent double count.
2019-10-21 08:22:06 +00:00
kre
18b8ffb209 Delete unused var (made redundant in previous commit). Unbreak build. 2019-10-11 04:25:11 +00:00
bad
8447452dd6 if we can memcpy to body->macaddr, we can memcpy from it. 2019-10-10 23:37:13 +00:00
mrg
2d65b962bb add missing break.
(this code is fun.  it has switch inside switch, and both switches
have two cases, one with an identifier and one with a magic number.)
2019-10-05 01:35:26 +00:00
mlelstv
2116a4cb58 add PCMCIA_CISTPL_SDIO definition. 2019-09-01 00:36:52 +00:00
msaitoh
39c3181ae1 s/recieve/receive/ 2019-05-28 08:59:33 +00:00
msaitoh
8375928380 Use ETHER_LOCK()/ETHER_UNLOCK() for all ethernet drivers to protect ec_multi*. 2019-05-28 07:41:46 +00:00
msaitoh
5542e458a9 Whitespace fix (mainly tabify). 2019-05-23 13:10:50 +00:00
msaitoh
c34bdbc550 -No functional change:
- KNF
  - u_int*_t -> uint*_t.
2019-05-23 10:57:27 +00:00
msaitoh
811add33d1 No functional change:
- Simplify MII structure initialization and reference.
 - u_int*_t -> uint*_t.
 - KNF
2019-05-23 10:51:38 +00:00
msaitoh
242bcfcd2e These drivers do ether_ioctl() on SIOC{ADD,DEL}MULTI, SIOC{G,S}IFMEDIA and
default case in the switch statement. Only the default case didn't check the
return value with ENETRESET. Integrate them to one ether_ioctl() with
ENETRESET test. This change might improve some other ioctl()s which return
ENETRESET by calling if_init().
2019-04-22 08:36:03 +00:00
msaitoh
46cd7acc3a s/pcmica/pcmcia/ 2019-04-06 04:52:44 +00:00
msaitoh
84347dba43 Centralize ETHER_ALIGN into net/if_ether.h. Note that this commit also changes
if_upgt.c's ETHER_ALIGN from 0 to 2.
2019-03-05 08:25:01 +00:00
msaitoh
091e15265d Remove very old IFF_NOTRAILERS flag. 2019-02-05 06:17:00 +00:00
mrg
fbffadb9f8 - add or adjust /* FALLTHROUGH */ where appropriate
- add __unreachable() after functions that can return but won't in
  this case, and thus can't be marked __dead easily
2019-02-03 03:19:25 +00:00
msaitoh
a5cdd4b441 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
2019-01-22 03:42:24 +00:00
msaitoh
fc10441db4 u_int{8,16,32}_t -> uint{8,16,32}_t. No functional change. 2019-01-08 08:52:46 +00:00
msaitoh
b0cab1f2c7 Whitespace fix. 2019-01-08 08:47:21 +00:00
thorpej
6d4870476f Clean up initialization of com_regs structure, in preparation for
some additional changers.
2018-12-08 17:46:09 +00:00
maxv
ec3805d3b8 Remove the 'copy' argument from m_devget(), unused. While here rename
off0->off.
2018-11-15 10:56:29 +00:00
maxv
89453def58 Remove isic(4). It is part of ISDN, which we are now retiring. 2018-09-22 16:22:22 +00:00
riastradh
d1579b2d70 Rename min/max -> uimin/uimax for better honesty.
These functions are defined on unsigned int.  The generic name
min/max should not silently truncate to 32 bits on 64-bit systems.
This is purely a name change -- no functional change intended.

HOWEVER!  Some subsystems have

	#define min(a, b)	((a) < (b) ? (a) : (b))
	#define max(a, b)	((a) > (b) ? (a) : (b))

even though our standard name for that is MIN/MAX.  Although these
may invite multiple evaluation bugs, these do _not_ cause integer
truncation.

To avoid `fixing' these cases, I first changed the name in libkern,
and then compile-tested every file where min/max occurred in order to
confirm that it failed -- and thus confirm that nothing shadowed
min/max -- before changing it.

I have left a handful of bootloaders that are too annoying to
compile-test, and some dead code:

cobalt ews4800mips hp300 hppa ia64 luna68k vax
acorn32/if_ie.c (not included in any kernels)
macppc/if_gm.c (superseded by gem(4))

It should be easy to fix the fallout once identified -- this way of
doing things fails safe, and the goal here, after all, is to _avoid_
silent integer truncations, not introduce them.

Maybe one day we can reintroduce min/max as type-generic things that
never silently truncate.  But we should avoid doing that for a while,
so that existing code has a chance to be detected by the compiler for
conversion to uimin/uimax without changing the semantics until we can
properly audit it all.  (Who knows, maybe in some cases integer
truncation is actually intended!)
2018-09-03 16:29:22 +00:00
msaitoh
3cd62456f9 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.
2018-06-26 06:47:57 +00:00
msaitoh
313477deff Simplify bpf_mtap() call. No functional change. 2018-06-25 09:57:25 +00:00
msaitoh
4b508fb16e It's not required to include net/bpfdesc.h. Remove it. 2018-06-22 04:17:40 +00:00
sevan
842cda659d regen 2018-03-16 01:58:42 +00:00
sevan
2c814d8971 Add 3Com Wireless Bluetooth PC Card (version 3.0) 3CRWB6096B 2018-03-16 01:49:15 +00:00
sevan
8721565795 typo 2018-03-16 00:56:28 +00:00
dholland
32cded6cc9 Typos. 2018-02-08 09:05:16 +00:00
maxv
ebdef72071 Fix memory leak, looks like there is still something wrong here. 2018-01-22 14:40:53 +00:00
christos
b224e68c31 adjust for printf signature. 2017-12-09 00:53:55 +00:00
christos
4a1f5c48a9 coalesce the two copies of hexdump into libkern 2017-12-08 21:51:07 +00:00
msaitoh
35096a90e3 If error occured in the attach function, free resources and return. 2017-10-23 09:24:34 +00:00
jdolecek
62fb613155 move ata_queue_alloc(1) and ata_queue_free() calls to ata_channel_init()
and ata_channel_destroy() respectively, to make attachment code simpler,
and to make it easier to spot special queue manipulation like cmdide(4)

on topic of PR kern/52606
2017-10-20 07:06:05 +00:00
jdolecek
26cf68556f Merge support for SATA NCQ (Native Command Queueing) from jdolecek-ncq branch
ATA subsystem was changed to support several outstanding commands, and use
NCQ xfers if supported by both the controller and the disk, including NCQ
error recovery. Set NCQ high priority for BPRIO_TIMECRITICAL xfers
if supported. Added FUA support.

Done some work towards MP-safe, all ATA code tsleep()/wakeup() replaced
by condvars, and switched most code from spl* to mutexes (separate
wd(4) and ata channel lock).

Introduced new option WD_CHAOS_MONKEY to facilitate testing of error
handling, fixed several uncovered issues. Also fixed several problems
with kernel dump to wd(4) disk.

Tested with ahcisata(4), mvsata(4), siisata(4), piixide(4) on amd64,
with and without port multiplier, both disk and ATAPI devices; other
drivers and archs mechanically adjusted and compile-tested. NCQ is
supported for ahcisata(4) and siisata(4) for any controller, for
mvsata(4) only Gen IIe ones for now. Also enabled ATAPI support in
mvsata(4).

Thanks to Matt Thomas for initial ATA infrastructure patch, and
Jonathan A.Kollasch for siisata(4) NCQ changes and general testing.

Also fixes PR kern/43169 (wd(4)); and PR kern/11811, PR kern/47041,
PR kern/51979 (kernel dump)
2017-10-07 16:05:31 +00:00
christos
2ed5654a9c From bjoern johannesson, in netbsd-general... Reset the mask to 0, used to
be 0xa. Is it wrong in the cfe? Should this better be done via a quirk?
2017-08-01 12:15:21 +00:00
maxv
5d59d12047 two spl leaks, found by Mootja 2017-06-25 12:25:02 +00:00
christos
1a4bdd5296 remove my copyright. 2017-06-03 14:46:29 +00:00
nonaka
5ffb0503f3 wlan interfaces make interrupt routine running on softint context.
see http://mail-index.netbsd.org/tech-kern/2016/12/06/msg021281.html

tested device:
 * ath at pci: AR5212, AR5424
 * athn at pci: AR9287
 * ipw at pci: 2100BG
 * iwi at pci: 2915ABG
 * iwm at pci: 3165, 7260, 8260
 * iwn at pci: 4945, 6235
 * ral at pci: RT2560
 * rtwn at pci: RTL8192CE
2017-02-02 10:05:35 +00:00