]> git.karo-electronics.de Git - linux-beck.git/commitdiff
ath6kl: Allow enabling of P2P support
authorJouni Malinen <jouni@qca.qualcomm.com>
Mon, 5 Sep 2011 14:38:47 +0000 (17:38 +0300)
committerKalle Valo <kvalo@qca.qualcomm.com>
Tue, 6 Sep 2011 18:47:00 +0000 (21:47 +0300)
For now, use a module parameter (ath6kl_p2p) to allow P2P support
to be enabled. This is needed since there is no mechanism for
enabling the P2P mode more dynamically for a single netdev.

Signed-off-by: Jouni Malinen <jouni@qca.qualcomm.com>
Signed-off-by: Kalle Valo <kvalo@qca.qualcomm.com>
drivers/net/wireless/ath/ath6kl/cfg80211.c
drivers/net/wireless/ath/ath6kl/core.h
drivers/net/wireless/ath/ath6kl/init.c
drivers/net/wireless/ath/ath6kl/target.h

index 640569688219952bcb8688f3bc52538da3e783d1..a889bf4a47223d852c9d3fa85773e08f41752592 100644 (file)
 #include "hif-ops.h"
 #include "testmode.h"
 
+static unsigned int ath6kl_p2p;
+
+module_param(ath6kl_p2p, uint, 0644);
+
 #define RATETAB_ENT(_rate, _rateid, _flags) {   \
        .bitrate    = (_rate),                  \
        .flags      = (_flags),                 \
@@ -1936,6 +1940,7 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
 {
        int ret = 0;
        struct wireless_dev *wdev;
+       struct ath6kl *ar;
 
        wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL);
        if (!wdev) {
@@ -1951,6 +1956,9 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
                return NULL;
        }
 
+       ar = wiphy_priv(wdev->wiphy);
+       ar->p2p = !!ath6kl_p2p;
+
        wdev->wiphy->mgmt_stypes = ath6kl_mgmt_stypes;
 
        wdev->wiphy->max_remain_on_channel_duration = 5000;
@@ -1960,6 +1968,10 @@ struct wireless_dev *ath6kl_cfg80211_init(struct device *dev)
 
        wdev->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
                BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP);
+       if (ar->p2p) {
+               wdev->wiphy->interface_modes |= BIT(NL80211_IFTYPE_P2P_GO) |
+                       BIT(NL80211_IFTYPE_P2P_CLIENT);
+       }
        /* max num of ssids that can be probed during scanning */
        wdev->wiphy->max_scan_ssids = MAX_PROBED_SSID_INDEX;
        wdev->wiphy->max_scan_ie_len = 1000; /* FIX: what is correct limit? */
index 054da13ce488e3973ba170806247b6c2979ec215..c6ed1fc42bd967f9a61e41ce8c055bfb5b482e5d 100644 (file)
@@ -471,6 +471,8 @@ struct ath6kl {
        bool probe_req_report;
        u16 next_chan;
 
+       bool p2p;
+
 #ifdef CONFIG_ATH6KL_DEBUG
        struct {
                struct circ_buf fwlog_buf;
index 3d67025b72c49fbfd3f1af6b87bbb08b05d3dfb9..eca34aa6e4ba253d53c8e95ed2c4716daa5ae7a5 100644 (file)
@@ -448,13 +448,26 @@ static int ath6kl_target_config_wlan_params(struct ath6kl *ar)
                        status = -EIO;
                }
 
-       ret = ath6kl_wmi_info_req_cmd(ar->wmi, P2P_FLAG_CAPABILITIES_REQ |
-                                     P2P_FLAG_MACADDR_REQ |
-                                     P2P_FLAG_HMODEL_REQ);
-       if (ret) {
-               ath6kl_dbg(ATH6KL_DBG_TRC, "failed to request P2P "
-                          "capabilities (%d) - assuming P2P not supported\n",
-                          ret);
+       if (ar->p2p) {
+               ret = ath6kl_wmi_info_req_cmd(ar->wmi,
+                                             P2P_FLAG_CAPABILITIES_REQ |
+                                             P2P_FLAG_MACADDR_REQ |
+                                             P2P_FLAG_HMODEL_REQ);
+               if (ret) {
+                       ath6kl_dbg(ATH6KL_DBG_TRC, "failed to request P2P "
+                                  "capabilities (%d) - assuming P2P not "
+                                  "supported\n", ret);
+                       ar->p2p = 0;
+               }
+       }
+
+       if (ar->p2p) {
+               /* Enable Probe Request reporting for P2P */
+               ret = ath6kl_wmi_probe_report_req_cmd(ar->wmi, true);
+               if (ret) {
+                       ath6kl_dbg(ATH6KL_DBG_TRC, "failed to enable Probe "
+                                  "Request reporting (%d)\n", ret);
+               }
        }
 
        return status;
@@ -492,6 +505,10 @@ int ath6kl_configure_target(struct ath6kl *ar)
 
        param |= (1 << HI_OPTION_NUM_DEV_SHIFT);
        param |= (fw_iftype << HI_OPTION_FW_MODE_SHIFT);
+       if (ar->p2p && fw_iftype == HI_OPTION_FW_MODE_BSS_STA) {
+               param |= HI_OPTION_FW_SUBMODE_P2PDEV <<
+                       HI_OPTION_FW_SUBMODE_SHIFT;
+       }
        param |= (0 << HI_OPTION_MAC_ADDR_METHOD_SHIFT);
        param |= (0 << HI_OPTION_FW_BRIDGE_SHIFT);
 
index dd8b953cbfc04d026b7cbb8ee2f0439be0c6ae70..7db06a5d919405b1f863ccf7c649640e4bbad9cb 100644 (file)
@@ -304,6 +304,11 @@ struct host_interest {
 #define HI_OPTION_FW_MODE_BSS_STA 0x1
 #define HI_OPTION_FW_MODE_AP      0x2
 
+#define HI_OPTION_FW_SUBMODE_NONE      0x0
+#define HI_OPTION_FW_SUBMODE_P2PDEV    0x1
+#define HI_OPTION_FW_SUBMODE_P2PCLIENT 0x2
+#define HI_OPTION_FW_SUBMODE_P2PGO     0x3
+
 #define HI_OPTION_NUM_DEV_SHIFT   0x9
 
 #define HI_OPTION_FW_BRIDGE_SHIFT 0x04
@@ -316,6 +321,7 @@ struct host_interest {
 |------------------------------------------------------------------------------|
 */
 #define HI_OPTION_FW_MODE_SHIFT        0xC
+#define HI_OPTION_FW_SUBMODE_SHIFT     0x14
 
 /* Convert a Target virtual address into a Target physical address */
 #define AR6003_VTOP(vaddr) ((vaddr) & 0x001fffff)