iwlwifi: fix a lot of checkpatch.pl warnings
A message that is not in the archive (sent off-list or not yet received): [email protected]
PATCH 1/28 iwlwifi: fix a lot of checkpatch.pl warnings
--- drivers/net/wireless/iwl-3945-rs.c | 4 +- drivers/net/wireless/iwl-3945.c | 81 ++++++------ drivers/net/wireless/iwl-4965-rs.c | 96 +++++++------- drivers/net/wireless/iwl-4965.c | 176 ++++++++++++------------ drivers/net/wireless/iwl-4965.h | 4 +- drivers/net/wireless/iwl-base.c | 266 +++++++++++++++++------------------- drivers/net/wireless/iwl-helpers.h | 5 +- drivers/net/wireless/iwl-io.h | 28 ++-- drivers/net/wireless/iwlwifi.h | 14 +- 9 files changed, 325 insertions(+), 349 deletions(-)
drivers/net/wireless/iwl-3945-rs.c +2 -2
@@ -745,9 +745,9 @@ static struct ieee80211_rate *rs_get_rate(void *priv_rate,IWL_DEBUG_RATE ("decrease rate because of low success_ratio\n" ); scale_action =-1 ; }else if ((low_tpt ==IWL_INVALID_VALUE ) && - (high_tpt ==IWL_INVALID_VALUE )) { + (high_tpt ==IWL_INVALID_VALUE )) scale_action =1 ; - }else if ((low_tpt !=IWL_INVALID_VALUE ) && +else if ((low_tpt !=IWL_INVALID_VALUE ) && (high_tpt !=IWL_INVALID_VALUE ) && (low_tpt < current_tpt) && (high_tpt < current_tpt)) {
drivers/net/wireless/iwl-3945.c +41 -40
192 lines not on this page · raw message
drivers/net/wireless/iwl-4965-rs.c +47 -49
258 lines not on this page · raw message
drivers/net/wireless/iwl-4965.c +85 -91
424 lines not on this page · raw message
drivers/net/wireless/iwl-4965.h +2 -2
@@ -36,7 +36,7 @@ struct sta_ht_info;*/ static inline void iwl_eeprom_release_semaphore (struct iwl_priv *priv) {} -static inline void iwl4965_add_station (struct iwl_priv *priv,const u8 * addr, +static inline void iwl4965_add_station (struct iwl_priv *priv,const u8 *addr,int is_ap) {}static inline void iwl4965_set_rxon_ht (struct iwl_priv *priv,struct sta_ht_info *ht_info) {}
@@ -77,7 +77,7 @@ extern void iwl_eeprom_release_semaphore(struct iwl_priv *priv);extern int iwl4965_tx_queue_update_wr_ptr (struct iwl_priv *priv,struct iwl_tx_queue *txq,u16 byte_cnt); -extern void iwl4965_add_station (struct iwl_priv *priv,const u8 * addr, +extern void iwl4965_add_station (struct iwl_priv *priv,const u8 *addr,int is_ap);extern void iwl4965_set_rxon_ht (struct iwl_priv *priv,struct sta_ht_info *ht_info);
drivers/net/wireless/iwl-base.c +125 -141
748 lines not on this page · raw message
drivers/net/wireless/iwl-helpers.h +2 -3
@@ -314,9 +314,8 @@ static inline const char *iwl_escape_essid(const char *essid, u8 essid_len) *d++ ='\\' ; *d++ ='0' ; s++; - }else { + }else *d++ = *s++; - } } *d ='\0' ;return escaped;
@@ -334,7 +333,7 @@ static inline unsigned long elapsed_jiffies(unsigned long start,static inline int snprint_line (char *buf,size_t count, -const u8 * data,u32 len,u32 ofs) +const u8 *data,u32 len,u32 ofs) {int out, i, j, l;char c;
drivers/net/wireless/iwl-io.h +14 -14
@@ -178,10 +178,9 @@ static inline int _iwl_grab_restricted_access(struct iwl_priv *priv)IWL_DEBUG_RF_KILL ("Wait for complete power-down, " "gpctl = 0x%08x\n" , gp_ctl);mdelay (10 ); - }else { + }else IWL_DEBUG_RF_KILL ("power-down complete, " -"gpctl = 0x%08x\n" , gp_ctl); - } +"gpctl = 0x%08x\n" , gp_ctl); }/* this bit wakes up the NIC */
@@ -268,7 +267,7 @@ static inline u32 __iwl_read_restricted(const char *f, u32 l,#define iwl_read_restricted (p, r) _iwl_read_restricted(p, r)#endif -static void inline _iwl_write_restricted (struct iwl_priv *priv, +static inline void _iwl_write_restricted (struct iwl_priv *priv,u32 reg,u32 value) {_iwl_write32 (priv, reg, value);
@@ -285,9 +284,10 @@ static void __iwl_write_restricted(u32 line, __iwl_write_restricted(__LINE__, priv, reg, value)static inline void iwl_write_buffer_restricted (struct iwl_priv *priv, -u32 reg,u32 len,u32 * values) +u32 reg,u32 len,u32 *values) {u32 count =sizeof (u32); +if ((priv !=NULL ) && (values !=NULL )) {for (;0 < len; len -= count, reg += count, values++)_iwl_write_restricted (priv, reg, *values);
@@ -308,19 +308,19 @@ static inline int _iwl_poll_restricted_bit(struct iwl_priv *priv,return -ETIMEDOUT ; } +static inline int __iwl_poll_restricted_bit (const char *f,u32 l,struct iwl_priv *priv,u32 addr,u32 mask,int timeout) {int rc =_iwl_poll_restricted_bit (priv, addr, mask, timeout); +if (unlikely (rc == -ETIMEDOUT )) -IWL_DEBUG_IO - ("poll_restricted_bit(0x%08X, 0x%08X) - timedout - %s %d\n" , - addr, mask, f, l); +IWL_DEBUG_IO ("poll_restricted_bit(0x%08X, 0x%08X) - " +"timedout - %s %d\n" , addr, mask, f, l);else -IWL_DEBUG_IO - ("poll_restricted_bit(0x%08X, 0x%08X) = 0x%08X - %s %d\n" , - addr, mask, rc, f, l); +IWL_DEBUG_IO ("poll_restricted_bit(0x%08X, 0x%08X) = 0x%08X " +"- %s %d\n" , addr, mask, rc, f, l);return rc; }
@@ -383,7 +383,7 @@ static inline void __iwl_set_bits_restricted_reg(u32 line, struct iwl_priv#define _iwl_set_bits_mask_restricted_reg (priv, reg, bits, mask) \ _iwl_write_restricted_reg( \ priv, reg, ((_iwl_read_restricted_reg(priv, reg) & mask) | bits)) -static void inline __iwl_set_bits_mask_restricted_reg (u32 line,struct iwl_priv +static inline void __iwl_set_bits_mask_restricted_reg (u32 line,struct iwl_priv *priv,u32 reg,u32 bits,u32 mask) {
@@ -417,7 +417,7 @@ static inline void iwl_write_restricted_mem(struct iwl_priv *priv, u32 addr,static inline void iwl_write_restricted_mem_buffer (struct iwl_priv *priv,u32 addr,u32 len, -u32 * values) +u32 *values) {iwl_write_restricted (priv,HBUS_TARG_MEM_WADDR , addr);for (;0 < len; len -=sizeof (u32), values++)
@@ -426,7 +426,7 @@ static inline void iwl_write_restricted_mem_buffer(struct iwl_priv *priv,static inline void iwl_write_restricted_reg_buffer (struct iwl_priv *priv,u32 reg,u32 len, -u8 * values) +u8 *values) {u32 reg_offset = reg;u32 aligment = reg &0x3 ;
drivers/net/wireless/iwlwifi.h +7 -7
@@ -520,11 +520,11 @@ struct fw_image_desc {/* uCode file layout */ struct iwl_ucode {__le32 ver;/* major/minor/subminor */ -__le32 inst_size;/* bytes of runtime instructions */ -__le32 data_size;/* bytes of runtime data */ -__le32 init_size;/* bytes of initialization instructions */ +__le32 inst_size;/* bytes of runtime instructions */ +__le32 data_size;/* bytes of runtime data */ +__le32 init_size;/* bytes of initialization instructions */ __le32 init_data_size;/* bytes of initialization data */ -__le32 boot_size;/* bytes of bootstrap instructions */ +__le32 boot_size;/* bytes of bootstrap instructions */ u8 data[0 ];/* data in same order as "size" elements */ };
@@ -590,7 +590,7 @@ struct iwl_addsta_cmd;extern int iwl_send_add_station (struct iwl_priv *priv,struct iwl_addsta_cmd *sta,u8 flags);extern const char *iwl_get_tx_fail_reason (u32 status); -extern u8 iwl_add_station (struct iwl_priv *priv,const u8 * bssid, +extern u8 iwl_add_station (struct iwl_priv *priv,const u8 *bssid,int is_ap,u8 flags);extern int iwl_is_network_packet (struct iwl_priv *priv,struct ieee80211_hdr *header);
@@ -631,7 +631,7 @@ extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len,extern int __must_check iwl_send_cmd (struct iwl_priv *priv,struct iwl_host_cmd *cmd);extern int iwl_fill_beacon_frame (struct iwl_priv *priv, -struct ieee80211_hdr *hdr,const u8 * dest, +struct ieee80211_hdr *hdr,const u8 *dest,int left);extern int iwl_rx_queue_update_write_ptr (struct iwl_priv *priv,struct iwl_rx_queue *q);
@@ -715,7 +715,7 @@ extern int iwl4965_get_temperature(const struct iwl_priv *priv);* not yet been merged into a single common layer for managing the * station tables. */ -extern u8 iwl_hw_find_station (struct iwl_priv *priv,const u8 * bssid); +extern u8 iwl_hw_find_station (struct iwl_priv *priv,const u8 *bssid);extern int iwl_hw_channel_switch (struct iwl_priv *priv,u8 channel);extern int iwl_tx_queue_reclaim (struct iwl_priv *priv,int txq_id,int index);
Signature · 1 line
1.5.2
PATCH 2/28 iwlwifi: add more Kconfig options
Add IWLWIFI_SENSITIVITY, IWLWIFI_SPECTRUM_MEASUREMENT, and IWLWIFI_QOS.
--- drivers/net/wireless/Kconfig | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-)
drivers/net/wireless/Kconfig +23 -0
@@ -768,6 +768,29 @@ config IWLWIFI_DEBUG as the debug information can assist others in helping you resolve any problems you may encounter. +config IWLWIFI_SENSITIVITY + bool "Enable Sensitivity Calibration in iwlwifi drivers" + depends on IWLWIFI + default y + ---help--- + This option will enable sensitivity calibration for the iwlwifi + drivers. + +config IWLWIFI_SPECTRUM_MEASUREMENT + bool "Enable Spectrum Measurement in iwlwifi drivers" + depends on IWLWIFI + default y + ---help--- + This option will enable spectrum measurement for the iwlwifi drivers. + +config IWLWIFI_QOS + bool "Enable Wireless QoS in iwlwifi drivers" + depends on IWLWIFI + default y + ---help--- + This option will enable wireless quality of service (QoS) for the + iwlwifi drivers. + config IWLWIFI_HT bool "Enable 802.11n HT features in iwlwifi drivers" depends on EXPERIMENTAL
Signature · 1 line
1.5.2
PATCH 3/28 iwlwifi: Endianity fix for 4965 rate scaling
From: Tomas Winkler <[email protected]>
This patch fixes endianity issues in 4965 rate scaling algorithm.
--- drivers/net/wireless/iwl-4965-hw.h | 4 ++- drivers/net/wireless/iwl-4965-rs.c | 54 ++++++++++++++++++++++------------- drivers/net/wireless/iwl-4965.c | 18 ++++++------ drivers/net/wireless/iwl-commands.h | 11 ------- 4 files changed, 46 insertions(+), 41 deletions(-)
drivers/net/wireless/iwl-4965-hw.h +3 -1
@@ -314,7 +314,9 @@ struct iwl_link_quality_cmd {__le16 control;struct iwl_link_qual_general_params general_params;struct iwl_link_qual_agg_params agg_params; -struct iwl_rate rate_scale_table[LINK_QUAL_MAX_RETRY_NUM ]; +struct { +__le32 rate_n_flags; + } rs_table[LINK_QUAL_MAX_RETRY_NUM ];__le32 reserved2; } __attribute__ ((packed));
drivers/net/wireless/iwl-4965-rs.c +34 -20
145 lines not on this page · raw message
drivers/net/wireless/iwl-4965.c +9 -9
@@ -4382,11 +4382,10 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)struct iwl_link_quality_cmd link_cmd = { .reserved1 =0 , }; -struct iwl_rate *table = link_cmd.rate_scale_table; +u16 rate_flags;/* Set up the rate scaling to start at 54M and fallback * all the way to 1M in IEEE order and then spin on IEEE */ - i =0 ;if (is_ap) r =IWL_RATE_54M_INDEX ; else if ((priv->phymode == MODE_IEEE80211A) ||
@@ -4395,21 +4394,22 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)else r =IWL_RATE_1M_INDEX ; -while (i <LINK_QUAL_MAX_RETRY_NUM ) { +for (i =0 ; i <LINK_QUAL_MAX_RETRY_NUM ; i++) { + rate_flags =0 ;if (r >=IWL_FIRST_CCK_RATE && r <=IWL_LAST_CCK_RATE ) - table[i].rate_n_flags |=RATE_MCS_CCK_MSK ; + rate_flags |=RATE_MCS_CCK_MSK ; - table[i].s.rate = iwl_rates[r].plcp; - table[i].rate_n_flags |=RATE_MCS_ANT_B_MSK ; - table[i].rate_n_flags &= ~RATE_MCS_ANT_A_MSK ; + rate_flags |=RATE_MCS_ANT_B_MSK ; + rate_flags &= ~RATE_MCS_ANT_A_MSK ; + link_cmd.rs_table[i].rate_n_flags = +iwl_hw_set_rate_n_flags (iwl_rates[r].plcp, rate_flags); r =iwl_get_prev_ieee_rate (r); - i++; } link_cmd.general_params.single_stream_ant_msk =2 ; link_cmd.general_params.dual_stream_ant_msk =3 ; link_cmd.agg_params.agg_dis_start_th =3 ; - link_cmd.agg_params.agg_time_limit =4000 ; + link_cmd.agg_params.agg_time_limit =cpu_to_le16 (4000 );/* Update the rate scaling for control frame Tx to AP */ link_cmd.sta_id = is_ap ?IWL_AP_ID :IWL_BROADCAST_ID ;
drivers/net/wireless/iwl-commands.h +0 -11
@@ -214,17 +214,6 @@ struct iwl_rate { __le16 rate_n_flags; }; } __attribute__ ((packed)); -#elif IWL == 4965 -struct iwl_rate { -union { -struct { -u8 rate; -u8 flags; -__le16 ext_flags; - } s; -__le32 rate_n_flags; - }; -} __attribute__ ((packed));#endif struct iwl_dram_scratch {
Signature · 1 line
1.5.2
PATCH 4/28 iwlwifi: Endianity fix for 4965 rx chain selection
From: Tomas Winkler <[email protected]>
This patch fixes endianity for rx chain setting.
--- drivers/net/wireless/iwl-4965-hw.h | 14 +++++++------- drivers/net/wireless/iwl-base.c | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/iwl-4965-hw.h +7 -7
@@ -244,18 +244,18 @@ struct iwl_channel_switch_notif {#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK 0x02000000#define RXON_FLG_CHANNEL_MODE_MIXED_MSK 0x04000000 -#define RXON_RX_CHAIN_DRIVER_FORCE_MSK (0x1<<0) -#define RXON_RX_CHAIN_VALID_MSK (0x7<<1) +#define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0) +#define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1)#define RXON_RX_CHAIN_VALID_POS (1) -#define RXON_RX_CHAIN_FORCE_SEL_MSK (0x7<<4) +#define RXON_RX_CHAIN_FORCE_SEL_MSK __constant_cpu_to_le16(0x7<<4)#define RXON_RX_CHAIN_FORCE_SEL_POS (4) -#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK (0x7<<7) +#define RXON_RX_CHAIN_FORCE_MIMO_SEL_MSK __constant_cpu_to_le16(0x7<<7)#define RXON_RX_CHAIN_FORCE_MIMO_SEL_POS (7) -#define RXON_RX_CHAIN_CNT_MSK (0x3<<10) +#define RXON_RX_CHAIN_CNT_MSK __constant_cpu_to_le16(0x3<<10)#define RXON_RX_CHAIN_CNT_POS (10) -#define RXON_RX_CHAIN_MIMO_CNT_MSK (0x3<<12) +#define RXON_RX_CHAIN_MIMO_CNT_MSK __constant_cpu_to_le16(0x3<<12)#define RXON_RX_CHAIN_MIMO_CNT_POS (12) -#define RXON_RX_CHAIN_MIMO_FORCE_MSK (0x1<<14) +#define RXON_RX_CHAIN_MIMO_FORCE_MSK __constant_cpu_to_le16(0x1<<14)#define RXON_RX_CHAIN_MIMO_FORCE_POS (14)
drivers/net/wireless/iwl-base.c +2 -2
@@ -7135,9 +7135,9 @@ static void iwl_bg_request_scan(struct work_struct *data)* Avoid A (0x1) because of its off-channel reception on A-band. * MIMO is not used here, but value is required to make uCode happy. */ scan->rx_chain =RXON_RX_CHAIN_DRIVER_FORCE_MSK | - (0x7 <<RXON_RX_CHAIN_VALID_POS ) | +cpu_to_le16 ((0x7 <<RXON_RX_CHAIN_VALID_POS ) | (0x6 <<RXON_RX_CHAIN_FORCE_SEL_POS ) | - (0x7 <<RXON_RX_CHAIN_FORCE_MIMO_SEL_POS ); + (0x7 <<RXON_RX_CHAIN_FORCE_MIMO_SEL_POS ));#endif if (priv->iw_mode ==IEEE80211_IF_TYPE_MNTR )
Signature · 1 line
1.5.2
PATCH 5/28 iwlwifi: optimize iwl_queue_{inc|dec}_wrap implementation
This patch optimizes implementation of iwl_queue_inc_wrap and iwl_queue_inc_wrap based on the fact the hardware queue is power-of-two size. We also add BUG_ON and BUILD_BUG_ON check for queue size against is_power_of_2 in case future hardwares break this rule.
--- drivers/net/wireless/iwl-base.c | 16 +++++++++++++--- 1 files changed, 13 insertions(+), 3 deletions(-)
drivers/net/wireless/iwl-base.c +13 -3
@@ -160,14 +160,16 @@ static int iwl_queue_space(const struct iwl_queue *q)return s; } +/* XXX: n_bd must be power-of-two size */ static inline int iwl_queue_inc_wrap (int index,int n_bd) { -return (++index == n_bd) ?0 : index; +return ++index & (n_bd -1 ); } +/* XXX: n_bd must be power-of-two size */ static inline int iwl_queue_dec_wrap (int index,int n_bd) { -return (index ==0 ) ? n_bd -1 : index -1 ; +return --index & (n_bd -1 ); }static inline int x2_queue_used (const struct iwl_queue *q,int i)
@@ -192,6 +194,10 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q, q->n_window = slots_num; q->id = id; +/* count must be power-of-two size, otherwise iwl_queue_inc_wrap +* and iwl_queue_dec_wrap are broken. */ +BUG_ON (!is_power_of_2 (count)); + q->low_mark = q->n_window /4 ;if (q->low_mark <4 ) q->low_mark =4 ;
@@ -266,9 +272,13 @@ int iwl_tx_queue_init(struct iwl_priv *priv,return -ENOMEM ; } - txq->need_update =0 ; + +/* TFD_QUEUE_SIZE_MAX must be power-of-two size, otherwise +* iwl_queue_inc_wrap and iwl_queue_dec_wrap are broken. */ +BUILD_BUG_ON (TFD_QUEUE_SIZE_MAX & (TFD_QUEUE_SIZE_MAX -1 ));iwl_queue_init (priv, &txq->q,TFD_QUEUE_SIZE_MAX , slots_num, txq_id); +iwl_hw_tx_queue_init (priv, txq);return 0 ;
Signature · 1 line
1.5.2
PATCH 6/28 iwlwifi: use mask operation to replace '%' for index calculation
This patch replaces index calculation with '%' to mask operation. Note, this is only applicable for power-of-two size.
--- drivers/net/wireless/iwl-4965.c | 2 +- drivers/net/wireless/iwl-base.c | 18 +++++++++++------- drivers/net/wireless/iwl-hw.h | 1 + drivers/net/wireless/iwlwifi.h | 2 +- 4 files changed, 14 insertions(+), 9 deletions(-)
drivers/net/wireless/iwl-4965.c +1 -1
@@ -2048,7 +2048,7 @@ static struct iwl_txpower_comp_entry {static s32 get_min_power_index (s32 rate_power_index,u32 band) {if (!band) { -if ((rate_power_index %8 ) <=4 ) +if ((rate_power_index &7 ) <=4 )return MIN_TX_GAIN_INDEX_52GHZ_EXT ; }return MIN_TX_GAIN_INDEX ;
drivers/net/wireless/iwl-base.c +11 -7
@@ -184,7 +184,7 @@ static inline u8 get_next_cmd_index(struct iwl_queue *q, u32 index, int is_huge)if (is_huge)return q->n_window; -return (u8) (index % q->n_window); +return index & (q->n_window -1 ); } static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,
@@ -198,6 +198,10 @@ static int iwl_queue_init(struct iwl_priv *priv, struct iwl_queue *q,* and iwl_queue_dec_wrap are broken. */ BUG_ON (!is_power_of_2 (count)); +/* slots_num must be power-of-two size, otherwise +* get_next_cmd_index is broken. */ +BUG_ON (!is_power_of_2 (slots_num)); + q->low_mark = q->n_window /4 ;if (q->low_mark <4 ) q->low_mark =4 ;
@@ -3247,7 +3251,7 @@ int is_duplicate_packet(struct iwl_priv *priv, struct ieee80211_hdr *header)struct list_head *p;struct iwl_ibss_seq *entry =NULL ;u8 *mac = header->addr2; -int index = mac[5 ] %IWL_IBSS_MAC_HASH_SIZE ; +int index = mac[5 ] & (IWL_IBSS_MAC_HASH_SIZE -1 );__list_for_each (p, &priv->ibss_mac_hash[index]) { entry =
@@ -3325,8 +3329,8 @@ static u32 iwl_usecs_to_beacons(u32 usec, u32 beacon_interval)if (!interval || !usec)return 0 ; - quot = (usec / interval) %0x100 ; - rem = (usec % interval) %BEACON_TIME_MASK_LOW ; + quot = (usec / interval) & (BEACON_TIME_MASK_HIGH >>24 ); + rem = (usec % interval) &BEACON_TIME_MASK_LOW ;return (quot <<24 ) + rem; }
@@ -4344,7 +4348,7 @@ int iwl_rx_queue_restock(struct iwl_priv *priv) rxq->bd[rxq->write] =iwl_dma_addr2rbd_ptr (priv, rxb->dma_addr); rxq->queue[rxq->write] = rxb; - rxq->write = (rxq->write +1 ) %RX_QUEUE_SIZE ; + rxq->write = (rxq->write +1 ) &RX_QUEUE_MASK ; rxq->free_count--; }spin_unlock_irqrestore (&rxq->lock, flags);
@@ -4647,7 +4651,7 @@ static void iwl_rx_handle(struct iwl_priv *priv)spin_lock_irqsave (&rxq->lock, flags);list_add_tail (&rxb->list, &priv->rxq.rx_used);spin_unlock_irqrestore (&rxq->lock, flags); - i = (i +1 ) %RX_QUEUE_SIZE ; + i = (i +1 ) &RX_QUEUE_MASK ; }/* Backtrack one entry */
@@ -8562,7 +8566,7 @@ static ssize_t show_rate(struct device *d,return sprintf (buf,"%d%s\n" , (iwl_rates[i].ieee >>1 ), - (iwl_rates[i].ieee %2 ) ?".5" :"" ); + (iwl_rates[i].ieee &0x1 ) ?".5" :"" ); } static DEVICE_ATTR(rate, S_IRUSR, show_rate, NULL);
drivers/net/wireless/iwl-hw.h +1 -0
@@ -1076,6 +1076,7 @@ struct statistics {#define NUM_TFD_CHUNKS 4#define RX_QUEUE_SIZE 256 +#define RX_QUEUE_MASK 255#define RX_QUEUE_SIZE_LOG 8/*
drivers/net/wireless/iwlwifi.h +1 -1
@@ -528,7 +528,7 @@ struct iwl_ucode {u8 data[0 ];/* data in same order as "size" elements */ }; -#define IWL_IBSS_MAC_HASH_SIZE 31 +#define IWL_IBSS_MAC_HASH_SIZE 32struct iwl_ibss_seq {u8 mac[ETH_ALEN ];
Signature · 1 line
1.5.2
PATCH 7/28 iwlwifi: make local functions static
--- drivers/net/wireless/iwl-4965.c | 9 +++++---- drivers/net/wireless/iwl-base.c | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-)
drivers/net/wireless/iwl-4965.c +5 -4
@@ -4257,8 +4257,9 @@ static int iwl4965_tx_queue_set_q2ratid(struct iwl_priv *priv, u16 ra_tid,/** * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID */ -int iwl4965_tx_queue_agg_enable (struct iwl_priv *priv,int txq_id,int tx_fifo, -int sta_id,int tid,u16 ssn_idx) +static int iwl4965_tx_queue_agg_enable (struct iwl_priv *priv,int txq_id, +int tx_fifo,int sta_id,int tid, +u16 ssn_idx) {unsigned long flags;int rc;
@@ -4315,8 +4316,8 @@ int iwl4965_tx_queue_agg_enable(struct iwl_priv *priv, int txq_id, int tx_fifo,/** * txq_id must be greater than IWL_BACK_QUEUE_FIRST_ID */ -int iwl4965_tx_queue_agg_disable (struct iwl_priv *priv,u16 txq_id, -u16 ssn_idx,u8 tx_fifo) +static int iwl4965_tx_queue_agg_disable (struct iwl_priv *priv,u16 txq_id, +u16 ssn_idx,u8 tx_fifo) {unsigned long flags;int rc;
drivers/net/wireless/iwl-base.c +2 -2
@@ -310,7 +310,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq) q->last_used = iwl_queue_inc_wrap(q->last_used, q->n_bd))iwl_hw_tx_queue_free_tfd (priv, txq); - len =sizeof (txq->cmd[0 ]) * q->n_window; + len =sizeof (struct iwl_cmd ) * q->n_window;if (q->id ==IWL_CMD_QUEUE_NUM ); len +=IWL_MAX_SCAN_SIZE ;
@@ -3549,7 +3549,7 @@ static inline u32 iwl_get_scd_ssn(struct iwl_tx_resp *tx_resp)return le32_to_cpu (*scd_ssn &MAX_SN ); } -int iwl4965_tx_status_reply_tx (struct iwl_priv *priv, +static int iwl4965_tx_status_reply_tx (struct iwl_priv *priv,struct iwl_ht_agg *agg,struct iwl_tx_resp *tx_resp,u16 start_idx)
Signature · 1 line
1.5.2
PATCH 8/28 iwlwifi: some coding styles cleanup
--- drivers/net/wireless/iwl-base.c | 54 ++++++++++++++++----------------------- 1 files changed, 22 insertions(+), 32 deletions(-)
drivers/net/wireless/iwl-base.c +22 -32
@@ -901,15 +901,15 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)int counter =1 ;if (rxon->flags &RXON_FLG_BAND_24G_MSK ) { - error |= -le32_to_cpu (rxon->flags &RXON_FLG_TGJ_NARROW_BAND_MSK ); - error |=le32_to_cpu (rxon->flags &RXON_FLG_RADAR_DETECT_MSK ); + error |=le32_to_cpu (rxon->flags & + (RXON_FLG_TGJ_NARROW_BAND_MSK | +RXON_FLG_RADAR_DETECT_MSK ));if (error)IWL_WARNING ("check 24G fields %d | %d\n" , counter++, error); }else { - error |= ((rxon->flags &RXON_FLG_SHORT_SLOT_MSK ) != -RXON_FLG_SHORT_SLOT_MSK ); + error |= (rxon->flags &RXON_FLG_SHORT_SLOT_MSK ) ? +0 :le32_to_cpu (RXON_FLG_SHORT_SLOT_MSK );if (error)IWL_WARNING ("check 52 fields %d | %d\n" , counter++, error);
@@ -917,7 +917,6 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)if (error)IWL_WARNING ("check 52 CCK %d | %d\n" , counter++, error); - } error |= (rxon->node_addr[0 ] | rxon->bssid_addr[0 ]) &0x1 ;if (error)
@@ -925,7 +924,7 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)/* make sure basic rates 6Mbps and 1Mbps are supported */ error |= (((rxon->ofdm_basic_rates &IWL_RATE_6M_MASK ) ==0 ) && - ((rxon->cck_basic_rates &IWL_RATE_1M_MASK ) ==0 )); + ((rxon->cck_basic_rates &IWL_RATE_1M_MASK ) ==0 ));if (error)IWL_WARNING ("check basic rate %d | %d\n" , counter++, error);
@@ -933,43 +932,39 @@ static int iwl_check_rxon_cmd(struct iwl_rxon_cmd *rxon)if (error)IWL_WARNING ("check assoc id %d | %d\n" , counter++, error); - error |= ((rxon->flags & - (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )) == - (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )); + error |= ((rxon->flags & (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK )) + == (RXON_FLG_CCK_MSK |RXON_FLG_SHORT_SLOT_MSK ));if (error)IWL_WARNING ("check CCK and short slot %d | %d\n" , counter++, error); error |= ((rxon->flags & (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK )) - == (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK )); + == (RXON_FLG_CCK_MSK |RXON_FLG_AUTO_DETECT_MSK ));if (error)IWL_WARNING ("check CCK & auto detect %d | %d\n" , counter++, error); - error |= ((rxon->flags & - (RXON_FLG_AUTO_DETECT_MSK |RXON_FLG_TGG_PROTECT_MSK )) == -RXON_FLG_TGG_PROTECT_MSK ); + error |= ((rxon->flags & (RXON_FLG_AUTO_DETECT_MSK | +RXON_FLG_TGG_PROTECT_MSK )) ==RXON_FLG_TGG_PROTECT_MSK );if (error) -IWL_WARNING ("check TGG %d | %d\n" , counter++, error); +IWL_WARNING ("check TGG and auto detect %d | %d\n" , + counter++, error);#if IWL ==3945 if ((rxon->flags &RXON_FLG_DIS_DIV_MSK )) - error |= ((rxon->flags & - (RXON_FLG_ANT_B_MSK |RXON_FLG_ANT_A_MSK )) ==0 ); + error |= ((rxon->flags & (RXON_FLG_ANT_B_MSK | +RXON_FLG_ANT_A_MSK )) ==0 );if (error)IWL_WARNING ("check antenna %d %d\n" , counter++, error);#endif -if (error)IWL_WARNING ("Tuning to channel %d\n" ,le16_to_cpu (rxon->channel));if (error) { -IWL_ERROR - ("Error not a valid iwl_rxon_assoc_cmd field values\n" ); +IWL_ERROR ("Not a valid iwl_rxon_assoc_cmd field values\n" );return -1 ; } -return 0 ; }
@@ -1512,7 +1507,7 @@ static int iwl_send_beacon_cmd(struct iwl_priv *priv) frame =iwl_get_free_frame (priv);if (!frame) { -IWL_ERROR ("Coult not obtain free frame buffer for beacon " +IWL_ERROR ("Could not obtain free frame buffer for beacon " "command.\n" );return -ENOMEM ; }
@@ -1642,9 +1637,6 @@ void iwl_report_frame(struct iwl_priv *priv,u32 print_dump =0 ;/* set to 1 to dump all frames' contents */ u32 hundred =0 ;u32 dataframe =0 ; - -/* these are declared without "=" to avoid compiler warnings if we -* don't use them in the debug messages below */ u16 frame_ctl;u16 seq_ctl;u16 channel;
@@ -1659,7 +1651,6 @@ void iwl_report_frame(struct iwl_priv *priv,u8 agc;u16 sig_avg;u16 noise_diff; -struct iwl_rx_frame_stats *rx_stats =IWL_RX_STATS (pkt);struct iwl_rx_frame_hdr *rx_hdr =IWL_RX_HDR (pkt);struct iwl_rx_frame_end *rx_end =IWL_RX_END (pkt);
@@ -2325,12 +2316,10 @@ static int iwl_scan_cancel(struct iwl_priv *priv, unsigned long ms) }else IWL_DEBUG_SCAN ("Scan abort already in progress.\n" ); -mutex_unlock (&priv->mutex);if (ms) -while (!time_after (jiffies, - now +msecs_to_jiffies (ms)) && - priv->status &STATUS_SCANNING ) +while (!time_after (jiffies, now +msecs_to_jiffies (ms)) + && priv->status &STATUS_SCANNING )msleep (1 );mutex_lock (&priv->mutex);
@@ -3914,8 +3903,9 @@ static void iwl_rx_reply_scan(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) {struct iwl_rx_packet *pkt = (void *)rxb->skb->data; -struct iwl_scanreq_notification *notif = - (struct iwl_scanreq_notification *)pkt->u.raw; +struct iwl_scanstart_notification *notif = + (struct iwl_scanstart_notification *)pkt->u.raw; +IWL_DEBUG_RX ("Scan request status = 0x%x\n" , notif->status); }
Signature · 1 line
1.5.2
PATCH 9/28 iwlwifi: replace unnecessary GFP_ATOMIC with GFP_KERNEL
--- drivers/net/wireless/iwl-base.c | 12 ++++++------ 1 files changed, 6 insertions(+), 6 deletions(-)
drivers/net/wireless/iwl-base.c +6 -6
@@ -222,7 +222,7 @@ static int iwl_tx_queue_alloc(struct iwl_priv *priv,if (id !=IWL_CMD_QUEUE_NUM ) { txq->txb =kmalloc (sizeof (txq->txb[0 ]) * -TFD_QUEUE_SIZE_MAX ,GFP_ATOMIC ); +TFD_QUEUE_SIZE_MAX ,GFP_KERNEL );if (!txq->txb) {IWL_ERROR ("kmalloc for auxilary BD " "structures failed\n" );
@@ -1460,7 +1460,7 @@ static struct iwl_frame *iwl_get_free_frame(struct iwl_priv *priv)struct iwl_frame *frame;struct list_head *element;if (list_empty (&priv->free_frames)) { - frame =kzalloc (sizeof (*frame),GFP_ATOMIC ); + frame =kzalloc (sizeof (*frame),GFP_KERNEL );if (!frame) {IWL_ERROR ("Could not allocate frame!\n" );return NULL ;
@@ -5706,19 +5706,19 @@ static int iwl_init_geos(struct iwl_priv *priv) } modes =kzalloc (sizeof (struct ieee80211_hw_mode ) * mode_count, -GFP_ATOMIC ); +GFP_KERNEL );if (!modes)return -ENOMEM ; channels =kzalloc (sizeof (struct ieee80211_channel ) * - priv->channel_count,GFP_ATOMIC ); + priv->channel_count,GFP_KERNEL );if (!channels) {kfree (modes);return -ENOMEM ; } rates =kzalloc ((sizeof (struct ieee80211_rate ) * (IWL_MAX_RATES +1 )), -GFP_ATOMIC ); +GFP_KERNEL );if (!rates) {kfree (modes);kfree (channels);
@@ -7014,7 +7014,7 @@ static void iwl_bg_request_scan(struct work_struct *data)if (!priv->scan) { priv->scan =kmalloc (sizeof (struct iwl_scan_cmd ) + -IWL_MAX_SCAN_SIZE ,GFP_ATOMIC ); +IWL_MAX_SCAN_SIZE ,GFP_KERNEL );if (!priv->scan) { rc = -ENOMEM ; goto done;
Signature · 1 line
1.5.2
PATCH 10/28 iwlwifi: remove priv stuff zeroing in iwl_pci_probe
Remove priv stuff zeroing in iwl_pci_probe() since priv is already zeroed by ieee80211_alloc_hw().
--- drivers/net/wireless/iwl-base.c | 4 ---- 1 files changed, 0 insertions(+), 4 deletions(-)
drivers/net/wireless/iwl-base.c +0 -4
@@ -9045,9 +9045,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)iwl_clear_stations_table (priv); -memset (&(priv->txq[0 ]),0 , -sizeof (struct iwl_tx_queue ) *IWL_MAX_NUM_QUEUES ); -memset (&priv->card_alive,0 ,sizeof (struct iwl_alive_resp )); priv->data_retry_limit =-1 ; priv->ieee_channels =NULL ; priv->ieee_rates =NULL ;
@@ -9138,7 +9135,6 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent) }#ifdef CONFIG_IWLWIFI_QOS -memset (&priv->qos_data,0 ,sizeof (struct iwl_qos_info ));if (iwl_param_qos_enable) priv->qos_data.qos_enable =1 ; priv->qos_data.qos_active =0 ;
Signature · 1 line
1.5.2
PATCH 11/28 iwlwifi: add name for some PCI configuration space registers
--- drivers/net/wireless/iwl-3945.c | 3 ++- drivers/net/wireless/iwl-4965.c | 8 +++++--- drivers/net/wireless/iwl-hw.h | 2 ++ 3 files changed, 9 insertions(+), 4 deletions(-)
drivers/net/wireless/iwl-3945.c +2 -1
@@ -721,7 +721,8 @@ static int iwl3945_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)if (!pwr_max) {u32 val; - rc =pci_read_config_dword (priv->pci_dev,0x0C8 , &val); + rc =pci_read_config_dword (priv->pci_dev,PCI_POWER_SOURCE , + &val);if (val &PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT ) { iwl_set_bits_mask_restricted_reg( priv, ALM_APMG_PS_CTL,
drivers/net/wireless/iwl-4965.c +5 -3
@@ -203,7 +203,8 @@ static int iwl4965_nic_set_pwr_src(struct iwl_priv *priv, int pwr_max)if (!pwr_max) {u32 val; - rc =pci_read_config_dword (priv->pci_dev,0x0C8 , &val); + rc =pci_read_config_dword (priv->pci_dev,PCI_POWER_SOURCE , + &val);if (val &PCI_CFG_PMC_PME_FROM_D3COLD_SUPPORT ) iwl_set_bits_mask_restricted_reg(
@@ -476,9 +477,10 @@ int iwl_hw_nic_init(struct iwl_priv *priv)spin_lock_irqsave (&priv->lock, flags);if ((rev_id &0x80 ) ==0x80 && (rev_id &0x7f ) <8 ) { -pci_read_config_dword (priv->pci_dev,0xe8 , &val); +pci_read_config_dword (priv->pci_dev,PCI_REG_WUM8 , &val);/* Enable No Snoop field */ -pci_write_config_dword (priv->pci_dev,0xe8 , val & ~(1 <<11 )); +pci_write_config_dword (priv->pci_dev,PCI_REG_WUM8 , + val & ~(1 <<11 )); }spin_unlock_irqrestore (&priv->lock, flags);
drivers/net/wireless/iwl-hw.h +2 -0
@@ -179,6 +179,8 @@ struct iwl_error_resp { } __attribute__ ((packed));#define PCI_LINK_CTRL 0x0F0 +#define PCI_POWER_SOURCE 0x0C8 +#define PCI_REG_WUM8 0x0E8/* * Rx config defines & structure
Signature · 1 line
1.5.2
PATCH 12/28 iwlwifi: shorten some structure and function names
--- drivers/net/wireless/iwl-3945.c | 1 - drivers/net/wireless/iwl-4965.c | 79 +++++++++++++------------------------ drivers/net/wireless/iwl-base.c | 10 +---- drivers/net/wireless/iwl-eeprom.h | 15 +++---- drivers/net/wireless/iwl-io.h | 10 ++--- 5 files changed, 41 insertions(+), 74 deletions(-)
drivers/net/wireless/iwl-3945.c +0 -1
@@ -307,7 +307,6 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, .rate = rx_hdr->rate, .flag = 0, }; -u8 network_packet;int snr;
drivers/net/wireless/iwl-4965.c +28 -51
196 lines not on this page · raw message
drivers/net/wireless/iwl-base.c +2 -8
@@ -4296,8 +4296,8 @@ int iwl_rx_queue_update_write_ptr(struct iwl_priv *priv, struct iwl_rx_queue *q)if (rc) goto exit_unlock; -iwl_write_restricted (priv, -FH_RSCSR_CHNL0_WPTR , q->write & ~0x7 ); +iwl_write_restricted (priv,FH_RSCSR_CHNL0_WPTR , + q->write & ~0x7 );iwl_release_restricted_access (priv); }else iwl_write32 (priv,FH_RSCSR_CHNL0_WPTR , q->write & ~0x7 );
@@ -6745,11 +6745,7 @@ void iwl_down(struct iwl_priv *priv)udelay (5 );iwl_hw_nic_stop_master (priv); - -spin_lock_irqsave (&priv->lock, flags);iwl_set_bit (priv,CSR_RESET ,CSR_RESET_REG_FLAG_SW_RESET ); -spin_unlock_irqrestore (&priv->lock, flags); -iwl_hw_nic_reset (priv); exit:
@@ -9328,9 +9324,7 @@ static void iwl_resume(struct iwl_priv *priv)spin_lock_irqsave (&priv->lock, flags);iwl_clear_bit (priv,CSR_GP_CNTRL ,CSR_GP_CNTRL_REG_FLAG_MAC_ACCESS_REQ ); -spin_unlock_irqrestore (&priv->lock, flags); -spin_lock_irqsave (&priv->lock, flags);if (!iwl_grab_restricted_access (priv)) {iwl_write_restricted_reg (priv,ALM_APMG_CLK_DIS ,APMG_CLK_REG_VAL_DMA_CLK_RQT );
drivers/net/wireless/iwl-eeprom.h +7 -8
@@ -187,32 +187,31 @@ struct iwl_eeprom_temperature_corr {#define EEPROM_TX_POWER_VERSION (2)#define EEPROM_TX_POWER_VERSION_NEW (5) -struct iwl_eeprom_calib_measurement { +struct iwl_eeprom_calib_measure {u8 temperature;u8 gain_idx;u8 actual_pow;s8 pa_det; } __attribute__ ((packed)); -struct iwl_eeprom_calib_channel_info { +struct iwl_eeprom_calib_ch_info {u8 ch_num; -struct iwl_eeprom_calib_measurement - measurements[EEPROM_TX_POWER_TX_CHAINS ][EEPROM_TX_POWER_MEASUREMENTS ]; +struct iwl_eeprom_calib_measure measurements[EEPROM_TX_POWER_TX_CHAINS ] + [EEPROM_TX_POWER_MEASUREMENTS ]; } __attribute__ ((packed));struct iwl_eeprom_calib_subband_info {u8 ch_from;u8 ch_to; -struct iwl_eeprom_calib_channel_info ch1; -struct iwl_eeprom_calib_channel_info ch2; +struct iwl_eeprom_calib_ch_info ch1; +struct iwl_eeprom_calib_ch_info ch2; } __attribute__ ((packed));struct iwl_eeprom_calib_info {u8 saturation_power24;u8 saturation_power52;__le16 voltage;/* signed */ -struct iwl_eeprom_calib_subband_info - band_info_tbl[EEPROM_TX_POWER_BANDS ]; +struct iwl_eeprom_calib_subband_info band_info[EEPROM_TX_POWER_BANDS ]; } __attribute__ ((packed));#endif
drivers/net/wireless/iwl-io.h +4 -6
@@ -415,18 +415,16 @@ static inline void iwl_write_restricted_mem(struct iwl_priv *priv, u32 addr,iwl_write_restricted (priv,HBUS_TARG_MEM_WDAT , val); } -static inline void iwl_write_restricted_mem_buffer (struct iwl_priv *priv, -u32 addr,u32 len, -u32 *values) +static inline void iwl_write_restricted_mems (struct iwl_priv *priv,u32 addr, +u32 len,u32 *values) {iwl_write_restricted (priv,HBUS_TARG_MEM_WADDR , addr);for (;0 < len; len -=sizeof (u32), values++)iwl_write_restricted (priv,HBUS_TARG_MEM_WDAT , *values); } -static inline void iwl_write_restricted_reg_buffer (struct iwl_priv *priv, -u32 reg,u32 len, -u8 *values) +static inline void iwl_write_restricted_regs (struct iwl_priv *priv,u32 reg, +u32 len,u8 *values) {u32 reg_offset = reg;u32 aligment = reg &0x3 ;
Signature · 1 line
1.5.2
PATCH 13/28 iwlwifi: define iwl_rx_reply_scan only when CONFIG_IWLWIFI_DEBUG enabled
--- drivers/net/wireless/iwl-base.c | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
drivers/net/wireless/iwl-base.c +2 -0
@@ -3902,11 +3902,13 @@ static void iwl_rx_beacon_notif(struct iwl_priv *priv,static void iwl_rx_reply_scan (struct iwl_priv *priv,struct iwl_rx_mem_buffer *rxb) { +#ifdef CONFIG_IWLWIFI_DEBUG struct iwl_rx_packet *pkt = (void *)rxb->skb->data;struct iwl_scanstart_notification *notif = (struct iwl_scanstart_notification *)pkt->u.raw;IWL_DEBUG_RX ("Scan request status = 0x%x\n" , notif->status); +#endif } static void iwl_rx_scan_start_notif(struct iwl_priv *priv,
Signature · 1 line
1.5.2
PATCH 14/28 iwlwifi: remove redundant quotes
From: Ian Schram <[email protected]>
Remove some redundant quotes that probably originated from moving code around.
--- drivers/net/wireless/iwl-base.c | 8 ++++---- 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/net/wireless/iwl-base.c +4 -4
@@ -1326,7 +1326,7 @@ static int iwl_add_sta_sync_callback(struct iwl_priv *priv,struct iwl_rx_packet *res =NULL ;if (!skb) { -IWL_ERROR ("Error: Response NULL in " "REPLY_ADD_STA.\n" ); +IWL_ERROR ("Error: Response NULL in REPLY_ADD_STA.\n" );return 1 ; }
@@ -2589,8 +2589,8 @@ static int iwl_set_mode(struct iwl_priv *priv, int mode)cancel_delayed_work (&priv->scan_check); priv->status &= ~STATUS_SCAN_PENDING ;if (iwl_scan_cancel (priv,100 )) { -IWL_WARNING ("Aborted scan still in progress " "after 100ms\n" ); -IWL_DEBUG_MAC80211 ("leaving - scan abort " "failed.\n" ); +IWL_WARNING ("Aborted scan still in progress after 100ms\n" ); +IWL_DEBUG_MAC80211 ("leaving - scan abort failed.\n" );return -EAGAIN ; }
@@ -7624,7 +7624,7 @@ static int iwl_mac_config_interface(struct ieee80211_hw *hw, int if_id,if (iwl_scan_cancel (priv,100 )) {IWL_WARNING ("Aborted scan still in progress " "after 100ms\n" ); -IWL_DEBUG_MAC80211 ("leaving - scan abort " "failed.\n" ); +IWL_DEBUG_MAC80211 ("leaving - scan abort failed.\n" );mutex_unlock (&priv->mutex);return -EAGAIN ; }
Signature · 1 line
1.5.2
PATCH 15/28 iwlwifi: Endianity fix for rxon host commands
From: Tomas Winkler <[email protected]>
This patch fixes left over endianity issues in rxon host command.
--- drivers/net/wireless/iwl-4965-hw.h | 21 +++++++++++---------- drivers/net/wireless/iwl-4965.c | 10 ++++++---- 2 files changed, 17 insertions(+), 14 deletions(-)
drivers/net/wireless/iwl-4965-hw.h +11 -10
@@ -229,20 +229,21 @@ struct iwl_channel_switch_notif {/********************* END TXPOWER *****************************************/ /* HT flags */ -#define RXON_FLG_CONTROL_CHANNEL_LOCATION_MSK 0x400000 -#define RXON_FLG_CONTROL_CHANNEL_LOC_LOW_MSK 0x000000 -#define RXON_FLG_CONTROL_CHANNEL_LOC_HIGH_MSK 0x400000 +#define RXON_FLG_CONTROL_CHANNEL_LOCATION_POS (22) +#define RXON_FLG_CONTROL_CHANNEL_LOCATION_MSK __constant_cpu_to_le32(0x1<<22) +#define RXON_FLG_CONTROL_CHANNEL_LOC_LOW_MSK __constant_cpu_to_le32(0x0<<22) +#define RXON_FLG_CONTROL_CHANNEL_LOC_HIGH_MSK __constant_cpu_to_le32(0x1<<22)#define RXON_FLG_HT_OPERATING_MODE_POS (23) -/*yshevet - bug fix */ -#define RXON_FLG_HT_PROT_MSK 0x800000 -#define RXON_FLG_FAT_PROT_MSK 0x1000000 + +#define RXON_FLG_HT_PROT_MSK __constant_cpu_to_le32(0x1<<23) +#define RXON_FLG_FAT_PROT_MSK __constant_cpu_to_le32(0x2<<23)#define RXON_FLG_CHANNEL_MODE_POS (25) -#define RXON_FLG_CHANNEL_MODE_MSK 0x06000000 -#define RXON_FLG_CHANNEL_MODE_LEGACY_MSK 0x00000000 -#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK 0x02000000 -#define RXON_FLG_CHANNEL_MODE_MIXED_MSK 0x04000000 +#define RXON_FLG_CHANNEL_MODE_MSK __constant_cpu_to_le32(0x3<<25) +#define RXON_FLG_CHANNEL_MODE_LEGACY_MSK __constant_cpu_to_le32(0x0<<25) +#define RXON_FLG_CHANNEL_MODE_PURE_40_MSK __constant_cpu_to_le32(0x1<<25) +#define RXON_FLG_CHANNEL_MODE_MIXED_MSK __constant_cpu_to_le32(0x2<<25)#define RXON_RX_CHAIN_DRIVER_FORCE_MSK __constant_cpu_to_le16(0x1<<0)#define RXON_RX_CHAIN_VALID_MSK __constant_cpu_to_le16(0x7<<1)
drivers/net/wireless/iwl-4965.c +6 -4
@@ -79,7 +79,7 @@ const struct iwl_rate_info iwl_rates[IWL_RATE_COUNT] = { IWL_DECLARE_RATE_INFO(60, 60, 48, INV, 48, INV, 48, INV),/* 60mbps */ }; -static int is_fat_channel (u32 rxon_flags) +static int is_fat_channel (__le32 rxon_flags) {return (rxon_flags &RXON_FLG_CHANNEL_MODE_PURE_40_MSK ) || (rxon_flags &RXON_FLG_CHANNEL_MODE_MIXED_MSK );
@@ -2859,12 +2859,14 @@ void iwl4965_set_rxon_chain(struct iwl_priv *priv)* Just after first association, iwl4965_noise_calibration() * checks which antennas actually *are* connected. */ priv->staging_rxon.rx_chain |= - (priv->valid_antenna <<RXON_RX_CHAIN_VALID_POS ); +cpu_to_le16 (priv->valid_antenna <<RXON_RX_CHAIN_VALID_POS );/* How many receivers should we use? */ iwl4965_get_rx_chain_counter (priv, &idle_state, &rx_state); - priv->staging_rxon.rx_chain |= (rx_state <<RXON_RX_CHAIN_MIMO_CNT_POS ); - priv->staging_rxon.rx_chain |= (idle_state <<RXON_RX_CHAIN_CNT_POS ); + priv->staging_rxon.rx_chain |= +cpu_to_le16 (rx_state <<RXON_RX_CHAIN_MIMO_CNT_POS ); + priv->staging_rxon.rx_chain |= +cpu_to_le16 (idle_state <<RXON_RX_CHAIN_CNT_POS );if (!is_single && !(priv->status &STATUS_POWER_PMI ) && (rx_state >=2 )) priv->staging_rxon.rx_chain |=RXON_RX_CHAIN_MIMO_FORCE_MSK ;
Signature · 1 line
1.5.2
PATCH 16/28 iwlwifi: Endianity fix for beacon host command
From: Tomas Winkler <[email protected]>
This patch fixes endianity issues in beacon host command
--- drivers/net/wireless/iwl-3945.c | 9 +++++---- drivers/net/wireless/iwl-4965.c | 9 +++++---- drivers/net/wireless/iwl-base.c | 8 +++++--- drivers/net/wireless/iwlwifi.h | 8 ++++---- 4 files changed, 19 insertions(+), 15 deletions(-)
drivers/net/wireless/iwl-3945.c +5 -4
@@ -2232,24 +2232,25 @@ int iwl_hw_set_hw_setting(struct iwl_priv *priv)return 0 ; } -int iwl_hw_get_beacon_cmd (struct iwl_priv *priv, +unsigned int iwl_hw_get_beacon_cmd (struct iwl_priv *priv,struct iwl_frame *frame,u8 rate) {struct iwl_tx_beacon_cmd *tx_beacon_cmd; -int frame_size; +unsigned int frame_size; tx_beacon_cmd = (struct iwl_tx_beacon_cmd *)&frame->u;memset (tx_beacon_cmd,0 ,sizeof (*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id =IWL_BROADCAST_ID ; - tx_beacon_cmd->tx.stop_time.life_time =0xFFFFFFFF ; + tx_beacon_cmd->tx.stop_time.life_time =TX_CMD_LIFE_TIME_INFINITE ; frame_size =iwl_fill_beacon_frame (priv, tx_beacon_cmd->frame,BROADCAST_ADDR ,sizeof (frame->u) -sizeof (*tx_beacon_cmd)); - tx_beacon_cmd->tx.len = frame_size; +BUG_ON (frame_size >MAX_MPDU_SIZE ); + tx_beacon_cmd->tx.len =cpu_to_le16 ((u16 )frame_size); tx_beacon_cmd->tx.rate = rate; tx_beacon_cmd->tx.tx_flags = (TX_CMD_FLG_SEQ_CTL_MSK |
drivers/net/wireless/iwl-4965.c +5 -4
@@ -2695,24 +2695,25 @@ int iwl_hw_get_temperature(struct iwl_priv *priv)return priv->temperature; } -int iwl_hw_get_beacon_cmd (struct iwl_priv *priv, +unsigned int iwl_hw_get_beacon_cmd (struct iwl_priv *priv,struct iwl_frame *frame,u8 rate) {struct iwl_tx_beacon_cmd *tx_beacon_cmd; -int frame_size; +unsigned int frame_size; tx_beacon_cmd = &frame->u.beacon;memset (tx_beacon_cmd,0 ,sizeof (*tx_beacon_cmd)); tx_beacon_cmd->tx.sta_id =IWL_BROADCAST_ID ; - tx_beacon_cmd->tx.stop_time.life_time =0xFFFFFFFF ; + tx_beacon_cmd->tx.stop_time.life_time =TX_CMD_LIFE_TIME_INFINITE ; frame_size =iwl_fill_beacon_frame (priv, tx_beacon_cmd->frame,BROADCAST_ADDR ,sizeof (frame->u) -sizeof (*tx_beacon_cmd)); - tx_beacon_cmd->tx.len = frame_size; +BUG_ON (frame_size >MAX_MPDU_SIZE ); + tx_beacon_cmd->tx.len =cpu_to_le16 ((u16 )frame_size);if ((rate ==IWL_RATE_1M_PLCP ) || (rate >=IWL_RATE_2M_PLCP )) tx_beacon_cmd->tx.rate_n_flags =
drivers/net/wireless/iwl-base.c +5 -3
@@ -1481,8 +1481,9 @@ static void iwl_free_frame(struct iwl_priv *priv, struct iwl_frame *frame)list_add (&frame->list, &priv->free_frames); } -int iwl_fill_beacon_frame (struct iwl_priv *priv,struct ieee80211_hdr *hdr, -const u8 *dest,int left) +unsigned int iwl_fill_beacon_frame (struct iwl_priv *priv, +struct ieee80211_hdr *hdr, +const u8 *dest,int left) { if (!iwl_is_associated(priv) || !priv->ibss_beacon ||
@@ -1501,7 +1502,8 @@ int iwl_fill_beacon_frame(struct iwl_priv *priv, struct ieee80211_hdr *hdr,static int iwl_send_beacon_cmd (struct iwl_priv *priv) {struct iwl_frame *frame; -int frame_size, rc; +unsigned int frame_size; +int rc;u8 rate; frame =iwl_get_free_frame (priv);
drivers/net/wireless/iwlwifi.h +4 -4
@@ -630,9 +630,9 @@ extern int iwl_send_cmd_pdu(struct iwl_priv *priv, u8 id, u16 len, const void *data);extern int __must_check iwl_send_cmd (struct iwl_priv *priv,struct iwl_host_cmd *cmd); -extern int iwl_fill_beacon_frame (struct iwl_priv *priv, -struct ieee80211_hdr *hdr,const u8 *dest, -int left); +extern unsigned int iwl_fill_beacon_frame (struct iwl_priv *priv, +struct ieee80211_hdr *hdr, +const u8 *dest,int left);extern int iwl_rx_queue_update_write_ptr (struct iwl_priv *priv,struct iwl_rx_queue *q);extern int iwl_send_statistics_request (struct iwl_priv *priv);
@@ -692,7 +692,7 @@ extern int iwl_tx_queue_free_tfd(struct iwl_priv *priv, struct iwl_tx_queue *txq);extern int iwl_hw_tx_queue_init (struct iwl_priv *priv,struct iwl_tx_queue *txq); -extern int iwl_hw_get_beacon_cmd (struct iwl_priv *priv, +extern unsigned int iwl_hw_get_beacon_cmd (struct iwl_priv *priv,struct iwl_frame *frame,u8 rate);extern int iwl_hw_get_rx_read (struct iwl_priv *priv); extern void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,
Signature · 1 line
1.5.2
PATCH 17/28 iwlwifi: Endianity fix for channel number
From: Tomas Winkler <[email protected]>
This patch fixes endinaity issue for channel number. It tries to introduce some more consistency in channel number type (u16).
--- drivers/net/wireless/iwl-3945.c | 4 +--- drivers/net/wireless/iwl-4965.c | 22 ++++++++++------------ drivers/net/wireless/iwl-4965.h | 4 ++-- drivers/net/wireless/iwl-base.c | 4 ++-- drivers/net/wireless/iwl-channel.h | 2 +- drivers/net/wireless/iwlwifi.h | 2 +- 6 files changed, 17 insertions(+), 21 deletions(-)
drivers/net/wireless/iwl-3945.c +1 -3
@@ -1695,7 +1695,6 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) {struct iwl_channel_info *ch_info;s8 max_power; -u8 channel;u8 a_band;u8 i;
@@ -1713,7 +1712,6 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power)for (i =0 ; i < priv->channel_count; i++) { ch_info = &priv->channel_info[i]; a_band =is_channel_a_band (ch_info); - channel = ch_info->channel;/* find minimum power of all user and regulatory constraints * (does not consider h/w clipping limitations) */
@@ -1736,7 +1734,7 @@ int iwl_hw_reg_set_txpower(struct iwl_priv *priv, s8 power) }/* will add 3945 channel switch cmd handling later */ -int iwl_hw_channel_switch (struct iwl_priv *priv,u8 channel) +int iwl_hw_channel_switch (struct iwl_priv *priv,u16 channel) {return 0 ; }
drivers/net/wireless/iwl-4965.c +10 -12
@@ -298,7 +298,7 @@ static int iwl4965_kw_alloc(struct iwl_priv *priv)#define CHECK_AND_PRINT (x) ((eeprom_ch->flags & EEPROM_CHANNEL_##x) \ ? # x " " : "") -int iwl4965_set_fat_chan_info (struct iwl_priv *priv,int phymode,int channel, +int iwl4965_set_fat_chan_info (struct iwl_priv *priv,int phymode,u16 channel,const struct iwl_eeprom_channel *eeprom_ch,u8 fat_extension_channel) {
@@ -1878,7 +1878,7 @@ static s32 iwl4965_get_voltage_compensation(s32 eeprom_voltage, }static const struct iwl_channel_info * -iwl4965_get_channel_txpower_info (struct iwl_priv *priv,u8 phymode,u8 channel) +iwl4965_get_channel_txpower_info (struct iwl_priv *priv,u8 phymode,u16 channel) {const struct iwl_channel_info *ch_info;
@@ -1890,7 +1890,7 @@ iwl4965_get_channel_txpower_info(struct iwl_priv *priv, u8 phymode, u8 channel)return ch_info; } -static s32 iwl4965_get_tx_atten_grp (u32 channel) +static s32 iwl4965_get_tx_atten_grp (u16 channel) {if (channel >=CALIB_IWL_TX_ATTEN_GR5_FCH && channel <=CALIB_IWL_TX_ATTEN_GR5_LCH )
@@ -2277,7 +2277,7 @@ static const struct gain_entry gain_table[2][108] = { } }; -static int iwl4965_fill_txpower_tbl (struct iwl_priv *priv,u8 band,u8 channel, +static int iwl4965_fill_txpower_tbl (struct iwl_priv *priv,u8 band,u16 channel,u8 is_fat,u8 ctrl_chan_high,struct iwl_tx_power_db *tx_power_tbl) {
@@ -2549,7 +2549,6 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)struct iwl_tx_power_table_cmd cmd = {0 };int rc =0 ;u8 band =0 ; -u8 channel =0 ;u8 is_fat =0 ;u8 ctrl_chan_high =0 ;
@@ -2565,8 +2564,6 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) (priv->phymode ==MODE_IEEE80211G ) || (priv->phymode == MODE_ATHEROS_TURBOG)) ? 1 : 0; - channel = priv->active_rxon.channel; - is_fat =is_fat_channel (priv->active_rxon.flags); if (is_fat &&
@@ -2574,11 +2571,12 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv) ctrl_chan_high =1 ; cmd.band = band; - cmd.channel = channel; + cmd.channel = priv->active_rxon.channel; cmd.channel_normal_width =0 ; - rc =iwl4965_fill_txpower_tbl (priv, band, channel, is_fat, - ctrl_chan_high, &cmd.tx_power); + rc =iwl4965_fill_txpower_tbl (priv, band, +le32_to_cpu (priv->active_rxon.channel), + is_fat, ctrl_chan_high, &cmd.tx_power);if (rc)return rc;
@@ -2586,7 +2584,7 @@ int iwl_hw_reg_send_txpower(struct iwl_priv *priv)return rc; } -int iwl_hw_channel_switch (struct iwl_priv *priv,u8 channel) +int iwl_hw_channel_switch (struct iwl_priv *priv,u16 channel) {int rc;u8 band =0 ;
@@ -4404,7 +4402,7 @@ void iwl4965_add_station(struct iwl_priv *priv, const u8 *addr, int is_ap)#ifdef CONFIG_IWLWIFI_HT static u8 iwl_is_channel_extension (struct iwl_priv *priv,int phymode, -int channel,u8 extension_chan_offset) +u16 channel,u8 extension_chan_offset) {const struct iwl_channel_info *ch_info;
drivers/net/wireless/iwl-4965.h +2 -2
@@ -63,7 +63,7 @@ static inline void iwl4965_chain_noise_reset(struct iwl_priv *priv) {}static inline void iwl4965_init_sensitivity (struct iwl_priv *priv,u8 flags,u8 force) {}static inline int iwl4965_set_fat_chan_info (struct iwl_priv *priv,int phymode, -int channel, +u16 channel,const struct iwl_eeprom_channel *eeprom_ch,u8 fat_extension_channel) {return 0 ; }static inline void iwl4965_rf_kill_ct_config (struct iwl_priv *priv) {}
@@ -98,7 +98,7 @@ extern void iwl4965_chain_noise_reset(struct iwl_priv *priv);extern void iwl4965_init_sensitivity (struct iwl_priv *priv,u8 flags,u8 force);extern int iwl4965_set_fat_chan_info (struct iwl_priv *priv,int phymode, -int channel, +u16 channel,const struct iwl_eeprom_channel *eeprom_ch,u8 fat_extension_channel);extern void iwl4965_rf_kill_ct_config (struct iwl_priv *priv);
drivers/net/wireless/iwl-base.c +2 -2
@@ -5314,7 +5314,7 @@ static void iwl_init_band_reference(const struct iwl_priv *priv, int band, }const struct iwl_channel_info *iwl_get_channel_info (const struct iwl_priv *priv, -int phymode,int channel) +int phymode,u16 channel) {int i;
@@ -8503,7 +8503,7 @@ static ssize_t store_measurement(struct device *d, {struct iwl_priv *priv =dev_get_drvdata (d);struct ieee80211_measurement_params params = { - .channel = priv->active_rxon.channel, + .channel =le16_to_cpu (priv->active_rxon.channel), .start_time = priv->last_tsf, .duration =1 , };
drivers/net/wireless/iwl-channel.h +1 -1
@@ -158,6 +158,6 @@ static inline int is_channel_ibss(const struct iwl_channel_info *ch) }extern const struct iwl_channel_info *iwl_get_channel_info ( -const struct iwl_priv *priv,int phymode,int channel); +const struct iwl_priv *priv,int phymode,u16 channel);#endif
drivers/net/wireless/iwlwifi.h +1 -1
@@ -717,6 +717,6 @@ extern int iwl4965_get_temperature(const struct iwl_priv *priv);*/ extern u8 iwl_hw_find_station (struct iwl_priv *priv,const u8 *bssid); -extern int iwl_hw_channel_switch (struct iwl_priv *priv,u8 channel); +extern int iwl_hw_channel_switch (struct iwl_priv *priv,u16 channel);extern int iwl_tx_queue_reclaim (struct iwl_priv *priv,int txq_id,int index);#endif
Signature · 1 line
1.5.2
PATCH 18/28 iwlwifi: shorten more function names
--- drivers/net/wireless/iwl-3945.c | 8 ++++---- drivers/net/wireless/iwl-4965.c | 8 ++++---- drivers/net/wireless/iwl-base.c | 10 +++++----- drivers/net/wireless/iwlwifi.h | 9 +++------ 4 files changed, 16 insertions(+), 19 deletions(-)
drivers/net/wireless/iwl-3945.c +4 -4
@@ -490,8 +490,8 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, } } -int iwl_hw_tx_queue_attach_buffer_to_tfd (struct iwl_priv *priv, -void *ptr,dma_addr_t addr,u16 len) +int iwl_hw_txq_attach_buf_to_tfd (struct iwl_priv *priv,void *ptr, +dma_addr_t addr,u16 len) {int count;u32 pad;
@@ -518,11 +518,11 @@ int iwl_hw_tx_queue_attach_buffer_to_tfd(struct iwl_priv *priv, }/** -* iwl_hw_tx_queue_free_tfd - Free one TFD, those at index [txq->q.last_used] +* iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.last_used] * * Does NOT advance any indexes */ -int iwl_hw_tx_queue_free_tfd (struct iwl_priv *priv,struct iwl_tx_queue *txq) +int iwl_hw_txq_free_tfd (struct iwl_priv *priv,struct iwl_tx_queue *txq) {struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0 ];struct iwl_tfd_frame *bd = &bd_tmp[txq->q.last_used];
drivers/net/wireless/iwl-4965.c +4 -4
@@ -1762,11 +1762,11 @@ void iwl_hw_txq_ctx_free(struct iwl_priv *priv) }/** -* iwl_hw_tx_queue_free_tfd - Free one TFD, those at index [txq->q.last_used] +* iwl_hw_txq_free_tfd - Free one TFD, those at index [txq->q.last_used] * * Does NOT advance any indexes */ -int iwl_hw_tx_queue_free_tfd (struct iwl_priv *priv,struct iwl_tx_queue *txq) +int iwl_hw_txq_free_tfd (struct iwl_priv *priv,struct iwl_tx_queue *txq) {struct iwl_tfd_frame *bd_tmp = (struct iwl_tfd_frame *)&txq->bd[0 ];struct iwl_tfd_frame *bd = &bd_tmp[txq->q.last_used];
@@ -2754,8 +2754,8 @@ static inline u8 iwl4965_get_dma_hi_address(dma_addr_t addr)return sizeof (addr) >sizeof (u32) ? (addr >>16 ) >>16 :0 ; } -int iwl_hw_tx_queue_attach_buffer_to_tfd (struct iwl_priv *priv, -void *ptr,dma_addr_t addr,u16 len) +int iwl_hw_txq_attach_buf_to_tfd (struct iwl_priv *priv,void *ptr, +dma_addr_t addr,u16 len) {int index, is_odd;struct iwl_tfd_frame *tfd = ptr;
drivers/net/wireless/iwl-base.c +5 -5
@@ -308,7 +308,7 @@ void iwl_tx_queue_free(struct iwl_priv *priv, struct iwl_tx_queue *txq)/* first, empty all BD's */ for (; q->first_empty != q->last_used; q->last_used =iwl_queue_inc_wrap (q->last_used, q->n_bd)) -iwl_hw_tx_queue_free_tfd (priv, txq); +iwl_hw_txq_free_tfd (priv, txq); len =sizeof (struct iwl_cmd ) * q->n_window;if (q->id ==IWL_CMD_QUEUE_NUM );
@@ -622,7 +622,7 @@ static int iwl_enqueue_hcmd(struct iwl_priv *priv, struct iwl_host_cmd *cmd) phys_addr = txq->dma_addr_cmd +sizeof (txq->cmd[0 ]) * idx + offsetof(struct iwl_cmd , hdr); -iwl_hw_tx_queue_attach_buffer_to_tfd (priv, tfd, phys_addr, fix_size); +iwl_hw_txq_attach_buf_to_tfd (priv, tfd, phys_addr, fix_size);#if IWL ==3945 pad =U32_PAD (out_cmd->meta.len);
@@ -2913,7 +2913,7 @@ static int iwl_tx_skb(struct iwl_priv *priv, txcmd_phys = txq->dma_addr_cmd +sizeof (struct iwl_cmd ) * idx + offsetof(struct iwl_cmd , hdr); -iwl_hw_tx_queue_attach_buffer_to_tfd (priv, tfd, txcmd_phys, len); +iwl_hw_txq_attach_buf_to_tfd (priv, tfd, txcmd_phys, len);if (ctl->key_idx !=-1 )iwl_build_tx_cmd_hwcrypto (priv, ctl, out_cmd, skb,0 );
@@ -2923,7 +2923,7 @@ static int iwl_tx_skb(struct iwl_priv *priv,if (len) { phys_addr =pci_map_single (priv->pci_dev, skb->data + hdr_len, len,PCI_DMA_TODEVICE ); -iwl_hw_tx_queue_attach_buffer_to_tfd (priv, tfd, phys_addr, len); +iwl_hw_txq_attach_buf_to_tfd (priv, tfd, phys_addr, len); }#if IWL ==3945
@@ -3477,7 +3477,7 @@ int iwl_tx_queue_reclaim(struct iwl_priv *priv, int txq_id, int index)if (txq_id !=IWL_CMD_QUEUE_NUM ) {iwl_txstatus_to_ieee (priv, &(txq->txb[txq->q.last_used])); -iwl_hw_tx_queue_free_tfd (priv, txq); +iwl_hw_txq_free_tfd (priv, txq); }else is_next =1 ; }
drivers/net/wireless/iwlwifi.h +3 -6
@@ -683,13 +683,10 @@ extern int iwl_hw_nic_stop_master(struct iwl_priv *priv);extern void iwl_hw_txq_ctx_free (struct iwl_priv *priv);extern void iwl_hw_txq_ctx_stop (struct iwl_priv *priv);extern int iwl_hw_nic_reset (struct iwl_priv *priv); -extern int iwl_hw_tx_queue_attach_buffer_to_tfd ( -struct iwl_priv *priv,void *tfd,dma_addr_t addr,u16 len); -extern int iwl_hw_tx_queue_free_tfd (struct iwl_priv *priv, -struct iwl_tx_queue *txq); +extern int iwl_hw_txq_attach_buf_to_tfd (struct iwl_priv *priv,void *tfd, +dma_addr_t addr,u16 len); +extern int iwl_hw_txq_free_tfd (struct iwl_priv *priv,struct iwl_tx_queue *txq);extern int iwl_hw_get_temperature (struct iwl_priv *priv); -extern int iwl_tx_queue_free_tfd (struct iwl_priv *priv, -struct iwl_tx_queue *txq);extern int iwl_hw_tx_queue_init (struct iwl_priv *priv,struct iwl_tx_queue *txq); extern unsigned int iwl_hw_get_beacon_cmd(struct iwl_priv *priv,
Signature · 1 line
1.5.2
PATCH 19/28 iwlwifi: make iwl_get_bits inline function from macro
Make iwl_get_bits and iwl_set_bits inline functions from the original macro implementation. Add IWL_SET_BITS16 for 16-bits value setting.
--- drivers/net/wireless/iwl-4965.c | 6 ++-- drivers/net/wireless/iwl-helpers.h | 53 +++++++++++++++++++++--------------- 2 files changed, 34 insertions(+), 25 deletions(-)
drivers/net/wireless/iwl-4965.c +3 -3
@@ -2815,11 +2815,11 @@ int iwl4965_tx_queue_update_wr_ptr(struct iwl_priv *priv, len = byte_cnt +IWL_TX_CRC_SIZE +IWL_TX_DELIMITER_SIZE ; -IWL_SET_BITS (shared_data->queues_byte_cnt_tbls[txq_id]. - tfd_offset[txq->q.first_empty], byte_cnt, len); +IWL_SET_BITS16 (shared_data->queues_byte_cnt_tbls[txq_id]. + tfd_offset[txq->q.first_empty], byte_cnt, len);if (txq->q.first_empty <IWL4965_MAX_WIN_SIZE ) -IWL_SET_BITS (shared_data->queues_byte_cnt_tbls[txq_id]. +IWL_SET_BITS16 (shared_data->queues_byte_cnt_tbls[txq_id]. tfd_offset[IWL4965_QUEUE_SIZE + txq->q.first_empty], byte_cnt, len);
drivers/net/wireless/iwl-helpers.h +31 -22
75 lines not on this page · raw message
Signature · 1 line
1.5.2
PATCH 20/28 iwlwifi: remove BIT_FMT and BIT_ARG
--- drivers/net/wireless/iwl-3945.c | 8 +++----- drivers/net/wireless/iwl-4965.c | 15 ++++++--------- drivers/net/wireless/iwl-base.c | 24 +++++++++--------------- drivers/net/wireless/iwl-helpers.h | 25 ++----------------------- 4 files changed, 20 insertions(+), 52 deletions(-)
drivers/net/wireless/iwl-3945.c +3 -5
@@ -659,11 +659,9 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,/* CCK */ cmd->cmd.tx.supp_rates[1 ] = (rate_mask >>8 ) &0xF ; -IWL_DEBUG_RATE ("Tx sta id: %d, rate: %d (plcp), flags: " BIT_FMT16 " " -"cck/ofdm mask: 0x%x/0x%x\n" , - sta_id, - cmd->cmd.tx.rate, -BIT_ARG16 (le32_to_cpu (cmd->cmd.tx.tx_flags)), +IWL_DEBUG_RATE ("Tx sta id: %d, rate: %d (plcp), flags: 0x%4X " +"cck/ofdm mask: 0x%x/0x%x\n" , sta_id, + cmd->cmd.tx.rate,le32_to_cpu (cmd->cmd.tx.tx_flags), cmd->cmd.tx.supp_rates[1 ], cmd->cmd.tx.supp_rates[0 ]); }
drivers/net/wireless/iwl-4965.c +6 -9
@@ -310,7 +310,7 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel,if (!is_channel_valid (ch_info))return -1 ; - IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(" BIT_FMT8 + IWL_DEBUG_INFO("FAT Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" " %ddBm): Ad-Hoc %ssupported\n", ch_info->channel, is_channel_a_band(ch_info) ?
@@ -321,14 +321,11 @@ int iwl4965_set_fat_chan_info(struct iwl_priv *priv, int phymode, u16 channel,CHECK_AND_PRINT (WIDE ),CHECK_AND_PRINT (NARROW ),CHECK_AND_PRINT (DFS ), -BIT_ARG8 (eeprom_ch->flags), - eeprom_ch-> - max_power_avg, - ((eeprom_ch-> - flags &EEPROM_CHANNEL_IBSS ) - && !(eeprom_ch-> - flags &EEPROM_CHANNEL_RADAR )) - ? "" : "not "); + eeprom_ch->flags, + eeprom_ch->max_power_avg, + ((eeprom_ch->flags &EEPROM_CHANNEL_IBSS ) + && !(eeprom_ch->flags &EEPROM_CHANNEL_RADAR )) ? + "" : "not "); ch_info->fat_eeprom = *eeprom_ch; ch_info->fat_max_power_avg = eeprom_ch->max_power_avg;
drivers/net/wireless/iwl-base.c +9 -15
@@ -4702,18 +4702,13 @@ static void iwl_print_rx_config_cmd(struct iwl_rxon_cmd *rxon)IWL_DEBUG_RADIO ("RX CONFIG:\n" );printk_buf (IWL_DL_RADIO , (u8 *) rxon,sizeof (*rxon));IWL_DEBUG_RADIO ("u16 channel: 0x%x\n" ,le16_to_cpu (rxon->channel)); -IWL_DEBUG_RADIO ("u32 flags: 0x%08X " BIT_FMT32 "\n" , -le32_to_cpu (rxon->flags), -BIT_ARG32 (le32_to_cpu (rxon->flags))); -IWL_DEBUG_RADIO ("u32 filter_flags: 0x%08x " BIT_FMT32 "\n" , -le32_to_cpu (rxon->filter_flags), -BIT_ARG32 (le32_to_cpu (rxon->filter_flags))); +IWL_DEBUG_RADIO ("u32 flags: 0x%08X\n" ,le32_to_cpu (rxon->flags)); +IWL_DEBUG_RADIO ("u32 filter_flags: 0x%08x\n" , +le32_to_cpu (rxon->filter_flags));IWL_DEBUG_RADIO ("u8 dev_type: 0x%x\n" , rxon->dev_type); -IWL_DEBUG_RADIO ("u8 ofdm_basic_rates: 0x%02x " BIT_FMT8 "\n" , - rxon->ofdm_basic_rates, -BIT_ARG8 (rxon->ofdm_basic_rates)); -IWL_DEBUG_RADIO ("u8 cck_basic_rates: 0x%02x " BIT_FMT8 "\n" , - rxon->cck_basic_rates,BIT_ARG8 (rxon->cck_basic_rates)); +IWL_DEBUG_RADIO ("u8 ofdm_basic_rates: 0x%02x\n" , + rxon->ofdm_basic_rates); +IWL_DEBUG_RADIO ("u8 cck_basic_rates: 0x%02x\n" , rxon->cck_basic_rates);IWL_DEBUG_RADIO ("u8[6] node_addr: " MAC_FMT "\n" ,MAC_ARG (rxon->node_addr)); IWL_DEBUG_RADIO("u8[6] bssid_addr: " MAC_FMT "\n",
@@ -5421,7 +5416,7 @@ static int iwl_init_channel_map(struct iwl_priv *priv) ch_info->scan_power = eeprom_ch_info[ch].max_power_avg; ch_info->min_power =0 ; - IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(" BIT_FMT8 + IWL_DEBUG_INFO("Ch. %d [%sGHz] %s%s%s%s%s%s(0x%02x" " %ddBm): Ad-Hoc %ssupported\n", ch_info->channel, is_channel_a_band(ch_info) ?
@@ -5432,9 +5427,8 @@ static int iwl_init_channel_map(struct iwl_priv *priv)CHECK_AND_PRINT (WIDE ),CHECK_AND_PRINT (NARROW ),CHECK_AND_PRINT (DFS ), -BIT_ARG8 (eeprom_ch_info[ch].flags), - eeprom_ch_info[ch]. - max_power_avg, + eeprom_ch_info[ch].flags, + eeprom_ch_info[ch].max_power_avg, ((eeprom_ch_info[ch]. flags & EEPROM_CHANNEL_IBSS) && !(eeprom_ch_info[ch].
drivers/net/wireless/iwl-helpers.h +2 -23
@@ -85,14 +85,14 @@ static inline void iwl_set_bits(__le32 *dst, u8 pos, u8 len, int val) {u32 tmp =le32_to_cpu (*dst); - tmp &= ~((1UL << (pos + len)) - (1UL << pos)); + tmp &= ~(((1UL << len) -1 ) << pos); tmp |= (val & ((1UL << len) -1 )) << pos; *dst =cpu_to_le32 (tmp); }static inline void iwl_set_bits16 (__le16 *dst,u8 pos,u8 len,int val) { -u32 tmp =le16_to_cpu (*dst); +u16 tmp =le16_to_cpu (*dst); tmp &= ~((1UL << (pos + len)) - (1UL << pos)); tmp |= (val & ((1UL << len) -1 )) << pos;
@@ -133,27 +133,6 @@ static inline void iwl_set_bits16(__le16 *dst, u8 pos, u8 len, int val) iwl_get_bits((s).IWL_ ## sym ## _SYM, IWL_ ## sym ## _POS, \ IWL_ ## sym ## _LEN) -/* Debug and printf string expansion helpers for printing bitfields */ -#define BIT_FMT8 "%c%c%c%c-%c%c%c%c" -#define BIT_FMT16 BIT_FMT8 ":" BIT_FMT8 -#define BIT_FMT32 BIT_FMT16 " " BIT_FMT16 - -#define BITC (x, y) (((x>>y) & 1) ? '1' : '0') -#define BIT_ARG8 (x) \ -BITC(x, 7), BITC(x, 6), BITC(x, 5), BITC(x, 4), \ -BITC(x, 3), BITC(x, 2), BITC(x, 1), BITC(x, 0) - -#define BIT_ARG16 (x) \ -BITC(x, 15), BITC(x, 14), BITC(x, 13), BITC(x, 12), \ -BITC(x, 11), BITC(x, 10), BITC(x, 9), BITC(x, 8), \ -BIT_ARG8(x) - -#define BIT_ARG32 (x) \ -BITC(x, 31), BITC(x, 30), BITC(x, 29), BITC(x, 28), \ -BITC(x, 27), BITC(x, 26), BITC(x, 25), BITC(x, 24), \ -BITC(x, 23), BITC(x, 22), BITC(x, 21), BITC(x, 20), \ -BITC(x, 19), BITC(x, 18), BITC(x, 17), BITC(x, 16), \ -BIT_ARG16(x)#define KELVIN_TO_CELSIUS (x) ((x)-273)#define CELSIUS_TO_KELVIN (x) ((x)+273)
Signature · 1 line
1.5.2
PATCH 21/28 iwlwifi: remove WLAN_FC_GET_TYPE macros
Use IEEE80211_FCTL_FTYPE directly. Also make some inline function unlined.
--- drivers/net/wireless/iwl-3945.c | 9 ++- drivers/net/wireless/iwl-4965.c | 14 +++-- drivers/net/wireless/iwl-base.c | 78 ++++++++++++++++++++--- drivers/net/wireless/iwl-helpers.h | 122 ++++++++---------------------------- drivers/net/wireless/iwlwifi.h | 1 + 5 files changed, 111 insertions(+), 113 deletions(-)
drivers/net/wireless/iwl-3945.c +5 -4
@@ -395,9 +395,10 @@ static void iwl3945_rx_reply_rx(struct iwl_priv *priv, priv->last_rx_noise = stats.noise; } -switch (WLAN_FC_GET_TYPE (le16_to_cpu (header->frame_control))) { +switch (le16_to_cpu (header->frame_control) &IEEE80211_FCTL_FTYPE ) {case IEEE80211_FTYPE_MGMT : -switch (WLAN_FC_GET_STYPE (le16_to_cpu (header->frame_control))) { +switch (le16_to_cpu (header->frame_control) & +IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_PROBE_RESP :case IEEE80211_STYPE_BEACON :{/* If this is a beacon or probe response for
@@ -632,8 +633,8 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,if (priv->data_retry_limit !=-1 ) data_retry_limit = priv->data_retry_limit; -if (WLAN_FC_GET_TYPE (fc) ==IEEE80211_FTYPE_MGMT ) { -switch (WLAN_FC_GET_STYPE (fc)) { +if ((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_MGMT ) { +switch (fc &IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_AUTH :case IEEE80211_STYPE_DEAUTH :case IEEE80211_STYPE_ASSOC_REQ :
drivers/net/wireless/iwl-4965.c +8 -6
@@ -2655,8 +2655,10 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,if (priv->data_retry_limit !=-1 ) data_retry_limit = priv->data_retry_limit; -if (WLAN_FC_GET_TYPE (hdr->frame_control) ==IEEE80211_FTYPE_MGMT ) { -switch (WLAN_FC_GET_STYPE (hdr->frame_control)) { +if ((le16_to_cpu (hdr->frame_control) &IEEE80211_FCTL_FTYPE ) + ==IEEE80211_FTYPE_MGMT ) { +switch (le16_to_cpu (hdr->frame_control) & +IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_AUTH :case IEEE80211_STYPE_DEAUTH :case IEEE80211_STYPE_ASSOC_REQ :
@@ -3233,7 +3235,7 @@ int iwl4965_tx_cmd(struct iwl_priv *priv, struct iwl_cmd *out_cmd, unicast = !is_multicast_ether_addr (hdr->addr1); fc =le16_to_cpu (hdr->frame_control); -if (WLAN_FC_GET_TYPE (fc) !=IEEE80211_FTYPE_DATA ) +if ((fc &IEEE80211_FCTL_FTYPE ) !=IEEE80211_FTYPE_DATA ) is_data =0 ;memcpy (&cmd, &(out_cmd->cmd.tx),sizeof (struct iwl_tx_cmd ));
@@ -3896,13 +3898,13 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv, } fc =le16_to_cpu (header->frame_control); -switch (WLAN_FC_GET_TYPE (fc)) { +switch (fc &IEEE80211_FCTL_FTYPE ) {case IEEE80211_FTYPE_MGMT :if (priv->iw_mode ==IEEE80211_IF_TYPE_AP )iwl4965_update_ps_mode (priv, fc &IEEE80211_FCTL_PM , header->addr2); -switch (WLAN_FC_GET_STYPE (fc)) { +switch (fc &IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_PROBE_RESP :case IEEE80211_STYPE_BEACON : if ((priv->iw_mode == IEEE80211_IF_TYPE_STA &&
@@ -3990,7 +3992,7 @@ static void iwl4965_rx_reply_rx(struct iwl_priv *priv,case IEEE80211_FTYPE_CTL :#ifdef CONFIG_IWLWIFI_HT_AGG -switch (WLAN_FC_GET_STYPE (fc)) { +switch (fc &IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_BACK_REQ :IWL_DEBUG_HT ("IEEE80211_STYPE_BACK_REQ arrived\n" ); iwl4965_handle_data_packet(priv, 0, include_phy,
drivers/net/wireless/iwl-base.c +70 -8
114 lines not on this page · raw message
drivers/net/wireless/iwl-helpers.h +27 -95
204 lines not on this page · raw message
drivers/net/wireless/iwlwifi.h +1 -0
@@ -639,6 +639,7 @@ extern int iwl_send_statistics_request(struct iwl_priv *priv);extern void iwl_set_decrypted_flag (struct iwl_priv *priv,struct sk_buff *skb,u32 decrypt_res,struct ieee80211_rx_status *stats); +extern __le16 *ieee80211_get_qos_ctrl (struct ieee80211_hdr *hdr);extern const u8 BROADCAST_ADDR [ETH_ALEN ];
Signature · 1 line
1.5.2
PATCH 22/28 iwlwifi: replace private snprint_line with common hex_dump_xxx
--- drivers/net/wireless/iwl-base.c | 45 ++++++++++++++++++++++++----------- drivers/net/wireless/iwl-helpers.h | 21 ---------------- 2 files changed, 31 insertions(+), 35 deletions(-)
drivers/net/wireless/iwl-base.c +31 -14
@@ -184,6 +184,23 @@ static const char *iwl_escape_essid(const char *essid, u8 essid_len)return escaped; } +static void iwl_print_hex_dump (int level,void *p,u32 len) +{ +#ifdef CONFIG_IWLWIFI_DEBUG +u32 ofs =0 ; + +if (!(iwl_debug_level & level)) +return ; + +while (len) { +print_hex_dump (KERN_DEBUG ,"iwl data: " ,DUMP_PREFIX_OFFSET , +16 ,1 , p + ofs, len,1 ); + ofs +=16 ; + len -=min (len,16U ); + } +#endif +} +/*************** DMA-QUEUE-GENERAL-FUNCTIONS ***** * DMA services *
@@ -1819,7 +1836,7 @@ void iwl_report_frame(struct iwl_priv *priv, } }if (print_dump) -printk_buf (IWL_DL_RX , data, length); +iwl_print_hex_dump (IWL_DL_RX , data, length); }#endif
@@ -2836,7 +2853,7 @@ static int iwl_get_sta_id(struct iwl_priv *priv, struct ieee80211_hdr *hdr)IWL_DEBUG_DROP ("Station " MAC_FMT " not in station map. " "Defaulting to broadcast...\n" ,MAC_ARG (hdr->addr1)); -printk_buf (IWL_DL_DROP , (u8 *) hdr,sizeof (*hdr)); +iwl_print_hex_dump (IWL_DL_DROP , (u8 *) hdr,sizeof (*hdr));return IWL_BROADCAST_ID ; }
@@ -3028,10 +3045,11 @@ static int iwl_tx_skb(struct iwl_priv *priv, txq->need_update =0 ; } -printk_buf (IWL_DL_TX , out_cmd->cmd.payload,sizeof (out_cmd->cmd.tx)); +iwl_print_hex_dump (IWL_DL_TX , out_cmd->cmd.payload, +sizeof (out_cmd->cmd.tx)); -printk_buf (IWL_DL_TX , (u8 *) out_cmd->cmd.tx.hdr, -ieee80211_get_hdrlen (fc)); +iwl_print_hex_dump (IWL_DL_TX , (u8 *)out_cmd->cmd.tx.hdr, +ieee80211_get_hdrlen (fc));iwl4965_tx_queue_update_wr_ptr (priv, txq, len);
@@ -3939,7 +3957,7 @@ static void iwl_rx_pm_debug_statistics_notif(struct iwl_priv *priv,IWL_DEBUG_RADIO ("Dumping %d bytes of unhandled " "notification for %s:\n" ,le32_to_cpu (pkt->len),get_cmd_string (pkt->hdr.cmd)); -printk_buf (IWL_DL_RADIO , pkt->u.raw,le32_to_cpu (pkt->len)); +iwl_print_hex_dump (IWL_DL_RADIO , pkt->u.raw,le32_to_cpu (pkt->len)); } static void iwl_rx_beacon_notif(struct iwl_priv *priv,
@@ -4762,7 +4780,7 @@ int iwl_tx_queue_update_write_ptr(struct iwl_priv *priv,static void iwl_print_rx_config_cmd (struct iwl_rxon_cmd *rxon) {IWL_DEBUG_RADIO ("RX CONFIG:\n" ); -printk_buf (IWL_DL_RADIO , (u8 *) rxon,sizeof (*rxon)); +iwl_print_hex_dump (IWL_DL_RADIO , (u8 *) rxon,sizeof (*rxon));IWL_DEBUG_RADIO ("u16 channel: 0x%x\n" ,le16_to_cpu (rxon->channel));IWL_DEBUG_RADIO ("u32 flags: 0x%08X\n" ,le32_to_cpu (rxon->flags)); IWL_DEBUG_RADIO("u32 filter_flags: 0x%08x\n",
@@ -8525,7 +8543,6 @@ static ssize_t show_measurement(struct device *d, {struct iwl_priv *priv =dev_get_drvdata (d);struct iwl_spectrum_notification measure_report; -u32 size =sizeof (measure_report), len =0 , ofs =0 ;u8 *data = (u8 *) & measure_report;unsigned long flags;
@@ -8540,9 +8557,9 @@ static ssize_t show_measurement(struct device *d,spin_unlock_irqrestore (&priv->lock, flags);while (size && (PAGE_SIZE - len)) { - len += -snprint_line (&buf[len],PAGE_SIZE - len, - &data[ofs],min (size,16U ), ofs); +hex_dump_to_buffer (data + ofs, size,16 ,1 , buf + len, +PAGE_SIZE - len,1 ); + len =strlen (buf);if (PAGE_SIZE - len) buf[len++] ='\n' ;
@@ -8828,9 +8845,9 @@ static ssize_t show_statistics(struct device *d, }while (size && (PAGE_SIZE - len)) { - len += -snprint_line (&buf[len],PAGE_SIZE - len, - &data[ofs],min (size,16U ), ofs); +hex_dump_to_buffer (data + ofs, size,16 ,1 , buf + len, +PAGE_SIZE - len,1 ); + len =strlen (buf);if (PAGE_SIZE - len) buf[len++] ='\n' ;
drivers/net/wireless/iwl-helpers.h +0 -21
@@ -287,25 +287,4 @@ static inline int snprint_line(char *buf, size_t count, return out; } -#ifdef CONFIG_IWLWIFI_DEBUG -static inline void printk_buf (int level,const void *p,u32 len) -{ -const u8 *data = p; -char line[81 ]; -u32 ofs =0 ; -if (!(iwl_debug_level & level)) -return ; - -while (len) { -snprint_line (line,sizeof (line), &data[ofs], -min (len,16U ), ofs); -printk (KERN_DEBUG "%s\n" , line); - ofs +=16 ; - len -=min (len,16U ); - } -} -#else -#define printk_buf (level, p, len) do {} while (0) -#endif -#endif /* __iwl_helpers_h__ */
Signature · 1 line
1.5.2
PATCH 23/28 iwlwifi: Endianity fix for frame control
From: Tomas Winkler <[email protected]>
This patch fixes endianity issue for frame control field in iwl_hw_build_tx_cmd_rate function. In addition it converts frame_ctl to fc to align name convention in driver.
--- drivers/net/wireless/iwl-4965.c | 9 ++++----- drivers/net/wireless/iwl-base.c | 28 ++++++++++++++-------------- 2 files changed, 18 insertions(+), 19 deletions(-)
drivers/net/wireless/iwl-4965.c +4 -5
@@ -2637,6 +2637,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,u8 rts_retry_limit =0 ;u8 data_retry_limit =0 ;__le32 tx_flags; +u16 fc =le16_to_cpu (hdr->frame_control); tx_flags = cmd->cmd.tx.tx_flags;
@@ -2645,7 +2646,7 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv, rts_retry_limit = (is_hcca) ?RTS_HCCA_RETRY_LIMIT :RTS_DFAULT_RETRY_LIMIT ; -if (ieee80211_is_probe_response (hdr->frame_control)) { +if (ieee80211_is_probe_response (fc)) { data_retry_limit =3 ;if (data_retry_limit < rts_retry_limit) rts_retry_limit = data_retry_limit;
@@ -2655,10 +2656,8 @@ void iwl_hw_build_tx_cmd_rate(struct iwl_priv *priv,if (priv->data_retry_limit !=-1 ) data_retry_limit = priv->data_retry_limit; -if ((le16_to_cpu (hdr->frame_control) &IEEE80211_FCTL_FTYPE ) - ==IEEE80211_FTYPE_MGMT ) { -switch (le16_to_cpu (hdr->frame_control) & -IEEE80211_FCTL_STYPE ) { +if ((fc &IEEE80211_FCTL_FTYPE ) ==IEEE80211_FTYPE_MGMT ) { +switch (fc &IEEE80211_FCTL_STYPE ) {case IEEE80211_STYPE_AUTH :case IEEE80211_STYPE_DEAUTH :case IEEE80211_STYPE_ASSOC_REQ :
drivers/net/wireless/iwl-base.c +14 -14
@@ -1718,7 +1718,7 @@ void iwl_report_frame(struct iwl_priv *priv,u32 print_dump =0 ;/* set to 1 to dump all frames' contents */ u32 hundred =0 ;u32 dataframe =0 ; -u16 frame_ctl; +u16 fc;u16 seq_ctl;u16 channel;u16 phy_flags;
@@ -1738,7 +1738,7 @@ void iwl_report_frame(struct iwl_priv *priv,u8 *data =IWL_RX_DATA (pkt);/* MAC header */ - frame_ctl =le16_to_cpu (header->frame_control); + fc =le16_to_cpu (header->frame_control); seq_ctl =le16_to_cpu (header->seq_ctrl);/* metadata */
@@ -1763,7 +1763,7 @@ void iwl_report_frame(struct iwl_priv *priv,/* if data frame is to us and all is good, * (optionally) print summary for only 1 out of every 100 */ -if (to_us && (frame_ctl & ~IEEE80211_FCTL_PROTECTED ) == +if (to_us && (fc & ~IEEE80211_FCTL_PROTECTED ) == (IEEE80211_FCTL_FROMDS |IEEE80211_FTYPE_DATA )) { dataframe =1 ;if (!group100)
@@ -1787,25 +1787,25 @@ void iwl_report_frame(struct iwl_priv *priv,if (hundred) title ="100Frames" ; -else if (frame_ctl &IEEE80211_FCTL_RETRY ) +else if (fc &IEEE80211_FCTL_RETRY ) title ="Retry" ; -else if (ieee80211_is_assoc_response (frame_ctl)) +else if (ieee80211_is_assoc_response (fc)) title ="AscRsp" ; -else if (ieee80211_is_reassoc_response (frame_ctl)) +else if (ieee80211_is_reassoc_response (fc)) title ="RasRsp" ; -else if (ieee80211_is_probe_response (frame_ctl)) { +else if (ieee80211_is_probe_response (fc)) { title ="PrbRsp" ; print_dump =1 ;/* dump frame contents */ - }else if (ieee80211_is_beacon (frame_ctl)) { + }else if (ieee80211_is_beacon (fc)) { title ="Beacon" ; print_dump =1 ;/* dump frame contents */ - }else if (ieee80211_is_atim (frame_ctl)) + }else if (ieee80211_is_atim (fc)) title ="ATIM" ; -else if (ieee80211_is_auth (frame_ctl)) +else if (ieee80211_is_auth (fc)) title ="Auth" ; -else if (ieee80211_is_deauth (frame_ctl)) +else if (ieee80211_is_deauth (fc)) title ="DeAuth" ; -else if (ieee80211_is_disassoc (frame_ctl)) +else if (ieee80211_is_disassoc (fc)) title ="DisAssoc" ;else title ="Frame" ;
@@ -1822,14 +1822,14 @@ void iwl_report_frame(struct iwl_priv *priv,if (dataframe)IWL_DEBUG_RX ("%s: mhd=0x%04x, dst=0x%02x, " "len=%u, rssi=%d, chnl=%d, rate=%u, \n" , - title, frame_ctl, header->addr1[5 ], + title, fc, header->addr1[5 ], length, rssi, channel, rate);else {/* src/dst addresses assume managed mode */ IWL_DEBUG_RX ("%s: 0x%04x, dst=0x%02x, " "src=0x%02x, rssi=%u, tim=%lu usec, " "phy=0x%02x, chnl=%d\n" , - title, frame_ctl, header->addr1[5 ], + title, fc, header->addr1[5 ], header->addr3[5 ], rssi, tsf_low - priv->scan_start_tsf, phy_flags, channel);
Signature · 1 line
1.5.2
PATCH 24/28 iwlwifi: Endianity fix for ct kill configuration
From: Tomas Winkler <[email protected]>
This patch fixes endinianity and style issuse in ct kill host command.
--- drivers/net/wireless/iwl-4965.c | 12 ++++++------ drivers/net/wireless/iwl-commands.h | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/net/wireless/iwl-4965.c +6 -6
@@ -713,8 +713,9 @@ static void iwl4965_bg_statistics_work(struct work_struct *work)void iwl4965_rf_kill_ct_config (struct iwl_priv *priv) {struct iwl_ct_kill_config cmd; -u32 R1 =0 ,R2 =0 ,R3 =0 ; -u32 temp_th =0 ; +u32 R1 ,R2 ,R3 ; +u32 temp_th; +u32 crit_temperature;unsigned long flags;int rc =0 ;
@@ -735,15 +736,14 @@ void iwl4965_rf_kill_ct_config(struct iwl_priv *priv) temp_th =CELSIUS_TO_KELVIN (TM_CT_KILL_THRESHOLD ); - cmd.critical_temperature_R = ((temp_th * (R3 -R1 ))/CT_LIMIT_CONST ) +R2 ; + crit_temperature = ((temp_th * (R3 -R1 ))/CT_LIMIT_CONST ) +R2 ; + cmd.critical_temperature_R =cpu_to_le32 (crit_temperature); rc =iwl_send_cmd_pdu (priv,REPLY_CT_KILL_CONFIG_CMD ,sizeof (cmd), &cmd);if (rc)IWL_ERROR ("REPLY_CT_KILL_CONFIG_CMD failed\n" );else -IWL_WARNING ("REPLY_CT_KILL_CONFIG_CMD succeeded\n" ); - -return ; +IWL_DEBUG_INFO ("REPLY_CT_KILL_CONFIG_CMD succeeded\n" ); }#ifdef CONFIG_IWLWIFI_SENSITIVITY
drivers/net/wireless/iwl-commands.h +3 -3
@@ -560,9 +560,9 @@ struct iwl_missed_beacon_notif { } __attribute__ ((packed));struct iwl_ct_kill_config { -u32 reserved; -u32 critical_temperature_M; -u32 critical_temperature_R; +__le32 reserved; +__le32 critical_temperature_M; +__le32 critical_temperature_R; } __attribute__ ((packed));/* * Add/Modify Station Command & Response
Signature · 1 line
1.5.2
PATCH 25/28 iwlwifi: remove unused snprint_line
--- drivers/net/wireless/iwl-helpers.h | 35 ----------------------------------- 1 files changed, 0 insertions(+), 35 deletions(-)
drivers/net/wireless/iwl-helpers.h +0 -35
@@ -252,39 +252,4 @@ static inline unsigned long elapsed_jiffies(unsigned long start, return end + (MAX_JIFFY_OFFSET - start); } -static inline int snprint_line (char *buf,size_t count, -const u8 *data,u32 len,u32 ofs) -{ -int out, i, j, l; -char c; - - out =snprintf (buf, count,"%08X" , ofs); - -for (l =0 , i =0 ; i <2 ; i++) { - out +=snprintf (buf + out, count - out," " ); -for (j =0 ; j <8 && l < len; j++, l++) - out += -snprintf (buf + out, count - out,"%02X " , - data[(i *8 + j)]); -for (; j <8 ; j++) - out +=snprintf (buf + out, count - out," " ); - } - out +=snprintf (buf + out, count - out," " ); -for (l =0 , i =0 ; i <2 ; i++) { - out +=snprintf (buf + out, count - out," " ); -for (j =0 ; j <8 && l < len; j++, l++) { - c = data[(i *8 + j)]; -if (!isascii (c) || !isprint (c)) - c ='.' ; - - out +=snprintf (buf + out, count - out,"%c" , c); - } - -for (; j <8 ; j++) - out +=snprintf (buf + out, count - out," " ); - } - -return out; -} -#endif /* __iwl_helpers_h__ */
Signature · 1 line
1.5.2
PATCH 26/28 iwlwifi: Enhance ISR/RX/CMD debug messages
From: Ben Cahill <[email protected]>
This patch enhances ISR/RX/CMD debug messages and make sure all commands are in get_cmd_string(). It also removes 2 unused commands and enhance comments.
--- drivers/net/wireless/iwl-base.c | 84 +++++++++++++++++++++++----------- drivers/net/wireless/iwl-commands.h | 5 +-- 2 files changed, 58 insertions(+), 31 deletions(-)
drivers/net/wireless/iwl-base.c +57 -27
@@ -593,41 +593,61 @@ static inline int iwl_is_ready_rf(struct iwl_priv *priv)static const char *get_cmd_string (u8 cmd) {switch (cmd) { -IWL_CMD (SCAN_START_NOTIFICATION ); -IWL_CMD (SCAN_RESULTS_NOTIFICATION ); -IWL_CMD (SCAN_COMPLETE_NOTIFICATION ); -IWL_CMD (STATISTICS_NOTIFICATION );IWL_CMD (REPLY_ALIVE );IWL_CMD (REPLY_ERROR ); -IWL_CMD (REPLY_RXON_ASSOC );IWL_CMD (REPLY_RXON ); +IWL_CMD (REPLY_RXON_ASSOC );IWL_CMD (REPLY_QOS_PARAM );IWL_CMD (REPLY_RXON_TIMING );IWL_CMD (REPLY_ADD_STA ); +#if IWL ==3945 +IWL_CMD (REPLY_REMOVE_STA ); +IWL_CMD (REPLY_REMOVE_ALL_STA ); +IWL_CMD (REPLY_3945_RX ); +#endif IWL_CMD (REPLY_TX );IWL_CMD (REPLY_BCON ); +#if IWL ==4965 +IWL_CMD (REPLY_SHUTDOWN ); +#endif IWL_CMD (REPLY_RATE_SCALE );IWL_CMD (REPLY_LEDS_CMD ); +IWL_CMD (REPLY_TX_LINK_QUALITY_CMD ); +IWL_CMD (RADAR_NOTIFICATION ); +IWL_CMD (REPLY_QUIET_CMD ); +IWL_CMD (REPLY_CHANNEL_SWITCH ); +IWL_CMD (CHANNEL_SWITCH_NOTIFICATION ); +IWL_CMD (REPLY_SPECTRUM_MEASUREMENT_CMD ); +IWL_CMD (SPECTRUM_MEASURE_NOTIFICATION ); +IWL_CMD (POWER_TABLE_CMD ); +IWL_CMD (PM_SLEEP_NOTIFICATION ); +IWL_CMD (PM_DEBUG_STATISTIC_NOTIFIC ); +IWL_CMD (REPLY_SCAN_CMD );IWL_CMD (REPLY_SCAN_ABORT_CMD ); +IWL_CMD (SCAN_START_NOTIFICATION ); +IWL_CMD (SCAN_RESULTS_NOTIFICATION ); +IWL_CMD (SCAN_COMPLETE_NOTIFICATION ); +IWL_CMD (BEACON_NOTIFICATION );IWL_CMD (REPLY_TX_BEACON ); -IWL_CMD (REPLY_BT_CONFIG ); -IWL_CMD (REPLY_SCAN_CMD ); +IWL_CMD (WHO_IS_AWAKE_NOTIFICATION ); +IWL_CMD (QUIET_NOTIFICATION );IWL_CMD (REPLY_TX_PWR_TABLE_CMD ); +IWL_CMD (MEASURE_ABORT_NOTIFICATION ); +IWL_CMD (REPLY_BT_CONFIG );IWL_CMD (REPLY_STATISTICS_CMD ); +IWL_CMD (STATISTICS_NOTIFICATION );IWL_CMD (REPLY_CARD_STATE_CMD ); -IWL_CMD (REPLY_TX_LINK_QUALITY_CMD ); -#if IWL ==3945 -IWL_CMD (REPLY_3945_RX ); -#elif IWL ==4965 -IWL_CMD (MISSED_BEACONS_NOTIFICATION_TH_CMD ); +IWL_CMD (CARD_STATE_NOTIFICATION ); +IWL_CMD (MISSED_BEACONS_NOTIFICATION ); +#if IWL ==4965 IWL_CMD (REPLY_CT_KILL_CONFIG_CMD );IWL_CMD (SENSITIVITY_CMD ); -IWL_CMD (REPLY_RX_MPDU_CMD ); +IWL_CMD (REPLY_PHY_CALIBRATION_CMD );IWL_CMD (REPLY_RX_PHY_CMD ); +IWL_CMD (REPLY_RX_MPDU_CMD );IWL_CMD (REPLY_4965_RX ); +IWL_CMD (REPLY_COMPRESSED_BA );#endif -case POWER_TABLE_CMD : -return "POWER_TABLE_CMD" ;default :return "UNKNOWN" ;
@@ -4647,8 +4667,8 @@ int iwl_calc_sig_qual(int rssi_dbm, int noise_dbm)* iwl_rx_handle - Main entry function for receiving responses from the uCode * * Uses the priv->rx_handlers callback function array to invoke -* the appropriate handlers including command response and 802.11 -* frame availability. +* the appropriate handlers, including command responses, +* frame-received notifications, and other notifications. */ static void iwl_rx_handle (struct iwl_priv *priv) {
@@ -4662,6 +4682,10 @@ static void iwl_rx_handle(struct iwl_priv *priv) r =iwl_hw_get_rx_read (priv); i = rxq->read; +/* Rx interrupt, but nothing sent from uCode */ +if (i == r) +IWL_DEBUG (IWL_DL_RX |IWL_DL_ISR ,"r = %d, i = %d\n" , r, i); +while (i != r) { rxb = rxq->queue[i];
@@ -4677,7 +4701,12 @@ static void iwl_rx_handle(struct iwl_priv *priv) PCI_DMA_FROMDEVICE); pkt = (struct iwl_rx_packet *)rxb->skb->data; -/* need to reclaim cmd buffer(s) */ +/* Reclaim a command buffer only if this packet is a response +* to a (driver-originated) command. +* If the packet (e.g. Rx frame) originated from uCode, +* there is no command buffer to reclaim. +* Ucode should set SEQ_RX_FRAME bit if ucode-originated, +* but apparently a few don't get set; catch them here. */ reclaim = !(pkt->hdr.sequence &SEQ_RX_FRAME ) && #if IWL == 4965 (pkt->hdr.cmd != REPLY_RX_PHY_CMD) &&
@@ -4690,21 +4719,22 @@ static void iwl_rx_handle(struct iwl_priv *priv)* handle those that need handling via function in * rx_handlers table. See iwl_setup_rx_handlers() */ if (priv->rx_handlers[pkt->hdr.cmd]) { +IWL_DEBUG (IWL_DL_HOST_COMMAND |IWL_DL_RX |IWL_DL_ISR , +"r = %d, i = %d, %s, 0x%02x\n" , r, i, +get_cmd_string (pkt->hdr.cmd), pkt->hdr.cmd); priv->rx_handlers[pkt->hdr.cmd] (priv, rxb); -IWL_DEBUG (IWL_DL_RX |IWL_DL_ISR , -"r = %d, i = %d, rx_handler %s\n" , r, i, -get_cmd_string (pkt->hdr.cmd)); }else {/* No handling needed */ -IWL_DEBUG_HC ("UNHANDLED - #0x%02x %s\n" , - pkt->hdr.cmd, -get_cmd_string (pkt->hdr.cmd)); +IWL_DEBUG (IWL_DL_HOST_COMMAND |IWL_DL_RX |IWL_DL_ISR , +"r %d i %d No handler needed for %s, 0x%02x\n" , + r, i,get_cmd_string (pkt->hdr.cmd), + pkt->hdr.cmd); }if (reclaim) { -/* Invoke any callbacks, transfer the skb to -* caller, and fire off the (possibly) blocking -* iwl_send_cmd() via as we reclaim the queue... */ +/* Invoke any callbacks, transfer the skb to caller, +* and fire off the (possibly) blocking iwl_send_cmd() +* as we reclaim the driver command queue */ if (rxb && rxb->skb)iwl_tx_cmd_complete (priv, rxb);else
drivers/net/wireless/iwl-commands.h +1 -4
@@ -130,8 +130,6 @@ enum {REPLY_TX_PWR_TABLE_CMD =0x97 ,MEASURE_ABORT_NOTIFICATION =0x99 , -REPLY_CALIBRATION_TUNE =0x9a , -/* BT config command */ REPLY_BT_CONFIG =0x9b , REPLY_STATISTICS_CMD = 0x9c,
@@ -143,15 +141,14 @@ enum {/* Missed beacons notification */ MISSED_BEACONS_NOTIFICATION = 0xa2, -MISSED_BEACONS_NOTIFICATION_TH_CMD =0xa3 ,#if IWL ==4965 REPLY_CT_KILL_CONFIG_CMD =0xa4 ,SENSITIVITY_CMD =0xa8 ,REPLY_PHY_CALIBRATION_CMD =0xb0 , -REPLY_4965_RX =0xc3 ,REPLY_RX_PHY_CMD =0xc0 ,REPLY_RX_MPDU_CMD =0xc1 , +REPLY_4965_RX =0xc3 ,REPLY_COMPRESSED_BA =0xc5 , #endifREPLY_MAX =0xff
Signature · 1 line
1.5.2
PATCH 27/28 iwlwifi: Correct missing hardware detection in iwl_isr()
From: Ben Cahill <[email protected]>
This patch corrects missing hardware detection in iwl_isr().
--- drivers/net/wireless/iwl-base.c | 3 +-- 1 files changed, 1 insertions(+), 2 deletions(-)
drivers/net/wireless/iwl-base.c +1 -2
@@ -5282,8 +5282,7 @@ static irqreturn_t iwl_isr(int irq, void *data) goto none; } -if ((inta ==0xFFFFFFFF ) || (inta ==0xa5a5a5a5 ) - || (inta ==0x5a5a5a5a )) { +if ((inta ==0xFFFFFFFF ) || ((inta &0xFFFFFFF0 ) ==0xa5a5a5a0 )) {/* Hardware disappeared */ IWL_WARNING ("HARDWARE GONE?? INTA == 0x%080x\n" , inta); goto none;
Signature · 1 line
1.5.2
PATCH 28/28 iwlwifi: Streamline irq_tasklet() when ISR debug not used
From: Cahill, Ben M <[email protected]>
This patch streamlines irq_tasklet() when ISR debug is not used. It also reports MAC_CLK_ACTV interrupt bit and enhance comments.
--- drivers/net/wireless/iwl-base.c | 35 +++++++++++++++++++++++++---------- 1 files changed, 25 insertions(+), 10 deletions(-)
drivers/net/wireless/iwl-base.c +25 -10
@@ -5125,10 +5125,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) inta_fh =iwl_read32 (priv,CSR_FH_INT_STATUS );iwl_write32 (priv,CSR_FH_INT_STATUS , inta_fh); - inta_mask =iwl_read32 (priv,CSR_INT_MASK );/* just for debug */ -IWL_DEBUG_ISR - ("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n" , - inta, inta_mask, inta_fh); +#ifdef CONFIG_IWLWIFI_DEBUG +if (iwl_debug_level &IWL_DL_ISR ) { + inta_mask =iwl_read32 (priv,CSR_INT_MASK );/* just for debug */ +IWL_DEBUG_ISR ("inta 0x%08x, enabled 0x%08x, fh 0x%08x\n" , + inta, inta_mask, inta_fh); + } +#endif /* Since CSR_INT and CSR_FH_INT_STATUS reads and clears are not * atomic, make sure that inta covers all the interrupts that
@@ -5155,6 +5158,21 @@ static void iwl_irq_tasklet(struct iwl_priv *priv)return ; } +#ifdef CONFIG_IWLWIFI_DEBUG +if (iwl_debug_level & (IWL_DL_ISR )) { +/* NIC fires this, but we don't use it, redundant with WAKEUP */ +if (inta &BIT_INT_MAC_CLK_ACTV ) +IWL_DEBUG_ISR ("Microcode started or stopped.\n" ); + +/* Alive notification via Rx interrupt will do the real work */ +if (inta &BIT_INT_ALIVE ) +IWL_DEBUG_ISR ("Alive interrupt\n" ); + } +#endif +/* Safely ignore these bits for debug checks below */ + inta &= ~(BIT_INT_MAC_CLK_ACTV |BIT_INT_ALIVE ); + +/* HW RF KILL switch toggled (4965 only) */ if (inta &BIT_INT_RF_KILL ) {int hw_rf_kill =0 ; if (!(iwl_read32(priv, CSR_GP_CNTRL) &
@@ -5175,11 +5193,13 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) handled |=BIT_INT_RF_KILL ; } +/* Chip got too hot and stopped itself (4965 only) */ if (inta &BIT_INT_CT_KILL ) {IWL_ERROR ("Microcode CT kill error detected.\n" ); handled |=BIT_INT_CT_KILL ; } +/* Error detected by uCode */ if (inta &BIT_INT_SWERROR ) {IWL_ERROR ("Microcode SW error detected. Restarting 0x%X.\n" , inta);
@@ -5187,6 +5207,7 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) handled |=BIT_INT_SWERROR ; } +/* uCode wakes up after power-down sleep */ if (inta &BIT_INT_WAKEUP ) {IWL_DEBUG_ISR ("Wakeup interrupt\n" );iwl_rx_queue_update_write_ptr (priv, &priv->rxq);
@@ -5200,12 +5221,6 @@ static void iwl_irq_tasklet(struct iwl_priv *priv) handled |=BIT_INT_WAKEUP ; } -/* Alive notification via Rx interrupt will do the real work */ -if (inta &BIT_INT_ALIVE ) { -IWL_DEBUG_ISR ("Alive interrupt\n" ); - handled |=BIT_INT_ALIVE ; - } -/* All uCode command responses, including Tx command responses, * Rx "responses" (frame-received notification), and other * notifications from uCode come through here*/
Signature · 1 line
1.5.2