aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/pcie/rx.c
AgeCommit message (Collapse)Author
2015-03-18iwlwifi: pcie: add rx packet sequence number to dbg printLiad Kaufman
For each RX packet until this patch there only was a debug print of the HCMD and the offset. This adds also the sequence number of the packet for easier matching between what was sent, what came back / was received, and what got stuck somewhere and was never responded by the FW. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-09-14iwlwifi: pcie: clear command data on freeingJohannes Berg
When freeing the structures used for command data, clear their memory as they may have contained key material at some point. Also clear the duplicated buffer when freeing it to be safe; currently key material is never put there but that may change. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-09-03iwlwifi: add Intel Mobile Communications copyrightJohannes Berg
Our legal structure changed at some point (see wikipedia), but we forgot to immediately switch over to the new copyright notice. For files that we have modified in the time since the change, add the proper copyright notice now. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-05-06iwlwifi: pcie: get rid of q->n_bdJohannes Berg
This variable always tracks a constant value (256) so there's no need to have it. Removing it simplifies code generation, reducing the .text size (by about 240 bytes on x86-64.) Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-04-13iwlwifi: pcie: unify iwl_rx_replenish and iwl_rx_replenish_nowEmmanuel Grumbach
Besides the different allocation flags, they are really the same. Pass the gfp_t flags as a parameter, and unify them. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-04-13iwlwifi: pcie: clarify TX queue need_update handlingJohannes Berg
Similar to the recent RX queue patch, this changes the need_update handling for the TX queues to be clearer and only done when needed. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-04-13iwlwifi: pcie: fix TX queue lockingJohannes Berg
When updating the write pointer, the TX queue should be locked to get consistent state, fix that in the interrupt handler. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-04-13iwlwifi: pcie: clarify RX queue need_update handling and lockingJohannes Berg
When shadow registers are enabled, then need_update never needs to be set, so move the need_update handling into the function that really needs to do it (iwl_pcie_rxq_inc_wr_ptr) and also separate the check when it woke up. While at it, convert it to bool. This also clarifies the locking and means the irq_lock needs to no longer be held for any such updates. The irq_lock also doesn't have to be held for restocking since everything else locks the RX queue properly, so remove that and finally disentangle the two locks entirely so there aren't any dependencies between the two left. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-04-13iwlwifi: pcie: implement GRO without NAPIJohannes Berg
Use the new NAPI infrastructure added to mac80211 to get GRO. We don't really implement NAPI since we don't have a real poll function and we never schedule a NAPI poll. Instead of this, we collect all the packets we got from a single interrupt and then call napi_gro_flush(). This allows us to benefit from GRO. In half duplex medium like WiFi, its main advantage is that it reduces the number of TCP Acks, hence improving the TCP Rx performance. Since we call the Rx path with a spinlock held, remove the might_sleep mention from the op_mode's API. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Ido Yariv <ido@wizery.com> [Squash different patches and rewrite the commit message] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-03-09iwlwifi: return whether to stop from rfkill methodJohannes Berg
When indicating RF-kill toggle to the higher layer, that may in turn call back to the transport (for MVM at least) to turn off the device quickly. Instead of that, allow it to return whether or not the device should be turned off, this gets rid of the call indirection and will help make the API more consistent when we go back to non-threaded interrupts again for PCIe. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-02-13iwlwifi: pcie: clean iwl_pcie_[rt]xq_inc_wr_ptr a bitEliad Peller
The various code blocks in iwl_pcie_[rt]xq_inc_wr_ptr finally do the same things, so just merge them all and make the functions cleaner. Signed-off-by: Eliad Peller <eliadx.peller@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-02-03iwlwifi: pcie: fix unused variable gcc warningEmmanuel Grumbach
In iwl_pcie_int_cause_non_ict, trans_pcie is used for lockdep purposes only. Since this might not be enabled, trans_pcie finds itself without user leading to a complaint from gcc. Avoid using trans_pcie by inlining IWL_TRANS_GET_PCIE_TRANS. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-01-13iwlwifi: add inline helper for packet lengthsJohannes Berg
Add an inline helper function for getting an RX packet's length or payload length and use it throughout the code (most of which I did using an spatch.) While at it, adjust some code, and remove a bogus comment from the dvm calibration code. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Eran Harary <eran.harary@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-31iwlwifi: Update Copyright to 2014Emmanuel Grumbach
Happy new year! Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-21iwlwifi: pcie: use don't disable interrupt when rxq->lock is takenEmmanuel Grumbach
This lock was never acquired in the primary interrupt handler, but since it was acquired along with irq_lock which had to disable interrupts, rxq->lock had to disable interrupts too. Now that trans_pcie->irq_lock isn't acquired in the primary interrupt handler, rxq->lock can let interrupt enabled. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-21iwlwifi: pcie: use don't disable interrupt when irq_lock is takenEmmanuel Grumbach
Since we don't take this lock in the primary interrupt handler, there is no pointin disabling the interrupt in the critical section protected by trans_pcie->irq_lock. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-21iwlwifi: pcie: move interrupt prints to the common handlerEmmanuel Grumbach
Handling interrupt with no cause and printing logs doesn't need to be ICT / non-ICT specific move this to the common code. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-21iwlwifi: pcie: no need to save inta in trans_pcieEmmanuel Grumbach
This was useful when the handling was not in the same context as the interrupt cause retrieval: we could have several hard interrupts until the handler gets called. Since we retrieve the interrupt cause in the handler itself, there is no need to OR the interrupt causes. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-21iwlwifi: pcie: return inta from iwl_pcie_int_cause_{non_}ictEmmanuel Grumbach
These functions are meant to return an interrupt cause and not an irqreturn_t. We still return IRQ_HANDLED if we had an error and IRQ_NONE if our device hasn't fired any interrupt. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: pcie: determine the interrupt type in the handlerEmmanuel Grumbach
Instead of having: iwl_pcie_irq_handler iwl_pcie_isr_ict iwl_pcie_isr_non_ict we now have: iwl_pcie_irq_handler: if (use_ict)) iwl_pcie_int_cause_ict; else iwl_pcie_int_cause_non_ict; This is much clearer. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: pcie: read the interrupt cause from the handlerEmmanuel Grumbach
We now disable the interrupts in the hardware from the upper half and all the rest (including reading the interrupt cause) is done in the handler. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: pcie: move the ICT / non-ICT handling functionsEmmanuel Grumbach
The purpose of this is to be able to call these functions from the interrupt handler and not from the primary interrupt handler. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: pcie: re-organize the PCIe ISR codeEmmanuel Grumbach
Separate the code that simply disables interrupt in the hardware and the code that checks what interrupt fired. This will be useful to move the second part in the threaded handler which will be done in a future patch. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: pcie: track interrupt mask in SWEmmanuel Grumbach
Track the interrupt mask in software, making it exactly what is configured in the interrupt mask register in the hardware. This allows not to access the register from the interrupt handler. This was the case for ICT interrupt already, but not for non-ICT interrupt. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: pcie: clean up ICT allocation codeEmmanuel Grumbach
Since iwl_trans_pcie_alloc_ict is called in the PCIe allocation code, we always set CSR_INT_BIT_RX_PERIODIC. Move that bit to the default list of interrupts we enable and simplify the code. Also use dma_zalloc_ and avoid to memset the memory afterwards. trans_pcie->ict_index is 0 since trans_pcie has just been kzalloced, remove the redundant assignment. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: trans: prevent reprobe on repeated FW errors before restartArik Nemtsov
In case a sync command timeouts or Tx is stuck while a FW error interrupt arrives, we might call iwl_op_mode_nic_error twice before a restart has been initiated. This will cause a reprobe. Unify calls to this function at the transport level and only call it on the first FW error in a given by checking the transport FW error flag. While at it, remove the privately defined iwl_nic_error from PCIE code and use the common callback instead. Signed-off-by: Arik Nemtsov <arik@wizery.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-17iwlwifi: trans: use a unified transport statusArik Nemtsov
The same bits are employed in all transport layers. Put the status field in the common transport layer. This allows us to employ them in common transport code. Signed-off-by: Arik Nemtsov <arik@wizery.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-12-09iwlwifi: pcie: remove minor dead codeMichal Nazarewicz
inta is checked to be zero in a IRQ_NONE branch so afterwards it cannot be zero as it is never modified. Signed-off-by: Michal Nazarewicz <mina86@mina86.com> [reword the patch title and fix comment] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-11-25iwlwifi: pcie: stop sending commands to dead firmwareAlexander Bondar
If we call ieee80211_hw_restart, it means that the firmware is in bad condition and will be reset soon. Since the firmware will be reset, there is no good reason to keep sending host commands. Signed-off-by: Alexander Bondar <alexander.bondar@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-11-25iwlwifi: pcie: fix interrupt coalescing for 7260 / 3160Emmanuel Grumbach
We changed the timeout for the interrupt coealescing for calibration, but that wasn't effective since we changed that value back before loading the firmware. Since calibrations are notification from firmware and not Rx packets, this doesn't change anyway - the firmware will fire an interrupt straight away regardless of the interrupt coalescing value. Also, a HW issue has been discovered in 7000 devices series. The work around is to disable the new interrupt coalescing timeout feature - do this by setting bit 31 in CSR_INT_COALESCING. This has been fixed in 7265 which means that we can't rely on the device family and must have a hint in the iwl_cfg structure. Cc: stable@vger.kernel.org [3.10+] Fixes: 99cd47142399 ("iwlwifi: add 7000 series device configuration") Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2013-08-28Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/iwlwifi/pcie/trans.c net/mac80211/ibss.c
2013-08-16Merge branch 'for-john' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next
2013-08-09Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
2013-08-09iwlwifi: pcie: Remove duplicate code from pcie irq handlersIdo Yariv
Instead of having the same code sequentially, fall-through. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-08-09iwlwifi: pcie: Refactor iwl_rxq_spaceIdo Yariv
Simplify iwl_rxq_space to improve readability and reduce the ambiguity spares to a single element. Signed-off-by: Ido Yariv <ido@wizery.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-08-06Revert "iwlwifi: pcie: clear RFKILL interrupt in AMPG"Guy Cohen
This reverts commit a53ee0a308b16e392e0219c585b10f329345766b. This fix causes a worse HW Error when entering RF-Kill. Signed-off-by: Guy Cohen <guy.cohen@intel.com> Signed-off-by: Dor Shaish <dor.shaish@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-07-26iwlwifi: pcie: clear RFKILL interrupt in AMPGEmmanuel Grumbach
If we forget to do so, we can't send HCMD to firmware while the NIC is in RFKILL state. Cc: stable@vger.kernel.org Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-07-16iwlwifi: move dump_fh into common codeInbal Hacohen
This means it can be shared for different transport layers in the future. Signed-off-by: Inbal Hacohen <Inbal.Hacohen@intel.com> Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes@sipsolutions.net>
2013-06-25iwlwifi: always use 'rxq' as RX queue struct nameJohannes Berg
A few places use just 'q', use 'rxq' there like all other places. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-06-25iwlwifi: pcie: rework RX buffer list init and freeingJohannes Berg
The PCIe code has an array of buffer descriptors (RXBs) that have pages and DMA mappings attached. In regular use, the array isn't used and the buffers are either on the hardware receive queue or the rx_free/rx_used lists for recycling. Occasionally, during module unload, we'd see a warning from this: WARNING: at lib/list_debug.c:32 __list_add+0x91/0xa0() list_add corruption. prev->next should be next (c31c98cc), but was c31c80bc. (prev=c31c80bc). Pid: 519, comm: rmmod Tainted: G W O 3.4.24-dev #3 Call Trace: [<c10335b2>] warn_slowpath_common+0x72/0xa0 [<c1033683>] warn_slowpath_fmt+0x33/0x40 [<c12e31d1>] __list_add+0x91/0xa0 [<fdf2083c>] iwl_pcie_rxq_free_rbs+0xcc/0xe0 [iwlwifi] [<fdf21b3f>] iwl_pcie_rx_free+0x3f/0x210 [iwlwifi] [<fdf2dd7a>] iwl_trans_pcie_free+0x2a/0x90 [iwlwifi] The reason for this seems to be that in iwl_pcie_rxq_free_rbs() we use the array to free all buffers (the hardware receive queue isn't in use any more at this point). The function also adds all buffers to rx_used because it's also used during initialisation (when no freeing happens.) This can cause the warning because it may add entries to the list that are already on it. Luckily, this is harmless because it can only happen when the entire data structure is freed anyway, since during init both lists are initialized from scratch. Disentangle this code and treat init and free separately. During init we just need to put them onto the list after freeing all buffers (for switching between 4k/8k buffers); during free no list manipulations are necessary at all. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-06-13iwlwifi: reduce debug ifdefs using the optimiserJohannes Berg
Instead of using #ifdef CONFIG_IWLWIFI_DEBUG, remove the iwlwifi_mod_params.debug_level variable completely and make iwl_have_debug_level() always return false in the non-debug case. This way, the optimiser will elide all code for it automatically without having to add #ifdefs. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-06-13iwlwifi: pcie: don't read INTA register in ICT IRQ handlerJohannes Berg
There's no reason to read the INTA register in the ICT IRQ handler, this interrupt mechanism is designed to not have to read as many registers as the regular one. Not reading the INTA register gives a significant performance/CPU use improvement. Since we still want to get this info, fetch it only if the ISR debug level is enabled. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-02-28iwlwifi: use coherent DMA memory for command headerJohannes Berg
Recently in commit 8a964f44e01ad3bbc208c3e80d931ba91b9ea786 ("iwlwifi: always copy first 16 bytes of commands") we fixed the problem that the hardware writes back to the command and that could overwrite parts of the data that was still needed and would thus be corrupted. Investigating this problem more closely we found that this write-back isn't really ordered very well with respect to other DMA traffic. Therefore, it sometimes happened that the write-back occurred after unmapping the command again which is clearly an issue and could corrupt the next allocation that goes to that spot, or (better) cause IOMMU faults. To fix this, allocate coherent memory for the first 16 bytes of each command, containing the write-back part, and use it for all queues. All the dynamic DMA mappings only need to be TO_DEVICE then. This ensures that even when the write-back happens "too late" it can't hit memory that has been freed or a mapping that doesn't exist any more. Since now the actual command is no longer modified, we can also remove CMD_WANT_HCMD and get rid of the DMA sync that was necessary to update the scratch pointer. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-02-05iwlwifi: use threaded interrupt handlerJohannes Berg
With new transports coming up, move to threaded interrupt handling now. This has the advantage that we can use the same locking scheme with all different transports we may need to implement. Note that the TX path obviously still runs in a tasklet, so some spin_lock() calls need to change to spin_lock_bh() calls to properly lock out the TX path. In my test on a Calpella platform this has no impact on throughput or latency. Also add lockdep annotations to avoid lockups due to catch sending synchronous commands or using locks that connect with them from the irq thread. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-01-30Merge branch 'for-john' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/iwlwifi/iwlwifi-next
2013-01-28Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless Conflicts: drivers/net/wireless/ath/ath9k/main.c drivers/net/wireless/iwlwifi/dvm/tx.c
2013-01-24iwlwifi: provide RX page orderEmmanuel Grumbach
When the pages are to be used by front-end, it may need to know the page order, provide it. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-01-24iwlwifi: update copyrightJohannes Berg
Update Copyright notices to 2013. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-01-16iwlwifi: enable communication with WoWLAN firmwareJohannes Berg
On resuming, the opmode may have to be able to talk to the WoWLAN/D3 firmware in order to query it about its status and wakeup reasons. To do that, the opmode has to call the new d3_resume() transport API which will set up the device for command communcation. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2013-01-16iwlwifi: don't memset scalar valuesJohannes Berg
The dma_addr_t type is a scalar value, so it should just be assigned, not memset. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>