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

Merge remote-tracking branch 'iwlwifi-fixes/master' into next

+79 -55
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-7000.c
··· 69 69 #include "iwl-agn-hw.h" 70 70 71 71 /* Highest firmware API version supported */ 72 - #define IWL7260_UCODE_API_MAX 17 72 + #define IWL7260_UCODE_API_MAX 19 73 73 74 74 /* Oldest version we won't warn about */ 75 75 #define IWL7260_UCODE_API_OK 13
+1 -1
drivers/net/wireless/intel/iwlwifi/iwl-8000.c
··· 69 69 #include "iwl-agn-hw.h" 70 70 71 71 /* Highest firmware API version supported */ 72 - #define IWL8000_UCODE_API_MAX 17 72 + #define IWL8000_UCODE_API_MAX 19 73 73 74 74 /* Oldest version we won't warn about */ 75 75 #define IWL8000_UCODE_API_OK 13
+2 -6
drivers/net/wireless/intel/iwlwifi/mvm/d3.c
··· 309 309 * to transmit packets to the AP, i.e. the PTK. 310 310 */ 311 311 if (key->flags & IEEE80211_KEY_FLAG_PAIRWISE) { 312 - key->hw_key_idx = 0; 313 312 mvm->ptk_ivlen = key->iv_len; 314 313 mvm->ptk_icvlen = key->icv_len; 314 + ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 0); 315 315 } else { 316 316 /* 317 317 * firmware only supports TSC/RSC for a single key, ··· 319 319 * with new ones -- this relies on mac80211 doing 320 320 * list_add_tail(). 321 321 */ 322 - key->hw_key_idx = 1; 323 322 mvm->gtk_ivlen = key->iv_len; 324 323 mvm->gtk_icvlen = key->icv_len; 324 + ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 1); 325 325 } 326 326 327 - ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, true); 328 327 data->error = ret != 0; 329 328 out_unlock: 330 329 mutex_unlock(&mvm->mutex); ··· 770 771 * back to the runtime firmware image. 771 772 */ 772 773 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); 773 - 774 - /* We reprogram keys and shouldn't allocate new key indices */ 775 - memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); 776 774 777 775 mvm->ptk_ivlen = 0; 778 776 mvm->ptk_icvlen = 0;
+8 -3
drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
··· 2941 2941 { 2942 2942 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); 2943 2943 int ret; 2944 + u8 key_offset; 2944 2945 2945 2946 if (iwlwifi_mod_params.sw_crypto) { 2946 2947 IWL_DEBUG_MAC80211(mvm, "leave - hwcrypto disabled\n"); ··· 3007 3006 break; 3008 3007 } 3009 3008 3009 + /* in HW restart reuse the index, otherwise request a new one */ 3010 + if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) 3011 + key_offset = key->hw_key_idx; 3012 + else 3013 + key_offset = STA_KEY_IDX_INVALID; 3014 + 3010 3015 IWL_DEBUG_MAC80211(mvm, "set hwcrypto key\n"); 3011 - ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 3012 - test_bit(IWL_MVM_STATUS_IN_HW_RESTART, 3013 - &mvm->status)); 3016 + ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, key_offset); 3014 3017 if (ret) { 3015 3018 IWL_WARN(mvm, "set key failed\n"); 3016 3019 /*
+47 -41
drivers/net/wireless/intel/iwlwifi/mvm/sta.c
··· 1201 1201 return max_offs; 1202 1202 } 1203 1203 1204 - static u8 iwl_mvm_get_key_sta_id(struct ieee80211_vif *vif, 1204 + static u8 iwl_mvm_get_key_sta_id(struct iwl_mvm *mvm, 1205 + struct ieee80211_vif *vif, 1205 1206 struct ieee80211_sta *sta) 1206 1207 { 1207 1208 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif); ··· 1219 1218 * station ID, then use AP's station ID. 1220 1219 */ 1221 1220 if (vif->type == NL80211_IFTYPE_STATION && 1222 - mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) 1223 - return mvmvif->ap_sta_id; 1221 + mvmvif->ap_sta_id != IWL_MVM_STATION_COUNT) { 1222 + u8 sta_id = mvmvif->ap_sta_id; 1223 + 1224 + sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], 1225 + lockdep_is_held(&mvm->mutex)); 1226 + /* 1227 + * It is possible that the 'sta' parameter is NULL, 1228 + * for example when a GTK is removed - the sta_id will then 1229 + * be the AP ID, and no station was passed by mac80211. 1230 + */ 1231 + if (IS_ERR_OR_NULL(sta)) 1232 + return IWL_MVM_STATION_COUNT; 1233 + 1234 + return sta_id; 1235 + } 1224 1236 1225 1237 return IWL_MVM_STATION_COUNT; 1226 1238 } ··· 1241 1227 static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, 1242 1228 struct iwl_mvm_sta *mvm_sta, 1243 1229 struct ieee80211_key_conf *keyconf, bool mcast, 1244 - u32 tkip_iv32, u16 *tkip_p1k, u32 cmd_flags) 1230 + u32 tkip_iv32, u16 *tkip_p1k, u32 cmd_flags, 1231 + u8 key_offset) 1245 1232 { 1246 1233 struct iwl_mvm_add_sta_key_cmd cmd = {}; 1247 1234 __le16 key_flags; ··· 1284 1269 if (mcast) 1285 1270 key_flags |= cpu_to_le16(STA_KEY_MULTICAST); 1286 1271 1287 - cmd.key_offset = keyconf->hw_key_idx; 1272 + cmd.key_offset = key_offset; 1288 1273 cmd.key_flags = key_flags; 1289 1274 cmd.sta_id = sta_id; 1290 1275 ··· 1375 1360 struct ieee80211_vif *vif, 1376 1361 struct ieee80211_sta *sta, 1377 1362 struct ieee80211_key_conf *keyconf, 1363 + u8 key_offset, 1378 1364 bool mcast) 1379 1365 { 1380 1366 struct iwl_mvm_sta *mvm_sta = iwl_mvm_sta_from_mac80211(sta); ··· 1391 1375 ieee80211_get_key_rx_seq(keyconf, 0, &seq); 1392 1376 ieee80211_get_tkip_rx_p1k(keyconf, addr, seq.tkip.iv32, p1k); 1393 1377 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, 1394 - seq.tkip.iv32, p1k, 0); 1378 + seq.tkip.iv32, p1k, 0, key_offset); 1395 1379 break; 1396 1380 case WLAN_CIPHER_SUITE_CCMP: 1397 1381 case WLAN_CIPHER_SUITE_WEP40: 1398 1382 case WLAN_CIPHER_SUITE_WEP104: 1399 1383 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, 1400 - 0, NULL, 0); 1384 + 0, NULL, 0, key_offset); 1401 1385 break; 1402 1386 default: 1403 1387 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, 1404 - 0, NULL, 0); 1388 + 0, NULL, 0, key_offset); 1405 1389 } 1406 1390 1407 1391 return ret; ··· 1449 1433 struct ieee80211_vif *vif, 1450 1434 struct ieee80211_sta *sta, 1451 1435 struct ieee80211_key_conf *keyconf, 1452 - bool have_key_offset) 1436 + u8 key_offset) 1453 1437 { 1454 1438 bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); 1455 1439 u8 sta_id; ··· 1459 1443 lockdep_assert_held(&mvm->mutex); 1460 1444 1461 1445 /* Get the station id from the mvm local station table */ 1462 - sta_id = iwl_mvm_get_key_sta_id(vif, sta); 1446 + sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); 1463 1447 if (sta_id == IWL_MVM_STATION_COUNT) { 1464 1448 IWL_ERR(mvm, "Failed to find station id\n"); 1465 1449 return -EINVAL; ··· 1486 1470 if (WARN_ON_ONCE(iwl_mvm_sta_from_mac80211(sta)->vif != vif)) 1487 1471 return -EINVAL; 1488 1472 1489 - if (!have_key_offset) { 1490 - /* 1491 - * The D3 firmware hardcodes the PTK offset to 0, so we have to 1492 - * configure it there. As a result, this workaround exists to 1493 - * let the caller set the key offset (hw_key_idx), see d3.c. 1494 - */ 1495 - keyconf->hw_key_idx = iwl_mvm_set_fw_key_idx(mvm); 1496 - if (keyconf->hw_key_idx == STA_KEY_IDX_INVALID) 1473 + /* If the key_offset is not pre-assigned, we need to find a 1474 + * new offset to use. In normal cases, the offset is not 1475 + * pre-assigned, but during HW_RESTART we want to reuse the 1476 + * same indices, so we pass them when this function is called. 1477 + * 1478 + * In D3 entry, we need to hardcoded the indices (because the 1479 + * firmware hardcodes the PTK offset to 0). In this case, we 1480 + * need to make sure we don't overwrite the hw_key_idx in the 1481 + * keyconf structure, because otherwise we cannot configure 1482 + * the original ones back when resuming. 1483 + */ 1484 + if (key_offset == STA_KEY_IDX_INVALID) { 1485 + key_offset = iwl_mvm_set_fw_key_idx(mvm); 1486 + if (key_offset == STA_KEY_IDX_INVALID) 1497 1487 return -ENOSPC; 1488 + keyconf->hw_key_idx = key_offset; 1498 1489 } 1499 1490 1500 - ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, mcast); 1491 + ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, key_offset, mcast); 1501 1492 if (ret) { 1502 1493 __clear_bit(keyconf->hw_key_idx, mvm->fw_key_table); 1503 1494 goto end; ··· 1518 1495 */ 1519 1496 if (keyconf->cipher == WLAN_CIPHER_SUITE_WEP40 || 1520 1497 keyconf->cipher == WLAN_CIPHER_SUITE_WEP104) { 1521 - ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, !mcast); 1498 + ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, 1499 + key_offset, !mcast); 1522 1500 if (ret) { 1523 1501 __clear_bit(keyconf->hw_key_idx, mvm->fw_key_table); 1524 1502 __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast); ··· 1545 1521 lockdep_assert_held(&mvm->mutex); 1546 1522 1547 1523 /* Get the station id from the mvm local station table */ 1548 - sta_id = iwl_mvm_get_key_sta_id(vif, sta); 1524 + sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); 1549 1525 1550 1526 IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n", 1551 1527 keyconf->keyidx, sta_id); ··· 1571 1547 return 0; 1572 1548 } 1573 1549 1574 - /* 1575 - * It is possible that the 'sta' parameter is NULL, and thus 1576 - * there is a need to retrieve the sta from the local station table, 1577 - * for example when a GTK is removed (where the sta_id will then be 1578 - * the AP ID, and no station was passed by mac80211.) 1579 - */ 1580 - if (!sta) { 1581 - sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], 1582 - lockdep_is_held(&mvm->mutex)); 1583 - if (!sta) { 1584 - IWL_ERR(mvm, "Invalid station id\n"); 1585 - return -EINVAL; 1586 - } 1587 - } 1588 - 1589 - if (WARN_ON_ONCE(iwl_mvm_sta_from_mac80211(sta)->vif != vif)) 1590 - return -EINVAL; 1591 - 1592 1550 ret = __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast); 1593 1551 if (ret) 1594 1552 return ret; ··· 1590 1584 u16 *phase1key) 1591 1585 { 1592 1586 struct iwl_mvm_sta *mvm_sta; 1593 - u8 sta_id = iwl_mvm_get_key_sta_id(vif, sta); 1587 + u8 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); 1594 1588 bool mcast = !(keyconf->flags & IEEE80211_KEY_FLAG_PAIRWISE); 1595 1589 1596 1590 if (WARN_ON_ONCE(sta_id == IWL_MVM_STATION_COUNT)) ··· 1608 1602 1609 1603 mvm_sta = iwl_mvm_sta_from_mac80211(sta); 1610 1604 iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, 1611 - iv32, phase1key, CMD_ASYNC); 1605 + iv32, phase1key, CMD_ASYNC, keyconf->hw_key_idx); 1612 1606 rcu_read_unlock(); 1613 1607 } 1614 1608
+2 -2
drivers/net/wireless/intel/iwlwifi/mvm/sta.h
··· 365 365 int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, 366 366 struct ieee80211_vif *vif, 367 367 struct ieee80211_sta *sta, 368 - struct ieee80211_key_conf *key, 369 - bool have_key_offset); 368 + struct ieee80211_key_conf *keyconf, 369 + u8 key_offset); 370 370 int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, 371 371 struct ieee80211_vif *vif, 372 372 struct ieee80211_sta *sta,
+18 -1
drivers/net/wireless/intel/iwlwifi/pcie/drv.c
··· 423 423 /* 8000 Series */ 424 424 {IWL_PCI_DEVICE(0x24F3, 0x0010, iwl8260_2ac_cfg)}, 425 425 {IWL_PCI_DEVICE(0x24F3, 0x1010, iwl8260_2ac_cfg)}, 426 + {IWL_PCI_DEVICE(0x24F3, 0x0130, iwl8260_2ac_cfg)}, 427 + {IWL_PCI_DEVICE(0x24F3, 0x1130, iwl8260_2ac_cfg)}, 428 + {IWL_PCI_DEVICE(0x24F3, 0x0132, iwl8260_2ac_cfg)}, 429 + {IWL_PCI_DEVICE(0x24F3, 0x1132, iwl8260_2ac_cfg)}, 426 430 {IWL_PCI_DEVICE(0x24F3, 0x0110, iwl8260_2ac_cfg)}, 431 + {IWL_PCI_DEVICE(0x24F3, 0x01F0, iwl8260_2ac_cfg)}, 432 + {IWL_PCI_DEVICE(0x24F3, 0x0012, iwl8260_2ac_cfg)}, 433 + {IWL_PCI_DEVICE(0x24F3, 0x1012, iwl8260_2ac_cfg)}, 427 434 {IWL_PCI_DEVICE(0x24F3, 0x1110, iwl8260_2ac_cfg)}, 428 435 {IWL_PCI_DEVICE(0x24F3, 0x0050, iwl8260_2ac_cfg)}, 429 436 {IWL_PCI_DEVICE(0x24F3, 0x0250, iwl8260_2ac_cfg)}, 430 437 {IWL_PCI_DEVICE(0x24F3, 0x1050, iwl8260_2ac_cfg)}, 431 438 {IWL_PCI_DEVICE(0x24F3, 0x0150, iwl8260_2ac_cfg)}, 439 + {IWL_PCI_DEVICE(0x24F3, 0x1150, iwl8260_2ac_cfg)}, 432 440 {IWL_PCI_DEVICE(0x24F4, 0x0030, iwl8260_2ac_cfg)}, 433 - {IWL_PCI_DEVICE(0x24F4, 0x1130, iwl8260_2ac_cfg)}, 434 441 {IWL_PCI_DEVICE(0x24F4, 0x1030, iwl8260_2ac_cfg)}, 435 442 {IWL_PCI_DEVICE(0x24F3, 0xC010, iwl8260_2ac_cfg)}, 436 443 {IWL_PCI_DEVICE(0x24F3, 0xC110, iwl8260_2ac_cfg)}, ··· 445 438 {IWL_PCI_DEVICE(0x24F3, 0xC050, iwl8260_2ac_cfg)}, 446 439 {IWL_PCI_DEVICE(0x24F3, 0xD050, iwl8260_2ac_cfg)}, 447 440 {IWL_PCI_DEVICE(0x24F3, 0x8010, iwl8260_2ac_cfg)}, 441 + {IWL_PCI_DEVICE(0x24F3, 0x8110, iwl8260_2ac_cfg)}, 448 442 {IWL_PCI_DEVICE(0x24F3, 0x9010, iwl8260_2ac_cfg)}, 443 + {IWL_PCI_DEVICE(0x24F3, 0x9110, iwl8260_2ac_cfg)}, 449 444 {IWL_PCI_DEVICE(0x24F4, 0x8030, iwl8260_2ac_cfg)}, 450 445 {IWL_PCI_DEVICE(0x24F4, 0x9030, iwl8260_2ac_cfg)}, 446 + {IWL_PCI_DEVICE(0x24F3, 0x8130, iwl8260_2ac_cfg)}, 447 + {IWL_PCI_DEVICE(0x24F3, 0x9130, iwl8260_2ac_cfg)}, 448 + {IWL_PCI_DEVICE(0x24F3, 0x8132, iwl8260_2ac_cfg)}, 449 + {IWL_PCI_DEVICE(0x24F3, 0x9132, iwl8260_2ac_cfg)}, 451 450 {IWL_PCI_DEVICE(0x24F3, 0x8050, iwl8260_2ac_cfg)}, 451 + {IWL_PCI_DEVICE(0x24F3, 0x8150, iwl8260_2ac_cfg)}, 452 452 {IWL_PCI_DEVICE(0x24F3, 0x9050, iwl8260_2ac_cfg)}, 453 + {IWL_PCI_DEVICE(0x24F3, 0x9150, iwl8260_2ac_cfg)}, 453 454 {IWL_PCI_DEVICE(0x24F3, 0x0004, iwl8260_2n_cfg)}, 455 + {IWL_PCI_DEVICE(0x24F3, 0x0044, iwl8260_2n_cfg)}, 454 456 {IWL_PCI_DEVICE(0x24F5, 0x0010, iwl4165_2ac_cfg)}, 455 457 {IWL_PCI_DEVICE(0x24F6, 0x0030, iwl4165_2ac_cfg)}, 456 458 {IWL_PCI_DEVICE(0x24F3, 0x0810, iwl8260_2ac_cfg)}, 457 459 {IWL_PCI_DEVICE(0x24F3, 0x0910, iwl8260_2ac_cfg)}, 458 460 {IWL_PCI_DEVICE(0x24F3, 0x0850, iwl8260_2ac_cfg)}, 459 461 {IWL_PCI_DEVICE(0x24F3, 0x0950, iwl8260_2ac_cfg)}, 462 + {IWL_PCI_DEVICE(0x24F3, 0x0930, iwl8260_2ac_cfg)}, 460 463 #endif /* CONFIG_IWLMVM */ 461 464 462 465 {0}