summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/iwlwifi/pcie/trans.c
AgeCommit message (Collapse)Author
2015-06-06iwlwifi: pcie: prevent using unmapped memory in fw monitorLiad Kaufman
commit 553452e5ffc0ed13214a287549627d02d9d7fbdc upstream. In the case of a DMA mapping error on the last iteration of the loop of the allocation of memory of the FW monitor we indeed free the pages, but don't NULL out the page variable thus allowing for the possibility of setting the FW monitor variables with invalid data to use. Fixes: c2d202017da1 ("iwlwifi: pcie: add firmware monitor capabilities") Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-02-01iwlwifi: allow to define the stuck queue timer per queueEmmanuel Grumbach
Different queue can have different behavior. While it can be unacceptable for a certain queue to be stuck for 2 seconds (e.g. the command queue), it can happen that another queue will stay stuck for even longer (a queue servicing a power saving client in GO). The op_mode can even make the timeout be a function of the listen interval. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-02-01iwlwifi: pcie: prepare the enablement of 31 TFD queuesEmmanuel Grumbach
Some devices have 31 TFD queues. Don't enable it yet since there are still issues with it, but at least prepare the code for it. There was a bug in the read pointer assignment, fix that. Also, move the inline functions to iwl-scd.h which is the right place. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-01-22iwlwifi: pcie: support secured boot flow for family 8000 B stepEran Harary
The driver loads the 2 CPU sections, then it needs to let the firmware know to start the authentication of the sections. This is done by writing the relevants bits to FH_UCODE_LOAD_STATUS. For CPU1, the driver sets the lower 16 bits. For both CPUs, the driver sets all the 32 bits. Signed-off-by: Eran Harary <eran.harary@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-01-22iwlwifi: mvm: support family 8000 C stepEran Harary
C step functionality in the driver is exactly the same as B step besides the ucode name that present as iwlwifi-8000C-xx.ucode instead of iwlwifi-8000B-xx.ucode Signed-off-by: Eran Harary <eran.harary@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-01-22iwlwifi: pcie: init ref_lockJohannes Berg
The ref_lock that was recently added is missing initialization which makes lockdep unhappy and is generally a bad idea. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-01-22Merge remote-tracking branch 'iwlwifi-fixes/master' into iwlwifi-nextEmmanuel Grumbach
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Conflicts: drivers/net/wireless/iwlwifi/iwl-fw-file.h drivers/net/wireless/iwlwifi/mvm/scan.c
2014-12-28iwlwifi: mvm: call to pcie_apply_destination also on family 8000 B stepEran Harary
In order to config the FW and to allocate monitor buffer driver should run the function iwl_pcie_apply_destination immediately after FW sections are loaded. Signed-off-by: Eran Harary <eran.harary@intel.com> Reviewed-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-28iwlwifi: mvm: support IWL_D0I3_MODE_ON_SUSPEND d0i3 modeEliad Peller
Enter d0i3 on suspend, and exit d0i3. Wait for the command responses in both cases. Use this mode in case of pcie trans. Signed-off-by: Eliad Peller <eliadx.peller@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-28iwlwifi: pcie: add basic reference accountingEliad Peller
Implement the ref/unref trans ops and track both tx and host command queues (and hold references while they are not empty). Signed-off-by: Eliad Peller <eliadx.peller@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-28iwlwifi: pcie: let the Manageability Engine know when we leaveEmmanuel Grumbach
When the driver is unload, the Manageability Engine should know about that - send an event to inform it about this event. Reviewed-by: Reuven Borok <reuven.borok@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-14iwlwifi: pcie: limit fw chunk sizes given to fhLiad Kaufman
New FW has chunks that are larger than the size limit of the FH's DMA. To make sure we don't crash it - actively limit the max size of each chunk. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-14iwlwifi: pcie: re-ACK all interrupts after device resetEmmanuel Grumbach
When we reset the device, the CSR_INT gets cleared as well as CSR_INT_MASK. Meaning that we shouldn't get any interrupt but, due to a hardware bug, recent devices will keep sending interrupts. This leads to an interrupt storm while stopping the device. The way to fix this is to ACK all the interrupts after the device is reset so that the value of CSR_INT will stay 0xffffffff. Fixes: 522713c81e4e ("iwlwifi: pcie: properly reset the device") Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-02iwlwifi: pcie: support more monitor types dumpingLiad Kaufman
Until this patch, dumping the monitor data could be done only for PCIe external (DRAM) mode in 7000 HW family. This patch allows to pull the monitor data also on other families, and also to pull the monitor data if an internal buffer is used. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-02iwlwifi: pcie: config regs according to fw tlvLiad Kaufman
Sometimes there is a need to configure some registers for setting some FW properties, such as the FW monitor mode (internal/external). This patch supports setting this for PCIe mode. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-01iwlwifi: pcie: add fh registers to dump dataLiad Kaufman
Adds all FH registers between FH_MEM_UPPER_BOUND and FH_MEM_LOWER_BOUND (which should be readable to the driver) to the dump data when it is collected. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-01iwlwifi: mvm: support ucode load for family_8000 B0 onlyEran Harary
The ucode load flow changed for B0 hardware step. Change the code accordingly. Signed-off-by: Eran Harary <eran.harary@intel.com> Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-12-01iwlwifi: pcie: claim ownership on the device after stop_device()Emmanuel Grumbach
Not doing so would allow other possible users of the device to take ownership and prevent normal WiFi operation. This fixes the second part of: https://bugzilla.kernel.org/show_bug.cgi?id=87191 Reviewed-by: Moshe Harel <moshe.harel@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-11-23iwlwifi: pcie: support loading FW with extended mem rangeArik Nemtsov
Toggle the LMPM_CHICK register when writing chunks into the FW's extended SRAM. This tells the FW to put the chunk into a different memory space. Signed-off-by: Arik Nemtsov <arikx.nemtsov@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-11-23iwlwifi: pcie: properly reset the deviceEmmanuel Grumbach
We were toggling the wrong bit when we reset the device, fix that. Moreover, since the reset can take time, we need to wait before we set the rfkill interrupt. Not doing so can be racy since the driver is enabling the rfkill interrupt while the device is resetting which will clear all the registers including the CSR_INT_MASK. This can basically lead to a situation where we don't enable the rfkill interrupt. If that happens, the user will not be able to re-enable the device when de-asserting rfkill. This scenario happened to the submitter of: https://bugzilla.kernel.org/show_bug.cgi?id=87191 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-11-23Merge remote-tracking branch 'wireless-next/master' into iwlwifi-nextEmmanuel Grumbach
2014-11-19Merge commit '4e6ce4dc7ce71d0886908d55129d5d6482a27ff9' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless
2014-11-11iwlwifi: pcie: newer platform needs a OS alive indicationEmmanuel Grumbach
This is fully backward compatible with older platforms. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-11-11iwlwifi: pcie: introduce delay when waking up the deviceEmmanuel Grumbach
In some rare cases, the firmware can put the device to sleep after the driver requested the access. This is because the access request can take a short time to be propagated to the firmware. If that happens, the driver may think that it has access since the firmware hasn't put the device to sleep yet, but right after the driver's check, the firmware might put the device to sleep. Warn when this happens by allowing the firmware to finish the "put the device sleep" flow so that the driver will not get access to the device. This will make the issue visible. This still doesn't fix the race, but at least it makes it more visible. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-11-11iwlwifi: pcie: fix prph dump lengthLiad Kaufman
The length counting previously done had an error in it, causing the length down the data dumping function to be shorter than it should be, causing the end of the data to get truncated off and lost. Cc: <stable@vger.kernel.org> [3.17+] Fixes: 67c65f2cf710 ("iwlwifi: dump periphery registers to fw-error-dump") Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-11-03iwlwifi: fix RFkill while calibratingEmmanuel Grumbach
If the RFkill interrupt fires while we calibrate, it would make the firmware fail and the driver wasn't able to recover. Change the flow so that the driver will kill the firmware in that case. Since we have now two flows that are calling trans_stop_device (the RFkill interrupt and the op_mode_mvm_start function) - we need to better sync this. Use the STATUS_DEVICE_ENABLED in the pcie transport in an atomic way to achieve this. This fixes: https://bugzilla.kernel.org/show_bug.cgi?id=86231 CC: <stable@vger.kernel.org> [3.10+] Reviewed-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Luciano Coelho <luciano.coelho@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-10-29iwlwifi: mvm: port to devcoredump frameworkJohannes Berg
iwlwifi features a debug mechanism that allows to dump binary data which is helpful to debug the firmware. Until now, this data was made available for the userspace through debugfs. For this exact purpose, devcoredump was created. Move to the new infrastructure. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-10-29iwlwifi: always run the secured flow for family 8000Eran Harary
In the new format the "CSS section" has the same TLV type as the "mem section". So we need to run the secured flow for all the 8000 products. Signed-off-by: Eran Harary <eran.harary@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-10-29iwlwifi: pcie: fix recovery from ARC reset in WoWLANEmmanuel Grumbach
When the ARC is reset when we exit from Sx in case we had WoWLAN running, we can't access the prph before we reset the NIC. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-10-29iwlwifi: pcie: warn if extern fw_debug buffer failedEmmanuel Grumbach
Otherwise we have no way to know that the buffer hasn't been allocated. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-10-23iwlwifi: pcie: fix polling in various placesEmmanuel Grumbach
iwl_poll_bit may return a strictly positive value when the poll doesn't match on the first try. This was caught when WoWLAN started failing upon resume even if the poll_bit actually succeeded. Also change a wrong print. If we reach the end of iwl_pcie_prepare_card_hw, it means that we couldn't get the devices. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Luciano Coelho <luciano.coelho@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-10-23iwlwifi: configure the LTREmmanuel Grumbach
The LTR is the handshake between the device and the root complex about the latency allowed when the bus exits power save. This configuration was missing and this led to high latency in the link power up. The end user could experience high latency in the network because of this. Cc: <stable@vger.kernel.org> [3.10+] Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-09-21iwlwifi: pcie: fix HW_REV saving for 8000 seriesLiad Kaufman
Align the trans->hw_rev variable format with previous series format. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-09-14iwlwifi: make hw rev checking more readableLiad Kaufman
Rather than ANDing with a mask - use existing macros, which are more readable. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-09-14iwlwifi: trans: don't configure the set_active in SCD for dvmEmmanuel Grumbach
This configuration is not needed for dvm, and it actually broke it. Reported-by: Oliver Hartkopp <socketcan@hartkopp.net> 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-07-22iwlwifi: dump CSRs to fw-error-dumpEmmanuel Grumbach
Add the Control Status Registers to the firmware error dump infrastructure. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-07-22iwlwifi: dump periphery registers to fw-error-dumpEmmanuel Grumbach
Use the fw-error-dump infrastructure to dump the periphery registers. Only certain ranges are readable, so dump only these. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-07-22iwlwifi: split fw-error-dump between transport and mvmEmmanuel Grumbach
The mvm op_mode won't allocate the buffer for the transport any more. The transport allocates its own buffer and mvm is in charge of splicing the buffers in the debugfs hook. This makes the repartition easier to handle. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-07-06iwlwifi: rename iwl_fw_error_fw_mon to iwl_fw_error_dump_fw_monEmmanuel Grumbach
This is matches the convention of the other structures. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-06-24iwlwifi: update trans->hw_rev 8000 hw family formatLiad Kaufman
The format of the CSR_HW_REV register has changed in 8000 HW family. To keep backwards compatibility, we store the value of this register as usual in trans->hw_rev, only we store it in the old format in this variable. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-06-24iwlwifi: pcie: improve debugfs queue infoAndy Lutomirski
This adds need_update and write_actual to rx_queue and need_update and an HCMD indicator to tx_queue. On my card, rx_queue now looks like: read: 181 write: 180 write_actual: 176 need_update: 0 free_count: 40 closed_rb_num: 181 tx_queue now looks like: hwq 00: read=29 write=30 use=1 stop=0 need_update=0 hwq 01: read=0 write=0 use=1 stop=0 need_update=0 hwq 02: read=128 write=128 use=1 stop=0 need_update=0 hwq 03: read=0 write=0 use=1 stop=0 need_update=0 hwq 04: read=94 write=94 use=1 stop=0 need_update=0 HCMD hwq 05: read=0 write=0 use=0 stop=0 need_update=0 hwq 06: read=0 write=0 use=0 stop=0 need_update=0 hwq 07: read=0 write=0 use=0 stop=0 need_update=0 hwq 08: read=0 write=0 use=0 stop=0 need_update=0 hwq 09: read=0 write=0 use=0 stop=0 need_update=0 hwq 10: read=0 write=0 use=0 stop=0 need_update=0 hwq 11: read=0 write=0 use=0 stop=0 need_update=0 hwq 12: read=0 write=0 use=0 stop=0 need_update=0 hwq 13: read=0 write=0 use=0 stop=0 need_update=0 hwq 14: read=0 write=0 use=0 stop=0 need_update=0 hwq 15: read=0 write=0 use=0 stop=0 need_update=0 hwq 16: read=0 write=0 use=0 stop=0 need_update=0 hwq 17: read=0 write=0 use=0 stop=0 need_update=0 hwq 18: read=0 write=0 use=0 stop=0 need_update=0 hwq 19: read=0 write=0 use=0 stop=0 need_update=0 This may help with debugging queue stalls. Signed-off-by: Andy Lutomirski <luto@amacapital.net> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-06-24iwlwifi: pcie: add firmware monitor capabilitiesEmmanuel Grumbach
This allows to use the firmware monitor. This capability uses a lot of contiguous memory (up to 64MB), so make its usage module parameter dependent. The driver will try to allocate as much contiguous memory as possible downgrading its requirements until the allocation succeeds. Dump this data into the fw-error dump file when an error happens. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-05-13Merge remote-tracking branch 'iwlwifi-fixes/master' into HEADEmmanuel Grumbach
2014-05-11iwlwifi: pcie: try to get ownership several timesEmmanuel Grumbach
Some races with the hardware can happen when we take ownership of the device. Don't give up after the first try. Cc: <stable@vger.kernel.org> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-05-07iwlwifi: pcie: disable interrupts upon PCIe allocEmmanuel Grumbach
In case RFKILL is in KILL position, the NIC will issue an interrupt straight away. This interrupt won't be sent because it is masked in the hardware. But if our interrupt service routine is called for another reason (SHARED_IRQ), then we'll look at the interrupt cause and service it. This can cause bad things if we are not ready yet. Explicitly clean the interrupt cause register to make sure we won't service anything before we are ready to. Cc: <stable@vger.kernel.org> [3.14] Reported-and-tested-by: Alexander Monakov <amonakov@gmail.com> Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-05-06iwlwifi: mvm/pcie: capture last commands on firmware errorJohannes Berg
When a firmware error occurs, capture the last 32 commands (which are still in memory) in the error dump debugfs file. 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: mvm: replace BUG_ON by WARN_ON in scan.cEmmanuel Grumbach
While the scan_cmd should really be allocated in init (and we do fail init in case the allocation failed), it doesn't mean we should lock up the machine if something really bad happened. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2014-04-13iwlwifi: pcie: WARN upon traffic while flushing TX queuesEmmanuel Grumbach
This must not happen - otherwise we might keep flushing forever. Reviewed-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>