30 #include <linux/pci.h>
31 #include <linux/kernel.h>
33 #include <linux/wait.h>
46 #define IL_ERR(f, a...) dev_err(&il->pci_dev->dev, f, ## a)
47 #define IL_WARN(f, a...) dev_warn(&il->pci_dev->dev, f, ## a)
48 #define IL_INFO(f, a...) dev_info(&il->pci_dev->dev, f, ## a)
50 #define RX_QUEUE_SIZE 256
51 #define RX_QUEUE_MASK 255
52 #define RX_QUEUE_SIZE_LOG 8
57 #define RX_FREE_BUFFERS 64
58 #define RX_LOW_WATERMARK 8
60 #define U32_PAD(n) ((4-(n))&0x3)
63 #define CT_KILL_THRESHOLD_LEGACY 110
76 #define IL_NOISE_MEAS_NOT_AVAILABLE (-127)
86 #define DEFAULT_RTS_THRESHOLD 2347U
87 #define MIN_RTS_THRESHOLD 0U
88 #define MAX_RTS_THRESHOLD 2347U
89 #define MAX_MSDU_SIZE 2304U
90 #define MAX_MPDU_SIZE 2346U
91 #define DEFAULT_BEACON_INTERVAL 100U
92 #define DEFAULT_SHORT_RETRY_LIMIT 7U
93 #define DEFAULT_LONG_RETRY_LIMIT 4U
101 #define rxb_addr(r) page_address(r->page)
161 #define TFD_TX_CMD_SLOTS 256
162 #define TFD_CMD_SLOTS 32
185 #define IL_EEPROM_ACCESS_TIMEOUT 5000
187 #define IL_EEPROM_SEM_TIMEOUT 10
188 #define IL_EEPROM_SEM_RETRY_LIMIT 1000
206 #define IL_NUM_TX_CALIB_GROUPS 5
220 #define EEPROM_SKU_CAP_SW_RF_KILL_ENABLE (1 << 0)
221 #define EEPROM_SKU_CAP_HW_RF_KILL_ENABLE (1 << 1)
231 #define EEPROM_3945_EEPROM_VERSION (0x2f)
234 #define EEPROM_TX_POWER_TX_CHAINS (2)
237 #define EEPROM_TX_POWER_BANDS (8)
241 #define EEPROM_TX_POWER_MEASUREMENTS (3)
245 #define EEPROM_4965_TX_POWER_VERSION (5)
246 #define EEPROM_4965_EEPROM_VERSION (0x2f)
247 #define EEPROM_4965_CALIB_VERSION_OFFSET (2*0xB6)
248 #define EEPROM_4965_CALIB_TXPOWER_OFFSET (2*0xE8)
249 #define EEPROM_4965_BOARD_REVISION (2*0x4F)
250 #define EEPROM_4965_BOARD_PBA (2*0x56+1)
336 #define EEPROM_DEVICE_ID (2*0x08)
337 #define EEPROM_MAC_ADDRESS (2*0x15)
338 #define EEPROM_BOARD_REVISION (2*0x35)
339 #define EEPROM_BOARD_PBA_NUMBER (2*0x3B+1)
340 #define EEPROM_VERSION (2*0x44)
341 #define EEPROM_SKU_CAP (2*0x45)
342 #define EEPROM_OEM_MODE (2*0x46)
343 #define EEPROM_WOWLAN_MODE (2*0x47)
344 #define EEPROM_RADIO_CONFIG (2*0x48)
345 #define EEPROM_NUM_MAC_ADDRESS (2*0x4C)
348 #define EEPROM_RF_CFG_TYPE_MSK(x) (x & 0x3)
349 #define EEPROM_RF_CFG_STEP_MSK(x) ((x >> 2) & 0x3)
350 #define EEPROM_RF_CFG_DASH_MSK(x) ((x >> 4) & 0x3)
351 #define EEPROM_RF_CFG_PNUM_MSK(x) ((x >> 6) & 0x3)
352 #define EEPROM_RF_CFG_TX_ANT_MSK(x) ((x >> 8) & 0xF)
353 #define EEPROM_RF_CFG_RX_ANT_MSK(x) ((x >> 12) & 0xF)
355 #define EEPROM_3945_RF_CFG_TYPE_MAX 0x0
356 #define EEPROM_4965_RF_CFG_TYPE_MAX 0x1
370 #define EEPROM_REGULATORY_SKU_ID (2*0x60)
371 #define EEPROM_REGULATORY_BAND_1 (2*0x62)
372 #define EEPROM_REGULATORY_BAND_1_CHANNELS (2*0x63)
379 #define EEPROM_REGULATORY_BAND_2 (2*0x71)
380 #define EEPROM_REGULATORY_BAND_2_CHANNELS (2*0x72)
386 #define EEPROM_REGULATORY_BAND_3 (2*0x7F)
387 #define EEPROM_REGULATORY_BAND_3_CHANNELS (2*0x80)
393 #define EEPROM_REGULATORY_BAND_4 (2*0x8C)
394 #define EEPROM_REGULATORY_BAND_4_CHANNELS (2*0x8D)
400 #define EEPROM_REGULATORY_BAND_5 (2*0x98)
401 #define EEPROM_REGULATORY_BAND_5_CHANNELS (2*0x99)
418 #define EEPROM_4965_REGULATORY_BAND_24_HT40_CHANNELS (2*0xA0)
424 #define EEPROM_4965_REGULATORY_BAND_52_HT40_CHANNELS (2*0xA8)
426 #define EEPROM_REGULATORY_BAND_NO_HT40 (0)
438 #define IL_NUM_SCAN_RATES (2)
449 #define IL4965_MAX_RATE (33)
516 #define IL_TX_FIFO_BK 0
517 #define IL_TX_FIFO_BE 1
518 #define IL_TX_FIFO_VI 2
519 #define IL_TX_FIFO_VO 3
520 #define IL_TX_FIFO_UNUSED -1
525 #define IL_MIN_NUM_QUEUES 10
527 #define IL_DEFAULT_CMD_QUEUE_NUM 4
529 #define IEEE80211_DATA_LEN 2304
530 #define IEEE80211_4ADDR_LEN 30
531 #define IEEE80211_HLEN (IEEE80211_4ADDR_LEN)
532 #define IEEE80211_FRAME_LEN (IEEE80211_DATA_LEN + IEEE80211_HLEN)
544 #define SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
545 #define SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
546 #define MAX_SN ((IEEE80211_SCTL_SEQ) >> 4)
558 #define DEF_CMD_PAYLOAD_SIZE 320
579 #define TFD_MAX_PAYLOAD_SIZE (sizeof(struct il_device_cmd))
591 #define SUP_RATE_11A_MAX_NUM_CHANNELS 8
592 #define SUP_RATE_11B_MAX_NUM_CHANNELS 4
593 #define SUP_RATE_11G_MAX_NUM_CHANNELS 12
627 #define IL_SUPPORTED_RATES_IE_LEN 8
629 #define MAX_TID_COUNT 9
631 #define IL_INVALID_RATE 0xFF
632 #define IL_INVALID_VALUE -1
657 #define IL_EMPTYING_HW_QUEUE_ADDBA 2
658 #define IL_EMPTYING_HW_QUEUE_DELBA 3
683 #define CFG_HT_RX_AMPDU_FACTOR_8K (0x0)
684 #define CFG_HT_RX_AMPDU_FACTOR_16K (0x1)
685 #define CFG_HT_RX_AMPDU_FACTOR_32K (0x2)
686 #define CFG_HT_RX_AMPDU_FACTOR_64K (0x3)
687 #define CFG_HT_RX_AMPDU_FACTOR_DEF CFG_HT_RX_AMPDU_FACTOR_64K
688 #define CFG_HT_RX_AMPDU_FACTOR_MAX CFG_HT_RX_AMPDU_FACTOR_64K
689 #define CFG_HT_RX_AMPDU_FACTOR_MIN CFG_HT_RX_AMPDU_FACTOR_8K
698 #define CFG_HT_MPDU_DENSITY_2USEC (0x4)
699 #define CFG_HT_MPDU_DENSITY_4USEC (0x5)
700 #define CFG_HT_MPDU_DENSITY_8USEC (0x6)
701 #define CFG_HT_MPDU_DENSITY_16USEC (0x7)
702 #define CFG_HT_MPDU_DENSITY_DEF CFG_HT_MPDU_DENSITY_4USEC
703 #define CFG_HT_MPDU_DENSITY_MAX CFG_HT_MPDU_DENSITY_16USEC
704 #define CFG_HT_MPDU_DENSITY_MIN (0x1)
800 #define KELVIN_TO_CELSIUS(x) ((x)-273)
801 #define CELSIUS_TO_KELVIN(x) ((x)+273)
869 il_queue_used(
const struct il_queue *
q,
int i)
891 return idx & (q->
n_win - 1);
900 #define IL_OPERATION_MODE_AUTO 0
901 #define IL_OPERATION_MODE_HT_ONLY 1
902 #define IL_OPERATION_MODE_MIXED 2
903 #define IL_OPERATION_MODE_20MHZ 3
905 #define IL_TX_CRC_SIZE 4
906 #define IL_TX_DELIMITER_SIZE 4
908 #define TX_POWER_IL_ILLEGAL_VOLTAGE -10000
911 #define INITIALIZATION_VALUE 0xFFFF
912 #define IL4965_CAL_NUM_BEACONS 20
913 #define IL_CAL_NUM_BEACONS 16
914 #define MAXIMUM_ALLOWED_PATHLOSS 15
916 #define CHAIN_NOISE_MAX_DELTA_GAIN_CODE 3
918 #define MAX_FA_OFDM 50
919 #define MIN_FA_OFDM 5
920 #define MAX_FA_CCK 50
923 #define AUTO_CORR_STEP_OFDM 1
925 #define AUTO_CORR_STEP_CCK 3
926 #define AUTO_CORR_MAX_TH_CCK 160
929 #define NRG_STEP_CCK 2
931 #define MAX_NUMBER_CCK_NO_FA 100
933 #define AUTO_CORR_CCK_MIN_VAL_DEF (125)
938 #define CHAIN_NOISE_DELTA_GAIN_INIT_VAL 4
939 #define ALL_BAND_FILTER 0xFF00
940 #define IN_BAND_FILTER 0xFF
941 #define MIN_AVERAGE_NOISE_MAX_VALUE 0xFFFFFFFF
943 #define NRG_NUM_PREV_STAT_L 20
944 #define NUM_RX_CHAINS 3
1012 #define EEPROM_SEM_TIMEOUT 10
1013 #define EEPROM_SEM_RETRY_LIMIT 1000
1015 #define IL_TRAFFIC_ENTRIES (256)
1016 #define IL_TRAFFIC_ENTRY_SIZE (64)
1069 #ifdef CONFIG_IWLEGACY_DEBUGFS
1085 #define IL_HOST_INT_TIMEOUT_MAX (0xFF)
1086 #define IL_HOST_INT_TIMEOUT_DEF (0x40)
1087 #define IL_HOST_INT_TIMEOUT_MIN (0x0)
1088 #define IL_HOST_INT_CALIB_TIMEOUT_MAX (0xFF)
1089 #define IL_HOST_INT_CALIB_TIMEOUT_DEF (0x10)
1090 #define IL_HOST_INT_CALIB_TIMEOUT_MIN (0x0)
1092 #define IL_DELAY_NEXT_FORCE_FW_RELOAD (HZ*5)
1095 #define IL_DEF_WD_TIMEOUT (2000)
1096 #define IL_LONG_WD_TIMEOUT (10000)
1097 #define IL_MAX_WD_TIMEOUT (120000)
1113 #define IL3945_EXT_BEACON_TIME_POS 24
1119 #define IL4965_EXT_BEACON_TIME_POS 22
1139 #ifdef CONFIG_IWLEGACY_DEBUGFS
1140 const struct il_debugfs_ops *debugfs_ops;
1304 #define IL_MAX_HW_QUEUES 32
1324 #if defined(CONFIG_IWL3945) || defined(CONFIG_IWL3945_MODULE)
1333 #ifdef CONFIG_IWLEGACY_DEBUGFS
1343 u32 last_beacon_time;
1355 #if defined(CONFIG_IWL4965) || defined(CONFIG_IWL4965_MODULE)
1358 bool last_phy_res_valid;
1367 u8 phy_calib_chain_noise_reset_cmd;
1368 u8 phy_calib_chain_noise_gain_cmd;
1370 u8 key_mapping_keys;
1374 #ifdef CONFIG_IWLEGACY_DEBUGFS
1411 #ifdef CONFIG_IWLEGACY_DEBUG
1416 #ifdef CONFIG_IWLEGACY_DEBUGFS
1422 struct dentry *debugfs_dir;
1423 u32 dbgfs_sram_offset, dbgfs_sram_len;
1442 il_txq_ctx_activate(
struct il_priv *il,
int txq_id)
1448 il_txq_ctx_deactivate(
struct il_priv *il,
int txq_id)
1454 il_is_associated(
struct il_priv *il)
1460 il_is_any_associated(
struct il_priv *il)
1462 return il_is_associated(il);
1468 if (ch_info ==
NULL)
1505 il_free_pages(
struct il_priv *il,
unsigned long page)
1511 #define IWLWIFI_VERSION "in-tree:"
1512 #define DRV_COPYRIGHT "Copyright(c) 2003-2011 Intel Corporation"
1515 #define IL_PCI_DEVICE(dev, subdev, cfg) \
1516 .vendor = PCI_VENDOR_ID_INTEL, .device = (dev), \
1517 .subvendor = PCI_ANY_ID, .subdevice = (subdev), \
1518 .driver_data = (kernel_ulong_t)&(cfg)
1520 #define TIME_UNIT 1024
1522 #define IL_SKU_G 0x1
1523 #define IL_SKU_A 0x2
1524 #define IL_SKU_N 0x8
1526 #define IL_CMD(x) case x: return #x
1529 #define IL_RX_BUF_SIZE_3K (3 * 1000)
1530 #define IL_RX_BUF_SIZE_4K (4 * 1024)
1531 #define IL_RX_BUF_SIZE_8K (8 * 1024)
1533 #ifdef CONFIG_IWLEGACY_DEBUGFS
1534 struct il_debugfs_ops {
1536 size_t count, loff_t *ppos);
1538 size_t count, loff_t *ppos);
1606 #define IL_LED_SOLID 11
1607 #define IL_DEF_LED_INTRVL cpu_to_le32(1000)
1609 #define IL_LED_ACTIVITY (0<<1)
1610 #define IL_LED_LINK (1<<1)
1729 #ifdef CONFIG_IWLEGACY_DEBUGFS
1807 #define IL_ACTIVE_QUIET_TIME cpu_to_le16(10)
1808 #define IL_PLCP_QUIET_THRESH cpu_to_le16(1)
1810 #define IL_SCAN_CHECK_WATCHDOG (HZ * 7)
1833 il_pcie_link_ctl(
struct il_priv *il)
1848 #define IL_LEGACY_PM_OPS (&il_pm_ops)
1852 #define IL_LEGACY_PM_OPS NULL
1860 #ifdef CONFIG_IWLEGACY_DEBUG
1861 void il_print_rx_config_cmd(
struct il_priv *il);
1864 il_print_rx_config_cmd(
struct il_priv *il)
1879 #define S_HCMD_ACTIVE 0
1881 #define S_INT_ENABLED 2
1887 #define S_TEMPERATURE 8
1888 #define S_GEO_CONFIGURED 9
1889 #define S_EXIT_PENDING 10
1891 #define S_SCANNING 13
1892 #define S_SCAN_ABORTING 14
1893 #define S_SCAN_HW 15
1894 #define S_POWER_PMI 16
1895 #define S_FW_ERROR 17
1896 #define S_CHANNEL_SWITCH_PENDING 18
1899 il_is_ready(
struct il_priv *il)
1909 il_is_alive(
struct il_priv *il)
1915 il_is_init(
struct il_priv *il)
1921 il_is_rfkill(
struct il_priv *il)
1927 il_is_ctkill(
struct il_priv *il)
1933 il_is_ready_rf(
struct il_priv *il)
1936 if (il_is_rfkill(il))
1939 return il_is_ready(il);
1952 il_send_rxon_assoc(
struct il_priv *il)
1954 return il->
ops->rxon_assoc(il);
1958 il_commit_rxon(
struct il_priv *il)
1960 return il->
ops->commit_rxon(il);
1966 return il->
hw->wiphy->bands[
band];
1994 #define il_write8(il, ofs, val) _il_write8(il, ofs, val)
2011 _il_wr(il, reg, _il_rd(il, reg) & ~mask);
2017 _il_wr(il, reg, _il_rd(il, reg) | mask);
2021 _il_release_nic_access(
struct il_priv *il)
2037 unsigned long reg_flags;
2041 value = _il_rd(il, reg);
2042 _il_release_nic_access(il);
2043 spin_unlock_irqrestore(&il->
reg_lock, reg_flags);
2050 unsigned long reg_flags;
2054 _il_wr(il, reg, value);
2055 _il_release_nic_access(il);
2057 spin_unlock_irqrestore(&il->
reg_lock, reg_flags);
2077 unsigned long reg_flags;
2081 _il_wr_prph(il, reg, (_il_rd_prph(il, reg) | mask));
2082 _il_release_nic_access(il);
2084 spin_unlock_irqrestore(&il->
reg_lock, reg_flags);
2090 unsigned long reg_flags;
2094 _il_wr_prph(il, reg, ((_il_rd_prph(il, reg) & mask) | bits));
2095 _il_release_nic_access(il);
2097 spin_unlock_irqrestore(&il->
reg_lock, reg_flags);
2103 unsigned long reg_flags;
2108 val = _il_rd_prph(il, reg);
2109 _il_wr_prph(il, reg, (val & ~mask));
2110 _il_release_nic_access(il);
2112 spin_unlock_irqrestore(&il->
reg_lock, reg_flags);
2115 #define HW_KEY_DYNAMIC 0
2116 #define HW_KEY_DEFAULT 1
2118 #define IL_STA_DRIVER_ACTIVE BIT(0)
2119 #define IL_STA_UCODE_ACTIVE BIT(1)
2120 #define IL_STA_UCODE_INPROGRESS BIT(2)
2122 #define IL_STA_LOCAL BIT(3)
2124 #define IL_STA_BCAST BIT(4)
2153 il_clear_driver_stations(
struct il_priv *il)
2155 unsigned long flags;
2161 spin_unlock_irqrestore(&il->
sta_lock, flags);
2192 sta_id = il_sta_id(sta);
2209 il_queue_inc_wrap(
int idx,
int n_bd)
2211 return ++idx & (n_bd - 1);
2220 il_queue_dec_wrap(
int idx,
int n_bd)
2222 return --idx & (n_bd - 1);
2237 il_alloc_fw_desc(
struct pci_dev *pci_dev,
struct fw_desc *desc)
2267 txq->
swq_id = (hwq << 2) | ac;
2275 u8 hwq = (queue >> 2) & 0x1f;
2287 u8 hwq = (queue >> 2) & 0x1f;
2294 #ifdef ieee80211_stop_queue
2295 #undef ieee80211_stop_queue
2298 #define ieee80211_stop_queue DO_NOT_USE_ieee80211_stop_queue
2300 #ifdef ieee80211_wake_queue
2301 #undef ieee80211_wake_queue
2304 #define ieee80211_wake_queue DO_NOT_USE_ieee80211_wake_queue
2307 il_disable_interrupts(
struct il_priv *il)
2316 _il_wr(il,
CSR_INT, 0xffffffff);
2321 il_enable_rfkill_int(
struct il_priv *il)
2327 il_enable_interrupts(
struct il_priv *il)
2339 il_beacon_time_mask_low(
struct il_priv *il,
u16 tsf_bits)
2341 return (1 << tsf_bits) - 1;
2350 il_beacon_time_mask_high(
struct il_priv *il,
u16 tsf_bits)
2352 return ((1 << (32 - tsf_bits)) - 1) << tsf_bits;
2373 #define TFD_QUEUE_SIZE_MAX 256
2374 #define TFD_QUEUE_SIZE_BC_DUP 64
2375 #define TFD_QUEUE_BC_SIZE (TFD_QUEUE_SIZE_MAX + TFD_QUEUE_SIZE_BC_DUP)
2376 #define IL_TX_DMA_MASK DMA_BIT_MASK(36)
2377 #define IL_NUM_OF_TBS 20
2382 return (
sizeof(addr) >
sizeof(
u32) ? (addr >> 16) >> 16 : 0) & 0xF;
2435 #define PCI_CFG_RETRY_TIMEOUT 0x041
2438 #define PCI_CFG_LINK_CTRL_VAL_L0S_EN 0x01
2439 #define PCI_CFG_LINK_CTRL_VAL_L1_EN 0x02
2517 #define RATE_6M_MASK (1 << RATE_6M_IDX)
2518 #define RATE_9M_MASK (1 << RATE_9M_IDX)
2519 #define RATE_12M_MASK (1 << RATE_12M_IDX)
2520 #define RATE_18M_MASK (1 << RATE_18M_IDX)
2521 #define RATE_24M_MASK (1 << RATE_24M_IDX)
2522 #define RATE_36M_MASK (1 << RATE_36M_IDX)
2523 #define RATE_48M_MASK (1 << RATE_48M_IDX)
2524 #define RATE_54M_MASK (1 << RATE_54M_IDX)
2525 #define RATE_60M_MASK (1 << RATE_60M_IDX)
2526 #define RATE_1M_MASK (1 << RATE_1M_IDX)
2527 #define RATE_2M_MASK (1 << RATE_2M_IDX)
2528 #define RATE_5M_MASK (1 << RATE_5M_IDX)
2529 #define RATE_11M_MASK (1 << RATE_11M_IDX)
2588 #define IL_CCK_BASIC_RATES_MASK \
2592 #define IL_CCK_RATES_MASK \
2593 (IL_CCK_BASIC_RATES_MASK | \
2597 #define IL_OFDM_BASIC_RATES_MASK \
2602 #define IL_OFDM_RATES_MASK \
2603 (IL_OFDM_BASIC_RATES_MASK | \
2610 #define IL_BASIC_RATES_MASK \
2611 (IL_OFDM_BASIC_RATES_MASK | \
2612 IL_CCK_BASIC_RATES_MASK)
2614 #define RATES_MASK ((1 << RATE_COUNT) - 1)
2615 #define RATES_MASK_3945 ((1 << RATE_COUNT_3945) - 1)
2617 #define IL_INVALID_VALUE -1
2619 #define IL_MIN_RSSI_VAL -100
2620 #define IL_MAX_RSSI_VAL 0
2624 #define IL_LEGACY_FAILURE_LIMIT 160
2625 #define IL_LEGACY_SUCCESS_LIMIT 480
2626 #define IL_LEGACY_TBL_COUNT 160
2628 #define IL_NONE_LEGACY_FAILURE_LIMIT 400
2629 #define IL_NONE_LEGACY_SUCCESS_LIMIT 4500
2630 #define IL_NONE_LEGACY_TBL_COUNT 1500
2633 #define IL_RS_GOOD_RATIO 12800
2634 #define RATE_SCALE_SWITCH 10880
2635 #define RATE_HIGH_TH 10880
2636 #define RATE_INCREASE_TH 6400
2637 #define RATE_DECREASE_TH 1920
2640 #define IL_LEGACY_SWITCH_ANTENNA1 0
2641 #define IL_LEGACY_SWITCH_ANTENNA2 1
2642 #define IL_LEGACY_SWITCH_SISO 2
2643 #define IL_LEGACY_SWITCH_MIMO2_AB 3
2644 #define IL_LEGACY_SWITCH_MIMO2_AC 4
2645 #define IL_LEGACY_SWITCH_MIMO2_BC 5
2648 #define IL_SISO_SWITCH_ANTENNA1 0
2649 #define IL_SISO_SWITCH_ANTENNA2 1
2650 #define IL_SISO_SWITCH_MIMO2_AB 2
2651 #define IL_SISO_SWITCH_MIMO2_AC 3
2652 #define IL_SISO_SWITCH_MIMO2_BC 4
2653 #define IL_SISO_SWITCH_GI 5
2656 #define IL_MIMO2_SWITCH_ANTENNA1 0
2657 #define IL_MIMO2_SWITCH_ANTENNA2 1
2658 #define IL_MIMO2_SWITCH_SISO_A 2
2659 #define IL_MIMO2_SWITCH_SISO_B 3
2660 #define IL_MIMO2_SWITCH_SISO_C 4
2661 #define IL_MIMO2_SWITCH_GI 5
2663 #define IL_MAX_SEARCH IL_MIMO2_SWITCH_GI
2665 #define IL_ACTION_LIMIT 3
2670 #define IL_AGG_TPT_THREHOLD 0
2671 #define IL_AGG_LOAD_THRESHOLD 10
2672 #define IL_AGG_ALL_TID 0xff
2673 #define TID_QUEUE_CELL_SPACING 50
2674 #define TID_QUEUE_MAX_SIZE 20
2675 #define TID_ROUND_VALUE 5
2676 #define TID_MAX_LOAD_COUNT 8
2678 #define TID_MAX_TIME_DIFF ((TID_QUEUE_MAX_SIZE - 1) * TID_QUEUE_CELL_SPACING)
2679 #define TIME_WRAP_AROUND(x, y) (((y) > (x)) ? (y) - (x) : (0-(x)) + (y))
2692 #define is_legacy(tbl) ((tbl) == LQ_G || (tbl) == LQ_A)
2693 #define is_siso(tbl) ((tbl) == LQ_SISO)
2694 #define is_mimo2(tbl) ((tbl) == LQ_MIMO2)
2695 #define is_mimo(tbl) (is_mimo2(tbl))
2696 #define is_Ht(tbl) (is_siso(tbl) || is_mimo(tbl))
2697 #define is_a_band(tbl) ((tbl) == LQ_A)
2698 #define is_g_and(tbl) ((tbl) == LQ_G)
2700 #define ANT_NONE 0x0
2701 #define ANT_A BIT(0)
2702 #define ANT_B BIT(1)
2703 #define ANT_AB (ANT_A | ANT_B)
2704 #define ANT_C BIT(2)
2705 #define ANT_AC (ANT_A | ANT_C)
2706 #define ANT_BC (ANT_B | ANT_C)
2707 #define ANT_ABC (ANT_AB | ANT_C)
2709 #define IL_MAX_MCS_DISPLAY_SIZE 12
2725 unsigned long stamp;
2796 #ifdef CONFIG_MAC80211_DEBUGFS
2797 struct dentry *rs_sta_dbgfs_scale_table_file;
2798 struct dentry *rs_sta_dbgfs_stats_table_file;
2799 struct dentry *rs_sta_dbgfs_rate_scale_data_file;
2800 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file;
2832 il4965_num_of_ant(
u8 m)
2838 il4965_first_antenna(
u8 mask)
2888 #ifdef CONFIG_IWLEGACY_DEBUG
2897 il_get_debug_level(
struct il_priv *il)
2899 if (il->debug_level)
2900 return il->debug_level;
2906 il_get_debug_level(
struct il_priv *il)
2912 #define il_print_hex_error(il, p, len) \
2914 print_hex_dump(KERN_ERR, "iwl data: ", \
2915 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
2918 #ifdef CONFIG_IWLEGACY_DEBUG
2919 #define IL_DBG(level, fmt, args...) \
2921 if (il_get_debug_level(il) & level) \
2922 dev_printk(KERN_ERR, &il->hw->wiphy->dev, \
2923 "%c %s " fmt, in_interrupt() ? 'I' : 'U', \
2924 __func__ , ## args); \
2927 #define il_print_hex_dump(il, level, p, len) \
2929 if (il_get_debug_level(il) & level) \
2930 print_hex_dump(KERN_DEBUG, "iwl data: ", \
2931 DUMP_PREFIX_OFFSET, 16, 1, p, len, 1); \
2935 #define IL_DBG(level, fmt, args...)
2942 #ifdef CONFIG_IWLEGACY_DEBUGFS
2982 #define IL_DL_INFO (1 << 0)
2983 #define IL_DL_MAC80211 (1 << 1)
2984 #define IL_DL_HCMD (1 << 2)
2985 #define IL_DL_STATE (1 << 3)
2987 #define IL_DL_MACDUMP (1 << 4)
2988 #define IL_DL_HCMD_DUMP (1 << 5)
2989 #define IL_DL_EEPROM (1 << 6)
2990 #define IL_DL_RADIO (1 << 7)
2992 #define IL_DL_POWER (1 << 8)
2993 #define IL_DL_TEMP (1 << 9)
2994 #define IL_DL_NOTIF (1 << 10)
2995 #define IL_DL_SCAN (1 << 11)
2997 #define IL_DL_ASSOC (1 << 12)
2998 #define IL_DL_DROP (1 << 13)
2999 #define IL_DL_TXPOWER (1 << 14)
3000 #define IL_DL_AP (1 << 15)
3002 #define IL_DL_FW (1 << 16)
3003 #define IL_DL_RF_KILL (1 << 17)
3004 #define IL_DL_FW_ERRORS (1 << 18)
3005 #define IL_DL_LED (1 << 19)
3007 #define IL_DL_RATE (1 << 20)
3008 #define IL_DL_CALIB (1 << 21)
3009 #define IL_DL_WEP (1 << 22)
3010 #define IL_DL_TX (1 << 23)
3012 #define IL_DL_RX (1 << 24)
3013 #define IL_DL_ISR (1 << 25)
3014 #define IL_DL_HT (1 << 26)
3016 #define IL_DL_11H (1 << 28)
3017 #define IL_DL_STATS (1 << 29)
3018 #define IL_DL_TX_REPLY (1 << 30)
3019 #define IL_DL_QOS (1 << 31)
3021 #define D_INFO(f, a...) IL_DBG(IL_DL_INFO, f, ## a)
3022 #define D_MAC80211(f, a...) IL_DBG(IL_DL_MAC80211, f, ## a)
3023 #define D_MACDUMP(f, a...) IL_DBG(IL_DL_MACDUMP, f, ## a)
3024 #define D_TEMP(f, a...) IL_DBG(IL_DL_TEMP, f, ## a)
3025 #define D_SCAN(f, a...) IL_DBG(IL_DL_SCAN, f, ## a)
3026 #define D_RX(f, a...) IL_DBG(IL_DL_RX, f, ## a)
3027 #define D_TX(f, a...) IL_DBG(IL_DL_TX, f, ## a)
3028 #define D_ISR(f, a...) IL_DBG(IL_DL_ISR, f, ## a)
3029 #define D_LED(f, a...) IL_DBG(IL_DL_LED, f, ## a)
3030 #define D_WEP(f, a...) IL_DBG(IL_DL_WEP, f, ## a)
3031 #define D_HC(f, a...) IL_DBG(IL_DL_HCMD, f, ## a)
3032 #define D_HC_DUMP(f, a...) IL_DBG(IL_DL_HCMD_DUMP, f, ## a)
3033 #define D_EEPROM(f, a...) IL_DBG(IL_DL_EEPROM, f, ## a)
3034 #define D_CALIB(f, a...) IL_DBG(IL_DL_CALIB, f, ## a)
3035 #define D_FW(f, a...) IL_DBG(IL_DL_FW, f, ## a)
3036 #define D_RF_KILL(f, a...) IL_DBG(IL_DL_RF_KILL, f, ## a)
3037 #define D_DROP(f, a...) IL_DBG(IL_DL_DROP, f, ## a)
3038 #define D_AP(f, a...) IL_DBG(IL_DL_AP, f, ## a)
3039 #define D_TXPOWER(f, a...) IL_DBG(IL_DL_TXPOWER, f, ## a)
3040 #define D_RATE(f, a...) IL_DBG(IL_DL_RATE, f, ## a)
3041 #define D_NOTIF(f, a...) IL_DBG(IL_DL_NOTIF, f, ## a)
3042 #define D_ASSOC(f, a...) IL_DBG(IL_DL_ASSOC, f, ## a)
3043 #define D_HT(f, a...) IL_DBG(IL_DL_HT, f, ## a)
3044 #define D_STATS(f, a...) IL_DBG(IL_DL_STATS, f, ## a)
3045 #define D_TX_REPLY(f, a...) IL_DBG(IL_DL_TX_REPLY, f, ## a)
3046 #define D_QOS(f, a...) IL_DBG(IL_DL_QOS, f, ## a)
3047 #define D_RADIO(f, a...) IL_DBG(IL_DL_RADIO, f, ## a)
3048 #define D_POWER(f, a...) IL_DBG(IL_DL_POWER, f, ## a)
3049 #define D_11H(f, a...) IL_DBG(IL_DL_11H, f, ## a)