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

Merge branch 'for-linville' of git://github.com/lucacoelho/wl12xx

+158 -24
+16
drivers/net/wireless/wl12xx/acx.c
··· 777 777 acx->rate_policy.long_retry_limit = c->long_retry_limit; 778 778 acx->rate_policy.aflags = c->aflags; 779 779 780 + ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); 781 + if (ret < 0) { 782 + wl1271_warning("Setting of rate policies failed: %d", ret); 783 + goto out; 784 + } 780 785 786 + /* 787 + * configure one rate class for basic p2p operations. 788 + * (p2p packets should always go out with OFDM rates, even 789 + * if we are currently connected to 11b AP) 790 + */ 791 + acx->rate_policy_idx = cpu_to_le32(ACX_TX_BASIC_RATE_P2P); 792 + acx->rate_policy.enabled_rates = 793 + cpu_to_le32(CONF_TX_RATE_MASK_BASIC_P2P); 794 + acx->rate_policy.short_retry_limit = c->short_retry_limit; 795 + acx->rate_policy.long_retry_limit = c->long_retry_limit; 796 + acx->rate_policy.aflags = c->aflags; 781 797 782 798 ret = wl1271_cmd_configure(wl, ACX_RATE_POLICY, acx, sizeof(*acx)); 783 799 if (ret < 0) {
+1
drivers/net/wireless/wl12xx/acx.h
··· 656 656 657 657 #define ACX_TX_BASIC_RATE 0 658 658 #define ACX_TX_AP_FULL_RATE 1 659 + #define ACX_TX_BASIC_RATE_P2P 2 659 660 #define ACX_TX_AP_MODE_MGMT_RATE 4 660 661 #define ACX_TX_AP_MODE_BCST_RATE 5 661 662 struct acx_rate_policy {
+2 -4
drivers/net/wireless/wl12xx/boot.c
··· 503 503 BA_SESSION_RX_CONSTRAINT_EVENT_ID | 504 504 REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID | 505 505 INACTIVE_STA_EVENT_ID | 506 - MAX_TX_RETRY_EVENT_ID; 506 + MAX_TX_RETRY_EVENT_ID | 507 + CHANNEL_SWITCH_COMPLETE_EVENT_ID; 507 508 508 509 ret = wl1271_event_unmask(wl); 509 510 if (ret < 0) { ··· 769 768 } else { 770 769 clk |= (wl->ref_clock << 1) << 4; 771 770 } 772 - 773 - if (wl->quirks & WL12XX_QUIRK_LPD_MODE) 774 - clk |= SCRATCH_ENABLE_LPD; 775 771 776 772 wl1271_write32(wl, DRPW_SCRATCH_START, clk); 777 773
+58 -5
drivers/net/wireless/wl12xx/cmd.c
··· 134 134 /* Override the REF CLK from the NVS with the one from platform data */ 135 135 gen_parms->general_params.ref_clock = wl->ref_clock; 136 136 137 - /* LPD mode enable (bits 6-7) in WL1271 AP mode only */ 138 - if (wl->quirks & WL12XX_QUIRK_LPD_MODE) 139 - gen_parms->general_params.general_settings |= 140 - GENERAL_SETTINGS_DRPW_LPD; 141 - 142 137 ret = wl1271_cmd_test(wl, gen_parms, sizeof(*gen_parms), answer); 143 138 if (ret < 0) { 144 139 wl1271_warning("CMD_INI_FILE_GENERAL_PARAM failed"); ··· 1692 1697 goto out; 1693 1698 1694 1699 __clear_bit(role_id, wl->roc_map); 1700 + out: 1701 + return ret; 1702 + } 1703 + 1704 + int wl12xx_cmd_channel_switch(struct wl1271 *wl, 1705 + struct ieee80211_channel_switch *ch_switch) 1706 + { 1707 + struct wl12xx_cmd_channel_switch *cmd; 1708 + int ret; 1709 + 1710 + wl1271_debug(DEBUG_ACX, "cmd channel switch"); 1711 + 1712 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 1713 + if (!cmd) { 1714 + ret = -ENOMEM; 1715 + goto out; 1716 + } 1717 + 1718 + cmd->channel = ch_switch->channel->hw_value; 1719 + cmd->switch_time = ch_switch->count; 1720 + cmd->tx_suspend = ch_switch->block_tx; 1721 + cmd->flush = 0; /* this value is ignored by the FW */ 1722 + 1723 + ret = wl1271_cmd_send(wl, CMD_CHANNEL_SWITCH, cmd, sizeof(*cmd), 0); 1724 + if (ret < 0) { 1725 + wl1271_error("failed to send channel switch command"); 1726 + goto out_free; 1727 + } 1728 + 1729 + out_free: 1730 + kfree(cmd); 1731 + 1732 + out: 1733 + return ret; 1734 + } 1735 + 1736 + int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl) 1737 + { 1738 + struct wl12xx_cmd_stop_channel_switch *cmd; 1739 + int ret; 1740 + 1741 + wl1271_debug(DEBUG_ACX, "cmd stop channel switch"); 1742 + 1743 + cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); 1744 + if (!cmd) { 1745 + ret = -ENOMEM; 1746 + goto out; 1747 + } 1748 + 1749 + ret = wl1271_cmd_send(wl, CMD_STOP_CHANNEL_SWICTH, cmd, sizeof(*cmd), 0); 1750 + if (ret < 0) { 1751 + wl1271_error("failed to stop channel switch command"); 1752 + goto out_free; 1753 + } 1754 + 1755 + out_free: 1756 + kfree(cmd); 1757 + 1695 1758 out: 1696 1759 return ret; 1697 1760 }
+20
drivers/net/wireless/wl12xx/cmd.h
··· 79 79 int wl12xx_cmd_config_fwlog(struct wl1271 *wl); 80 80 int wl12xx_cmd_start_fwlog(struct wl1271 *wl); 81 81 int wl12xx_cmd_stop_fwlog(struct wl1271 *wl); 82 + int wl12xx_cmd_channel_switch(struct wl1271 *wl, 83 + struct ieee80211_channel_switch *ch_switch); 84 + int wl12xx_cmd_stop_channel_switch(struct wl1271 *wl); 82 85 83 86 enum wl1271_commands { 84 87 CMD_INTERROGATE = 1, /*use this to read information elements*/ ··· 677 674 } __packed; 678 675 679 676 struct wl12xx_cmd_stop_fwlog { 677 + struct wl1271_cmd_header header; 678 + } __packed; 679 + 680 + struct wl12xx_cmd_channel_switch { 681 + struct wl1271_cmd_header header; 682 + 683 + /* The new serving channel */ 684 + u8 channel; 685 + /* Relative time of the serving channel switch in TBTT units */ 686 + u8 switch_time; 687 + /* 1: Suspend TX till switch time; 0: Do not suspend TX */ 688 + u8 tx_suspend; 689 + /* 1: Flush TX at switch time; 0: Do not flush */ 690 + u8 flush; 691 + } __packed; 692 + 693 + struct wl12xx_cmd_stop_channel_switch { 680 694 struct wl1271_cmd_header header; 681 695 } __packed; 682 696
+5 -1
drivers/net/wireless/wl12xx/conf.h
··· 416 416 u8 queue_type; 417 417 }; 418 418 419 - #define CONF_TX_MAX_RATE_CLASSES 8 419 + #define CONF_TX_MAX_RATE_CLASSES 10 420 420 421 421 #define CONF_TX_RATE_MASK_UNSPECIFIED 0 422 422 #define CONF_TX_RATE_MASK_BASIC (CONF_HW_BIT_RATE_1MBPS | \ 423 423 CONF_HW_BIT_RATE_2MBPS) 424 424 #define CONF_TX_RATE_RETRY_LIMIT 10 425 + 426 + /* basic rates for p2p operations (probe req/resp, etc.) */ 427 + #define CONF_TX_RATE_MASK_BASIC_P2P (CONF_HW_BIT_RATE_6MBPS | \ 428 + CONF_HW_BIT_RATE_12MBPS | CONF_HW_BIT_RATE_24MBPS) 425 429 426 430 /* 427 431 * Rates supported for data packets when operating as AP. Note the absence
+15
drivers/net/wireless/wl12xx/event.c
··· 300 300 wl1271_stop_ba_event(wl); 301 301 } 302 302 303 + if ((vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID) && !is_ap) { 304 + wl1271_debug(DEBUG_EVENT, "CHANNEL_SWITCH_COMPLETE_EVENT_ID. " 305 + "status = 0x%x", 306 + mbox->channel_switch_status); 307 + /* 308 + * That event uses for two cases: 309 + * 1) channel switch complete with status=0 310 + * 2) channel switch failed status=1 311 + */ 312 + if (test_and_clear_bit(WL1271_FLAG_CS_PROGRESS, &wl->flags) && 313 + (wl->vif)) 314 + ieee80211_chswitch_done(wl->vif, 315 + mbox->channel_switch_status ? false : true); 316 + } 317 + 303 318 if ((vector & DUMMY_PACKET_EVENT_ID)) { 304 319 wl1271_debug(DEBUG_EVENT, "DUMMY_PACKET_ID_EVENT_ID"); 305 320 if (wl->vif)
+40 -8
drivers/net/wireless/wl12xx/main.c
··· 1333 1333 wl1271_debug(DEBUG_BOOT, "chip id 0x%x (1271 PG20)", 1334 1334 wl->chip.id); 1335 1335 1336 - /* 1337 - * 'end-of-transaction flag' and 'LPD mode flag' 1338 - * should be set in wl127x AP mode only 1339 - */ 1340 - if (wl->bss_type == BSS_TYPE_AP_BSS) 1341 - wl->quirks |= (WL12XX_QUIRK_END_OF_TRANSACTION | 1342 - WL12XX_QUIRK_LPD_MODE); 1343 - 1344 1336 ret = wl1271_setup(wl); 1345 1337 if (ret < 0) 1346 1338 goto out; ··· 2213 2221 static int wl1271_unjoin(struct wl1271 *wl) 2214 2222 { 2215 2223 int ret; 2224 + 2225 + if (test_and_clear_bit(WL1271_FLAG_CS_PROGRESS, &wl->flags)) { 2226 + wl12xx_cmd_stop_channel_switch(wl); 2227 + ieee80211_chswitch_done(wl->vif, false); 2228 + } 2216 2229 2217 2230 /* to stop listening to a channel, we disconnect */ 2218 2231 ret = wl12xx_cmd_role_stop_sta(wl); ··· 4127 4130 return 0; 4128 4131 } 4129 4132 4133 + static void wl12xx_op_channel_switch(struct ieee80211_hw *hw, 4134 + struct ieee80211_channel_switch *ch_switch) 4135 + { 4136 + struct wl1271 *wl = hw->priv; 4137 + int ret; 4138 + 4139 + wl1271_debug(DEBUG_MAC80211, "mac80211 channel switch"); 4140 + 4141 + mutex_lock(&wl->mutex); 4142 + 4143 + if (unlikely(wl->state == WL1271_STATE_OFF)) { 4144 + mutex_unlock(&wl->mutex); 4145 + ieee80211_chswitch_done(wl->vif, false); 4146 + return; 4147 + } 4148 + 4149 + ret = wl1271_ps_elp_wakeup(wl); 4150 + if (ret < 0) 4151 + goto out; 4152 + 4153 + ret = wl12xx_cmd_channel_switch(wl, ch_switch); 4154 + 4155 + if (!ret) 4156 + set_bit(WL1271_FLAG_CS_PROGRESS, &wl->flags); 4157 + 4158 + wl1271_ps_elp_sleep(wl); 4159 + 4160 + out: 4161 + mutex_unlock(&wl->mutex); 4162 + } 4163 + 4130 4164 static bool wl1271_tx_frames_pending(struct ieee80211_hw *hw) 4131 4165 { 4132 4166 struct wl1271 *wl = hw->priv; ··· 4434 4406 .ampdu_action = wl1271_op_ampdu_action, 4435 4407 .tx_frames_pending = wl1271_tx_frames_pending, 4436 4408 .set_bitrate_mask = wl12xx_set_bitrate_mask, 4409 + .channel_switch = wl12xx_op_channel_switch, 4437 4410 CFG80211_TESTMODE_CMD(wl1271_tm_cmd) 4438 4411 }; 4439 4412 ··· 4707 4678 */ 4708 4679 wl->hw->wiphy->max_scan_ie_len = WL1271_CMD_TEMPL_DFLT_SIZE - 4709 4680 sizeof(struct ieee80211_header); 4681 + 4682 + wl->hw->wiphy->max_sched_scan_ie_len = WL1271_CMD_TEMPL_DFLT_SIZE - 4683 + sizeof(struct ieee80211_header); 4710 4684 4711 4685 wl->hw->wiphy->flags |= WIPHY_FLAG_AP_UAPSD; 4712 4686
+1 -6
drivers/net/wireless/wl12xx/wl12xx.h
··· 348 348 WL1271_FLAG_SOFT_GEMINI, 349 349 WL1271_FLAG_RX_STREAMING_STARTED, 350 350 WL1271_FLAG_RECOVERY_IN_PROGRESS, 351 + WL1271_FLAG_CS_PROGRESS, 351 352 }; 352 353 353 354 struct wl1271_link { ··· 671 670 672 671 /* WL128X requires aggregated packets to be aligned to the SDIO block size */ 673 672 #define WL12XX_QUIRK_BLOCKSIZE_ALIGNMENT BIT(2) 674 - 675 - /* 676 - * WL127X AP mode requires Low Power DRPw (LPD) enable to reduce power 677 - * consumption 678 - */ 679 - #define WL12XX_QUIRK_LPD_MODE BIT(3) 680 673 681 674 /* Older firmwares did not implement the FW logger over bus feature */ 682 675 #define WL12XX_QUIRK_FWLOG_NOT_IMPLEMENTED BIT(4)