* [PATCH 0/2] p2p interface types
@ 2010-09-16 12:58 Johannes Berg
2010-09-16 12:58 ` [PATCH 1/2] cfg80211/nl80211: introduce p2p device types Johannes Berg
` (2 more replies)
0 siblings, 3 replies; 9+ messages in thread
From: Johannes Berg @ 2010-09-16 12:58 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Jouni Malinen
These two patches introduce p2p interface types
so drivers and the stack can distinguish them
from normal station/AP modes. I'm posting another
set of patches for the supplicant to make use of
them.
johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 1/2] cfg80211/nl80211: introduce p2p device types
2010-09-16 12:58 [PATCH 0/2] p2p interface types Johannes Berg
@ 2010-09-16 12:58 ` Johannes Berg
2010-09-16 12:58 ` [PATCH 2/2] mac80211: add p2p device type support Johannes Berg
2010-09-16 13:20 ` [RFC] ath9k: advertise support for p2p Johannes Berg
2 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2010-09-16 12:58 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Jouni Malinen, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
This adds P2P-STA and P2P-GO as device types so
we can distinguish between those and normal STA
or AP (respectively) type interfaces.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
include/linux/nl80211.h | 4 +++
net/wireless/core.c | 2 +
net/wireless/mlme.c | 3 +-
net/wireless/nl80211.c | 56 +++++++++++++++++++++++++++++++++---------------
net/wireless/sme.c | 9 +++++--
net/wireless/util.c | 15 ++++++++++--
6 files changed, 65 insertions(+), 24 deletions(-)
--- wireless-testing.orig/include/linux/nl80211.h 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/include/linux/nl80211.h 2010-09-16 14:47:13.000000000 +0200
@@ -1020,6 +1020,8 @@ enum nl80211_attrs {
* @NL80211_IFTYPE_WDS: wireless distribution interface
* @NL80211_IFTYPE_MONITOR: monitor interface receiving all frames
* @NL80211_IFTYPE_MESH_POINT: mesh point
+ * @NL80211_IFTYPE_P2P_CLIENT: P2P client
+ * @NL80211_IFTYPE_P2P_GO: P2P group owner
* @NL80211_IFTYPE_MAX: highest interface type number currently defined
* @NUM_NL80211_IFTYPES: number of defined interface types
*
@@ -1036,6 +1038,8 @@ enum nl80211_iftype {
NL80211_IFTYPE_WDS,
NL80211_IFTYPE_MONITOR,
NL80211_IFTYPE_MESH_POINT,
+ NL80211_IFTYPE_P2P_CLIENT,
+ NL80211_IFTYPE_P2P_GO,
/* keep last */
NUM_NL80211_IFTYPES,
--- wireless-testing.orig/net/wireless/util.c 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/net/wireless/util.c 2010-09-16 14:47:13.000000000 +0200
@@ -326,7 +326,8 @@ int ieee80211_data_to_8023(struct sk_buf
cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS)) {
case cpu_to_le16(IEEE80211_FCTL_TODS):
if (unlikely(iftype != NL80211_IFTYPE_AP &&
- iftype != NL80211_IFTYPE_AP_VLAN))
+ iftype != NL80211_IFTYPE_AP_VLAN &&
+ iftype != NL80211_IFTYPE_P2P_GO))
return -1;
break;
case cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS):
@@ -354,7 +355,8 @@ int ieee80211_data_to_8023(struct sk_buf
break;
case cpu_to_le16(IEEE80211_FCTL_FROMDS):
if ((iftype != NL80211_IFTYPE_STATION &&
- iftype != NL80211_IFTYPE_MESH_POINT) ||
+ iftype != NL80211_IFTYPE_P2P_CLIENT &&
+ iftype != NL80211_IFTYPE_MESH_POINT) ||
(is_multicast_ether_addr(dst) &&
!compare_ether_addr(src, addr)))
return -1;
@@ -431,6 +433,7 @@ int ieee80211_data_from_8023(struct sk_b
switch (iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
+ case NL80211_IFTYPE_P2P_GO:
fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS);
/* DA BSSID SA */
memcpy(hdr.addr1, skb->data, ETH_ALEN);
@@ -439,6 +442,7 @@ int ieee80211_data_from_8023(struct sk_b
hdrlen = 24;
break;
case NL80211_IFTYPE_STATION:
+ case NL80211_IFTYPE_P2P_CLIENT:
fc |= cpu_to_le16(IEEE80211_FCTL_TODS);
/* BSSID SA DA */
memcpy(hdr.addr1, bssid, ETH_ALEN);
@@ -778,7 +782,9 @@ int cfg80211_change_iface(struct cfg8021
/* if it's part of a bridge, reject changing type to station/ibss */
if ((dev->priv_flags & IFF_BRIDGE_PORT) &&
- (ntype == NL80211_IFTYPE_ADHOC || ntype == NL80211_IFTYPE_STATION))
+ (ntype == NL80211_IFTYPE_ADHOC ||
+ ntype == NL80211_IFTYPE_STATION ||
+ ntype == NL80211_IFTYPE_P2P_CLIENT))
return -EBUSY;
if (ntype != otype) {
@@ -789,6 +795,7 @@ int cfg80211_change_iface(struct cfg8021
cfg80211_leave_ibss(rdev, dev, false);
break;
case NL80211_IFTYPE_STATION:
+ case NL80211_IFTYPE_P2P_CLIENT:
cfg80211_disconnect(rdev, dev,
WLAN_REASON_DEAUTH_LEAVING, true);
break;
@@ -817,9 +824,11 @@ int cfg80211_change_iface(struct cfg8021
if (dev->ieee80211_ptr->use_4addr)
break;
/* fall through */
+ case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_ADHOC:
dev->priv_flags |= IFF_DONT_BRIDGE;
break;
+ case NL80211_IFTYPE_P2P_GO:
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
case NL80211_IFTYPE_WDS:
--- wireless-testing.orig/net/wireless/core.c 2010-09-16 14:47:03.000000000 +0200
+++ wireless-testing/net/wireless/core.c 2010-09-16 14:47:13.000000000 +0200
@@ -729,6 +729,7 @@ static int cfg80211_netdev_notifier_call
dev->ethtool_ops = &cfg80211_ethtool_ops;
if ((wdev->iftype == NL80211_IFTYPE_STATION ||
+ wdev->iftype == NL80211_IFTYPE_P2P_CLIENT ||
wdev->iftype == NL80211_IFTYPE_ADHOC) && !wdev->use_4addr)
dev->priv_flags |= IFF_DONT_BRIDGE;
break;
@@ -737,6 +738,7 @@ static int cfg80211_netdev_notifier_call
case NL80211_IFTYPE_ADHOC:
cfg80211_leave_ibss(rdev, dev, true);
break;
+ case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
wdev_lock(wdev);
#ifdef CONFIG_CFG80211_WEXT
--- wireless-testing.orig/net/wireless/mlme.c 2010-09-16 14:47:03.000000000 +0200
+++ wireless-testing/net/wireless/mlme.c 2010-09-16 14:47:13.000000000 +0200
@@ -882,7 +882,8 @@ int cfg80211_mlme_mgmt_tx(struct cfg8021
if (!wdev->current_bss ||
memcmp(wdev->current_bss->pub.bssid, mgmt->bssid,
ETH_ALEN) != 0 ||
- (wdev->iftype == NL80211_IFTYPE_STATION &&
+ ((wdev->iftype == NL80211_IFTYPE_STATION ||
+ wdev->iftype == NL80211_IFTYPE_P2P_CLIENT) &&
memcmp(wdev->current_bss->pub.bssid, mgmt->da,
ETH_ALEN) != 0)) {
wdev_unlock(wdev);
--- wireless-testing.orig/net/wireless/nl80211.c 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/net/wireless/nl80211.c 2010-09-16 14:47:13.000000000 +0200
@@ -410,12 +410,14 @@ static int nl80211_key_allowed(struct wi
switch (wdev->iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
+ case NL80211_IFTYPE_P2P_GO:
break;
case NL80211_IFTYPE_ADHOC:
if (!wdev->current_bss)
return -ENOLINK;
break;
case NL80211_IFTYPE_STATION:
+ case NL80211_IFTYPE_P2P_CLIENT:
if (wdev->sme_state != CFG80211_SME_CONNECTED)
return -ENOLINK;
break;
@@ -766,7 +768,8 @@ static bool nl80211_can_set_dev_channel(
wdev->iftype == NL80211_IFTYPE_AP ||
wdev->iftype == NL80211_IFTYPE_WDS ||
wdev->iftype == NL80211_IFTYPE_MESH_POINT ||
- wdev->iftype == NL80211_IFTYPE_MONITOR;
+ wdev->iftype == NL80211_IFTYPE_MONITOR ||
+ wdev->iftype == NL80211_IFTYPE_P2P_GO;
}
static int __nl80211_set_channel(struct cfg80211_registered_device *rdev,
@@ -1693,7 +1696,8 @@ static int nl80211_addset_beacon(struct
if (err)
goto unlock_rtnl;
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
err = -EOPNOTSUPP;
goto out;
}
@@ -1785,7 +1789,8 @@ static int nl80211_del_beacon(struct sk_
goto out;
}
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
err = -EOPNOTSUPP;
goto out;
}
@@ -2128,10 +2133,12 @@ static int nl80211_set_station(struct sk
switch (dev->ieee80211_ptr->iftype) {
case NL80211_IFTYPE_AP:
case NL80211_IFTYPE_AP_VLAN:
+ case NL80211_IFTYPE_P2P_GO:
/* disallow mesh-specific things */
if (params.plink_action)
err = -EINVAL;
break;
+ case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
/* disallow everything but AUTHORIZED flag */
if (params.plink_action)
@@ -2233,7 +2240,8 @@ static int nl80211_new_station(struct sk
goto out_rtnl;
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
- dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN) {
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
err = -EINVAL;
goto out;
}
@@ -2286,7 +2294,8 @@ static int nl80211_del_station(struct sk
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP_VLAN &&
- dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT) {
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_MESH_POINT &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
err = -EINVAL;
goto out;
}
@@ -2660,7 +2669,8 @@ static int nl80211_set_bss(struct sk_buf
goto out;
}
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_AP &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_GO) {
err = -EOPNOTSUPP;
goto out;
}
@@ -3363,6 +3373,7 @@ static int nl80211_send_bss(struct sk_bu
}
switch (wdev->iftype) {
+ case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_STATION:
if (intbss == wdev->current_bss)
NLA_PUT_U32(msg, NL80211_BSS_STATUS,
@@ -3649,7 +3660,8 @@ static int nl80211_authenticate(struct s
goto out;
}
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -3804,7 +3816,8 @@ static int nl80211_associate(struct sk_b
goto out;
}
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -3888,7 +3901,8 @@ static int nl80211_deauthenticate(struct
goto out;
}
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -3954,7 +3968,8 @@ static int nl80211_disassociate(struct s
goto out;
}
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -4332,7 +4347,8 @@ static int nl80211_connect(struct sk_buf
if (err)
goto unlock_rtnl;
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -4408,7 +4424,8 @@ static int nl80211_disconnect(struct sk_
if (err)
goto unlock_rtnl;
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -4496,7 +4513,8 @@ static int nl80211_setdel_pmksa(struct s
pmksa.pmkid = nla_data(info->attrs[NL80211_ATTR_PMKID]);
pmksa.bssid = nla_data(info->attrs[NL80211_ATTR_MAC]);
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -4541,7 +4559,8 @@ static int nl80211_flush_pmksa(struct sk
if (err)
goto out_rtnl;
- if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION) {
+ if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -4823,7 +4842,8 @@ static int nl80211_register_mgmt(struct
goto unlock_rtnl;
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
- dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) {
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -4875,7 +4895,8 @@ static int nl80211_tx_mgmt(struct sk_buf
}
if (dev->ieee80211_ptr->iftype != NL80211_IFTYPE_STATION &&
- dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC) {
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_ADHOC &&
+ dev->ieee80211_ptr->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto out;
}
@@ -5093,7 +5114,8 @@ static int nl80211_set_cqm_rssi(struct g
goto unlock_rdev;
}
- if (wdev->iftype != NL80211_IFTYPE_STATION) {
+ if (wdev->iftype != NL80211_IFTYPE_STATION &&
+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT) {
err = -EOPNOTSUPP;
goto unlock_rdev;
}
--- wireless-testing.orig/net/wireless/sme.c 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/net/wireless/sme.c 2010-09-16 14:47:13.000000000 +0200
@@ -411,7 +411,8 @@ void __cfg80211_connect_result(struct ne
ASSERT_WDEV_LOCK(wdev);
- if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
+ if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
return;
if (wdev->sme_state != CFG80211_SME_CONNECTING)
@@ -548,7 +549,8 @@ void __cfg80211_roamed(struct wireless_d
ASSERT_WDEV_LOCK(wdev);
- if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
+ if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
return;
if (wdev->sme_state != CFG80211_SME_CONNECTED)
@@ -644,7 +646,8 @@ void __cfg80211_disconnected(struct net_
ASSERT_WDEV_LOCK(wdev);
- if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION))
+ if (WARN_ON(wdev->iftype != NL80211_IFTYPE_STATION &&
+ wdev->iftype != NL80211_IFTYPE_P2P_CLIENT))
return;
if (wdev->sme_state != CFG80211_SME_CONNECTED)
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH 2/2] mac80211: add p2p device type support
2010-09-16 12:58 [PATCH 0/2] p2p interface types Johannes Berg
2010-09-16 12:58 ` [PATCH 1/2] cfg80211/nl80211: introduce p2p device types Johannes Berg
@ 2010-09-16 12:58 ` Johannes Berg
2010-09-16 18:22 ` Luis R. Rodriguez
2010-09-16 13:20 ` [RFC] ath9k: advertise support for p2p Johannes Berg
2 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2010-09-16 12:58 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Jouni Malinen, Johannes Berg
From: Johannes Berg <johannes.berg@intel.com>
When a driver advertises p2p device support,
mac80211 will handle it, but internally it will
rewrite the interface type to STA/AP rather than
P2P-STA/GO since otherwise a lot of paths need
to be touched that are otherwise identical. A
p2p boolean tells drivers whether or not a given
interface will be used for p2p or not.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
drivers/net/wireless/mac80211_hwsim.c | 15 +++++++++++----
include/net/mac80211.h | 27 ++++++++++++++++++++++++++-
net/mac80211/cfg.c | 25 ++++++++++++++++++-------
net/mac80211/driver-ops.h | 6 +++---
net/mac80211/driver-trace.h | 21 +++++++++++++--------
net/mac80211/iface.c | 29 ++++++++++++++++++++++++++---
net/mac80211/main.c | 15 +++++++++++++++
net/mac80211/rx.c | 4 +---
net/mac80211/util.c | 18 ++++--------------
9 files changed, 117 insertions(+), 43 deletions(-)
--- wireless-testing.orig/net/mac80211/iface.c 2010-09-16 14:47:02.000000000 +0200
+++ wireless-testing/net/mac80211/iface.c 2010-09-16 14:47:16.000000000 +0200
@@ -188,6 +188,8 @@ static int ieee80211_do_open(struct net_
break;
case NL80211_IFTYPE_UNSPECIFIED:
case NUM_NL80211_IFTYPES:
+ case NL80211_IFTYPE_P2P_CLIENT:
+ case NL80211_IFTYPE_P2P_GO:
/* cannot happen */
WARN_ON(1);
break;
@@ -843,6 +845,7 @@ static void ieee80211_setup_sdata(struct
/* and set some type-dependent values */
sdata->vif.type = type;
+ sdata->vif.p2p = false;
sdata->dev->netdev_ops = &ieee80211_dataif_ops;
sdata->wdev.iftype = type;
@@ -856,10 +859,20 @@ static void ieee80211_setup_sdata(struct
INIT_WORK(&sdata->work, ieee80211_iface_work);
switch (type) {
+ case NL80211_IFTYPE_P2P_GO:
+ type = NL80211_IFTYPE_AP;
+ sdata->vif.type = type;
+ sdata->vif.p2p = true;
+ /* fall through */
case NL80211_IFTYPE_AP:
skb_queue_head_init(&sdata->u.ap.ps_bc_buf);
INIT_LIST_HEAD(&sdata->u.ap.vlans);
break;
+ case NL80211_IFTYPE_P2P_CLIENT:
+ type = NL80211_IFTYPE_STATION;
+ sdata->vif.type = type;
+ sdata->vif.p2p = true;
+ /* fall through */
case NL80211_IFTYPE_STATION:
ieee80211_sta_setup_sdata(sdata);
break;
@@ -893,6 +906,8 @@ static int ieee80211_runtime_change_ifty
{
struct ieee80211_local *local = sdata->local;
int ret, err;
+ enum nl80211_iftype internal_type = type;
+ bool p2p = false;
ASSERT_RTNL();
@@ -925,11 +940,19 @@ static int ieee80211_runtime_change_ifty
* code isn't prepared to handle).
*/
break;
+ case NL80211_IFTYPE_P2P_CLIENT:
+ p2p = true;
+ internal_type = NL80211_IFTYPE_STATION;
+ break;
+ case NL80211_IFTYPE_P2P_GO:
+ p2p = true;
+ internal_type = NL80211_IFTYPE_AP;
+ break;
default:
return -EBUSY;
}
- ret = ieee80211_check_concurrent_iface(sdata, type);
+ ret = ieee80211_check_concurrent_iface(sdata, internal_type);
if (ret)
return ret;
@@ -937,7 +960,7 @@ static int ieee80211_runtime_change_ifty
ieee80211_teardown_sdata(sdata->dev);
- ret = drv_change_interface(local, sdata, type);
+ ret = drv_change_interface(local, sdata, internal_type, p2p);
if (ret)
type = sdata->vif.type;
@@ -956,7 +979,7 @@ int ieee80211_if_change_type(struct ieee
ASSERT_RTNL();
- if (type == sdata->vif.type)
+ if (type == ieee80211_vif_type_p2p(&sdata->vif))
return 0;
/* Setting ad-hoc mode on non-IBSS channel is not supported. */
--- wireless-testing.orig/net/mac80211/rx.c 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/net/mac80211/rx.c 2010-09-16 14:47:16.000000000 +0200
@@ -2588,9 +2588,7 @@ static int prepare_for_handlers(struct i
if (compare_ether_addr(sdata->u.wds.remote_addr, hdr->addr2))
return 0;
break;
- case NL80211_IFTYPE_MONITOR:
- case NL80211_IFTYPE_UNSPECIFIED:
- case NUM_NL80211_IFTYPES:
+ default:
/* should never get here */
WARN_ON(1);
break;
--- wireless-testing.orig/net/mac80211/util.c 2010-09-16 14:47:02.000000000 +0200
+++ wireless-testing/net/mac80211/util.c 2010-09-16 14:47:16.000000000 +0200
@@ -474,16 +474,10 @@ void ieee80211_iterate_active_interfaces
list_for_each_entry(sdata, &local->interfaces, list) {
switch (sdata->vif.type) {
- case NUM_NL80211_IFTYPES:
- case NL80211_IFTYPE_UNSPECIFIED:
case NL80211_IFTYPE_MONITOR:
case NL80211_IFTYPE_AP_VLAN:
continue;
- case NL80211_IFTYPE_AP:
- case NL80211_IFTYPE_STATION:
- case NL80211_IFTYPE_ADHOC:
- case NL80211_IFTYPE_WDS:
- case NL80211_IFTYPE_MESH_POINT:
+ default:
break;
}
if (ieee80211_sdata_running(sdata))
@@ -508,16 +502,10 @@ void ieee80211_iterate_active_interfaces
list_for_each_entry_rcu(sdata, &local->interfaces, list) {
switch (sdata->vif.type) {
- case NUM_NL80211_IFTYPES:
- case NL80211_IFTYPE_UNSPECIFIED:
case NL80211_IFTYPE_MONITOR:
case NL80211_IFTYPE_AP_VLAN:
continue;
- case NL80211_IFTYPE_AP:
- case NL80211_IFTYPE_STATION:
- case NL80211_IFTYPE_ADHOC:
- case NL80211_IFTYPE_WDS:
- case NL80211_IFTYPE_MESH_POINT:
+ default:
break;
}
if (ieee80211_sdata_running(sdata))
@@ -1193,6 +1181,8 @@ int ieee80211_reconfig(struct ieee80211_
break;
case NL80211_IFTYPE_UNSPECIFIED:
case NUM_NL80211_IFTYPES:
+ case NL80211_IFTYPE_P2P_CLIENT:
+ case NL80211_IFTYPE_P2P_GO:
WARN_ON(1);
break;
}
--- wireless-testing.orig/net/mac80211/cfg.c 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/net/mac80211/cfg.c 2010-09-16 14:47:16.000000000 +0200
@@ -1151,15 +1151,26 @@ static int ieee80211_scan(struct wiphy *
struct net_device *dev,
struct cfg80211_scan_request *req)
{
- struct ieee80211_sub_if_data *sdata;
+ struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
- sdata = IEEE80211_DEV_TO_SUB_IF(dev);
-
- if (sdata->vif.type != NL80211_IFTYPE_STATION &&
- sdata->vif.type != NL80211_IFTYPE_ADHOC &&
- sdata->vif.type != NL80211_IFTYPE_MESH_POINT &&
- (sdata->vif.type != NL80211_IFTYPE_AP || sdata->u.ap.beacon))
+ switch (ieee80211_vif_type_p2p(&sdata->vif)) {
+ case NL80211_IFTYPE_STATION:
+ case NL80211_IFTYPE_ADHOC:
+ case NL80211_IFTYPE_MESH_POINT:
+ case NL80211_IFTYPE_P2P_CLIENT:
+ break;
+ case NL80211_IFTYPE_P2P_GO:
+ if (sdata->local->ops->hw_scan)
+ break;
+ /* FIXME: implement NoA while scanning in software */
+ return -EOPNOTSUPP;
+ case NL80211_IFTYPE_AP:
+ if (sdata->u.ap.beacon)
+ return -EOPNOTSUPP;
+ break;
+ default:
return -EOPNOTSUPP;
+ }
return ieee80211_request_scan(sdata, req);
}
--- wireless-testing.orig/include/net/mac80211.h 2010-09-16 14:47:06.000000000 +0200
+++ wireless-testing/include/net/mac80211.h 2010-09-16 14:47:16.000000000 +0200
@@ -769,6 +769,8 @@ struct ieee80211_channel_switch {
* @bss_conf: BSS configuration for this interface, either our own
* or the BSS we're associated to
* @addr: address of this interface
+ * @p2p: indicates whether this AP or STA interface is a p2p
+ * interface, i.e. a GO or p2p-sta respectively
* @drv_priv: data area for driver use, will always be aligned to
* sizeof(void *).
*/
@@ -776,6 +778,7 @@ struct ieee80211_vif {
enum nl80211_iftype type;
struct ieee80211_bss_conf bss_conf;
u8 addr[ETH_ALEN];
+ bool p2p;
/* must be last */
u8 drv_priv[0] __attribute__((__aligned__(sizeof(void *))));
};
@@ -1701,7 +1704,7 @@ struct ieee80211_ops {
struct ieee80211_vif *vif);
int (*change_interface)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
- enum nl80211_iftype new_type);
+ enum nl80211_iftype new_type, bool p2p);
void (*remove_interface)(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
int (*config)(struct ieee80211_hw *hw, u32 changed);
@@ -2721,4 +2724,26 @@ conf_is_ht(struct ieee80211_conf *conf)
return conf->channel_type != NL80211_CHAN_NO_HT;
}
+static inline enum nl80211_iftype
+ieee80211_iftype_p2p(enum nl80211_iftype type, bool p2p)
+{
+ if (p2p) {
+ switch (type) {
+ case NL80211_IFTYPE_STATION:
+ return NL80211_IFTYPE_P2P_CLIENT;
+ case NL80211_IFTYPE_AP:
+ return NL80211_IFTYPE_P2P_GO;
+ default:
+ break;
+ }
+ }
+ return type;
+}
+
+static inline enum nl80211_iftype
+ieee80211_vif_type_p2p(struct ieee80211_vif *vif)
+{
+ return ieee80211_iftype_p2p(vif->type, vif->p2p);
+}
+
#endif /* MAC80211_H */
--- wireless-testing.orig/net/mac80211/main.c 2010-09-16 14:47:02.000000000 +0200
+++ wireless-testing/net/mac80211/main.c 2010-09-16 14:47:16.000000000 +0200
@@ -459,6 +459,21 @@ ieee80211_default_mgmt_stypes[NUM_NL8021
BIT(IEEE80211_STYPE_DEAUTH >> 4) |
BIT(IEEE80211_STYPE_ACTION >> 4),
},
+ [NL80211_IFTYPE_P2P_CLIENT] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
+ },
+ [NL80211_IFTYPE_P2P_GO] = {
+ .tx = 0xffff,
+ .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
+ BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
+ BIT(IEEE80211_STYPE_DISASSOC >> 4) |
+ BIT(IEEE80211_STYPE_AUTH >> 4) |
+ BIT(IEEE80211_STYPE_DEAUTH >> 4) |
+ BIT(IEEE80211_STYPE_ACTION >> 4),
+ },
};
struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
--- wireless-testing.orig/net/mac80211/driver-trace.h 2010-09-16 14:47:02.000000000 +0200
+++ wireless-testing/net/mac80211/driver-trace.h 2010-09-16 14:47:16.000000000 +0200
@@ -25,12 +25,14 @@ static inline void trace_ ## name(proto)
#define STA_PR_FMT " sta:%pM"
#define STA_PR_ARG __entry->sta_addr
-#define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \
+#define VIF_ENTRY __field(enum nl80211_iftype, vif_type) __field(void *, sdata) \
+ __field(bool, p2p) \
__string(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
-#define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \
+#define VIF_ASSIGN __entry->vif_type = sdata->vif.type; __entry->sdata = sdata; \
+ __entry->p2p = sdata->vif.p2p; \
__assign_str(vif_name, sdata->dev ? sdata->dev->name : "<nodev>")
-#define VIF_PR_FMT " vif:%s(%d)"
-#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type
+#define VIF_PR_FMT " vif:%s(%d%s)"
+#define VIF_PR_ARG __get_str(vif_name), __entry->vif_type, __entry->p2p ? "/p2p" : ""
/*
* Tracing for driver callbacks.
@@ -139,25 +141,28 @@ TRACE_EVENT(drv_add_interface,
TRACE_EVENT(drv_change_interface,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
- enum nl80211_iftype type),
+ enum nl80211_iftype type, bool p2p),
- TP_ARGS(local, sdata, type),
+ TP_ARGS(local, sdata, type, p2p),
TP_STRUCT__entry(
LOCAL_ENTRY
VIF_ENTRY
__field(u32, new_type)
+ __field(bool, new_p2p)
),
TP_fast_assign(
LOCAL_ASSIGN;
VIF_ASSIGN;
__entry->new_type = type;
+ __entry->new_p2p = p2p;
),
TP_printk(
- LOCAL_PR_FMT VIF_PR_FMT " new type:%d",
- LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type
+ LOCAL_PR_FMT VIF_PR_FMT " new type:%d%s",
+ LOCAL_PR_ARG, VIF_PR_ARG, __entry->new_type,
+ __entry->new_p2p ? "/p2p" : ""
)
);
--- wireless-testing.orig/net/mac80211/driver-ops.h 2010-09-16 14:47:02.000000000 +0200
+++ wireless-testing/net/mac80211/driver-ops.h 2010-09-16 14:47:16.000000000 +0200
@@ -56,14 +56,14 @@ static inline int drv_add_interface(stru
static inline int drv_change_interface(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
- enum nl80211_iftype type)
+ enum nl80211_iftype type, bool p2p)
{
int ret;
might_sleep();
- trace_drv_change_interface(local, sdata, type);
- ret = local->ops->change_interface(&local->hw, &sdata->vif, type);
+ trace_drv_change_interface(local, sdata, type, p2p);
+ ret = local->ops->change_interface(&local->hw, &sdata->vif, type, p2p);
trace_drv_return_int(local, ret);
return ret;
}
--- wireless-testing.orig/drivers/net/wireless/mac80211_hwsim.c 2010-09-16 14:47:02.000000000 +0200
+++ wireless-testing/drivers/net/wireless/mac80211_hwsim.c 2010-09-16 14:47:16.000000000 +0200
@@ -595,7 +595,8 @@ static int mac80211_hwsim_add_interface(
struct ieee80211_vif *vif)
{
wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n",
- __func__, vif->type, vif->addr);
+ __func__, ieee80211_vif_type_p2p(vif),
+ vif->addr);
hwsim_set_magic(vif);
return 0;
}
@@ -603,11 +604,14 @@ static int mac80211_hwsim_add_interface(
static int mac80211_hwsim_change_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
- enum nl80211_iftype newtype)
+ enum nl80211_iftype newtype,
+ bool newp2p)
{
+ newtype = ieee80211_iftype_p2p(newtype, newp2p);
wiphy_debug(hw->wiphy,
"%s (old type=%d, new type=%d, mac_addr=%pM)\n",
- __func__, vif->type, newtype, vif->addr);
+ __func__, ieee80211_vif_type_p2p(vif),
+ newtype, vif->addr);
hwsim_check_magic(vif);
return 0;
@@ -617,7 +621,8 @@ static void mac80211_hwsim_remove_interf
struct ieee80211_hw *hw, struct ieee80211_vif *vif)
{
wiphy_debug(hw->wiphy, "%s (type=%d mac_addr=%pM)\n",
- __func__, vif->type, vif->addr);
+ __func__, ieee80211_vif_type_p2p(vif),
+ vif->addr);
hwsim_check_magic(vif);
hwsim_clear_magic(vif);
}
@@ -1310,6 +1315,8 @@ static int __init init_mac80211_hwsim(vo
hw->wiphy->interface_modes =
BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_AP) |
+ BIT(NL80211_IFTYPE_P2P_CLIENT) |
+ BIT(NL80211_IFTYPE_P2P_GO) |
BIT(NL80211_IFTYPE_ADHOC) |
BIT(NL80211_IFTYPE_MESH_POINT);
^ permalink raw reply [flat|nested] 9+ messages in thread
* [RFC] ath9k: advertise support for p2p
2010-09-16 12:58 [PATCH 0/2] p2p interface types Johannes Berg
2010-09-16 12:58 ` [PATCH 1/2] cfg80211/nl80211: introduce p2p device types Johannes Berg
2010-09-16 12:58 ` [PATCH 2/2] mac80211: add p2p device type support Johannes Berg
@ 2010-09-16 13:20 ` Johannes Berg
2 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2010-09-16 13:20 UTC (permalink / raw)
To: John Linville; +Cc: linux-wireless, Jouni Malinen
Obvious patch really, but I guess the filtering thing should be figured
out first ... this is just for people who want to keep using ath9k after
updates to the supplicant and already have a patched kernel.
---
drivers/net/wireless/ath/ath9k/init.c | 2 ++
1 file changed, 2 insertions(+)
--- wireless-testing.orig/drivers/net/wireless/ath/ath9k/init.c 2010-09-16 14:08:48.000000000 +0200
+++ wireless-testing/drivers/net/wireless/ath/ath9k/init.c 2010-09-16 14:09:03.000000000 +0200
@@ -638,6 +638,8 @@ void ath9k_set_hw_capab(struct ath_softc
hw->flags |= IEEE80211_HW_MFP_CAPABLE;
hw->wiphy->interface_modes =
+ BIT(NL80211_IFTYPE_P2P_GO) |
+ BIT(NL80211_IFTYPE_P2P_CLIENT) |
BIT(NL80211_IFTYPE_AP) |
BIT(NL80211_IFTYPE_STATION) |
BIT(NL80211_IFTYPE_ADHOC) |
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] mac80211: add p2p device type support
2010-09-16 12:58 ` [PATCH 2/2] mac80211: add p2p device type support Johannes Berg
@ 2010-09-16 18:22 ` Luis R. Rodriguez
2010-09-16 18:30 ` Johannes Berg
0 siblings, 1 reply; 9+ messages in thread
From: Luis R. Rodriguez @ 2010-09-16 18:22 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, Jouni Malinen, Johannes Berg
On Thu, Sep 16, 2010 at 5:58 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> From: Johannes Berg <johannes.berg@intel.com>
>
> When a driver advertises p2p device support,
> mac80211 will handle it, but internally it will
> rewrite the interface type to STA/AP rather than
> P2P-STA/GO since otherwise a lot of paths need
> to be touched that are otherwise identical. A
> p2p boolean tells drivers whether or not a given
> interface will be used for p2p or not.
>
> Signed-off-by: Johannes Berg <johannes.berg@intel.com>
While at it can you add a is_beaconing_iftype() or something, that
should reduce code and make it easier to check for these modes.
Luis
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] mac80211: add p2p device type support
2010-09-16 18:22 ` Luis R. Rodriguez
@ 2010-09-16 18:30 ` Johannes Berg
2010-09-16 18:40 ` Luis R. Rodriguez
0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2010-09-16 18:30 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: John Linville, linux-wireless, Jouni Malinen
On Thu, 2010-09-16 at 11:22 -0700, Luis R. Rodriguez wrote:
> On Thu, Sep 16, 2010 at 5:58 AM, Johannes Berg
> <johannes@sipsolutions.net> wrote:
> > From: Johannes Berg <johannes.berg@intel.com>
> >
> > When a driver advertises p2p device support,
> > mac80211 will handle it, but internally it will
> > rewrite the interface type to STA/AP rather than
> > P2P-STA/GO since otherwise a lot of paths need
> > to be touched that are otherwise identical. A
> > p2p boolean tells drivers whether or not a given
> > interface will be used for p2p or not.
> >
> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
>
> While at it can you add a is_beaconing_iftype() or something, that
> should reduce code and make it easier to check for these modes.
Err, it doesn't really change for drivers, since it's still AP/IBSS --
since GO is just an AP subtype internally. And anyway, I wouldn't use it
internally, so does it really belong into this patch?
johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] mac80211: add p2p device type support
2010-09-16 18:30 ` Johannes Berg
@ 2010-09-16 18:40 ` Luis R. Rodriguez
2010-09-16 18:42 ` Johannes Berg
0 siblings, 1 reply; 9+ messages in thread
From: Luis R. Rodriguez @ 2010-09-16 18:40 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, Jouni Malinen
On Thu, Sep 16, 2010 at 11:30 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2010-09-16 at 11:22 -0700, Luis R. Rodriguez wrote:
>> On Thu, Sep 16, 2010 at 5:58 AM, Johannes Berg
>> <johannes@sipsolutions.net> wrote:
>> > From: Johannes Berg <johannes.berg@intel.com>
>> >
>> > When a driver advertises p2p device support,
>> > mac80211 will handle it, but internally it will
>> > rewrite the interface type to STA/AP rather than
>> > P2P-STA/GO since otherwise a lot of paths need
>> > to be touched that are otherwise identical. A
>> > p2p boolean tells drivers whether or not a given
>> > interface will be used for p2p or not.
>> >
>> > Signed-off-by: Johannes Berg <johannes.berg@intel.com>
>>
>> While at it can you add a is_beaconing_iftype() or something, that
>> should reduce code and make it easier to check for these modes.
>
> Err, it doesn't really change for drivers, since it's still AP/IBSS --
> since GO is just an AP subtype internally.
Well if the iftype is a beaconing one it used to use AP interface type
before and now its a GO then yeah I could see this requiring changes
in drivers. Apart from the filter stuff ath9k does have some checks
for current operating interface type IIRC.
> And anyway, I wouldn't use it
> internally, so does it really belong into this patch?
If there is not much usage for it in mac80211 / cfg80211 sure, I just
thought there would be a lot of uses for it in mac80211 / cfg80211 but
I guess there isn't.
Luis
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] mac80211: add p2p device type support
2010-09-16 18:40 ` Luis R. Rodriguez
@ 2010-09-16 18:42 ` Johannes Berg
2010-09-16 18:56 ` Luis R. Rodriguez
0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2010-09-16 18:42 UTC (permalink / raw)
To: Luis R. Rodriguez; +Cc: John Linville, linux-wireless, Jouni Malinen
On Thu, 2010-09-16 at 11:40 -0700, Luis R. Rodriguez wrote:
> >> While at it can you add a is_beaconing_iftype() or something, that
> >> should reduce code and make it easier to check for these modes.
> >
> > Err, it doesn't really change for drivers, since it's still AP/IBSS --
> > since GO is just an AP subtype internally.
>
> Well if the iftype is a beaconing one it used to use AP interface type
> before and now its a GO then yeah I could see this requiring changes
> in drivers. Apart from the filter stuff ath9k does have some checks
> for current operating interface type IIRC.
But nothing changes for it -- look at the patch again, I translate
P2P_GO to AP and P2P_CLIENT to STATION precisely to require fewer
changes in drivers unless they actually want to care. The only ath9k
change that is required is the one I posted (and you'll be back to the
same non-functioning state, but that's another matter).
johannes
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH 2/2] mac80211: add p2p device type support
2010-09-16 18:42 ` Johannes Berg
@ 2010-09-16 18:56 ` Luis R. Rodriguez
0 siblings, 0 replies; 9+ messages in thread
From: Luis R. Rodriguez @ 2010-09-16 18:56 UTC (permalink / raw)
To: Johannes Berg; +Cc: John Linville, linux-wireless, Jouni Malinen
On Thu, Sep 16, 2010 at 11:42 AM, Johannes Berg
<johannes@sipsolutions.net> wrote:
> On Thu, 2010-09-16 at 11:40 -0700, Luis R. Rodriguez wrote:
>
>> >> While at it can you add a is_beaconing_iftype() or something, that
>> >> should reduce code and make it easier to check for these modes.
>> >
>> > Err, it doesn't really change for drivers, since it's still AP/IBSS --
>> > since GO is just an AP subtype internally.
>>
>> Well if the iftype is a beaconing one it used to use AP interface type
>> before and now its a GO then yeah I could see this requiring changes
>> in drivers. Apart from the filter stuff ath9k does have some checks
>> for current operating interface type IIRC.
>
> But nothing changes for it -- look at the patch again, I translate
> P2P_GO to AP and P2P_CLIENT to STATION precisely to require fewer
> changes in drivers unless they actually want to care. The only ath9k
> change that is required is the one I posted (and you'll be back to the
> same non-functioning state, but that's another matter).
Ah OK fair enough, didn't pick up on that on first glance, nice.
Luis
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2010-09-16 18:56 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-09-16 12:58 [PATCH 0/2] p2p interface types Johannes Berg
2010-09-16 12:58 ` [PATCH 1/2] cfg80211/nl80211: introduce p2p device types Johannes Berg
2010-09-16 12:58 ` [PATCH 2/2] mac80211: add p2p device type support Johannes Berg
2010-09-16 18:22 ` Luis R. Rodriguez
2010-09-16 18:30 ` Johannes Berg
2010-09-16 18:40 ` Luis R. Rodriguez
2010-09-16 18:42 ` Johannes Berg
2010-09-16 18:56 ` Luis R. Rodriguez
2010-09-16 13:20 ` [RFC] ath9k: advertise support for p2p Johannes Berg
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.