summaryrefslogtreecommitdiffstats
path: root/sys/dev/iwm/if_iwm.c
Commit message (Collapse)AuthorAgeFilesLines
* MFC r303322,303326,303327,303345,303413,303416,303418,303557sbruno2016-08-011-368/+1470
| | | | | | | Update iwm(4) and iwmfw(4) to current in order to stabilize and improve functionality. Approved by: re (gjb)
* [iwm] Use mbuf for large firmware commands, like OpenBSD does.adrian2016-06-231-2/+13
| | | | | | | | | | We also need to consider the size of large firmware commands in iwm_alloc_tx_ring(), in the dma tag creation, when qid == IWM_MVM_CMD_QUEUE. The old code apparently only allocated a 2KB (MCLBYTES) sized buffer when it actually expected 4KB. Submitted by: Imre Vadasz <imre@vdsz.com> Approved by: re (gjb) Differential Revision: https://reviews.freebsd.org/D6824
* [iwm] Add and use iwm_phy_db_free(), to plug phy_db memory leak.adrian2016-06-231-0/+2
| | | | | | | | | | (Together with other iwm(4) memory leak fixes) Memory leakage in M_DEVBUF is now at ca. 2KB for each iwm(4) module load/unload cycle. Submitted by: Imre Vadasz <imre@vdsz.com> Approved by: re (gjb) Obtained from: DragonflyBSD git eaf551a1d464c643e98ce5781971dd32124e9af1 Differential Revision: https://reviews.freebsd.org/D6819
* [iwm] Fix iwm_dma_contig_free(). dma->map is always NULL here.adrian2016-06-231-11/+11
| | | | | | | | | | | | | * When bus_dmamem_alloc is used, the bus_dmamap_t is usually set to NULL, so we were never actually freeing any dma memory allocations done via iwm_dma_contig_alloc(). So we should check dma->vaddr instead of dma->map here. * Also, the dmamap is actually supposed to be invalidated as part of bus_dmamem_free(), so bus_dmamap_destroy() is never needed here. Submitted by: Imre Vadasz <imre@vdsz.com> Approved by: re (gjb) Obtained from: DragonflyBSD git ef2b29a7ba6ca8a9d2c82ab591c0622227ff84cb
* [iwm] free RX ring / NVM memory after they're used.adrian2016-06-161-4/+12
| | | | | | | | | | | | | | * Free RX ring during detach * Free NVM memory after parsing Tested: * 7260, STA mode Submitted by: Imre Vadasz <imre@vdsz.com> Approved by: re (gjb) Obtained from: dragonflybsd Differential Revision: https://reviews.freebsd.org/D6817
* [iwm] Fix up busdma use in the RX pathadrian2016-06-131-15/+37
| | | | | | | | | | | | | | | | | | | | | When allocating a new mbuf or bus_dmamap_load()-ing it fails, we can just keep the old mbuf since we are dropping that packet anyway. Instead of doing bus_dmamap_create() and bus_dmamap_destroy() all the time, create an extra bus_dmamap_t which we can use to safely try bus_dmamap_load()-ing the new mbuf. On success we just swap the spare bus_dmamap_t with the data->map of that ring entry. Tested: Tested with Intel AC7260, verified with vmstat -m that new kernel no longer visibly leaks memory from the M_DEVBUF malloc type. Before, leakage was 1KB every few seconds while ping(8)-ing over the wlan connection. Submitted by: Imre Vadasz <imre@vdsz.com> Approved by: re@ Obtained from: DragonflyBSD.git cc440b26818b5dfdd9af504d71c1b0e6522b53ef Differential Revision: https://reviews.freebsd.org/D6742
* [iwm] valid_{tx,rx}_ant from radio_cfg is only needed for 8000 family.adrian2016-06-021-10/+0
| | | | | | | | * The "if (!data->valid_tx_ant || !data->valid_rx_ant) {" check was getting triggered with a 3165 chipset. Submitted by: Imre Vadasz <imre@vdsz.com> Obtained from: DragonflyBSD 3655dfb6fc311fc83e5ce8370dd91b4cd4a37991
* [iwm] Fix several nitpicks in iwm(4).adrian2016-06-021-24/+5
| | | | | | | | | | | | | | | Move some declarations to if_iwmreg.h. Remove iwm_fw_alive(); just call iwm_post_alive() directly. Simplify iwm_mvm_add_sta(). Return timeout error from iwm_apm_init(). Print a message when init (i.e. boot) firmware fails to load. Remove some commented-out code which wouldn't compile anyway. Move iwm_mvm_tx_fifo to if_iwmreg.h to match better where Linux puts it. Taken-From: OpenBSD (if_iwm.c r1.80 and if_iwmreg.h r1.11) Submitted by: Imre Vadasz <imre@vdsz.com> Obtained from: DragonflyBSD 29fcb331e5620ae145a6ab9cdda830e22fff626a
* [iwm] Add bit-polling in Rx-DMA init code path.adrian2016-06-021-2/+9
| | | | | | | Taken-From: OpenBSD (if_iwm.c r1.80) Submitted by: Imre Vadasz <imre@vdsz.com> Obtained from: DragonflyBSD ed35558754288911048cb607e57c688273ebd8d4
* [iwm] Clean up iwm(4) scanning logic a bit.adrian2016-06-021-2/+4
| | | | | Submitted by: Imre Vadasz <imre@vdsz.com> Obtained from: DragonflyBSD 8f3ffab9136e33263d424275ec28f57ad2096437
* [iwm] add LED blinking for iwm hardware that supports it.adrian2016-06-021-1/+19
| | | | | Submitted by: Imre Vadasz <imre@vdsz.com> Obtained from: DragonflyBSD, Linux iwlwifi/mvm
* [iwm] remove dead code.adrian2016-05-271-14/+2
| | | | | | | | | if_iwm - GC some dead code, left by a partially applied OpenBSD change. Taken-From: OpenBSD (if_iwm.c r1.69) Submitted by: Imre Vadasz <imre@vdsz.com> Obtained from: DragonflyBSD git 07dfed32ea39b980b0b80d27ff938e7c3ca4c0b5
* iwm: add 'opt_wlan.h' include into source files.avos2016-05-191-0/+2
| | | | | Include net80211 options file, so IEEE80211_DEBUG_REFCNT option will be handled correctly.
* iwm: restart device after watchdog timeouts.avos2016-05-191-2/+3
|
* Follow-up r298818: hide size of 'bands' array behind a macro.kevlo2016-05-161-1/+1
|
* iwm: fix parameters for iwm_add_channel_band()avos2016-05-021-3/+2
| | | | | | | It accepts <first index, max index + 1>, not <first index, number of entries>. Reported by: adrian
* iwm: switch to ieee80211_add_channel()avos2016-05-011-68/+75
| | | | | | | | | - Switch to ieee80211_add_channel(). - Parse/set more channel flags (DFS, NOADHOC). - Add ic_getradiocaps() method. Reviewed by: adrian Differential Revision: https://reviews.freebsd.org/D6150
* [iwn] fill in the TX command rate info flags consistently.adrian2016-05-011-24/+21
| | | | | | | | | | | | | The Linux driver sets the rate_n_flags regardless of whether it's being sent using firmware rate control or local rate control. This includes the antenna configuration. Thanks to Kyle Evans <kevans91@ksu.edu> for pointing this out to me and doing some investigation/testing on his end. Tested: * Intel 7260 STA, 2G and 5G networks
* The iwm_nic_error() defined if IWM_DEBUG is defined.dchagin2016-04-291-1/+2
|
* iwm(4): Don't dereference potentially NULL pointer before NULL checkcem2016-04-261-1/+1
| | | | | | | | | Introduced in r298594. There is no path before the 'vap == NULL' check where vap is not already dereferenced. Reported by: Coverity CID: 1354979 Sponsored by: EMC / Isilon Storage Division
* [iwm] implement suspend/resume through ieee80211_{suspend,resume}_alladrian2016-04-261-1/+19
| | | | | | | | | | This allows wifi to associate correctly after a suspend/resume cycle. Yes, I'm using this now day to day. Tested: * Intel 7260AC, STA mode
* [iwm] add extra transmit setup/completion logging so I can see what's going on.adrian2016-04-261-2/+17
| | | | | | | | | | I'm seeing 5GHz association work but data not work until the rate drops, so I need way more information about what's being programmed into the transmit descriptors. Tested: * 7260AC, STA mode
* [iwm] restart the VAP if there's a firmware panic.adrian2016-04-251-6/+13
| | | | | | | | Always print out the firmware panic info before restarting; don't put it behind IWM_DEBUG. Submitted by: bapt Differential Revision: https://reviews.freebsd.org/D6081
* [iwn] fix firmware command use in iwm_auth().adrian2016-04-251-50/+42
| | | | | | | | | | | | | | | | | | | | | | | | The iwm firmware has separate commands for add, modify and delete for various things (mac, phy context, etc.) The openbsd driver has a habit of just completely resetting the NIC each time, which is technically mostly okay (as long as the reset doesn't actually fail!) but it means a lot of the code is doing ADD when it should do MODIFY. The firmware responds in kind - it just asserts. This fixes auth attempts that occur after the NIC has been already configured. (I'm sure there are more instances of this!) Tested: iwm0: <Intel Dual Band Wireless AC 7260> mem 0xf1400000-0xf1401fff irq 17 at device 0.0 on pci2 iwm0: revision: 0x140, firmware 25.228 (API ver. 9) .. STA mode. Submitted by: Masachika ISHIZUKA <ish@amail.plala.or.jp>
* [iwm] fix up the rate control setup code to initialise rates in the orderadrian2016-01-181-3/+14
| | | | | | | | | | | | | | we want to use it. The rate table was being initialised in low->high, but the link quality table was being initialised high->low. So, when we did a lookup, we would get the indexes wrong. This started by a patch from dragonflybsd which reversed how the ni->in_ridx[] array is being used; I'd rather it all be consistent. So, this is consistent. Inspired by: what I did to iwn(4) a while ago Inspired by: DragonflyBSD; <imre@vdsz.com>
* iwm: revert r293178avos2016-01-051-1/+5
| | | | | | | | This optimization is not proper (and causes kernel panic), since driver checks fw_status to optimize away parsing stage if it was already done. Reported by: dchagin
* iwm: free firmware related resources after uploading it to the hardwareavos2016-01-041-6/+2
| | | | | | | | iwn(4) / wpi(4) works in the same way (read_firmware() -> hw_init() -> firmware_put()) Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4766
* iwm: store pointer for 'struct firmware' instead ofavos2016-01-041-14/+11
| | | | | | | | 'size_t' and 'void *' pair. Approved by: adrian (mentor) Obtained from: DragonFlyBSD Differential Revision: https://reviews.freebsd.org/D4765
* iwm: use m_collapse() to defragment a mbuf chainavos2016-01-031-14/+6
| | | | | | | | | - Simplify defragmentation code. - Use proper number of dma segments for data. Approved by: adrian (mentor) Obtained from: DragonFlyBSD (mostly) Differential Revision: https://reviews.freebsd.org/D4754
* iwm: convert to ieee80211_tx_complete()avos2016-01-031-20/+17
| | | | | Approved by: adrian (mentor) Differential Revision: https://reviews.freebsd.org/D4755
* iwm: reorganize if_iwmvar.havos2016-01-031-8/+7
| | | | | | | | | | | | | | | - Change order of data in if_iwmvar.h (like it is in other drivers: defines, data structures, vap/node structures, softc struct and locks); use indentation. - Fix IWM_LOCK(_sc) / IWM_UNLOCK(_sc) macro. - Add IWM_LOCK_INIT / DESTROY(sc) + fix mtx_init() usage. - Wrap iwm_node casts into IWM_NODE() macro. - Drop some fields: * wt_hwqueue from Tx radiotap header; * macaddr[6] from iwm_vap; Approved by: adrian Differential Revision: https://reviews.freebsd.org/D4753
* Fix IEEE80211_ADDR_COPY() usage.kevlo2015-10-221-1/+1
| | | | Reviewed by: adrian
* Remove BUS_DMA_NOWAIT from bus_dma_tag_create() invocations as it'skevlo2015-10-211-5/+3
| | | | no valid flag there.
* net80211: move ieee80211_free_node() call on error from ic_raw_xmit() to ↵adrian2015-10-121-5/+0
| | | | | | | | | | 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
* Ensure the ring state is also blanked upon reset, otherwiseadrian2015-09-181-0/+2
| | | | | | | duplicate rx events get handled during reset paths. Submitted by: Matthew Dillion <dillon@apollo.backplane.com> Obtained from: DragonflyBSD
* Replay r286410. Change KPI of how device drivers that provide wirelessglebius2015-08-271-200/+104
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Convert more ifp->if_softc -> ic->ic_softc.adrian2015-08-171-5/+4
| | | | | | | | These should be a big no-op. Tested: * make universe
* iwm: use the proper include path for iwm headers.rpaulo2015-08-081-13/+13
|
* Import OpenBSD's iwm WiFi driver for Intel 3160/7260/7265.rpaulo2015-08-081-0/+5125
There are still several bugs, but I've been using it for a while now. Thanks to all the testers and to Adrian for his help with this driver. This driver isn't connected to the build yet, but it will be soon. There's no MFC planned because the driver isn't very stable yet. Reviewed by: adrian Obtained from: https://github.com/rpaulo/iwm Tested by: adrian, gjb, dumbbell (others that I forgot). Relnotes: yes
OpenPOWER on IntegriCloud