From patchwork Wed Aug 9 02:31:43 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xinming Hu X-Patchwork-Id: 9889453 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 2542860384 for ; Wed, 9 Aug 2017 02:32:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11AE628758 for ; Wed, 9 Aug 2017 02:32:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 053012877B; Wed, 9 Aug 2017 02:32:20 +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 6FDC728758 for ; Wed, 9 Aug 2017 02:32:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752527AbdHICbw (ORCPT ); Tue, 8 Aug 2017 22:31:52 -0400 Received: from mail-pg0-f66.google.com ([74.125.83.66]:37761 "EHLO mail-pg0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752519AbdHICbv (ORCPT ); Tue, 8 Aug 2017 22:31:51 -0400 Received: by mail-pg0-f66.google.com with SMTP id 83so4635428pgb.4 for ; Tue, 08 Aug 2017 19:31:51 -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=ifxjDS8+4SfukNFJyrjzvbQFOt10YMeIHlFb4n51QVg=; b=frTO0rVqYWGQS2FvKKWcgtbTtWcgJvSsU2DugCvgeGNUknLrYBwM9kmjTxqF4tL73v tyXyMsqtvm1ufc3gWIIgPa8ozOLsVrFU+hU+XHz7yu+gu/c1RLe5mdC/QpSPVIsRoc7r nlh+nH3HZpKK+oztIylNc+mFqtXv9B1E2jvhbMiuZ4jsTpIfvETD8nJfTvnUqZNgvDe2 0FK7IGVU+Ws8kvr+A6Ja/8isBp83iErquDpGA/XseuqiGFQTSHOvOgl2fJqaTQo7QwvK X9yD7dPJViFz/D5jZJE+7/vtilQwyexZckkR/ix1h+rzaOY+YurjqKRe1boPdu8mA8tc Z2Dw== 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=ifxjDS8+4SfukNFJyrjzvbQFOt10YMeIHlFb4n51QVg=; b=o+LgrF66rBVx+FSymwiyumaHZfalcRzqLotk7hoN0rDOXBJakRNJR2x2Ts9gVC9X9u 4HUEsXAjRqJzJljTQUG5Z8A1cIKTUMWnu3Sg9WwnvuUaTwa8qxj5bjnF3+Plerp7bIcd CSOZJ3Xbf8p4P5hruHfBO4DXQmTEkUtRMAMUQnCWAFANHTAfVshErjqhcG35U/WdPvop 96E6QamMwZMTIrGrTcn7Qa2LyjHjFYxMcOWmvgFeuJUx454ubF+OZQjD3KVRtPOeodaI MKszPjpoPNUSWTRIpxk0jMmgyZwqY4m81Jlg3UlXSRxCy3ia0d0Ckb+w654mM3F6hc7v vzQg== X-Gm-Message-State: AHYfb5hWxjUQ9yUlFy4BnB718ddzQsa3Jhlh71UwtH5e9Hb///Ycqd81 SlXuZTUskllnzXx8 X-Received: by 10.99.190.4 with SMTP id l4mr6179563pgf.46.1502245910374; Tue, 08 Aug 2017 19:31:50 -0700 (PDT) Received: from ubuntu.members.linode.com ([2400:8902::f03c:91ff:fee7:7cf1]) by smtp.gmail.com with ESMTPSA id r5sm4576205pgn.45.2017.08.08.19.31.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 08 Aug 2017 19:31:49 -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: uap: enable 11d based on userspace configruation Date: Wed, 9 Aug 2017 02:31:43 +0000 Message-Id: <1502245903-22246-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 check whether userspace beacon data include country ie, if so then download command to enable 11d setup in firmeare accordingly. Signed-off-by: Xinming Hu Signed-off-by: Cathy Luo --- drivers/net/wireless/marvell/mwifiex/cfg80211.c | 2 ++ drivers/net/wireless/marvell/mwifiex/main.h | 3 +++ drivers/net/wireless/marvell/mwifiex/uap_cmd.c | 34 ++++++++++++++++--------- 3 files changed, 27 insertions(+), 12 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/cfg80211.c b/drivers/net/wireless/marvell/mwifiex/cfg80211.c index c4382d0..2aa5adc 100644 --- a/drivers/net/wireless/marvell/mwifiex/cfg80211.c +++ b/drivers/net/wireless/marvell/mwifiex/cfg80211.c @@ -2018,6 +2018,8 @@ static int mwifiex_cfg80211_start_ap(struct wiphy *wiphy, priv->state_11h.is_11h_active = false; } + mwifiex_config_uap_11d(priv, ¶ms->beacon); + if (mwifiex_config_start_uap(priv, bss_cfg)) { mwifiex_dbg(priv->adapter, ERROR, "Failed to start AP\n"); diff --git a/drivers/net/wireless/marvell/mwifiex/main.h b/drivers/net/wireless/marvell/mwifiex/main.h index 84be38e..ee8876a 100644 --- a/drivers/net/wireless/marvell/mwifiex/main.h +++ b/drivers/net/wireless/marvell/mwifiex/main.h @@ -1565,6 +1565,9 @@ int mwifiex_config_start_uap(struct mwifiex_private *priv, void mwifiex_uap_del_sta_data(struct mwifiex_private *priv, struct mwifiex_sta_node *node); +void mwifiex_config_uap_11d(struct mwifiex_private *priv, + struct cfg80211_beacon_data *beacon_data); + void mwifiex_init_11h_params(struct mwifiex_private *priv); int mwifiex_is_11h_active(struct mwifiex_private *priv); int mwifiex_11h_activate(struct mwifiex_private *priv, bool flag); diff --git a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c index 477c29c..18f7d9b 100644 --- a/drivers/net/wireless/marvell/mwifiex/uap_cmd.c +++ b/drivers/net/wireless/marvell/mwifiex/uap_cmd.c @@ -444,6 +444,28 @@ void mwifiex_set_sys_config_invalid_data(struct mwifiex_uap_bss_param *config) return; } +/* This function enable 11D if userspace set the country IE. + */ +void mwifiex_config_uap_11d(struct mwifiex_private *priv, + struct cfg80211_beacon_data *beacon_data) +{ + enum state_11d_t state_11d; + const u8 *country_ie; + + country_ie = cfg80211_find_ie(WLAN_EID_COUNTRY, beacon_data->tail, + beacon_data->tail_len); + if (country_ie) { + /* Send cmd to FW to enable 11D function */ + state_11d = ENABLE_11D; + if (mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB, + HostCmd_ACT_GEN_SET, DOT11D_I, + &state_11d, true)) { + mwifiex_dbg(priv->adapter, ERROR, + "11D: failed to enable 11D\n"); + } + } +} + /* This function parses BSS related parameters from structure * and prepares TLVs. These TLVs are appended to command buffer. */ @@ -848,8 +870,6 @@ void mwifiex_uap_set_channel(struct mwifiex_private *priv, int mwifiex_config_start_uap(struct mwifiex_private *priv, struct mwifiex_uap_bss_param *bss_cfg) { - enum state_11d_t state_11d; - if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_SYS_CONFIG, HostCmd_ACT_GEN_SET, UAP_BSS_PARAMS_I, bss_cfg, true)) { @@ -858,16 +878,6 @@ int mwifiex_config_start_uap(struct mwifiex_private *priv, return -1; } - /* Send cmd to FW to enable 11D function */ - state_11d = ENABLE_11D; - if (mwifiex_send_cmd(priv, HostCmd_CMD_802_11_SNMP_MIB, - HostCmd_ACT_GEN_SET, DOT11D_I, - &state_11d, true)) { - mwifiex_dbg(priv->adapter, ERROR, - "11D: failed to enable 11D\n"); - return -1; - } - if (mwifiex_send_cmd(priv, HostCmd_CMD_UAP_BSS_START, HostCmd_ACT_GEN_SET, 0, NULL, true)) { mwifiex_dbg(priv->adapter, ERROR,