Commit Graph

202 Commits

Author SHA1 Message Date
Pedro F. Giffuni
4ed3c0e713 sys: Make use of our rounddown() macro when sys/param.h is available.
No functional change.
2016-04-30 14:41:18 +00:00
Andriy Voskoboinyk
5763d9db58 wpi: convert to ieee80211_add_channel() (mostly noop).
Tested with Intel 3945BG, STA / HOSTAP modes.
2016-04-29 22:43:11 +00:00
Andriy Voskoboinyk
bc502553a6 wpi: remove unused variable. 2016-04-29 21:38:36 +00:00
Andriy Voskoboinyk
86d9f8fc65 wpi, iwn: fix check in find_eeprom_channel()
Return correct eeprom_chan structure pointer for 7, 8, 11 and 12 5Ghz
channels.
2016-04-03 14:38:26 +00:00
Andriy Voskoboinyk
abd89aa292 wpi: remove internal taskqueue
- Replace sc_reinittask() by ieee80211_restart_all() (mostly the same).
- Revert r282377 (seems to be unneeded now).

Tested with Intel 3945BG, STA mode.

Differential Revision:	https://reviews.freebsd.org/D5056
2016-03-21 23:25:41 +00:00
Andriy Voskoboinyk
1c6b43df0a wpi, iwn: implement ic_getradiocaps method
This will allow to restore channel list after switching interface
to more restrictive regdomain.

Tested with Intel 3945BG (wpi) only.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4863
2016-01-12 00:24:40 +00:00
Andriy Voskoboinyk
ce036b5148 wpi, rum and urtwn: update copyright headers
Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4489
2015-12-13 22:08:27 +00:00
Andriy Voskoboinyk
54b27b3583 wpi: ignore ic_update_promisc() call when device is not running
This change will fix kernel panic with uninitialized (zeroed)
RXON structure.

Tested with Intel 3945BG, IBSS mode.

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4304
2015-11-30 17:16:51 +00:00
Andriy Voskoboinyk
7c2e8d335d wpi(4): import r289674
Switch PCI register reads from using magic numbers to using the names
defined in pcireg.h

Approved by:	adrian (mentor)
Differential Revision:	https://reviews.freebsd.org/D4185
2015-11-16 21:55:11 +00:00
Kevin Lo
b020e15ebd Remove BUS_DMA_NOWAIT from bus_dma_tag_create() invocations as it's
no valid flag there.
2015-10-21 06:23:57 +00:00
Adrian Chadd
d957a93abe net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ieee80211_raw_output().
This doesn't free the mbuf upon error; the driver ic_raw_xmit method is still
doing that.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3774
2015-10-12 04:55:20 +00:00
Adrian Chadd
940aa8080c wpi(4): add support for TX fragmentation.
Tested:

* Tested with Intel 3945BG, HOSTAP and STA modes

Differential Revision:	https://reviews.freebsd.org/D3770
2015-10-12 04:05:12 +00:00
Adrian Chadd
f7cd3e189c wpi(4): do not count failures twice for ic_raw_xmit().
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3768
2015-10-11 02:00:08 +00:00
Adrian Chadd
823e17dbe1 wpi(4): move error handling upper (wpi_tx_data()/wpi_cmd2() -> wpi_raw_xmit()/wpi_transmit()).
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3767
2015-10-11 01:58:50 +00:00
Adrian Chadd
431ebc90bf wpi(4): fix possible race between TX/RX threads.
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3766
2015-10-11 01:56:46 +00:00
Adrian Chadd
19053a5448 wpi(4): do not allocate space for unused rings.
Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3765
2015-10-11 01:53:51 +00:00
Adrian Chadd
57c61f5d05 wpi(4): do not override iv_recv_mgmt() in non-adhoc modes.
Tested:

* Tested with Intel 3945BG, IBSS and STA modes

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3764
2015-10-11 01:50:54 +00:00
Adrian Chadd
525a3d47d8 wpi(4): use more correct types.
This change fixes some amount of -Wsign-conversion and -Wconversion warnings
and sets correct sizes for some variables (as a result, some loop counters
were touched too).

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3763
2015-10-11 01:31:18 +00:00
Adrian Chadd
fbcf1662de wpi(4): check size before transmitting frames
In addition to https://bz-attachments.freebsd.org/attachment.cgi?id=156112;
fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=144987.

Tested:

* Tested with Intel 3945BG, STA mode

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3762
2015-10-08 07:22:40 +00:00
Adrian Chadd
4c09e592e6 wpi(4): fix some byteorder conversions
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3761
2015-10-08 07:21:36 +00:00
Adrian Chadd
19ea23a08d wpi(4): fix 'maybe uninitialized' warnings
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3760
2015-10-08 07:20:22 +00:00
Adrian Chadd
859f6ddcdc wpi(4): add some branch predictions.
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3759
2015-10-08 07:18:28 +00:00
Adrian Chadd
c34db4207c wpi(4): drop unnecessary locking in wpi_set_pslevel().
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3758
2015-10-08 07:17:11 +00:00
Adrian Chadd
753ca9ef4f wpi(4): remove software queues
Use direct dispatch into the destination hardware ring instead of using
a staging queue.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3757
2015-10-08 00:52:41 +00:00
Adrian Chadd
210ab3c258 net80211: drop ieee80211_beacon_offsets parameter from ieee80211_beacon_alloc() and ieee80211_beacon_update()
Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3659
2015-10-03 22:12:25 +00:00
Adrian Chadd
bc813c40bf net80211: drop redundant 3rd parameter from iv_key_set().
The MAC can be fetched from the key struct.

I added the ndis updates to make it compile.

Submitted by:	<s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3657
2015-10-03 21:48:27 +00:00
Adrian Chadd
cc43c3e8a7 Don't duplicate checks; net80211 now does this for us.
Submitted by:	s3erios@gmail.com
2015-09-26 13:22:44 +00:00
Adrian Chadd
0cf00015be net80211: include one copy of struct ieee80211_beacon_offsets into ieee80211vap
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
Differential Revision:	https://reviews.freebsd.org/D3658
2015-09-22 06:34:07 +00:00
Gleb Smirnoff
7a79cebfba Replay r286410. Change KPI of how device drivers that provide wireless
connectivity interact with the net80211 stack.

Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.

Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:

- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
  the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
  driver about any changes: number of wlan(4) interfaces, number of them
  in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
  driver experiences errors and can not attribute them to any specific
  interface, driver updates ic_oerrors or ic_ierrors counters.

Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
  now provided by net.wlan.devices sysctl.

Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to pluknet@, Oliver Hartmann,
Olivier Cochard, gjb@, mmoll@, op@ and lev@, who also participated in
testing.

Reviewed by:	adrian
Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-08-27 08:56:39 +00:00
Adrian Chadd
2cb71df183 Convert more ifp->if_softc -> ic->ic_softc.
These should be a big no-op.

Tested:

* make universe
2015-08-17 23:44:38 +00:00
Adrian Chadd
ba2c1fbc03 Revert the wifi ifnet changes until things are more baked and tested.
* 286410
* 286413
* 286416

The initial commit broke a variety of debug and features that aren't
in the GENERIC kernels but are enabled in other platforms.
2015-08-08 01:10:17 +00:00
Gleb Smirnoff
79d2c5e857 Change KPI of how device drivers that provide wireless connectivity interact
with the net80211 stack.

Historical background: originally wireless devices created an interface,
just like Ethernet devices do. Name of an interface matched the name of
the driver that created. Later, wlan(4) layer was introduced, and the
wlanX interfaces become the actual interface, leaving original ones as
"a parent interface" of wlanX. Kernelwise, the KPI between net80211 layer
and a driver became a mix of methods that pass a pointer to struct ifnet
as identifier and methods that pass pointer to struct ieee80211com. From
user point of view, the parent interface just hangs on in the ifconfig
list, and user can't do anything useful with it.

Now, the struct ifnet goes away. The struct ieee80211com is the only
KPI between a device driver and net80211. Details:

- The struct ieee80211com is embedded into drivers softc.
- Packets are sent via new ic_transmit method, which is very much like
  the previous if_transmit.
- Bringing parent up/down is done via new ic_parent method, which notifies
  driver about any changes: number of wlan(4) interfaces, number of them
  in promisc or allmulti state.
- Device specific ioctls (if any) are received on new ic_ioctl method.
- Packets/errors accounting are done by the stack. In certain cases, when
  driver experiences errors and can not attribute them to any specific
  interface, driver updates ic_oerrors or ic_ierrors counters.

Details on interface configuration with new world order:
- A sequence of commands needed to bring up wireless DOESN"T change.
- /etc/rc.conf parameters DON'T change.
- List of devices that can be used to create wlan(4) interfaces is
  now provided by net.wlan.devices sysctl.

Most drivers in this change were converted by me, except of wpi(4),
that was done by Andriy Voskoboinyk. Big thanks to Kevin Lo for testing
changes to at least 8 drivers. Thanks to Olivier Cochard, gjb@, mmoll@,
op@ and lev@, who also participated in testing. Details here:

https://wiki.freebsd.org/projects/ifnet/net80211

Still, drivers: ndis, wtap, mwl, ipw, bwn, wi, upgt, uath were not
tested. Changes to mwl, ipw, bwn, wi, upgt are trivial and chances
of problems are low. The wtap wasn't compilable even before this change.
But the ndis driver is complex, and it is likely to be broken with this
commit. Help with testing and debugging it is appreciated.

Differential Revision:	D2655, D2740
Sponsored by:	Nginx, Inc.
Sponsored by:	Netflix
2015-08-07 11:43:14 +00:00
Gleb Smirnoff
272f6ade9b Change three methods in struct ieee80211com, namely ic_updateslot,
ic_update_mcast and ic_update_promisc, to pass pointer to the ieee80211com,
not to the ifnet.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-05-25 19:53:29 +00:00
Gleb Smirnoff
59686fe935 Set ic_softc in all 802.11 drivers. Not required right now, but will be
used quite soon.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-05-25 18:50:26 +00:00
Adrian Chadd
b66af287ad Update wpi(4) to use the new mgmt RX API. 2015-05-25 17:06:52 +00:00
Gleb Smirnoff
c8550c0278 Make net80211 drivers supply their device name to the net80211 layer, so
that the latter doesn't need to go through struct ifnet to get their name.

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2015-05-25 13:51:13 +00:00
Adrian Chadd
3077c104f5 [iwn] Do not filter control frames in monitor mode.
PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:40:12 +00:00
Adrian Chadd
a20c9aff42 Handle properly IBSS merges (works with patch from bug 199632).
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:39:44 +00:00
Adrian Chadd
5cacb17fa2 Fix various powersave races + optimize tx/rx pointer update when powersave is off.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:39:02 +00:00
Adrian Chadd
9b7cc717ed [iwn?] Use correct sequence numbers with non-QoS STAs.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:38:32 +00:00
Adrian Chadd
e43b274af6 Fix warning about comparison of integers of different signs.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:37:13 +00:00
Adrian Chadd
978d805f34 [iwn?] Fix memory leak in wpi_reset_tx_ring().
PR:		kern/197143
Differential Revision:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:36:25 +00:00
Adrian Chadd
12e0ff3b76 Use nitems() for counting elements in arrays.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:35:44 +00:00
Adrian Chadd
cbaa708073 Do not include WPI_START_SCAN event processing into non-debug builds.
PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:35:11 +00:00
Adrian Chadd
c39df5f423 Fix sequence number generation for beacon frames.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:34:24 +00:00
Adrian Chadd
6ddc7d4d45 Add debug output for WPI_BEACON_SENT event.
PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:30:04 +00:00
Adrian Chadd
6f5066748d Try to fix passive scanning hang on beacon miss.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:28:54 +00:00
Adrian Chadd
89023da2eb Add comment about AUTH -> AUTH state transition + fix some style issues.
PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:27:36 +00:00
Adrian Chadd
cf990903c7 Display more information for beacon miss debugging.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:25:33 +00:00
Adrian Chadd
5c0159195d Limit minimum threshold of missed beacons.
PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-05-03 23:24:20 +00:00