123
120
* Generic queue structure
125
* Contains common data for Rx and Tx queues
122
* Contains common data for Rx and Tx queues.
124
* Note the difference between n_bd and n_window: the hardware
125
* always assumes 256 descriptors, so n_bd is always 256 (unless
126
* there might be HW changes in the future). For the normal TX
127
* queues, n_window, which is the size of the software queue data
128
* is also 256; however, for the command queue, n_window is only
129
* 32 since we don't need so many commands pending. Since the HW
130
* still uses 256 BDs for DMA though, n_bd stays 256. As a result,
131
* the software buffers (in the variables @meta, @txb in struct
132
* iwl_tx_queue) only have 32 entries, while the HW buffers (@tfds
133
* in the same struct) have 256.
134
* This means that we end up with the following:
135
* HW entries: | 0 | ... | N * 32 | ... | N * 32 + 31 | ... | 255 |
136
* SW entries: | 0 | ... | 31 |
137
* where N is a number between 0 and 7. This means that the SW
138
* data is a window overlayed over the HW queue.
127
140
struct iwl_queue {
128
141
int n_bd; /* number of BDs in this queue */
178
191
#define IWL_NUM_SCAN_RATES (2)
180
struct iwl4965_channel_tgd_info {
185
struct iwl4965_channel_tgh_info {
189
#define IWL4965_MAX_RATE (33)
191
struct iwl3945_clip_group {
192
/* maximum power level to prevent clipping for each rate, derived by
193
* us from this band's saturation power in EEPROM */
194
const s8 clip_powers[IWL_MAX_RATES];
197
/* current Tx power values to use, one for each rate for each channel.
198
* requested power is limited by:
199
* -- regulatory EEPROM limits for this channel
200
* -- hardware capabilities (clip-powers)
201
* -- spectrum management
202
* -- user preference (e.g. iwconfig)
203
* when requested power is set, base power index must also be set. */
204
struct iwl3945_channel_power_info {
205
struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
206
s8 power_table_index; /* actual (compenst'd) index into gain table */
207
s8 base_power_index; /* gain index for power at factory temp. */
208
s8 requested_power; /* power (dBm) requested for this chnl/rate */
211
/* current scan Tx power values to use, one for each scan rate for each
213
struct iwl3945_scan_power_info {
214
struct iwl3945_tx_power tpc; /* actual radio and DSP gain settings */
215
s8 power_table_index; /* actual (compenst'd) index into gain table */
216
s8 requested_power; /* scan pwr (dBm) requested for chnl/rate */
220
194
* One for each channel, holds all channel setup data
221
195
* Some of the fields (e.g. eeprom and flags/max_power_avg) are redundant
222
196
* with one another!
224
198
struct iwl_channel_info {
225
struct iwl4965_channel_tgd_info tgd;
226
struct iwl4965_channel_tgh_info tgh;
227
199
struct iwl_eeprom_channel eeprom; /* EEPROM regulatory limit */
228
200
struct iwl_eeprom_channel ht40_eeprom; /* EEPROM regulatory limit for
229
201
* HT40 channel */
583
547
IWL_UCODE_TLV_INIT_ERRLOG_PTR = 13,
584
548
IWL_UCODE_TLV_ENHANCE_SENS_TBL = 14,
585
549
IWL_UCODE_TLV_PHY_CALIBRATION_SIZE = 15,
550
/* 16 and 17 reserved for future use */
551
IWL_UCODE_TLV_FLAGS = 18,
555
* enum iwl_ucode_tlv_flag - ucode API flags
556
* @IWL_UCODE_TLV_FLAGS_PAN: This is PAN capable microcode; this previously
557
* was a separate TLV but moved here to save space.
558
* @IWL_UCODE_TLV_FLAGS_NEWSCAN: new uCode scan behaviour on hidden SSID,
559
* treats good CRC threshold as a boolean
560
* @IWL_UCODE_TLV_FLAGS_MFP: This uCode image supports MFP (802.11w).
562
enum iwl_ucode_tlv_flag {
563
IWL_UCODE_TLV_FLAGS_PAN = BIT(0),
564
IWL_UCODE_TLV_FLAGS_NEWSCAN = BIT(1),
565
IWL_UCODE_TLV_FLAGS_MFP = BIT(2),
588
568
struct iwl_ucode_tlv {
1128
1066
/* extend beacon time format bit shifting */
1131
* bits 31:24 - extended
1132
* bits 23:0 - interval
1134
#define IWL3945_EXT_BEACON_TIME_POS 24
1136
1068
* for _agn devices
1137
1069
* bits 31:22 - extended
1138
1070
* bits 21:0 - interval
1140
1072
#define IWLAGN_EXT_BEACON_TIME_POS 22
1075
* struct iwl_notification_wait - notification wait entry
1076
* @list: list head for global list
1077
* @fn: function called with the notification
1080
* This structure is not used directly, to wait for a
1081
* notification declare it on the stack, and call
1082
* iwlagn_init_notification_wait() with appropriate
1083
* parameters. Then do whatever will cause the ucode
1084
* to notify the driver, and to wait for that then
1085
* call iwlagn_wait_notification().
1087
* Each notification is one-shot. If at some point we
1088
* need to support multi-shot notifications (which
1089
* can't be allocated on the stack) we need to modify
1090
* the code for them.
1092
struct iwl_notification_wait {
1093
struct list_head list;
1095
void (*fn)(struct iwl_priv *priv, struct iwl_rx_packet *pkt,
1100
bool triggered, aborted;
1142
1103
enum iwl_rxon_context_id {
1143
1104
IWL_RXON_CTX_BSS,
1144
1105
IWL_RXON_CTX_PAN,
1291
1267
int fw_index; /* firmware we're trying to load */
1292
1268
u32 ucode_ver; /* version of ucode, copy of
1293
1269
iwl_ucode.ver */
1294
struct fw_desc ucode_code; /* runtime inst */
1295
struct fw_desc ucode_data; /* runtime data original */
1296
struct fw_desc ucode_data_backup; /* runtime data save/restore */
1297
struct fw_desc ucode_init; /* initialization inst */
1298
struct fw_desc ucode_init_data; /* initialization data */
1299
struct fw_desc ucode_boot; /* bootstrap inst */
1300
enum ucode_type ucode_type;
1270
struct fw_img ucode_rt;
1271
struct fw_img ucode_init;
1273
enum iwlagn_ucode_subtype ucode_type;
1301
1274
u8 ucode_write_complete; /* the image write is complete */
1302
1275
char firmware_name[25];
1304
1277
struct iwl_rxon_context contexts[NUM_IWL_RXON_CTX];
1306
struct iwl_switch_rxon switch_rxon;
1308
/* 1st responses from initialize and runtime uCode images.
1309
* _agn's initialize alive response contains some calibration data. */
1310
struct iwl_init_alive_resp card_alive_init;
1311
struct iwl_alive_resp card_alive;
1313
unsigned long last_blink_time;
1279
__le16 switch_channel;
1282
u32 error_event_table;
1283
u32 log_event_table;
1318
1286
u16 active_rate;
1386
1351
/* Last Rx'd beacon timestamp */
1390
#if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE)
1393
dma_addr_t shared_phys;
1395
struct delayed_work thermal_periodic;
1396
struct delayed_work rfkill_poll;
1398
struct iwl3945_notif_statistics statistics;
1399
#ifdef CONFIG_IWLWIFI_DEBUGFS
1400
struct iwl3945_notif_statistics accum_statistics;
1401
struct iwl3945_notif_statistics delta_statistics;
1402
struct iwl3945_notif_statistics max_delta;
1406
int last_rx_rssi; /* From Rx packet statistics */
1408
/* Rx'd packet timing information */
1409
u32 last_beacon_time;
1413
* each calibration channel group in the
1414
* EEPROM has a derived clip setting for
1417
const struct iwl3945_clip_group clip_groups[5];
1421
#if defined(CONFIG_IWLAGN) || defined(CONFIG_IWLAGN_MODULE)
1426
dma_addr_t ict_tbl_dma;
1427
dma_addr_t aligned_ict_tbl_dma;
1432
* reporting the number of tids has AGG on. 0 means
1437
struct iwl_rx_phy_res last_phy_res;
1438
bool last_phy_res_valid;
1440
struct completion firmware_loading_complete;
1442
u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
1443
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
1446
* chain noise reset and gain commands are the
1447
* two extra calibration commands follows the standard
1448
* phy calibration commands
1450
u8 phy_calib_chain_noise_reset_cmd;
1451
u8 phy_calib_chain_noise_gain_cmd;
1453
struct iwl_notif_statistics statistics;
1454
struct iwl_bt_notif_statistics statistics_bt;
1455
/* counts reply_tx error */
1456
struct reply_tx_error_statistics reply_tx_stats;
1457
struct reply_agg_tx_error_statistics reply_agg_tx_stats;
1458
#ifdef CONFIG_IWLWIFI_DEBUGFS
1459
struct iwl_notif_statistics accum_statistics;
1460
struct iwl_notif_statistics delta_statistics;
1461
struct iwl_notif_statistics max_delta;
1462
struct iwl_bt_notif_statistics accum_statistics_bt;
1463
struct iwl_bt_notif_statistics delta_statistics_bt;
1464
struct iwl_bt_notif_statistics max_delta_bt;
1356
struct statistics_general_common common;
1357
struct statistics_rx_non_phy rx_non_phy;
1358
struct statistics_rx_phy rx_ofdm;
1359
struct statistics_rx_ht_phy rx_ofdm_ht;
1360
struct statistics_rx_phy rx_cck;
1361
struct statistics_tx tx;
1362
#ifdef CONFIG_IWLWIFI_DEBUGFS
1363
struct statistics_bt_activity bt_activity;
1364
__le32 num_bt_kills, accum_num_bt_kills;
1367
#ifdef CONFIG_IWLWIFI_DEBUGFS
1369
struct statistics_general_common common;
1370
struct statistics_rx_non_phy rx_non_phy;
1371
struct statistics_rx_phy rx_ofdm;
1372
struct statistics_rx_ht_phy rx_ofdm_ht;
1373
struct statistics_rx_phy rx_cck;
1374
struct statistics_tx tx;
1375
struct statistics_bt_activity bt_activity;
1376
} accum_stats, delta_stats, max_delta_stats;
1383
dma_addr_t ict_tbl_dma;
1384
dma_addr_t aligned_ict_tbl_dma;
1389
* reporting the number of tids has AGG on. 0 means
1394
struct iwl_rx_phy_res last_phy_res;
1395
bool last_phy_res_valid;
1397
struct completion firmware_loading_complete;
1399
u32 init_evtlog_ptr, init_evtlog_size, init_errlog_ptr;
1400
u32 inst_evtlog_ptr, inst_evtlog_size, inst_errlog_ptr;
1403
* chain noise reset and gain commands are the
1404
* two extra calibration commands follows the standard
1405
* phy calibration commands
1407
u8 phy_calib_chain_noise_reset_cmd;
1408
u8 phy_calib_chain_noise_gain_cmd;
1410
/* counts reply_tx error */
1411
struct reply_tx_error_statistics reply_tx_stats;
1412
struct reply_agg_tx_error_statistics reply_agg_tx_stats;
1413
/* notification wait support */
1414
struct list_head notif_waits;
1415
spinlock_t notif_wait_lock;
1416
wait_queue_head_t notif_waitq;
1418
/* remain-on-channel offload support */
1419
struct ieee80211_channel *hw_roc_channel;
1420
struct delayed_work hw_roc_work;
1421
enum nl80211_channel_type hw_roc_chantype;
1422
int hw_roc_duration;
1425
struct sk_buff *offchan_tx_skb;
1426
int offchan_tx_timeout;
1427
struct ieee80211_channel *offchan_tx_chan;
1471
1431
u8 bt_enable_flag;
1473
1433
u8 bt_traffic_load, last_bt_traffic_load;
1474
1434
bool bt_ch_announce;
1476
1435
bool bt_full_concurrent;
1477
1436
bool bt_ant_couple_ok;
1478
1437
__le32 kill_ack_mask;
1604
1569
ctx < &priv->contexts[NUM_IWL_RXON_CTX]; ctx++) \
1605
1570
if (priv->valid_contexts & BIT(ctx->ctxid))
1572
static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
1574
return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1607
1577
static inline int iwl_is_associated(struct iwl_priv *priv,
1608
1578
enum iwl_rxon_context_id ctxid)
1610
return (priv->contexts[ctxid].active.filter_flags &
1611
RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1580
return iwl_is_associated_ctx(&priv->contexts[ctxid]);
1614
1583
static inline int iwl_is_any_associated(struct iwl_priv *priv)
1616
return iwl_is_associated(priv, IWL_RXON_CTX_BSS);
1619
static inline int iwl_is_associated_ctx(struct iwl_rxon_context *ctx)
1621
return (ctx->active.filter_flags & RXON_FILTER_ASSOC_MSK) ? 1 : 0;
1585
struct iwl_rxon_context *ctx;
1586
for_each_context(priv, ctx)
1587
if (iwl_is_associated_ctx(ctx))
1624
1592
static inline int is_channel_valid(const struct iwl_channel_info *ch_info)