Skip to content

Commit

Permalink
mac80211: support P2P Device abstraction
Browse files Browse the repository at this point in the history
After cfg80211 got a P2P Device abstraction, add
support to mac80211. Whether it really is supported
or not will depend on whether or not the driver has
support for it, but mac80211 needs to change to be
able to support drivers that need a P2P Device.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Aug 20, 2012
1 parent 98104fd commit f142c6b
Show file tree
Hide file tree
Showing 10 changed files with 226 additions and 96 deletions.
18 changes: 18 additions & 0 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,18 @@ static int ieee80211_change_iface(struct wiphy *wiphy,
return 0;
}

static int ieee80211_start_p2p_device(struct wiphy *wiphy,
struct wireless_dev *wdev)
{
return ieee80211_do_open(wdev, true);
}

static void ieee80211_stop_p2p_device(struct wiphy *wiphy,
struct wireless_dev *wdev)
{
ieee80211_sdata_stop(IEEE80211_WDEV_TO_SUB_IF(wdev));
}

static int ieee80211_set_noack_map(struct wiphy *wiphy,
struct net_device *dev,
u16 noack_map)
Expand Down Expand Up @@ -1774,6 +1786,7 @@ static int ieee80211_scan(struct wiphy *wiphy,
case NL80211_IFTYPE_ADHOC:
case NL80211_IFTYPE_MESH_POINT:
case NL80211_IFTYPE_P2P_CLIENT:
case NL80211_IFTYPE_P2P_DEVICE:
break;
case NL80211_IFTYPE_P2P_GO:
if (sdata->local->ops->hw_scan)
Expand Down Expand Up @@ -2461,6 +2474,9 @@ static int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
if (!sdata->u.mgd.associated)
need_offchan = true;
break;
case NL80211_IFTYPE_P2P_DEVICE:
need_offchan = true;
break;
default:
return -EOPNOTSUPP;
}
Expand Down Expand Up @@ -3013,6 +3029,8 @@ struct cfg80211_ops mac80211_config_ops = {
.add_virtual_intf = ieee80211_add_iface,
.del_virtual_intf = ieee80211_del_iface,
.change_virtual_intf = ieee80211_change_iface,
.start_p2p_device = ieee80211_start_p2p_device,
.stop_p2p_device = ieee80211_stop_p2p_device,
.add_key = ieee80211_add_key,
.del_key = ieee80211_del_key,
.get_key = ieee80211_get_key,
Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ static inline void check_sdata_in_driver(struct ieee80211_sub_if_data *sdata)
{
WARN(!(sdata->flags & IEEE80211_SDATA_IN_DRIVER),
"%s: Failed check-sdata-in-driver check, flags: 0x%x\n",
sdata->dev->name, sdata->flags);
sdata->dev ? sdata->dev->name : sdata->name, sdata->flags);
}

static inline struct ieee80211_sub_if_data *
Expand Down
4 changes: 4 additions & 0 deletions net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -1080,6 +1080,8 @@ struct ieee80211_local {
struct idr ack_status_frames;
spinlock_t ack_status_lock;

struct ieee80211_sub_if_data __rcu *p2p_sdata;

/* dummy netdev for use w/ NAPI */
struct net_device napi_dev;

Expand Down Expand Up @@ -1296,6 +1298,8 @@ void ieee80211_remove_interfaces(struct ieee80211_local *local);
void ieee80211_recalc_idle(struct ieee80211_local *local);
void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
const int offset);
int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);

static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
{
Expand Down
Loading

0 comments on commit f142c6b

Please sign in to comment.