From patchwork Sat Feb 28 08:43:05 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rajkumar Manoharan X-Patchwork-Id: 444584 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) by ozlabs.org (Postfix) with ESMTP id 53F8E140119 for ; Sat, 28 Feb 2015 19:43:45 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=fail reason="verification failed; unprotected key" header.d=qti.qualcomm.com header.i=@qti.qualcomm.com header.b=ysSRhfZW; dkim-adsp=none (unprotected policy); dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id AF8D79D250; Sat, 28 Feb 2015 03:43:42 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 2hh+xh2h2jKE; Sat, 28 Feb 2015 03:43:42 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 793A59D257; Sat, 28 Feb 2015 03:43:38 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id A019417C02D for ; Sat, 28 Feb 2015 03:43:36 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id hvFB-Vpyv+d9 for ; Sat, 28 Feb 2015 03:43:32 -0500 (EST) Received: from wolverine02.qualcomm.com (wolverine02.qualcomm.com [199.106.114.251]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "smtprelay.qualcomm.com", Issuer "GlobalSign Organization Validation CA - SHA256 - G2" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 551E09D250 for ; Sat, 28 Feb 2015 03:43:32 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=qti.qualcomm.com; i=@qti.qualcomm.com; q=dns/txt; s=qcdkim; t=1425113012; x=1456649012; h=from:to:cc:subject:date:message-id:mime-version; bh=HKhQUqZ2/Zek4Jk5J5mtq8LJjCoJnxbXrh7yGe990gQ=; b=ysSRhfZWveZZjFDIbmjFWr4V04AGTbmskGpD6ntyri3MNjRI3yAfhh0r C4rW6c45w9D0FjtT5RzmMu3HcQO9uvhxfjcbwkPx7fh6gE8i0xCgKPl2B k+ODhKvQUruC0mROhHHNhMn82dO9IdwucaLoiC4aXfOM7+ZGY247KwJny Q=; X-IronPort-AV: E=McAfee;i="5600,1067,7725"; a="197639961" Received: from ironmsg04-l.qualcomm.com ([172.30.48.19]) by wolverine02.qualcomm.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 28 Feb 2015 00:43:31 -0800 X-IronPort-AV: E=Sophos;i="5.09,666,1418112000"; d="scan'208";a="824972462" Received: from nasanexm02b.na.qualcomm.com ([10.85.0.42]) by Ironmsg04-L.qualcomm.com with ESMTP/TLS/RC4-SHA; 28 Feb 2015 00:43:31 -0800 Received: from aphydexm01b.ap.qualcomm.com (10.252.127.11) by nasanexm02b.na.qualcomm.com (10.85.0.42) with Microsoft SMTP Server (TLS) id 15.0.995.29; Sat, 28 Feb 2015 00:43:30 -0800 Received: from qcmail1.qualcomm.com (10.80.80.8) by aphydexm01b.ap.qualcomm.com (10.252.127.11) with Microsoft SMTP Server (TLS) id 15.0.995.29; Sat, 28 Feb 2015 00:43:21 -0800 Received: by qcmail1.qualcomm.com (sSMTP sendmail emulation); Sat, 28 Feb 2015 14:13:12 +0530 From: Rajkumar Manoharan To: Subject: [PATCH v2] hostapd: Disable VHT caps for STAs when no valid VHT MCS found Date: Sat, 28 Feb 2015 14:13:05 +0530 Message-ID: <1425112985-8701-1-git-send-email-rmanohar@qti.qualcomm.com> X-Mailer: git-send-email 2.3.1 MIME-Version: 1.0 X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: NASANEXM01E.na.qualcomm.com (10.85.0.31) To aphydexm01b.ap.qualcomm.com (10.252.127.11) Cc: hostap@lists.shmoo.com X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.11 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Disable VHT caps for STAs for which there is not even a single allowed MCS in any supported number of streams. i.e STA is advertising 3 (not supported) as VHT MCS rates for all supported streams. Signed-off-by: Rajkumar Manoharan --- src/ap/ieee802_11_vht.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/ap/ieee802_11_vht.c b/src/ap/ieee802_11_vht.c index 159693f..60c9ee1 100644 --- a/src/ap/ieee802_11_vht.c +++ b/src/ap/ieee802_11_vht.c @@ -93,6 +93,11 @@ u8 * hostapd_eid_vht_operation(struct hostapd_data *hapd, u8 *eid) u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta, const u8 *vht_capab, size_t vht_capab_len) { + struct hostapd_hw_modes *mode = hapd->iface->current_mode; + struct ieee80211_vht_capabilities *vht_cap, ap_vht_cap; + u16 sta_rx_mcs_set, ap_tx_mcs_set; + int i, valid_mcs = 0; + /* Disable VHT caps for STAs associated to no-VHT BSSes. */ if (!vht_capab || vht_capab_len < sizeof(struct ieee80211_vht_capabilities) || @@ -103,6 +108,36 @@ u16 copy_sta_vht_capab(struct hostapd_data *hapd, struct sta_info *sta, return WLAN_STATUS_SUCCESS; } + /* Disable VHT caps for STAs for which there is not even a single + * allowed MCS in any supported number of streams. i.e STA is + * advertising 3 (not supported) as VHT MCS rates for all supported + * stream cases. + */ + memcpy(&ap_vht_cap.vht_supported_mcs_set, mode->vht_mcs_set, + sizeof(ap_vht_cap.vht_supported_mcs_set)); + vht_cap = (struct ieee80211_vht_capabilities *)vht_capab; + + /* AP Tx MCS map vs STA Rx MCS map */ + sta_rx_mcs_set = le_to_host16(vht_cap->vht_supported_mcs_set.rx_map); + ap_tx_mcs_set = le_to_host16(ap_vht_cap.vht_supported_mcs_set.tx_map); + + for (i = 0; i < VHT_RX_NSS_MAX_STREAMS; i++) { + if ((ap_tx_mcs_set & (0x3 << (i * 2))) == 3) + continue; + + if ((sta_rx_mcs_set & (0x3 << (i * 2))) == 3) + continue; + + valid_mcs = 1; + } + + if (!valid_mcs) { + sta->flags &= ~WLAN_STA_VHT; + os_free(sta->vht_capabilities); + sta->vht_capabilities = NULL; + return WLAN_STATUS_SUCCESS; + } + if (sta->vht_capabilities == NULL) { sta->vht_capabilities = os_zalloc(sizeof(struct ieee80211_vht_capabilities));