]> git.proxmox.com Git - mirror_ubuntu-artful-kernel.git/blobdiff - drivers/net/wireless/intel/iwlwifi/pcie/rx.c
iwlwifi: pcie: prepare for dynamic queue allocation
[mirror_ubuntu-artful-kernel.git] / drivers / net / wireless / intel / iwlwifi / pcie / rx.c
index de94dfdf2ec9972ee7c78e695b26f04f3a022154..0338c5f41ce6adf320d3362b7a0f59899609fc8f 100644 (file)
@@ -2,7 +2,7 @@
  *
  * Copyright(c) 2003 - 2014 Intel Corporation. All rights reserved.
  * Copyright(c) 2013 - 2015 Intel Mobile Communications GmbH
- * Copyright(c) 2016 Intel Deutschland GmbH
+ * Copyright(c) 2016 - 2017 Intel Deutschland GmbH
  *
  * Portions of this file are derived from the ipw3945 project, as well
  * as portions of the ieee80211 subsystem header files.
@@ -880,7 +880,7 @@ static int iwl_pcie_dummy_napi_poll(struct napi_struct *napi, int budget)
        return 0;
 }
 
-int iwl_pcie_rx_init(struct iwl_trans *trans)
+static int _iwl_pcie_rx_init(struct iwl_trans *trans)
 {
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rxq *def_rxq;
@@ -958,20 +958,40 @@ int iwl_pcie_rx_init(struct iwl_trans *trans)
 
        iwl_pcie_rxq_alloc_rbs(trans, GFP_KERNEL, def_rxq);
 
+       return 0;
+}
+
+int iwl_pcie_rx_init(struct iwl_trans *trans)
+{
+       struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
+       int ret = _iwl_pcie_rx_init(trans);
+
+       if (ret)
+               return ret;
+
        if (trans->cfg->mq_rx_supported)
                iwl_pcie_rx_mq_hw_init(trans);
        else
-               iwl_pcie_rx_hw_init(trans, def_rxq);
+               iwl_pcie_rx_hw_init(trans, trans_pcie->rxq);
 
-       iwl_pcie_rxq_restock(trans, def_rxq);
+       iwl_pcie_rxq_restock(trans, trans_pcie->rxq);
 
-       spin_lock(&def_rxq->lock);
-       iwl_pcie_rxq_inc_wr_ptr(trans, def_rxq);
-       spin_unlock(&def_rxq->lock);
+       spin_lock(&trans_pcie->rxq->lock);
+       iwl_pcie_rxq_inc_wr_ptr(trans, trans_pcie->rxq);
+       spin_unlock(&trans_pcie->rxq->lock);
 
        return 0;
 }
 
+int iwl_pcie_gen2_rx_init(struct iwl_trans *trans)
+{
+       /*
+        * We don't configure the RFH.
+        * Restock will be done at alive, after firmware configured the RFH.
+        */
+       return _iwl_pcie_rx_init(trans);
+}
+
 void iwl_pcie_rx_free(struct iwl_trans *trans)
 {
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
@@ -1074,7 +1094,7 @@ static void iwl_pcie_rx_handle_rb(struct iwl_trans *trans,
                                bool emergency)
 {
        struct iwl_trans_pcie *trans_pcie = IWL_TRANS_GET_PCIE_TRANS(trans);
-       struct iwl_txq *txq = &trans_pcie->txq[trans_pcie->cmd_queue];
+       struct iwl_txq *txq = trans_pcie->txq[trans_pcie->cmd_queue];
        bool page_stolen = false;
        int max_len = PAGE_SIZE << trans_pcie->rx_page_order;
        u32 offset = 0;
@@ -1393,9 +1413,6 @@ static void iwl_pcie_irq_handle_error(struct iwl_trans *trans)
                return;
        }
 
-       iwl_pcie_dump_csr(trans);
-       iwl_dump_fh(trans, NULL);
-
        local_bh_disable();
        /* The STATUS_FW_ERROR bit is set in this function. This must happen
         * before we wake up the command caller, to ensure a proper cleanup. */
@@ -1403,7 +1420,7 @@ static void iwl_pcie_irq_handle_error(struct iwl_trans *trans)
        local_bh_enable();
 
        for (i = 0; i < trans->cfg->base_params->num_of_queues; i++)
-               del_timer(&trans_pcie->txq[i].stuck_timer);
+               del_timer(&trans_pcie->txq[i]->stuck_timer);
 
        clear_bit(STATUS_SYNC_HCMD_ACTIVE, &trans->status);
        wake_up(&trans_pcie->wait_command_queue);
@@ -1597,6 +1614,13 @@ irqreturn_t iwl_pcie_irq_handler(int irq, void *dev_id)
                if (inta & CSR_INT_BIT_ALIVE) {
                        IWL_DEBUG_ISR(trans, "Alive interrupt\n");
                        isr_stats->alive++;
+                       if (trans->cfg->gen2) {
+                               /*
+                                * We can restock, since firmware configured
+                                * the RFH
+                                */
+                               iwl_pcie_rxmq_restock(trans, trans_pcie->rxq);
+                       }
                }
        }
 
@@ -1933,6 +1957,10 @@ irqreturn_t iwl_pcie_irq_msix_handler(int irq, void *dev_id)
        if (inta_hw & MSIX_HW_INT_CAUSES_REG_ALIVE) {
                IWL_DEBUG_ISR(trans, "Alive interrupt\n");
                isr_stats->alive++;
+               if (trans->cfg->gen2) {
+                       /* We can restock, since firmware configured the RFH */
+                       iwl_pcie_rxmq_restock(trans, trans_pcie->rxq);
+               }
        }
 
        /* uCode wakes up after power-down sleep */