From e2ebc8337d116acdc25469ec8547ae665f50a4c1 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Mon, 24 Oct 2011 15:41:30 +0200 Subject: iwlegacy: rename iwl to il iwl_legacy prefix result in long function names, what cause that we have frequent line split and not readable code. Also iwl_foo symbols are duplicated in iwlwifi driver, what is annoying when editing kernel tree with cscope. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 72 +++++++++++++++++----------------- 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 9b5d0abe8be9..9a2714c7f3e8 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -73,7 +73,7 @@ * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled * to replenish the iwl->rxq->rx_free. - * + In iwl_rx_replenish (scheduled) if 'processed' != 'read' then the + * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ INDEX is updated (updating the * 'processed' and 'read' driver indexes as well) * + A received packet is processed and handed to the kernel network stack, @@ -86,28 +86,28 @@ * * Driver sequence: * - * iwl_legacy_rx_queue_alloc() Allocates rx_free - * iwl_rx_replenish() Replenishes rx_free list from rx_used, and calls - * iwl_rx_queue_restock - * iwl_rx_queue_restock() Moves available buffers from rx_free into Rx + * il_rx_queue_alloc() Allocates rx_free + * il_rx_replenish() Replenishes rx_free list from rx_used, and calls + * il_rx_queue_restock + * il_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates * the WRITE index. If insufficient rx_free buffers - * are available, schedules iwl_rx_replenish + * are available, schedules il_rx_replenish * * -- enable interrupts -- - * ISR - iwl_rx() Detach iwl_rx_mem_buffers from pool up to the + * ISR - il_rx() Detach il_rx_mem_buffers from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. - * Calls iwl_rx_queue_restock to refill any empty + * Calls il_rx_queue_restock to refill any empty * slots. * ... * */ /** - * iwl_legacy_rx_queue_space - Return number of free slots available in queue. + * il_rx_queue_space - Return number of free slots available in queue. */ -int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q) +int il_rx_queue_space(const struct il_rx_queue *q) { int s = q->read - q->write; if (s <= 0) @@ -118,14 +118,14 @@ int iwl_legacy_rx_queue_space(const struct iwl_rx_queue *q) s = 0; return s; } -EXPORT_SYMBOL(iwl_legacy_rx_queue_space); +EXPORT_SYMBOL(il_rx_queue_space); /** - * iwl_legacy_rx_queue_update_write_ptr - Update the write pointer for the RX queue + * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue */ void -iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, - struct iwl_rx_queue *q) +il_rx_queue_update_write_ptr(struct il_priv *priv, + struct il_rx_queue *q) { unsigned long flags; u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg; @@ -138,26 +138,26 @@ iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, /* If power-saving is in use, make sure device is awake */ if (test_bit(STATUS_POWER_PMI, &priv->status)) { - reg = iwl_read32(priv, CSR_UCODE_DRV_GP1); + reg = il_read32(priv, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IWL_DEBUG_INFO(priv, + IL_DEBUG_INFO(priv, "Rx queue requesting wakeup," " GP1 = 0x%x\n", reg); - iwl_legacy_set_bit(priv, CSR_GP_CNTRL, + il_set_bit(priv, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); goto exit_unlock; } q->write_actual = (q->write & ~0x7); - iwl_legacy_write_direct32(priv, rx_wrt_ptr_reg, + il_write_direct32(priv, rx_wrt_ptr_reg, q->write_actual); /* Else device is assumed to be awake */ } else { /* Device expects a multiple of 8 */ q->write_actual = (q->write & ~0x7); - iwl_legacy_write_direct32(priv, rx_wrt_ptr_reg, + il_write_direct32(priv, rx_wrt_ptr_reg, q->write_actual); } @@ -166,11 +166,11 @@ iwl_legacy_rx_queue_update_write_ptr(struct iwl_priv *priv, exit_unlock: spin_unlock_irqrestore(&q->lock, flags); } -EXPORT_SYMBOL(iwl_legacy_rx_queue_update_write_ptr); +EXPORT_SYMBOL(il_rx_queue_update_write_ptr); -int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv) +int il_rx_queue_alloc(struct il_priv *priv) { - struct iwl_rx_queue *rxq = &priv->rxq; + struct il_rx_queue *rxq = &priv->rxq; struct device *dev = &priv->pci_dev->dev; int i; @@ -184,7 +184,7 @@ int iwl_legacy_rx_queue_alloc(struct iwl_priv *priv) if (!rxq->bd) goto err_bd; - rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct iwl_rb_status), + rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct il_rb_status), &rxq->rb_stts_dma, GFP_KERNEL); if (!rxq->rb_stts) goto err_rb; @@ -207,17 +207,17 @@ err_rb: err_bd: return -ENOMEM; } -EXPORT_SYMBOL(iwl_legacy_rx_queue_alloc); +EXPORT_SYMBOL(il_rx_queue_alloc); -void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, - struct iwl_rx_mem_buffer *rxb) +void il_rx_spectrum_measure_notif(struct il_priv *priv, + struct il_rx_mem_buffer *rxb) { - struct iwl_rx_packet *pkt = rxb_addr(rxb); - struct iwl_spectrum_notification *report = &(pkt->u.spectrum_notif); + struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { - IWL_DEBUG_11H(priv, + IL_DEBUG_11H(priv, "Spectrum Measure Notification: Start\n"); return; } @@ -225,12 +225,12 @@ void iwl_legacy_rx_spectrum_measure_notif(struct iwl_priv *priv, memcpy(&priv->measure_report, report, sizeof(*report)); priv->measurement_status |= MEASUREMENT_READY; } -EXPORT_SYMBOL(iwl_legacy_rx_spectrum_measure_notif); +EXPORT_SYMBOL(il_rx_spectrum_measure_notif); /* * returns non-zero if packet should be dropped */ -int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, +int il_set_decrypted_flag(struct il_priv *priv, struct ieee80211_hdr *hdr, u32 decrypt_res, struct ieee80211_rx_status *stats) @@ -241,14 +241,14 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, * All contexts have the same setting here due to it being * a module parameter, so OK to check any context. */ - if (priv->contexts[IWL_RXON_CTX_BSS].active.filter_flags & + if (priv->contexts[IL_RXON_CTX_BSS].active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) return 0; if (!(fc & IEEE80211_FCTL_PROTECTED)) return 0; - IWL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); + IL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { case RX_RES_STATUS_SEC_TYPE_TKIP: /* The uCode has got a bad phase 1 Key, pushes the packet. @@ -262,13 +262,13 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, RX_RES_STATUS_BAD_ICV_MIC) { /* bad ICV, the packet is destroyed since the * decryption is inplace, drop it */ - IWL_DEBUG_RX(priv, "Packet destroyed\n"); + IL_DEBUG_RX(priv, "Packet destroyed\n"); return -1; } case RX_RES_STATUS_SEC_TYPE_CCMP: if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == RX_RES_STATUS_DECRYPT_OK) { - IWL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); + IL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); stats->flag |= RX_FLAG_DECRYPTED; } break; @@ -278,4 +278,4 @@ int iwl_legacy_set_decrypted_flag(struct iwl_priv *priv, } return 0; } -EXPORT_SYMBOL(iwl_legacy_set_decrypted_flag); +EXPORT_SYMBOL(il_set_decrypted_flag); -- cgit v1.2.3 From 46bc8d4b0e73ac75de323646d75a2333f47b84c3 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Mon, 24 Oct 2011 16:49:25 +0200 Subject: iwlegacy: rename priv to il Make code shorter. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 42 +++++++++++++++++----------------- 1 file changed, 21 insertions(+), 21 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 9a2714c7f3e8..b6c5dd09bd8b 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -124,11 +124,11 @@ EXPORT_SYMBOL(il_rx_queue_space); * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue */ void -il_rx_queue_update_write_ptr(struct il_priv *priv, +il_rx_queue_update_write_ptr(struct il_priv *il, struct il_rx_queue *q) { unsigned long flags; - u32 rx_wrt_ptr_reg = priv->hw_params.rx_wrt_ptr_reg; + u32 rx_wrt_ptr_reg = il->hw_params.rx_wrt_ptr_reg; u32 reg; spin_lock_irqsave(&q->lock, flags); @@ -137,27 +137,27 @@ il_rx_queue_update_write_ptr(struct il_priv *priv, goto exit_unlock; /* If power-saving is in use, make sure device is awake */ - if (test_bit(STATUS_POWER_PMI, &priv->status)) { - reg = il_read32(priv, CSR_UCODE_DRV_GP1); + if (test_bit(STATUS_POWER_PMI, &il->status)) { + reg = il_read32(il, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IL_DEBUG_INFO(priv, + IL_DEBUG_INFO(il, "Rx queue requesting wakeup," " GP1 = 0x%x\n", reg); - il_set_bit(priv, CSR_GP_CNTRL, + il_set_bit(il, CSR_GP_CNTRL, CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); goto exit_unlock; } q->write_actual = (q->write & ~0x7); - il_write_direct32(priv, rx_wrt_ptr_reg, + il_write_direct32(il, rx_wrt_ptr_reg, q->write_actual); /* Else device is assumed to be awake */ } else { /* Device expects a multiple of 8 */ q->write_actual = (q->write & ~0x7); - il_write_direct32(priv, rx_wrt_ptr_reg, + il_write_direct32(il, rx_wrt_ptr_reg, q->write_actual); } @@ -168,10 +168,10 @@ il_rx_queue_update_write_ptr(struct il_priv *priv, } EXPORT_SYMBOL(il_rx_queue_update_write_ptr); -int il_rx_queue_alloc(struct il_priv *priv) +int il_rx_queue_alloc(struct il_priv *il) { - struct il_rx_queue *rxq = &priv->rxq; - struct device *dev = &priv->pci_dev->dev; + struct il_rx_queue *rxq = &il->rxq; + struct device *dev = &il->pci_dev->dev; int i; spin_lock_init(&rxq->lock); @@ -202,7 +202,7 @@ int il_rx_queue_alloc(struct il_priv *priv) return 0; err_rb: - dma_free_coherent(&priv->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, + dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, rxq->bd_dma); err_bd: return -ENOMEM; @@ -210,27 +210,27 @@ err_bd: EXPORT_SYMBOL(il_rx_queue_alloc); -void il_rx_spectrum_measure_notif(struct il_priv *priv, +void il_rx_spectrum_measure_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { struct il_rx_packet *pkt = rxb_addr(rxb); struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { - IL_DEBUG_11H(priv, + IL_DEBUG_11H(il, "Spectrum Measure Notification: Start\n"); return; } - memcpy(&priv->measure_report, report, sizeof(*report)); - priv->measurement_status |= MEASUREMENT_READY; + memcpy(&il->measure_report, report, sizeof(*report)); + il->measurement_status |= MEASUREMENT_READY; } EXPORT_SYMBOL(il_rx_spectrum_measure_notif); /* * returns non-zero if packet should be dropped */ -int il_set_decrypted_flag(struct il_priv *priv, +int il_set_decrypted_flag(struct il_priv *il, struct ieee80211_hdr *hdr, u32 decrypt_res, struct ieee80211_rx_status *stats) @@ -241,14 +241,14 @@ int il_set_decrypted_flag(struct il_priv *priv, * All contexts have the same setting here due to it being * a module parameter, so OK to check any context. */ - if (priv->contexts[IL_RXON_CTX_BSS].active.filter_flags & + if (il->contexts[IL_RXON_CTX_BSS].active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) return 0; if (!(fc & IEEE80211_FCTL_PROTECTED)) return 0; - IL_DEBUG_RX(priv, "decrypt_res:0x%x\n", decrypt_res); + IL_DEBUG_RX(il, "decrypt_res:0x%x\n", decrypt_res); switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { case RX_RES_STATUS_SEC_TYPE_TKIP: /* The uCode has got a bad phase 1 Key, pushes the packet. @@ -262,13 +262,13 @@ int il_set_decrypted_flag(struct il_priv *priv, RX_RES_STATUS_BAD_ICV_MIC) { /* bad ICV, the packet is destroyed since the * decryption is inplace, drop it */ - IL_DEBUG_RX(priv, "Packet destroyed\n"); + IL_DEBUG_RX(il, "Packet destroyed\n"); return -1; } case RX_RES_STATUS_SEC_TYPE_CCMP: if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == RX_RES_STATUS_DECRYPT_OK) { - IL_DEBUG_RX(priv, "hw decrypt successfully!!!\n"); + IL_DEBUG_RX(il, "hw decrypt successfully!!!\n"); stats->flag |= RX_FLAG_DECRYPTED; } break; -- cgit v1.2.3 From 58de00a464f1e7cf0b108341dc6cc49276d19d7a Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 15 Nov 2011 11:21:01 +0100 Subject: iwlegacy: rename IL_DEBUG_ to D_ Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index b6c5dd09bd8b..183acdc69a25 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -141,7 +141,7 @@ il_rx_queue_update_write_ptr(struct il_priv *il, reg = il_read32(il, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - IL_DEBUG_INFO(il, + D_INFO( "Rx queue requesting wakeup," " GP1 = 0x%x\n", reg); il_set_bit(il, CSR_GP_CNTRL, @@ -217,7 +217,7 @@ void il_rx_spectrum_measure_notif(struct il_priv *il, struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { - IL_DEBUG_11H(il, + D_11H( "Spectrum Measure Notification: Start\n"); return; } @@ -248,7 +248,7 @@ int il_set_decrypted_flag(struct il_priv *il, if (!(fc & IEEE80211_FCTL_PROTECTED)) return 0; - IL_DEBUG_RX(il, "decrypt_res:0x%x\n", decrypt_res); + D_RX("decrypt_res:0x%x\n", decrypt_res); switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { case RX_RES_STATUS_SEC_TYPE_TKIP: /* The uCode has got a bad phase 1 Key, pushes the packet. @@ -262,13 +262,13 @@ int il_set_decrypted_flag(struct il_priv *il, RX_RES_STATUS_BAD_ICV_MIC) { /* bad ICV, the packet is destroyed since the * decryption is inplace, drop it */ - IL_DEBUG_RX(il, "Packet destroyed\n"); + D_RX("Packet destroyed\n"); return -1; } case RX_RES_STATUS_SEC_TYPE_CCMP: if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == RX_RES_STATUS_DECRYPT_OK) { - IL_DEBUG_RX(il, "hw decrypt successfully!!!\n"); + D_RX("hw decrypt successfully!!!\n"); stats->flag |= RX_FLAG_DECRYPTED; } break; -- cgit v1.2.3 From 841b2ccac3251fdbf7a0bc26724874cdc35df96c Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Wed, 24 Aug 2011 15:14:03 +0200 Subject: iwlegacy: rename il_{read,write}32 to _il_{rd,wr} Introduce rule that underscore at the beginning mean unlocked I/O method. Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 183acdc69a25..e481ca8c0cc9 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -138,7 +138,7 @@ il_rx_queue_update_write_ptr(struct il_priv *il, /* If power-saving is in use, make sure device is awake */ if (test_bit(STATUS_POWER_PMI, &il->status)) { - reg = il_read32(il, CSR_UCODE_DRV_GP1); + reg = _il_rd(il, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { D_INFO( -- cgit v1.2.3 From 0c1a94e299eed7ea11ebc407d1e08a26c594abe5 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Wed, 24 Aug 2011 17:37:16 +0200 Subject: iwlegacy: rename i/o direct methods Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index e481ca8c0cc9..b2ec2a214caa 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -150,14 +150,14 @@ il_rx_queue_update_write_ptr(struct il_priv *il, } q->write_actual = (q->write & ~0x7); - il_write_direct32(il, rx_wrt_ptr_reg, + il_wr(il, rx_wrt_ptr_reg, q->write_actual); /* Else device is assumed to be awake */ } else { /* Device expects a multiple of 8 */ q->write_actual = (q->write & ~0x7); - il_write_direct32(il, rx_wrt_ptr_reg, + il_wr(il, rx_wrt_ptr_reg, q->write_actual); } -- cgit v1.2.3 From dcae1c641a4d7b7a00b1a566355ffaa517588aa6 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Fri, 26 Aug 2011 14:36:21 +0200 Subject: iwlegacy: s/iwl_rx_packet/iwl_rx_pkt/ Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index b2ec2a214caa..746b5a7e4e07 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -213,7 +213,7 @@ EXPORT_SYMBOL(il_rx_queue_alloc); void il_rx_spectrum_measure_notif(struct il_priv *il, struct il_rx_mem_buffer *rxb) { - struct il_rx_packet *pkt = rxb_addr(rxb); + struct il_rx_pkt *pkt = rxb_addr(rxb); struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); if (!report->state) { -- cgit v1.2.3 From 7c2cde2ef278cb833581fe599c6654fc28b11a7e Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 15 Nov 2011 11:29:04 +0100 Subject: iwlegacy: partial rxon context cleanup Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 746b5a7e4e07..2e7c87f6104f 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -241,7 +241,7 @@ int il_set_decrypted_flag(struct il_priv *il, * All contexts have the same setting here due to it being * a module parameter, so OK to check any context. */ - if (il->contexts[IL_RXON_CTX_BSS].active.filter_flags & + if (il->ctx.active.filter_flags & RXON_FILTER_DIS_DECRYPT_MSK) return 0; -- cgit v1.2.3 From b73bb5f13bb60735a846b73125e297ab6e3eece5 Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Fri, 26 Aug 2011 14:37:54 +0200 Subject: iwlegacy: s/il_rx_mem_buffer/il_rx_buf/ Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 2e7c87f6104f..a6bee8432798 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -95,7 +95,7 @@ * are available, schedules il_rx_replenish * * -- enable interrupts -- - * ISR - il_rx() Detach il_rx_mem_buffers from pool up to the + * ISR - il_rx() Detach il_rx_bufs from pool up to the * READ INDEX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. * Calls il_rx_queue_restock to refill any empty @@ -211,7 +211,7 @@ EXPORT_SYMBOL(il_rx_queue_alloc); void il_rx_spectrum_measure_notif(struct il_priv *il, - struct il_rx_mem_buffer *rxb) + struct il_rx_buf *rxb) { struct il_rx_pkt *pkt = rxb_addr(rxb); struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); -- cgit v1.2.3 From 2d09b0624a1048f6424b2c7ff60ad3a42d8036ff Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Fri, 26 Aug 2011 16:10:40 +0200 Subject: iwlegacy: s/INDEX/IDX/ Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index a6bee8432798..5c0d1317d149 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -62,7 +62,7 @@ * WRITE = READ. * * During initialization, the host sets up the READ queue position to the first - * INDEX position, and WRITE to the last (READ - 1 wrapped) + * IDX position, and WRITE to the last (READ - 1 wrapped) * * When the firmware places a packet in a buffer, it will advance the READ index * and fire the RX interrupt. The driver can then query the READ index and @@ -74,13 +74,13 @@ * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled * to replenish the iwl->rxq->rx_free. * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the - * iwl->rxq is replenished and the READ INDEX is updated (updating the + * iwl->rxq is replenished and the READ IDX is updated (updating the * 'processed' and 'read' driver indexes as well) * + A received packet is processed and handed to the kernel network stack, * detached from the iwl->rxq. The driver 'processed' index is updated. * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ - * INDEX is not incremented and iwl->status(RX_STALLED) is set. If there + * IDX is not incremented and iwl->status(RX_STALLED) is set. If there * were enough free buffers and RX_STALLED is set it is cleared. * * @@ -96,7 +96,7 @@ * * -- enable interrupts -- * ISR - il_rx() Detach il_rx_bufs from pool up to the - * READ INDEX, detaching the SKB from the pool. + * READ IDX, detaching the SKB from the pool. * Moves the packet buffer from queue to rx_used. * Calls il_rx_queue_restock to refill any empty * slots. -- cgit v1.2.3 From 0c2c885200057c44ac5660d123e199192689ca5d Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 15 Nov 2011 12:30:17 +0100 Subject: iwlegacy: s/index/idx/ Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 5c0d1317d149..58d19c155a3d 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -45,17 +45,17 @@ * each of which point to Receive Buffers to be filled by the NIC. These get * used not only for Rx frames, but for any command response or notification * from the NIC. The driver and NIC manage the Rx buffers by means - * of indexes into the circular buffer. + * of idxes into the circular buffer. * * Rx Queue Indexes - * The host/firmware share two index registers for managing the Rx buffers. + * The host/firmware share two idx registers for managing the Rx buffers. * - * The READ index maps to the first position that the firmware may be writing + * The READ idx maps to the first position that the firmware may be writing * to -- the driver can read up to (but not including) this position and get * good data. - * The READ index is managed by the firmware once the card is enabled. + * The READ idx is managed by the firmware once the card is enabled. * - * The WRITE index maps to the last position the driver has read from -- the + * The WRITE idx maps to the last position the driver has read from -- the * position preceding WRITE is the last slot the firmware can place a packet. * * The queue is empty (no good data) if WRITE = READ - 1, and is full if @@ -64,9 +64,9 @@ * During initialization, the host sets up the READ queue position to the first * IDX position, and WRITE to the last (READ - 1 wrapped) * - * When the firmware places a packet in a buffer, it will advance the READ index - * and fire the RX interrupt. The driver can then query the READ index and - * process as many packets as possible, moving the WRITE index forward as it + * When the firmware places a packet in a buffer, it will advance the READ idx + * and fire the RX interrupt. The driver can then query the READ idx and + * process as many packets as possible, moving the WRITE idx forward as it * resets the Rx queue buffers with new memory. * * The management in the driver is as follows: @@ -75,9 +75,9 @@ * to replenish the iwl->rxq->rx_free. * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the * iwl->rxq is replenished and the READ IDX is updated (updating the - * 'processed' and 'read' driver indexes as well) + * 'processed' and 'read' driver idxes as well) * + A received packet is processed and handed to the kernel network stack, - * detached from the iwl->rxq. The driver 'processed' index is updated. + * detached from the iwl->rxq. The driver 'processed' idx is updated. * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ * IDX is not incremented and iwl->status(RX_STALLED) is set. If there @@ -91,7 +91,7 @@ * il_rx_queue_restock * il_rx_queue_restock() Moves available buffers from rx_free into Rx * queue, updates firmware pointers, and updates - * the WRITE index. If insufficient rx_free buffers + * the WRITE idx. If insufficient rx_free buffers * are available, schedules il_rx_replenish * * -- enable interrupts -- -- cgit v1.2.3 From a6766ccdaf9cc80d565672516d429a562d1a732d Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 15 Nov 2011 13:09:01 +0100 Subject: iwlegacy: s/STATUS_/S_/ Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 58d19c155a3d..76f2361031bb 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -137,7 +137,7 @@ il_rx_queue_update_write_ptr(struct il_priv *il, goto exit_unlock; /* If power-saving is in use, make sure device is awake */ - if (test_bit(STATUS_POWER_PMI, &il->status)) { + if (test_bit(S_POWER_PMI, &il->status)) { reg = _il_rd(il, CSR_UCODE_DRV_GP1); if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { -- cgit v1.2.3 From d2dfb33ec9a8da257bb0e6ed2872af2fdf85260c Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 15 Nov 2011 13:16:38 +0100 Subject: iwlegacy: rename other handlers Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c index 76f2361031bb..7a8ae556f2be 100644 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ b/drivers/net/wireless/iwlegacy/iwl-rx.c @@ -210,7 +210,7 @@ err_bd: EXPORT_SYMBOL(il_rx_queue_alloc); -void il_rx_spectrum_measure_notif(struct il_priv *il, +void il_hdl_spectrum_measurement(struct il_priv *il, struct il_rx_buf *rxb) { struct il_rx_pkt *pkt = rxb_addr(rxb); @@ -225,7 +225,7 @@ void il_rx_spectrum_measure_notif(struct il_priv *il, memcpy(&il->measure_report, report, sizeof(*report)); il->measurement_status |= MEASUREMENT_READY; } -EXPORT_SYMBOL(il_rx_spectrum_measure_notif); +EXPORT_SYMBOL(il_hdl_spectrum_measurement); /* * returns non-zero if packet should be dropped -- cgit v1.2.3 From 0cdc21363cc27989fe9aa1cde614ef4c0429d62f Mon Sep 17 00:00:00 2001 From: Stanislaw Gruszka Date: Tue, 15 Nov 2011 13:40:15 +0100 Subject: iwlegacy: merge common .c files Merge iwl-{tx,rx,sta,scan,power,eeprom,led,hcmd}.c into common.c . Signed-off-by: Stanislaw Gruszka --- drivers/net/wireless/iwlegacy/iwl-rx.c | 281 --------------------------------- 1 file changed, 281 deletions(-) delete mode 100644 drivers/net/wireless/iwlegacy/iwl-rx.c (limited to 'drivers/net/wireless/iwlegacy/iwl-rx.c') diff --git a/drivers/net/wireless/iwlegacy/iwl-rx.c b/drivers/net/wireless/iwlegacy/iwl-rx.c deleted file mode 100644 index 7a8ae556f2be..000000000000 --- a/drivers/net/wireless/iwlegacy/iwl-rx.c +++ /dev/null @@ -1,281 +0,0 @@ -/****************************************************************************** - * - * Copyright(c) 2003 - 2011 Intel Corporation. All rights reserved. - * - * Portions of this file are derived from the ipw3945 project, as well - * as portions of the ieee80211 subsystem header files. - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of version 2 of the GNU General Public License as - * published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along with - * this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA - * - * The full GNU General Public License is included in this distribution in the - * file called LICENSE. - * - * Contact Information: - * Intel Linux Wireless - * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497 - * - *****************************************************************************/ - -#include -#include -#include -#include -#include "iwl-eeprom.h" -#include "iwl-dev.h" -#include "iwl-core.h" -#include "iwl-sta.h" -#include "iwl-io.h" -#include "iwl-helpers.h" -/************************** RX-FUNCTIONS ****************************/ -/* - * Rx theory of operation - * - * Driver allocates a circular buffer of Receive Buffer Descriptors (RBDs), - * each of which point to Receive Buffers to be filled by the NIC. These get - * used not only for Rx frames, but for any command response or notification - * from the NIC. The driver and NIC manage the Rx buffers by means - * of idxes into the circular buffer. - * - * Rx Queue Indexes - * The host/firmware share two idx registers for managing the Rx buffers. - * - * The READ idx maps to the first position that the firmware may be writing - * to -- the driver can read up to (but not including) this position and get - * good data. - * The READ idx is managed by the firmware once the card is enabled. - * - * The WRITE idx maps to the last position the driver has read from -- the - * position preceding WRITE is the last slot the firmware can place a packet. - * - * The queue is empty (no good data) if WRITE = READ - 1, and is full if - * WRITE = READ. - * - * During initialization, the host sets up the READ queue position to the first - * IDX position, and WRITE to the last (READ - 1 wrapped) - * - * When the firmware places a packet in a buffer, it will advance the READ idx - * and fire the RX interrupt. The driver can then query the READ idx and - * process as many packets as possible, moving the WRITE idx forward as it - * resets the Rx queue buffers with new memory. - * - * The management in the driver is as follows: - * + A list of pre-allocated SKBs is stored in iwl->rxq->rx_free. When - * iwl->rxq->free_count drops to or below RX_LOW_WATERMARK, work is scheduled - * to replenish the iwl->rxq->rx_free. - * + In il_rx_replenish (scheduled) if 'processed' != 'read' then the - * iwl->rxq is replenished and the READ IDX is updated (updating the - * 'processed' and 'read' driver idxes as well) - * + A received packet is processed and handed to the kernel network stack, - * detached from the iwl->rxq. The driver 'processed' idx is updated. - * + The Host/Firmware iwl->rxq is replenished at tasklet time from the rx_free - * list. If there are no allocated buffers in iwl->rxq->rx_free, the READ - * IDX is not incremented and iwl->status(RX_STALLED) is set. If there - * were enough free buffers and RX_STALLED is set it is cleared. - * - * - * Driver sequence: - * - * il_rx_queue_alloc() Allocates rx_free - * il_rx_replenish() Replenishes rx_free list from rx_used, and calls - * il_rx_queue_restock - * il_rx_queue_restock() Moves available buffers from rx_free into Rx - * queue, updates firmware pointers, and updates - * the WRITE idx. If insufficient rx_free buffers - * are available, schedules il_rx_replenish - * - * -- enable interrupts -- - * ISR - il_rx() Detach il_rx_bufs from pool up to the - * READ IDX, detaching the SKB from the pool. - * Moves the packet buffer from queue to rx_used. - * Calls il_rx_queue_restock to refill any empty - * slots. - * ... - * - */ - -/** - * il_rx_queue_space - Return number of free slots available in queue. - */ -int il_rx_queue_space(const struct il_rx_queue *q) -{ - int s = q->read - q->write; - if (s <= 0) - s += RX_QUEUE_SIZE; - /* keep some buffer to not confuse full and empty queue */ - s -= 2; - if (s < 0) - s = 0; - return s; -} -EXPORT_SYMBOL(il_rx_queue_space); - -/** - * il_rx_queue_update_write_ptr - Update the write pointer for the RX queue - */ -void -il_rx_queue_update_write_ptr(struct il_priv *il, - struct il_rx_queue *q) -{ - unsigned long flags; - u32 rx_wrt_ptr_reg = il->hw_params.rx_wrt_ptr_reg; - u32 reg; - - spin_lock_irqsave(&q->lock, flags); - - if (q->need_update == 0) - goto exit_unlock; - - /* If power-saving is in use, make sure device is awake */ - if (test_bit(S_POWER_PMI, &il->status)) { - reg = _il_rd(il, CSR_UCODE_DRV_GP1); - - if (reg & CSR_UCODE_DRV_GP1_BIT_MAC_SLEEP) { - D_INFO( - "Rx queue requesting wakeup," - " GP1 = 0x%x\n", reg); - il_set_bit(il, CSR_GP_CNTRL, - CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ); - goto exit_unlock; - } - - q->write_actual = (q->write & ~0x7); - il_wr(il, rx_wrt_ptr_reg, - q->write_actual); - - /* Else device is assumed to be awake */ - } else { - /* Device expects a multiple of 8 */ - q->write_actual = (q->write & ~0x7); - il_wr(il, rx_wrt_ptr_reg, - q->write_actual); - } - - q->need_update = 0; - - exit_unlock: - spin_unlock_irqrestore(&q->lock, flags); -} -EXPORT_SYMBOL(il_rx_queue_update_write_ptr); - -int il_rx_queue_alloc(struct il_priv *il) -{ - struct il_rx_queue *rxq = &il->rxq; - struct device *dev = &il->pci_dev->dev; - int i; - - spin_lock_init(&rxq->lock); - INIT_LIST_HEAD(&rxq->rx_free); - INIT_LIST_HEAD(&rxq->rx_used); - - /* Alloc the circular buffer of Read Buffer Descriptors (RBDs) */ - rxq->bd = dma_alloc_coherent(dev, 4 * RX_QUEUE_SIZE, &rxq->bd_dma, - GFP_KERNEL); - if (!rxq->bd) - goto err_bd; - - rxq->rb_stts = dma_alloc_coherent(dev, sizeof(struct il_rb_status), - &rxq->rb_stts_dma, GFP_KERNEL); - if (!rxq->rb_stts) - goto err_rb; - - /* Fill the rx_used queue with _all_ of the Rx buffers */ - for (i = 0; i < RX_FREE_BUFFERS + RX_QUEUE_SIZE; i++) - list_add_tail(&rxq->pool[i].list, &rxq->rx_used); - - /* Set us so that we have processed and used all buffers, but have - * not restocked the Rx queue with fresh buffers */ - rxq->read = rxq->write = 0; - rxq->write_actual = 0; - rxq->free_count = 0; - rxq->need_update = 0; - return 0; - -err_rb: - dma_free_coherent(&il->pci_dev->dev, 4 * RX_QUEUE_SIZE, rxq->bd, - rxq->bd_dma); -err_bd: - return -ENOMEM; -} -EXPORT_SYMBOL(il_rx_queue_alloc); - - -void il_hdl_spectrum_measurement(struct il_priv *il, - struct il_rx_buf *rxb) -{ - struct il_rx_pkt *pkt = rxb_addr(rxb); - struct il_spectrum_notification *report = &(pkt->u.spectrum_notif); - - if (!report->state) { - D_11H( - "Spectrum Measure Notification: Start\n"); - return; - } - - memcpy(&il->measure_report, report, sizeof(*report)); - il->measurement_status |= MEASUREMENT_READY; -} -EXPORT_SYMBOL(il_hdl_spectrum_measurement); - -/* - * returns non-zero if packet should be dropped - */ -int il_set_decrypted_flag(struct il_priv *il, - struct ieee80211_hdr *hdr, - u32 decrypt_res, - struct ieee80211_rx_status *stats) -{ - u16 fc = le16_to_cpu(hdr->frame_control); - - /* - * All contexts have the same setting here due to it being - * a module parameter, so OK to check any context. - */ - if (il->ctx.active.filter_flags & - RXON_FILTER_DIS_DECRYPT_MSK) - return 0; - - if (!(fc & IEEE80211_FCTL_PROTECTED)) - return 0; - - D_RX("decrypt_res:0x%x\n", decrypt_res); - switch (decrypt_res & RX_RES_STATUS_SEC_TYPE_MSK) { - case RX_RES_STATUS_SEC_TYPE_TKIP: - /* The uCode has got a bad phase 1 Key, pushes the packet. - * Decryption will be done in SW. */ - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_BAD_KEY_TTAK) - break; - - case RX_RES_STATUS_SEC_TYPE_WEP: - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_BAD_ICV_MIC) { - /* bad ICV, the packet is destroyed since the - * decryption is inplace, drop it */ - D_RX("Packet destroyed\n"); - return -1; - } - case RX_RES_STATUS_SEC_TYPE_CCMP: - if ((decrypt_res & RX_RES_STATUS_DECRYPT_TYPE_MSK) == - RX_RES_STATUS_DECRYPT_OK) { - D_RX("hw decrypt successfully!!!\n"); - stats->flag |= RX_FLAG_DECRYPTED; - } - break; - - default: - break; - } - return 0; -} -EXPORT_SYMBOL(il_set_decrypted_flag); -- cgit v1.2.3