diff mbox series

[v2,35/47] iwlwifi: pcie: clean up some rx code

Message ID iwlwifi.20201209231352.6207fdcc91a9.Ia71e766ead7560262f4bc6ad3da6f1117c498cd6@changeid (mailing list archive)
State Accepted
Commit e4475583b5c49d5a90dcff9ae201018cd98c7d84
Delegated to: Luca Coelho
Headers show
Series iwlwifi: final patches for v5.11 2020-12-09 | expand

Commit Message

Luca Coelho Dec. 9, 2020, 9:16 p.m. UTC
From: Johannes Berg <johannes.berg@intel.com>

We don't need the sequence/index/cmd_index unless we're doing
reclaim, they're not even valid in the other cases. Move the
variables and their assignments into the right if statement
and combine the two if statements into a single one as well.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
---
 drivers/net/wireless/intel/iwlwifi/pcie/rx.c | 19 ++++++++-----------
 1 file changed, 8 insertions(+), 11 deletions(-)

Comments

Luca Coelho Dec. 9, 2020, 10:16 p.m. UTC | #1
Luca Coelho <luca@coelho.fi> wrote:

> From: Johannes Berg <johannes.berg@intel.com>
> 
> We don't need the sequence/index/cmd_index unless we're doing
> reclaim, they're not even valid in the other cases. Move the
> variables and their assignments into the right if statement
> and combine the two if statements into a single one as well.
> 
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
> Signed-off-by: Luca Coelho <luciano.coelho@intel.com>

13 patches applied to iwlwifi-next.git, thanks.

e4475583b5c4 iwlwifi: pcie: clean up some rx code
b570e5b0592a iwlwifi: mvm: validate firmware sync response size
caf463771295 iwlwifi: mvm: fix a race in CSA that caused assert 0x3420
b2ed841ed070 iwlwifi: add an extra firmware state in the transport
906d4eb84408 iwlwifi: support firmware reset handshake
87d9564e14cf iwlwifi: mvm: disconnect if channel switch delay is too long
ac1a98e1e924 iwlwifi: Add a new card for MA family
b8aba27cdc0e iwlwifi: tighten RX MPDU bounds checks
8a59d39033c3 iwlwifi: mvm: hook up missing RX handlers
27eeb03784b3 iwlwifi: mvm: add size checks for range response notification
c0f46dca0019 iwlwifi: mvm: check that statistics TLV version match struct version
d3d9b4fca363 iwlwifi: mvm: purge the BSS table upon firmware load
fd1c3318f4e7 iwlwifi: mvm: validate notification size when waiting
diff mbox series

Patch

diff --git a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
index 5d5513d39809..e82356abd0c4 100644
--- a/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
+++ b/drivers/net/wireless/intel/iwlwifi/pcie/rx.c
@@ -1239,9 +1239,8 @@  static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
 
 	while (offset + sizeof(u32) + sizeof(struct iwl_cmd_header) < max_len) {
 		struct iwl_rx_packet *pkt;
-		u16 sequence;
 		bool reclaim;
-		int index, cmd_index, len;
+		int len;
 		struct iwl_rx_cmd_buffer rxcb = {
 			._offset = rxb->offset + offset,
 			._rx_page_order = trans_pcie->rx_page_order,
@@ -1307,10 +1306,6 @@  static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
 			}
 		}
 
-		sequence = le16_to_cpu(pkt->hdr.sequence);
-		index = SEQ_TO_INDEX(sequence);
-		cmd_index = iwl_txq_get_cmd_index(txq, index);
-
 		if (rxq->id == trans_pcie->def_rx_queue)
 			iwl_op_mode_rx(trans->op_mode, &rxq->napi,
 				       &rxcb);
@@ -1318,17 +1313,19 @@  static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
 			iwl_op_mode_rx_rss(trans->op_mode, &rxq->napi,
 					   &rxcb, rxq->id);
 
-		if (reclaim) {
-			kfree_sensitive(txq->entries[cmd_index].free_buf);
-			txq->entries[cmd_index].free_buf = NULL;
-		}
-
 		/*
 		 * After here, we should always check rxcb._page_stolen,
 		 * if it is true then one of the handlers took the page.
 		 */
 
 		if (reclaim) {
+			u16 sequence = le16_to_cpu(pkt->hdr.sequence);
+			int index = SEQ_TO_INDEX(sequence);
+			int cmd_index = iwl_txq_get_cmd_index(txq, index);
+
+			kfree_sensitive(txq->entries[cmd_index].free_buf);
+			txq->entries[cmd_index].free_buf = NULL;
+
 			/* Invoke any callbacks, transfer the buffer to caller,
 			 * and fire off the (possibly) blocking
 			 * iwl_trans_send_cmd()