Commit Graph

359 Commits

Author SHA1 Message Date
ozaki-r edaa29b022 Fix incrementing wrong counter 2017-03-06 08:36:20 +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
maya fe2925feed appease coverity by using strlcpy instead of strncpy
ok riastradh
2017-01-14 16:34:44 +00:00
nonaka 08620666eb Export some 802.11 IE manipulate functions. 2017-01-04 03:05:24 +00:00
ozaki-r dd8638eea5 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
2016-12-15 09:28:02 +00:00
christos 9015c01fa3 PR/51540: Henning Petersen: replace , with ; 2016-10-09 14:49:51 +00:00
christos c2ec58382b - use ether_snprintf() so that we don't overwrite our buffer for printing
ethernet-like addresses
- make this compile againw without IEEE80211_DEBUG.
2016-09-27 20:20:06 +00:00
mlelstv faca41fb2b Merge enough FreeBSD code to make RT5592 work. 2016-09-16 09:25:30 +00:00
msaitoh 8bc54e5be6 KNF. Remove extra spaces. No functional change. 2016-07-07 06:55:38 +00:00
ozaki-r bdb88f5405 Get rid of invalid KASSERT
The mbuf being checked is allocated in ieee80211_getmgtframe just above,
so checking NULL of its CTX is meaningless.

Pointed out by mlelstv@
2016-06-20 08:57:18 +00:00
knakahara 69c0ff04b9 apply if_start_lock() to L2 callers which call ifp->if_start() of device derivers 2016-06-20 08:30:58 +00:00
ozaki-r cef59834c4 Use M_GETCTX and M_SETCTX instead of open-coding rcvif
No functional change.
2016-05-16 09:53:59 +00:00
mlelstv f3c013cf09 In station mode filter packets that or not for us in case the
interface is in promiscous mode or doesn't filter packets itself.
2016-05-14 13:35:40 +00:00
mlelstv 28f11d6152 Don't check sequence number on multicast packets in station mode.
Handle overflow of 12bit sequence number.
2016-05-07 12:36:50 +00:00
christos 7da1320f48 Add 80211n ht frame. 2016-04-27 20:17:00 +00:00
knakahara b76ec0b083 IFQ_ENQUEUE refactor (3/3) : eliminate pktattr argument from IFQ_ENQUEUE caller 2016-04-20 09:01:03 +00:00
knakahara 40b1061c07 IFQ_ENQUEUE refactor (2/3) : eliminate pktattr argument from altq implemantation 2016-04-20 08:58:48 +00:00
roy 111ee86de4 Revert prior. 2016-04-08 14:30:47 +00:00
roy 50101ec8fb ieee80211 users in Other OS export rssi and noise as int8_t.
We should not be the odd one out for no good reason and the majority
of the ieee80211 drivers treat rssi as int8_t.
2016-04-06 14:42:16 +00:00
ozaki-r 9c4cd06355 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!
2016-02-09 08:32:07 +00:00
dholland 1fbab01a93 More on PR 41200: headers that declare ioctls should include sys/ioccom.h.
This covers (I think) all the MI headers outside of external/ (and dist/).
2015-09-06 06:00:59 +00:00
pooka 1c4a50f192 sprinkle _KERNEL_OPT 2015-08-24 22:21:26 +00:00
pooka 76622945bf + include opt_inet.h for INET (or lack thereof)
+ include net/in_ether.h, not netinet/in_ether.h
  (did not cause a meltdown only because opt_inet.h was missing)
2015-08-24 20:58:47 +00:00
snj f0a7346d21 src is too big these days to tolerate superfluous apostrophes. It's
"its", people!
2014-10-18 08:33:23 +00:00
pooka 3eab37f7f1 Use module-compatible sysctl init instead of link sets. 2014-04-07 00:07:40 +00:00
pooka 4f6fb3bf35 Ensure that the top level sysctl nodes (kern, vfs, net, ...) exist before
the sysctl link sets are processed, and remove redundancy.

Shaves >13kB off of an amd64 GENERIC, not to mention >1k duplicate
lines of code.
2014-02-25 18:30:08 +00:00
christos db0adb91e5 fix monitor mode channel. 2014-01-25 00:59:44 +00:00
joerg 7a17852c4d GC unused functions. Don't bother building ieee80211_acl.c, nothing in
it is non-static.
2013-09-13 20:19:53 +00:00
martin 2dd911aefa Fix return value of ieee80211_ioctl_setoptie 2013-09-12 20:44:02 +00:00
christos 45ab582ccf - add m_add() that puts an mbuf to end of a chain
- m_append() and m_align() with their family
- remove parameters from prototypes
2013-06-27 17:47:18 +00:00
christos bf2739ea2c Putting extra l's in align does not make it more so. 2013-03-30 19:03:02 +00:00
christos 1f60acb650 remove trailing whitespace 2013-03-30 15:12:28 +00:00
christos f3de05fd08 Use only one set of EDCA variables 2013-03-30 14:14:30 +00:00
christos dfe8e3b0ad remove obsolete macro 2013-03-30 03:25:47 +00:00
christos db8452b16f remove trailing space 2013-03-30 03:24:55 +00:00
christos 9cea3c23f4 remove trailing whitespace. 2013-03-30 01:06:37 +00:00
christos 393b6a6372 EDCA and QOS additions from OpenBSD 2013-03-30 01:05:48 +00:00
christos 65b3d068f8 one we is enough. 2013-03-29 02:30:18 +00:00
christos f3b59d51b8 Don't hold 2 locks at the same time, causes lockdebug panic. Triggered by
running usb wifi interfaces as access points. What we do instead is check
the generation number upon restart, and if it changed we give up.
2013-03-29 02:26:45 +00:00
christos 8cd59a9591 trailing blanks police. 2013-03-29 02:20:17 +00:00
christos 8e7c71cac9 Instead of always checking for ANYC, make it a valid channel 2013-03-21 18:30:09 +00:00
christos 23b988d718 Don't attempt to dereference ANYC (since it is a pointer to 0x1).
Fixes random crashes in hostap mode (race conditions in the interrupt handler
while the interface comes up or down).
2013-03-21 17:10:25 +00:00
christos ef99903991 don't print the interface name 2ice. 2013-02-04 15:44:45 +00:00
christos 9782767422 The IEEE80211_F_ flag prefix was used for both the flags in ieee80211_var.h
and for the rates in ieee80211_proto.h; rename the rate bits as _R_ to avoid
confusion.
2013-01-10 17:40:10 +00:00
matt 5523aadff2 Set max_linkhdr when attaching so when bridging/forwarding ethernet drivers
have a chance to reserve enough space to insert a max-sized 802.11 header.
2012-11-14 18:34:05 +00:00
christos 4b1f2b81a3 add more QoS bits 2012-08-20 07:30:10 +00:00
dsl e21a34c25e Add some pre-processor magic to verify that the type of the data item
passed to sysctl_createv() actually matches the declared type for
  the item itself.
In the places where the caller specifies a function and a structure
  address (typically the 'softc') an explicit (void *) cast is now needed.
Fixes bugs in sys/dev/acpi/asus_acpi.c sys/dev/bluetooth/bcsp.c
  sys/kern/vfs_bio.c sys/miscfs/syncfs/sync_subr.c and setting
  AcpiGbl_EnableAmlDebugObject.
(mostly passing the address of a uint64_t when typed as CTLTYPE_INT).
I've test built quite a few kernels, but there may be some unfixed MD
  fallout. Most likely passing &char[] to char *.
Also add CTLFLAG_UNSIGNED for unsiged decimals - not set yet.
2012-06-02 21:36:41 +00:00
christos 42c420856f - fix offsetof usage, and redundant defines
- kill pointer casts to 0
2011-12-31 20:41:58 +00:00
tls 3afd44cf08 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.
2011-11-19 22:51:18 +00:00
dyoung 2ed4138b61 Use atomic_ops(3) to increase/decrease node reference counts, just
like the upstream code did, because the current reference counting is
potentially racy.  This works fine in light testing.
2011-10-07 16:51:45 +00:00