diff options
author | Stone Piao <piaoyun@marvell.com> | 2012-09-25 23:23:40 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2012-09-28 13:54:05 -0400 |
commit | 197f4a2ec99dd3a70b27fba7e827d1fa98114ce3 (patch) | |
tree | 44c1f4c17a8c8b1d2482bdb480c3c75a549f560d /drivers/net/wireless/mwifiex/cfg80211.c | |
parent | 7bff9c974e1a70819c30c37d8ec0d84d456f8237 (diff) |
mwifiex: add P2P interface
Due to firmware design, driver needs to add a default P2P interface
to implement find phase and action frame handshake.
Signed-off-by: Stone Piao <piaoyun@marvell.com>
Signed-off-by: Bing Zhao <bzhao@marvell.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/net/wireless/mwifiex/cfg80211.c')
-rw-r--r-- | drivers/net/wireless/mwifiex/cfg80211.c | 39 |
1 files changed, 38 insertions, 1 deletions
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c index 1f4bd67dffa7..ece267a36380 100644 --- a/drivers/net/wireless/mwifiex/cfg80211.c +++ b/drivers/net/wireless/mwifiex/cfg80211.c | |||
@@ -22,7 +22,7 @@ | |||
22 | 22 | ||
23 | static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = { | 23 | static const struct ieee80211_iface_limit mwifiex_ap_sta_limits[] = { |
24 | { | 24 | { |
25 | .max = 1, .types = BIT(NL80211_IFTYPE_STATION), | 25 | .max = 2, .types = BIT(NL80211_IFTYPE_STATION), |
26 | }, | 26 | }, |
27 | { | 27 | { |
28 | .max = 1, .types = BIT(NL80211_IFTYPE_AP), | 28 | .max = 1, .types = BIT(NL80211_IFTYPE_AP), |
@@ -1918,6 +1918,41 @@ struct wireless_dev *mwifiex_add_virtual_intf(struct wiphy *wiphy, | |||
1918 | priv->bss_mode = type; | 1918 | priv->bss_mode = type; |
1919 | 1919 | ||
1920 | break; | 1920 | break; |
1921 | case NL80211_IFTYPE_P2P_CLIENT: | ||
1922 | priv = adapter->priv[MWIFIEX_BSS_TYPE_P2P]; | ||
1923 | |||
1924 | if (priv->bss_mode) { | ||
1925 | wiphy_err(wiphy, "Can't create multiple P2P ifaces"); | ||
1926 | return ERR_PTR(-EINVAL); | ||
1927 | } | ||
1928 | |||
1929 | wdev = kzalloc(sizeof(struct wireless_dev), GFP_KERNEL); | ||
1930 | if (!wdev) | ||
1931 | return ERR_PTR(-ENOMEM); | ||
1932 | |||
1933 | priv->wdev = wdev; | ||
1934 | wdev->wiphy = wiphy; | ||
1935 | |||
1936 | /* At start-up, wpa_supplicant tries to change the interface | ||
1937 | * to NL80211_IFTYPE_STATION if it is not managed mode. | ||
1938 | * So, we initialize it to STA mode. | ||
1939 | */ | ||
1940 | wdev->iftype = NL80211_IFTYPE_STATION; | ||
1941 | priv->bss_mode = NL80211_IFTYPE_STATION; | ||
1942 | |||
1943 | /* Setting bss_type to P2P tells firmware that this interface | ||
1944 | * is receiving P2P peers found during find phase and doing | ||
1945 | * action frame handshake. | ||
1946 | */ | ||
1947 | priv->bss_type = MWIFIEX_BSS_TYPE_P2P; | ||
1948 | |||
1949 | priv->frame_type = MWIFIEX_DATA_FRAME_TYPE_ETH_II; | ||
1950 | priv->bss_priority = MWIFIEX_BSS_ROLE_STA; | ||
1951 | priv->bss_role = MWIFIEX_BSS_ROLE_STA; | ||
1952 | priv->bss_started = 0; | ||
1953 | priv->bss_num = 0; | ||
1954 | |||
1955 | break; | ||
1921 | default: | 1956 | default: |
1922 | wiphy_err(wiphy, "type not supported\n"); | 1957 | wiphy_err(wiphy, "type not supported\n"); |
1923 | return ERR_PTR(-EINVAL); | 1958 | return ERR_PTR(-EINVAL); |
@@ -2069,6 +2104,8 @@ int mwifiex_register_cfg80211(struct mwifiex_adapter *adapter) | |||
2069 | wiphy->max_remain_on_channel_duration = 5000; | 2104 | wiphy->max_remain_on_channel_duration = 5000; |
2070 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | | 2105 | wiphy->interface_modes = BIT(NL80211_IFTYPE_STATION) | |
2071 | BIT(NL80211_IFTYPE_ADHOC) | | 2106 | BIT(NL80211_IFTYPE_ADHOC) | |
2107 | BIT(NL80211_IFTYPE_P2P_CLIENT) | | ||
2108 | BIT(NL80211_IFTYPE_P2P_GO) | | ||
2072 | BIT(NL80211_IFTYPE_AP); | 2109 | BIT(NL80211_IFTYPE_AP); |
2073 | 2110 | ||
2074 | wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; | 2111 | wiphy->bands[IEEE80211_BAND_2GHZ] = &mwifiex_band_2ghz; |