iwlwifi: don't pass iwl_rx_mem_buffer to upper layers
[deliverable/linux.git] / drivers / net / wireless / iwlwifi / iwl-trans-pcie-rx.c
index 60e70b78d7d1d3be2654de499d0969e877c3487b..68e89be60bef2e055b40fdf0710367072ec15d8c 100644 (file)
@@ -367,8 +367,6 @@ void iwl_bg_rx_replenish(struct work_struct *data)
  */
 static void iwl_rx_handle(struct iwl_trans *trans)
 {
-       struct iwl_rx_mem_buffer *rxb;
-       struct iwl_rx_packet *pkt;
        struct iwl_trans_pcie *trans_pcie =
                IWL_TRANS_GET_PCIE_TRANS(trans);
        struct iwl_rx_queue *rxq = &trans_pcie->rxq;
@@ -402,6 +400,9 @@ static void iwl_rx_handle(struct iwl_trans *trans)
        while (i != r) {
                int len, err;
                u16 sequence;
+               struct iwl_rx_mem_buffer *rxb;
+               struct iwl_rx_cmd_buffer rxcb;
+               struct iwl_rx_packet *pkt;
 
                rxb = rxq->queue[i];
 
@@ -418,7 +419,9 @@ static void iwl_rx_handle(struct iwl_trans *trans)
                dma_unmap_page(trans->dev, rxb->page_dma,
                               PAGE_SIZE << hw_params(trans).rx_page_order,
                               DMA_FROM_DEVICE);
-               pkt = rxb_addr(rxb);
+
+               rxcb._page = rxb->page;
+               pkt = rxb_addr(&rxcb);
 
                IWL_DEBUG_RX(trans, "r = %d, i = %d, %s, 0x%02x\n", r,
                        i, get_cmd_string(pkt->hdr.cmd), pkt->hdr.cmd);
@@ -461,10 +464,10 @@ static void iwl_rx_handle(struct iwl_trans *trans)
                     "reclaim is false, SEQ_RX_FRAME unset: %s\n",
                     get_cmd_string(pkt->hdr.cmd));
 
-               err = iwl_op_mode_rx(trans->op_mode, rxb, cmd);
+               err = iwl_op_mode_rx(trans->op_mode, &rxcb, cmd);
 
                /*
-                * XXX: After here, we should always check rxb->page
+                * XXX: After here, we should always check rxcb._page
                 * against NULL before touching it or its virtual
                 * memory (pkt). Because some rx_handler might have
                 * already taken or freed the pages.
@@ -475,12 +478,16 @@ static void iwl_rx_handle(struct iwl_trans *trans)
                         * and fire off the (possibly) blocking
                         * iwl_trans_send_cmd()
                         * as we reclaim the driver command queue */
-                       if (rxb->page)
-                               iwl_tx_cmd_complete(trans, rxb, err);
+                       if (rxcb._page)
+                               iwl_tx_cmd_complete(trans, &rxcb, err);
                        else
                                IWL_WARN(trans, "Claim null rxb?\n");
                }
 
+               /* page was stolen from us */
+               if (rxcb._page == NULL)
+                       rxb->page = NULL;
+
                /* Reuse the page if possible. For notification packets and
                 * SKBs that fail to Rx correctly, add them back into the
                 * rx_free list for reuse later. */
@@ -695,10 +702,6 @@ static void iwl_irq_handle_error(struct iwl_trans *trans)
        iwl_dump_csr(trans);
        iwl_dump_fh(trans, NULL, false);
        iwl_dump_nic_event_log(trans, false, NULL, false);
-#ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS)
-               iwl_print_rx_config_cmd(priv(trans), IWL_RXON_CTX_BSS);
-#endif
 
        iwl_op_mode_nic_error(trans->op_mode);
 }
@@ -885,7 +888,7 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
        }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (!(iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS) && !full_log)
+       if (!(iwl_have_debug_level(IWL_DL_FW_ERRORS)) && !full_log)
                size = (size > DEFAULT_DUMP_EVENT_LOG_ENTRIES)
                        ? DEFAULT_DUMP_EVENT_LOG_ENTRIES : size;
 #else
@@ -905,7 +908,7 @@ int iwl_dump_nic_event_log(struct iwl_trans *trans, bool full_log,
                if (!*buf)
                        return -ENOMEM;
        }
-       if ((iwl_get_debug_level(trans->shrd) & IWL_DL_FW_ERRORS) || full_log) {
+       if (iwl_have_debug_level(IWL_DL_FW_ERRORS) || full_log) {
                /*
                 * if uCode has wrapped back to top of log,
                 * start at the oldest entry,
@@ -964,7 +967,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
        inta = trans_pcie->inta;
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(trans->shrd) & IWL_DL_ISR) {
+       if (iwl_have_debug_level(IWL_DL_ISR)) {
                /* just for debug */
                inta_mask = iwl_read32(trans, CSR_INT_MASK);
                IWL_DEBUG_ISR(trans, "inta 0x%08x, enabled 0x%08x\n ",
@@ -993,7 +996,7 @@ void iwl_irq_tasklet(struct iwl_trans *trans)
        }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(trans->shrd) & (IWL_DL_ISR)) {
+       if (iwl_have_debug_level(IWL_DL_ISR)) {
                /* NIC fires this, but we don't use it, redundant with WAKEUP */
                if (inta & CSR_INT_BIT_SCD) {
                        IWL_DEBUG_ISR(trans, "Scheduler finished to transmit "
@@ -1305,7 +1308,7 @@ static irqreturn_t iwl_isr(int irq, void *data)
        }
 
 #ifdef CONFIG_IWLWIFI_DEBUG
-       if (iwl_get_debug_level(trans->shrd) & (IWL_DL_ISR)) {
+       if (iwl_have_debug_level(IWL_DL_ISR)) {
                inta_fh = iwl_read32(trans, CSR_FH_INT_STATUS);
                IWL_DEBUG_ISR(trans, "ISR inta 0x%08x, enabled 0x%08x, "
                              "fh 0x%08x\n", inta, inta_mask, inta_fh);
This page took 0.030593 seconds and 5 git commands to generate.