summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
AgeCommit message (Collapse)Author
2019-03-22iwlwifi: add sync_nmi to trans opsShahar S Matityahu
Allow modules from outside pcie to call sync_nmi. Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-02-04iwlwifi: fix send hcmd timeout recovery flowShahar S Matityahu
Both iwl_trans_fw_error and iwl_force_nmi initiate async recovery flow. Calling them both is redundant and causing a race. Solve this by removing the call to iwl_trans_fw_error. Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com> Fixes: cfadc3ffccd5 ("iwlwifi: pcie: stop the firmware when we restart it") Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29iwlwifi: calculate pointers from out_cmd instead of out_cmd->hdrLuca Coelho
The out_cmd structure starts with a header, so there's no need to use &out_cmd->hdr, out_cmd alone is enough. We use this when calculating other addresses and klocwork gets confused with that because it thinks we are trying to access hdr (as an array) beyond its size. Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-29iwlwifi: pcie: fix the use of a wrong defineSara Sharon
The code checks that we haven't exceeded the maximum number of TBs by comparing to a define of gen1 instead of gen2, fix it. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-25iwlwifi: memcpy from dev_cmd and not dev_cmd->hdrLiad Kaufman
Klocwork complains about copying from dev_cmd->hdr if copying more than 4 bytes since it means part of the copy is from the next field. This isn't a real bug, but for not failing Klocwork next time - fix this. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-01-25iwlwifi: tighten boundary checksLiad Kaufman
The driver assumes certain sizes and lengths aren't crossed in some places. Make sure this indeed happens. Found by Klocwork. Signed-off-by: Liad Kaufman <liad.kaufman@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-12-20iwlwifi: pcie: use iwl_tx_cmd_gen2 and not iwl_tx_cmdSara Sharon
When building AMSDU for gen2, code uses iwl_tx_cmd. The only updated field is len, which is in the same location, so it is not a bug. However, it is a bit confusing and error prone, so change it. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2018-12-14iwlwifi: pcie: set cmd_len in the correct placeSara Sharon
command len is set too early in the code, since when building AMSDU, the size changes. This causes the byte count table to have the wrong size. Fixes: a0ec0169b7a9 ("iwlwifi: support new tx api") Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-11-11iwlwifi: pcie: don't reset TXQ write pointerSara Sharon
Currently code sets the write pointer when getting the TX queue allocate response. This causes a redundant interrupt with any actual change in the pointer. Remove this write altogether. Fixes: 310181ec34e2 ("iwlwifi: move to TVQM mode") Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-10-08iwlwifi: trace: change trace to trace one TB at a timeSara Sharon
Split TX tracing to be per TB. This is needed now that AMSDUs can be sent and skb can be larger than trace limit. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-10-08iwlwifi: pcie: don't pad AMSDU packetsSara Sharon
When we TX AMSDU, we shouldn't pad the packet. In the past, we were building AMSDU only in transport layer, and gen2 functions are built based on this. However, now that op mode may build AMSDUs, we need to take care of padding also in gen2 "non-pcie-amsdu" path. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-10-06iwlwifi: pcie gen2: check iwl_pcie_gen2_set_tb() return valueJohannes Berg
If we use the iwl_pcie_gen2_set_tb() return value for BIT(), we should validate that it's not going to be negative, so do the check and bail out if we hit an error. We shouldn't, as we check if it'll fit beforehand, but better be safe. Fixes: ab6c644539e9 ("iwlwifi: pcie: copy TX functions to new transport") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-09-28iwlwifi: pcie: gen2: build A-MSDU only for GSOJohannes Berg
If the incoming frame should be an A-MSDU, it may already be one, for example in the case of NAN multicast being encapsulated in an A-MSDU. Thus, use the GSO algorithm to build A-MSDU only if the skb actually contains GSO data. Fixes: 6ffe5de35b05 ("iwlwifi: pcie: add AMSDU to gen2") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-09-28iwlwifi: pcie: gen2: pull adding frags to helper routineJohannes Berg
Move the skb fragment loop into a helper routine to be able to reuse it later. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-08-31iwlwifi: refactor txq_alloc for supporting more command typeGolan Ben Ami
Support more txq_alloc command types by moving the command declaration to the gen specific area. While at it, move some of the code segments to a common place for re-use. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-08-31iwlwifi: pcie: make non-static hcmd and rx codeGolan Ben Ami
Allow other device generations to use the utilities that are used to send and reclaim host commands and to allocate rx, by making it non-static. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-08-31iwlwifi: pcie: allow using tx init for other queues but the command queueGolan Ben Ami
We would like to allow using tx init code for other queues but the command queue - for newer devices. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-08-02iwlwifi: pcie: split tx to amsdu and non amsduSara Sharon
The code is different enough to justify a split. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-08-02iwlwifi: pcie: include tcp.h implicitlyLuca Coelho
If CONFIG_IPV6 is not enabled in the kernel, tcp.h is not included implicitly from other header files, causing compilation errors. To solve that, explicitly include it in tx-gen2.c. Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-07-26iwlwifi: support new tx apiGolan Ben Ami
22560 devices use a new tx cmd api. Update the code to use the new api. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-07-26iwlwifi: support multiple tfd queue max sizes for different devicesGolan Ben Ami
22560 devices tfd queue max size is 2^16. Allow a configurable max size in the driver for supporting different devices. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-07-26iwlwifi: pcie: update bytes in the byte count tableGolan Ben Ami
For devices which use the image loader image, the length of the frame must be updated in the byte count in bytes, and not dwords as today. Avoid dividing the input length by 4. Signed-off-by: Golan Ben Ami <golan.ben.ami@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-04-20iwlwifi: pcie: gen2: fix race in cmd fifo write ptrShaul Triebitz
Avoid a race where two (or more) commands get the same index: 1. T1 calls enqueue_hcmd and the local TFD index is assigned to txq->write_ptr; 2. Context switch 'before incrementing txq->write_ptr'; 3. T2 calls enqueue_hcmd and the local TFD index is assigned to txq->write_ptr; 4. Now the index is set to the same value for both commands of T1 and T2. To prevent this from happening, set the local TFD index inside the critical section (the index is set by global txq write pointer). Signed-off-by: Shaul Triebitz <shaul.triebitz@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-04-20iwlwifi: pcie: use the queue size as sent by opmodeSara Sharon
Op mode will begin tp use varying size of TX queue. All the infra is in place, allow it. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-04-20iwlwifi: add TX queue size parameter to TX queue allocationSara Sharon
As preparation for dynamic queue sizing, add a parameter of the TX queue size to the dynamic queue allocation op mode API. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-04-20iwlwifi: Revert "iwlwifi: pcie: dynamic Tx command queue size"Sara Sharon
This reverts commit dd05f9aab4426ff178b12d601e50d19d336eba30. Shorter TX queues support was added eventually without the need for the parameters this patch added. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-04-20iwlwifi: pcie: allocate shorter TX queues for 22000 devicesSara Sharon
When support for shorter TX queues was introduced, it didn't include the actual allocation of shorter queue, which is the main motive for the change. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-04-20iwlwifi: pcie: implement the overlow queue for Gen2 devicesEmmanuel Grumbach
When we enable TSO, we can have a lot of packets in the operation mode that will be pushed to the transport no matter what is the queue's fullness state. To cope with that the transport can buffer those packets and add them to the ring later when there is more room. This implementation was missing in the Gen2 devices' code. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-02-16iwlwifi: pcie: don't warn if we use all the transmit pointersEmmanuel Grumbach
Our Transmit Frame Descriptor (TFD) is a DMA descriptor that includes several pointers to be able to transmit a packet which is not physically contiguous. Depending on the hardware being use, we can have 20 or 25 pointers in a single TFD. In both cases, it is more than enough and it is quite hard to hit this limit. It has been reported that when using specific applications (Ktorrent), we can actually use all the pointers and then a long standing bug showed up. When we free the TFD, we check its number of valid pointers and make sure it doesn't exceed the number of pointers the hardware support. This check had an off by one bug: it is perfectly valid to free the 20 pointers if the TFD has 20 pointers. Fix that. https://bugzilla.kernel.org/show_bug.cgi?id=197981 Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-01-05iwlwifi: pcie: fix DMA memory mapping / unmappingEmmanuel Grumbach
22000 devices (previously referenced as A000) can support short transmit queues. This means that we have less DMA descriptors (TFD) for those shorter queues. Previous devices must still have 256 TFDs for each queue even if those 256 TFDs point to fewer buffers. When I introduced support for the short queues for 22000 I broke older devices by assuming that they can also have less TFDs in their queues. This led to several problems: 1) the payload of the commands weren't unmapped properly which caused the SWIOTLB to complain at some point. 2) the hardware could get confused and we get hardware crashes. The corresponding bugzilla entries are: https://bugzilla.kernel.org/show_bug.cgi?id=198201 https://bugzilla.kernel.org/show_bug.cgi?id=198265 Cc: stable@vger.kernel.org # 4.14+ Fixes: 4ecab5616023 ("iwlwifi: pcie: support short Tx queues for A000 device family") Reviewed-by: Sharon, Sara <sara.sharon@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
2017-10-18iwlwifi: pcie: remove set but not used variable tcphJohannes Berg
This variable is never used, so remove the code to set it. After this, the variable 'iph' also has the same fate. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-10-06iwlwifi: pcie: dynamic Tx command queue sizeShahar S Matityahu
Devices in the A000 family can use a different size for the command queue. To allow this, make the command queue size configurable and set the size for A000 devices to 32. Signed-off-by: Shahar S Matityahu <shahar.s.matityahu@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-08-18iwlwifi: pcie: support short Tx queues for A000 device familyEmmanuel Grumbach
This allows to modify TFD_TX_CMD_SLOTS to a power of 2 which is smaller than 256. Note that we still need to set values to wrap at 256 into the scheduler's write pointer, but all the rest of the code can use shorter transmit queues. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-08-09iwlwifi: pcie: free the TSO page when a Tx queue is unmapped on A000 devicesEmmanuel Grumbach
When we unmap a non-empty Tx queue, we need to free the pages that we allocated for the headers in TSO flows. This code existed for the 9000 device family, but somehow it got left out when the new Tx path for the A000 devices was written. Fixes: 2b0c5946d9ed ("iwlwifi: pcie: introduce a000 TX queues management") Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-08-09iwlwifi: pcie: don't init a Tx queue with an SSN > size of the queueEmmanuel Grumbach
The TVQM tells us the initial write pointer for a queue, but that write pointer is in WiFi sequence number unit and not in TFD index unit. Which means that the write pointer in the TVQM's response can be bigger than the Tx queue ring size. Fix that by modulo'ing the write pointer from the TVQM with the Tx queue size. Fixes: 66128fa08806 ("iwlwifi: move to TVQM mode") Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-08-01iwlwifi: pcie: fix A-MSDU on gen2 devicesEmmanuel Grumbach
The return status check of iwl_pcie_gen2_build_amsdu was buggy. Fix it. Fixes: 6ffe5de35b05 ("iwlwifi: pcie: add AMSDU to gen2") Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-08-01iwlwifi: reorganize firmware APIJohannes Berg
Apart from DVM, all firmware uses the same base API, and there's code outside iwlmvm that needs to interact with it. Reflect this in the source better and reorganize the firmware API to a new fw/api/ directory. While at it, split the already pretty large fw-api.h file into a number of smaller files, going from almost 3k lines in there to a maximum number of lines less than 1k. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-23iwlwifi: fix TX tracing for non-linear SKBsJohannes Berg
When sending non-linear SKBs that should be included in the regular TX tracing completely (and not be pushed into the tx_data tracing), the (tracing) code didn't correctly take the fact that they were non-linear into account and added only the skb head portion. This probably never really triggered, since those frames we want traced fully are most likely linear anyway, but the code gets easier to understand and we lose an argument to the tracing function, so overall fixing this is better. Fixes: 206eea783385 ("iwlwifi: pcie: support frag SKBs") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-23iwlwifi: simplify data tracepointJohannes Berg
There's no need to calculate the data_len outside of the tracepoint, since it's always skb->len - hdr_len, which are both available inside. Simplify the callers and move the calculation in. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-23iwlwifi: pcie: don't report RF-kill enabled while shutting downJohannes Berg
When toggling the RF-kill pin quickly in succession, the driver can get rather confused because it might be in the process of shutting down, expecting all commands to go through quickly due to rfkill, but the transport already thinks the device is accessible again, even though it previously shut it down. This leads to bugs, and I even observed a kernel panic. Avoid this by making the PCIe code only report that the radio is enabled again after the higher layers actually decided to shut it off. This also pulls out this common RF-kill checking code into a common function called by both transport generations and also moves it to the direct method - in the internal helper we don't really care about the RF-kill status anymore since we won't report it up until the stop anyway. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-23iwlwifi: pcie: fix TVQM queue ID range checkJohannes Berg
The queue ID should never be 512 either, so correct the check to be >= instead of just >. Fixes: 310181ec34e2 ("iwlwifi: move to TVQM mode") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-05iwlwifi: pcie: add AMSDU to gen2Sara Sharon
This is essentially the same code as gen1, except that it uses gen2 functions and SW checksum is not included. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-02iwlwifi: mvm: support getting nvm data from firmwareSara Sharon
This API replaces the complex NVM parsing of the iwlwifi module. Instead, we get all needed data from firmware. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: move to TVQM modeSara Sharon
In TVQM firmware returns the value of the queue ID and code should accept it. The TX queue config API was changed. Move to new API. This has to be done in parallel in mvm and pcie. Do not move yet to 512 queues since there are some opens with enabling it. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: pcie: get rid of txq id assignmentSara Sharon
In TVQM mode the queue ID is assigned after enablement. Get rid of assuming pre-defined TX queue ID in functions that will be used by TVQM allocation path. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: pcie: alloc queues dynamicallySara Sharon
Change queue allocation to be dynamic. On transport init only the command queue is being allocated. Other queues are allocated on demand. This is due to the huge amount of queues we will soon enable (512) and as a preparation for TX Virtual Queue Manager feature (TVQM), where firmware will assign the actual queue number on demand. This includes also allocation of the byte count table per queue and not as a contiguous chunk of memory. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: pcie: prepare for dynamic queue allocationSara Sharon
In a000 transport we will allocate queues dynamically. Right now queue are allocated as one big chunk of memory and accessed as such. The dynamic allocation of the queues will require accessing the queues as pointers. In order to keep simplicity of pre-a000 tx queues handling, keep allocating and freeing the memory in the same style, but move to access the queues in the various functions as individual pointers. Dynamic allocation for the a000 devices will be in a separate patch. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: pcie: remove block and freeze operations from new transportSara Sharon
New transport will be used only by op modes that supports buffer station offload - hence those will never be called. Clean it up. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: pcie: support new write pointer widthSara Sharon
In a000 devices we have 16 bytes for the TFD index and 16 for the queue, in order to support 512 queues. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-19iwlwifi: pcie: support host commands in new transportSara Sharon
Code is basically the same, with a cleanups of old narrow host command, ampg workarounds, some cosmetic stuff, and usage of TFH functions when accessing TFD queues. This enables also the cleanup of iwl_pcie_tfd_set_tb() since now it won't be called anywhere in the a000 data path Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>