summaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless/iwlwifi/iwl-trans-pcie-tx.c
AgeCommit message (Collapse)Author
2012-06-06iwlwifi: move PCIe into subdirectoryJohannes Berg
Structure the code a bit more and move all PCIe code including the hardware configuration files into a PCIe specific subdirectory. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2012-06-05iwlwifi: clean up coding style in PCIe transportJohannes Berg
Mostly clean up indentation around parentheses after if, function calls, etc. and also a few unneeded line breaks and some other things. Reviewed-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05iwlwifi: s/iwlagn_unmap_tfd/iwl_unmap_tfdEmmanuel Grumbach
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-06-05iwlwifi: s/iwlagn_txq_free_tfd/iwl_txq_free_tfdEmmanuel Grumbach
Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-05-25iwlwifi: fix the Transmit Frame Descriptor ringsEmmanuel Grumbach
The logic that allows to have a short TFD queue was completely wrong. We do maintain 256 Transmit Frame Descriptors, but they point to recycled buffers. We used to attach and de-attach different TFDs for the same buffer and it worked since they pointed to the same buffer. Also zero the number of BDs after unmapping a TFD. This seems not necessary since we don't reclaim the same TFD twice, but I like housekeeping. This patch solves this warning: [ 6427.079855] WARNING: at lib/dma-debug.c:866 check_unmap+0x727/0x7a0() [ 6427.079859] Hardware name: Latitude E6410 [ 6427.079865] iwlwifi 0000:02:00.0: DMA-API: device driver tries to free DMA memory it has not allocated [device address=0x00000000296d393c] [size=8 bytes] [ 6427.079870] Modules linked in: ... [ 6427.079950] Pid: 6613, comm: ifconfig Tainted: G O 3.3.3 #5 [ 6427.079954] Call Trace: [ 6427.079963] [<c10337a2>] warn_slowpath_common+0x72/0xa0 [ 6427.079982] [<c1033873>] warn_slowpath_fmt+0x33/0x40 [ 6427.079988] [<c12dcb77>] check_unmap+0x727/0x7a0 [ 6427.079995] [<c12dcdaa>] debug_dma_unmap_page+0x5a/0x80 [ 6427.080024] [<fe2312ac>] iwlagn_unmap_tfd+0x12c/0x180 [iwlwifi] [ 6427.080048] [<fe231349>] iwlagn_txq_free_tfd+0x49/0xb0 [iwlwifi] [ 6427.080071] [<fe228e37>] iwl_tx_queue_unmap+0x67/0x90 [iwlwifi] [ 6427.080095] [<fe22d221>] iwl_trans_pcie_stop_device+0x341/0x7b0 [iwlwifi] [ 6427.080113] [<fe204b0e>] iwl_down+0x17e/0x260 [iwlwifi] [ 6427.080132] [<fe20efec>] iwlagn_mac_stop+0x6c/0xf0 [iwlwifi] [ 6427.080168] [<fd8480ce>] ieee80211_stop_device+0x5e/0x190 [mac80211] [ 6427.080198] [<fd833208>] ieee80211_do_stop+0x288/0x620 [mac80211] [ 6427.080243] [<fd8335b7>] ieee80211_stop+0x17/0x20 [mac80211] [ 6427.080250] [<c148dac1>] __dev_close_many+0x81/0xd0 [ 6427.080270] [<c148db3d>] __dev_close+0x2d/0x50 [ 6427.080276] [<c148d152>] __dev_change_flags+0x82/0x150 [ 6427.080282] [<c148e3e3>] dev_change_flags+0x23/0x60 [ 6427.080289] [<c14f6320>] devinet_ioctl+0x6a0/0x770 [ 6427.080296] [<c14f8705>] inet_ioctl+0x95/0xb0 [ 6427.080304] [<c147a0f0>] sock_ioctl+0x70/0x270 Cc: stable@vger.kernel.org Reported-by: Antonio Quartulli <ordex@autistici.org> Tested-by: Antonio Quartulli <ordex@autistici.org> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Reviewed-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-23iwlwifi: clean up iwl-shared.h includesJohannes Berg
That file is now holding just a few defines and the module parameters, so it shouldn't include anything. Make sure the right users include the right files instead. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-04-18iwlwifi: improve TX cache footprintJohannes Berg
Having cmd[], meta[] and skbs[] as separate arrays in the TX queue structure is cache inefficient as we need the data for a given entry together. To improve this, create an array with these three members (allocate meta as part of that struct) so we have the data we need together located together improving cache footprint. The downside is that we need to allocate a lot of memory in one chunk, about 10KiB (on 64-bit) which isn't very efficient. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-04-18iwlwifi: transport holds its pointer to the configEmmanuel Grumbach
Instead of using the shared area that we be killed. Remove the pointer to config from shared since it is not used any more. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-04-16iwlwifi: remove get_cmd_stringJohannes Berg
The command strings are needed through the layers for debug and error messages, but can differ with opmode. As a result, we need to give the command names to the transport layer as configuration. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-04-16iwlwifi: move status definitions from iwl-sharedDon Fry
The code has been changed, move the definitions to the proper file being used by the code. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-04-16iwlwifi: move HCMD_ACTIVE to transDon Fry
The HCMD_ACTIVE bit is only used in trans. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-04-12iwlwifi: move queue watchdog into transportJohannes Berg
This removes one of the two sources of device restarts in the upper layer -- those are a bit inconvenient because normal restarts originate in the transport. By moving the watchdog down it can be treated the same. Also rewrite the watchdog logic. Timers are much more efficient when they never fire, so instead firing a timer every 500ms set up a timer for each TX queue and fire it only when the queue is really stuck. This avoids the CPU waking up when everything is working well. While at it, remove the wd_disable config item and replace it by simply setting wd_timeout to IWL_WATCHHDOG_DISABLED (0). Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-12iwlwifi: move rx_page_order into transportJohannes Berg
That way it isn't needed in hw_params, which is shared data. It also isn't really what we should configure in the transport, that is better just 4k/8k, so configure a bool and derive the page order in the transport. This also means the transport doesn't need access to the module parameter any more. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-09iwlwifi: split POWER_PMI status bitDon Fry
Move the POWER_PMI to the op_mode where it is changed. The trans needs to check it frequently, so shadow the status in the trans and update it in trans when it infrequently changes. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-09iwlwifi: move FW_ERROR to privDon Fry
The op_mode should check for FW_ERROR before calling send_cmd. This removes the need to test for FW_ERROR in the trans layer. Signed-off-by: Don Fry <donald.h.fry@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-09iwlwifi: move queue mapping out of transportJohannes Berg
The queue mapping is not only dynamic, it is also dependent on the uCode, as we can already see today with the dual-mode and non-dual-mode being different. Move the queue mapping out of the transport layer and let the higher layer manage it. Part of the transport configuration is how to set up the queues. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-04-09iwlwifi: add trailing newline to various messagesJohannes Berg
A whole bunch of messages, even some recent ones, didn't include a trailing newline so add it. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-16Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem Conflicts: drivers/net/wireless/ath/ath9k/hw.c
2012-03-12iwlwifi: move wait_command_queue from shared to transMeenakshi Venkataraman
This wait queue really belongs to the transport layer, as it is used for sending synchronous commands to the HW. However, only op_mode knows about errors and exceptional conditions, so make this queue accessible by the op_mode. Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-09Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
2012-03-09iwlwifi: fix the delta for remove max_txq_num patchWey-Yi Guy
BIg portion of "iwlwifi: remove max_txq_num from hw_params" was missing during merge, here is the fix for it. Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-09iwlwifi: move command queue number out of the iwl_shared structMeenakshi Venkataraman
The command queue number is required by the transport layer, but it can be determined only by the op mode. Move this parameter to the dvm op mode, and configure the transport layer using an API. Signed-off-by: Meenakshi Venkataraman <meenakshi.venkataraman@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-07iwlwifi: move ucode_owner to privJohannes Berg
The transport doesn't really need to know as we can enforce it in the command wrapper. Move the ucode_owner variable into priv and do all enforcing there. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-07iwlwifi: virtualize command queue full behaviourJohannes Berg
When the command queue is full, the transport will return -ENOSPC, but the reaction to that depends on the op_mode. Virtualize that, the DVM op_mode checks for CT-kill and restarts the hardware otherwise. We may be able to get rid of this callback by putting the behaviour check into the wrapper but that needs more careful evaluation. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-07iwlwifi: make tracing use device as identifierJohannes Berg
Tracing used the priv pointer as an identifier, which has the problem that we don't have it in all code, and also some people say no pointers should be "leaked" to userspace. Use the device name instead, it is more useful anyway. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-07iwlwifi: remove shadow_reg_enable from hw_paramsJohannes Berg
There's no need to copy shadow_reg_enable into hw_params since it is a pure hardware parameter that will never change, we can access it from the config directly. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-07iwlwifi: move lockdep assertion into DVMJohannes Berg
The fact that the mutex must be held is an implementation detail of DVM, but something has to ensure that no two synchronous cmds are submitted concurrently. Move the lockdep assertion into the DVM-specific code, but also make the transport abort if there are two concurrently commands. The assertion is much more useful though as the transport check can only catch it when it actually happens, while the assertion makes sure it can't possibly happen. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-07iwlwifi: move RF/CT kill check to command wrapperJohannes Berg
Currently, we cannot send any commands when the uCode is in RF or CT kill, but that will not be true for all new uCode versions, so we need to move the check into the uCode specific code. Also remove the duplicate rfkill check. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06iwlwifi: move tid_to_ac to PCI-EJohannes Berg
Currently, queue mapping is handled in the transport. This may change, but until then the code for it can be close to where it's used rather than in iwl-shared.h. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06iwlwifi: don't pass iwl_rx_mem_buffer to upper layersJohannes Berg
struct iwl_rx_mem_buffer implementation details (DMA address, list pointers) that the upper layers don't need. Introduce iwl_rx_cmd_buffer that is passed upstream and only contains the needed data (the page). Additionally, access this data only via accessor functions, allowing us to change the implementation in the future. These accessors are rxb_addr() (as before) and rxb_steal_page() to take ownership of the data. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06iwlwifi: pass response packet directlyJohannes Berg
When CMD_WANT_SKB is set for a (synchronous) command, the response is passed back to the caller which is then responsible for freeing it. Make this more abstract with real API, passing directly the response packet in the new cmd.resp_pkt member and also introduce iwl_free_resp() to free the pages -- this way the upper layers don't have to directly touch the page implementation. NOTE: This breaks IDI -- the new code isn't reflected there yet! Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06iwlwifi: make EXIT_PENDING depend on mac80211Johannes Berg
There's no reason to set EXIT_PENDING when we start removing the module, as mac80211 will cleanly shut down the device in this case. Additionally, there's no point in rejecting commands to the device when we're cleaning up as that only leads to unwanted errors from mac80211 being printed, such as failed to remove key (...) from hardware (-16) Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-06iwlwifi: introduce per-queue locksJohannes Berg
Instead of (ab)using the sta_lock, make the transport layer lock its own TX queue data structures with a lock per queue. This also unifies with the cmd queue lock. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-03-05Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
2012-02-27iwlwifi: virtualize op_mode's fw_errorEmmanuel Grumbach
Export it as "nic_error" notification, the error handling will be in the op_mode. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-27iwlwifi: virtualize op_mode's free skbEmmanuel Grumbach
This handler allows the transport layer to free an skb from the op_mode. This can happen when the driver is stopped while Tx packets are pending in the transport layer. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-21Merge branch 'master' of ↵John W. Linville
git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next into for-davem
2012-02-17iwlwifi: give PCIe its own lockJohannes Berg
Instead of using a global lock, the PCIe transport can use an own lock for its IRQ. This will make it possible to not disable IRQs for the shared lock. The lock is currently used throughout the code but this can be improved even further by splitting up the locking for the queues. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Reviewed-by: Wey-Yi W Guy <wey-yi.w.guy@intel.com>
2012-02-13drivers/net: Remove boolean comparisons to true/falseJoe Perches
Booleans should not be compared to true or false but be directly tested or tested with !. Done via cocci script: @@ bool t; @@ - t == true + t @@ bool t; @@ - t != true + !t @@ bool t; @@ - t == false + !t @@ bool t; @@ - t != false + t Signed-off-by: Joe Perches <joe@perches.com> Reviewed-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2012-02-02iwlwifi: debug print in tx_queue_set_status is more clearEmmanuel Grumbach
The message was misleading when a queue is deactivated. The fifo number is irrelevant then, so don't print it. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-02-02iwlwifi: give trans to all the read / write functionsEmmanuel Grumbach
From now on, the transport layer in charge of providing access to the device. So change all the driver to give a pointer to the transport to all the low level functions that actually access the device. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2012-01-24iwlwifi: update CopyrightWey-Yi Guy
Update Copyright to 2012 Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com> Signed-off-by: John W. Linville <linville@tuxdriver.com>
2012-01-06iwlwifi: update CopyrightWey-Yi Guy
Update Copyright to 2012 Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: add debug in Tx path in AGG flowEmmanuel Grumbach
This will allow us to catch bad cases in which the packets aren't in the right place on the ring. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: tid_data logic move to upper layer - txqidEmmanuel Grumbach
The tid_data is not related to the transport layer, so move the logic that depends on it to the upper layer. This patch deals with the mapping of RA / TID to HW queues in AGG. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: tid_data logic move to upper layer - tx AGG setupEmmanuel Grumbach
The tid_data is not related to the transport layer, so move the logic that depends on it to the upper layer. This patch deals with tx AGG setup. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: tid_data logic move to upper layer - tx AGG allocEmmanuel Grumbach
The tid_data is not related to the transport layer, so move the logic that depends on it to the upper layer. This patch deals with tx AGG alloc. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: tid_data logic move to upper layer - tx AGG stopEmmanuel Grumbach
The tid_data is not related to the transport layer, so move the logic that depends on it to the upper layer. This patch deals with tx AGG stop. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: don't rely on the wr / rd pointers in DELBA flowEmmanuel Grumbach
In the same spirit as the previous patch. Eventually this will allow us to remove the tid_data knowledge from the transport layer. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>
2011-12-16iwlwifi: don't count the tfds in HW queue any moreEmmanuel Grumbach
Since packets sent to an RA / TID in AGG are sent from a separate HW Tx queue, we may get into a race: the regular queue isn't empty while we already begin to send packets from the AGG queue. This would result in sending packets out of order. In order to cope with this, mac80211 waits until the driver reports that the legacy queue is drained before it can send packets to the AGG queue. During that time, mac80211 buffers packets for the driver. These packets will be sent in order after the driver reports it is ready. The way this was implemented in the driver is as follows: We held a counter that monitors the number of packets for an RA / TID in the HW queues. When this counter reached 0, we knew that the HW queues were drained and we reported to mac80211 that were ready to proceed. This patch changes the implementation described above. We now remember what is the wifi sequence number of the first packet that will be sent in the AGG queue (lets' call it ssn). When we reclaim the packet before ssn, we know that the queue is drained, and we are ready to proceed. This will allow us to move this logic in the upper layer and eventually remove the tid_data from the shared area. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Wey-Yi Guy <wey-yi.w.guy@intel.com>