From patchwork Thu Aug 3 09:06:55 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9878495 X-Patchwork-Delegate: kvalo@adurom.com Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id B05226037D for ; Thu, 3 Aug 2017 09:07:10 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 99259287B8 for ; Thu, 3 Aug 2017 09:07:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8D5C628882; Thu, 3 Aug 2017 09:07:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_SORBS_SPAM autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EB3AA287B8 for ; Thu, 3 Aug 2017 09:07:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751236AbdHCJHI (ORCPT ); Thu, 3 Aug 2017 05:07:08 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:35424 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751162AbdHCJHG (ORCPT ); Thu, 3 Aug 2017 05:07:06 -0400 Received: by mail-pg0-f68.google.com with SMTP id l64so947654pge.2 for ; Thu, 03 Aug 2017 02:07:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=v69DeR4pPvLnkOew1hdLph54El/hobNBju5ASsrU7I4=; b=WguSxoWwKSZCBLk3evBLGFVcT1aWea1EkqWuCPmFUMRou7yih+2wKNSsm1Nqw3rF8/ +7x09/O7iJx2bTR45P7ZwqTVEnpyEUEMo6OywW0Wo2SW1n+Z5NUjKUa/F9vCCPCoslNA LbR4zEZYkMkWdw0wCvBJVf/PRTnSAx2RwooFRyL0Lvh7ViDJSKTnwjne6MB8rFMAkIdt Rmb+DiewtHSbF/OObcjD/khPQY0fG5D8bOxXrUzIwcRAcFoaR0BGDTeHClvwwB2tlbPd LysceR8ZVFSqsmMh0LWU3jbB7+EI9Sz3CyHEQyAGtgCzjf+QrfnS0d1VOvSKDuigbYZK cqyw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=v69DeR4pPvLnkOew1hdLph54El/hobNBju5ASsrU7I4=; b=tb67hXJkwvmwRpodZ3CYEK0bCpIQokV8g9S4lXZcdR0goXd7BolcS7GmVEdEvQIOoy JG8EbZcJn3Wn1kcKSKjlia1A8Au4RHP0+lE271frrxTOVt+ioZcg69Ln6EOkNIe6Vwnl V1CV8itUW88HXBnX5hejIyvnCzFFJVgssAlLoOIL4AupjgJzpD+YrIVm/k3x+ZkSpDoa 2xHbBwLSoM+fZ9sR/BQwqJghIV2tRbFUU2t0hgZRnsgC40abOztQxpB86Nnq5008ZHqj wOpO+PtoekUdXvkgmxj2UPEnki5rgSpae5iu5nTBerkB3RaEedEVxU1B3mknlBmwSW4F hoFQ== X-Gm-Message-State: AIVw112Rn2jXWLGZWfi26G8acjw1T6EjBAAksQz0FSae3YNCz6Wuls2W tTo9WtSovOCQ4wHk X-Received: by 10.98.78.73 with SMTP id c70mr950639pfb.17.1501751225498; Thu, 03 Aug 2017 02:07:05 -0700 (PDT) Received: from ubuntu.members.linode.com ([2400:8902::f03c:91ff:fee7:7cf1]) by smtp.gmail.com with ESMTPSA id e131sm31931465pfc.93.2017.08.03.02.07.02 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Aug 2017 02:07:04 -0700 (PDT) From: Xinming Hu To: Linux Wireless Cc: Kalle Valo , Brian Norris , Dmitry Torokhov , rajatja@google.com, Zhiyuan Yang , Tim Song , Cathy Luo , Ganapathi Bhat , Xinming Hu Subject: [PATCH] mwifiex: add module parameter to disable 40MHZ support in 2.4G band Date: Thu, 3 Aug 2017 09:06:55 +0000 Message-Id: <1501751215-12742-1-git-send-email-huxinming820@gmail.com> X-Mailer: git-send-email 2.7.4 Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Xinming Hu This patch provide a new module parameter disable_2g4_40m, with which driver will not report 40M capability for 2.4GHZ to cfg80211. Signed-off-by: Xinming Hu Signed-off-by: Cathy Luo Signed-off-by: Ganapathi Bhat --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index 2be7817..820475a 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -25,6 +25,10 @@ static char *reg_alpha2; module_param(reg_alpha2, charp, 0); +static bool disable_2g4_40m; +module_param(disable_2g4_40m, bool, 0000); +MODULE_PARM_DESC(disable_2g4_40m, "2.4G 40M support disable:1, enable:0"); + static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = { { .max = 3, .types = BIT(NL80211_IFTYPE_STATION) | @@ -2755,7 +2759,7 @@ static void mwifiex_setup_vht_caps(struct ieee80211_sta_vht_cap *vht_info, */ static void mwifiex_setup_ht_caps(struct ieee80211_sta_ht_cap *ht_info, - struct mwifiex_private *priv) + struct mwifiex_private *priv, int disable_40m) { int rx_mcs_supp; struct ieee80211_mcs_info mcs_set; @@ -2769,7 +2773,7 @@ static void mwifiex_setup_vht_caps(struct ieee80211_sta_vht_cap *vht_info, memset(&ht_info->mcs, 0, sizeof(ht_info->mcs)); /* Fill HT capability information */ - if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) + if (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap) && !disable_40m) ht_info->cap |= IEEE80211_HT_CAP_SUP_WIDTH_20_40; else ht_info->cap &= ~IEEE80211_HT_CAP_SUP_WIDTH_20_40; @@ -2779,7 +2783,7 @@ static void mwifiex_setup_vht_caps(struct ieee80211_sta_vht_cap *vht_info, else ht_info->cap &= ~IEEE80211_HT_CAP_SGI_20; - if (ISSUPP_SHORTGI40(adapter->hw_dot_11n_dev_cap)) + if (ISSUPP_SHORTGI40(adapter->hw_dot_11n_dev_cap) && !disable_40m) ht_info->cap |= IEEE80211_HT_CAP_SGI_40; else ht_info->cap &= ~IEEE80211_HT_CAP_SGI_40; @@ -2799,7 +2803,8 @@ static void mwifiex_setup_vht_caps(struct ieee80211_sta_vht_cap *vht_info, else ht_info->cap &= ~IEEE80211_HT_CAP_GRN_FLD; - if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap)) + if (ISENABLED_40MHZ_INTOLERANT(adapter->hw_dot_11n_dev_cap) && + !disable_40m) ht_info->cap |= IEEE80211_HT_CAP_40MHZ_INTOLERANT; else ht_info->cap &= ~IEEE80211_HT_CAP_40MHZ_INTOLERANT; @@ -2819,7 +2824,7 @@ static void mwifiex_setup_vht_caps(struct ieee80211_sta_vht_cap *vht_info, memset(&mcs[rx_mcs_supp], 0, sizeof(struct ieee80211_mcs_info) - rx_mcs_supp); if (priv->bss_mode == NL80211_IFTYPE_STATION || - ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap)) + (ISSUPP_CHANWIDTH40(adapter->hw_dot_11n_dev_cap) && !disable_40m)) /* Set MCS32 for infra mode or ad-hoc mode with 40MHz support */ SETHT_MCS32(mcs_set.rx_mask); @@ -2974,14 +2979,15 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, if (ret) goto err_sta_init; - mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv); - if (adapter->is_hw_11ac_capable) + mwifiex_setup_ht_caps(&wiphy->bands[NL80211_BAND_2GHZ]->ht_cap, priv, + disable_2g4_40m); + if (adapter->is_hw_11ac_capable && !disable_2g4_40m) mwifiex_setup_vht_caps( &wiphy->bands[NL80211_BAND_2GHZ]->vht_cap, priv); if (adapter->config_bands & BAND_A) mwifiex_setup_ht_caps( - &wiphy->bands[NL80211_BAND_5GHZ]->ht_cap, priv); + &wiphy->bands[NL80211_BAND_5GHZ]->ht_cap, priv, 0); if ((adapter->config_bands & BAND_A) && adapter->is_hw_11ac_capable) mwifiex_setup_vht_caps(