Commit Graph

88 Commits

Author SHA1 Message Date
Adrian Chadd
45ac43f30f Use ring->queued for WPI_CMD_TX_DATA only.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:43:22 +00:00
Adrian Chadd
10550f6135 Move some code under WPI_LOCK().
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:42:41 +00:00
Adrian Chadd
0b093122eb Remove unnecessary locking.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:41:57 +00:00
Adrian Chadd
ff62db1d9d Eliminate the WPI_FLAG_BUSY flag.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:40:59 +00:00
Adrian Chadd
63f576999e Add separate lock for TX queues.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:40:11 +00:00
Adrian Chadd
0ebca24555 Wrap node addition in STA mode into wpi_add_sta_node().
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:35:25 +00:00
Adrian Chadd
eca2eb395c Replace kernel unit allocator with local set of functions.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:34:26 +00:00
Adrian Chadd
f15520d9b0 Move key processing in wpi_tx_data.
(This is in preparation for further work to support hardware encryption.)

PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:33:13 +00:00
Adrian Chadd
f319a41c66 Remove some un-needed variables.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:32:12 +00:00
Adrian Chadd
7167f5fc02 Reformatting - break lines ~ 80 characters.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:31:21 +00:00
Adrian Chadd
7f1299c5cd wpi_intr(): remove duplicate code
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:30:03 +00:00
Adrian Chadd
8e4cf38ac7 Replace few numbers with named constants.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:29:22 +00:00
Adrian Chadd
a5e093b0e0 Wrap cast to (struct wpi_node *) into WPI_NODE macros
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:23:58 +00:00
Adrian Chadd
76fdf7eb35 msleep() -> mtx_sleep()
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:22:16 +00:00
Adrian Chadd
cb0de40f2a Fix warning: Value stored to 'supportsa' is never read.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:21:30 +00:00
Adrian Chadd
96dadeb0aa Fix error handling in wpi_scan().
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:20:43 +00:00
Adrian Chadd
bb086d4e83 Fix indentation - non-functional change.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:19:54 +00:00
Adrian Chadd
ebf62e08fb Check some variables only on active TX rings
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:19:01 +00:00
Adrian Chadd
5f25a0e970 Use correct pointer for wpi_softc
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:18:09 +00:00
Adrian Chadd
01729242e5 Fix panics in wpi_tx_done() when powersave is enabled
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:17:25 +00:00
Adrian Chadd
71258eb207 Fix races between wpi_rx_done() and wpi_stop()
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:15:10 +00:00
Adrian Chadd
e336bd5499 Divide ackfailcnt by 2 (firmware decreases rate after two unsuccessful retries)
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:13:58 +00:00
Adrian Chadd
811fe0a8fb Run callout_reset() with mutex held.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:13:07 +00:00
Adrian Chadd
0c66281c5f Add missed ieee80211_draintask()
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:12:16 +00:00
Adrian Chadd
9facf2b90a Fix a typo (IEEE80211_S_SCAN -> IEEE80211_F_SCAN)
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:10:55 +00:00
Adrian Chadd
893edbea10 Fix mbuf mapping errors in wpi_cmd2() + add check for nsegs
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-15 20:09:47 +00:00
Adrian Chadd
8a28176add Undo some issues from the previous big patch - there's no padding on RX,
so remove DATAPAD and re-do the padding in the TX path manually.

PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-03-08 01:47:10 +00:00
Adrian Chadd
3de934a7a4 Use the correct mac addresses when initialising things.
PR:		kern/197143
Submitted by:	Andriy Voskoboinyk <s3rios@gmail.com>
2015-03-08 01:44:57 +00:00
Adrian Chadd
fae61c6918 More fixes to wpi(4), again not by me! Woo!
- Use IEEE80211_F_DATAPAD;
- (c->ic_flags & IEEE80211_CHAN_PASSIVE) -> IEEE80211_IS_CHAN_PASSIVE(c);
- Convert ackfailcnt to int (there is dereference to *(int *) in ieee80211_ratectl_tx_complete());
- Fix & move cleanup to the end in wpi_rx_done();
- Add missed lock in wpi_update_beacon();
- Try to fix powersave.

PR:		kern/197143
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2015-02-14 17:45:53 +00:00
Adrian Chadd
692ad7ca94 Big wpi(4) overhaul! Not by me!
This is a sync against iwn(4) and openbsd.

- Add power management support;
- Add background scanning support;
- Fix few LORs;
- Handle rfkill switch state changes properly;
- Fix recovering after firmware failure;
- Add more error checking;
- Cleanup & disable by default debug output;
- Update macroses names;
- Other various fixes;
- Add IBSS support:
  - don't set data_ntries field for management frames;
- Add AHDEMO support:
    - fix padding;
- Sync eeprom functions;
- Use CMD_RXON_ASSOC where possible;
- Enable HW CCMP encryption/decryption for pairwise keys;
- Fix filter flags for CMD_RXON.

Tested (by submitter) - iwn 3945 NIC.  I have one somewhere; I'll
validate this later on and revert it if it's a problem.

Thanks!

PR:		197143
Submitted by:	Andriy Voskoboinyk <s3erios@gmail.com>
2015-02-07 23:11:38 +00:00
Adrian Chadd
e54c8bda3e Remove some hard-coded IE assembly over to use net80211 methods.
PR:		kern/196069
Submitted by:	 Andriy Voskoboinyk <s3erios@gmail.com>
2014-12-20 20:07:48 +00:00
Gleb Smirnoff
c8dfaf382f Mechanically convert to if_inc_counter(). 2014-09-19 03:51:26 +00:00
Hans Petter Selasky
af3b2549c4 Pull in r267961 and r267973 again. Fix for issues reported will follow. 2014-06-28 03:56:17 +00:00
Glen Barber
37a107a407 Revert r267961, r267973:
These changes prevent sysctl(8) from returning proper output,
such as:

 1) no output from sysctl(8)
 2) erroneously returning ENOMEM with tools like truss(1)
    or uname(1)
 truss: can not get etype: Cannot allocate memory
2014-06-27 22:05:21 +00:00
Hans Petter Selasky
3da1cf1e88 Extend the meaning of the CTLFLAG_TUN flag to automatically check if
there is an environment variable which shall initialize the SYSCTL
during early boot. This works for all SYSCTL types both statically and
dynamically created ones, except for the SYSCTL NODE type and SYSCTLs
which belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added to
be used in the case a tunable sysctl has a custom initialisation
function allowing the sysctl to still be marked as a tunable. The
kernel SYSCTL API is mostly the same, with a few exceptions for some
special operations like iterating childrens of a static/extern SYSCTL
node. This operation should probably be made into a factored out
common macro, hence some device drivers use this. The reason for
changing the SYSCTL API was the need for a SYSCTL parent OID pointer
and not only the SYSCTL parent OID list pointer in order to quickly
generate the sysctl path. The motivation behind this patch is to avoid
parameter loading cludges inside the OFED driver subsystem. Instead of
adding special code to the OFED driver subsystem to post-load tunables
into dynamically created sysctls, we generalize this in the kernel.

Other changes:
- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"
to "hw.pcic.intr_mask".
- Removed redundant TUNABLE statements throughout the kernel.
- Some minor code rewrites in connection to removing not needed
TUNABLE statements.
- Added a missing SYSCTL_DECL().
- Wrapped two very long lines.
- Avoid malloc()/free() inside sysctl string handling, in case it is
called to initialize a sysctl from a tunable, hence malloc()/free() is
not ready when sysctls from the sysctl dataset are registered.
- Bumped FreeBSD version to indicate SYSCTL API change.

MFC after:	2 weeks
Sponsored by:	Mellanox Technologies
2014-06-27 16:33:43 +00:00
John Baldwin
c34f1a08c6 Fix teardown of static DMA allocations in various NIC drivers:
- Add missing calls to bus_dmamap_unload() in et(4).
- Check the bus address against 0 to decide when to call
  bus_dmamap_unload() instead of comparing the bus_dma map against NULL.
- Check the virtual address against NULL to decide when to call
  bus_dmamem_free() instead of comparing the bus_dma map against NULL.
- Don't clear bus_dma map pointers to NULL for static allocations.
  Instead, treat the value as completely opaque.
- Pass the correct virtual address to bus_dmamem_free() in wpi(4) instead
  of trying to free a pointer to the virtual address.

Reviewed by:	yongari
2014-06-17 14:47:49 +00:00
Kevin Lo
5945b5f5ab Rename definition of IEEE80211_FC1_WEP to IEEE80211_FC1_PROTECTED.
The origin of WEP comes from IEEE Std 802.11-1997 where it defines
whether the frame body of MAC frame has been encrypted using WEP
algorithm or not.
IEEE Std. 802.11-2007 changes WEP to Protected Frame, indicates
whether the frame is protected by a cryptographic encapsulation
algorithm.

Reviewed by:	adrian, rpaulo
2014-01-08 08:06:56 +00:00
Marius Strobl
da67681dd3 - Probe with BUS_PROBE_DEFAULT instead of 0.
- Nuke code setting PCI_POWERSTATE_D0; pci(4) already does that for type 0
  devices.
- There's no need to keep track of resource IDs.
- Quiesce the interrupt before actually detaching.
- Use DEVMETHOD_END.
- Use NULL instead of 0 for pointers.

MFC after:	1 week
2013-12-29 23:46:59 +00:00
Gleb Smirnoff
76039bc84f The r48589 promised to remove implicit inclusion of if_var.h soon. Prepare
to this event, adding if_var.h to files that do need it. Also, include
all includes that now are included due to implicit pollution via if_var.h

Sponsored by:	Netflix
Sponsored by:	Nginx, Inc.
2013-10-26 17:58:36 +00:00
Gleb Smirnoff
c6499eccad Mechanically substitute flags from historic mbuf allocator with
malloc(9) flags in sys/dev.
2012-12-04 09:32:43 +00:00
Adrian Chadd
81c2214dda Add a missing #include, required for IEEE80211_DEBUG. 2012-06-01 06:20:39 +00:00
Bernhard Schmidt
ada977b103 Use suspend/resume methods provided by net80211. This ensures that the
appropriate state handling takes place, not doing so results in the
device doing nothing until manual intervention.

Reviewed by:	iwasaki
Tested by:	iwasaki (iwi)
MFC after:	4 weeks
2012-03-23 19:32:30 +00:00
Bernhard Schmidt
fcd9500f91 Fix some net80211 enum nits:
- ic_vap_create() uses an ieee80211_opmode argument
- ieee80211_rate2media() takes an ieee80211_phymode argument
- ieee80211_plcp2rate() takes an ieee80211_phytype argument
- cast to enum ieee80211_protmode and ieee80211_roamingmode to silence
  compiler warnings

Submitted by:	arundel@
2011-12-17 10:23:17 +00:00
Bernhard Schmidt
129145a426 Add module version to iwi/ipw/wpi and iwn.
The version is used to check if a module is already preset, not setting
it results in:

can't re-use a leaf (ipw)!
module_register: module pci/ipw already exists!
Module pci/ipw failed to register: 17

while trying to load the module due to an entry in loader.conf. With this
commit we get the expected:

module ipw already present!

Reported by:	Dru Lavigne, bz
Tested by:	bz
MFC after:	1 week
2011-05-31 19:08:25 +00:00
Bernhard Schmidt
797b914622 No need for htole32(), which is an uint8_t. 2011-05-01 18:41:57 +00:00
Rebecca Cran
6bccea7c2b Fix typos - remove duplicate "the".
PR:	bin/154928
Submitted by:	Eitan Adler <lists at eitanadler.com>
MFC after: 	3 days
2011-02-21 09:01:34 +00:00
Bernhard Schmidt
bd56e71b4b Pull ieee80211_ratectl_node_init() calls from drivers into net80211.
This fixes hostap mode for at least ral(4) and run(4), because there is
no sufficient call into drivers which could be used initialize the node
related ratectl variables.

MFC after:	3 days
2011-01-17 20:15:15 +00:00
Bernhard Schmidt
a71ad78761 The RX path is missing a few bus_dmamap_*() calls, this results in
modification of memory which was already free'd and eventually in:
wpi0: could not map mbuf (error 12)
wpi0: wpi_rx_intr: bus_dmamap_load failed, error 12
and an usuable device.

PR:		kern/144898
MFC after:	3 days
2010-12-30 18:29:22 +00:00
Bernhard Schmidt
6a9e69db1b Fix panic trying to use monitor mode. The iwn_cmd() calls issued by
iwn_config() want to msleep() on the mutex.

PR:		kern/138427
Submitted by:	Henry Hu <henry.hu.sh at gmail.com>
MFC after:	3 days
2010-12-19 10:36:06 +00:00
Bernhard Schmidt
f015cb7882 Add 2 missing bus_dmamap_sync() calls. Those fix random 'scan timeout',
'could not set power mode', 'device config failed' and other errors due
reading invalid memory.

Obtained from:	OpenBSD
MFC after:	3 days
2010-12-18 15:45:10 +00:00