iwlegacy update 2012-02-13
cover iwlegacy update 2012-02-13
Further cleanups and some debugging improvements.
drivers/net/wireless/iwlegacy/3945-debug.c | 6 drivers/net/wireless/iwlegacy/3945-mac.c | 108 ++--- drivers/net/wireless/iwlegacy/3945.c | 133 ++---- drivers/net/wireless/iwlegacy/3945.h | 8 drivers/net/wireless/iwlegacy/4965-calib.c | 4 drivers/net/wireless/iwlegacy/4965-debug.c | 6 drivers/net/wireless/iwlegacy/4965-mac.c | 589 +++++++++++++++++++++-------- drivers/net/wireless/iwlegacy/4965.c | 402 +------------------ drivers/net/wireless/iwlegacy/4965.h | 20 drivers/net/wireless/iwlegacy/common.c | 548 +++++++------------------- drivers/net/wireless/iwlegacy/common.h | 224 +++-------- drivers/net/wireless/iwlegacy/debug.c | 260 +++++++----- 12 files changed, 956 insertions(+), 1352 deletions(-)
PATCH 1/24 iwlegacy: dump stack when fail to gain access to the device
Print dump stack when the device is not responding. This should give some more clue about the reason of failure. Also change the message we print, since "MAC in deep sleep" is kinda confusing.
On the way add unlikely(), as fail to gain NIC access is hmm ... unlikely.
--- drivers/net/wireless/iwlegacy/common.c | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-)
drivers/net/wireless/iwlegacy/common.c +3 -2
@@ -111,9 +111,10 @@ _il_grab_nic_access(struct il_priv *il)_il_poll_bit (il,CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN , (CSR_GP_CNTRL_REG_FLAG_MAC_CLOCK_READY |CSR_GP_CNTRL_REG_FLAG_GOING_TO_SLEEP ),15000 ); -if (ret <0 ) { +if (unlikely (ret <0 )) { val =_il_rd (il,CSR_GP_CNTRL ); -IL_ERR ("MAC is in deep sleep!. CSR_GP_CNTRL = 0x%08X\n" , val); +WARN_ONCE (1 ,"Timeout waiting for ucode processor access " +"(CSR_GP_CNTRL 0x%08x)\n" , val);_il_wr (il,CSR_RESET ,CSR_RESET_REG_FLAG_FORCE_NMI );return -EIO ; }
Signature · 1 line
1.7.1
PATCH 2/24 iwlegacy: always check if got h/w access before write
In reply to Stanislaw GruszkaBefore we write to the device register always check if _il_grap_nic_access() was successful.
Change type return type _il_grap_nic_access() to bool, and add likely()/unlikely() statements.
--- drivers/net/wireless/iwlegacy/4965-mac.c | 2 +- drivers/net/wireless/iwlegacy/common.c | 10 +++++----- drivers/net/wireless/iwlegacy/common.h | 27 +++++++++++++++------------ 3 files changed, 21 insertions(+), 18 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +1 -1
@@ -3778,7 +3778,7 @@ il4965_perform_ct_kill_task(struct il_priv *il)_il_rd (il,CSR_UCODE_DRV_GP1 );spin_lock_irqsave (&il->reg_lock, flags); -if (!_il_grab_nic_access (il)) +if (likely (_il_grab_nic_access (il)))_il_release_nic_access (il);spin_unlock_irqrestore (&il->reg_lock, flags); }
drivers/net/wireless/iwlegacy/common.c +5 -5
@@ -81,7 +81,7 @@ il_clear_bit(struct il_priv *p, u32 r, u32 m) }EXPORT_SYMBOL (il_clear_bit); -int +bool _il_grab_nic_access (struct il_priv *il) {int ret;
@@ -116,10 +116,10 @@ _il_grab_nic_access(struct il_priv *il)WARN_ONCE (1 ,"Timeout waiting for ucode processor access " "(CSR_GP_CNTRL 0x%08x)\n" , val);_il_wr (il,CSR_RESET ,CSR_RESET_REG_FLAG_FORCE_NMI ); -return -EIO ; +return false; } -return 0 ; +return true; }EXPORT_SYMBOL_GPL (_il_grab_nic_access);
@@ -161,7 +161,7 @@ il_wr_prph(struct il_priv *il, u32 addr, u32 val)unsigned long reg_flags;spin_lock_irqsave (&il->reg_lock, reg_flags); -if (!_il_grab_nic_access (il)) { +if (likely (_il_grab_nic_access (il))) {_il_wr_prph (il, addr, val);_il_release_nic_access (il); }
@@ -194,7 +194,7 @@ il_write_targ_mem(struct il_priv *il, u32 addr, u32 val)unsigned long reg_flags;spin_lock_irqsave (&il->reg_lock, reg_flags); -if (!_il_grab_nic_access (il)) { +if (likely (_il_grab_nic_access (il))) {_il_wr (il,HBUS_TARG_MEM_WADDR , addr);wmb ();_il_wr (il,HBUS_TARG_MEM_WDAT , val);
drivers/net/wireless/iwlegacy/common.h +15 -12
@@ -2103,7 +2103,7 @@ irqreturn_t il_isr(int irq, void *data);extern void il_set_bit (struct il_priv *p,u32 r,u32 m);extern void il_clear_bit (struct il_priv *p,u32 r,u32 m); -extern int _il_grab_nic_access (struct il_priv *il); +extern bool _il_grab_nic_access (struct il_priv *il);extern int _il_poll_bit (struct il_priv *il,u32 addr,u32 bits,u32 mask,int timeout);extern int il_poll_bit (struct il_priv *il,u32 addr,u32 mask,int timeout);extern u32 il_rd_prph (struct il_priv *il,u32 reg);
@@ -2168,7 +2168,7 @@ il_wr(struct il_priv *il, u32 reg, u32 value)unsigned long reg_flags;spin_lock_irqsave (&il->reg_lock, reg_flags); -if (!_il_grab_nic_access (il)) { +if (likely (_il_grab_nic_access (il))) {_il_wr (il, reg, value);_il_release_nic_access (il); }
@@ -2197,9 +2197,10 @@ il_set_bits_prph(struct il_priv *il, u32 reg, u32 mask)unsigned long reg_flags;spin_lock_irqsave (&il->reg_lock, reg_flags); -_il_grab_nic_access (il); -_il_wr_prph (il, reg, (_il_rd_prph (il, reg) | mask)); -_il_release_nic_access (il); +if (likely (_il_grab_nic_access (il))) { +_il_wr_prph (il, reg, (_il_rd_prph (il, reg) | mask)); +_il_release_nic_access (il); + }spin_unlock_irqrestore (&il->reg_lock, reg_flags); }
@@ -2209,9 +2210,10 @@ il_set_bits_mask_prph(struct il_priv *il, u32 reg, u32 bits, u32 mask)unsigned long reg_flags;spin_lock_irqsave (&il->reg_lock, reg_flags); -_il_grab_nic_access (il); -_il_wr_prph (il, reg, ((_il_rd_prph (il, reg) & mask) | bits)); -_il_release_nic_access (il); +if (likely (_il_grab_nic_access (il))) { +_il_wr_prph (il, reg, ((_il_rd_prph (il, reg) & mask) | bits)); +_il_release_nic_access (il); + }spin_unlock_irqrestore (&il->reg_lock, reg_flags); }
@@ -2222,10 +2224,11 @@ il_clear_bits_prph(struct il_priv *il, u32 reg, u32 mask)u32 val;spin_lock_irqsave (&il->reg_lock, reg_flags); -_il_grab_nic_access (il); - val =_il_rd_prph (il, reg); -_il_wr_prph (il, reg, (val & ~mask)); -_il_release_nic_access (il); +if (likely (_il_grab_nic_access (il))) { + val =_il_rd_prph (il, reg); +_il_wr_prph (il, reg, (val & ~mask)); +_il_release_nic_access (il); + }spin_unlock_irqrestore (&il->reg_lock, reg_flags); }
Signature · 1 line
1.7.1
PATCH 3/24 iwlegacy: cleanup/fix memory barriers
In reply to Stanislaw Gruszkawmb(), rmb() are not needed when writel(), readl() are used as accessors for MMIO. We use them indirectly via iowrite32(), ioread32().
What is needed mmiowb(), for synchronizing writes coming from different CPUs on PCIe bridge (see in patch comments). This fortunately is not needed on x86, where mmiowb() is just defined as compiler barrier. As iwlegacy devices are most likely not used on anything other than x86, this is not so important fix.
--- drivers/net/wireless/iwlegacy/common.c | 2 -- drivers/net/wireless/iwlegacy/common.h | 9 +++++++-- 2 files changed, 7 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlegacy/common.c +0 -2
@@ -179,7 +179,6 @@ il_read_targ_mem(struct il_priv *il, u32 addr)_il_grab_nic_access (il);_il_wr (il,HBUS_TARG_MEM_RADDR , addr); -rmb (); value =_il_rd (il,HBUS_TARG_MEM_RDAT );_il_release_nic_access (il);
@@ -196,7 +195,6 @@ il_write_targ_mem(struct il_priv *il, u32 addr, u32 val)spin_lock_irqsave (&il->reg_lock, reg_flags);if (likely (_il_grab_nic_access (il))) {_il_wr (il,HBUS_TARG_MEM_WADDR , addr); -wmb ();_il_wr (il,HBUS_TARG_MEM_WDAT , val);_il_release_nic_access (il); }
drivers/net/wireless/iwlegacy/common.h +7 -2
@@ -2146,6 +2146,13 @@ static inline void _il_release_nic_access(struct il_priv *il) {_il_clear_bit (il,CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ ); +/* +* In above we are reading CSR_GP_CNTRL register, what will flush any +* previous writes, but still want write, which clear MAC_ACCESS_REQ +* bit, be performed on PCI bus before any other writes scheduled on +* different CPUs (after we drop reg_lock). +*/ +mmiowb (); } static inline u32
@@ -2179,7 +2186,6 @@ static inline u32 _il_rd_prph(struct il_priv *il, u32 reg) { _il_wr(il, HBUS_TARG_PRPH_RADDR, reg | (3 << 24)); -rmb ();return _il_rd (il,HBUS_TARG_PRPH_RDAT ); }
@@ -2187,7 +2193,6 @@ static inline void _il_wr_prph(struct il_priv *il, u32 addr, u32 val) { _il_wr(il, HBUS_TARG_PRPH_WADDR, ((addr & 0x0000FFFF) | (3 << 24))); -wmb ();_il_wr (il,HBUS_TARG_PRPH_WDAT , val); }
Signature · 1 line
1.7.1
PATCH 4/24 iwlegacy: use writeb,writel,readl directly
In reply to Stanislaw GruszkaThat change will save us some CPU cycles at run time. Having port-based I/O seems to be not possible for PCIe devices.
--- drivers/net/wireless/iwlegacy/3945-mac.c | 6 +++--- drivers/net/wireless/iwlegacy/4965-mac.c | 6 +++--- drivers/net/wireless/iwlegacy/common.h | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +3 -3
@@ -3655,7 +3655,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/*********************** * 3. Read REV Register * ********************/ - il->hw_base =pci_iomap (pdev,0 ,0 ); + il->hw_base =pci_ioremap_bar (pdev,0 );if (!il->hw_base) { err = -ENODEV ; goto out_pci_release_regions;
@@ -3780,7 +3780,7 @@ out_unset_hw_params: out_eeprom_free:il_eeprom_free (il); out_iounmap: -pci_iounmap (pdev, il->hw_base); +iounmap (il->hw_base); out_pci_release_regions:pci_release_regions (pdev); out_pci_disable_device:
@@ -3860,7 +3860,7 @@ il3945_pci_remove(struct pci_dev *pdev)free_irq (pdev->irq, il);pci_disable_msi (pdev); -pci_iounmap (pdev, il->hw_base); +iounmap (il->hw_base);pci_release_regions (pdev);pci_disable_device (pdev);pci_set_drvdata (pdev,NULL );
drivers/net/wireless/iwlegacy/4965-mac.c +3 -3
@@ -6224,7 +6224,7 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/*********************** * 3. Read REV register ***********************/ - il->hw_base =pci_iomap (pdev,0 ,0 ); + il->hw_base =pci_ioremap_bar (pdev,0 );if (!il->hw_base) { err = -ENODEV ; goto out_pci_release_regions;
@@ -6356,7 +6356,7 @@ out_disable_msi: out_free_eeprom:il_eeprom_free (il); out_iounmap: -pci_iounmap (pdev, il->hw_base); +iounmap (il->hw_base); out_pci_release_regions:pci_set_drvdata (pdev,NULL );pci_release_regions (pdev);
@@ -6438,7 +6438,7 @@ il4965_pci_remove(struct pci_dev *pdev)free_irq (il->pci_dev->irq, il);pci_disable_msi (il->pci_dev); -pci_iounmap (pdev, il->hw_base); +iounmap (il->hw_base);pci_release_regions (pdev);pci_disable_device (pdev);pci_set_drvdata (pdev,NULL );
drivers/net/wireless/iwlegacy/common.h +3 -3
@@ -2114,20 +2114,20 @@ extern void il_write_targ_mem(struct il_priv *il, u32 addr, u32 val);static inline void _il_write8 (struct il_priv *il,u32 ofs,u8 val) { -iowrite8 (val, il->hw_base + ofs); +writeb (val, il->hw_base + ofs); }#define il_write8 (il, ofs, val) _il_write8(il, ofs, val)static inline void _il_wr (struct il_priv *il,u32 ofs,u32 val) { -iowrite32 (val, il->hw_base + ofs); +writel (val, il->hw_base + ofs); }static inline u32 _il_rd (struct il_priv *il,u32 ofs) { -return ioread32 (il->hw_base + ofs); +return readl (il->hw_base + ofs); } static inline void
Signature · 1 line
1.7.1
PATCH 5/24 iwlegacy: regulatory_bands is not an ops
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945.c | 39 ++++++++++++++++++++----------- drivers/net/wireless/iwlegacy/4965.c | 19 +++++++++------ drivers/net/wireless/iwlegacy/common.c | 10 +++----- drivers/net/wireless/iwlegacy/common.h | 3 +- 4 files changed, 42 insertions(+), 29 deletions(-)
drivers/net/wireless/iwlegacy/3945.c +25 -14
@@ -2646,18 +2646,9 @@ static struct il_lib_ops il3945_lib = { .config = il3945_nic_config, }, .eeprom_ops = { - .regulatory_bands = { -EEPROM_REGULATORY_BAND_1_CHANNELS , -EEPROM_REGULATORY_BAND_2_CHANNELS , -EEPROM_REGULATORY_BAND_3_CHANNELS , -EEPROM_REGULATORY_BAND_4_CHANNELS , -EEPROM_REGULATORY_BAND_5_CHANNELS , -EEPROM_REGULATORY_BAND_NO_HT40 , - EEPROM_REGULATORY_BAND_NO_HT40, - }, - .acquire_semaphore = il3945_eeprom_acquire_semaphore, - .release_semaphore = il3945_eeprom_release_semaphore, - }, + .acquire_semaphore = il3945_eeprom_acquire_semaphore, + .release_semaphore = il3945_eeprom_release_semaphore, + }, .send_tx_power = il3945_send_tx_power, .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr,
@@ -2707,7 +2698,17 @@ static struct il_cfg il3945_bg_cfg = { .set_l0s = false, .use_bsm = true, .led_compensation = 64, - .wd_timeout = IL_DEF_WD_TIMEOUT + .wd_timeout = IL_DEF_WD_TIMEOUT, + + .regulatory_bands = { +EEPROM_REGULATORY_BAND_1_CHANNELS , +EEPROM_REGULATORY_BAND_2_CHANNELS , +EEPROM_REGULATORY_BAND_3_CHANNELS , +EEPROM_REGULATORY_BAND_4_CHANNELS , +EEPROM_REGULATORY_BAND_5_CHANNELS , +EEPROM_REGULATORY_BAND_NO_HT40 , + EEPROM_REGULATORY_BAND_NO_HT40, + }, }; static struct il_cfg il3945_abg_cfg = {
@@ -2726,7 +2727,17 @@ static struct il_cfg il3945_abg_cfg = { .set_l0s = false, .use_bsm = true, .led_compensation = 64, - .wd_timeout = IL_DEF_WD_TIMEOUT + .wd_timeout = IL_DEF_WD_TIMEOUT, + + .regulatory_bands = { +EEPROM_REGULATORY_BAND_1_CHANNELS , +EEPROM_REGULATORY_BAND_2_CHANNELS , +EEPROM_REGULATORY_BAND_3_CHANNELS , +EEPROM_REGULATORY_BAND_4_CHANNELS , +EEPROM_REGULATORY_BAND_5_CHANNELS , +EEPROM_REGULATORY_BAND_NO_HT40 , + EEPROM_REGULATORY_BAND_NO_HT40, + }, }; DEFINE_PCI_DEVICE_TABLE(il3945_hw_card_ids) = {
drivers/net/wireless/iwlegacy/4965.c +11 -8
@@ -2217,14 +2217,6 @@ static struct il_lib_ops il4965_lib = { .config = il4965_nic_config, }, .eeprom_ops = { - .regulatory_bands = { -EEPROM_REGULATORY_BAND_1_CHANNELS , -EEPROM_REGULATORY_BAND_2_CHANNELS , -EEPROM_REGULATORY_BAND_3_CHANNELS , -EEPROM_REGULATORY_BAND_4_CHANNELS , -EEPROM_REGULATORY_BAND_5_CHANNELS , -EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS , - EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS}, .acquire_semaphore = il4965_eeprom_acquire_semaphore, .release_semaphore = il4965_eeprom_release_semaphore, },
@@ -2288,6 +2280,17 @@ struct il_cfg il4965_cfg = { .ucode_tracing = true, .sensitivity_calib_by_driver = true, .chain_noise_calib_by_driver = true, + + .regulatory_bands = { +EEPROM_REGULATORY_BAND_1_CHANNELS , +EEPROM_REGULATORY_BAND_2_CHANNELS , +EEPROM_REGULATORY_BAND_3_CHANNELS , +EEPROM_REGULATORY_BAND_4_CHANNELS , +EEPROM_REGULATORY_BAND_5_CHANNELS , +EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS , +EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS + }, + };/* Module firmware */
drivers/net/wireless/iwlegacy/common.c +4 -6
@@ -798,8 +798,8 @@ il_init_band_reference(const struct il_priv *il, int eep_band,const struct il_eeprom_channel **eeprom_ch_info, const u8 **eeprom_ch_idx) { - u32 offset = - il->ops->lib->eeprom_ops.regulatory_bands[eep_band -1 ]; + u32 offset = il->cfg->regulatory_bands[eep_band - 1]; +switch (eep_band) {case 1 :/* 2.4GHz band */ *eeprom_ch_count =ARRAY_SIZE (il_eeprom_band_1);
@@ -1000,10 +1000,8 @@ il_init_channel_map(struct il_priv *il) }/* Check if we do have HT40 channels */ -if (il->ops->lib->eeprom_ops.regulatory_bands[5 ] == -EEPROM_REGULATORY_BAND_NO_HT40 && - il->ops->lib->eeprom_ops.regulatory_bands[6 ] == -EEPROM_REGULATORY_BAND_NO_HT40 ) +if (il->cfg->regulatory_bands[5 ] ==EEPROM_REGULATORY_BAND_NO_HT40 && + il->cfg->regulatory_bands[6 ] ==EEPROM_REGULATORY_BAND_NO_HT40 )return 0 ;/* Two additional EEPROM bands for 2.4 and 5 GHz HT40 channels */
drivers/net/wireless/iwlegacy/common.h +2 -1
@@ -426,7 +426,6 @@ struct il_eeprom_calib_info {#define EEPROM_REGULATORY_BAND_NO_HT40 (0)struct il_eeprom_ops { -const u32 regulatory_bands[7 ];int (*acquire_semaphore) (struct il_priv *il);void (*release_semaphore) (struct il_priv *il); };
@@ -1769,6 +1768,8 @@ struct il_cfg {const bool ucode_tracing;const bool sensitivity_calib_by_driver;const bool chain_noise_calib_by_driver; + +const u32 regulatory_bands[7 ]; };/***************************
Signature · 1 line
1.7.1
PATCH 6/24 iwlegacy: gather all 4965 handlers in one place
In reply to Stanislaw GruszkaHanders belongs logically into 4965-mac.c file.
--- drivers/net/wireless/iwlegacy/4965-mac.c | 307 +++++++++++++++++++++++++++++- drivers/net/wireless/iwlegacy/4965.c | 312 ------------------------------ drivers/net/wireless/iwlegacy/4965.h | 9 - drivers/net/wireless/iwlegacy/common.h | 2 - 4 files changed, 305 insertions(+), 325 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +305 -2
@@ -2548,6 +2548,308 @@ il4965_tx_status_reply_compressed_ba(struct il_priv *il, struct il_ht_agg *agg,return 0 ; } +static inline bool +il4965_is_tx_success (u32 status) +{ + status &=TX_STATUS_MSK ; +return (status ==TX_STATUS_SUCCESS || status ==TX_STATUS_DIRECT_DONE ); +} + +static u8 +il4965_find_station (struct il_priv *il,const u8 *addr) +{ +int i; +int start =0 ; +int ret =IL_INVALID_STATION ; +unsigned long flags; + +if (il->iw_mode ==NL80211_IFTYPE_ADHOC ) + start =IL_STA_ID ; + +if (is_broadcast_ether_addr (addr)) +return il->hw_params.bcast_id; + +spin_lock_irqsave (&il->sta_lock, flags); +for (i = start; i < il->hw_params.max_stations; i++) +if (il->stations[i].used && + (!compare_ether_addr (il->stations[i].sta.sta.addr, addr))) { + ret = i; + goto out; + } + +D_ASSOC ("can not find STA %pM total %d\n" , addr, il->num_stations); + +out: +/* +* It may be possible that more commands interacting with stations +* arrive before we completed processing the adding of +* station +*/ +if (ret !=IL_INVALID_STATION && + (!(il->stations[ret].used &IL_STA_UCODE_ACTIVE ) || + ((il->stations[ret].used &IL_STA_UCODE_ACTIVE ) && + (il->stations[ret].used &IL_STA_UCODE_INPROGRESS )))) { +IL_ERR ("Requested station info for sta %d before ready.\n" , + ret); + ret =IL_INVALID_STATION ; + } +spin_unlock_irqrestore (&il->sta_lock, flags); +return ret; +} + +static int +il4965_get_ra_sta_id (struct il_priv *il,struct ieee80211_hdr *hdr) +{ +if (il->iw_mode ==NL80211_IFTYPE_STATION ) +return IL_AP_ID ; +else { +u8 *da =ieee80211_get_DA (hdr); + +return il4965_find_station (il, da); + } +} + +static inline u32 +il4965_get_scd_ssn (struct il4965_tx_resp *tx_resp) +{ +return le32_to_cpup (&tx_resp->u.status + tx_resp->frame_count) &MAX_SN ; +} + +static inline u32 +il4965_tx_status_to_mac80211 (u32 status) +{ + status &=TX_STATUS_MSK ; + +switch (status) { +case TX_STATUS_SUCCESS : +case TX_STATUS_DIRECT_DONE : +return IEEE80211_TX_STAT_ACK ; +case TX_STATUS_FAIL_DEST_PS : +return IEEE80211_TX_STAT_TX_FILTERED ; +default : +return 0 ; + } +} + +/** +* il4965_tx_status_reply_tx - Handle Tx response for frames in aggregation queue +*/ +static int +il4965_tx_status_reply_tx (struct il_priv *il,struct il_ht_agg *agg, +struct il4965_tx_resp *tx_resp,int txq_id, +u16 start_idx) +{ +u16 status; +struct agg_tx_status *frame_status = tx_resp->u.agg_status; +struct ieee80211_tx_info *info =NULL ; +struct ieee80211_hdr *hdr =NULL ; +u32 rate_n_flags =le32_to_cpu (tx_resp->rate_n_flags); +int i, sh, idx; +u16 seq; +if (agg->wait_for_ba) +D_TX_REPLY ("got tx response w/o block-ack\n" ); + + agg->frame_count = tx_resp->frame_count; + agg->start_idx = start_idx; + agg->rate_n_flags = rate_n_flags; + agg->bitmap =0 ; + +/* num frames attempted by Tx command */ +if (agg->frame_count ==1 ) { +/* Only one frame was attempted; no block-ack will arrive */ + status =le16_to_cpu (frame_status[0 ].status); + idx = start_idx; + +D_TX_REPLY ("FrameCnt = %d, StartIdx=%d idx=%d\n" , + agg->frame_count, agg->start_idx, idx); + + info =IEEE80211_SKB_CB (il->txq[txq_id].skbs[idx]); + info->status.rates[0 ].count = tx_resp->failure_frame +1 ; + info->flags &= ~IEEE80211_TX_CTL_AMPDU ; + info->flags |=il4965_tx_status_to_mac80211 (status); +il4965_hwrate_to_tx_control (il, rate_n_flags, info); + +D_TX_REPLY ("1 Frame 0x%x failure :%d\n" , status &0xff , + tx_resp->failure_frame); +D_TX_REPLY ("Rate Info rate_n_flags=%x\n" , rate_n_flags); + + agg->wait_for_ba =0 ; + }else { +/* Two or more frames were attempted; expect block-ack */ +u64 bitmap =0 ; +int start = agg->start_idx; +struct sk_buff *skb; + +/* Construct bit-map of pending frames within Tx win */ +for (i =0 ; i < agg->frame_count; i++) { +u16 sc; + status =le16_to_cpu (frame_status[i].status); + seq =le16_to_cpu (frame_status[i].sequence); + idx =SEQ_TO_IDX (seq); + txq_id =SEQ_TO_QUEUE (seq); + +if (status & + (AGG_TX_STATE_FEW_BYTES_MSK | +AGG_TX_STATE_ABORT_MSK )) +continue ; + +D_TX_REPLY ("FrameCnt = %d, txq_id=%d idx=%d\n" , + agg->frame_count, txq_id, idx); + + skb = il->txq[txq_id].skbs[idx]; +if (WARN_ON_ONCE (skb ==NULL )) +return -1 ; + hdr = (struct ieee80211_hdr *) skb->data; + + sc =le16_to_cpu (hdr->seq_ctrl); +if (idx != (SEQ_TO_SN (sc) &0xff )) { +IL_ERR ("BUG_ON idx doesn't match seq control" +" idx=%d, seq_idx=%d, seq=%d\n" , idx, +SEQ_TO_SN (sc), hdr->seq_ctrl); +return -1 ; + } + +D_TX_REPLY ("AGG Frame i=%d idx %d seq=%d\n" , i, idx, +SEQ_TO_SN (sc)); + + sh = idx - start; +if (sh >64 ) { + sh = (start - idx) +0xff ; + bitmap = bitmap << sh; + sh =0 ; + start = idx; + }else if (sh <-64 ) + sh =0xff - (start - idx); +else if (sh <0 ) { + sh = start - idx; + start = idx; + bitmap = bitmap << sh; + sh =0 ; + } + bitmap |=1ULL << sh; +D_TX_REPLY ("start=%d bitmap=0x%llx\n" , start, + (unsigned long long )bitmap); + } + + agg->bitmap = bitmap; + agg->start_idx = start; +D_TX_REPLY ("Frames %d start_idx=%d bitmap=0x%llx\n" , + agg->frame_count, agg->start_idx, + (unsigned long long )agg->bitmap); + +if (bitmap) + agg->wait_for_ba =1 ; + } +return 0 ; +} + +/** +* il4965_hdl_tx - Handle standard (non-aggregation) Tx response +*/ +static void +il4965_hdl_tx (struct il_priv *il,struct il_rx_buf *rxb) +{ +struct il_rx_pkt *pkt =rxb_addr (rxb); +u16 sequence =le16_to_cpu (pkt->hdr.sequence); +int txq_id =SEQ_TO_QUEUE (sequence); +int idx =SEQ_TO_IDX (sequence); +struct il_tx_queue *txq = &il->txq[txq_id]; +struct sk_buff *skb; +struct ieee80211_hdr *hdr; +struct ieee80211_tx_info *info; +struct il4965_tx_resp *tx_resp = (void *)&pkt->u.raw[0 ]; +u32 status =le32_to_cpu (tx_resp->u.status); +int uninitialized_var (tid ); +int sta_id; +int freed; +u8 *qc =NULL ; +unsigned long flags; + +if (idx >= txq->q.n_bd ||il_queue_used (&txq->q, idx) ==0 ) { +IL_ERR ("Read idx for DMA queue txq_id (%d) idx %d " +"is out of range [0-%d] %d %d\n" , txq_id, idx, + txq->q.n_bd, txq->q.write_ptr, txq->q.read_ptr); +return ; + } + + txq->time_stamp = jiffies; + + skb = txq->skbs[txq->q.read_ptr]; + info =IEEE80211_SKB_CB (skb); +memset (&info->status,0 ,sizeof (info->status)); + + hdr = (struct ieee80211_hdr *) skb->data; +if (ieee80211_is_data_qos (hdr->frame_control)) { + qc =ieee80211_get_qos_ctl (hdr); + tid = qc[0 ] &0xf ; + } + + sta_id =il4965_get_ra_sta_id (il, hdr); +if (txq->sched_retry &&unlikely (sta_id ==IL_INVALID_STATION )) { +IL_ERR ("Station not known\n" ); +return ; + } + +spin_lock_irqsave (&il->sta_lock, flags); +if (txq->sched_retry) { +const u32 scd_ssn =il4965_get_scd_ssn (tx_resp); +struct il_ht_agg *agg =NULL ; +WARN_ON (!qc); + + agg = &il->stations[sta_id].tid[tid].agg; + +il4965_tx_status_reply_tx (il, agg, tx_resp, txq_id, idx); + +/* check if BAR is needed */ +if (tx_resp->frame_count ==1 && + !il4965_is_tx_success (status)) + info->flags |=IEEE80211_TX_STAT_AMPDU_NO_BACK ; + +if (txq->q.read_ptr != (scd_ssn &0xff )) { + idx =il_queue_dec_wrap (scd_ssn &0xff , txq->q.n_bd); +D_TX_REPLY ("Retry scheduler reclaim scd_ssn " +"%d idx %d\n" , scd_ssn, idx); + freed =il4965_tx_queue_reclaim (il, txq_id, idx); +if (qc) +il4965_free_tfds_in_queue (il, sta_id, tid, + freed); + +if (il->mac80211_registered && +il_queue_space (&txq->q) > txq->q.low_mark && + agg->state !=IL_EMPTYING_HW_QUEUE_DELBA ) +il_wake_queue (il, txq); + } + }else { + info->status.rates[0 ].count = tx_resp->failure_frame +1 ; + info->flags |=il4965_tx_status_to_mac80211 (status); +il4965_hwrate_to_tx_control (il, +le32_to_cpu (tx_resp->rate_n_flags), + info); + +D_TX_REPLY ("TXQ %d status %s (0x%08x) " +"rate_n_flags 0x%x retries %d\n" , txq_id, +il4965_get_tx_fail_reason (status), status, +le32_to_cpu (tx_resp->rate_n_flags), + tx_resp->failure_frame); + + freed =il4965_tx_queue_reclaim (il, txq_id, idx); +if (qc &&likely (sta_id !=IL_INVALID_STATION )) +il4965_free_tfds_in_queue (il, sta_id, tid, freed); +else if (sta_id ==IL_INVALID_STATION ) +D_TX_REPLY ("Station not known\n" ); + +if (il->mac80211_registered && +il_queue_space (&txq->q) > txq->q.low_mark) +il_wake_queue (il, txq); + } +if (qc &&likely (sta_id !=IL_INVALID_STATION )) +il4965_txq_check_empty (il, sta_id, tid, txq_id); + +il4965_check_abort_status (il, tx_resp->frame_count, status); + +spin_unlock_irqrestore (&il->sta_lock, flags); +} +/** * translate ucode response to mac80211 tx status control values */
@@ -3868,10 +4170,11 @@ il4965_setup_handlers(struct il_priv *il)/* Rx handlers */ il->handlers[N_RX_PHY ] = il4965_hdl_rx_phy; il->handlers[N_RX_MPDU ] = il4965_hdl_rx; + il->handlers[N_RX ] = il4965_hdl_rx;/* block ack */ il->handlers[N_COMPRESSED_BA ] = il4965_hdl_compressed_ba; -/* Set up hardware specific Rx handlers */ - il->ops->lib->handler_setup (il); +/* Tx response */ + il->handlers[C_TX ] = il4965_hdl_tx; }/**
drivers/net/wireless/iwlegacy/4965.c +0 -312
324 lines not on this page · raw message
drivers/net/wireless/iwlegacy/4965.h +0 -9
@@ -67,8 +67,6 @@ void il4965_rx_replenish_now(struct il_priv *il);void il4965_rx_queue_free (struct il_priv *il,struct il_rx_queue *rxq);int il4965_rxq_stop (struct il_priv *il);int il4965_hwrate_to_mac80211_idx (u32 rate_n_flags,enum ieee80211_band band); -void il4965_hdl_rx (struct il_priv *il,struct il_rx_buf *rxb); -void il4965_hdl_rx_phy (struct il_priv *il,struct il_rx_buf *rxb);void il4965_rx_handle (struct il_priv *il);/* tx */
@@ -84,7 +82,6 @@ int il4965_tx_agg_start(struct il_priv *il, struct ieee80211_vif *vif,int il4965_tx_agg_stop (struct il_priv *il,struct ieee80211_vif *vif,struct ieee80211_sta *sta,u16 tid);int il4965_txq_check_empty (struct il_priv *il,int sta_id,u8 tid,int txq_id); -void il4965_hdl_compressed_ba (struct il_priv *il,struct il_rx_buf *rxb);int il4965_tx_queue_reclaim (struct il_priv *il,int txq_id,int idx);void il4965_hw_txq_ctx_free (struct il_priv *il);int il4965_txq_ctx_alloc (struct il_priv *il);
@@ -106,12 +103,6 @@ void il4965_set_wr_ptrs(struct il_priv *il, int txq_id, u32 idx);void il4965_tx_queue_set_status (struct il_priv *il,struct il_tx_queue *txq,int tx_fifo_id,int scd_retry); -/* rx */ -void il4965_hdl_missed_beacon (struct il_priv *il,struct il_rx_buf *rxb); -bool il4965_good_plcp_health (struct il_priv *il,struct il_rx_pkt *pkt); -void il4965_hdl_stats (struct il_priv *il,struct il_rx_buf *rxb); -void il4965_hdl_c_stats (struct il_priv *il,struct il_rx_buf *rxb); -/* scan */ int il4965_request_scan (struct il_priv *il,struct ieee80211_vif *vif);
drivers/net/wireless/iwlegacy/common.h +0 -2
@@ -1600,8 +1600,6 @@ struct il_lib_ops { u16 len, u8 reset, u8 pad);void (*txq_free_tfd) (struct il_priv *il,struct il_tx_queue *txq);int (*txq_init) (struct il_priv *il,struct il_tx_queue *txq); -/* setup Rx handler */ -void (*handler_setup) (struct il_priv *il);/* alive notification after init uCode load */ void (*init_alive_start) (struct il_priv *il);/* check validity of rtc data address */
Signature · 1 line
1.7.1
PATCH 7/24 iwlegacy: move debugfs_ops to il_priv
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945-debug.c | 6 ++++++ drivers/net/wireless/iwlegacy/3945-mac.c | 3 +++ drivers/net/wireless/iwlegacy/3945.c | 8 -------- drivers/net/wireless/iwlegacy/3945.h | 8 +------- drivers/net/wireless/iwlegacy/4965-debug.c | 6 ++++++ drivers/net/wireless/iwlegacy/4965-mac.c | 3 +++ drivers/net/wireless/iwlegacy/4965.c | 7 ------- drivers/net/wireless/iwlegacy/4965.h | 8 +------- drivers/net/wireless/iwlegacy/common.h | 10 ++++------ drivers/net/wireless/iwlegacy/debug.c | 9 ++++++--- 10 files changed, 30 insertions(+), 38 deletions(-)
drivers/net/wireless/iwlegacy/3945-debug.c +6 -0
@@ -503,3 +503,9 @@ il3945_ucode_general_stats_read(struct file *file, char __user *user_buf,kfree (buf);return ret; } + +const struct il_debugfs_ops il3945_debugfs_ops = { + .rx_stats_read = il3945_ucode_rx_stats_read, + .tx_stats_read = il3945_ucode_tx_stats_read, + .general_stats_read = il3945_ucode_general_stats_read, +};
drivers/net/wireless/iwlegacy/3945-mac.c +3 -0
@@ -3619,6 +3619,9 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)D_INFO ("*** LOAD DRIVER ***\n" ); il->cfg = cfg; il->ops = &il3945_ops; +#ifdef CONFIG_IWLEGACY_DEBUGFS + il->debugfs_ops = &il3945_debugfs_ops; +#endif il->pci_dev = pdev; il->inta_mask =CSR_INI_SET_MASK ;
drivers/net/wireless/iwlegacy/3945.c +0 -8
@@ -2651,14 +2651,6 @@ static struct il_lib_ops il3945_lib = { }, .send_tx_power = il3945_send_tx_power, .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, - -#ifdef CONFIG_IWLEGACY_DEBUGFS - .debugfs_ops = { - .rx_stats_read = il3945_ucode_rx_stats_read, - .tx_stats_read = il3945_ucode_tx_stats_read, - .general_stats_read = il3945_ucode_general_stats_read, - }, -#endif };static const struct il_legacy_ops il3945_legacy_ops = {
drivers/net/wireless/iwlegacy/3945.h +1 -7
@@ -595,13 +595,7 @@ struct il3945_tfd { } __packed;#ifdef CONFIG_IWLEGACY_DEBUGFS -ssize_t il3945_ucode_rx_stats_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); -ssize_t il3945_ucode_tx_stats_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); -ssize_t il3945_ucode_general_stats_read (struct file *file, -char __user *user_buf,size_t count, -loff_t *ppos); +extern const struct il_debugfs_ops il3945_debugfs_ops;#endif #endif
drivers/net/wireless/iwlegacy/4965-debug.c +6 -0
@@ -744,3 +744,9 @@ il4965_ucode_general_stats_read(struct file *file, char __user *user_buf,kfree (buf);return ret; } + +const struct il_debugfs_ops il4965_debugfs_ops = { + .rx_stats_read = il4965_ucode_rx_stats_read, + .tx_stats_read = il4965_ucode_tx_stats_read, + .general_stats_read = il4965_ucode_general_stats_read, +};
drivers/net/wireless/iwlegacy/4965-mac.c +3 -0
@@ -6483,6 +6483,9 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)D_INFO ("*** LOAD DRIVER ***\n" ); il->cfg = cfg; il->ops = &il4965_ops; +#ifdef CONFIG_IWLEGACY_DEBUGFS + il->debugfs_ops = &il4965_debugfs_ops; +#endif il->pci_dev = pdev; il->inta_mask =CSR_INI_SET_MASK ;
drivers/net/wireless/iwlegacy/4965.c +0 -7
@@ -1913,13 +1913,6 @@ static struct il_lib_ops il4965_lib = { .temp_ops = { .temperature = il4965_temperature_calib, }, -#ifdef CONFIG_IWLEGACY_DEBUGFS - .debugfs_ops = { - .rx_stats_read = il4965_ucode_rx_stats_read, - .tx_stats_read = il4965_ucode_tx_stats_read, - .general_stats_read = il4965_ucode_general_stats_read, - }, -#endif };static const struct il_legacy_ops il4965_legacy_ops = {
drivers/net/wireless/iwlegacy/4965.h +1 -7
@@ -928,13 +928,7 @@ void il4965_calib_free_results(struct il_priv *il);/* Debug */ #ifdef CONFIG_IWLEGACY_DEBUGFS -ssize_t il4965_ucode_rx_stats_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); -ssize_t il4965_ucode_tx_stats_read (struct file *file,char __user *user_buf, -size_t count,loff_t *ppos); -ssize_t il4965_ucode_general_stats_read (struct file *file, -char __user *user_buf,size_t count, -loff_t *ppos); +extern const struct il_debugfs_ops il4965_debugfs_ops;#endif /****************************/
drivers/net/wireless/iwlegacy/common.h +4 -6
@@ -1155,13 +1155,15 @@ struct il_power_mgr { };struct il_priv { - -/* ieee device used by generic ieee processing code */ struct ieee80211_hw *hw;struct ieee80211_channel *ieee_channels;struct ieee80211_rate *ieee_rates; +struct il_cfg *cfg;const struct il_ops *ops; +#ifdef CONFIG_IWLEGACY_DEBUGFS +const struct il_debugfs_ops *debugfs_ops; +#endif /* temporary frame storage list */ struct list_head free_frames;
@@ -1624,10 +1626,6 @@ struct il_lib_ops {/* temperature */ struct il_temp_ops temp_ops; -#ifdef CONFIG_IWLEGACY_DEBUGFS -struct il_debugfs_ops debugfs_ops; -#endif - };struct il_led_ops {
drivers/net/wireless/iwlegacy/debug.c +6 -3
@@ -901,7 +901,8 @@ il_dbgfs_ucode_rx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct il_priv *il = file->private_data; -return il->ops->lib->debugfs_ops.rx_stats_read (file, user_buf, count, ppos); + +return il->debugfs_ops->rx_stats_read (file, user_buf, count, ppos); } static ssize_t
@@ -909,7 +910,8 @@ il_dbgfs_ucode_tx_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct il_priv *il = file->private_data; -return il->ops->lib->debugfs_ops.tx_stats_read (file, user_buf, count, ppos); + +return il->debugfs_ops->tx_stats_read (file, user_buf, count, ppos); } static ssize_t
@@ -917,7 +919,8 @@ il_dbgfs_ucode_general_stats_read(struct file *file, char __user *user_buf, size_t count, loff_t *ppos) { struct il_priv *il = file->private_data; -return il->ops->lib->debugfs_ops.general_stats_read (file, user_buf, count, ppos); + +return il->debugfs_ops->general_stats_read (file, user_buf, count, ppos); } static ssize_t
Signature · 1 line
1.7.1
PATCH 8/24 iwlegacy: remove temp_ops
In reply to Stanislaw GruszkaRemove unneeded structure and cleanup temperature calibration routines a bit.
--- drivers/net/wireless/iwlegacy/4965-mac.c | 26 +++++++++++++------------- drivers/net/wireless/iwlegacy/4965.c | 5 +---- drivers/net/wireless/iwlegacy/4965.h | 1 + drivers/net/wireless/iwlegacy/common.h | 8 -------- 4 files changed, 15 insertions(+), 25 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +13 -13
@@ -1343,12 +1343,11 @@ il4965_accumulative_stats(struct il_priv *il, __le32 * stats) }#endif -#define REG_RECALIB_PERIOD (60) -void il4965_hdl_stats (struct il_priv *il,struct il_rx_buf *rxb) { -int change; +const int recalib_seconds =60 ; +bool change;struct il_rx_pkt *pkt =rxb_addr (rxb); D_RX("Statistics notification received (%d vs %d).\n",
@@ -1369,20 +1368,21 @@ il4965_hdl_stats(struct il_priv *il, struct il_rx_buf *rxb)set_bit (S_STATS , &il->status); -/* Reschedule the stats timer to occur in -* REG_RECALIB_PERIOD seconds to ensure we get a -* thermal update even if the uCode doesn't give -* us one */ +/* +* Reschedule the stats timer to occur in recalib_seconds to ensure +* we get a thermal update even if the uCode doesn't give us one +*/ mod_timer (&il->stats_periodic, - jiffies +msecs_to_jiffies (REG_RECALIB_PERIOD *1000 )); + jiffies +msecs_to_jiffies (recalib_seconds *1000 ));if (unlikely (!test_bit (S_SCANNING , &il->status)) && (pkt->hdr.cmd ==N_STATS )) {il4965_rx_calc_noise (il);queue_work (il->workqueue, &il->run_time_calib_work); } -if (il->ops->lib->temp_ops.temperature && change) - il->ops->lib->temp_ops.temperature (il); + +if (change) +il4965_temperature_calib (il); }void
@@ -4028,9 +4028,9 @@ il4965_hdl_alive(struct il_priv *il, struct il_rx_buf *rxb)* This callback is provided in order to send a stats request. * * This timer function is continually reset to execute within -* REG_RECALIB_PERIOD seconds since the last N_STATS -* was received. We need to ensure we receive the stats in order -* to update the temperature used for calibrating the TXPOWER. +* 60 seconds since the last N_STATS was received. We need to +* ensure we receive the stats in order to update the temperature +* used for calibrating the TXPOWER. */ static void il4965_bg_stats_periodic (unsigned long data)
drivers/net/wireless/iwlegacy/4965.c +1 -4
@@ -1678,7 +1678,7 @@ il4965_is_temp_calib_needed(struct il_priv *il)return 1 ; } -static void +void il4965_temperature_calib (struct il_priv *il) {s32 temp;
@@ -1910,9 +1910,6 @@ static struct il_lib_ops il4965_lib = { }, .send_tx_power = il4965_send_tx_power, .update_chain_flags = il4965_update_chain_flags, - .temp_ops = { - .temperature = il4965_temperature_calib, - }, };static const struct il_legacy_ops il4965_legacy_ops = {
drivers/net/wireless/iwlegacy/4965.h +1 -0
@@ -266,6 +266,7 @@ il4965_hw_valid_rtc_data_addr(u32 addr) ((t) <IL_TX_POWER_TEMPERATURE_MIN || \ (t) > IL_TX_POWER_TEMPERATURE_MAX) +extern void il4965_temperature_calib (struct il_priv *il);/********************* END TEMPERATURE ***************************************/ /********************* START TXPOWER *****************************************/
drivers/net/wireless/iwlegacy/common.h +0 -8
@@ -1588,10 +1588,6 @@ struct il_debugfs_ops { };#endif -struct il_temp_ops { -void (*temperature) (struct il_priv *il); -}; -struct il_lib_ops {/* Handling TX */ void (*txq_update_byte_cnt_tbl) (struct il_priv *il,
@@ -1622,10 +1618,6 @@ struct il_lib_ops {/* eeprom operations */ struct il_eeprom_ops eeprom_ops; - -/* temperature */ -struct il_temp_ops temp_ops; - };struct il_led_ops {
Signature · 1 line
1.7.1
PATCH 9/24 iwlegacy: merge eeprom_ops into lib_ops
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945.c | 6 ++---- drivers/net/wireless/iwlegacy/4965.c | 6 ++---- drivers/net/wireless/iwlegacy/common.c | 4 ++-- drivers/net/wireless/iwlegacy/common.h | 8 ++------ 4 files changed, 8 insertions(+), 16 deletions(-)
drivers/net/wireless/iwlegacy/3945.c +2 -4
@@ -2645,12 +2645,10 @@ static struct il_lib_ops il3945_lib = { .init = il3945_apm_init, .config = il3945_nic_config, }, - .eeprom_ops = { - .acquire_semaphore = il3945_eeprom_acquire_semaphore, - .release_semaphore = il3945_eeprom_release_semaphore, - }, .send_tx_power = il3945_send_tx_power, .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, + .eeprom_acquire_semaphore = il3945_eeprom_acquire_semaphore, + .eeprom_release_semaphore = il3945_eeprom_release_semaphore, }; static const struct il_legacy_ops il3945_legacy_ops = {
drivers/net/wireless/iwlegacy/4965.c +2 -4
@@ -1904,12 +1904,10 @@ static struct il_lib_ops il4965_lib = { .init = il_apm_init, .config = il4965_nic_config, }, - .eeprom_ops = { - .acquire_semaphore = il4965_eeprom_acquire_semaphore, - .release_semaphore = il4965_eeprom_release_semaphore, - }, .send_tx_power = il4965_send_tx_power, .update_chain_flags = il4965_update_chain_flags, + .eeprom_acquire_semaphore = il4965_eeprom_acquire_semaphore, + .eeprom_release_semaphore = il4965_eeprom_release_semaphore, }; static const struct il_legacy_ops il4965_legacy_ops = {
drivers/net/wireless/iwlegacy/common.c +2 -2
@@ -740,7 +740,7 @@ il_eeprom_init(struct il_priv *il) }/* Make sure driver (instead of uCode) is allowed to read EEPROM */ - ret = il->ops->lib->eeprom_ops.acquire_semaphore (il); + ret = il->ops->lib->eeprom_acquire_semaphore (il);if (ret <0 ) {IL_ERR ("Failed to acquire EEPROM semaphore.\n" ); ret = -ENOENT ;
@@ -772,7 +772,7 @@ il_eeprom_init(struct il_priv *il) ret =0 ; done: - il->ops->lib->eeprom_ops.release_semaphore (il); + il->ops->lib->eeprom_release_semaphore (il); err:if (ret)
drivers/net/wireless/iwlegacy/common.h +2 -6
@@ -425,11 +425,6 @@ struct il_eeprom_calib_info {#define EEPROM_REGULATORY_BAND_NO_HT40 (0) -struct il_eeprom_ops { -int (*acquire_semaphore) (struct il_priv *il); -void (*release_semaphore) (struct il_priv *il); -}; -int il_eeprom_init (struct il_priv *il);void il_eeprom_free (struct il_priv *il);const u8 *il_eeprom_query_addr (const struct il_priv *il,size_t offset);
@@ -1617,7 +1612,8 @@ struct il_lib_ops {void (*update_chain_flags) (struct il_priv *il);/* eeprom operations */ -struct il_eeprom_ops eeprom_ops; +int (*eeprom_acquire_semaphore) (struct il_priv *il); +void (*eeprom_release_semaphore) (struct il_priv *il); };struct il_led_ops {
Signature · 1 line
1.7.1
PATCH 10/24 iwlegacy: remove il_apm_ops
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945-mac.c | 2 +- drivers/net/wireless/iwlegacy/3945.c | 10 +++------- drivers/net/wireless/iwlegacy/4965-mac.c | 8 ++------ drivers/net/wireless/iwlegacy/4965.c | 7 ++----- drivers/net/wireless/iwlegacy/4965.h | 2 ++ drivers/net/wireless/iwlegacy/common.c | 2 +- drivers/net/wireless/iwlegacy/common.h | 9 ++------- 7 files changed, 13 insertions(+), 27 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +1 -1
@@ -3672,7 +3672,7 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)* PCI Tx retries from interfering with C3 CPU state */ pci_write_config_byte (pdev,0x41 ,0x00 ); -/* these spin locks will be used in apm_ops.init and EEPROM access +/* these spin locks will be used in apm_init and EEPROM access * we should init now */ spin_lock_init (&il->reg_lock);
drivers/net/wireless/iwlegacy/3945.c +3 -7
@@ -958,12 +958,11 @@ il3945_hw_nic_init(struct il_priv *il)struct il_rx_queue *rxq = &il->rxq;spin_lock_irqsave (&il->lock, flags); - il->ops->lib->apm_ops.init (il); +il3945_apm_init (il);spin_unlock_irqrestore (&il->lock, flags);il3945_set_pwr_vmain (il); - - il->ops->lib->apm_ops.config (il); +il3945_nic_config (il);/* Allocate the RX queue, or reset if it is already allocated */ if (!rxq->bd) {
@@ -2641,10 +2640,7 @@ static struct il_lib_ops il3945_lib = { .txq_init = il3945_hw_tx_queue_init, .load_ucode = il3945_load_bsm, .dump_nic_error_log = il3945_dump_nic_error_log, - .apm_ops = { - .init = il3945_apm_init, - .config = il3945_nic_config, - }, + .apm_init = il3945_apm_init, .send_tx_power = il3945_send_tx_power, .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, .eeprom_acquire_semaphore = il3945_eeprom_acquire_semaphore,
drivers/net/wireless/iwlegacy/4965-mac.c +2 -6
@@ -199,18 +199,14 @@ il4965_hw_nic_init(struct il_priv *il)struct il_rx_queue *rxq = &il->rxq;int ret; -/* nic_init */ spin_lock_irqsave (&il->lock, flags); - il->ops->lib->apm_ops.init (il); - +il_apm_init (il);/* Set interrupt coalescing calibration timer to default (512 usecs) */ il_write8 (il,CSR_INT_COALESCING ,IL_HOST_INT_CALIB_TIMEOUT_DEF ); -spin_unlock_irqrestore (&il->lock, flags);il4965_set_pwr_vmain (il); - - il->ops->lib->apm_ops.config (il); +il4965_nic_config (il);/* Allocate the RX queue, or reset if it is already allocated */ if (!rxq->bd) {
drivers/net/wireless/iwlegacy/4965.c +2 -5
@@ -508,7 +508,7 @@ iw4965_is_ht40_channel(__le32 rxon_flags) chan_mod == CHANNEL_MODE_MIXED); } -static void +void il4965_nic_config (struct il_priv *il) {unsigned long flags;
@@ -1900,10 +1900,7 @@ static struct il_lib_ops il4965_lib = { .dump_nic_error_log = il4965_dump_nic_error_log, .dump_fh = il4965_dump_fh, .set_channel_switch = il4965_hw_channel_switch, - .apm_ops = { - .init = il_apm_init, - .config = il4965_nic_config, - }, + .apm_init = il_apm_init, .send_tx_power = il4965_send_tx_power, .update_chain_flags = il4965_update_chain_flags, .eeprom_acquire_semaphore = il4965_eeprom_acquire_semaphore,
drivers/net/wireless/iwlegacy/4965.h +2 -0
@@ -60,6 +60,8 @@ int il4965_rx_init(struct il_priv *il, struct il_rx_queue *rxq);int il4965_hw_nic_init (struct il_priv *il);int il4965_dump_fh (struct il_priv *il,char **buf,bool display); +void il4965_nic_config (struct il_priv *il); +/* rx */ void il4965_rx_queue_restock (struct il_priv *il);void il4965_rx_replenish (struct il_priv *il);
drivers/net/wireless/iwlegacy/common.c +1 -1
@@ -730,7 +730,7 @@ il_eeprom_init(struct il_priv *il) } e = (__le16 *) il->eeprom; - il->ops->lib->apm_ops.init (il); + il->ops->lib->apm_init (il); ret =il_eeprom_verify_signature (il);if (ret <0 ) {
drivers/net/wireless/iwlegacy/common.h +2 -7
@@ -1566,11 +1566,6 @@ struct il_hcmd_utils_ops {void (*post_scan) (struct il_priv *il); }; -struct il_apm_ops { -int (*init) (struct il_priv *il); -void (*config) (struct il_priv *il); -}; - #ifdef CONFIG_IWLEGACY_DEBUGFS struct il_debugfs_ops { ssize_t(*rx_stats_read) (struct file *file, char __user *user_buf,
@@ -1605,9 +1600,9 @@ struct il_lib_ops {int (*set_channel_switch) (struct il_priv *il,struct ieee80211_channel_switch *ch_switch);/* power management */ -struct il_apm_ops apm_ops; +int (*apm_init) (struct il_priv *il); -/* power */ +/* tx power */ int (*send_tx_power) (struct il_priv *il);void (*update_chain_flags) (struct il_priv *il);
Signature · 1 line
1.7.1
PATCH 11/24 iwlegacy: merge il_lib_ops into il_ops
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945-mac.c | 8 +++--- drivers/net/wireless/iwlegacy/3945.c | 29 ++++++++++------------- drivers/net/wireless/iwlegacy/4965-calib.c | 4 +- drivers/net/wireless/iwlegacy/4965-mac.c | 23 +++++++++---------- drivers/net/wireless/iwlegacy/4965.c | 19 ++++++--------- drivers/net/wireless/iwlegacy/common.c | 34 ++++++++++++++-------------- drivers/net/wireless/iwlegacy/common.h | 31 +++++++++++-------------- drivers/net/wireless/iwlegacy/debug.c | 4 +- 8 files changed, 71 insertions(+), 81 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +4 -4
@@ -616,7 +616,7 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb)/* Add buffer containing Tx command and MAC(!) header to TFD's * first entry */ - il->ops->lib->txq_attach_buf_to_tfd (il, txq, txcmd_phys, len,1 ,0 ); + il->ops->txq_attach_buf_to_tfd (il, txq, txcmd_phys, len,1 ,0 );/* Set up TFD's 2nd entry to point directly to remainder of skb, * if any (802.11 null frames have no payload). */
@@ -625,8 +625,8 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) phys_addr =pci_map_single (il->pci_dev, skb->data + hdr_len, len,PCI_DMA_TODEVICE ); - il->ops->lib->txq_attach_buf_to_tfd (il, txq, phys_addr, len,0 , -U32_PAD (len)); + il->ops->txq_attach_buf_to_tfd (il, txq, phys_addr, len,0 , +U32_PAD (len)); }/* Tell device the write idx *just past* this latest filled TFD */
@@ -2413,7 +2413,7 @@ __il3945_up(struct il_priv *il)/* load bootstrap state machine, * load bootstrap program into processor's memory, * prepare to load the "initialize" uCode */ - rc = il->ops->lib->load_ucode (il); + rc = il->ops->load_ucode (il);if (rc) {IL_ERR ("Unable to set up bootstrap uCode: %d\n" , rc);
drivers/net/wireless/iwlegacy/3945.c +13 -16
@@ -303,7 +303,7 @@ il3945_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx) skb = txq->skbs[txq->q.read_ptr];ieee80211_tx_status_irqsafe (il->hw, skb); txq->skbs[txq->q.read_ptr] =NULL ; - il->ops->lib->txq_free_tfd (il, txq); + il->ops->txq_free_tfd (il, txq); } if (il_queue_space(q) > q->low_mark && txq_id >= 0 &&
@@ -1612,7 +1612,7 @@ il3945_hw_reg_comp_txpower_temp(struct il_priv *il) }/* send Txpower command for current channel to ucode */ -return il->ops->lib->send_tx_power (il); +return il->ops->send_tx_power (il); }int
@@ -2634,19 +2634,6 @@ static struct il_hcmd_ops il3945_hcmd = { .commit_rxon = il3945_commit_rxon, }; -static struct il_lib_ops il3945_lib = { - .txq_attach_buf_to_tfd = il3945_hw_txq_attach_buf_to_tfd, - .txq_free_tfd = il3945_hw_txq_free_tfd, - .txq_init = il3945_hw_tx_queue_init, - .load_ucode = il3945_load_bsm, - .dump_nic_error_log = il3945_dump_nic_error_log, - .apm_init = il3945_apm_init, - .send_tx_power = il3945_send_tx_power, - .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, - .eeprom_acquire_semaphore = il3945_eeprom_acquire_semaphore, - .eeprom_release_semaphore = il3945_eeprom_release_semaphore, -}; -static const struct il_legacy_ops il3945_legacy_ops = { .post_associate = il3945_post_associate, .config_ap = il3945_config_ap,
@@ -2661,7 +2648,17 @@ static struct il_hcmd_utils_ops il3945_hcmd_utils = { };const struct il_ops il3945_ops = { - .lib = &il3945_lib, + .txq_attach_buf_to_tfd = il3945_hw_txq_attach_buf_to_tfd, + .txq_free_tfd = il3945_hw_txq_free_tfd, + .txq_init = il3945_hw_tx_queue_init, + .load_ucode = il3945_load_bsm, + .dump_nic_error_log = il3945_dump_nic_error_log, + .apm_init = il3945_apm_init, + .send_tx_power = il3945_send_tx_power, + .is_valid_rtc_data_addr = il3945_hw_valid_rtc_data_addr, + .eeprom_acquire_semaphore = il3945_eeprom_acquire_semaphore, + .eeprom_release_semaphore = il3945_eeprom_release_semaphore, + .hcmd = &il3945_hcmd, .utils = &il3945_hcmd_utils, .led = &il3945_led_ops,
drivers/net/wireless/iwlegacy/4965-calib.c +2 -2
@@ -923,8 +923,8 @@ il4965_chain_noise_calibration(struct il_priv *il, void *stat_resp)/* Some power changes may have been made during the calibration. * Update and commit the RXON */ -if (il->ops->lib->update_chain_flags) - il->ops->lib->update_chain_flags (il); +if (il->ops->update_chain_flags) + il->ops->update_chain_flags (il); data->state =IL_CHAIN_NOISE_DONE ;il_power_update_mode (il, false);
drivers/net/wireless/iwlegacy/4965-mac.c +11 -12
@@ -1811,7 +1811,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)dma_unmap_len_set (out_meta, len, firstlen);/* Add buffer containing Tx command and MAC(!) header to TFD's * first entry */ - il->ops->lib->txq_attach_buf_to_tfd (il, txq, txcmd_phys, firstlen,1 ,0 ); + il->ops->txq_attach_buf_to_tfd (il, txq, txcmd_phys, firstlen,1 ,0 );if (!ieee80211_has_morefrags (hdr->frame_control)) { txq->need_update =1 ;
@@ -1827,8 +1827,8 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb) phys_addr =pci_map_single (il->pci_dev, skb->data + hdr_len, secondlen,PCI_DMA_TODEVICE ); - il->ops->lib->txq_attach_buf_to_tfd (il, txq, phys_addr, - secondlen,0 ,0 ); + il->ops->txq_attach_buf_to_tfd (il, txq, phys_addr, secondlen, +0 ,0 ); } scratch_phys =
@@ -1848,8 +1848,7 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)/* Set up entry for this TFD in Tx byte-count array */ if (info->flags &IEEE80211_TX_CTL_AMPDU ) - il->ops->lib->txq_update_byte_cnt_tbl (il, txq, -le16_to_cpu (tx_cmd->len)); + il->ops->txq_update_byte_cnt_tbl (il, txq,le16_to_cpu (tx_cmd->len));pci_dma_sync_single_for_device (il->pci_dev, txcmd_phys, firstlen,PCI_DMA_BIDIRECTIONAL );
@@ -2470,7 +2469,7 @@ il4965_tx_queue_reclaim(struct il_priv *il, int txq_id, int idx)il4965_tx_status (il, skb, txq_id >=IL4965_FIRST_AMPDU_QUEUE ); txq->skbs[txq->q.read_ptr] =NULL ; - il->ops->lib->txq_free_tfd (il, txq); + il->ops->txq_free_tfd (il, txq); }return nfreed; }
@@ -5072,7 +5071,7 @@ il4965_dump_nic_error_log(struct il_priv *il)else base =le32_to_cpu (il->card_alive.error_event_table_ptr); -if (!il->ops->lib->is_valid_rtc_data_addr (base)) { +if (!il->ops->is_valid_rtc_data_addr (base)) {IL_ERR ("Not valid error log pointer 0x%08X for %s uCode\n" , base, (il->ucode_type ==UCODE_INIT ) ?"Init" :"RT" );return ;
@@ -5574,7 +5573,7 @@ __il4965_up(struct il_priv *il)/* load bootstrap state machine, * load bootstrap program into processor's memory, * prepare to load the "initialize" uCode */ - ret = il->ops->lib->load_ucode (il); + ret = il->ops->load_ucode (il);if (ret) {IL_ERR ("Unable to set up bootstrap uCode: %d\n" , ret);
@@ -5615,7 +5614,7 @@ il4965_bg_init_alive_start(struct work_struct *data)if (test_bit (S_EXIT_PENDING , &il->status)) goto out; - il->ops->lib->init_alive_start (il); + il->ops->init_alive_start (il); out:mutex_unlock (&il->mutex); }
@@ -6047,7 +6046,7 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,if (!il_is_associated (il)) goto out; -if (!il->ops->lib->set_channel_switch) +if (!il->ops->set_channel_switch) goto out; ch = channel->hw_value;
@@ -6099,7 +6098,7 @@ il4965_mac_channel_switch(struct ieee80211_hw *hw,*/ set_bit (S_CHANNEL_SWITCH_PENDING , &il->status); il->switch_channel =cpu_to_le16 (ch); -if (il->ops->lib->set_channel_switch (il, ch_switch)) { +if (il->ops->set_channel_switch (il, ch_switch)) {clear_bit (S_CHANNEL_SWITCH_PENDING , &il->status); il->switch_channel =0 ;ieee80211_chswitch_done (il->vif, false);
@@ -6182,7 +6181,7 @@ il4965_bg_txpower_work(struct work_struct *work)/* Regardless of if we are associated, we must reconfigure the * TX power since frames can be sent on non-radar channels while * not associated */ - il->ops->lib->send_tx_power (il); + il->ops->send_tx_power (il);/* Update last_temperature to keep is_calib_needed from running * when it isn't needed... */
drivers/net/wireless/iwlegacy/4965.c +8 -11
@@ -1889,7 +1889,14 @@ static struct il_hcmd_utils_ops il4965_hcmd_utils = { .post_scan = il4965_post_scan, }; -static struct il_lib_ops il4965_lib = { +static const struct il_legacy_ops il4965_legacy_ops = { + .post_associate = il4965_post_associate, + .config_ap = il4965_config_ap, + .manage_ibss_station = il4965_manage_ibss_station, + .update_bcast_stations = il4965_update_bcast_stations, +}; + +const struct il_ops il4965_ops = { .txq_update_byte_cnt_tbl = il4965_txq_update_byte_cnt_tbl, .txq_attach_buf_to_tfd = il4965_hw_txq_attach_buf_to_tfd, .txq_free_tfd = il4965_hw_txq_free_tfd,
@@ -1905,17 +1912,7 @@ static struct il_lib_ops il4965_lib = { .update_chain_flags = il4965_update_chain_flags, .eeprom_acquire_semaphore = il4965_eeprom_acquire_semaphore, .eeprom_release_semaphore = il4965_eeprom_release_semaphore, -}; -static const struct il_legacy_ops il4965_legacy_ops = { - .post_associate = il4965_post_associate, - .config_ap = il4965_config_ap, - .manage_ibss_station = il4965_manage_ibss_station, - .update_bcast_stations = il4965_update_bcast_stations, -}; - -const struct il_ops il4965_ops = { - .lib = &il4965_lib, .hcmd = &il4965_hcmd, .utils = &il4965_hcmd_utils, .led = &il4965_led_ops,
drivers/net/wireless/iwlegacy/common.c +17 -17
@@ -730,7 +730,7 @@ il_eeprom_init(struct il_priv *il) } e = (__le16 *) il->eeprom; - il->ops->lib->apm_init (il); + il->ops->apm_init (il); ret =il_eeprom_verify_signature (il);if (ret <0 ) {
@@ -740,7 +740,7 @@ il_eeprom_init(struct il_priv *il) }/* Make sure driver (instead of uCode) is allowed to read EEPROM */ - ret = il->ops->lib->eeprom_acquire_semaphore (il); + ret = il->ops->eeprom_acquire_semaphore (il);if (ret <0 ) {IL_ERR ("Failed to acquire EEPROM semaphore.\n" ); ret = -ENOENT ;
@@ -772,7 +772,7 @@ il_eeprom_init(struct il_priv *il) ret =0 ; done: - il->ops->lib->eeprom_release_semaphore (il); + il->ops->eeprom_release_semaphore (il); err:if (ret)
@@ -1155,9 +1155,9 @@ il_power_set_mode(struct il_priv *il, struct il_powertable_cmd *cmd, bool force)if (!(cmd->flags &IL_POWER_DRIVER_ALLOW_SLEEP_MSK ))clear_bit (S_POWER_PMI , &il->status); -if (il->ops->lib->update_chain_flags && update_chains) - il->ops->lib->update_chain_flags (il); -else if (il->ops->lib->update_chain_flags) +if (il->ops->update_chain_flags && update_chains) + il->ops->update_chain_flags (il); +else if (il->ops->update_chain_flags)D_POWER ("Cannot update the power, chain noise " "calibration running: %d\n" , il->chain_noise_data.state);
@@ -2719,7 +2719,7 @@ il_tx_queue_unmap(struct il_priv *il, int txq_id)return ;while (q->write_ptr != q->read_ptr) { - il->ops->lib->txq_free_tfd (il, txq); + il->ops->txq_free_tfd (il, txq); q->read_ptr =il_queue_inc_wrap (q->read_ptr, q->n_bd); } }
@@ -3019,7 +3019,7 @@ il_tx_queue_init(struct il_priv *il, struct il_tx_queue *txq, int slots_num,il_queue_init (il, &txq->q,TFD_QUEUE_SIZE_MAX , slots_num, txq_id);/* Tell device where to find queue */ - il->ops->lib->txq_init (il, txq); + il->ops->txq_init (il, txq);return 0 ; err:
@@ -3050,7 +3050,7 @@ il_tx_queue_reset(struct il_priv *il, struct il_tx_queue *txq, int slots_num,il_queue_init (il, &txq->q,TFD_QUEUE_SIZE_MAX , slots_num, txq_id);/* Tell device where to find queue */ - il->ops->lib->txq_init (il, txq); + il->ops->txq_init (il, txq); }EXPORT_SYMBOL (il_tx_queue_reset);
@@ -3157,9 +3157,9 @@ il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)#endif txq->need_update =1 ; -if (il->ops->lib->txq_update_byte_cnt_tbl) +if (il->ops->txq_update_byte_cnt_tbl)/* Set up entry in queue's byte count circular buffer */ - il->ops->lib->txq_update_byte_cnt_tbl (il, txq,0 ); + il->ops->txq_update_byte_cnt_tbl (il, txq,0 ); phys_addr = pci_map_single(il->pci_dev, &out_cmd->hdr, fix_size,
@@ -3167,7 +3167,7 @@ il_enqueue_hcmd(struct il_priv *il, struct il_host_cmd *cmd)dma_unmap_addr_set (out_meta, mapping, phys_addr);dma_unmap_len_set (out_meta, len, fix_size); - il->ops->lib->txq_attach_buf_to_tfd (il, txq, phys_addr, fix_size,1 , + il->ops->txq_attach_buf_to_tfd (il, txq, phys_addr, fix_size,1 ,U32_PAD (cmd->len));/* Increment and update queue's write idx */
@@ -4101,9 +4101,9 @@ il_irq_handle_error(struct il_priv *il)IL_ERR ("Loaded firmware version: %s\n" , il->hw->wiphy->fw_version); - il->ops->lib->dump_nic_error_log (il); -if (il->ops->lib->dump_fh) - il->ops->lib->dump_fh (il,NULL , false); + il->ops->dump_nic_error_log (il); +if (il->ops->dump_fh) + il->ops->dump_fh (il,NULL , false);#ifdef CONFIG_IWLEGACY_DEBUG if (il_get_debug_level (il) &IL_DL_FW_ERRORS )il_print_rx_config_cmd (il);
@@ -4290,7 +4290,7 @@ il_set_tx_power(struct il_priv *il, s8 tx_power, bool force)if (il->tx_power_user_lmt == tx_power && !force)return 0 ; -if (!il->ops->lib->send_tx_power) +if (!il->ops->send_tx_power)return -EOPNOTSUPP ;/* 0 dBm mean 1 milliwatt */
@@ -4323,7 +4323,7 @@ il_set_tx_power(struct il_priv *il, s8 tx_power, bool force) prev_tx_power = il->tx_power_user_lmt; il->tx_power_user_lmt = tx_power; - ret = il->ops->lib->send_tx_power (il); + ret = il->ops->send_tx_power (il);/* if fail to set tx_power, restore the orig. tx power */ if (ret) {
drivers/net/wireless/iwlegacy/common.h +14 -17
@@ -1578,7 +1578,20 @@ struct il_debugfs_ops { };#endif -struct il_lib_ops { +struct il_led_ops { +int (*cmd) (struct il_priv *il,struct il_led_cmd *led_cmd); +}; + +struct il_legacy_ops { +void (*post_associate) (struct il_priv *il); +void (*config_ap) (struct il_priv *il); +/* station management */ +int (*update_bcast_stations) (struct il_priv *il); +int (*manage_ibss_station) (struct il_priv *il, +struct ieee80211_vif *vif,bool add); +}; + +struct il_ops {/* Handling TX */ void (*txq_update_byte_cnt_tbl) (struct il_priv *il, struct il_tx_queue *txq,
@@ -1609,23 +1622,7 @@ struct il_lib_ops {/* eeprom operations */ int (*eeprom_acquire_semaphore) (struct il_priv *il);void (*eeprom_release_semaphore) (struct il_priv *il); -}; -struct il_led_ops { -int (*cmd) (struct il_priv *il,struct il_led_cmd *led_cmd); -}; - -struct il_legacy_ops { -void (*post_associate) (struct il_priv *il); -void (*config_ap) (struct il_priv *il); -/* station management */ -int (*update_bcast_stations) (struct il_priv *il); -int (*manage_ibss_station) (struct il_priv *il, -struct ieee80211_vif *vif,bool add); -}; - -struct il_ops { -const struct il_lib_ops *lib;const struct il_hcmd_ops *hcmd;const struct il_hcmd_utils_ops *utils;const struct il_led_ops *led;
drivers/net/wireless/iwlegacy/debug.c +2 -2
@@ -1178,8 +1178,8 @@ il_dbgfs_fh_reg_read(struct file *file, char __user *user_buf, size_t count,int pos =0 ;ssize_t ret = -EFAULT ; -if (il->ops->lib->dump_fh) { - ret = pos = il->ops->lib->dump_fh (il, &buf, true); +if (il->ops->dump_fh) { + ret = pos = il->ops->dump_fh (il, &buf, true);if (buf) { ret = simple_read_from_buffer(user_buf, count, ppos, buf,
Signature · 1 line
1.7.1
PATCH 12/24 iwlegacy: merge all ops structures into one
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945.c | 39 +++++++--------------- drivers/net/wireless/iwlegacy/4965-mac.c | 17 ++++----- drivers/net/wireless/iwlegacy/4965.c | 51 +++++++++++------------------ drivers/net/wireless/iwlegacy/common.c | 50 +++++++++++------------------ drivers/net/wireless/iwlegacy/common.h | 52 +++++++++++------------------- 5 files changed, 78 insertions(+), 131 deletions(-)
drivers/net/wireless/iwlegacy/3945.c +13 -26
@@ -57,10 +57,6 @@ il3945_send_led_cmd(struct il_priv *il, struct il_led_cmd *led_cmd)return il_send_cmd (il, &cmd); } -const struct il_led_ops il3945_led_ops = { - .cmd = il3945_send_led_cmd, -}; -#define IL_DECLARE_RATE_INFO (r, ip, in, rp, rn, pp, np) \ [RATE_##r##M_IDX] = { RATE_##r##M_PLCP, \ RATE_##r##M_IEEE, \
@@ -2629,24 +2625,6 @@ il3945_load_bsm(struct il_priv *il)return 0 ; } -static struct il_hcmd_ops il3945_hcmd = { - .rxon_assoc = il3945_send_rxon_assoc, - .commit_rxon = il3945_commit_rxon, -}; - -static const struct il_legacy_ops il3945_legacy_ops = { - .post_associate = il3945_post_associate, - .config_ap = il3945_config_ap, - .manage_ibss_station = il3945_manage_ibss_station, -}; - -static struct il_hcmd_utils_ops il3945_hcmd_utils = { - .get_hcmd_size = il3945_get_hcmd_size, - .build_addsta_hcmd = il3945_build_addsta_hcmd, - .request_scan = il3945_request_scan, - .post_scan = il3945_post_scan, -}; -const struct il_ops il3945_ops = { .txq_attach_buf_to_tfd = il3945_hw_txq_attach_buf_to_tfd, .txq_free_tfd = il3945_hw_txq_free_tfd,
@@ -2659,10 +2637,19 @@ const struct il_ops il3945_ops = { .eeprom_acquire_semaphore = il3945_eeprom_acquire_semaphore, .eeprom_release_semaphore = il3945_eeprom_release_semaphore, - .hcmd = &il3945_hcmd, - .utils = &il3945_hcmd_utils, - .led = &il3945_led_ops, - .legacy = &il3945_legacy_ops, + .rxon_assoc = il3945_send_rxon_assoc, + .commit_rxon = il3945_commit_rxon, + + .get_hcmd_size = il3945_get_hcmd_size, + .build_addsta_hcmd = il3945_build_addsta_hcmd, + .request_scan = il3945_request_scan, + .post_scan = il3945_post_scan, + + .post_associate = il3945_post_associate, + .config_ap = il3945_config_ap, + .manage_ibss_station = il3945_manage_ibss_station, + + .send_led_cmd = il3945_send_led_cmd, };static struct il_cfg il3945_bg_cfg = {
drivers/net/wireless/iwlegacy/4965-mac.c +8 -9
@@ -3649,8 +3649,8 @@ il4965_sta_modify_sleep_tx_count(struct il_priv *il, int sta_id, int cnt)void il4965_update_chain_flags (struct il_priv *il) { -if (il->ops->hcmd->set_rxon_chain) { - il->ops->hcmd->set_rxon_chain (il); +if (il->ops->set_rxon_chain) { + il->ops->set_rxon_chain (il);if (il->active.rx_chain != il->staging.rx_chain)il_commit_rxon (il); }
@@ -4399,9 +4399,8 @@ il4965_irq_tasklet(struct il_priv *il)/* HW RF KILL switch toggled */ if (inta &CSR_INT_BIT_RF_KILL ) {int hw_rf_kill =0 ; -if (! - (_il_rd (il,CSR_GP_CNTRL ) & -CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW )) + +if (!(_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW )) hw_rf_kill =1 ; IL_WARN("RF_KILL bit toggled to %s.\n",
@@ -5300,8 +5299,8 @@ il4965_alive_start(struct il_priv *il)/* Initialize our rx_config data */ il_connection_init_rx_config (il); -if (il->ops->hcmd->set_rxon_chain) - il->ops->hcmd->set_rxon_chain (il); +if (il->ops->set_rxon_chain) + il->ops->set_rxon_chain (il); }/* Configure bluetooth coexistence if enabled */
@@ -6333,8 +6332,8 @@ il4965_init_drv(struct il_priv *il) il->force_reset.reset_duration =IL_DELAY_NEXT_FORCE_FW_RELOAD ;/* Choose which receivers/antennas to use */ -if (il->ops->hcmd->set_rxon_chain) - il->ops->hcmd->set_rxon_chain (il); +if (il->ops->set_rxon_chain) + il->ops->set_rxon_chain (il);il_init_scan_params (il);
drivers/net/wireless/iwlegacy/4965.c +19 -32
87 lines not on this page · raw message
drivers/net/wireless/iwlegacy/common.c +19 -31
158 lines not on this page · raw message
drivers/net/wireless/iwlegacy/common.h +19 -33
81 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 13/24 iwlegacy: get rid of tx/rx traffic log
In reply to Stanislaw GruszkaThe same data can be gathered using monitor mode.
--- drivers/net/wireless/iwlegacy/3945-mac.c | 12 +-- drivers/net/wireless/iwlegacy/3945.c | 2 - drivers/net/wireless/iwlegacy/4965-mac.c | 13 +-- drivers/net/wireless/iwlegacy/common.c | 247 ------------------------------ drivers/net/wireless/iwlegacy/common.h | 51 +------ drivers/net/wireless/iwlegacy/debug.c | 243 ++++++++++++++++------------- 6 files changed, 145 insertions(+), 423 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +2 -10
@@ -573,7 +573,6 @@ il3945_tx_skb(struct il_priv *il, struct sk_buff *skb) len = (u16 ) skb->len; tx_cmd->len =cpu_to_le16 (len); -il_dbg_log_tx_data_frame (il, len, hdr);il_update_stats (il, true, fc, len); tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_A_MSK ; tx_cmd->tx_flags &= ~TX_CMD_FLG_ANT_B_MSK ;
@@ -3098,11 +3097,9 @@ il3945_store_debug_level(struct device *d, struct device_attribute *attr, ret =strict_strtoul (buf,0 , &val);if (ret)IL_INFO ("%s is not in hex or decimal form.\n" , buf); -else { +else il->debug_level = val; -if (il_alloc_traffic_mem (il)) -IL_ERR ("Not enough memory to generate traffic log\n" ); - } +return strnlen (buf, count); }
@@ -3625,9 +3622,6 @@ il3945_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) il->pci_dev = pdev; il->inta_mask =CSR_INI_SET_MASK ; -if (il_alloc_traffic_mem (il)) -IL_ERR ("Not enough memory to generate traffic log\n" ); -/*************************** * 2. Initializing PCI bus * *************************/
@@ -3790,7 +3784,6 @@ out_pci_disable_device:pci_set_drvdata (pdev,NULL );pci_disable_device (pdev); out_ieee80211_free_hw: -il_free_traffic_mem (il);ieee80211_free_hw (il->hw); out:return err;
@@ -3858,7 +3851,6 @@ il3945_pci_remove(struct pci_dev *pdev)* until now... */ destroy_workqueue (il->workqueue); il->workqueue =NULL ; -il_free_traffic_mem (il);free_irq (pdev->irq, il);pci_disable_msi (pdev);
drivers/net/wireless/iwlegacy/3945.c +0 -2
@@ -573,8 +573,6 @@ il3945_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb) network_packet ?'*' :' ' ,le16_to_cpu (rx_hdr->channel), rx_status.signal, rx_status.signal, rx_status.rate_idx); -il_dbg_log_rx_data_frame (il,le16_to_cpu (rx_hdr->len), header); -if (network_packet) { il->_3945.last_beacon_time =le32_to_cpu (rx_end->beacon_timestamp);
drivers/net/wireless/iwlegacy/4965-mac.c +2 -11
@@ -688,7 +688,6 @@ il4965_hdl_rx(struct il_priv *il, struct il_rx_buf *rxb)/* Find max signal strength (dBm) among 3 antenna/receiver chains */ rx_status.signal =il4965_calc_rssi (il, phy_res); -il_dbg_log_rx_data_frame (il, len, header);D_STATS ("Rssi %d, TSF %llu\n" , rx_status.signal, (unsigned long long )rx_status.mactime);
@@ -1781,7 +1780,6 @@ il4965_tx_skb(struct il_priv *il, struct sk_buff *skb)/* TODO need this for burst mode later on */ il4965_tx_cmd_build_basic (il, skb, tx_cmd, info, hdr, sta_id); -il_dbg_log_tx_data_frame (il, len, hdr);il4965_tx_cmd_build_rate (il, tx_cmd, info, fc);
@@ -4541,11 +4539,9 @@ il4965_store_debug_level(struct device *d, struct device_attribute *attr, ret =strict_strtoul (buf,0 , &val);if (ret)IL_ERR ("%s is not in hex or decimal form.\n" , buf); -else { +else il->debug_level = val; -if (il_alloc_traffic_mem (il)) -IL_ERR ("Not enough memory to generate traffic log\n" ); - } +return strnlen (buf, count); }
@@ -6483,9 +6479,6 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) il->pci_dev = pdev; il->inta_mask =CSR_INI_SET_MASK ; -if (il_alloc_traffic_mem (il)) -IL_ERR ("Not enough memory to generate traffic log\n" ); -/************************** * 2. Initializing PCI bus **************************/
@@ -6663,7 +6656,6 @@ out_pci_release_regions: out_pci_disable_device:pci_disable_device (pdev); out_ieee80211_free_hw: -il_free_traffic_mem (il);ieee80211_free_hw (il->hw); out:return err;
@@ -6734,7 +6726,6 @@ il4965_pci_remove(struct pci_dev *pdev)* until now... */ destroy_workqueue (il->workqueue); il->workqueue =NULL ; -il_free_traffic_mem (il);free_irq (il->pci_dev->irq, il);pci_disable_msi (il->pci_dev);
drivers/net/wireless/iwlegacy/common.c +0 -247
253 lines not on this page · raw message
drivers/net/wireless/iwlegacy/common.h +6 -45
76 lines not on this page · raw message
drivers/net/wireless/iwlegacy/debug.c +135 -108
273 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 14/24 iwlegacy: improve mac operation debuggability a bit
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945-mac.c | 16 +++-- drivers/net/wireless/iwlegacy/common.c | 89 +++++++++++++++--------------- 2 files changed, 53 insertions(+), 52 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +9 -7
@@ -2781,10 +2781,9 @@ il3945_mac_start(struct ieee80211_hw *hw)struct il_priv *il = hw->priv;int ret; -D_MAC80211 ("enter\n" ); -/* we should be verifying the device is ready to be opened */ mutex_lock (&il->mutex); +D_MAC80211 ("enter\n" );/* fetch ucode file from disk, alloc and copy to bus-master buffers ... * ucode filename and max sizes are card-specific. */
@@ -2940,15 +2939,19 @@ il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,* hardware will then not attempt to decrypt the frames. */ if (vif->type ==NL80211_IFTYPE_ADHOC && - !(key->flags &IEEE80211_KEY_FLAG_PAIRWISE )) + !(key->flags &IEEE80211_KEY_FLAG_PAIRWISE )) { +D_MAC80211 ("leave - IBSS RSN\n" );return -EOPNOTSUPP ; + } static_key = !il_is_associated (il);if (!static_key) { sta_id =il_sta_id_or_broadcast (il, sta); -if (sta_id ==IL_INVALID_STATION ) +if (sta_id ==IL_INVALID_STATION ) { +D_MAC80211 ("leave - station not found\n" );return -EINVAL ; + } }mutex_lock (&il->mutex);
@@ -2973,8 +2976,8 @@ il3945_mac_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, ret = -EINVAL ; } +D_MAC80211 ("leave ret %d\n" , ret);mutex_unlock (&il->mutex); -D_MAC80211 ("leave\n" );return ret; }
@@ -2989,9 +2992,8 @@ il3945_mac_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif,bool is_ap = vif->type ==NL80211_IFTYPE_STATION ;u8 sta_id; -D_INFO ("received request to add station %pM\n" , sta->addr);mutex_lock (&il->mutex); -D_INFO ("proceeding to add station %pM\n" , sta->addr); +D_INFO ("station %pM\n" , sta->addr); sta_priv->common.sta_id =IL_INVALID_STATION ; ret =il_add_station_common (il, sta->addr, is_ap, sta, &sta_id);
drivers/net/wireless/iwlegacy/common.c +44 -45
241 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH 15/24 iwleagcy: remove old comments
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/common.h | 16 ---------------- 1 files changed, 0 insertions(+), 16 deletions(-)
drivers/net/wireless/iwlegacy/common.h +0 -16
@@ -1626,22 +1626,6 @@ struct il_mod_params {int restart_fw;/* def: 1 = restart firmware */ }; -/* -* @led_compensation: compensate on the led on/off time per HW according -* to the deviation to achieve the desired led frequency. -* The detail algorithm is described in common.c -* @chain_noise_num_beacons: number of beacons used to compute chain noise -* @wd_timeout: TX queues watchdog timeout -* @temperature_kelvin: temperature report by uCode in kelvin -* @ucode_tracing: support ucode continuous tracing -* @sensitivity_calib_by_driver: driver has the capability to perform -* sensitivity calibration operation -* @chain_noise_calib_by_driver: driver has the capability to perform -* chain noise calibration operation -*/ -struct il_base_params { -}; -#define IL_LED_SOLID 11#define IL_DEF_LED_INTRVL cpu_to_le32(1000)
Signature · 1 line
1.7.1
PATCH 16/24 iwleagcy: fix ident code damage
In reply to Stanislaw GruszkaUsing ident is not always good.
--- drivers/net/wireless/iwlegacy/3945-mac.c | 18 +++++------------- drivers/net/wireless/iwlegacy/4965-mac.c | 18 +++++------------- 2 files changed, 10 insertions(+), 26 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +5 -13
@@ -2272,12 +2272,8 @@ __il3945_down(struct il_priv *il)* clear all bits but the RF Kill bits and return */ if (!il_is_init (il)) { il->status = -test_bit (S_RF_KILL_HW , - &il-> - status) <<S_RF_KILL_HW | -test_bit (S_GEO_CONFIGURED , - &il-> - status) <<S_GEO_CONFIGURED | +test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ; goto exit; }
@@ -2285,13 +2281,9 @@ __il3945_down(struct il_priv *il)/* ...otherwise clear out all the status bits but the RF Kill * bit and continue taking the NIC down. */ il->status &= -test_bit (S_RF_KILL_HW , - &il->status) <<S_RF_KILL_HW |test_bit (S_GEO_CONFIGURED , - &il-> - status) << -S_GEO_CONFIGURED |test_bit (S_FW_ERROR , - &il-> - status) <<S_FW_ERROR | +test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED | +test_bit (S_FW_ERROR , &il->status) <<S_FW_ERROR |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ;il3945_hw_txq_ctx_stop (il);
drivers/net/wireless/iwlegacy/4965-mac.c +5 -13
@@ -5384,12 +5384,8 @@ __il4965_down(struct il_priv *il)* clear all bits but the RF Kill bit and return */ if (!il_is_init (il)) { il->status = -test_bit (S_RF_KILL_HW , - &il-> - status) <<S_RF_KILL_HW | -test_bit (S_GEO_CONFIGURED , - &il-> - status) <<S_GEO_CONFIGURED | +test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ; goto exit; }
@@ -5397,13 +5393,9 @@ __il4965_down(struct il_priv *il)/* ...otherwise clear out all the status bits but the RF Kill * bit and continue taking the NIC down. */ il->status &= -test_bit (S_RF_KILL_HW , - &il->status) <<S_RF_KILL_HW |test_bit (S_GEO_CONFIGURED , - &il-> - status) << -S_GEO_CONFIGURED |test_bit (S_FW_ERROR , - &il-> - status) <<S_FW_ERROR | +test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED | +test_bit (S_FW_ERROR , &il->status) <<S_FW_ERROR |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ;il4965_txq_ctx_stop (il);
Signature · 1 line
1.7.1
PATCH 17/24 iwlegacy: do not grab nic access if rfkill
In reply to Stanislaw GruszkaIf rfkill is on il_grab_nic_access() fail and we can not write to the various registers during stop procedure. Write to those registers unconditionally instead.
--- drivers/net/wireless/iwlegacy/3945-mac.c | 17 +++++-- drivers/net/wireless/iwlegacy/3945.c | 29 ++++++----- drivers/net/wireless/iwlegacy/4965-mac.c | 81 ++++++++++++++++++------------ drivers/net/wireless/iwlegacy/common.c | 25 +++++++-- drivers/net/wireless/iwlegacy/common.h | 4 +- 5 files changed, 98 insertions(+), 58 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +13 -4
@@ -2286,16 +2286,25 @@ __il3945_down(struct il_priv *il)test_bit (S_FW_ERROR , &il->status) <<S_FW_ERROR |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ; +/* +* We disabled and synchronized interrupt, and priv->mutex is taken, so +* here is the only thread which will program device registers, but +* still have lockdep assertions, so we are taking reg_lock. +*/ +spin_lock_irq (&il->reg_lock); +/* FIXME: il_grab_nic_access if rfkill is off ? */ +il3945_hw_txq_ctx_stop (il);il3945_hw_rxq_stop (il); -/* Power-down device's busmaster DMA clocks */ -il_wr_prph (il,APMG_CLK_DIS_REG ,APMG_CLK_VAL_DMA_CLK_RQT ); +_il_wr_prph (il,APMG_CLK_DIS_REG ,APMG_CLK_VAL_DMA_CLK_RQT );udelay (5 ); -/* Stop the device, and put it in low power state */ -il_apm_stop (il); +_il_apm_stop (il); +spin_unlock_irq (&il->reg_lock); + +il3945_hw_txq_ctx_free (il); exit:memset (&il->card_alive,0 ,sizeof (struct il_alive_resp ));
drivers/net/wireless/iwlegacy/3945.c +14 -13
@@ -1016,18 +1016,17 @@ il3945_hw_txq_ctx_stop(struct il_priv *il)int txq_id;/* stop SCD */ -il_wr_prph (il,ALM_SCD_MODE_REG ,0 ); -il_wr_prph (il,ALM_SCD_TXFACT_REG ,0 ); +_il_wr_prph (il,ALM_SCD_MODE_REG ,0 ); +_il_wr_prph (il,ALM_SCD_TXFACT_REG ,0 );/* reset TFD queues */ for (txq_id =0 ; txq_id < il->hw_params.max_txq_num; txq_id++) { -il_wr (il,FH39_TCSR_CONFIG (txq_id),0x0 ); -il_poll_bit (il,FH39_TSSR_TX_STATUS , -FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE (txq_id), -1000 ); +_il_wr (il,FH39_TCSR_CONFIG (txq_id),0x0 ); +_il_poll_bit (il,FH39_TSSR_TX_STATUS , +FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE (txq_id), +FH39_TSSR_TX_STATUS_REG_MSK_CHNL_IDLE (txq_id), +1000 ); } - -il3945_hw_txq_ctx_free (il); }/**
@@ -2176,12 +2175,14 @@ il3945_txpower_set_from_eeprom(struct il_priv *il)int il3945_hw_rxq_stop (struct il_priv *il) { -int rc; +int ret; -il_wr (il,FH39_RCSR_CONFIG (0 ),0 ); - rc =il_poll_bit (il,FH39_RSSR_STATUS , -FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE ,1000 ); -if (rc <0 ) +_il_wr (il,FH39_RCSR_CONFIG (0 ),0 ); + ret =_il_poll_bit (il,FH39_RSSR_STATUS , +FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE , +FH39_RSSR_CHNL0_RX_STATUS_CHNL_IDLE , +1000 ); +if (ret <0 )IL_ERR ("Can't stop Rx DMA.\n" );return 0 ;
drivers/net/wireless/iwlegacy/4965-mac.c +48 -33
115 lines not on this page · raw message
drivers/net/wireless/iwlegacy/common.c +19 -6
@@ -4126,12 +4126,12 @@ il_irq_handle_error(struct il_priv *il)EXPORT_SYMBOL (il_irq_handle_error);static int -il_apm_stop_master (struct il_priv *il) +_il_apm_stop_master (struct il_priv *il) {int ret =0 ;/* stop device's busmaster DMA activity */ -il_set_bit (il,CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); +_il_set_bit (il,CSR_RESET ,CSR_RESET_REG_FLAG_STOP_MASTER ); ret = _il_poll_bit(il, CSR_RESET, CSR_RESET_REG_FLAG_MASTER_DISABLED,
@@ -4145,15 +4145,17 @@ il_apm_stop_master(struct il_priv *il) }void -il_apm_stop (struct il_priv *il) +_il_apm_stop (struct il_priv *il) { +lockdep_assert_held (&il->reg_lock); +D_INFO ("Stop card, put in low power state\n" );/* Stop device's DMA activity */ -il_apm_stop_master (il); +_il_apm_stop_master (il);/* Reset the entire device */ -il_set_bit (il,CSR_RESET ,CSR_RESET_REG_FLAG_SW_RESET ); +_il_set_bit (il,CSR_RESET ,CSR_RESET_REG_FLAG_SW_RESET );udelay (10 );
@@ -4161,7 +4163,18 @@ il_apm_stop(struct il_priv *il)* Clear "initialization complete" bit to move adapter from * D0A* (powered-up Active) --> D0U* (Uninitialized) state. */ -il_clear_bit (il,CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); +_il_clear_bit (il,CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_INIT_DONE ); +} +EXPORT_SYMBOL (_il_apm_stop); + +void +il_apm_stop (struct il_priv *il) +{ +unsigned long flags; + +spin_lock_irqsave (&il->reg_lock, flags); +_il_apm_stop (il); +spin_unlock_irqrestore (&il->reg_lock, flags); }EXPORT_SYMBOL (il_apm_stop);
drivers/net/wireless/iwlegacy/common.h +3 -1
@@ -1976,7 +1976,9 @@ il_is_ready_rf(struct il_priv *il)extern void il_send_bt_config (struct il_priv *il);extern int il_send_stats_request (struct il_priv *il,u8 flags,bool clear); -void il_apm_stop (struct il_priv *il); +extern void il_apm_stop (struct il_priv *il); +extern void _il_apm_stop (struct il_priv *il); +int il_apm_init (struct il_priv *il);int il_send_rxon_timing (struct il_priv *il);
Signature · 1 line
1.7.1
PATCH 18/24 iwlegacy: check correct il_poll_bit error value
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/common.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/net/wireless/iwlegacy/common.c +1 -1
@@ -4136,7 +4136,7 @@ _il_apm_stop_master(struct il_priv *il) ret =_il_poll_bit (il,CSR_RESET ,CSR_RESET_REG_FLAG_MASTER_DISABLED ,CSR_RESET_REG_FLAG_MASTER_DISABLED ,100 ); -if (ret) +if (ret <0 )IL_WARN ("Master Disable Timed Out, 100 usec\n" );D_INFO ("stop master\n" );
Signature · 1 line
1.7.1
PATCH 19/24 iwlegacy: small il4965_set_hw_ready cleanup
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/4965-mac.c | 35 ++++++++++++------------------ 1 files changed, 14 insertions(+), 21 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +14 -21
@@ -5446,40 +5446,36 @@ il4965_down(struct il_priv *il)il4965_cancel_deferred_work (il); } -#define HW_READY_TIMEOUT (50) -static int +static void il4965_set_hw_ready (struct il_priv *il) { -int ret =0 ; +int ret;il_set_bit (il,CSR_HW_IF_CONFIG_REG ,CSR_HW_IF_CONFIG_REG_BIT_NIC_READY );/* See if we got it */ - ret = -_il_poll_bit (il,CSR_HW_IF_CONFIG_REG , -CSR_HW_IF_CONFIG_REG_BIT_NIC_READY , -CSR_HW_IF_CONFIG_REG_BIT_NIC_READY ,HW_READY_TIMEOUT ); -if (ret != -ETIMEDOUT ) + ret =_il_poll_bit (il,CSR_HW_IF_CONFIG_REG , +CSR_HW_IF_CONFIG_REG_BIT_NIC_READY , +CSR_HW_IF_CONFIG_REG_BIT_NIC_READY , +100 ); +if (ret >=0 ) il->hw_ready = true; -else - il->hw_ready = false; -D_INFO ("hardware %s\n" , (il->hw_ready ==1 ) ?"ready" :"not ready" ); -return ret; +D_INFO ("hardware %s ready\n" , (il->hw_ready) ?"" :"not" ); } -static int +static void il4965_prepare_card_hw (struct il_priv *il) { -int ret =0 ; +int ret; -D_INFO ("il4965_prepare_card_hw enter\n" ); + il->hw_ready = false; - ret =il4965_set_hw_ready (il); +il4965_set_hw_ready (il);if (il->hw_ready) -return ret; +return ;/* If HW is not ready, prepare the conditions to check again */ il_set_bit (il,CSR_HW_IF_CONFIG_REG ,CSR_HW_IF_CONFIG_REG_PREPARE );
@@ -5492,8 +5488,6 @@ il4965_prepare_card_hw(struct il_priv *il)/* HW should be ready by now, check again. */ if (ret != -ETIMEDOUT )il4965_set_hw_ready (il); - -return ret; }#define MAX_HW_RESTARTS 5
@@ -5521,9 +5515,8 @@ __il4965_up(struct il_priv *il) }il4965_prepare_card_hw (il); -if (!il->hw_ready) { -IL_WARN ("Exit HW not ready\n" ); +IL_ERR ("HW not ready\n" );return -EIO ; }
Signature · 1 line
1.7.1
PATCH 20/24 iwlegacy: only enable rfkill interrupt during UP
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/4965-mac.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +2 -4
@@ -5523,13 +5523,11 @@ __il4965_up(struct il_priv *il)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW )clear_bit (S_RF_KILL_HW , &il->status); -else +else {set_bit (S_RF_KILL_HW , &il->status); - -if (il_is_rfkill (il)) {wiphy_rfkill_set_hw_state (il->hw->wiphy, true); -il_enable_interrupts (il); +il_enable_rfkill_int (il);IL_WARN ("Radio disabled by HW RF Kill switch\n" );return 0 ; }
Signature · 1 line
1.7.1
Re: [PATCH 20/24] iwlegacy: only enable rfkill interrupt during UP
Quoted 4 lines · Stanislaw Gruszka
Signed-off-by Stanislaw Gruszka <[email protected]>--- drivers/net/wireless/iwlegacy/4965-mac.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
By UP here I'll assume IFF_UP; did the previous code enable the interrupt while the interface was down too? The problem we have here is that if there's no platform rfkill switch, but only the iwlwifi one, then we don't get notifications of rfkill changes, which breaks showing in the UI when you can and cannot use the card.
There are various complexities with rfkill here; for example I think for 3945 it used to be that you couldn't UP the interface when it was rfkilled, so when it was killed (and thus down) you couldn't get notifications of rfkill change at all, and thus you wouldn't know if you could start using it again, except to poll (which sucks).
Dan
Quoted 20 lines
drivers/net/wireless/iwlegacy/4965-mac.c +2
-4@@ -5523,13 +5523,11 @@ __il4965_up(struct il_priv *il)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW )clear_bit (S_RF_KILL_HW , &il->status); -else +else {set_bit (S_RF_KILL_HW , &il->status); - -if (il_is_rfkill (il)) {wiphy_rfkill_set_hw_state (il->hw->wiphy, true); -il_enable_interrupts (il); +il_enable_rfkill_int (il);IL_WARN ("Radio disabled by HW RF Kill switch\n" );return 0 ; }
Re: [PATCH 20/24] iwlegacy: only enable rfkill interrupt during UP
Quoted 8 lines · Dan Williams
Quoted 4 lines · Stanislaw Gruszka
Signed-off-by Stanislaw Gruszka <[email protected]>--- drivers/net/wireless/iwlegacy/4965-mac.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)By UP here I'll assume
IFF_UP; did the previous code enable the interrupt while the interface was down too?
Yes, we do the same thing during IFF_DOWN and IFF_UP, we enable rfkill interrupt and mask all other interrupts, when rfkill switch is on.
Quoted 4 lines
The problem we have here is
that if there's no platform rfkill switch, but only the iwlwifi one, then we don't get notifications of rfkill changes, which breaks showing in the UI when you can and cannot use the card.
This change will not broke that.
I just realize that description is wrong, and probably that make the confusion here. It should be "enable only rfkill interrupt when rfkill switch is on during IFF_UP".
Deja vu
http://comments.gmane.org/gmane.linux.kernel.wireless.general/61915
Some people will never learn some things ...
Quoted 5 lines
There are various complexities with rfkill here; for example I think for 3945 it used to be that you couldn't UP the interface when it was rfkilled, so when it was killed (and thus down) you couldn't get notifications of rfkill change at all, and thus you wouldn't know if you could start using it again, except to poll (which sucks).
Anyway I tested this patches on two laptops with 3945 and 4965, rfkill worked there as expected.
I'll repost patch with correct topic
Stanislaw
Quoted 25 lines
Dan
Quoted 20 lines
drivers/net/wireless/iwlegacy/4965-mac.c +2
-4@@ -5523,13 +5523,11 @@ __il4965_up(struct il_priv *il)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW )clear_bit (S_RF_KILL_HW , &il->status); -else +else {set_bit (S_RF_KILL_HW , &il->status); - -if (il_is_rfkill (il)) {wiphy_rfkill_set_hw_state (il->hw->wiphy, true); -il_enable_interrupts (il); +il_enable_rfkill_int (il);IL_WARN ("Radio disabled by HW RF Kill switch\n" );return 0 ; }
PATCH v2 20/24 iwlegacy: enable only rfkill interrupt when rfkill switch is on during IFF_UP
In reply to Stanislaw Gruszka---
v1 -> v2: make description less confusing
drivers/net/wireless/iwlegacy/4965-mac.c | 6 ++---- 1 files changed, 2 insertions(+), 4 deletions(-)
drivers/net/wireless/iwlegacy/4965-mac.c +2 -4
@@ -5523,13 +5523,11 @@ __il4965_up(struct il_priv *il)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW )clear_bit (S_RF_KILL_HW , &il->status); -else +else {set_bit (S_RF_KILL_HW , &il->status); - -if (il_is_rfkill (il)) {wiphy_rfkill_set_hw_state (il->hw->wiphy, true); -il_enable_interrupts (il); +il_enable_rfkill_int (il);IL_WARN ("Radio disabled by HW RF Kill switch\n" );return 0 ; }
Signature · 1 line
1.7.1
PATCH 21/24 iwlegacy: small queue initializations cleanup
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945.c | 9 +--- drivers/net/wireless/iwlegacy/4965-mac.c | 18 ++------ drivers/net/wireless/iwlegacy/common.c | 66 ++++++++++++++++------------- drivers/net/wireless/iwlegacy/common.h | 20 ++++----- 4 files changed, 52 insertions(+), 61 deletions(-)
drivers/net/wireless/iwlegacy/3945.c +2 -7
@@ -790,7 +790,6 @@ il3945_rx_init(struct il_priv *il, struct il_rx_queue *rxq)static int il3945_tx_reset (struct il_priv *il) { -/* bypass mode */ il_wr_prph (il,ALM_SCD_MODE_REG ,0x2 );
@@ -827,8 +826,7 @@ il3945_tx_reset(struct il_priv *il)static int il3945_txq_ctx_reset (struct il_priv *il) { -int rc; -int txq_id, slots_num; +int rc, txq_id;il3945_hw_txq_ctx_free (il);
@@ -844,10 +842,7 @@ il3945_txq_ctx_reset(struct il_priv *il)/* Tx queue(s) */ for (txq_id =0 ; txq_id < il->hw_params.max_txq_num; txq_id++) { - slots_num = - (txq_id == -IL39_CMD_QUEUE_NUM ) ?TFD_CMD_SLOTS :TFD_TX_CMD_SLOTS ; - rc =il_tx_queue_init (il, &il->txq[txq_id], slots_num, txq_id); + rc =il_tx_queue_init (il, txq_id);if (rc) {IL_ERR ("Tx %d queue init failed\n" , txq_id); goto error;
drivers/net/wireless/iwlegacy/4965-mac.c +5 -13
@@ -1952,8 +1952,7 @@ il4965_hw_txq_ctx_free(struct il_priv *il)int il4965_txq_ctx_alloc (struct il_priv *il) { -int ret; -int txq_id, slots_num; +int ret, txq_id;unsigned long flags;/* Free all tx/cmd queues and keep-warm buffer */
@@ -1990,10 +1989,7 @@ il4965_txq_ctx_alloc(struct il_priv *il)/* Alloc and init all Tx queues, including the command queue (#4/#9) */ for (txq_id =0 ; txq_id < il->hw_params.max_txq_num; txq_id++) { - slots_num = - (txq_id == - il->cmd_queue) ?TFD_CMD_SLOTS :TFD_TX_CMD_SLOTS ; - ret =il_tx_queue_init (il, &il->txq[txq_id], slots_num, txq_id); + ret =il_tx_queue_init (il, txq_id);if (ret) {IL_ERR ("Tx %d queue init failed\n" , txq_id); goto error;
@@ -2014,25 +2010,21 @@ error_bc_tbls:void il4965_txq_ctx_reset (struct il_priv *il) { -int txq_id, slots_num; +int txq_id;unsigned long flags;spin_lock_irqsave (&il->lock, flags);/* Turn off all Tx DMA fifos */ il4965_txq_set_sched (il,0 ); -/* Tell NIC where to find the "keep warm" buffer */ il_wr (il,FH49_KW_MEM_ADDR_REG , il->kw.dma >>4 );spin_unlock_irqrestore (&il->lock, flags);/* Alloc and init all Tx queues, including the command queue (#4) */ -for (txq_id =0 ; txq_id < il->hw_params.max_txq_num; txq_id++) { - slots_num = - txq_id == il->cmd_queue ?TFD_CMD_SLOTS :TFD_TX_CMD_SLOTS ; -il_tx_queue_reset (il, &il->txq[txq_id], slots_num, txq_id); - } +for (txq_id =0 ; txq_id < il->hw_params.max_txq_num; txq_id++) +il_tx_queue_reset (il, txq_id); }void
drivers/net/wireless/iwlegacy/common.c +36 -30
115 lines not on this page · raw message
drivers/net/wireless/iwlegacy/common.h +9 -11
@@ -1783,14 +1783,12 @@ void il_chswitch_done(struct il_priv *il, bool is_success);/***************************************************** * TX ******************************************************/ -void il_txq_update_write_ptr (struct il_priv *il,struct il_tx_queue *txq); -int il_tx_queue_init (struct il_priv *il,struct il_tx_queue *txq,int slots_num, -u32 txq_id); -void il_tx_queue_reset (struct il_priv *il,struct il_tx_queue *txq, -int slots_num,u32 txq_id); -void il_tx_queue_unmap (struct il_priv *il,int txq_id); -void il_tx_queue_free (struct il_priv *il,int txq_id); -void il_setup_watchdog (struct il_priv *il); +extern void il_txq_update_write_ptr (struct il_priv *il,struct il_tx_queue *txq); +extern int il_tx_queue_init (struct il_priv *il,u32 txq_id); +extern void il_tx_queue_reset (struct il_priv *il,u32 txq_id); +extern void il_tx_queue_unmap (struct il_priv *il,int txq_id); +extern void il_tx_queue_free (struct il_priv *il,int txq_id); +extern void il_setup_watchdog (struct il_priv *il);/***************************************************** * TX power ****************************************************/
@@ -2405,10 +2403,10 @@ struct il_rb_status {__le32 __unused;/* 3945 only */ } __packed; -#define TFD_QUEUE_SIZE_MAX (256) -#define TFD_QUEUE_SIZE_BC_DUP (64) +#define TFD_QUEUE_SIZE_MAX 256 +#define TFD_QUEUE_SIZE_BC_DUP 64#define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP) -#define IL_TX_DMA_MASK DMA_BIT_MASK(36) +#define IL_TX_DMA_MASK DMA_BIT_MASK(36)#define IL_NUM_OF_TBS 20 static inline u8
Signature · 1 line
1.7.1
PATCH 22/24 iwlegacy: s/S_RF_KILL_HW/S_RFKILL/g
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/3945-mac.c | 30 +++++++++++++++--------------- drivers/net/wireless/iwlegacy/4965-mac.c | 28 ++++++++++++++-------------- drivers/net/wireless/iwlegacy/common.c | 6 +++--- drivers/net/wireless/iwlegacy/common.h | 4 ++-- drivers/net/wireless/iwlegacy/debug.c | 4 ++-- 5 files changed, 36 insertions(+), 36 deletions(-)
drivers/net/wireless/iwlegacy/3945-mac.c +15 -15
@@ -809,16 +809,16 @@ il3945_hdl_card_state(struct il_priv *il, struct il_rx_buf *rxb)_il_wr (il,CSR_UCODE_DRV_GP1_SET ,CSR_UCODE_DRV_GP1_BIT_CMD_BLOCKED );if (flags &HW_CARD_DISABLED ) -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);else -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);il_scan_cancel (il); -if ((test_bit (S_RF_KILL_HW , &status) != -test_bit (S_RF_KILL_HW , &il->status))) +if ((test_bit (S_RFKILL , &status) != +test_bit (S_RFKILL , &il->status)))wiphy_rfkill_set_hw_state (il->hw->wiphy, -test_bit (S_RF_KILL_HW , &il->status)); +test_bit (S_RFKILL , &il->status));else wake_up (&il->wait_command_queue); }
@@ -2166,7 +2166,7 @@ il3945_alive_start(struct il_priv *il)D_INFO ("RFKILL status: 0x%x\n" , rfkill);if (rfkill &0x1 ) { -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);/* if RFKILL is not on, then wait for thermal * sensor in adapter to kick in */ while (il3945_hw_get_temperature (il) ==0 ) {
@@ -2178,7 +2178,7 @@ il3945_alive_start(struct il_priv *il)D_INFO ("Thermal calibration took %dus\n" , thermal_spin *10 ); }else -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);/* After the ALIVE response, we can send commands to 3945 uCode */ set_bit (S_ALIVE , &il->status);
@@ -2272,7 +2272,7 @@ __il3945_down(struct il_priv *il)* clear all bits but the RF Kill bits and return */ if (!il_is_init (il)) { il->status = -test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_RFKILL , &il->status) <<S_RFKILL |test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ; goto exit;
@@ -2281,7 +2281,7 @@ __il3945_down(struct il_priv *il)/* ...otherwise clear out all the status bits but the RF Kill * bit and continue taking the NIC down. */ il->status &= -test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_RFKILL , &il->status) <<S_RFKILL |test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED |test_bit (S_FW_ERROR , &il->status) <<S_FW_ERROR |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ;
@@ -2371,9 +2371,9 @@ __il3945_up(struct il_priv *il)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW ) -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);else { -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);IL_WARN ("Radio disabled by HW RF Kill switch\n" );return -ENODEV ; }
@@ -2405,7 +2405,7 @@ __il3945_up(struct il_priv *il) il->ucode_data.len);/* We return success when we resume from suspend and rf_kill is on. */ -if (test_bit (S_RF_KILL_HW , &il->status)) +if (test_bit (S_RFKILL , &il->status))return 0 ;for (i =0 ; i <MAX_HW_RESTARTS ; i++) {
@@ -2485,15 +2485,15 @@ il3945_rfkill_poll(struct work_struct *data) {struct il_priv *il = container_of(data, struct il_priv, _3945.rfkill_poll.work); -bool old_rfkill =test_bit (S_RF_KILL_HW , &il->status); +bool old_rfkill =test_bit (S_RFKILL , &il->status);bool new_rfkill = !(_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW );if (new_rfkill != old_rfkill) {if (new_rfkill) -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);else -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, new_rfkill);
drivers/net/wireless/iwlegacy/4965-mac.c +14 -14
@@ -4110,17 +4110,17 @@ il4965_hdl_card_state(struct il_priv *il, struct il_rx_buf *rxb)il4965_perform_ct_kill_task (il);if (flags &HW_CARD_DISABLED ) -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);else -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);if (!(flags &RXON_CARD_DISABLED ))il_scan_cancel (il); -if ((test_bit (S_RF_KILL_HW , &status) != -test_bit (S_RF_KILL_HW , &il->status))) +if ((test_bit (S_RFKILL , &status) != +test_bit (S_RFKILL , &il->status)))wiphy_rfkill_set_hw_state (il->hw->wiphy, -test_bit (S_RF_KILL_HW , &il->status)); +test_bit (S_RFKILL , &il->status));else wake_up (&il->wait_command_queue); }
@@ -4412,9 +4412,9 @@ il4965_irq_tasklet(struct il_priv *il)*/ if (!test_bit (S_ALIVE , &il->status)) {if (hw_rf_kill) -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);else -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, hw_rf_kill); }
@@ -5383,7 +5383,7 @@ __il4965_down(struct il_priv *il)* clear all bits but the RF Kill bit and return */ if (!il_is_init (il)) { il->status = -test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_RFKILL , &il->status) <<S_RFKILL |test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ; goto exit;
@@ -5392,7 +5392,7 @@ __il4965_down(struct il_priv *il)/* ...otherwise clear out all the status bits but the RF Kill * bit and continue taking the NIC down. */ il->status &= -test_bit (S_RF_KILL_HW , &il->status) <<S_RF_KILL_HW | +test_bit (S_RFKILL , &il->status) <<S_RFKILL |test_bit (S_GEO_CONFIGURED , &il->status) <<S_GEO_CONFIGURED |test_bit (S_FW_ERROR , &il->status) <<S_FW_ERROR |test_bit (S_EXIT_PENDING , &il->status) <<S_EXIT_PENDING ;
@@ -5514,9 +5514,9 @@ __il4965_up(struct il_priv *il)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW ) -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);else { -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, true);il_enable_rfkill_int (il);
@@ -6612,12 +6612,12 @@ il4965_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)/* If platform's RF_KILL switch is NOT set to KILL */ if (_il_rd (il,CSR_GP_CNTRL ) &CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW ) -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);else -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, -test_bit (S_RF_KILL_HW , &il->status)); +test_bit (S_RFKILL , &il->status));il_power_initialize (il);
drivers/net/wireless/iwlegacy/common.c +3 -3
@@ -350,7 +350,7 @@ il_send_cmd_sync(struct il_priv *il, struct il_host_cmd *cmd) } } -if (test_bit (S_RF_KILL_HW , &il->status)) { +if (test_bit (S_RFKILL , &il->status)) {IL_ERR ("Command %s aborted: RF KILL Switch\n" ,il_get_cmd_string (cmd->id)); ret = -ECANCELED ;
@@ -4890,9 +4890,9 @@ il_pci_resume(struct device *device) hw_rfkill = true;if (hw_rfkill) -set_bit (S_RF_KILL_HW , &il->status); +set_bit (S_RFKILL , &il->status);else -clear_bit (S_RF_KILL_HW , &il->status); +clear_bit (S_RFKILL , &il->status);wiphy_rfkill_set_hw_state (il->hw->wiphy, hw_rfkill);
drivers/net/wireless/iwlegacy/common.h +2 -2
@@ -1906,7 +1906,7 @@ void il_free_geos(struct il_priv *il);#define S_HCMD_ACTIVE 0/* host command in progress */ /* 1 is unused (used to be S_HCMD_SYNC_ACTIVE) */ #define S_INT_ENABLED 2 -#define S_RF_KILL_HW 3 +#define S_RFKILL 3#define S_CT_KILL 4#define S_INIT 5#define S_ALIVE 6
@@ -1947,7 +1947,7 @@ il_is_init(struct il_priv *il)static inline int il_is_rfkill_hw (struct il_priv *il) { -return test_bit (S_RF_KILL_HW , &il->status); +return test_bit (S_RFKILL , &il->status); } static inline int
drivers/net/wireless/iwlegacy/debug.c +2 -2
@@ -630,8 +630,8 @@ il_dbgfs_status_read(struct file *file, char __user *user_buf, size_t count,scnprintf (buf + pos, bufsz - pos,"S_INT_ENABLED:\t %d\n" ,test_bit (S_INT_ENABLED , &il->status)); pos += -scnprintf (buf + pos, bufsz - pos,"S_RF_KILL_HW:\t %d\n" , -test_bit (S_RF_KILL_HW , &il->status)); +scnprintf (buf + pos, bufsz - pos,"S_RFKILL:\t %d\n" , +test_bit (S_RFKILL , &il->status)); pos +=scnprintf (buf + pos, bufsz - pos,"S_CT_KILL:\t\t %d\n" ,test_bit (S_CT_KILL , &il->status));
Signature · 1 line
1.7.1
PATCH 23/24 iwlegacy: s/il_txq_mem/il_free_txq_mem/g
In reply to Stanislaw GruszkaPrevious name was confusing.
--- drivers/net/wireless/iwlegacy/3945.c | 2 +- drivers/net/wireless/iwlegacy/4965-mac.c | 2 +- drivers/net/wireless/iwlegacy/common.c | 4 ++-- drivers/net/wireless/iwlegacy/common.h | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-)
drivers/net/wireless/iwlegacy/3945.c +1 -1
@@ -1002,7 +1002,7 @@ il3945_hw_txq_ctx_free(struct il_priv *il)il_tx_queue_free (il, txq_id);/* free tx queue structure */ -il_txq_mem (il); +il_free_txq_mem (il); }void
drivers/net/wireless/iwlegacy/4965-mac.c +1 -1
@@ -1939,7 +1939,7 @@ il4965_hw_txq_ctx_free(struct il_priv *il)il4965_free_dma_ptr (il, &il->scd_bc_tbls);/* free tx queue structure */ -il_txq_mem (il); +il_free_txq_mem (il); }/**
drivers/net/wireless/iwlegacy/common.c +2 -2
@@ -4591,12 +4591,12 @@ il_alloc_txq_mem(struct il_priv *il)EXPORT_SYMBOL (il_alloc_txq_mem);void -il_txq_mem (struct il_priv *il) +il_free_txq_mem (struct il_priv *il) {kfree (il->txq); il->txq =NULL ; } -EXPORT_SYMBOL (il_txq_mem); +EXPORT_SYMBOL (il_free_txq_mem);int il_force_reset (struct il_priv *il,bool external)
drivers/net/wireless/iwlegacy/common.h +1 -1
@@ -1747,7 +1747,7 @@ void il_mac_remove_interface(struct ieee80211_hw *hw,int il_mac_change_interface (struct ieee80211_hw *hw,struct ieee80211_vif *vif,enum nl80211_iftype newtype,bool newp2p);int il_alloc_txq_mem (struct il_priv *il); -void il_txq_mem (struct il_priv *il); +void il_free_txq_mem (struct il_priv *il);#ifdef CONFIG_IWLEGACY_DEBUGFS extern void il_update_stats (struct il_priv *il,bool is_tx,__le16 fc,u16 len);
Signature · 1 line
1.7.1
PATCH 24/24 iwlegacy: remove il_is_rfkill_hw
In reply to Stanislaw Gruszka--- drivers/net/wireless/iwlegacy/common.h | 8 +------- 1 files changed, 1 insertions(+), 7 deletions(-)
drivers/net/wireless/iwlegacy/common.h +1 -7
@@ -1945,15 +1945,9 @@ il_is_init(struct il_priv *il) }static inline int -il_is_rfkill_hw (struct il_priv *il) -{ -return test_bit (S_RFKILL , &il->status); -} - -static inline int il_is_rfkill (struct il_priv *il) { -return il_is_rfkill_hw (il); +return test_bit (S_RFKILL , &il->status); } static inline int
Signature · 1 line
1.7.1