]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
iwlwifi: pcie: fix emergency path
authorSara Sharon <sara.sharon@intel.com>
Thu, 13 Dec 2018 12:47:40 +0000 (14:47 +0200)
committerLuca Coelho <luciano.coelho@intel.com>
Thu, 14 Feb 2019 09:29:42 +0000 (11:29 +0200)
Allocator swaps the pending requests with 0 when it starts
working. This means that relying on it n RX path to decide if
to move to emergency is not always a good idea, since it may
be zero, but there are still a lot of unallocated RBs in the
system. Change allocator to decrement the pending requests on
real time. It is more expensive since it accesses the atomic
variable more times, but it gives the RX path a better idea
of the system's status.

Reported-by: Ilan Peer <ilan.peer@intel.com>
Signed-off-by: Sara Sharon <sara.sharon@intel.com>
Fixes: 868a1e863f95 ("iwlwifi: pcie: avoid empty free RB queue")
Signed-off-by: Luca Coelho <luciano.coelho@intel.com>
drivers/net/wireless/intel/iwlwifi/pcie/rx.c

index c260d1251b5fc4d29db39e341c7e603ecb2e043e..36cbfed409d0a72deded33532ae0522b3c0997aa 100644 (file)
@@ -538,7 +538,7 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rb_allocator *rba = &trans_pcie->rba;
        struct list_head local_empty;
-       int pending = atomic_xchg(&rba->req_pending, 0);
+       int pending = atomic_read(&rba->req_pending);
 
        IWL_DEBUG_RX(trans, "Pending allocation requests = %d\n", pending);
 
@@ -593,11 +593,13 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
                        i++;
                }
 
+               atomic_dec(&rba->req_pending);
                pending--;
+
                if (!pending) {
-                       pending = atomic_xchg(&rba->req_pending, 0);
+                       pending = atomic_read(&rba->req_pending);
                        IWL_DEBUG_RX(trans,
-                                    "Pending allocation requests = %d\n",
+                                    "Got more pending allocation requests = %d\n",
                                     pending);
                }
 
@@ -609,12 +611,15 @@ static void iwl_pcie_rx_allocator(struct iwl_trans *trans)
                spin_unlock(&rba->lock);
 
                atomic_inc(&rba->req_ready);
+
        }
 
        spin_lock(&rba->lock);
        /* return unused rbds to the allocator empty list */
        list_splice_tail(&local_empty, &rba->rbd_empty);
        spin_unlock(&rba->lock);
+
+       IWL_DEBUG_RX(trans, "%s, exit.\n", __func__);
 }
 
 /*