iwlwifi: pcie: free the TSO page when a Tx queue is unmapped on A000 devices
authorEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Sun, 16 Jul 2017 09:45:12 +0000 (12:45 +0300)
committerLuca Coelho <luciano.coelho@intel.com>
Wed, 9 Aug 2017 18:14:44 +0000 (21:14 +0300)
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>
drivers/net/wireless/intel/iwlwifi/pcie/internal.h
drivers/net/wireless/intel/iwlwifi/pcie/tx-gen2.c
drivers/net/wireless/intel/iwlwifi/pcie/tx.c

index a8ffd4c..f468718 100644 (file)
@@ -806,6 +806,8 @@ int iwl_pcie_alloc_dma_ptr(struct iwl_trans *trans,
                           struct iwl_dma_ptr *ptr, size_t size);
 void iwl_pcie_free_dma_ptr(struct iwl_trans *trans, struct iwl_dma_ptr *ptr);
 void iwl_pcie_apply_destination(struct iwl_trans *trans);
+void iwl_pcie_free_tso_page(struct iwl_trans_pcie *trans_pcie,
+                           struct sk_buff *skb);
 #ifdef CONFIG_INET
 struct iwl_tso_hdr_page *get_page_hdr(struct iwl_trans *trans, size_t len);
 #endif
index 83a2889..4db45e5 100644 (file)
@@ -937,6 +937,15 @@ void iwl_pcie_gen2_txq_unmap(struct iwl_trans *trans, int txq_id)
                IWL_DEBUG_TX_REPLY(trans, "Q %d Free %d\n",
                                   txq_id, txq->read_ptr);
 
+               if (txq_id != trans_pcie->cmd_queue) {
+                       int idx = get_cmd_index(txq, txq->read_ptr);
+                       struct sk_buff *skb = txq->entries[idx].skb;
+
+                       if (WARN_ON_ONCE(!skb))
+                               continue;
+
+                       iwl_pcie_free_tso_page(trans_pcie, skb);
+               }
                iwl_pcie_gen2_free_tfd(trans, txq);
                txq->read_ptr = iwl_queue_inc_wrap(txq->read_ptr);
 
index 6f58945..c893f90 100644 (file)
@@ -577,8 +577,8 @@ int iwl_pcie_txq_init(struct iwl_trans *trans, struct iwl_txq *txq,
        return 0;
 }
 
-static void iwl_pcie_free_tso_page(struct iwl_trans_pcie *trans_pcie,
-                                  struct sk_buff *skb)
+void iwl_pcie_free_tso_page(struct iwl_trans_pcie *trans_pcie,
+                           struct sk_buff *skb)
 {
        struct page **page_ptr;