Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge branch 'master' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next-2.6

+1124 -1021
+12 -39
drivers/net/wireless/ath/ath9k/eeprom.c
··· 694 694 #undef TMP_VAL_VPD_TABLE 695 695 } 696 696 697 - static bool ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, 697 + static void ath9k_hw_set_4k_power_cal_table(struct ath_hw *ah, 698 698 struct ath9k_channel *chan, 699 699 int16_t *pTxPowerIndexOffset) 700 700 { ··· 805 805 } 806 806 807 807 *pTxPowerIndexOffset = 0; 808 - 809 - return true; 810 808 } 811 809 812 - static bool ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, 810 + static void ath9k_hw_set_4k_power_per_rate_table(struct ath_hw *ah, 813 811 struct ath9k_channel *chan, 814 812 int16_t *ratesArray, 815 813 u16 cfgCtl, ··· 1039 1041 ratesArray[rateExtOfdm] = targetPowerOfdmExt.tPow2x[0]; 1040 1042 ratesArray[rateExtCck] = targetPowerCckExt.tPow2x[0]; 1041 1043 } 1042 - return true; 1043 1044 } 1044 1045 1045 - static int ath9k_hw_4k_set_txpower(struct ath_hw *ah, 1046 + static void ath9k_hw_4k_set_txpower(struct ath_hw *ah, 1046 1047 struct ath9k_channel *chan, 1047 1048 u16 cfgCtl, 1048 1049 u8 twiceAntennaReduction, ··· 1062 1065 ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; 1063 1066 } 1064 1067 1065 - if (!ath9k_hw_set_4k_power_per_rate_table(ah, chan, 1068 + ath9k_hw_set_4k_power_per_rate_table(ah, chan, 1066 1069 &ratesArray[0], cfgCtl, 1067 1070 twiceAntennaReduction, 1068 1071 twiceMaxRegulatoryPower, 1069 - powerLimit)) { 1070 - DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 1071 - "ath9k_hw_set_txpower: unable to set " 1072 - "tx power per rate table\n"); 1073 - return -EIO; 1074 - } 1072 + powerLimit); 1075 1073 1076 - if (!ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset)) { 1077 - DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 1078 - "ath9k_hw_set_txpower: unable to set power table\n"); 1079 - return -EIO; 1080 - } 1074 + ath9k_hw_set_4k_power_cal_table(ah, chan, &txPowerIndexOffset); 1081 1075 1082 1076 for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { 1083 1077 ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); ··· 1156 1168 else 1157 1169 ah->regulatory.max_power_level = ratesArray[i]; 1158 1170 1159 - return 0; 1160 1171 } 1161 1172 1162 1173 static void ath9k_hw_4k_set_addac(struct ath_hw *ah, ··· 2090 2103 return; 2091 2104 } 2092 2105 2093 - static bool ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, 2106 + static void ath9k_hw_set_def_power_cal_table(struct ath_hw *ah, 2094 2107 struct ath9k_channel *chan, 2095 2108 int16_t *pTxPowerIndexOffset) 2096 2109 { ··· 2242 2255 } 2243 2256 2244 2257 *pTxPowerIndexOffset = 0; 2245 - 2246 - return true; 2247 2258 #undef SM_PD_GAIN 2248 2259 #undef SM_PDGAIN_B 2249 2260 } 2250 2261 2251 - static bool ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, 2262 + static void ath9k_hw_set_def_power_per_rate_table(struct ath_hw *ah, 2252 2263 struct ath9k_channel *chan, 2253 2264 int16_t *ratesArray, 2254 2265 u16 cfgCtl, ··· 2534 2549 targetPowerCckExt.tPow2x[0]; 2535 2550 } 2536 2551 } 2537 - return true; 2538 2552 } 2539 2553 2540 - static int ath9k_hw_def_set_txpower(struct ath_hw *ah, 2554 + static void ath9k_hw_def_set_txpower(struct ath_hw *ah, 2541 2555 struct ath9k_channel *chan, 2542 2556 u16 cfgCtl, 2543 2557 u8 twiceAntennaReduction, ··· 2559 2575 ht40PowerIncForPdadc = pModal->ht40PowerIncForPdadc; 2560 2576 } 2561 2577 2562 - if (!ath9k_hw_set_def_power_per_rate_table(ah, chan, 2578 + ath9k_hw_set_def_power_per_rate_table(ah, chan, 2563 2579 &ratesArray[0], cfgCtl, 2564 2580 twiceAntennaReduction, 2565 2581 twiceMaxRegulatoryPower, 2566 - powerLimit)) { 2567 - DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 2568 - "ath9k_hw_set_txpower: unable to set " 2569 - "tx power per rate table\n"); 2570 - return -EIO; 2571 - } 2582 + powerLimit); 2572 2583 2573 - if (!ath9k_hw_set_def_power_cal_table(ah, chan, &txPowerIndexOffset)) { 2574 - DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 2575 - "ath9k_hw_set_txpower: unable to set power table\n"); 2576 - return -EIO; 2577 - } 2584 + ath9k_hw_set_def_power_cal_table(ah, chan, &txPowerIndexOffset); 2578 2585 2579 2586 for (i = 0; i < ARRAY_SIZE(ratesArray); i++) { 2580 2587 ratesArray[i] = (int16_t)(txPowerIndexOffset + ratesArray[i]); ··· 2692 2717 "Invalid chainmask configuration\n"); 2693 2718 break; 2694 2719 } 2695 - 2696 - return 0; 2697 2720 } 2698 2721 2699 2722 static u8 ath9k_hw_def_get_num_ant_config(struct ath_hw *ah,
+1 -1
drivers/net/wireless/ath/ath9k/eeprom.h
··· 494 494 struct ath9k_channel *chan); 495 495 void (*set_board_values)(struct ath_hw *hw, struct ath9k_channel *chan); 496 496 void (*set_addac)(struct ath_hw *hw, struct ath9k_channel *chan); 497 - int (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, 497 + void (*set_txpower)(struct ath_hw *hw, struct ath9k_channel *chan, 498 498 u16 cfgCtl, u8 twiceAntennaReduction, 499 499 u8 twiceMaxRegulatoryPower, u8 powerLimit); 500 500 u16 (*get_spur_channel)(struct ath_hw *ah, u16 i, bool is2GHz);
+19 -40
drivers/net/wireless/ath/ath9k/hw.c
··· 1274 1274 int i, regWrites = 0; 1275 1275 struct ieee80211_channel *channel = chan->chan; 1276 1276 u32 modesIndex, freqIndex; 1277 - int status; 1278 1277 1279 1278 switch (chan->chanmode) { 1280 1279 case CHANNEL_A: ··· 1375 1376 if (OLC_FOR_AR9280_20_LATER) 1376 1377 ath9k_olc_init(ah); 1377 1378 1378 - status = ah->eep_ops->set_txpower(ah, chan, 1379 - ath9k_regd_get_ctl(&ah->regulatory, chan), 1380 - channel->max_antenna_gain * 2, 1381 - channel->max_power * 2, 1382 - min((u32) MAX_RATE_POWER, 1383 - (u32) ah->regulatory.power_limit)); 1384 - if (status != 0) { 1385 - DPRINTF(ah->ah_sc, ATH_DBG_FATAL, 1386 - "Error initializing transmit power\n"); 1387 - return -EIO; 1388 - } 1379 + ah->eep_ops->set_txpower(ah, chan, 1380 + ath9k_regd_get_ctl(&ah->regulatory, chan), 1381 + channel->max_antenna_gain * 2, 1382 + channel->max_power * 2, 1383 + min((u32) MAX_RATE_POWER, 1384 + (u32) ah->regulatory.power_limit)); 1389 1385 1390 1386 if (!ath9k_hw_set_rf_regs(ah, chan, freqIndex)) { 1391 1387 DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ··· 1611 1617 switch (type) { 1612 1618 case ATH9K_RESET_POWER_ON: 1613 1619 return ath9k_hw_set_reset_power_on(ah); 1614 - break; 1615 1620 case ATH9K_RESET_WARM: 1616 1621 case ATH9K_RESET_COLD: 1617 1622 return ath9k_hw_set_reset(ah, type); 1618 - break; 1619 1623 default: 1620 1624 return false; 1621 1625 } ··· 1695 1703 ath9k_hw_set_regs(ah, chan, macmode); 1696 1704 1697 1705 if (AR_SREV_9280_10_OR_LATER(ah)) { 1698 - if (!(ath9k_hw_ar9280_set_channel(ah, chan))) { 1699 - DPRINTF(ah->ah_sc, ATH_DBG_FATAL, 1700 - "Failed to set channel\n"); 1701 - return false; 1702 - } 1706 + ath9k_hw_ar9280_set_channel(ah, chan); 1703 1707 } else { 1704 1708 if (!(ath9k_hw_set_channel(ah, chan))) { 1705 1709 DPRINTF(ah->ah_sc, ATH_DBG_FATAL, ··· 1704 1716 } 1705 1717 } 1706 1718 1707 - if (ah->eep_ops->set_txpower(ah, chan, 1719 + ah->eep_ops->set_txpower(ah, chan, 1708 1720 ath9k_regd_get_ctl(&ah->regulatory, chan), 1709 1721 channel->max_antenna_gain * 2, 1710 1722 channel->max_power * 2, 1711 1723 min((u32) MAX_RATE_POWER, 1712 - (u32) ah->regulatory.power_limit)) != 0) { 1713 - DPRINTF(ah->ah_sc, ATH_DBG_EEPROM, 1714 - "Error initializing transmit power\n"); 1715 - return false; 1716 - } 1724 + (u32) ah->regulatory.power_limit)); 1717 1725 1718 1726 synthDelay = REG_READ(ah, AR_PHY_RX_DELAY) & AR_PHY_RX_DELAY_DELAY; 1719 1727 if (IS_CHAN_B(chan)) ··· 2297 2313 2298 2314 REG_WRITE(ah, AR_RSSI_THR, INIT_RSSI_THR); 2299 2315 2300 - if (AR_SREV_9280_10_OR_LATER(ah)) { 2301 - if (!(ath9k_hw_ar9280_set_channel(ah, chan))) 2302 - return -EIO; 2303 - } else { 2316 + if (AR_SREV_9280_10_OR_LATER(ah)) 2317 + ath9k_hw_ar9280_set_channel(ah, chan); 2318 + else 2304 2319 if (!(ath9k_hw_set_channel(ah, chan))) 2305 2320 return -EIO; 2306 - } 2307 2321 2308 2322 for (i = 0; i < AR_NUM_DCU; i++) 2309 2323 REG_WRITE(ah, AR_DQCUMASK(i), 1 << i); ··· 3732 3750 return ath9k_hw_set_reset_reg(ah, ATH9K_RESET_COLD); 3733 3751 } 3734 3752 3735 - bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit) 3753 + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit) 3736 3754 { 3737 3755 struct ath9k_channel *chan = ah->curchan; 3738 3756 struct ieee80211_channel *channel = chan->chan; 3739 3757 3740 3758 ah->regulatory.power_limit = min(limit, (u32) MAX_RATE_POWER); 3741 3759 3742 - if (ah->eep_ops->set_txpower(ah, chan, 3743 - ath9k_regd_get_ctl(&ah->regulatory, chan), 3744 - channel->max_antenna_gain * 2, 3745 - channel->max_power * 2, 3746 - min((u32) MAX_RATE_POWER, 3747 - (u32) ah->regulatory.power_limit)) != 0) 3748 - return false; 3749 - 3750 - return true; 3760 + ah->eep_ops->set_txpower(ah, chan, 3761 + ath9k_regd_get_ctl(&ah->regulatory, chan), 3762 + channel->max_antenna_gain * 2, 3763 + channel->max_power * 2, 3764 + min((u32) MAX_RATE_POWER, 3765 + (u32) ah->regulatory.power_limit)); 3751 3766 } 3752 3767 3753 3768 void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac)
+1 -1
drivers/net/wireless/ath/ath9k/hw.h
··· 590 590 void ath9k_hw_setrxfilter(struct ath_hw *ah, u32 bits); 591 591 bool ath9k_hw_phy_disable(struct ath_hw *ah); 592 592 bool ath9k_hw_disable(struct ath_hw *ah); 593 - bool ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit); 593 + void ath9k_hw_set_txpowerlimit(struct ath_hw *ah, u32 limit); 594 594 void ath9k_hw_setmac(struct ath_hw *ah, const u8 *mac); 595 595 void ath9k_hw_setopmode(struct ath_hw *ah); 596 596 void ath9k_hw_setmcastfilter(struct ath_hw *ah, u32 filter0, u32 filter1);
+2 -5
drivers/net/wireless/ath/ath9k/phy.c
··· 96 96 return true; 97 97 } 98 98 99 - bool 100 - ath9k_hw_ar9280_set_channel(struct ath_hw *ah, 101 - struct ath9k_channel *chan) 99 + void ath9k_hw_ar9280_set_channel(struct ath_hw *ah, 100 + struct ath9k_channel *chan) 102 101 { 103 102 u16 bMode, fracMode, aModeRefSel = 0; 104 103 u32 freq, ndiv, channelSel = 0, channelFrac = 0, reg32 = 0; ··· 168 169 169 170 ah->curchan = chan; 170 171 ah->curchan_rad_index = -1; 171 - 172 - return true; 173 172 } 174 173 175 174 static void
+1 -1
drivers/net/wireless/ath/ath9k/phy.h
··· 17 17 #ifndef PHY_H 18 18 #define PHY_H 19 19 20 - bool ath9k_hw_ar9280_set_channel(struct ath_hw *ah, 20 + void ath9k_hw_ar9280_set_channel(struct ath_hw *ah, 21 21 struct ath9k_channel 22 22 *chan); 23 23 bool ath9k_hw_set_channel(struct ath_hw *ah,
+5 -7
drivers/net/wireless/iwlwifi/iwl-3945.c
··· 1110 1110 1111 1111 spin_lock_irqsave(&priv->lock, flags); 1112 1112 1113 + /* Determine HW type */ 1114 + pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id); 1115 + 1116 + IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); 1117 + 1113 1118 if (rev_id & PCI_CFG_REV_ID_BIT_RTP) 1114 1119 IWL_DEBUG_INFO(priv, "RTP type \n"); 1115 1120 else if (rev_id & PCI_CFG_REV_ID_BIT_BASIC_SKU) { ··· 1168 1163 1169 1164 int iwl3945_hw_nic_init(struct iwl_priv *priv) 1170 1165 { 1171 - u8 rev_id; 1172 1166 int rc; 1173 1167 unsigned long flags; 1174 1168 struct iwl_rx_queue *rxq = &priv->rxq; ··· 1175 1171 spin_lock_irqsave(&priv->lock, flags); 1176 1172 priv->cfg->ops->lib->apm_ops.init(priv); 1177 1173 spin_unlock_irqrestore(&priv->lock, flags); 1178 - 1179 - /* Determine HW type */ 1180 - rc = pci_read_config_byte(priv->pci_dev, PCI_REVISION_ID, &rev_id); 1181 - if (rc) 1182 - return rc; 1183 - IWL_DEBUG_INFO(priv, "HW Revision ID = 0x%X\n", rev_id); 1184 1174 1185 1175 rc = priv->cfg->ops->lib->apm_ops.set_pwr_src(priv, IWL_PWR_SRC_VMAIN); 1186 1176 if (rc)
+80 -9
drivers/net/wireless/iwlwifi/iwl-agn-rs.c
··· 100 100 u8 is_fat; /* 1 = 40 MHz channel width */ 101 101 u8 is_dup; /* 1 = duplicated data streams */ 102 102 u8 action; /* change modulation; IWL_[LEGACY/SISO/MIMO]_SWITCH_* */ 103 + u8 max_search; /* maximun number of tables we can search */ 103 104 s32 *expected_tpt; /* throughput metrics; expected_tpt_G, etc. */ 104 105 u32 current_rate; /* rate_n_flags, uCode API format */ 105 106 struct iwl_rate_scale_data win[IWL_RATE_COUNT]; /* rate histories */ ··· 161 160 #ifdef CONFIG_MAC80211_DEBUGFS 162 161 struct dentry *rs_sta_dbgfs_scale_table_file; 163 162 struct dentry *rs_sta_dbgfs_stats_table_file; 163 + struct dentry *rs_sta_dbgfs_rate_scale_data_file; 164 164 struct dentry *rs_sta_dbgfs_tx_agg_tid_en_file; 165 165 u32 dbg_fixed_rate; 166 166 #endif ··· 581 579 tbl->is_dup = 0; 582 580 tbl->ant_type = (ant_msk >> RATE_MCS_ANT_POS); 583 581 tbl->lq_type = LQ_NONE; 582 + tbl->max_search = IWL_MAX_SEARCH; 584 583 585 584 /* legacy rate format */ 586 585 if (!(rate_n_flags & RATE_MCS_HT_MSK)) { ··· 615 612 tbl->lq_type = LQ_MIMO2; 616 613 /* MIMO3 */ 617 614 } else { 618 - if (num_of_ant == 3) 615 + if (num_of_ant == 3) { 616 + tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; 619 617 tbl->lq_type = LQ_MIMO3; 618 + } 620 619 } 621 620 } 622 621 return 0; ··· 776 771 777 772 tbl->is_fat = 0; 778 773 tbl->is_SGI = 0; 774 + tbl->max_search = IWL_MAX_SEARCH; 779 775 } 780 776 781 777 rate_mask = rs_get_supported_rates(lq_sta, NULL, tbl->lq_type); ··· 1032 1026 lq_sta->total_failed = 0; 1033 1027 lq_sta->total_success = 0; 1034 1028 lq_sta->flush_timer = jiffies; 1029 + lq_sta->action_counter = 0; 1035 1030 } 1036 1031 1037 1032 /* ··· 1212 1205 tbl->lq_type = LQ_MIMO2; 1213 1206 tbl->is_dup = lq_sta->is_dup; 1214 1207 tbl->action = 0; 1208 + tbl->max_search = IWL_MAX_SEARCH; 1215 1209 rate_mask = lq_sta->active_mimo2_rate; 1216 1210 1217 1211 if (iwl_is_fat_tx_allowed(priv, &sta->ht_cap)) ··· 1278 1270 tbl->lq_type = LQ_MIMO3; 1279 1271 tbl->is_dup = lq_sta->is_dup; 1280 1272 tbl->action = 0; 1273 + tbl->max_search = IWL_MAX_11N_MIMO3_SEARCH; 1281 1274 rate_mask = lq_sta->active_mimo3_rate; 1282 1275 1283 1276 if (iwl_is_fat_tx_allowed(priv, &sta->ht_cap)) ··· 1337 1328 tbl->is_dup = lq_sta->is_dup; 1338 1329 tbl->lq_type = LQ_SISO; 1339 1330 tbl->action = 0; 1331 + tbl->max_search = IWL_MAX_SEARCH; 1340 1332 rate_mask = lq_sta->active_siso_rate; 1341 1333 1342 1334 if (iwl_is_fat_tx_allowed(priv, &sta->ht_cap)) ··· 1394 1384 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1395 1385 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1396 1386 int ret = 0; 1387 + u8 update_search_tbl_counter = 0; 1397 1388 1398 1389 for (; ;) { 1390 + lq_sta->action_counter++; 1399 1391 switch (tbl->action) { 1400 1392 case IWL_LEGACY_SWITCH_ANTENNA1: 1401 1393 case IWL_LEGACY_SWITCH_ANTENNA2: 1402 1394 IWL_DEBUG_RATE(priv, "LQ: Legacy toggle Antenna\n"); 1403 - 1404 - lq_sta->action_counter++; 1405 1395 1406 1396 if ((tbl->action == IWL_LEGACY_SWITCH_ANTENNA1 && 1407 1397 tx_chains_num <= 1) || ··· 1418 1408 1419 1409 if (rs_toggle_antenna(valid_tx_ant, 1420 1410 &search_tbl->current_rate, search_tbl)) { 1411 + update_search_tbl_counter = 1; 1421 1412 rs_set_expected_tpt_table(lq_sta, search_tbl); 1422 1413 goto out; 1423 1414 } ··· 1500 1489 tbl->action++; 1501 1490 if (tbl->action > IWL_LEGACY_SWITCH_MIMO3_ABC) 1502 1491 tbl->action = IWL_LEGACY_SWITCH_ANTENNA1; 1492 + if (update_search_tbl_counter) 1493 + search_tbl->action = tbl->action; 1503 1494 return 0; 1504 1495 1505 1496 } ··· 1524 1511 u8 start_action = tbl->action; 1525 1512 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1526 1513 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1514 + u8 update_search_tbl_counter = 0; 1527 1515 int ret; 1528 1516 1529 1517 for (;;) { ··· 1545 1531 1546 1532 memcpy(search_tbl, tbl, sz); 1547 1533 if (rs_toggle_antenna(valid_tx_ant, 1548 - &search_tbl->current_rate, search_tbl)) 1534 + &search_tbl->current_rate, search_tbl)) { 1535 + update_search_tbl_counter = 1; 1549 1536 goto out; 1537 + } 1550 1538 break; 1551 1539 case IWL_SISO_SWITCH_MIMO2_AB: 1552 1540 case IWL_SISO_SWITCH_MIMO2_AC: ··· 1602 1586 search_tbl->current_rate = 1603 1587 rate_n_flags_from_tbl(priv, search_tbl, 1604 1588 index, is_green); 1589 + update_search_tbl_counter = 1; 1605 1590 goto out; 1606 1591 case IWL_SISO_SWITCH_MIMO3_ABC: 1607 1592 IWL_DEBUG_RATE(priv, "LQ: SISO switch to MIMO3\n"); ··· 1634 1617 tbl->action++; 1635 1618 if (tbl->action > IWL_SISO_SWITCH_MIMO3_ABC) 1636 1619 tbl->action = IWL_SISO_SWITCH_ANTENNA1; 1620 + if (update_search_tbl_counter) 1621 + search_tbl->action = tbl->action; 1622 + 1637 1623 return 0; 1638 1624 } 1639 1625 ··· 1658 1638 u8 start_action = tbl->action; 1659 1639 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1660 1640 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1641 + u8 update_search_tbl_counter = 0; 1661 1642 int ret; 1662 1643 1663 1644 for (;;) { ··· 1676 1655 1677 1656 memcpy(search_tbl, tbl, sz); 1678 1657 if (rs_toggle_antenna(valid_tx_ant, 1679 - &search_tbl->current_rate, search_tbl)) 1658 + &search_tbl->current_rate, search_tbl)) { 1659 + update_search_tbl_counter = 1; 1680 1660 goto out; 1661 + } 1681 1662 break; 1682 1663 case IWL_MIMO2_SWITCH_SISO_A: 1683 1664 case IWL_MIMO2_SWITCH_SISO_B: ··· 1736 1713 search_tbl->current_rate = 1737 1714 rate_n_flags_from_tbl(priv, search_tbl, 1738 1715 index, is_green); 1716 + update_search_tbl_counter = 1; 1739 1717 goto out; 1740 1718 1741 1719 case IWL_MIMO2_SWITCH_MIMO3_ABC: ··· 1769 1745 tbl->action++; 1770 1746 if (tbl->action > IWL_MIMO2_SWITCH_MIMO3_ABC) 1771 1747 tbl->action = IWL_MIMO2_SWITCH_ANTENNA1; 1748 + if (update_search_tbl_counter) 1749 + search_tbl->action = tbl->action; 1750 + 1772 1751 return 0; 1773 1752 1774 1753 } ··· 1795 1768 u8 valid_tx_ant = priv->hw_params.valid_tx_ant; 1796 1769 u8 tx_chains_num = priv->hw_params.tx_chains_num; 1797 1770 int ret; 1771 + u8 update_search_tbl_counter = 0; 1798 1772 1799 1773 for (;;) { 1800 1774 lq_sta->action_counter++; ··· 1894 1866 search_tbl->current_rate = 1895 1867 rate_n_flags_from_tbl(priv, search_tbl, 1896 1868 index, is_green); 1869 + update_search_tbl_counter = 1; 1897 1870 goto out; 1898 1871 } 1899 1872 tbl->action++; ··· 1911 1882 tbl->action++; 1912 1883 if (tbl->action > IWL_MIMO3_SWITCH_GI) 1913 1884 tbl->action = IWL_MIMO3_SWITCH_ANTENNA1; 1885 + if (update_search_tbl_counter) 1886 + search_tbl->action = tbl->action; 1887 + 1914 1888 return 0; 1915 1889 1916 1890 } ··· 2358 2326 * before next round of mode comparisons. */ 2359 2327 tbl1 = &(lq_sta->lq_info[lq_sta->active_tbl]); 2360 2328 if (is_legacy(tbl1->lq_type) && !conf_is_ht(conf) && 2361 - lq_sta->action_counter >= 1) { 2362 - lq_sta->action_counter = 0; 2329 + lq_sta->action_counter > tbl1->max_search) { 2363 2330 IWL_DEBUG_RATE(priv, "LQ: STAY in legacy table\n"); 2364 2331 rs_set_stay_in_table(priv, 1, lq_sta); 2365 2332 } ··· 2367 2336 * have been tried and compared, stay in this best modulation 2368 2337 * mode for a while before next round of mode comparisons. */ 2369 2338 if (lq_sta->enable_counter && 2370 - (lq_sta->action_counter >= IWL_ACTION_LIMIT)) { 2339 + (lq_sta->action_counter >= tbl1->max_search)) { 2371 2340 if ((lq_sta->last_tpt > IWL_AGG_TPT_THREHOLD) && 2372 2341 (lq_sta->tx_agg_tid_en & (1 << tid)) && 2373 2342 (tid != MAX_TID_COUNT)) { ··· 2381 2350 lq_sta, sta); 2382 2351 } 2383 2352 } 2384 - lq_sta->action_counter = 0; 2385 2353 rs_set_stay_in_table(priv, 0, lq_sta); 2386 2354 } 2387 2355 } ··· 2985 2955 .open = open_file_generic, 2986 2956 }; 2987 2957 2958 + static ssize_t rs_sta_dbgfs_rate_scale_data_read(struct file *file, 2959 + char __user *user_buf, size_t count, loff_t *ppos) 2960 + { 2961 + char buff[120]; 2962 + int desc = 0; 2963 + ssize_t ret; 2964 + 2965 + struct iwl_lq_sta *lq_sta = file->private_data; 2966 + struct iwl_priv *priv; 2967 + struct iwl_scale_tbl_info *tbl = &lq_sta->lq_info[lq_sta->active_tbl]; 2968 + 2969 + priv = lq_sta->drv; 2970 + 2971 + if (is_Ht(tbl->lq_type)) 2972 + desc += sprintf(buff+desc, 2973 + "Bit Rate= %d Mb/s\n", 2974 + tbl->expected_tpt[lq_sta->last_txrate_idx]); 2975 + else 2976 + desc += sprintf(buff+desc, 2977 + "Bit Rate= %d Mb/s\n", 2978 + iwl_rates[lq_sta->last_txrate_idx].ieee >> 1); 2979 + desc += sprintf(buff+desc, 2980 + "Signal Level= %d dBm\tNoise Level= %d dBm\n", 2981 + priv->last_rx_rssi, priv->last_rx_noise); 2982 + desc += sprintf(buff+desc, 2983 + "Tsf= 0x%llx\tBeacon time= 0x%08X\n", 2984 + priv->last_tsf, priv->last_beacon_time); 2985 + 2986 + ret = simple_read_from_buffer(user_buf, count, ppos, buff, desc); 2987 + return ret; 2988 + } 2989 + 2990 + static const struct file_operations rs_sta_dbgfs_rate_scale_data_ops = { 2991 + .read = rs_sta_dbgfs_rate_scale_data_read, 2992 + .open = open_file_generic, 2993 + }; 2994 + 2988 2995 static void rs_add_debugfs(void *priv, void *priv_sta, 2989 2996 struct dentry *dir) 2990 2997 { ··· 3032 2965 lq_sta->rs_sta_dbgfs_stats_table_file = 3033 2966 debugfs_create_file("rate_stats_table", 0600, dir, 3034 2967 lq_sta, &rs_sta_dbgfs_stats_table_ops); 2968 + lq_sta->rs_sta_dbgfs_rate_scale_data_file = 2969 + debugfs_create_file("rate_scale_data", 0600, dir, 2970 + lq_sta, &rs_sta_dbgfs_rate_scale_data_ops); 3035 2971 lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file = 3036 2972 debugfs_create_u8("tx_agg_tid_enable", 0600, dir, 3037 2973 &lq_sta->tx_agg_tid_en); ··· 3046 2976 struct iwl_lq_sta *lq_sta = priv_sta; 3047 2977 debugfs_remove(lq_sta->rs_sta_dbgfs_scale_table_file); 3048 2978 debugfs_remove(lq_sta->rs_sta_dbgfs_stats_table_file); 2979 + debugfs_remove(lq_sta->rs_sta_dbgfs_rate_scale_data_file); 3049 2980 debugfs_remove(lq_sta->rs_sta_dbgfs_tx_agg_tid_en_file); 3050 2981 } 3051 2982 #endif
+2
drivers/net/wireless/iwlwifi/iwl-agn-rs.h
··· 275 275 #define IWL_MIMO3_SWITCH_GI 8 276 276 277 277 278 + #define IWL_MAX_11N_MIMO3_SEARCH IWL_MIMO3_SWITCH_GI 279 + #define IWL_MAX_SEARCH IWL_MIMO2_SWITCH_MIMO3_ABC 278 280 279 281 /*FIXME:RS:add possible actions for MIMO3*/ 280 282
+37 -52
drivers/net/wireless/iwlwifi/iwl-agn.c
··· 190 190 191 191 priv->cfg->ops->smgmt->clear_station_table(priv); 192 192 193 - if (!priv->error_recovering) 194 - priv->start_calib = 0; 193 + priv->start_calib = 0; 195 194 196 195 /* Add the broadcast address so we can send broadcast frames */ 197 196 if (iwl_rxon_add_station(priv, iwl_bcast_addr, 0) == ··· 966 967 tasklet_kill(&priv->irq_tasklet); 967 968 } 968 969 969 - static void iwl_error_recovery(struct iwl_priv *priv) 970 - { 971 - unsigned long flags; 972 - 973 - memcpy(&priv->staging_rxon, &priv->recovery_rxon, 974 - sizeof(priv->staging_rxon)); 975 - priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 976 - iwlcore_commit_rxon(priv); 977 - 978 - iwl_rxon_add_station(priv, priv->bssid, 1); 979 - 980 - spin_lock_irqsave(&priv->lock, flags); 981 - priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); 982 - priv->error_recovering = 0; 983 - spin_unlock_irqrestore(&priv->lock, flags); 984 - } 985 - 986 970 static void iwl_irq_tasklet(struct iwl_priv *priv) 987 971 { 988 972 u32 inta, handled = 0; ··· 1496 1514 set_bit(STATUS_READY, &priv->status); 1497 1515 wake_up_interruptible(&priv->wait_command_queue); 1498 1516 1499 - if (priv->error_recovering) 1500 - iwl_error_recovery(priv); 1501 - 1502 1517 iwl_power_update_mode(priv, 1); 1503 1518 1504 1519 /* reassociate for ADHOC mode */ ··· 1694 1715 continue; 1695 1716 } 1696 1717 1697 - /* Clear out the uCode error bit if it is set */ 1698 - clear_bit(STATUS_FW_ERROR, &priv->status); 1699 - 1700 1718 /* start card; "initialize" will load runtime ucode */ 1701 1719 iwl_nic_start(priv); 1702 1720 ··· 1788 1812 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 1789 1813 return; 1790 1814 1791 - iwl_down(priv); 1792 - queue_work(priv->workqueue, &priv->up); 1815 + if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 1816 + mutex_lock(&priv->mutex); 1817 + priv->vif = NULL; 1818 + priv->is_open = 0; 1819 + mutex_unlock(&priv->mutex); 1820 + iwl_down(priv); 1821 + ieee80211_restart_hw(priv->hw); 1822 + } else { 1823 + iwl_down(priv); 1824 + queue_work(priv->workqueue, &priv->up); 1825 + } 1793 1826 } 1794 1827 1795 1828 static void iwl_bg_rx_replenish(struct work_struct *data) ··· 1838 1853 if (!priv->vif || !priv->is_open) 1839 1854 return; 1840 1855 1841 - iwl_power_cancel_timeout(priv); 1842 1856 iwl_scan_cancel_timeout(priv, 200); 1843 1857 1844 1858 conf = ieee80211_get_hw_conf(priv->hw); ··· 1913 1929 * If chain noise has already been run, then we need to enable 1914 1930 * power management here */ 1915 1931 if (priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE) 1916 - iwl_power_enable_management(priv); 1932 + iwl_power_update_mode(priv, 0); 1917 1933 1918 1934 /* Enable Rx differential gain and sensitivity calibrations */ 1919 1935 iwl_chain_noise_reset(priv); ··· 1991 2007 1992 2008 IWL_DEBUG_MAC80211(priv, "enter\n"); 1993 2009 1994 - if (!priv->is_open) { 1995 - IWL_DEBUG_MAC80211(priv, "leave - skip\n"); 2010 + if (!priv->is_open) 1996 2011 return; 1997 - } 1998 2012 1999 2013 priv->is_open = 0; 2000 2014 ··· 2464 2482 { 2465 2483 struct iwl_priv *priv = dev_get_drvdata(d); 2466 2484 int mode = priv->power_data.user_power_setting; 2467 - int system = priv->power_data.system_power_setting; 2468 2485 int level = priv->power_data.power_mode; 2469 2486 char *p = buf; 2470 2487 2471 - switch (system) { 2472 - case IWL_POWER_SYS_AUTO: 2473 - p += sprintf(p, "SYSTEM:auto"); 2474 - break; 2475 - case IWL_POWER_SYS_AC: 2476 - p += sprintf(p, "SYSTEM:ac"); 2477 - break; 2478 - case IWL_POWER_SYS_BATTERY: 2479 - p += sprintf(p, "SYSTEM:battery"); 2480 - break; 2481 - } 2482 - 2483 - p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO) ? 2484 - "fixed" : "auto"); 2485 - p += sprintf(p, "\tINDEX:%d", level); 2486 - p += sprintf(p, "\n"); 2488 + p += sprintf(p, "INDEX:%d\t", level); 2489 + p += sprintf(p, "USER:%d\n", mode); 2487 2490 return p - buf + 1; 2488 2491 } 2489 2492 2490 2493 static DEVICE_ATTR(power_level, S_IWUSR | S_IRUSR, show_power_level, 2491 2494 store_power_level); 2492 2495 2496 + static ssize_t show_qos(struct device *d, 2497 + struct device_attribute *attr, char *buf) 2498 + { 2499 + struct iwl_priv *priv = (struct iwl_priv *)d->driver_data; 2500 + char *p = buf; 2501 + int q; 2502 + 2503 + for (q = 0; q < AC_NUM; q++) { 2504 + p += sprintf(p, "\tcw_min\tcw_max\taifsn\ttxop\n"); 2505 + p += sprintf(p, "AC[%d]\t%u\t%u\t%u\t%u\n", q, 2506 + priv->qos_data.def_qos_parm.ac[q].cw_min, 2507 + priv->qos_data.def_qos_parm.ac[q].cw_max, 2508 + priv->qos_data.def_qos_parm.ac[q].aifsn, 2509 + priv->qos_data.def_qos_parm.ac[q].edca_txop); 2510 + } 2511 + 2512 + return p - buf + 1; 2513 + } 2514 + 2515 + static DEVICE_ATTR(qos, S_IRUGO, show_qos, NULL); 2493 2516 2494 2517 static ssize_t show_statistics(struct device *d, 2495 2518 struct device_attribute *attr, char *buf) ··· 2557 2570 INIT_DELAYED_WORK(&priv->alive_start, iwl_bg_alive_start); 2558 2571 2559 2572 iwl_setup_scan_deferred_work(priv); 2560 - iwl_setup_power_deferred_work(priv); 2561 2573 2562 2574 if (priv->cfg->ops->lib->setup_deferred_work) 2563 2575 priv->cfg->ops->lib->setup_deferred_work(priv); ··· 2576 2590 2577 2591 cancel_delayed_work_sync(&priv->init_alive_start); 2578 2592 cancel_delayed_work(&priv->scan_check); 2579 - cancel_delayed_work_sync(&priv->set_power_save); 2580 2593 cancel_delayed_work(&priv->alive_start); 2581 2594 cancel_work_sync(&priv->beacon_update); 2582 2595 del_timer_sync(&priv->statistics_periodic); ··· 2592 2607 &dev_attr_debug_level.attr, 2593 2608 #endif 2594 2609 &dev_attr_version.attr, 2595 - 2610 + &dev_attr_qos.attr, 2596 2611 NULL 2597 2612 }; 2598 2613
+1 -1
drivers/net/wireless/iwlwifi/iwl-calib.c
··· 857 857 priv->cfg->ops->lib->update_chain_flags(priv); 858 858 859 859 data->state = IWL_CHAIN_NOISE_DONE; 860 - iwl_power_enable_management(priv); 860 + iwl_power_update_mode(priv, 0); 861 861 } 862 862 EXPORT_SYMBOL(iwl_chain_noise_calibration); 863 863
+26 -36
drivers/net/wireless/iwlwifi/iwl-core.c
··· 273 273 } 274 274 EXPORT_SYMBOL(iwl_activate_qos); 275 275 276 + /* 277 + * AC CWmin CW max AIFSN TXOP Limit TXOP Limit 278 + * (802.11b) (802.11a/g) 279 + * AC_BK 15 1023 7 0 0 280 + * AC_BE 15 1023 3 0 0 281 + * AC_VI 7 15 2 6.016ms 3.008ms 282 + * AC_VO 3 7 2 3.264ms 1.504ms 283 + */ 276 284 void iwl_reset_qos(struct iwl_priv *priv) 277 285 { 278 286 u16 cw_min = 15; ··· 312 304 if (priv->qos_data.qos_active) 313 305 aifs = 3; 314 306 307 + /* AC_BE */ 315 308 priv->qos_data.def_qos_parm.ac[0].cw_min = cpu_to_le16(cw_min); 316 309 priv->qos_data.def_qos_parm.ac[0].cw_max = cpu_to_le16(cw_max); 317 310 priv->qos_data.def_qos_parm.ac[0].aifsn = aifs; ··· 320 311 priv->qos_data.def_qos_parm.ac[0].reserved1 = 0; 321 312 322 313 if (priv->qos_data.qos_active) { 314 + /* AC_BK */ 323 315 i = 1; 324 316 priv->qos_data.def_qos_parm.ac[i].cw_min = cpu_to_le16(cw_min); 325 317 priv->qos_data.def_qos_parm.ac[i].cw_max = cpu_to_le16(cw_max); ··· 328 318 priv->qos_data.def_qos_parm.ac[i].edca_txop = 0; 329 319 priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; 330 320 321 + /* AC_VI */ 331 322 i = 2; 332 323 priv->qos_data.def_qos_parm.ac[i].cw_min = 333 324 cpu_to_le16((cw_min + 1) / 2 - 1); 334 325 priv->qos_data.def_qos_parm.ac[i].cw_max = 335 - cpu_to_le16(cw_max); 326 + cpu_to_le16(cw_min); 336 327 priv->qos_data.def_qos_parm.ac[i].aifsn = 2; 337 328 if (is_legacy) 338 329 priv->qos_data.def_qos_parm.ac[i].edca_txop = ··· 343 332 cpu_to_le16(3008); 344 333 priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; 345 334 335 + /* AC_VO */ 346 336 i = 3; 347 337 priv->qos_data.def_qos_parm.ac[i].cw_min = 348 338 cpu_to_le16((cw_min + 1) / 4 - 1); 349 339 priv->qos_data.def_qos_parm.ac[i].cw_max = 350 - cpu_to_le16((cw_max + 1) / 2 - 1); 340 + cpu_to_le16((cw_min + 1) / 2 - 1); 351 341 priv->qos_data.def_qos_parm.ac[i].aifsn = 2; 352 342 priv->qos_data.def_qos_parm.ac[i].reserved1 = 0; 353 343 if (is_legacy) ··· 972 960 if (iwl_is_monitor_mode(priv) && 973 961 !(priv->staging_rxon.flags & RXON_FLG_BAND_24G_MSK) && 974 962 ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965)) { 975 - rx_chain = 0x07 << RXON_RX_CHAIN_VALID_POS; 976 - rx_chain |= 0x06 << RXON_RX_CHAIN_FORCE_SEL_POS; 977 - rx_chain |= 0x07 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; 978 - rx_chain |= 0x01 << RXON_RX_CHAIN_DRIVER_FORCE_POS; 963 + rx_chain = ANT_ABC << RXON_RX_CHAIN_VALID_POS; 964 + rx_chain |= ANT_BC << RXON_RX_CHAIN_FORCE_SEL_POS; 965 + rx_chain |= ANT_ABC << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; 966 + rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; 979 967 } 980 968 981 969 priv->staging_rxon.rx_chain = cpu_to_le16(rx_chain); ··· 1132 1120 } 1133 1121 EXPORT_SYMBOL(iwl_connection_init_rx_config); 1134 1122 1135 - void iwl_set_rate(struct iwl_priv *priv) 1123 + static void iwl_set_rate(struct iwl_priv *priv) 1136 1124 { 1137 1125 const struct ieee80211_supported_band *hw = NULL; 1138 1126 struct ieee80211_rate *rate; ··· 1178 1166 priv->staging_rxon.ofdm_basic_rates = 1179 1167 (IWL_OFDM_BASIC_RATES_MASK >> IWL_FIRST_OFDM_RATE) & 0xFF; 1180 1168 } 1181 - EXPORT_SYMBOL(iwl_set_rate); 1182 1169 1183 1170 void iwl_rx_csa(struct iwl_priv *priv, struct iwl_rx_mem_buffer *rxb) 1184 1171 { ··· 1241 1230 IWL_DEBUG(priv, IWL_DL_FW_ERRORS, 1242 1231 "Restarting adapter due to uCode error.\n"); 1243 1232 1244 - if (iwl_is_associated(priv)) { 1245 - memcpy(&priv->recovery_rxon, &priv->active_rxon, 1246 - sizeof(priv->recovery_rxon)); 1247 - priv->error_recovering = 1; 1248 - } 1249 1233 if (priv->cfg->mod_params->restart_fw) 1250 1234 queue_work(priv->workqueue, &priv->restart); 1251 1235 } ··· 1364 1358 priv->ibss_beacon = NULL; 1365 1359 1366 1360 spin_lock_init(&priv->lock); 1367 - spin_lock_init(&priv->power_data.lock); 1368 1361 spin_lock_init(&priv->sta_lock); 1369 1362 spin_lock_init(&priv->hcmd_lock); 1370 1363 ··· 2231 2226 2232 2227 iwl_conf->tx_chan_width = iwl_conf->supported_chan_width != 0; 2233 2228 iwl_conf->ht_protection = 2234 - bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; 2229 + bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_PROTECTION; 2235 2230 iwl_conf->non_GF_STA_present = 2236 - !!(bss_conf->ht.operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 2231 + !!(bss_conf->ht_operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT); 2237 2232 2238 2233 rcu_read_unlock(); 2239 2234 ··· 2587 2582 iwl_set_rate(priv); 2588 2583 } 2589 2584 2590 - if (changed & IEEE80211_CONF_CHANGE_PS) { 2591 - if (conf->flags & IEEE80211_CONF_PS) 2592 - ret = iwl_power_set_user_mode(priv, IWL_POWER_INDEX_3); 2593 - else 2594 - ret = iwl_power_set_user_mode(priv, IWL_POWER_MODE_CAM); 2585 + if (changed & IEEE80211_CONF_CHANGE_PS && 2586 + priv->iw_mode == NL80211_IFTYPE_STATION) { 2587 + priv->power_data.power_disabled = 2588 + !(conf->flags & IEEE80211_CONF_PS); 2589 + ret = iwl_power_update_mode(priv, 0); 2595 2590 if (ret) 2596 2591 IWL_DEBUG_MAC80211(priv, "Error setting power level\n"); 2597 - 2598 2592 } 2599 2593 2600 2594 if (changed & IEEE80211_CONF_CHANGE_POWER) { ··· 2729 2725 iwlcore_commit_rxon(priv); 2730 2726 } 2731 2727 2732 - iwl_power_update_mode(priv, 0); 2733 - 2734 - /* Per mac80211.h: This is only used in IBSS mode... */ 2735 2728 if (priv->iw_mode != NL80211_IFTYPE_ADHOC) { 2736 - 2737 - /* switch to CAM during association period. 2738 - * the ucode will block any association/authentication 2739 - * frome during assiciation period if it can not hear 2740 - * the AP because of PM. the timer enable PM back is 2741 - * association do not complete 2742 - */ 2743 - if (priv->hw->conf.channel->flags & 2744 - (IEEE80211_CHAN_PASSIVE_SCAN | IEEE80211_CHAN_RADAR)) 2745 - iwl_power_disable_management(priv, 3000); 2746 - 2747 2729 IWL_DEBUG_MAC80211(priv, "leave - not in IBSS\n"); 2748 2730 mutex_unlock(&priv->mutex); 2749 2731 return;
-2
drivers/net/wireless/iwlwifi/iwl-core.h
··· 363 363 364 364 u8 iwl_rate_get_lowest_plcp(struct iwl_priv *priv); 365 365 366 - void iwl_set_rate(struct iwl_priv *priv); 367 - 368 366 u8 iwl_toggle_tx_ant(struct iwl_priv *priv, u8 ant_idx); 369 367 370 368 static inline u32 iwl_ant_idx_to_flags(u8 ant_idx)
-2
drivers/net/wireless/iwlwifi/iwl-dev.h
··· 933 933 const struct iwl_rxon_cmd active_rxon; 934 934 struct iwl_rxon_cmd staging_rxon; 935 935 936 - int error_recovering; 937 936 struct iwl_rxon_cmd recovery_rxon; 938 937 939 938 /* 1st responses from initialize and runtime uCode images. ··· 1075 1076 1076 1077 struct tasklet_struct irq_tasklet; 1077 1078 1078 - struct delayed_work set_power_save; 1079 1079 struct delayed_work init_alive_start; 1080 1080 struct delayed_work alive_start; 1081 1081 struct delayed_work scan_check;
+1 -1
drivers/net/wireless/iwlwifi/iwl-eeprom.c
··· 285 285 286 286 return 0; 287 287 err: 288 - IWL_ERR(priv, "Unsupported EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", 288 + IWL_ERR(priv, "Unsupported (too old) EEPROM VER=0x%x < 0x%x CALIB=0x%x < 0x%x\n", 289 289 eeprom_ver, priv->cfg->eeprom_ver, 290 290 calib_ver, priv->cfg->eeprom_calib_ver); 291 291 return -EINVAL;
+33 -200
drivers/net/wireless/iwlwifi/iwl-power.c
··· 41 41 #include "iwl-power.h" 42 42 43 43 /* 44 - * Setting power level allow the card to go to sleep when not busy 45 - * there are three factor that decide the power level to go to, they 46 - * are list here with its priority 47 - * 1- critical_power_setting this will be set according to card temperature. 48 - * 2- system_power_setting this will be set by system PM manager. 49 - * 3- user_power_setting this will be set by user either by writing to sys or 50 - * mac80211 44 + * Setting power level allow the card to go to sleep when not busy. 51 45 * 52 - * if system_power_setting and user_power_setting is set to auto 53 - * the power level will be decided according to association status and battery 54 - * status. 46 + * The power level is set to INDEX_1 (the least deep state) by 47 + * default, and will, in the future, be the deepest state unless 48 + * otherwise required by pm_qos network latency requirements. 55 49 * 50 + * Using INDEX_1 without pm_qos is ok because mac80211 will disable 51 + * PS when even checking every beacon for the TIM bit would exceed 52 + * the required latency. 56 53 */ 57 54 58 - #define MSEC_TO_USEC 1024 59 55 #define IWL_POWER_RANGE_0_MAX (2) 60 56 #define IWL_POWER_RANGE_1_MAX (10) 61 57 62 58 63 - 64 - #define IWL_POWER_ON_BATTERY IWL_POWER_INDEX_5 65 - #define IWL_POWER_ON_AC_DISASSOC IWL_POWER_MODE_CAM 66 - #define IWL_POWER_ON_AC_ASSOC IWL_POWER_MODE_CAM 67 - 68 - 69 - #define IWL_CT_KILL_TEMPERATURE 110 70 - #define IWL_MIN_POWER_TEMPERATURE 100 71 - #define IWL_REDUCED_POWER_TEMPERATURE 95 72 - 59 + #define NOSLP cpu_to_le16(0), 0, 0 60 + #define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0 61 + #define TU_TO_USEC 1024 62 + #define SLP_TOUT(T) cpu_to_le32((T) * TU_TO_USEC) 63 + #define SLP_VEC(X0, X1, X2, X3, X4) {cpu_to_le32(X0), \ 64 + cpu_to_le32(X1), \ 65 + cpu_to_le32(X2), \ 66 + cpu_to_le32(X3), \ 67 + cpu_to_le32(X4)} 73 68 /* default power management (not Tx power) table values */ 74 - /* for TIM 0-10 */ 75 - static struct iwl_power_vec_entry range_0[IWL_POWER_MAX] = { 69 + /* for DTIM period 0 through IWL_POWER_RANGE_0_MAX */ 70 + static const struct iwl_power_vec_entry range_0[IWL_POWER_NUM] = { 76 71 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 77 72 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, 78 73 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 2, 2, 0xFF)}, 0}, ··· 77 82 }; 78 83 79 84 80 - /* for TIM = 3-10 */ 81 - static struct iwl_power_vec_entry range_1[IWL_POWER_MAX] = { 85 + /* for DTIM period IWL_POWER_RANGE_0_MAX + 1 through IWL_POWER_RANGE_1_MAX */ 86 + static const struct iwl_power_vec_entry range_1[IWL_POWER_NUM] = { 82 87 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 83 88 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 4)}, 0}, 84 89 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(1, 2, 3, 4, 7)}, 0}, ··· 87 92 {{SLP, SLP_TOUT(25), SLP_TOUT(25), SLP_VEC(2, 4, 7, 10, 10)}, 2} 88 93 }; 89 94 90 - /* for TIM > 11 */ 91 - static struct iwl_power_vec_entry range_2[IWL_POWER_MAX] = { 95 + /* for DTIM period > IWL_POWER_RANGE_1_MAX */ 96 + static const struct iwl_power_vec_entry range_2[IWL_POWER_NUM] = { 92 97 {{NOSLP, SLP_TOUT(0), SLP_TOUT(0), SLP_VEC(0, 0, 0, 0, 0)}, 0}, 93 98 {{SLP, SLP_TOUT(200), SLP_TOUT(500), SLP_VEC(1, 2, 3, 4, 0xFF)}, 0}, 94 99 {{SLP, SLP_TOUT(200), SLP_TOUT(300), SLP_VEC(2, 4, 6, 7, 0xFF)}, 0}, ··· 101 106 /* set card power command */ 102 107 static int iwl_set_power(struct iwl_priv *priv, void *cmd) 103 108 { 104 - return iwl_send_cmd_pdu_async(priv, POWER_TABLE_CMD, 105 - sizeof(struct iwl_powertable_cmd), 106 - cmd, NULL); 107 - } 108 - /* decide the right power level according to association status 109 - * and battery status 110 - */ 111 - static u16 iwl_get_auto_power_mode(struct iwl_priv *priv) 112 - { 113 - u16 mode; 114 - 115 - switch (priv->power_data.user_power_setting) { 116 - case IWL_POWER_AUTO: 117 - /* if running on battery */ 118 - if (priv->power_data.is_battery_active) 119 - mode = IWL_POWER_ON_BATTERY; 120 - else if (iwl_is_associated(priv)) 121 - mode = IWL_POWER_ON_AC_ASSOC; 122 - else 123 - mode = IWL_POWER_ON_AC_DISASSOC; 124 - break; 125 - default: 126 - mode = priv->power_data.user_power_setting; 127 - break; 128 - } 129 - return mode; 109 + return iwl_send_cmd_pdu(priv, POWER_TABLE_CMD, 110 + sizeof(struct iwl_powertable_cmd), cmd); 130 111 } 131 112 132 113 /* initialize to default */ 133 114 static void iwl_power_init_handle(struct iwl_priv *priv) 134 115 { 135 116 struct iwl_power_mgr *pow_data; 136 - int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_MAX; 117 + int size = sizeof(struct iwl_power_vec_entry) * IWL_POWER_NUM; 137 118 struct iwl_powertable_cmd *cmd; 138 119 int i; 139 120 u16 lctl; ··· 128 157 129 158 IWL_DEBUG_POWER(priv, "adjust power command flags\n"); 130 159 131 - for (i = 0; i < IWL_POWER_MAX; i++) { 160 + for (i = 0; i < IWL_POWER_NUM; i++) { 132 161 cmd = &pow_data->pwr_range_0[i].cmd; 133 162 134 163 if (lctl & PCI_CFG_LINK_CTRL_VAL_L0S_EN) ··· 218 247 update_chains = priv->chain_noise_data.state == IWL_CHAIN_NOISE_DONE || 219 248 priv->chain_noise_data.state == IWL_CHAIN_NOISE_ALIVE; 220 249 221 - /* If on battery, set to 3, 222 - * if plugged into AC power, set to CAM ("continuously aware mode"), 223 - * else user level */ 250 + final_mode = priv->power_data.user_power_setting; 224 251 225 - switch (setting->system_power_setting) { 226 - case IWL_POWER_SYS_AUTO: 227 - final_mode = iwl_get_auto_power_mode(priv); 228 - break; 229 - case IWL_POWER_SYS_BATTERY: 230 - final_mode = IWL_POWER_INDEX_3; 231 - break; 232 - case IWL_POWER_SYS_AC: 233 - final_mode = IWL_POWER_MODE_CAM; 234 - break; 235 - default: 236 - final_mode = IWL_POWER_INDEX_3; 237 - WARN_ON(1); 238 - } 239 - 240 - if (setting->critical_power_setting > final_mode) 241 - final_mode = setting->critical_power_setting; 242 - 243 - /* driver only support CAM for non STA network */ 244 - if (priv->iw_mode != NL80211_IFTYPE_STATION) 252 + if (setting->power_disabled) 245 253 final_mode = IWL_POWER_MODE_CAM; 246 254 247 - if (iwl_is_ready_rf(priv) && !setting->power_disabled && 255 + if (iwl_is_ready_rf(priv) && 248 256 ((setting->power_mode != final_mode) || force)) { 249 257 struct iwl_powertable_cmd cmd; 250 258 ··· 240 290 241 291 if (final_mode == IWL_POWER_MODE_CAM) 242 292 clear_bit(STATUS_POWER_PMI, &priv->status); 243 - else 244 - set_bit(STATUS_POWER_PMI, &priv->status); 245 293 246 294 if (priv->cfg->ops->lib->update_chain_flags && update_chains) 247 295 priv->cfg->ops->lib->update_chain_flags(priv); ··· 255 307 } 256 308 EXPORT_SYMBOL(iwl_power_update_mode); 257 309 258 - /* Allow other iwl code to disable/enable power management active 259 - * this will be useful for rate scale to disable PM during heavy 260 - * Tx/Rx activities 261 - */ 262 - int iwl_power_disable_management(struct iwl_priv *priv, u32 ms) 263 - { 264 - u16 prev_mode; 265 - int ret = 0; 266 - 267 - if (priv->power_data.power_disabled) 268 - return -EBUSY; 269 - 270 - prev_mode = priv->power_data.user_power_setting; 271 - priv->power_data.user_power_setting = IWL_POWER_MODE_CAM; 272 - ret = iwl_power_update_mode(priv, 0); 273 - priv->power_data.power_disabled = 1; 274 - priv->power_data.user_power_setting = prev_mode; 275 - cancel_delayed_work(&priv->set_power_save); 276 - if (ms) 277 - queue_delayed_work(priv->workqueue, &priv->set_power_save, 278 - msecs_to_jiffies(ms)); 279 - 280 - 281 - return ret; 282 - } 283 - EXPORT_SYMBOL(iwl_power_disable_management); 284 - 285 - /* Allow other iwl code to disable/enable power management active 286 - * this will be useful for rate scale to disable PM during high 287 - * volume activities 288 - */ 289 - int iwl_power_enable_management(struct iwl_priv *priv) 290 - { 291 - int ret = 0; 292 - 293 - priv->power_data.power_disabled = 0; 294 - ret = iwl_power_update_mode(priv, 0); 295 - return ret; 296 - } 297 - EXPORT_SYMBOL(iwl_power_enable_management); 298 - 299 310 /* set user_power_setting */ 300 311 int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode) 301 312 { 302 - if (mode > IWL_POWER_MAX) 313 + if (mode >= IWL_POWER_NUM) 303 314 return -EINVAL; 304 315 305 316 priv->power_data.user_power_setting = mode; ··· 267 360 } 268 361 EXPORT_SYMBOL(iwl_power_set_user_mode); 269 362 270 - /* set system_power_setting. This should be set by over all 271 - * PM application. 272 - */ 273 - int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode) 274 - { 275 - if (mode < IWL_POWER_SYS_MAX) 276 - priv->power_data.system_power_setting = mode; 277 - else 278 - return -EINVAL; 279 - return iwl_power_update_mode(priv, 0); 280 - } 281 - EXPORT_SYMBOL(iwl_power_set_system_mode); 282 - 283 363 /* initialize to default */ 284 364 void iwl_power_initialize(struct iwl_priv *priv) 285 365 { 286 366 iwl_power_init_handle(priv); 287 - priv->power_data.user_power_setting = IWL_POWER_AUTO; 288 - priv->power_data.system_power_setting = IWL_POWER_SYS_AUTO; 289 - priv->power_data.power_disabled = 0; 290 - priv->power_data.is_battery_active = 0; 291 - priv->power_data.critical_power_setting = 0; 367 + priv->power_data.user_power_setting = IWL_POWER_INDEX_1; 368 + /* default to disabled until mac80211 says otherwise */ 369 + priv->power_data.power_disabled = 1; 292 370 } 293 371 EXPORT_SYMBOL(iwl_power_initialize); 294 - 295 - /* set critical_power_setting according to temperature value */ 296 - int iwl_power_temperature_change(struct iwl_priv *priv) 297 - { 298 - int ret = 0; 299 - s32 temperature = KELVIN_TO_CELSIUS(priv->last_temperature); 300 - u16 new_critical = priv->power_data.critical_power_setting; 301 - 302 - if (temperature > IWL_CT_KILL_TEMPERATURE) 303 - return 0; 304 - else if (temperature > IWL_MIN_POWER_TEMPERATURE) 305 - new_critical = IWL_POWER_INDEX_5; 306 - else if (temperature > IWL_REDUCED_POWER_TEMPERATURE) 307 - new_critical = IWL_POWER_INDEX_3; 308 - else 309 - new_critical = IWL_POWER_MODE_CAM; 310 - 311 - if (new_critical != priv->power_data.critical_power_setting) 312 - priv->power_data.critical_power_setting = new_critical; 313 - 314 - if (priv->power_data.critical_power_setting > 315 - priv->power_data.power_mode) 316 - ret = iwl_power_update_mode(priv, 0); 317 - 318 - return ret; 319 - } 320 - EXPORT_SYMBOL(iwl_power_temperature_change); 321 - 322 - static void iwl_bg_set_power_save(struct work_struct *work) 323 - { 324 - struct iwl_priv *priv = container_of(work, 325 - struct iwl_priv, set_power_save.work); 326 - IWL_DEBUG_POWER(priv, "update power\n"); 327 - 328 - if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 329 - return; 330 - 331 - mutex_lock(&priv->mutex); 332 - 333 - /* on starting association we disable power management 334 - * until association, if association failed then this 335 - * timer will expire and enable PM again. 336 - */ 337 - if (!iwl_is_associated(priv)) 338 - iwl_power_enable_management(priv); 339 - 340 - mutex_unlock(&priv->mutex); 341 - } 342 - void iwl_setup_power_deferred_work(struct iwl_priv *priv) 343 - { 344 - INIT_DELAYED_WORK(&priv->set_power_save, iwl_bg_set_power_save); 345 - } 346 - EXPORT_SYMBOL(iwl_setup_power_deferred_work); 347 - 348 - void iwl_power_cancel_timeout(struct iwl_priv *priv) 349 - { 350 - cancel_delayed_work(&priv->set_power_save); 351 - } 352 - EXPORT_SYMBOL(iwl_power_cancel_timeout);
+6 -33
drivers/net/wireless/iwlwifi/iwl-power.h
··· 40 40 IWL_POWER_INDEX_3, 41 41 IWL_POWER_INDEX_4, 42 42 IWL_POWER_INDEX_5, 43 - IWL_POWER_AUTO, 44 - IWL_POWER_MAX = IWL_POWER_AUTO, 43 + IWL_POWER_NUM 45 44 }; 46 - 47 - enum { 48 - IWL_POWER_SYS_AUTO, 49 - IWL_POWER_SYS_AC, 50 - IWL_POWER_SYS_BATTERY, 51 - IWL_POWER_SYS_MAX, 52 - }; 53 - 54 45 55 46 /* Power management (not Tx power) structures */ 56 47 57 - #define NOSLP cpu_to_le16(0), 0, 0 58 - #define SLP IWL_POWER_DRIVER_ALLOW_SLEEP_MSK, 0, 0 59 - #define SLP_TOUT(T) cpu_to_le32((T) * MSEC_TO_USEC) 60 - #define SLP_VEC(X0, X1, X2, X3, X4) {cpu_to_le32(X0), \ 61 - cpu_to_le32(X1), \ 62 - cpu_to_le32(X2), \ 63 - cpu_to_le32(X3), \ 64 - cpu_to_le32(X4)} 65 48 struct iwl_power_vec_entry { 66 49 struct iwl_powertable_cmd cmd; 67 50 u8 no_dtim; 68 51 }; 69 52 70 53 struct iwl_power_mgr { 71 - spinlock_t lock; 72 - struct iwl_power_vec_entry pwr_range_0[IWL_POWER_MAX]; 73 - struct iwl_power_vec_entry pwr_range_1[IWL_POWER_MAX]; 74 - struct iwl_power_vec_entry pwr_range_2[IWL_POWER_MAX]; 54 + struct iwl_power_vec_entry pwr_range_0[IWL_POWER_NUM]; 55 + struct iwl_power_vec_entry pwr_range_1[IWL_POWER_NUM]; 56 + struct iwl_power_vec_entry pwr_range_2[IWL_POWER_NUM]; 75 57 u32 dtim_period; 76 58 /* final power level that used to calculate final power command */ 77 59 u8 power_mode; 78 - u8 user_power_setting; /* set by user through mac80211 or sysfs */ 79 - u8 system_power_setting; /* set by kernel system tools */ 80 - u8 critical_power_setting; /* set if driver over heated */ 81 - u8 is_battery_active; /* DC/AC power */ 82 - u8 power_disabled; /* flag to disable using power saving level */ 60 + u8 user_power_setting; /* set by user through sysfs */ 61 + u8 power_disabled; /* set by mac80211's CONF_PS */ 83 62 }; 84 63 85 - void iwl_setup_power_deferred_work(struct iwl_priv *priv); 86 - void iwl_power_cancel_timeout(struct iwl_priv *priv); 87 64 int iwl_power_update_mode(struct iwl_priv *priv, bool force); 88 - int iwl_power_disable_management(struct iwl_priv *priv, u32 ms); 89 - int iwl_power_enable_management(struct iwl_priv *priv); 90 65 int iwl_power_set_user_mode(struct iwl_priv *priv, u16 mode); 91 - int iwl_power_set_system_mode(struct iwl_priv *priv, u16 mode); 92 66 void iwl_power_initialize(struct iwl_priv *priv); 93 - int iwl_power_temperature_change(struct iwl_priv *priv); 94 67 95 68 #endif /* __iwl_power_setting_h__ */
+8 -6
drivers/net/wireless/iwlwifi/iwl-scan.c
··· 580 580 int ret = 0; 581 581 u32 rate_flags = 0; 582 582 u16 cmd_len; 583 + u16 rx_chain = 0; 583 584 enum ieee80211_band band; 584 585 u8 n_probes = 0; 585 - u8 rx_chain = priv->hw_params.valid_rx_ant; 586 + u8 rx_ant = priv->hw_params.valid_rx_ant; 586 587 u8 rate; 587 588 bool is_active = false; 588 589 ··· 724 723 * Avoid A (0x1) because of its off-channel reception on A-band. 725 724 */ 726 725 if ((priv->hw_rev & CSR_HW_REV_TYPE_MSK) == CSR_HW_REV_TYPE_4965) 727 - rx_chain = 0x6; 726 + rx_ant = ANT_BC; 728 727 } else { 729 728 IWL_WARN(priv, "Invalid scan band count\n"); 730 729 goto done; ··· 736 735 scan->tx_cmd.rate_n_flags = iwl_hw_set_rate_n_flags(rate, rate_flags); 737 736 738 737 /* MIMO is not used here, but value is required */ 739 - scan->rx_chain = RXON_RX_CHAIN_DRIVER_FORCE_MSK | 740 - cpu_to_le16((0x7 << RXON_RX_CHAIN_VALID_POS) | 741 - (rx_chain << RXON_RX_CHAIN_FORCE_SEL_POS) | 742 - (0x7 << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS)); 738 + rx_chain |= ANT_ABC << RXON_RX_CHAIN_VALID_POS; 739 + rx_chain |= ANT_ABC << RXON_RX_CHAIN_FORCE_MIMO_SEL_POS; 740 + rx_chain |= rx_ant << RXON_RX_CHAIN_FORCE_SEL_POS; 741 + rx_chain |= 0x1 << RXON_RX_CHAIN_DRIVER_FORCE_POS; 742 + scan->rx_chain = cpu_to_le16(rx_chain); 743 743 cmd_len = iwl_fill_probe_req(priv, 744 744 (struct ieee80211_mgmt *)scan->data, 745 745 priv->scan_request->ie,
+13 -43
drivers/net/wireless/iwlwifi/iwl3945-base.c
··· 1837 1837 iwl_release_nic_access(priv); 1838 1838 } 1839 1839 1840 - static void iwl3945_error_recovery(struct iwl_priv *priv) 1841 - { 1842 - unsigned long flags; 1843 - 1844 - memcpy(&priv->staging_rxon, &priv->recovery_rxon, 1845 - sizeof(priv->staging_rxon)); 1846 - priv->staging_rxon.filter_flags &= ~RXON_FILTER_ASSOC_MSK; 1847 - iwlcore_commit_rxon(priv); 1848 - 1849 - priv->cfg->ops->smgmt->add_station(priv, priv->bssid, 1, 0, NULL); 1850 - 1851 - spin_lock_irqsave(&priv->lock, flags); 1852 - priv->assoc_id = le16_to_cpu(priv->staging_rxon.assoc_id); 1853 - priv->error_recovering = 0; 1854 - spin_unlock_irqrestore(&priv->lock, flags); 1855 - } 1856 - 1857 1840 static void iwl3945_irq_tasklet(struct iwl_priv *priv) 1858 1841 { 1859 1842 u32 inta, handled = 0; ··· 2666 2683 /* After the ALIVE response, we can send commands to 3945 uCode */ 2667 2684 set_bit(STATUS_ALIVE, &priv->status); 2668 2685 2669 - /* Clear out the uCode error bit if it is set */ 2670 - clear_bit(STATUS_FW_ERROR, &priv->status); 2671 - 2672 2686 if (iwl_is_rfkill(priv)) 2673 2687 return; 2674 2688 ··· 2701 2721 IWL_DEBUG_INFO(priv, "ALIVE processing complete.\n"); 2702 2722 set_bit(STATUS_READY, &priv->status); 2703 2723 wake_up_interruptible(&priv->wait_command_queue); 2704 - 2705 - if (priv->error_recovering) 2706 - iwl3945_error_recovery(priv); 2707 2724 2708 2725 /* reassociate for ADHOC mode */ 2709 2726 if (priv->vif && (priv->iw_mode == NL80211_IFTYPE_ADHOC)) { ··· 3208 3231 if (test_bit(STATUS_EXIT_PENDING, &priv->status)) 3209 3232 return; 3210 3233 3211 - iwl3945_down(priv); 3212 - queue_work(priv->workqueue, &priv->up); 3234 + if (test_and_clear_bit(STATUS_FW_ERROR, &priv->status)) { 3235 + mutex_lock(&priv->mutex); 3236 + priv->vif = NULL; 3237 + priv->is_open = 0; 3238 + mutex_unlock(&priv->mutex); 3239 + iwl3945_down(priv); 3240 + ieee80211_restart_hw(priv->hw); 3241 + } else { 3242 + iwl3945_down(priv); 3243 + queue_work(priv->workqueue, &priv->up); 3244 + } 3213 3245 } 3214 3246 3215 3247 static void iwl3945_bg_rx_replenish(struct work_struct *data) ··· 3845 3859 { 3846 3860 struct iwl_priv *priv = dev_get_drvdata(d); 3847 3861 int mode = priv->power_data.user_power_setting; 3848 - int system = priv->power_data.system_power_setting; 3849 3862 int level = priv->power_data.power_mode; 3850 3863 char *p = buf; 3851 3864 3852 - switch (system) { 3853 - case IWL_POWER_SYS_AUTO: 3854 - p += sprintf(p, "SYSTEM:auto"); 3855 - break; 3856 - case IWL_POWER_SYS_AC: 3857 - p += sprintf(p, "SYSTEM:ac"); 3858 - break; 3859 - case IWL_POWER_SYS_BATTERY: 3860 - p += sprintf(p, "SYSTEM:battery"); 3861 - break; 3862 - } 3863 - 3864 - p += sprintf(p, "\tMODE:%s", (mode < IWL_POWER_AUTO) ? 3865 - "fixed" : "auto"); 3866 - p += sprintf(p, "\tINDEX:%d", level); 3867 - p += sprintf(p, "\n"); 3865 + p += sprintf(p, "INDEX:%d\t", level); 3866 + p += sprintf(p, "USER:%d\n", mode); 3868 3867 return p - buf + 1; 3869 3868 } 3870 3869 ··· 4093 4122 priv->ibss_beacon = NULL; 4094 4123 4095 4124 spin_lock_init(&priv->lock); 4096 - spin_lock_init(&priv->power_data.lock); 4097 4125 spin_lock_init(&priv->sta_lock); 4098 4126 spin_lock_init(&priv->hcmd_lock); 4099 4127
+1 -1
drivers/net/wireless/mac80211_hwsim.c
··· 642 642 if (changed & BSS_CHANGED_HT) { 643 643 printk(KERN_DEBUG " %s: HT: op_mode=0x%x\n", 644 644 wiphy_name(hw->wiphy), 645 - info->ht.operation_mode); 645 + info->ht_operation_mode); 646 646 } 647 647 648 648 if (changed & BSS_CHANGED_BASIC_RATES) {
+1 -1
drivers/net/wireless/mwl8k.c
··· 2369 2369 if (info->use_cts_prot) { 2370 2370 prot_mode = MWL8K_FRAME_PROT_11G; 2371 2371 } else { 2372 - switch (info->ht.operation_mode & 2372 + switch (info->ht_operation_mode & 2373 2373 IEEE80211_HT_OP_MODE_PROTECTION) { 2374 2374 case IEEE80211_HT_OP_MODE_PROTECTION_20MHZ: 2375 2375 prot_mode = MWL8K_FRAME_PROT_11N_HT_40MHZ_ONLY;
+1 -1
drivers/net/wireless/rt2x00/rt73usb.c
··· 1847 1847 rt2x00_set_chip(rt2x00dev, RT2571, value, reg); 1848 1848 1849 1849 if (!rt2x00_check_rev(&rt2x00dev->chip, 0x000ffff0, 0x25730) || 1850 - !rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) { 1850 + rt2x00_check_rev(&rt2x00dev->chip, 0x0000000f, 0)) { 1851 1851 ERROR(rt2x00dev, "Invalid RT chipset detected.\n"); 1852 1852 return -ENODEV; 1853 1853 }
+1 -1
drivers/net/wireless/wl12xx/Kconfig
··· 1 1 config WL12XX 2 2 tristate "TI wl1251/wl1271 support" 3 - depends on MAC80211 && WLAN_80211 && SPI_MASTER && EXPERIMENTAL 3 + depends on MAC80211 && WLAN_80211 && SPI_MASTER && GENERIC_HARDIRQS && EXPERIMENTAL 4 4 select FW_LOADER 5 5 select CRC7 6 6 ---help---
+7 -1
include/linux/ieee80211.h
··· 1068 1068 WLAN_CATEGORY_DLS = 2, 1069 1069 WLAN_CATEGORY_BACK = 3, 1070 1070 WLAN_CATEGORY_PUBLIC = 4, 1071 + WLAN_CATEGORY_HT = 7, 1071 1072 WLAN_CATEGORY_SA_QUERY = 8, 1073 + WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9, 1072 1074 WLAN_CATEGORY_WMM = 17, 1075 + WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126, 1076 + WLAN_CATEGORY_VENDOR_SPECIFIC = 127, 1073 1077 }; 1074 1078 1075 1079 /* SPECTRUM_MGMT action code */ ··· 1265 1261 if (ieee80211_has_protected(hdr->frame_control)) 1266 1262 return true; 1267 1263 category = ((u8 *) hdr) + 24; 1268 - return *category != WLAN_CATEGORY_PUBLIC; 1264 + return *category != WLAN_CATEGORY_PUBLIC && 1265 + *category != WLAN_CATEGORY_HT && 1266 + *category != WLAN_CATEGORY_VENDOR_SPECIFIC; 1269 1267 } 1270 1268 1271 1269 return false;
+48 -3
include/linux/nl80211.h
··· 25 25 * 26 26 */ 27 27 28 + #include <linux/types.h> 29 + 28 30 /** 29 31 * DOC: Station handling 30 32 * ··· 79 77 * @NL80211_CMD_SET_KEY: Set key attributes %NL80211_ATTR_KEY_DEFAULT, 80 78 * %NL80211_ATTR_KEY_DEFAULT_MGMT, or %NL80211_ATTR_KEY_THRESHOLD. 81 79 * @NL80211_CMD_NEW_KEY: add a key with given %NL80211_ATTR_KEY_DATA, 82 - * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC and %NL80211_ATTR_KEY_CIPHER 83 - * attributes. 80 + * %NL80211_ATTR_KEY_IDX, %NL80211_ATTR_MAC, %NL80211_ATTR_KEY_CIPHER, 81 + * and %NL80211_ATTR_KEY_SEQ attributes. 84 82 * @NL80211_CMD_DEL_KEY: delete a key identified by %NL80211_ATTR_KEY_IDX 85 83 * or %NL80211_ATTR_MAC. 86 84 * ··· 382 380 * 383 381 * @NL80211_ATTR_STA_AID: Association ID for the station (u16) 384 382 * @NL80211_ATTR_STA_FLAGS: flags, nested element with NLA_FLAG attributes of 385 - * &enum nl80211_sta_flags. 383 + * &enum nl80211_sta_flags (deprecated, use %NL80211_ATTR_STA_FLAGS2) 386 384 * @NL80211_ATTR_STA_LISTEN_INTERVAL: listen interval as defined by 387 385 * IEEE 802.11 7.3.1.6 (u16). 388 386 * @NL80211_ATTR_STA_SUPPORTED_RATES: supported rates, array of supported ··· 496 494 * @NL80211_ATTR_TIMED_OUT: a flag indicating than an operation timed out; this 497 495 * is used, e.g., with %NL80211_CMD_AUTHENTICATE event 498 496 * 497 + * @NL80211_ATTR_USE_MFP: Whether management frame protection (IEEE 802.11w) is 498 + * used for the association (&enum nl80211_mfp, represented as a u32); 499 + * this attribute can be used 500 + * with %NL80211_CMD_ASSOCIATE request 501 + * 502 + * @NL80211_ATTR_STA_FLAGS2: Attribute containing a 503 + * &struct nl80211_sta_flag_update. 504 + * 505 + * @NL80211_ATTR_CONTROL_PORT: A flag indicating whether user space controls 506 + * IEEE 802.1X port, i.e., sets/clears %NL80211_STA_FLAG_AUTHORIZED, in 507 + * station mode. If the flag is included in %NL80211_CMD_ASSOCIATE 508 + * request, the driver will assume that the port is unauthorized until 509 + * authorized by user space. Otherwise, port is marked authorized by 510 + * default in station mode. 511 + * 499 512 * @NL80211_ATTR_MAX: highest attribute number currently defined 500 513 * @__NL80211_ATTR_AFTER_LAST: internal use 501 514 */ ··· 613 596 614 597 NL80211_ATTR_TIMED_OUT, 615 598 599 + NL80211_ATTR_USE_MFP, 600 + 601 + NL80211_ATTR_STA_FLAGS2, 602 + 603 + NL80211_ATTR_CONTROL_PORT, 604 + 616 605 /* add attributes here, update the policy in nl80211.c */ 617 606 618 607 __NL80211_ATTR_AFTER_LAST, ··· 706 683 __NL80211_STA_FLAG_AFTER_LAST, 707 684 NL80211_STA_FLAG_MAX = __NL80211_STA_FLAG_AFTER_LAST - 1 708 685 }; 686 + 687 + /** 688 + * struct nl80211_sta_flag_update - station flags mask/set 689 + * @mask: mask of station flags to set 690 + * @set: which values to set them to 691 + * 692 + * Both mask and set contain bits as per &enum nl80211_sta_flags. 693 + */ 694 + struct nl80211_sta_flag_update { 695 + __u32 mask; 696 + __u32 set; 697 + } __attribute__((packed)); 709 698 710 699 /** 711 700 * enum nl80211_rate_info - bitrate information ··· 1212 1177 NL80211_KEYTYPE_GROUP, 1213 1178 NL80211_KEYTYPE_PAIRWISE, 1214 1179 NL80211_KEYTYPE_PEERKEY, 1180 + }; 1181 + 1182 + /** 1183 + * enum nl80211_mfp - Management frame protection state 1184 + * @NL80211_MFP_NO: Management frame protection not used 1185 + * @NL80211_MFP_REQUIRED: Management frame protection required 1186 + */ 1187 + enum nl80211_mfp { 1188 + NL80211_MFP_NO, 1189 + NL80211_MFP_REQUIRED, 1215 1190 }; 1216 1191 1217 1192 #endif /* __LINUX_NL80211_H */
+29 -28
include/net/cfg80211.h
··· 252 252 }; 253 253 254 254 /** 255 - * enum station_flags - station flags 256 - * 257 - * Station capability flags. Note that these must be the bits 258 - * according to the nl80211 flags. 259 - * 260 - * @STATION_FLAG_CHANGED: station flags were changed 261 - * @STATION_FLAG_AUTHORIZED: station is authorized to send frames (802.1X) 262 - * @STATION_FLAG_SHORT_PREAMBLE: station is capable of receiving frames 263 - * with short preambles 264 - * @STATION_FLAG_WME: station is WME/QoS capable 265 - * @STATION_FLAG_MFP: station uses management frame protection 266 - */ 267 - enum station_flags { 268 - STATION_FLAG_CHANGED = 1<<0, 269 - STATION_FLAG_AUTHORIZED = 1<<NL80211_STA_FLAG_AUTHORIZED, 270 - STATION_FLAG_SHORT_PREAMBLE = 1<<NL80211_STA_FLAG_SHORT_PREAMBLE, 271 - STATION_FLAG_WME = 1<<NL80211_STA_FLAG_WME, 272 - STATION_FLAG_MFP = 1<<NL80211_STA_FLAG_MFP, 273 - }; 274 - 275 - /** 276 255 * enum plink_action - actions to perform in mesh peers 277 256 * 278 257 * @PLINK_ACTION_INVALID: action 0 is reserved ··· 273 294 * @supported_rates: supported rates in IEEE 802.11 format 274 295 * (or NULL for no change) 275 296 * @supported_rates_len: number of supported rates 276 - * @station_flags: station flags (see &enum station_flags) 297 + * @sta_flags_mask: station flags that changed 298 + * (bitmask of BIT(NL80211_STA_FLAG_...)) 299 + * @sta_flags_set: station flags values 300 + * (bitmask of BIT(NL80211_STA_FLAG_...)) 277 301 * @listen_interval: listen interval or -1 for no change 278 302 * @aid: AID or zero for no change 279 303 */ 280 304 struct station_parameters { 281 305 u8 *supported_rates; 282 306 struct net_device *vlan; 283 - u32 station_flags; 307 + u32 sta_flags_mask, sta_flags_set; 284 308 int listen_interval; 285 309 u16 aid; 286 310 u8 supported_rates_len; ··· 654 672 * @ssid_len: Length of ssid in octets 655 673 * @ie: Extra IEs to add to (Re)Association Request frame or %NULL 656 674 * @ie_len: Length of ie buffer in octets 675 + * @use_mfp: Use management frame protection (IEEE 802.11w) in this association 676 + * @control_port: Whether user space controls IEEE 802.1X port, i.e., 677 + * sets/clears %NL80211_STA_FLAG_AUTHORIZED. If true, the driver is 678 + * required to assume that the port is unauthorized until authorized by 679 + * user space. Otherwise, port is marked authorized by default. 657 680 */ 658 681 struct cfg80211_assoc_request { 659 682 struct ieee80211_channel *chan; ··· 667 680 size_t ssid_len; 668 681 const u8 *ie; 669 682 size_t ie_len; 683 + bool use_mfp; 684 + bool control_port; 670 685 }; 671 686 672 687 /** ··· 847 858 struct vif_params *params); 848 859 849 860 int (*add_key)(struct wiphy *wiphy, struct net_device *netdev, 850 - u8 key_index, u8 *mac_addr, 861 + u8 key_index, const u8 *mac_addr, 851 862 struct key_params *params); 852 863 int (*get_key)(struct wiphy *wiphy, struct net_device *netdev, 853 - u8 key_index, u8 *mac_addr, void *cookie, 864 + u8 key_index, const u8 *mac_addr, void *cookie, 854 865 void (*callback)(void *cookie, struct key_params*)); 855 866 int (*del_key)(struct wiphy *wiphy, struct net_device *netdev, 856 - u8 key_index, u8 *mac_addr); 867 + u8 key_index, const u8 *mac_addr); 857 868 int (*set_default_key)(struct wiphy *wiphy, 858 869 struct net_device *netdev, 859 870 u8 key_index); ··· 1134 1145 1135 1146 #ifdef CONFIG_WIRELESS_EXT 1136 1147 /* wext data */ 1137 - struct cfg80211_ibss_params wext; 1138 - u8 wext_bssid[ETH_ALEN]; 1148 + struct { 1149 + struct cfg80211_ibss_params ibss; 1150 + u8 bssid[ETH_ALEN]; 1151 + s8 default_key, default_mgmt_key; 1152 + } wext; 1139 1153 #endif 1140 1154 }; 1141 1155 ··· 1388 1396 int cfg80211_wext_giwretry(struct net_device *dev, 1389 1397 struct iw_request_info *info, 1390 1398 struct iw_param *retry, char *extra); 1399 + int cfg80211_wext_siwencodeext(struct net_device *dev, 1400 + struct iw_request_info *info, 1401 + struct iw_point *erq, char *extra); 1402 + int cfg80211_wext_siwencode(struct net_device *dev, 1403 + struct iw_request_info *info, 1404 + struct iw_point *erq, char *keybuf); 1405 + int cfg80211_wext_giwencode(struct net_device *dev, 1406 + struct iw_request_info *info, 1407 + struct iw_point *erq, char *keybuf); 1391 1408 1392 1409 /* 1393 1410 * callbacks for asynchronous cfg80211 methods, notification
+3 -25
include/net/mac80211.h
··· 73 73 */ 74 74 75 75 /** 76 - * struct ieee80211_ht_bss_info - describing BSS's HT characteristics 77 - * 78 - * This structure describes most essential parameters needed 79 - * to describe 802.11n HT characteristics in a BSS. 80 - * 81 - * @primary_channel: channel number of primery channel 82 - * @bss_cap: 802.11n's general BSS capabilities (e.g. channel width) 83 - * @bss_op_mode: 802.11n's BSS operation modes (e.g. HT protection) 84 - */ 85 - struct ieee80211_ht_bss_info { 86 - u8 primary_channel; 87 - u8 bss_cap; /* use IEEE80211_HT_IE_CHA_ */ 88 - u8 bss_op_mode; /* use IEEE80211_HT_IE_ */ 89 - }; 90 - 91 - /** 92 76 * enum ieee80211_max_queues - maximum number of queues 93 77 * 94 78 * @IEEE80211_MAX_QUEUES: Maximum number of regular device queues. ··· 155 171 }; 156 172 157 173 /** 158 - * struct ieee80211_bss_ht_conf - BSS's changing HT configuration 159 - * @operation_mode: HT operation mode (like in &struct ieee80211_ht_info) 160 - */ 161 - struct ieee80211_bss_ht_conf { 162 - u16 operation_mode; 163 - }; 164 - 165 - /** 166 174 * struct ieee80211_bss_conf - holds the BSS's changing parameters 167 175 * 168 176 * This structure keeps information about a BSS (and an association ··· 179 203 * the current band. 180 204 * @bssid: The BSSID for this BSS 181 205 * @enable_beacon: whether beaconing should be enabled or not 206 + * @ht_operation_mode: HT operation mode (like in &struct ieee80211_ht_info). 207 + * This field is only valid when the channel type is one of the HT types. 182 208 */ 183 209 struct ieee80211_bss_conf { 184 210 const u8 *bssid; ··· 197 219 u16 assoc_capability; 198 220 u64 timestamp; 199 221 u32 basic_rates; 200 - struct ieee80211_bss_ht_conf ht; 222 + u16 ht_operation_mode; 201 223 }; 202 224 203 225 /**
+43 -25
net/mac80211/cfg.c
··· 112 112 } 113 113 114 114 static int ieee80211_add_key(struct wiphy *wiphy, struct net_device *dev, 115 - u8 key_idx, u8 *mac_addr, 115 + u8 key_idx, const u8 *mac_addr, 116 116 struct key_params *params) 117 117 { 118 118 struct ieee80211_sub_if_data *sdata; ··· 141 141 return -EINVAL; 142 142 } 143 143 144 - key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key); 144 + key = ieee80211_key_alloc(alg, key_idx, params->key_len, params->key, 145 + params->seq_len, params->seq); 145 146 if (!key) 146 147 return -ENOMEM; 147 148 ··· 167 166 } 168 167 169 168 static int ieee80211_del_key(struct wiphy *wiphy, struct net_device *dev, 170 - u8 key_idx, u8 *mac_addr) 169 + u8 key_idx, const u8 *mac_addr) 171 170 { 172 171 struct ieee80211_sub_if_data *sdata; 173 172 struct sta_info *sta; ··· 209 208 } 210 209 211 210 static int ieee80211_get_key(struct wiphy *wiphy, struct net_device *dev, 212 - u8 key_idx, u8 *mac_addr, void *cookie, 211 + u8 key_idx, const u8 *mac_addr, void *cookie, 213 212 void (*callback)(void *cookie, 214 213 struct key_params *params)) 215 214 { ··· 630 629 int i, j; 631 630 struct ieee80211_supported_band *sband; 632 631 struct ieee80211_sub_if_data *sdata = sta->sdata; 632 + u32 mask, set; 633 633 634 634 sband = local->hw.wiphy->bands[local->oper_channel->band]; 635 635 636 - /* 637 - * FIXME: updating the flags is racy when this function is 638 - * called from ieee80211_change_station(), this will 639 - * be resolved in a future patch. 640 - */ 636 + spin_lock_bh(&sta->lock); 637 + mask = params->sta_flags_mask; 638 + set = params->sta_flags_set; 641 639 642 - if (params->station_flags & STATION_FLAG_CHANGED) { 643 - spin_lock_bh(&sta->lock); 640 + if (mask & BIT(NL80211_STA_FLAG_AUTHORIZED)) { 644 641 sta->flags &= ~WLAN_STA_AUTHORIZED; 645 - if (params->station_flags & STATION_FLAG_AUTHORIZED) 642 + if (set & BIT(NL80211_STA_FLAG_AUTHORIZED)) 646 643 sta->flags |= WLAN_STA_AUTHORIZED; 647 - 648 - sta->flags &= ~WLAN_STA_SHORT_PREAMBLE; 649 - if (params->station_flags & STATION_FLAG_SHORT_PREAMBLE) 650 - sta->flags |= WLAN_STA_SHORT_PREAMBLE; 651 - 652 - sta->flags &= ~WLAN_STA_WME; 653 - if (params->station_flags & STATION_FLAG_WME) 654 - sta->flags |= WLAN_STA_WME; 655 - 656 - sta->flags &= ~WLAN_STA_MFP; 657 - if (params->station_flags & STATION_FLAG_MFP) 658 - sta->flags |= WLAN_STA_MFP; 659 - spin_unlock_bh(&sta->lock); 660 644 } 645 + 646 + if (mask & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) { 647 + sta->flags &= ~WLAN_STA_SHORT_PREAMBLE; 648 + if (set & BIT(NL80211_STA_FLAG_SHORT_PREAMBLE)) 649 + sta->flags |= WLAN_STA_SHORT_PREAMBLE; 650 + } 651 + 652 + if (mask & BIT(NL80211_STA_FLAG_WME)) { 653 + sta->flags &= ~WLAN_STA_WME; 654 + if (set & BIT(NL80211_STA_FLAG_WME)) 655 + sta->flags |= WLAN_STA_WME; 656 + } 657 + 658 + if (mask & BIT(NL80211_STA_FLAG_MFP)) { 659 + sta->flags &= ~WLAN_STA_MFP; 660 + if (set & BIT(NL80211_STA_FLAG_MFP)) 661 + sta->flags |= WLAN_STA_MFP; 662 + } 663 + spin_unlock_bh(&sta->lock); 661 664 662 665 /* 663 666 * FIXME: updating the following information is racy when this ··· 1257 1252 ret = ieee80211_sta_set_extra_ie(sdata, req->ie, req->ie_len); 1258 1253 if (ret) 1259 1254 return ret; 1255 + 1256 + if (req->use_mfp) { 1257 + sdata->u.mgd.mfp = IEEE80211_MFP_REQUIRED; 1258 + sdata->u.mgd.flags |= IEEE80211_STA_MFP_ENABLED; 1259 + } else { 1260 + sdata->u.mgd.mfp = IEEE80211_MFP_DISABLED; 1261 + sdata->u.mgd.flags &= ~IEEE80211_STA_MFP_ENABLED; 1262 + } 1263 + 1264 + if (req->control_port) 1265 + sdata->u.mgd.flags |= IEEE80211_STA_CONTROL_PORT; 1266 + else 1267 + sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; 1260 1268 1261 1269 sdata->u.mgd.flags |= IEEE80211_STA_EXT_SME; 1262 1270 sdata->u.mgd.state = IEEE80211_STA_MLME_ASSOCIATE;
+38
net/mac80211/debugfs.c
··· 135 135 .open = mac80211_open_file_generic, 136 136 }; 137 137 138 + static ssize_t noack_read(struct file *file, char __user *user_buf, 139 + size_t count, loff_t *ppos) 140 + { 141 + struct ieee80211_local *local = file->private_data; 142 + int res; 143 + char buf[10]; 144 + 145 + res = scnprintf(buf, sizeof(buf), "%d\n", local->wifi_wme_noack_test); 146 + 147 + return simple_read_from_buffer(user_buf, count, ppos, buf, res); 148 + } 149 + 150 + static ssize_t noack_write(struct file *file, 151 + const char __user *user_buf, 152 + size_t count, loff_t *ppos) 153 + { 154 + struct ieee80211_local *local = file->private_data; 155 + char buf[10]; 156 + size_t len; 157 + 158 + len = min(count, sizeof(buf) - 1); 159 + if (copy_from_user(buf, user_buf, len)) 160 + return -EFAULT; 161 + buf[len] = '\0'; 162 + 163 + local->wifi_wme_noack_test = !!simple_strtoul(buf, NULL, 0); 164 + 165 + return count; 166 + } 167 + 168 + static const struct file_operations noack_ops = { 169 + .read = noack_read, 170 + .write = noack_write, 171 + .open = mac80211_open_file_generic 172 + }; 173 + 138 174 /* statistics stuff */ 139 175 140 176 #define DEBUGFS_STATS_FILE(name, buflen, fmt, value...) \ ··· 311 275 DEBUGFS_ADD(wep_iv); 312 276 DEBUGFS_ADD(tsf); 313 277 DEBUGFS_ADD_MODE(reset, 0200); 278 + DEBUGFS_ADD(noack); 314 279 315 280 statsd = debugfs_create_dir("statistics", phyd); 316 281 local->debugfs.statistics = statsd; ··· 367 330 DEBUGFS_DEL(wep_iv); 368 331 DEBUGFS_DEL(tsf); 369 332 DEBUGFS_DEL(reset); 333 + DEBUGFS_DEL(noack); 370 334 371 335 DEBUGFS_STATS_DEL(transmitted_fragment_count); 372 336 DEBUGFS_STATS_DEL(multicast_transmitted_frame_count);
+48 -29
net/mac80211/ibss.c
··· 63 63 static void __ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, 64 64 const u8 *bssid, const int beacon_int, 65 65 struct ieee80211_channel *chan, 66 - const size_t supp_rates_len, 67 - const u8 *supp_rates, 66 + const u32 basic_rates, 68 67 const u16 capability, u64 tsf) 69 68 { 70 69 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 71 70 struct ieee80211_local *local = sdata->local; 72 - int rates, i, j; 71 + int rates, i; 73 72 struct sk_buff *skb; 74 73 struct ieee80211_mgmt *mgmt; 75 74 u8 *pos; 76 75 struct ieee80211_supported_band *sband; 77 76 u32 bss_change; 78 - 77 + u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 79 78 80 79 /* Reset own TSF to allow time synchronization work. */ 81 80 drv_reset_tsf(local); ··· 100 101 101 102 sband = local->hw.wiphy->bands[chan->band]; 102 103 104 + /* build supported rates array */ 105 + pos = supp_rates; 106 + for (i = 0; i < sband->n_bitrates; i++) { 107 + int rate = sband->bitrates[i].bitrate; 108 + u8 basic = 0; 109 + if (basic_rates & BIT(i)) 110 + basic = 0x80; 111 + *pos++ = basic | (u8) (rate / 5); 112 + } 113 + 103 114 /* Build IBSS probe response */ 104 115 mgmt = (void *) skb_put(skb, 24 + sizeof(mgmt->u.beacon)); 105 116 memset(mgmt, 0, 24 + sizeof(mgmt->u.beacon)); ··· 127 118 *pos++ = ifibss->ssid_len; 128 119 memcpy(pos, ifibss->ssid, ifibss->ssid_len); 129 120 130 - rates = supp_rates_len; 121 + rates = sband->n_bitrates; 131 122 if (rates > 8) 132 123 rates = 8; 133 124 pos = skb_put(skb, 2 + rates); ··· 149 140 *pos++ = 0; 150 141 *pos++ = 0; 151 142 152 - if (supp_rates_len > 8) { 153 - rates = supp_rates_len - 8; 143 + if (sband->n_bitrates > 8) { 144 + rates = sband->n_bitrates - 8; 154 145 pos = skb_put(skb, 2 + rates); 155 146 *pos++ = WLAN_EID_EXT_SUPP_RATES; 156 147 *pos++ = rates; ··· 171 162 bss_change |= BSS_CHANGED_BEACON_ENABLED; 172 163 ieee80211_bss_info_change_notify(sdata, bss_change); 173 164 174 - rates = 0; 175 - for (i = 0; i < supp_rates_len; i++) { 176 - int bitrate = (supp_rates[i] & 0x7f) * 5; 177 - for (j = 0; j < sband->n_bitrates; j++) 178 - if (sband->bitrates[j].bitrate == bitrate) 179 - rates |= BIT(j); 180 - } 181 - 182 - ieee80211_sta_def_wmm_params(sdata, supp_rates_len, supp_rates); 165 + ieee80211_sta_def_wmm_params(sdata, sband->n_bitrates, supp_rates); 183 166 184 167 ifibss->state = IEEE80211_IBSS_MLME_JOINED; 185 168 mod_timer(&ifibss->timer, ··· 185 184 static void ieee80211_sta_join_ibss(struct ieee80211_sub_if_data *sdata, 186 185 struct ieee80211_bss *bss) 187 186 { 187 + struct ieee80211_supported_band *sband; 188 + u32 basic_rates; 189 + int i, j; 188 190 u16 beacon_int = bss->cbss.beacon_interval; 189 191 190 192 if (beacon_int < 10) 191 193 beacon_int = 10; 192 194 195 + sband = sdata->local->hw.wiphy->bands[bss->cbss.channel->band]; 196 + 197 + basic_rates = 0; 198 + 199 + for (i = 0; i < bss->supp_rates_len; i++) { 200 + int rate = (bss->supp_rates[i] & 0x7f) * 5; 201 + bool is_basic = !!(bss->supp_rates[i] & 0x80); 202 + 203 + for (j = 0; j < sband->n_bitrates; j++) { 204 + if (sband->bitrates[j].bitrate == rate) { 205 + if (is_basic) 206 + basic_rates |= BIT(j); 207 + break; 208 + } 209 + } 210 + } 211 + 193 212 __ieee80211_sta_join_ibss(sdata, bss->cbss.bssid, 194 213 beacon_int, 195 214 bss->cbss.channel, 196 - bss->supp_rates_len, bss->supp_rates, 215 + basic_rates, 197 216 bss->cbss.capability, 198 217 bss->cbss.tsf); 199 218 } ··· 470 449 struct ieee80211_if_ibss *ifibss = &sdata->u.ibss; 471 450 struct ieee80211_local *local = sdata->local; 472 451 struct ieee80211_supported_band *sband; 473 - u8 *pos; 474 452 u8 bssid[ETH_ALEN]; 475 - u8 supp_rates[IEEE80211_MAX_SUPP_RATES]; 476 453 u16 capability; 477 454 int i; 478 455 ··· 499 480 else 500 481 sdata->drop_unencrypted = 0; 501 482 502 - pos = supp_rates; 503 - for (i = 0; i < sband->n_bitrates; i++) { 504 - int rate = sband->bitrates[i].bitrate; 505 - *pos++ = (u8) (rate / 5); 506 - } 507 - 508 483 __ieee80211_sta_join_ibss(sdata, bssid, sdata->vif.bss_conf.beacon_int, 509 - ifibss->channel, sband->n_bitrates, 510 - supp_rates, capability, 0); 484 + ifibss->channel, 3, /* first two are basic */ 485 + capability, 0); 511 486 } 512 487 513 488 static void ieee80211_sta_find_ibss(struct ieee80211_sub_if_data *sdata) ··· 512 499 struct ieee80211_channel *chan = NULL; 513 500 const u8 *bssid = NULL; 514 501 int active_ibss; 502 + u16 capability; 515 503 516 504 active_ibss = ieee80211_sta_active_ibss(sdata); 517 505 #ifdef CONFIG_MAC80211_IBSS_DEBUG ··· 523 509 if (active_ibss) 524 510 return; 525 511 512 + capability = WLAN_CAPABILITY_IBSS; 513 + if (sdata->default_key) 514 + capability |= WLAN_CAPABILITY_PRIVACY; 515 + 526 516 if (ifibss->fixed_bssid) 527 517 bssid = ifibss->bssid; 528 518 if (ifibss->fixed_channel) ··· 535 517 bssid = ifibss->bssid; 536 518 bss = (void *)cfg80211_get_bss(local->hw.wiphy, chan, bssid, 537 519 ifibss->ssid, ifibss->ssid_len, 538 - WLAN_CAPABILITY_IBSS, 539 - WLAN_CAPABILITY_IBSS); 520 + capability, 521 + WLAN_CAPABILITY_IBSS | 522 + WLAN_CAPABILITY_PRIVACY); 540 523 541 524 #ifdef CONFIG_MAC80211_IBSS_DEBUG 542 525 if (bss)
+8 -1
net/mac80211/ieee80211_i.h
··· 235 235 #define IEEE80211_STA_ASSOCIATED BIT(4) 236 236 #define IEEE80211_STA_PROBEREQ_POLL BIT(5) 237 237 #define IEEE80211_STA_CREATE_IBSS BIT(6) 238 - /* hole at 7, please re-use */ 238 + #define IEEE80211_STA_CONTROL_PORT BIT(7) 239 239 #define IEEE80211_STA_WMM_ENABLED BIT(8) 240 240 /* hole at 9, please re-use */ 241 241 #define IEEE80211_STA_AUTO_SSID_SEL BIT(10) ··· 426 426 unsigned int flags; 427 427 428 428 int drop_unencrypted; 429 + 430 + /* 431 + * keep track of whether the HT opmode (stored in 432 + * vif.bss_info.ht_operation_mode) is valid. 433 + */ 434 + bool ht_opmode_valid; 429 435 430 436 /* Fragment table for host-based reassembly */ 431 437 struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX]; ··· 766 760 struct dentry *wep_iv; 767 761 struct dentry *tsf; 768 762 struct dentry *reset; 763 + struct dentry *noack; 769 764 struct dentry *statistics; 770 765 struct local_debugfsdentries_statsdentries { 771 766 struct dentry *transmitted_fragment_count;
+2 -1
net/mac80211/iface.c
··· 964 964 mutex_lock(&local->iflist_mtx); 965 965 chg = __ieee80211_recalc_idle(local); 966 966 mutex_unlock(&local->iflist_mtx); 967 - ieee80211_hw_config(local, chg); 967 + if (chg) 968 + ieee80211_hw_config(local, chg); 968 969 }
+20 -1
net/mac80211/key.c
··· 290 290 struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, 291 291 int idx, 292 292 size_t key_len, 293 - const u8 *key_data) 293 + const u8 *key_data, 294 + size_t seq_len, const u8 *seq) 294 295 { 295 296 struct ieee80211_key *key; 297 + int i, j; 296 298 297 299 BUG_ON(idx < 0 || idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS); 298 300 ··· 320 318 case ALG_TKIP: 321 319 key->conf.iv_len = TKIP_IV_LEN; 322 320 key->conf.icv_len = TKIP_ICV_LEN; 321 + if (seq && seq_len == 6) { 322 + for (i = 0; i < NUM_RX_DATA_QUEUES; i++) { 323 + key->u.tkip.rx[i].iv32 = 324 + get_unaligned_le32(&seq[2]); 325 + key->u.tkip.rx[i].iv16 = 326 + get_unaligned_le16(seq); 327 + } 328 + } 323 329 break; 324 330 case ALG_CCMP: 325 331 key->conf.iv_len = CCMP_HDR_LEN; 326 332 key->conf.icv_len = CCMP_MIC_LEN; 333 + if (seq && seq_len == CCMP_PN_LEN) { 334 + for (i = 0; i < NUM_RX_DATA_QUEUES; i++) 335 + for (j = 0; j < CCMP_PN_LEN; j++) 336 + key->u.ccmp.rx_pn[i][j] = 337 + seq[CCMP_PN_LEN - j - 1]; 338 + } 327 339 break; 328 340 case ALG_AES_CMAC: 329 341 key->conf.iv_len = 0; 330 342 key->conf.icv_len = sizeof(struct ieee80211_mmie); 343 + if (seq && seq_len == 6) 344 + for (j = 0; j < 6; j++) 345 + key->u.aes_cmac.rx_pn[j] = seq[6 - j - 1]; 331 346 break; 332 347 } 333 348 memcpy(key->conf.key, key_data, key_len);
+2 -1
net/mac80211/key.h
··· 144 144 struct ieee80211_key *ieee80211_key_alloc(enum ieee80211_key_alg alg, 145 145 int idx, 146 146 size_t key_len, 147 - const u8 *key_data); 147 + const u8 *key_data, 148 + size_t seq_len, const u8 *seq); 148 149 /* 149 150 * Insert a key into data structures (sdata, sta if necessary) 150 151 * to make it used, free old key.
+8 -6
net/mac80211/main.c
··· 154 154 155 155 int ieee80211_hw_config(struct ieee80211_local *local, u32 changed) 156 156 { 157 - struct ieee80211_channel *chan; 157 + struct ieee80211_channel *chan, *scan_chan; 158 158 int ret = 0; 159 159 int power; 160 160 enum nl80211_channel_type channel_type; 161 161 162 162 might_sleep(); 163 163 164 - if (local->sw_scanning) { 165 - chan = local->scan_channel; 164 + scan_chan = local->scan_channel; 165 + 166 + if (scan_chan) { 167 + chan = scan_chan; 166 168 channel_type = NL80211_CHAN_NO_HT; 167 169 } else { 168 170 chan = local->oper_channel; ··· 178 176 changed |= IEEE80211_CONF_CHANGE_CHANNEL; 179 177 } 180 178 181 - if (local->sw_scanning) 179 + if (scan_chan) 182 180 power = chan->max_power; 183 181 else 184 182 power = local->power_constr_level ? ··· 861 859 if (!local->oper_channel) { 862 860 /* init channel we're on */ 863 861 local->hw.conf.channel = 864 - local->oper_channel = 865 - local->scan_channel = &sband->channels[0]; 862 + local->oper_channel = &sband->channels[0]; 863 + local->hw.conf.channel_type = NL80211_CHAN_NO_HT; 866 864 } 867 865 channels += sband->n_channels; 868 866
+30 -11
net/mac80211/mlme.c
··· 33 33 #define IEEE80211_ASSOC_TIMEOUT (HZ / 5) 34 34 #define IEEE80211_ASSOC_MAX_TRIES 3 35 35 #define IEEE80211_MONITORING_INTERVAL (2 * HZ) 36 + #define IEEE80211_PROBE_WAIT (HZ / 20) 36 37 #define IEEE80211_PROBE_IDLE_TIME (60 * HZ) 37 38 #define IEEE80211_RETRY_AUTH_INTERVAL (1 * HZ) 38 39 ··· 96 95 struct ieee80211_local *local = sdata->local; 97 96 struct ieee80211_supported_band *sband; 98 97 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 99 - struct ieee80211_bss_ht_conf ht; 100 98 struct sta_info *sta; 101 99 u32 changed = 0; 100 + u16 ht_opmode; 102 101 bool enable_ht = true, ht_changed; 103 102 enum nl80211_channel_type channel_type = NL80211_CHAN_NO_HT; 104 103 105 104 sband = local->hw.wiphy->bands[local->hw.conf.channel->band]; 106 - 107 - memset(&ht, 0, sizeof(ht)); 108 105 109 106 /* HT is not supported */ 110 107 if (!sband->ht_cap.ht_supported) ··· 147 148 IEEE80211_RC_HT_CHANGED); 148 149 149 150 rcu_read_unlock(); 150 - 151 151 } 152 152 153 153 /* disable HT */ 154 154 if (!enable_ht) 155 155 return 0; 156 156 157 - ht.operation_mode = le16_to_cpu(hti->operation_mode); 157 + ht_opmode = le16_to_cpu(hti->operation_mode); 158 158 159 159 /* if bss configuration changed store the new one */ 160 - if (memcmp(&sdata->vif.bss_conf.ht, &ht, sizeof(ht))) { 160 + if (!sdata->ht_opmode_valid || 161 + sdata->vif.bss_conf.ht_operation_mode != ht_opmode) { 161 162 changed |= BSS_CHANGED_HT; 162 - sdata->vif.bss_conf.ht = ht; 163 + sdata->vif.bss_conf.ht_operation_mode = ht_opmode; 164 + sdata->ht_opmode_valid = true; 163 165 } 164 166 165 167 return changed; ··· 1043 1043 1044 1044 rcu_read_unlock(); 1045 1045 1046 + ieee80211_set_wmm_default(sdata); 1047 + 1046 1048 ieee80211_recalc_idle(local); 1047 1049 1048 1050 /* channel(_type) changes are handled by ieee80211_hw_config */ 1049 1051 local->oper_channel_type = NL80211_CHAN_NO_HT; 1052 + 1053 + /* on the next assoc, re-program HT parameters */ 1054 + sdata->ht_opmode_valid = false; 1050 1055 1051 1056 local->power_constr_level = 0; 1052 1057 ··· 1183 1178 u.mgd.beacon_loss_work); 1184 1179 struct ieee80211_if_managed *ifmgd = &sdata->u.mgd; 1185 1180 1181 + /* 1182 + * The driver has already reported this event and we have 1183 + * already sent a probe request. Maybe the AP died and the 1184 + * driver keeps reporting until we disassociate... We have 1185 + * to ignore that because otherwise we would continually 1186 + * reset the timer and never check whether we received a 1187 + * probe response! 1188 + */ 1189 + if (ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) 1190 + return; 1191 + 1186 1192 #ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1187 1193 if (net_ratelimit()) { 1188 1194 printk(KERN_DEBUG "%s: driver reports beacon loss from AP %pM " ··· 1206 1190 ieee80211_send_probe_req(sdata, ifmgd->bssid, ifmgd->ssid, 1207 1191 ifmgd->ssid_len, NULL, 0); 1208 1192 1209 - mod_timer(&ifmgd->timer, jiffies + IEEE80211_MONITORING_INTERVAL); 1193 + mod_timer(&ifmgd->timer, jiffies + IEEE80211_PROBE_WAIT); 1210 1194 } 1211 1195 1212 1196 void ieee80211_beacon_loss(struct ieee80211_vif *vif) ··· 1243 1227 } 1244 1228 1245 1229 if ((ifmgd->flags & IEEE80211_STA_PROBEREQ_POLL) && 1246 - time_after(jiffies, sta->last_rx + IEEE80211_MONITORING_INTERVAL)) { 1230 + time_after(jiffies, sta->last_rx + IEEE80211_PROBE_WAIT)) { 1247 1231 printk(KERN_DEBUG "%s: no probe response from AP %pM " 1248 1232 "- disassociating\n", 1249 1233 sdata->dev->name, ifmgd->bssid); ··· 1593 1577 * to between the sta_info_alloc() and sta_info_insert() above. 1594 1578 */ 1595 1579 1596 - set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_AP | 1597 - WLAN_STA_AUTHORIZED); 1580 + set_sta_flags(sta, WLAN_STA_AUTH | WLAN_STA_ASSOC | WLAN_STA_ASSOC_AP); 1581 + if (!(ifmgd->flags & IEEE80211_STA_CONTROL_PORT)) 1582 + set_sta_flags(sta, WLAN_STA_AUTHORIZED); 1598 1583 1599 1584 rates = 0; 1600 1585 basic_rates = 0; ··· 1675 1658 if (elems.wmm_param) 1676 1659 ieee80211_sta_wmm_params(local, ifmgd, elems.wmm_param, 1677 1660 elems.wmm_param_len); 1661 + else 1662 + ieee80211_set_wmm_default(sdata); 1678 1663 1679 1664 if (elems.ht_info_elem && elems.wmm_param && 1680 1665 (ifmgd->flags & IEEE80211_STA_WMM_ENABLED) &&
+40 -18
net/mac80211/rx.c
··· 630 630 * possible. 631 631 */ 632 632 633 - if (!ieee80211_has_protected(hdr->frame_control)) { 634 - if (!ieee80211_is_mgmt(hdr->frame_control) || 635 - rx->sta == NULL || !test_sta_flags(rx->sta, WLAN_STA_MFP)) 636 - return RX_CONTINUE; 637 - mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb); 638 - if (mmie_keyidx < 0) 639 - return RX_CONTINUE; 640 - } 641 - 642 633 /* 643 634 * No point in finding a key and decrypting if the frame is neither 644 635 * addressed to us nor a multicast frame. ··· 640 649 if (rx->sta) 641 650 stakey = rcu_dereference(rx->sta->key); 642 651 652 + if (!ieee80211_has_protected(hdr->frame_control)) 653 + mmie_keyidx = ieee80211_get_mmie_keyidx(rx->skb); 654 + 643 655 if (!is_multicast_ether_addr(hdr->addr1) && stakey) { 644 656 rx->key = stakey; 657 + /* Skip decryption if the frame is not protected. */ 658 + if (!ieee80211_has_protected(hdr->frame_control)) 659 + return RX_CONTINUE; 645 660 } else if (mmie_keyidx >= 0) { 646 661 /* Broadcast/multicast robust management frame / BIP */ 647 662 if ((rx->status->flag & RX_FLAG_DECRYPTED) && ··· 658 661 mmie_keyidx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) 659 662 return RX_DROP_MONITOR; /* unexpected BIP keyidx */ 660 663 rx->key = rcu_dereference(rx->sdata->keys[mmie_keyidx]); 664 + } else if (!ieee80211_has_protected(hdr->frame_control)) { 665 + /* 666 + * The frame was not protected, so skip decryption. However, we 667 + * need to set rx->key if there is a key that could have been 668 + * used so that the frame may be dropped if encryption would 669 + * have been expected. 670 + */ 671 + struct ieee80211_key *key = NULL; 672 + if (ieee80211_is_mgmt(hdr->frame_control) && 673 + is_multicast_ether_addr(hdr->addr1) && 674 + (key = rcu_dereference(rx->sdata->default_mgmt_key))) 675 + rx->key = key; 676 + else if ((key = rcu_dereference(rx->sdata->default_key))) 677 + rx->key = key; 678 + return RX_CONTINUE; 661 679 } else { 662 680 /* 663 681 * The device doesn't give us the IV so we won't be ··· 1221 1209 /* Drop unencrypted frames if key is set. */ 1222 1210 if (unlikely(!ieee80211_has_protected(fc) && 1223 1211 !ieee80211_is_nullfunc(fc) && 1224 - (!ieee80211_is_mgmt(fc) || 1225 - (ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && 1226 - rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP))) && 1212 + ieee80211_is_data(fc) && 1227 1213 (rx->key || rx->sdata->drop_unencrypted))) 1228 1214 return -EACCES; 1229 - /* BIP does not use Protected field, so need to check MMIE */ 1230 - if (unlikely(rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP) && 1231 - ieee80211_is_multicast_robust_mgmt_frame(rx->skb) && 1232 - ieee80211_get_mmie_keyidx(rx->skb) < 0 && 1233 - (rx->key || rx->sdata->drop_unencrypted))) 1234 - return -EACCES; 1215 + if (rx->sta && test_sta_flags(rx->sta, WLAN_STA_MFP)) { 1216 + if (unlikely(ieee80211_is_unicast_robust_mgmt_frame(rx->skb) && 1217 + rx->key)) 1218 + return -EACCES; 1219 + /* BIP does not use Protected field, so need to check MMIE */ 1220 + if (unlikely(ieee80211_is_multicast_robust_mgmt_frame(rx->skb) 1221 + && ieee80211_get_mmie_keyidx(rx->skb) < 0 && 1222 + rx->key)) 1223 + return -EACCES; 1224 + /* 1225 + * When using MFP, Action frames are not allowed prior to 1226 + * having configured keys. 1227 + */ 1228 + if (unlikely(ieee80211_is_action(fc) && !rx->key && 1229 + ieee80211_is_robust_mgmt_frame( 1230 + (struct ieee80211_hdr *) rx->skb->data))) 1231 + return -EACCES; 1232 + } 1235 1233 1236 1234 return 0; 1237 1235 }
+24 -8
net/mac80211/scan.c
··· 298 298 was_hw_scan = local->hw_scanning; 299 299 local->hw_scanning = false; 300 300 local->sw_scanning = false; 301 + local->scan_channel = NULL; 301 302 302 303 /* we only have to protect scan_req and hw/sw scan */ 303 304 mutex_unlock(&local->scan_mtx); ··· 559 558 if (skip) 560 559 break; 561 560 562 - next_delay = IEEE80211_PROBE_DELAY + 563 - usecs_to_jiffies(local->hw.channel_change_time); 561 + /* 562 + * Probe delay is used to update the NAV, cf. 11.1.3.2.2 563 + * (which unfortunately doesn't say _why_ step a) is done, 564 + * but it waits for the probe delay or until a frame is 565 + * received - and the received frame would update the NAV). 566 + * For now, we do not support waiting until a frame is 567 + * received. 568 + * 569 + * In any case, it is not necessary for a passive scan. 570 + */ 571 + if (chan->flags & IEEE80211_CHAN_PASSIVE_SCAN || 572 + !local->scan_req->n_ssids) { 573 + next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; 574 + break; 575 + } 576 + 577 + next_delay = IEEE80211_PROBE_DELAY; 564 578 local->scan_state = SCAN_SEND_PROBE; 565 579 break; 566 580 case SCAN_SEND_PROBE: 567 - next_delay = IEEE80211_PASSIVE_CHANNEL_TIME; 568 - local->scan_state = SCAN_SET_CHANNEL; 569 - 570 - if (local->scan_channel->flags & IEEE80211_CHAN_PASSIVE_SCAN || 571 - !local->scan_req->n_ssids) 572 - break; 573 581 for (i = 0; i < local->scan_req->n_ssids; i++) 574 582 ieee80211_send_probe_req( 575 583 sdata, NULL, 576 584 local->scan_req->ssids[i].ssid, 577 585 local->scan_req->ssids[i].ssid_len, 578 586 local->scan_req->ie, local->scan_req->ie_len); 587 + 588 + /* 589 + * After sending probe requests, wait for probe responses 590 + * on the channel. 591 + */ 579 592 next_delay = IEEE80211_CHANNEL_TIME; 593 + local->scan_state = SCAN_SET_CHANNEL; 580 594 break; 581 595 } 582 596
+4 -1
net/mac80211/tx.c
··· 1087 1087 info->flags |= IEEE80211_TX_CTL_NO_ACK; 1088 1088 } else { 1089 1089 tx->flags |= IEEE80211_TX_UNICAST; 1090 - info->flags &= ~IEEE80211_TX_CTL_NO_ACK; 1090 + if (unlikely(local->wifi_wme_noack_test)) 1091 + info->flags |= IEEE80211_TX_CTL_NO_ACK; 1092 + else 1093 + info->flags &= ~IEEE80211_TX_CTL_NO_ACK; 1091 1094 } 1092 1095 1093 1096 if (tx->flags & IEEE80211_TX_FRAGMENTED) {
+47 -11
net/mac80211/util.c
··· 708 708 { 709 709 struct ieee80211_local *local = sdata->local; 710 710 struct ieee80211_tx_queue_params qparam; 711 - int i; 711 + int queue; 712 + bool use_11b; 713 + int aCWmin, aCWmax; 712 714 713 715 if (!local->ops->conf_tx) 714 716 return; 715 717 716 718 memset(&qparam, 0, sizeof(qparam)); 717 719 718 - qparam.aifs = 2; 720 + use_11b = (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ) && 721 + !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE); 719 722 720 - if (local->hw.conf.channel->band == IEEE80211_BAND_2GHZ && 721 - !(sdata->flags & IEEE80211_SDATA_OPERATING_GMODE)) 722 - qparam.cw_min = 31; 723 - else 724 - qparam.cw_min = 15; 723 + for (queue = 0; queue < local_to_hw(local)->queues; queue++) { 724 + /* Set defaults according to 802.11-2007 Table 7-37 */ 725 + aCWmax = 1023; 726 + if (use_11b) 727 + aCWmin = 31; 728 + else 729 + aCWmin = 15; 725 730 726 - qparam.cw_max = 1023; 727 - qparam.txop = 0; 731 + switch (queue) { 732 + case 3: /* AC_BK */ 733 + qparam.cw_max = aCWmin; 734 + qparam.cw_min = aCWmax; 735 + qparam.txop = 0; 736 + qparam.aifs = 7; 737 + break; 738 + default: /* never happens but let's not leave undefined */ 739 + case 2: /* AC_BE */ 740 + qparam.cw_max = aCWmin; 741 + qparam.cw_min = aCWmax; 742 + qparam.txop = 0; 743 + qparam.aifs = 3; 744 + break; 745 + case 1: /* AC_VI */ 746 + qparam.cw_max = aCWmin; 747 + qparam.cw_min = (aCWmin + 1) / 2 - 1; 748 + if (use_11b) 749 + qparam.txop = 6016/32; 750 + else 751 + qparam.txop = 3008/32; 752 + qparam.aifs = 2; 753 + break; 754 + case 0: /* AC_VO */ 755 + qparam.cw_max = (aCWmin + 1) / 2 - 1; 756 + qparam.cw_min = (aCWmin + 1) / 4 - 1; 757 + if (use_11b) 758 + qparam.txop = 3264/32; 759 + else 760 + qparam.txop = 1504/32; 761 + qparam.aifs = 2; 762 + break; 763 + } 728 764 729 - for (i = 0; i < local_to_hw(local)->queues; i++) 730 - drv_conf_tx(local, i, &qparam); 765 + drv_conf_tx(local, queue, &qparam); 766 + } 731 767 } 732 768 733 769 void ieee80211_sta_def_wmm_params(struct ieee80211_sub_if_data *sdata,
+6 -276
net/mac80211/wext.c
··· 27 27 #include "aes_ccm.h" 28 28 29 29 30 - static int ieee80211_set_encryption(struct ieee80211_sub_if_data *sdata, u8 *sta_addr, 31 - int idx, int alg, int remove, 32 - int set_tx_key, const u8 *_key, 33 - size_t key_len) 34 - { 35 - struct ieee80211_local *local = sdata->local; 36 - struct sta_info *sta; 37 - struct ieee80211_key *key; 38 - int err; 39 - 40 - if (alg == ALG_AES_CMAC) { 41 - if (idx < NUM_DEFAULT_KEYS || 42 - idx >= NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) { 43 - printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d " 44 - "(BIP)\n", sdata->dev->name, idx); 45 - return -EINVAL; 46 - } 47 - } else if (idx < 0 || idx >= NUM_DEFAULT_KEYS) { 48 - printk(KERN_DEBUG "%s: set_encrypt - invalid idx=%d\n", 49 - sdata->dev->name, idx); 50 - return -EINVAL; 51 - } 52 - 53 - if (remove) { 54 - rcu_read_lock(); 55 - 56 - err = 0; 57 - 58 - if (is_broadcast_ether_addr(sta_addr)) { 59 - key = sdata->keys[idx]; 60 - } else { 61 - sta = sta_info_get(local, sta_addr); 62 - if (!sta) { 63 - err = -ENOENT; 64 - goto out_unlock; 65 - } 66 - key = sta->key; 67 - } 68 - 69 - ieee80211_key_free(key); 70 - } else { 71 - key = ieee80211_key_alloc(alg, idx, key_len, _key); 72 - if (!key) 73 - return -ENOMEM; 74 - 75 - sta = NULL; 76 - err = 0; 77 - 78 - rcu_read_lock(); 79 - 80 - if (!is_broadcast_ether_addr(sta_addr)) { 81 - set_tx_key = 0; 82 - /* 83 - * According to the standard, the key index of a 84 - * pairwise key must be zero. However, some AP are 85 - * broken when it comes to WEP key indices, so we 86 - * work around this. 87 - */ 88 - if (idx != 0 && alg != ALG_WEP) { 89 - ieee80211_key_free(key); 90 - err = -EINVAL; 91 - goto out_unlock; 92 - } 93 - 94 - sta = sta_info_get(local, sta_addr); 95 - if (!sta) { 96 - ieee80211_key_free(key); 97 - err = -ENOENT; 98 - goto out_unlock; 99 - } 100 - } 101 - 102 - if (alg == ALG_WEP && 103 - key_len != LEN_WEP40 && key_len != LEN_WEP104) { 104 - ieee80211_key_free(key); 105 - err = -EINVAL; 106 - goto out_unlock; 107 - } 108 - 109 - ieee80211_key_link(key, sdata, sta); 110 - 111 - if (set_tx_key || (!sta && !sdata->default_key && key)) 112 - ieee80211_set_default_key(sdata, idx); 113 - if (alg == ALG_AES_CMAC && 114 - (set_tx_key || (!sta && !sdata->default_mgmt_key && key))) 115 - ieee80211_set_default_mgmt_key(sdata, idx); 116 - } 117 - 118 - out_unlock: 119 - rcu_read_unlock(); 120 - 121 - return err; 122 - } 123 - 124 30 static int ieee80211_ioctl_siwgenie(struct net_device *dev, 125 31 struct iw_request_info *info, 126 32 struct iw_point *data, char *extra) ··· 41 135 return ret; 42 136 sdata->u.mgd.flags &= ~IEEE80211_STA_AUTO_BSSID_SEL; 43 137 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; 138 + sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; 44 139 ieee80211_sta_req_auth(sdata); 45 140 return 0; 46 141 } ··· 125 218 return ret; 126 219 127 220 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; 221 + sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; 128 222 ieee80211_sta_req_auth(sdata); 129 223 return 0; 130 224 } ··· 183 275 if (ret) 184 276 return ret; 185 277 sdata->u.mgd.flags &= ~IEEE80211_STA_EXT_SME; 278 + sdata->u.mgd.flags &= ~IEEE80211_STA_CONTROL_PORT; 186 279 ieee80211_sta_req_auth(sdata); 187 280 return 0; 188 281 } else if (sdata->vif.type == NL80211_IFTYPE_WDS) { ··· 377 468 data->txpower.disabled = !(local->hw.conf.radio_enabled); 378 469 data->txpower.value = local->hw.conf.power_level; 379 470 data->txpower.flags = IW_TXPOW_DBM; 380 - 381 - return 0; 382 - } 383 - 384 - static int ieee80211_ioctl_siwencode(struct net_device *dev, 385 - struct iw_request_info *info, 386 - struct iw_point *erq, char *keybuf) 387 - { 388 - struct ieee80211_sub_if_data *sdata; 389 - int idx, i, alg = ALG_WEP; 390 - u8 bcaddr[ETH_ALEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; 391 - int remove = 0, ret; 392 - 393 - sdata = IEEE80211_DEV_TO_SUB_IF(dev); 394 - 395 - idx = erq->flags & IW_ENCODE_INDEX; 396 - if (idx == 0) { 397 - if (sdata->default_key) 398 - for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 399 - if (sdata->default_key == sdata->keys[i]) { 400 - idx = i; 401 - break; 402 - } 403 - } 404 - } else if (idx < 1 || idx > 4) 405 - return -EINVAL; 406 - else 407 - idx--; 408 - 409 - if (erq->flags & IW_ENCODE_DISABLED) 410 - remove = 1; 411 - else if (erq->length == 0) { 412 - /* No key data - just set the default TX key index */ 413 - ieee80211_set_default_key(sdata, idx); 414 - return 0; 415 - } 416 - 417 - ret = ieee80211_set_encryption( 418 - sdata, bcaddr, 419 - idx, alg, remove, 420 - !sdata->default_key, 421 - keybuf, erq->length); 422 - 423 - if (!ret && sdata->vif.type == NL80211_IFTYPE_STATION) { 424 - if (remove) 425 - sdata->u.mgd.flags &= ~IEEE80211_STA_TKIP_WEP_USED; 426 - else 427 - sdata->u.mgd.flags |= IEEE80211_STA_TKIP_WEP_USED; 428 - } 429 - 430 - return ret; 431 - } 432 - 433 - 434 - static int ieee80211_ioctl_giwencode(struct net_device *dev, 435 - struct iw_request_info *info, 436 - struct iw_point *erq, char *key) 437 - { 438 - struct ieee80211_sub_if_data *sdata; 439 - int idx, i; 440 - 441 - sdata = IEEE80211_DEV_TO_SUB_IF(dev); 442 - 443 - idx = erq->flags & IW_ENCODE_INDEX; 444 - if (idx < 1 || idx > 4) { 445 - idx = -1; 446 - if (!sdata->default_key) 447 - idx = 0; 448 - else for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 449 - if (sdata->default_key == sdata->keys[i]) { 450 - idx = i; 451 - break; 452 - } 453 - } 454 - if (idx < 0) 455 - return -EINVAL; 456 - } else 457 - idx--; 458 - 459 - erq->flags = idx + 1; 460 - 461 - if (!sdata->keys[idx]) { 462 - erq->length = 0; 463 - erq->flags |= IW_ENCODE_DISABLED; 464 - return 0; 465 - } 466 - 467 - memcpy(key, sdata->keys[idx]->conf.key, 468 - min_t(int, erq->length, sdata->keys[idx]->conf.keylen)); 469 - erq->length = sdata->keys[idx]->conf.keylen; 470 - erq->flags |= IW_ENCODE_ENABLED; 471 - 472 - if (sdata->vif.type == NL80211_IFTYPE_STATION) { 473 - switch (sdata->u.mgd.auth_alg) { 474 - case WLAN_AUTH_OPEN: 475 - case WLAN_AUTH_LEAP: 476 - erq->flags |= IW_ENCODE_OPEN; 477 - break; 478 - case WLAN_AUTH_SHARED_KEY: 479 - erq->flags |= IW_ENCODE_RESTRICTED; 480 - break; 481 - } 482 - } 483 471 484 472 return 0; 485 473 } ··· 615 809 } 616 810 617 811 618 - static int ieee80211_ioctl_siwencodeext(struct net_device *dev, 619 - struct iw_request_info *info, 620 - struct iw_point *erq, char *extra) 621 - { 622 - struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); 623 - struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 624 - int uninitialized_var(alg), idx, i, remove = 0; 625 - 626 - switch (ext->alg) { 627 - case IW_ENCODE_ALG_NONE: 628 - remove = 1; 629 - break; 630 - case IW_ENCODE_ALG_WEP: 631 - alg = ALG_WEP; 632 - break; 633 - case IW_ENCODE_ALG_TKIP: 634 - alg = ALG_TKIP; 635 - break; 636 - case IW_ENCODE_ALG_CCMP: 637 - alg = ALG_CCMP; 638 - break; 639 - case IW_ENCODE_ALG_AES_CMAC: 640 - alg = ALG_AES_CMAC; 641 - break; 642 - default: 643 - return -EOPNOTSUPP; 644 - } 645 - 646 - if (erq->flags & IW_ENCODE_DISABLED) 647 - remove = 1; 648 - 649 - idx = erq->flags & IW_ENCODE_INDEX; 650 - if (alg == ALG_AES_CMAC) { 651 - if (idx < NUM_DEFAULT_KEYS + 1 || 652 - idx > NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS) { 653 - idx = -1; 654 - if (!sdata->default_mgmt_key) 655 - idx = 0; 656 - else for (i = NUM_DEFAULT_KEYS; 657 - i < NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS; 658 - i++) { 659 - if (sdata->default_mgmt_key == sdata->keys[i]) 660 - { 661 - idx = i; 662 - break; 663 - } 664 - } 665 - if (idx < 0) 666 - return -EINVAL; 667 - } else 668 - idx--; 669 - } else { 670 - if (idx < 1 || idx > 4) { 671 - idx = -1; 672 - if (!sdata->default_key) 673 - idx = 0; 674 - else for (i = 0; i < NUM_DEFAULT_KEYS; i++) { 675 - if (sdata->default_key == sdata->keys[i]) { 676 - idx = i; 677 - break; 678 - } 679 - } 680 - if (idx < 0) 681 - return -EINVAL; 682 - } else 683 - idx--; 684 - } 685 - 686 - return ieee80211_set_encryption(sdata, ext->addr.sa_data, idx, alg, 687 - remove, 688 - ext->ext_flags & 689 - IW_ENCODE_EXT_SET_TX_KEY, 690 - ext->key, ext->key_len); 691 - } 692 - 693 - 694 812 /* Structures to export the Wireless Handlers */ 695 813 696 814 static const iw_handler ieee80211_handler[] = ··· 661 931 (iw_handler) ieee80211_ioctl_giwtxpower, /* SIOCGIWTXPOW */ 662 932 (iw_handler) cfg80211_wext_siwretry, /* SIOCSIWRETRY */ 663 933 (iw_handler) cfg80211_wext_giwretry, /* SIOCGIWRETRY */ 664 - (iw_handler) ieee80211_ioctl_siwencode, /* SIOCSIWENCODE */ 665 - (iw_handler) ieee80211_ioctl_giwencode, /* SIOCGIWENCODE */ 934 + (iw_handler) cfg80211_wext_siwencode, /* SIOCSIWENCODE */ 935 + (iw_handler) cfg80211_wext_giwencode, /* SIOCGIWENCODE */ 666 936 (iw_handler) ieee80211_ioctl_siwpower, /* SIOCSIWPOWER */ 667 937 (iw_handler) ieee80211_ioctl_giwpower, /* SIOCGIWPOWER */ 668 938 (iw_handler) NULL, /* -- hole -- */ ··· 671 941 (iw_handler) NULL, /* SIOCGIWGENIE */ 672 942 (iw_handler) ieee80211_ioctl_siwauth, /* SIOCSIWAUTH */ 673 943 (iw_handler) ieee80211_ioctl_giwauth, /* SIOCGIWAUTH */ 674 - (iw_handler) ieee80211_ioctl_siwencodeext, /* SIOCSIWENCODEEXT */ 944 + (iw_handler) cfg80211_wext_siwencodeext, /* SIOCSIWENCODEEXT */ 675 945 (iw_handler) NULL, /* SIOCGIWENCODEEXT */ 676 946 (iw_handler) NULL, /* SIOCSIWPMKSA */ 677 947 (iw_handler) NULL, /* -- hole -- */
+1 -1
net/mac80211/wme.c
··· 133 133 u8 *p = ieee80211_get_qos_ctl(hdr); 134 134 u8 ack_policy = 0; 135 135 tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK; 136 - if (local->wifi_wme_noack_test) 136 + if (unlikely(local->wifi_wme_noack_test)) 137 137 ack_policy |= QOS_CONTROL_ACK_POLICY_NOACK << 138 138 QOS_CONTROL_ACK_POLICY_SHIFT; 139 139 /* qos header is 2 bytes, second reserved */
+7 -3
net/wireless/core.c
··· 1 1 /* 2 2 * This is the linux wireless configuration interface. 3 3 * 4 - * Copyright 2006-2008 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 5 5 */ 6 6 7 7 #include <linux/if.h> ··· 457 457 "symlink to netdev!\n"); 458 458 } 459 459 dev->ieee80211_ptr->netdev = dev; 460 + #ifdef CONFIG_WIRELESS_EXT 461 + dev->ieee80211_ptr->wext.default_key = -1; 462 + dev->ieee80211_ptr->wext.default_mgmt_key = -1; 463 + #endif 460 464 mutex_unlock(&rdev->devlist_mtx); 461 465 break; 462 466 case NETDEV_GOING_DOWN: ··· 474 470 #ifdef CONFIG_WIRELESS_EXT 475 471 if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) 476 472 break; 477 - if (!dev->ieee80211_ptr->wext.ssid_len) 473 + if (!dev->ieee80211_ptr->wext.ibss.ssid_len) 478 474 break; 479 - cfg80211_join_ibss(rdev, dev, &dev->ieee80211_ptr->wext); 475 + cfg80211_join_ibss(rdev, dev, &dev->ieee80211_ptr->wext.ibss); 480 476 break; 481 477 #endif 482 478 case NETDEV_UNREGISTER:
+5 -1
net/wireless/core.h
··· 1 1 /* 2 2 * Wireless configuration interface internals. 3 3 * 4 - * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 5 5 */ 6 6 #ifndef __NET_WIRELESS_CORE_H 7 7 #define __NET_WIRELESS_CORE_H ··· 150 150 void cfg80211_clear_ibss(struct net_device *dev, bool nowext); 151 151 int cfg80211_leave_ibss(struct cfg80211_registered_device *rdev, 152 152 struct net_device *dev, bool nowext); 153 + 154 + /* internal helpers */ 155 + int cfg80211_validate_key_settings(struct key_params *params, int key_idx, 156 + const u8 *mac_addr); 153 157 154 158 #endif /* __NET_WIRELESS_CORE_H */
+30 -30
net/wireless/ibss.c
··· 63 63 return -EALREADY; 64 64 65 65 #ifdef CONFIG_WIRELESS_EXT 66 - wdev->wext.channel = params->channel; 66 + wdev->wext.ibss.channel = params->channel; 67 67 #endif 68 68 err = rdev->ops->join_ibss(&rdev->wiphy, dev, params); 69 69 ··· 90 90 memset(wdev->bssid, 0, ETH_ALEN); 91 91 #ifdef CONFIG_WIRELESS_EXT 92 92 if (!nowext) 93 - wdev->wext.ssid_len = 0; 93 + wdev->wext.ibss.ssid_len = 0; 94 94 #endif 95 95 } 96 96 ··· 116 116 enum ieee80211_band band; 117 117 int i; 118 118 119 - if (!wdev->wext.beacon_interval) 120 - wdev->wext.beacon_interval = 100; 119 + if (!wdev->wext.ibss.beacon_interval) 120 + wdev->wext.ibss.beacon_interval = 100; 121 121 122 122 /* try to find an IBSS channel if none requested ... */ 123 - if (!wdev->wext.channel) { 123 + if (!wdev->wext.ibss.channel) { 124 124 for (band = 0; band < IEEE80211_NUM_BANDS; band++) { 125 125 struct ieee80211_supported_band *sband; 126 126 struct ieee80211_channel *chan; ··· 135 135 continue; 136 136 if (chan->flags & IEEE80211_CHAN_DISABLED) 137 137 continue; 138 - wdev->wext.channel = chan; 138 + wdev->wext.ibss.channel = chan; 139 139 break; 140 140 } 141 141 142 - if (wdev->wext.channel) 142 + if (wdev->wext.ibss.channel) 143 143 break; 144 144 } 145 145 146 - if (!wdev->wext.channel) 146 + if (!wdev->wext.ibss.channel) 147 147 return -EINVAL; 148 148 } 149 149 150 150 /* don't join -- SSID is not there */ 151 - if (!wdev->wext.ssid_len) 151 + if (!wdev->wext.ibss.ssid_len) 152 152 return 0; 153 153 154 154 if (!netif_running(wdev->netdev)) 155 155 return 0; 156 156 157 157 return cfg80211_join_ibss(wiphy_to_dev(wdev->wiphy), 158 - wdev->netdev, &wdev->wext); 158 + wdev->netdev, &wdev->wext.ibss); 159 159 } 160 160 161 161 int cfg80211_ibss_wext_siwfreq(struct net_device *dev, ··· 182 182 chan->flags & IEEE80211_CHAN_DISABLED)) 183 183 return -EINVAL; 184 184 185 - if (wdev->wext.channel == chan) 185 + if (wdev->wext.ibss.channel == chan) 186 186 return 0; 187 187 188 188 if (wdev->ssid_len) { ··· 193 193 } 194 194 195 195 if (chan) { 196 - wdev->wext.channel = chan; 197 - wdev->wext.channel_fixed = true; 196 + wdev->wext.ibss.channel = chan; 197 + wdev->wext.ibss.channel_fixed = true; 198 198 } else { 199 199 /* cfg80211_ibss_wext_join will pick one if needed */ 200 - wdev->wext.channel_fixed = false; 200 + wdev->wext.ibss.channel_fixed = false; 201 201 } 202 202 203 203 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev); ··· 218 218 219 219 if (wdev->current_bss) 220 220 chan = wdev->current_bss->channel; 221 - else if (wdev->wext.channel) 222 - chan = wdev->wext.channel; 221 + else if (wdev->wext.ibss.channel) 222 + chan = wdev->wext.ibss.channel; 223 223 224 224 if (chan) { 225 225 freq->m = chan->center_freq; ··· 259 259 if (len > 0 && ssid[len - 1] == '\0') 260 260 len--; 261 261 262 - wdev->wext.ssid = wdev->ssid; 263 - memcpy(wdev->wext.ssid, ssid, len); 264 - wdev->wext.ssid_len = len; 262 + wdev->wext.ibss.ssid = wdev->ssid; 263 + memcpy(wdev->wext.ibss.ssid, ssid, len); 264 + wdev->wext.ibss.ssid_len = len; 265 265 266 266 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev); 267 267 } ··· 284 284 data->flags = 1; 285 285 data->length = wdev->ssid_len; 286 286 memcpy(ssid, wdev->ssid, data->length); 287 - } else if (wdev->wext.ssid && wdev->wext.ssid_len) { 287 + } else if (wdev->wext.ibss.ssid && wdev->wext.ibss.ssid_len) { 288 288 data->flags = 1; 289 - data->length = wdev->wext.ssid_len; 290 - memcpy(ssid, wdev->wext.ssid, data->length); 289 + data->length = wdev->wext.ibss.ssid_len; 290 + memcpy(ssid, wdev->wext.ibss.ssid, data->length); 291 291 } 292 292 293 293 return 0; ··· 318 318 bssid = NULL; 319 319 320 320 /* both automatic */ 321 - if (!bssid && !wdev->wext.bssid) 321 + if (!bssid && !wdev->wext.ibss.bssid) 322 322 return 0; 323 323 324 324 /* fixed already - and no change */ 325 - if (wdev->wext.bssid && bssid && 326 - compare_ether_addr(bssid, wdev->wext.bssid) == 0) 325 + if (wdev->wext.ibss.bssid && bssid && 326 + compare_ether_addr(bssid, wdev->wext.ibss.bssid) == 0) 327 327 return 0; 328 328 329 329 if (wdev->ssid_len) { ··· 334 334 } 335 335 336 336 if (bssid) { 337 - memcpy(wdev->wext_bssid, bssid, ETH_ALEN); 338 - wdev->wext.bssid = wdev->wext_bssid; 337 + memcpy(wdev->wext.bssid, bssid, ETH_ALEN); 338 + wdev->wext.ibss.bssid = wdev->wext.bssid; 339 339 } else 340 - wdev->wext.bssid = NULL; 340 + wdev->wext.ibss.bssid = NULL; 341 341 342 342 return cfg80211_ibss_wext_join(wiphy_to_dev(wdev->wiphy), wdev); 343 343 } ··· 356 356 357 357 ap_addr->sa_family = ARPHRD_ETHER; 358 358 359 - if (wdev->wext.bssid) { 360 - memcpy(ap_addr->sa_data, wdev->wext.bssid, ETH_ALEN); 359 + if (wdev->wext.ibss.bssid) { 360 + memcpy(ap_addr->sa_data, wdev->wext.ibss.bssid, ETH_ALEN); 361 361 return 0; 362 362 } 363 363
+82 -46
net/wireless/nl80211.c
··· 1 1 /* 2 2 * This is the new netlink-based wireless configuration interface. 3 3 * 4 - * Copyright 2006, 2007 Johannes Berg <johannes@sipsolutions.net> 4 + * Copyright 2006-2009 Johannes Berg <johannes@sipsolutions.net> 5 5 */ 6 6 7 7 #include <linux/if.h> ··· 122 122 [NL80211_ATTR_REASON_CODE] = { .type = NLA_U16 }, 123 123 [NL80211_ATTR_FREQ_FIXED] = { .type = NLA_FLAG }, 124 124 [NL80211_ATTR_TIMED_OUT] = { .type = NLA_FLAG }, 125 + [NL80211_ATTR_USE_MFP] = { .type = NLA_U32 }, 126 + [NL80211_ATTR_STA_FLAGS2] = { 127 + .len = sizeof(struct nl80211_sta_flag_update), 128 + }, 129 + [NL80211_ATTR_CONTROL_PORT] = { .type = NLA_FLAG }, 125 130 }; 126 131 127 132 /* IE validation */ ··· 1077 1072 } 1078 1073 1079 1074 err = func(&drv->wiphy, dev, key_idx); 1075 + #ifdef CONFIG_WIRELESS_EXT 1076 + if (!err) { 1077 + if (func == drv->ops->set_default_key) 1078 + dev->ieee80211_ptr->wext.default_key = key_idx; 1079 + else 1080 + dev->ieee80211_ptr->wext.default_mgmt_key = key_idx; 1081 + } 1082 + #endif 1080 1083 1081 1084 out: 1082 1085 cfg80211_put_dev(drv); ··· 1115 1102 params.key_len = nla_len(info->attrs[NL80211_ATTR_KEY_DATA]); 1116 1103 } 1117 1104 1105 + if (info->attrs[NL80211_ATTR_KEY_SEQ]) { 1106 + params.seq = nla_data(info->attrs[NL80211_ATTR_KEY_SEQ]); 1107 + params.seq_len = nla_len(info->attrs[NL80211_ATTR_KEY_SEQ]); 1108 + } 1109 + 1118 1110 if (info->attrs[NL80211_ATTR_KEY_IDX]) 1119 1111 key_idx = nla_get_u8(info->attrs[NL80211_ATTR_KEY_IDX]); 1120 1112 ··· 1128 1110 if (info->attrs[NL80211_ATTR_MAC]) 1129 1111 mac_addr = nla_data(info->attrs[NL80211_ATTR_MAC]); 1130 1112 1131 - if (key_idx > 5) 1113 + if (cfg80211_validate_key_settings(&params, key_idx, mac_addr)) 1132 1114 return -EINVAL; 1133 - 1134 - /* 1135 - * Disallow pairwise keys with non-zero index unless it's WEP 1136 - * (because current deployments use pairwise WEP keys with 1137 - * non-zero indizes but 802.11i clearly specifies to use zero) 1138 - */ 1139 - if (mac_addr && key_idx && 1140 - params.cipher != WLAN_CIPHER_SUITE_WEP40 && 1141 - params.cipher != WLAN_CIPHER_SUITE_WEP104) 1142 - return -EINVAL; 1143 - 1144 - /* TODO: add definitions for the lengths to linux/ieee80211.h */ 1145 - switch (params.cipher) { 1146 - case WLAN_CIPHER_SUITE_WEP40: 1147 - if (params.key_len != 5) 1148 - return -EINVAL; 1149 - break; 1150 - case WLAN_CIPHER_SUITE_TKIP: 1151 - if (params.key_len != 32) 1152 - return -EINVAL; 1153 - break; 1154 - case WLAN_CIPHER_SUITE_CCMP: 1155 - if (params.key_len != 16) 1156 - return -EINVAL; 1157 - break; 1158 - case WLAN_CIPHER_SUITE_WEP104: 1159 - if (params.key_len != 13) 1160 - return -EINVAL; 1161 - break; 1162 - case WLAN_CIPHER_SUITE_AES_CMAC: 1163 - if (params.key_len != 16) 1164 - return -EINVAL; 1165 - break; 1166 - default: 1167 - return -EINVAL; 1168 - } 1169 1115 1170 1116 rtnl_lock(); 1171 1117 ··· 1190 1208 } 1191 1209 1192 1210 err = drv->ops->del_key(&drv->wiphy, dev, key_idx, mac_addr); 1211 + 1212 + #ifdef CONFIG_WIRELESS_EXT 1213 + if (!err) { 1214 + if (key_idx == dev->ieee80211_ptr->wext.default_key) 1215 + dev->ieee80211_ptr->wext.default_key = -1; 1216 + else if (key_idx == dev->ieee80211_ptr->wext.default_mgmt_key) 1217 + dev->ieee80211_ptr->wext.default_mgmt_key = -1; 1218 + } 1219 + #endif 1193 1220 1194 1221 out: 1195 1222 cfg80211_put_dev(drv); ··· 1340 1349 [NL80211_STA_FLAG_AUTHORIZED] = { .type = NLA_FLAG }, 1341 1350 [NL80211_STA_FLAG_SHORT_PREAMBLE] = { .type = NLA_FLAG }, 1342 1351 [NL80211_STA_FLAG_WME] = { .type = NLA_FLAG }, 1352 + [NL80211_STA_FLAG_MFP] = { .type = NLA_FLAG }, 1343 1353 }; 1344 1354 1345 - static int parse_station_flags(struct nlattr *nla, u32 *staflags) 1355 + static int parse_station_flags(struct genl_info *info, 1356 + struct station_parameters *params) 1346 1357 { 1347 1358 struct nlattr *flags[NL80211_STA_FLAG_MAX + 1]; 1359 + struct nlattr *nla; 1348 1360 int flag; 1349 1361 1350 - *staflags = 0; 1362 + /* 1363 + * Try parsing the new attribute first so userspace 1364 + * can specify both for older kernels. 1365 + */ 1366 + nla = info->attrs[NL80211_ATTR_STA_FLAGS2]; 1367 + if (nla) { 1368 + struct nl80211_sta_flag_update *sta_flags; 1351 1369 1370 + sta_flags = nla_data(nla); 1371 + params->sta_flags_mask = sta_flags->mask; 1372 + params->sta_flags_set = sta_flags->set; 1373 + if ((params->sta_flags_mask | 1374 + params->sta_flags_set) & BIT(__NL80211_STA_FLAG_INVALID)) 1375 + return -EINVAL; 1376 + return 0; 1377 + } 1378 + 1379 + /* if present, parse the old attribute */ 1380 + 1381 + nla = info->attrs[NL80211_ATTR_STA_FLAGS]; 1352 1382 if (!nla) 1353 1383 return 0; 1354 1384 ··· 1377 1365 nla, sta_flags_policy)) 1378 1366 return -EINVAL; 1379 1367 1380 - *staflags = STATION_FLAG_CHANGED; 1368 + params->sta_flags_mask = (1 << __NL80211_STA_FLAG_AFTER_LAST) - 1; 1369 + params->sta_flags_mask &= ~1; 1381 1370 1382 1371 for (flag = 1; flag <= NL80211_STA_FLAG_MAX; flag++) 1383 1372 if (flags[flag]) 1384 - *staflags |= (1<<flag); 1373 + params->sta_flags_set |= (1<<flag); 1385 1374 1386 1375 return 0; 1387 1376 } ··· 1678 1665 params.ht_capa = 1679 1666 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); 1680 1667 1681 - if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], 1682 - &params.station_flags)) 1668 + if (parse_station_flags(info, &params)) 1683 1669 return -EINVAL; 1684 1670 1685 1671 if (info->attrs[NL80211_ATTR_STA_PLINK_ACTION]) ··· 1747 1735 params.ht_capa = 1748 1736 nla_data(info->attrs[NL80211_ATTR_HT_CAPABILITY]); 1749 1737 1750 - if (parse_station_flags(info->attrs[NL80211_ATTR_STA_FLAGS], 1751 - &params.station_flags)) 1738 + if (parse_station_flags(info, &params)) 1752 1739 return -EINVAL; 1753 1740 1754 1741 rtnl_lock(); ··· 1755 1744 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); 1756 1745 if (err) 1757 1746 goto out_rtnl; 1747 + 1748 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 1749 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) { 1750 + err = -EINVAL; 1751 + goto out; 1752 + } 1758 1753 1759 1754 err = get_vlan(info->attrs[NL80211_ATTR_STA_VLAN], drv, &params.vlan); 1760 1755 if (err) ··· 1804 1787 err = get_drv_dev_by_info_ifindex(info->attrs, &drv, &dev); 1805 1788 if (err) 1806 1789 goto out_rtnl; 1790 + 1791 + if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP && 1792 + dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) { 1793 + err = -EINVAL; 1794 + goto out; 1795 + } 1807 1796 1808 1797 if (!drv->ops->del_station) { 1809 1798 err = -EOPNOTSUPP; ··· 3034 3011 req.ie = nla_data(info->attrs[NL80211_ATTR_IE]); 3035 3012 req.ie_len = nla_len(info->attrs[NL80211_ATTR_IE]); 3036 3013 } 3014 + 3015 + if (info->attrs[NL80211_ATTR_USE_MFP]) { 3016 + enum nl80211_mfp use_mfp = 3017 + nla_get_u32(info->attrs[NL80211_ATTR_USE_MFP]); 3018 + if (use_mfp == NL80211_MFP_REQUIRED) 3019 + req.use_mfp = true; 3020 + else if (use_mfp != NL80211_MFP_NO) { 3021 + err = -EINVAL; 3022 + goto out; 3023 + } 3024 + } 3025 + 3026 + req.control_port = info->attrs[NL80211_ATTR_CONTROL_PORT]; 3037 3027 3038 3028 err = drv->ops->assoc(&drv->wiphy, dev, &req); 3039 3029
+45
net/wireless/util.c
··· 138 138 if (wiphy->bands[band]) 139 139 set_mandatory_flags_band(wiphy->bands[band], band); 140 140 } 141 + 142 + int cfg80211_validate_key_settings(struct key_params *params, int key_idx, 143 + const u8 *mac_addr) 144 + { 145 + if (key_idx > 5) 146 + return -EINVAL; 147 + 148 + /* 149 + * Disallow pairwise keys with non-zero index unless it's WEP 150 + * (because current deployments use pairwise WEP keys with 151 + * non-zero indizes but 802.11i clearly specifies to use zero) 152 + */ 153 + if (mac_addr && key_idx && 154 + params->cipher != WLAN_CIPHER_SUITE_WEP40 && 155 + params->cipher != WLAN_CIPHER_SUITE_WEP104) 156 + return -EINVAL; 157 + 158 + /* TODO: add definitions for the lengths to linux/ieee80211.h */ 159 + switch (params->cipher) { 160 + case WLAN_CIPHER_SUITE_WEP40: 161 + if (params->key_len != 5) 162 + return -EINVAL; 163 + break; 164 + case WLAN_CIPHER_SUITE_TKIP: 165 + if (params->key_len != 32) 166 + return -EINVAL; 167 + break; 168 + case WLAN_CIPHER_SUITE_CCMP: 169 + if (params->key_len != 16) 170 + return -EINVAL; 171 + break; 172 + case WLAN_CIPHER_SUITE_WEP104: 173 + if (params->key_len != 13) 174 + return -EINVAL; 175 + break; 176 + case WLAN_CIPHER_SUITE_AES_CMAC: 177 + if (params->key_len != 16) 178 + return -EINVAL; 179 + break; 180 + default: 181 + return -EINVAL; 182 + } 183 + 184 + return 0; 185 + }
+279 -7
net/wireless/wext-compat.c
··· 5 5 * into cfg80211, when that happens all the exports here go away and 6 6 * we directly assign the wireless handlers of wireless interfaces. 7 7 * 8 - * Copyright 2008 Johannes Berg <johannes@sipsolutions.net> 8 + * Copyright 2008-2009 Johannes Berg <johannes@sipsolutions.net> 9 9 */ 10 10 11 11 #include <linux/wireless.h> 12 12 #include <linux/nl80211.h> 13 13 #include <linux/if_arp.h> 14 + #include <linux/etherdevice.h> 14 15 #include <net/iw_handler.h> 15 16 #include <net/cfg80211.h> 16 17 #include "core.h" ··· 297 296 struct ieee80211_channel *cfg80211_wext_freq(struct wiphy *wiphy, 298 297 struct iw_freq *freq) 299 298 { 299 + struct ieee80211_channel *chan; 300 + int f; 301 + 302 + /* 303 + * Parse frequency - return NULL for auto and 304 + * -EINVAL for impossible things. 305 + */ 300 306 if (freq->e == 0) { 301 307 if (freq->m < 0) 302 308 return NULL; 303 - else 304 - return ieee80211_get_channel(wiphy, 305 - ieee80211_channel_to_frequency(freq->m)); 309 + f = ieee80211_channel_to_frequency(freq->m); 306 310 } else { 307 311 int i, div = 1000000; 308 312 for (i = 0; i < freq->e; i++) 309 313 div /= 10; 310 - if (div > 0) 311 - return ieee80211_get_channel(wiphy, freq->m / div); 312 - else 314 + if (div <= 0) 313 315 return ERR_PTR(-EINVAL); 316 + f = freq->m / div; 314 317 } 315 318 319 + /* 320 + * Look up channel struct and return -EINVAL when 321 + * it cannot be found. 322 + */ 323 + chan = ieee80211_get_channel(wiphy, f); 324 + if (!chan) 325 + return ERR_PTR(-EINVAL); 326 + return chan; 316 327 } 317 328 EXPORT_SYMBOL_GPL(cfg80211_wext_freq); 318 329 ··· 478 465 return 0; 479 466 } 480 467 EXPORT_SYMBOL_GPL(cfg80211_wext_giwretry); 468 + 469 + static int cfg80211_set_encryption(struct cfg80211_registered_device *rdev, 470 + struct net_device *dev, const u8 *addr, 471 + bool remove, bool tx_key, int idx, 472 + struct key_params *params) 473 + { 474 + struct wireless_dev *wdev = dev->ieee80211_ptr; 475 + int err; 476 + 477 + if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC) { 478 + if (!rdev->ops->set_default_mgmt_key) 479 + return -EOPNOTSUPP; 480 + 481 + if (idx < 4 || idx > 5) 482 + return -EINVAL; 483 + } else if (idx < 0 || idx > 3) 484 + return -EINVAL; 485 + 486 + if (remove) { 487 + err = rdev->ops->del_key(&rdev->wiphy, dev, idx, addr); 488 + if (!err) { 489 + if (idx == wdev->wext.default_key) 490 + wdev->wext.default_key = -1; 491 + else if (idx == wdev->wext.default_mgmt_key) 492 + wdev->wext.default_mgmt_key = -1; 493 + } 494 + return err; 495 + } else { 496 + if (addr) 497 + tx_key = false; 498 + 499 + if (cfg80211_validate_key_settings(params, idx, addr)) 500 + return -EINVAL; 501 + 502 + err = rdev->ops->add_key(&rdev->wiphy, dev, idx, addr, params); 503 + if (err) 504 + return err; 505 + 506 + if (tx_key || (!addr && wdev->wext.default_key == -1)) { 507 + err = rdev->ops->set_default_key(&rdev->wiphy, 508 + dev, idx); 509 + if (!err) 510 + wdev->wext.default_key = idx; 511 + return err; 512 + } 513 + 514 + if (params->cipher == WLAN_CIPHER_SUITE_AES_CMAC && 515 + (tx_key || (!addr && wdev->wext.default_mgmt_key == -1))) { 516 + err = rdev->ops->set_default_mgmt_key(&rdev->wiphy, 517 + dev, idx); 518 + if (!err) 519 + wdev->wext.default_mgmt_key = idx; 520 + return err; 521 + } 522 + 523 + return 0; 524 + } 525 + } 526 + 527 + int cfg80211_wext_siwencode(struct net_device *dev, 528 + struct iw_request_info *info, 529 + struct iw_point *erq, char *keybuf) 530 + { 531 + struct wireless_dev *wdev = dev->ieee80211_ptr; 532 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 533 + int idx, err; 534 + bool remove = false; 535 + struct key_params params; 536 + 537 + /* no use -- only MFP (set_default_mgmt_key) is optional */ 538 + if (!rdev->ops->del_key || 539 + !rdev->ops->add_key || 540 + !rdev->ops->set_default_key) 541 + return -EOPNOTSUPP; 542 + 543 + idx = erq->flags & IW_ENCODE_INDEX; 544 + if (idx == 0) { 545 + idx = wdev->wext.default_key; 546 + if (idx < 0) 547 + idx = 0; 548 + } else if (idx < 1 || idx > 4) 549 + return -EINVAL; 550 + else 551 + idx--; 552 + 553 + if (erq->flags & IW_ENCODE_DISABLED) 554 + remove = true; 555 + else if (erq->length == 0) { 556 + /* No key data - just set the default TX key index */ 557 + err = rdev->ops->set_default_key(&rdev->wiphy, dev, idx); 558 + if (!err) 559 + wdev->wext.default_key = idx; 560 + return err; 561 + } 562 + 563 + memset(&params, 0, sizeof(params)); 564 + params.key = keybuf; 565 + params.key_len = erq->length; 566 + if (erq->length == 5) 567 + params.cipher = WLAN_CIPHER_SUITE_WEP40; 568 + else if (erq->length == 13) 569 + params.cipher = WLAN_CIPHER_SUITE_WEP104; 570 + else if (!remove) 571 + return -EINVAL; 572 + 573 + return cfg80211_set_encryption(rdev, dev, NULL, remove, 574 + wdev->wext.default_key == -1, 575 + idx, &params); 576 + } 577 + EXPORT_SYMBOL_GPL(cfg80211_wext_siwencode); 578 + 579 + int cfg80211_wext_siwencodeext(struct net_device *dev, 580 + struct iw_request_info *info, 581 + struct iw_point *erq, char *extra) 582 + { 583 + struct wireless_dev *wdev = dev->ieee80211_ptr; 584 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 585 + struct iw_encode_ext *ext = (struct iw_encode_ext *) extra; 586 + const u8 *addr; 587 + int idx; 588 + bool remove = false; 589 + struct key_params params; 590 + u32 cipher; 591 + 592 + /* no use -- only MFP (set_default_mgmt_key) is optional */ 593 + if (!rdev->ops->del_key || 594 + !rdev->ops->add_key || 595 + !rdev->ops->set_default_key) 596 + return -EOPNOTSUPP; 597 + 598 + switch (ext->alg) { 599 + case IW_ENCODE_ALG_NONE: 600 + remove = true; 601 + cipher = 0; 602 + break; 603 + case IW_ENCODE_ALG_WEP: 604 + if (ext->key_len == 5) 605 + cipher = WLAN_CIPHER_SUITE_WEP40; 606 + else if (ext->key_len == 13) 607 + cipher = WLAN_CIPHER_SUITE_WEP104; 608 + else 609 + return -EINVAL; 610 + break; 611 + case IW_ENCODE_ALG_TKIP: 612 + cipher = WLAN_CIPHER_SUITE_TKIP; 613 + break; 614 + case IW_ENCODE_ALG_CCMP: 615 + cipher = WLAN_CIPHER_SUITE_CCMP; 616 + break; 617 + case IW_ENCODE_ALG_AES_CMAC: 618 + cipher = WLAN_CIPHER_SUITE_AES_CMAC; 619 + break; 620 + default: 621 + return -EOPNOTSUPP; 622 + } 623 + 624 + if (erq->flags & IW_ENCODE_DISABLED) 625 + remove = true; 626 + 627 + idx = erq->flags & IW_ENCODE_INDEX; 628 + if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) { 629 + if (idx < 4 || idx > 5) { 630 + idx = wdev->wext.default_mgmt_key; 631 + if (idx < 0) 632 + return -EINVAL; 633 + } else 634 + idx--; 635 + } else { 636 + if (idx < 1 || idx > 4) { 637 + idx = wdev->wext.default_key; 638 + if (idx < 0) 639 + return -EINVAL; 640 + } else 641 + idx--; 642 + } 643 + 644 + addr = ext->addr.sa_data; 645 + if (is_broadcast_ether_addr(addr)) 646 + addr = NULL; 647 + 648 + memset(&params, 0, sizeof(params)); 649 + params.key = ext->key; 650 + params.key_len = ext->key_len; 651 + params.cipher = cipher; 652 + 653 + if (ext->ext_flags & IW_ENCODE_EXT_RX_SEQ_VALID) { 654 + params.seq = ext->rx_seq; 655 + params.seq_len = 6; 656 + } 657 + 658 + return cfg80211_set_encryption( 659 + rdev, dev, addr, remove, 660 + ext->ext_flags & IW_ENCODE_EXT_SET_TX_KEY, 661 + idx, &params); 662 + } 663 + EXPORT_SYMBOL_GPL(cfg80211_wext_siwencodeext); 664 + 665 + struct giwencode_cookie { 666 + size_t buflen; 667 + char *keybuf; 668 + }; 669 + 670 + static void giwencode_get_key_cb(void *cookie, struct key_params *params) 671 + { 672 + struct giwencode_cookie *data = cookie; 673 + 674 + if (!params->key) { 675 + data->buflen = 0; 676 + return; 677 + } 678 + 679 + data->buflen = min_t(size_t, data->buflen, params->key_len); 680 + memcpy(data->keybuf, params->key, data->buflen); 681 + } 682 + 683 + int cfg80211_wext_giwencode(struct net_device *dev, 684 + struct iw_request_info *info, 685 + struct iw_point *erq, char *keybuf) 686 + { 687 + struct wireless_dev *wdev = dev->ieee80211_ptr; 688 + struct cfg80211_registered_device *rdev = wiphy_to_dev(wdev->wiphy); 689 + int idx, err; 690 + struct giwencode_cookie data = { 691 + .keybuf = keybuf, 692 + .buflen = erq->length, 693 + }; 694 + 695 + if (!rdev->ops->get_key) 696 + return -EOPNOTSUPP; 697 + 698 + idx = erq->flags & IW_ENCODE_INDEX; 699 + if (idx == 0) { 700 + idx = wdev->wext.default_key; 701 + if (idx < 0) 702 + idx = 0; 703 + } else if (idx < 1 || idx > 4) 704 + return -EINVAL; 705 + else 706 + idx--; 707 + 708 + erq->flags = idx + 1; 709 + 710 + err = rdev->ops->get_key(&rdev->wiphy, dev, idx, NULL, &data, 711 + giwencode_get_key_cb); 712 + if (!err) { 713 + erq->length = data.buflen; 714 + erq->flags |= IW_ENCODE_ENABLED; 715 + return 0; 716 + } 717 + 718 + if (err == -ENOENT) { 719 + erq->flags |= IW_ENCODE_DISABLED; 720 + erq->length = 0; 721 + return 0; 722 + } 723 + 724 + return err; 725 + } 726 + EXPORT_SYMBOL_GPL(cfg80211_wext_giwencode);
+16 -4
net/wireless/wext.c
··· 649 649 return 0; 650 650 } 651 651 652 + static void *wireless_dev_seq_start(struct seq_file *seq, loff_t *pos) 653 + { 654 + rtnl_lock(); 655 + return dev_seq_start(seq, pos); 656 + } 657 + 658 + static void wireless_dev_seq_stop(struct seq_file *seq, void *v) 659 + { 660 + dev_seq_stop(seq, v); 661 + rtnl_unlock(); 662 + } 663 + 652 664 static const struct seq_operations wireless_seq_ops = { 653 - .start = dev_seq_start, 665 + .start = wireless_dev_seq_start, 654 666 .next = dev_seq_next, 655 - .stop = dev_seq_stop, 667 + .stop = wireless_dev_seq_stop, 656 668 .show = wireless_seq_show, 657 669 }; 658 670 659 - static int wireless_seq_open(struct inode *inode, struct file *file) 671 + static int seq_open_wireless(struct inode *inode, struct file *file) 660 672 { 661 673 return seq_open_net(inode, file, &wireless_seq_ops, 662 674 sizeof(struct seq_net_private)); ··· 676 664 677 665 static const struct file_operations wireless_seq_fops = { 678 666 .owner = THIS_MODULE, 679 - .open = wireless_seq_open, 667 + .open = seq_open_wireless, 680 668 .read = seq_read, 681 669 .llseek = seq_lseek, 682 670 .release = seq_release_net,