Commit 045c745f authored by Eliad Peller's avatar Eliad Peller Committed by Luciano Coelho

wl12xx: support p2p interfaces

Declare support for p2p interfaces, and create p2p_cli/p2p_go
roles when being asked for.

Indicate we are using a p2p interface by setting the wl->p2p flag.
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 93f8c8e0
...@@ -1825,9 +1825,15 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl) ...@@ -1825,9 +1825,15 @@ static u8 wl12xx_get_role_type(struct wl1271 *wl)
{ {
switch (wl->bss_type) { switch (wl->bss_type) {
case BSS_TYPE_AP_BSS: case BSS_TYPE_AP_BSS:
if (wl->p2p)
return WL1271_ROLE_P2P_GO;
else
return WL1271_ROLE_AP; return WL1271_ROLE_AP;
case BSS_TYPE_STA_BSS: case BSS_TYPE_STA_BSS:
if (wl->p2p)
return WL1271_ROLE_P2P_CL;
else
return WL1271_ROLE_STA; return WL1271_ROLE_STA;
case BSS_TYPE_IBSS: case BSS_TYPE_IBSS:
...@@ -1850,7 +1856,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ...@@ -1850,7 +1856,7 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
bool booted = false; bool booted = false;
wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM", wl1271_debug(DEBUG_MAC80211, "mac80211 add interface type %d mac %pM",
vif->type, vif->addr); ieee80211_vif_type_p2p(vif), vif->addr);
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (wl->vif) { if (wl->vif) {
...@@ -1870,7 +1876,10 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ...@@ -1870,7 +1876,10 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
goto out; goto out;
} }
switch (vif->type) { switch (ieee80211_vif_type_p2p(vif)) {
case NL80211_IFTYPE_P2P_CLIENT:
wl->p2p = 1;
/* fall-through */
case NL80211_IFTYPE_STATION: case NL80211_IFTYPE_STATION:
wl->bss_type = BSS_TYPE_STA_BSS; wl->bss_type = BSS_TYPE_STA_BSS;
wl->set_bss_type = BSS_TYPE_STA_BSS; wl->set_bss_type = BSS_TYPE_STA_BSS;
...@@ -1879,6 +1888,9 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw, ...@@ -1879,6 +1888,9 @@ static int wl1271_op_add_interface(struct ieee80211_hw *hw,
wl->bss_type = BSS_TYPE_IBSS; wl->bss_type = BSS_TYPE_IBSS;
wl->set_bss_type = BSS_TYPE_STA_BSS; wl->set_bss_type = BSS_TYPE_STA_BSS;
break; break;
case NL80211_IFTYPE_P2P_GO:
wl->p2p = 1;
/* fall-through */
case NL80211_IFTYPE_AP: case NL80211_IFTYPE_AP:
wl->bss_type = BSS_TYPE_AP_BSS; wl->bss_type = BSS_TYPE_AP_BSS;
break; break;
...@@ -2074,6 +2086,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl, ...@@ -2074,6 +2086,7 @@ static void __wl1271_op_remove_interface(struct wl1271 *wl,
wl->ssid_len = 0; wl->ssid_len = 0;
wl->bss_type = MAX_BSS_TYPE; wl->bss_type = MAX_BSS_TYPE;
wl->set_bss_type = MAX_BSS_TYPE; wl->set_bss_type = MAX_BSS_TYPE;
wl->p2p = 0;
wl->band = IEEE80211_BAND_2GHZ; wl->band = IEEE80211_BAND_2GHZ;
wl->rx_counter = 0; wl->rx_counter = 0;
...@@ -4514,7 +4527,8 @@ int wl1271_init_ieee80211(struct wl1271 *wl) ...@@ -4514,7 +4527,8 @@ int wl1271_init_ieee80211(struct wl1271 *wl)
wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites); wl->hw->wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | wl->hw->wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP); BIT(NL80211_IFTYPE_ADHOC) | BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_P2P_CLIENT) | BIT(NL80211_IFTYPE_P2P_GO);
wl->hw->wiphy->max_scan_ssids = 1; wl->hw->wiphy->max_scan_ssids = 1;
wl->hw->wiphy->max_sched_scan_ssids = 16; wl->hw->wiphy->max_sched_scan_ssids = 16;
wl->hw->wiphy->max_match_sets = 16; wl->hw->wiphy->max_match_sets = 16;
......
...@@ -402,6 +402,7 @@ struct wl1271 { ...@@ -402,6 +402,7 @@ struct wl1271 {
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
u8 bss_type; u8 bss_type;
u8 set_bss_type; u8 set_bss_type;
u8 p2p; /* we are using p2p role */
u8 ssid[IEEE80211_MAX_SSID_LEN + 1]; u8 ssid[IEEE80211_MAX_SSID_LEN + 1];
u8 ssid_len; u8 ssid_len;
int channel; int channel;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment