summaryrefslogtreecommitdiff
path: root/drivers/net/wireless/intel/iwlwifi/iwl-trans.c
AgeCommit message (Collapse)Author
2023-12-12wifi: iwlwifi: remove async command callbackJohannes Berg
There's only one user of this code, which is STA unblock during sleep for uAPSD on really old devices. Instead of having this all through the API with calls up and down, just implemented a special-case CMD_BLOCK_TXQS flag for this, it's only needed in the old gen1 transport. While at it, fix a complain that lockdep would have, as we lock the cmd queue and then the TXQs in the reclaim by using spin_lock_nested(). We no longer need to disable BHs in iwl_trans_pcie_block_txq_ptrs() since it's called with them disabled already. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com> Link: https://msgid.link/20231207044813.2bd95e0570fc.I16486dbc82570d2f73a585872f5394698627310d@changeid Signed-off-by: Johannes Berg <johannes.berg@intel.com>
2023-07-11wifi: iwlwifi: remove 'use_tfh' config to fix crashJohannes Berg
This is equivalent to 'gen2', and it was always confusing to have two identical config entries. The split config patch actually had been originally developed after removing 'use_tfh" and didn't add the use_tfh in the new configs as they'd later been copied to the new files. Thus the easiest way to fix the init crash here now is to just remove use_tfh (which is erroneously unset in most of the configs now) and use 'gen2' in the code instead. There's possibly still an unwind error in iwl_txq_gen2_init() as it crashes if TXQ 0 fails to initialize, but we can deal with it later since the original failure is due to the use_tfh confusion. Tested-by: Xi Ruoyao <xry111@xry111.site> Reported-and-tested-by: Niklāvs Koļesņikovs <pinkflames.linux@gmail.com> Reported-and-tested-by: Jeff Chua <jeff.chua.linux@gmail.com> Reported-and-tested-by: Zhang Rui <rui.zhang@intel.com> Link: https://bugzilla.kernel.org/show_bug.cgi?id=217622 Link: https://lore.kernel.org/all/9274d9bd3d080a457649ff5addcc1726f08ef5b2.camel@xry111.site/ Link: https://lore.kernel.org/all/CAAJw_Zug6VCS5ZqTWaFSr9sd85k%3DtyPm9DEE%2BmV%3DAKoECZM%2BsQ@mail.gmail.com/ Fixes: 19898ce9cf8a ("wifi: iwlwifi: split 22000.c into multiple files") Signed-off-by: Johannes Berg <johannes.berg@intel.com> Link: https://lore.kernel.org/r/20230710145038.84186-2-johannes@sipsolutions.net Signed-off-by: Jakub Kicinski <kuba@kernel.org>
2022-02-18iwlwifi: cfg: add support for 1K BA queueMordechay Goodstein
In order to support 1K aggregations start ba queue with at least double the size, also allocate based on the connecting type to save memory usage. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20220128153014.16b43fe3e92f.I853c57648feee4b69ccb01ef4c75354377d60be2@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2022-02-18iwlwifi: propagate (const) type qualifierBjoern A. Zeeb
Most of this change is a continuation of commit 403ea939ea6a ("iwlwifi: dbg: Mark ucode tlv data as const") propagating the (const) type qualifier for ucode based tlv data to avoid having the impression that it is writeable. The other part of the change preserves the (const) type qualifier over casts and function calls where it was previously lost. Both changes are needed to avoid compile time errors on system with more strict error settings, in this case found with clang on FreeBSD. Sponsored by: The FreeBSD Foundation Signed-off-by: Bjoern A. Zeeb <bz@FreeBSD.ORG> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> [fix double word in commit message] Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20220128153014.3230c41312fc.I0032c597984834258d5a79b97052ed83dbe53b80@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-04-14iwlwifi: trans/pcie: defer transport initialisationJohannes Berg
In a few PCIe devices we may have to swap out the configuration after we allocate/initialise some parts of the device because we only know the correct one after reading some registers. This causes some things such as the byte-count table allocations to be incorrect, since the configuration is swapped for one with a bigger queue size. Fix this by initialising most of the transport much later, only after the configuration has finally been determined. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210411132130.8f5db97db1e4.Ic622da559b586a04ca536a0ec49ed5ecf03a9354@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-10iwlwifi: correction of group-id once sending REPLY_ERRORMukesh Sisodiya
Once sending the REPLY_ERROR group ID is not set and this lead to get it set to wrong value LONG_GROUP later in default handling Fix this by checking the REPLY_ERROR and avoid changing the Group ID Signed-off-by: Mukesh Sisodiya <mukesh.sisodiya@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210210142629.82578caaea84.I0ca9cfdd4e656d2e88ee7696dd6baf4267e7cb52@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-05iwlwifi: tx: move handing sync/async host command to transMordechay Goodstein
Handling host commands in a sync way is not directly related to PCIe transport, and can serve as common logic for any transport, so move it to trans layer. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210117164916.fde99af4e0f7.I4cab95919eb35cc5bfb26d32dcf5e15419d0e0ef@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2021-02-05iwlwifi: mvm: don't send commands during suspend\resume transitionHaim Dreyfuss
D3_CONFIG_CMD and D0I3_END_CMD should be the last\first command upon suspend\resume correspondingly, otherwise, FW will raise an assert (0x342). There are firmware notifications that cause the driver to send a command back to the firmware. If such a notification is sent to the driver while the the driver prepares the firmware for D3, operation, what is likely to happen is that the handling of the notification will try to get the mutex and will wait unil the driver finished configuring the firmware for D3. Then the handling notification will get the mutex and handle the notification which will lead to the aforementioned ASSERT 342. To avoid this, we need to prevent any command to be sent to the firmware between the D3_CONFIG_CMD and the D0I3_END_CMD. Check this in the utility layer that sends the host commands and in the transport layer as well. Flag the D3_CONFIG_CMD and the D0I3_END_CMD commands as commands that must be sent even if the firmware has already been configured for D3 operation. Signed-off-by: Haim Dreyfuss <haim.dreyfuss@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20210117164916.1935a993b471.I3192c93c030576ca16773c01b009c4d93610d6ea@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-12-10iwlwifi: use SPDX tagsJohannes Berg
Use SPDX tags instead of the long copyright notices. Also cleanup some duplicate copyright notices and combine the years where possible. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20201210000603.481bcb512a6f.I8146abe5a637079e7336209f23cb26af98b12b31@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-10-09Revert "iwlwifi: remove wide_cmd_header field"Luca Coelho
This reverts commit 0a8159cbd11abf586693f1ec5264d0df587b71d8. It turns out that this flag is used by iwldvm, so we can't get rid of it. This broke iwldvm devices with BAD_COMMAND errors. Fixes: 0a8159cbd11a ("iwlwifi: remove wide_cmd_header field") Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Signed-off-by: Kalle Valo <kvalo@codeaurora.org> Link: https://lore.kernel.org/r/iwlwifi.20201009122123.3e4ee0ad7a71.Id6d95ae601f048aeb4d2ed63a1712e469da84369@changeid
2020-10-01iwlwifi: move all bus-independent TX functions to common codeMordechay Goodstein
After moving out all Tx fields not related to pcie-bus it's time to move the code to a common place. We also rename all pcie functions name to txq. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20200930161256.3947a5276003.I3fe1bec2b25a965a49532df288f47b8b59eb1500@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-10-01iwlwifi: remove wide_cmd_header fieldMordechay Goodstein
Driver doesn't support fw without wide_cmd so driver always sets it to true. instead of setting it always to true just remove the field. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20200928121852.e6137861d917.I93405604eb503568688b28d3169fea7fbb88ed7e@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-10-01iwlwifi: iwl-trans: move tfd to trans layerMordechay Goodstein
The tfd_* code is not directly related to the PCIe transport, so move the structures it uses to the common iwl-trans.h header. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20200924162105.a1a2ce2bce38.Ieada0fe087ebcc9bc84e22fc5abc9dba8914dd9f@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-10-01iwlwifi: move bc_pool to a common trans headerMordechay Goodstein
The bc_pool code is not directly related to the PCIe transport, so move the structures it uses to the common iwl-trans.h header. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20200924162105.f6469c62665d.Id920f1ae8f70886b66a98956a6412726d29a9481@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2020-10-01iwlwifi: iwl-trans: move all txcmd init to trans allocMordechay Goodstein
txcmd fields is not directly related to the PCIe transport, so move to the common iwl_trans_alloc function. Signed-off-by: Mordechay Goodstein <mordechay.goodstein@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com> Link: https://lore.kernel.org/r/iwlwifi.20200924162105.862ef88d1ab2.Iba220a962b5d6d05c030b9275d97a89202d055dc@changeid Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-12-23iwlwifi: pcie: allocate smaller dev_cmd for TX headersJohannes Berg
As noted in the previous commit, due to the way we allocate the dev_cmd headers with 324 byte size, and 4/8 byte alignment, the part we use of them (bytes 20..40-68) could still cross a page and thus 2^32 boundary. Address this by using alignment to ensure that the allocation cannot cross a page boundary, on hardware that's affected. To make that not cause more memory consumption, reduce the size of the allocations to the necessary size - we go from 324 bytes in each allocation to 60/68 on gen2 depending on family, and ~120 or so on gen1 (so on gen1 it's a pure reduction in size, since we don't need alignment there). To avoid size and clearing issues, add a new structure that's just the header, and use kmem_cache_zalloc(). Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-09-06iwlwifi: pcie: set iwl_trans->cfg later in the probe functionLuca Coelho
Instead of setting the cfg to iwl_trans already during allocation, set it only later when we have had the time to decide which cfg to use. This is part of the effort to be able to decide the cfg based on HW revision and RF ID after iwl_trans_alloc() has been called. For now, since we still have a bunch of code checking the HW revision and the RF ID, we set iwl_trans->cfg early, even before we decided the real cfg to use. We only use the trans configuration at this point, so this is fine for now. In the future, the trans configuration will be completely independent from the rest of the config structure, so we'll be able to avoid this. Additionally, we can't access the PRPH registers in iwl_trans_alloc() anymore, so move the HW REV C-step check for family 8000 code later to the probe function as well. This step is probably not necessary, but if that's the case it should be removed separately later on. Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2019-09-06iwlwifi: pcie: remove the refs / unrefs from the transportEmmanuel Grumbach
This code is now stale Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2018-08-31iwlwifi: remove all occurrences of the FSF address paragraphLuca Coelho
The Free Software Foundation address is superfluous and causes checkpatch to issue a warning when present. Remove all paragraphs with FSF's address to prevent that. Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-10-06iwlwifi: trans: move ref/unref code to the common part of the transportLuca Coelho
De-inline iwl_trans_ref/unref and move it to common transport code in preparation for more common code to come to these functions. 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: remove resp_pkt NULL checksJohannes Berg
Contrary to what some of the comments say, if rfkill was asserted the transport will return -ERFKILL instead of success, if CMD_WANT_SKB was set, so it's not necessary to check cmd.resp_pkt for being NULL if the return code was success. Validate that this is true in iwl_trans_send_cmd(). Most of the other code modifications were done with the following spatch: @@ struct iwl_host_cmd cmd; identifier pkt; @@ <... ( pkt = cmd.resp_pkt; ... -if (!pkt) { ... } | pkt = cmd.resp_pkt; ... -if (WARN_ON(!pkt)) { ... } | -if (!cmd.resp_pkt) { ... } ) ...> Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-06-02iwlwifi: add wait for tx queue emptySara Sharon
Now that we have 512 queues, add a wait for single TX queue to gen2. This replaces gen1 wait_tx_queues_empty, which was limited to 32 queues. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2017-04-11iwlwifi: remove unnecessary dev_cmd_headroom parameterLuca Coelho
We don't need this parameter anymore, since we always pass 0 anyway. Remove it from the structure and from all the relevant functions. Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2016-09-19iwlwifi: migrate to devm_* APISharon Dvir
Change PCIE and trans resource allocations to managed resources. Signed-off-by: Sharon Dvir <sharon.dvir@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2016-09-19iwlwifi: move to wide ID for all commandsSara Sharon
Due to firmware design considerations, move to wide ID for all commands. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2016-09-15iwlwifi: pcie: introduce new tfd and tb formatsSara Sharon
New hardware supports bigger TFDs and TBs. Introduce the new formats and adjust defines and code relying on old format. Changing the actual TFD allocation is trickier and deferred to the next patch. Signed-off-by: Sara Sharon <sara.sharon@intel.com> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
2015-12-13iwlwifi: update host command messages to new formatSharon Dvir
Host commands now have a group id, express this in printed messages. Signed-off-by: Sharon Dvir <sharon.dvir@intel.com> Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-12-13iwlwifi: uninline iwl_trans_send_cmdEmmanuel Grumbach
This function got too big to be inlined. Uninline it. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-12-01iwlwifi: change the Intel Wireless email addressEmmanuel Grumbach
ilw@linux.intel.com is not available anymore. linuxwifi@intel.com should be used instead. Signed-off-by: Emmanuel Grumbach <emmanuel.grumbach@intel.com>
2015-11-18iwlwifi: move under intel vendor directoryKalle Valo
Part of reorganising wireless drivers directory and Kconfig. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>