P2P find phase offload
PATCH v9 1/1 P2P find phase offload
- add listen_channel
- comment on channel set assumption (either missing or non-empty set)
- document expected behavior for p2p_find conflict with scan/ROC
- document probe/probe-resp reporting assumption
- remove check for genlmsg_end return value
Vladimir Kondratiev (1):
cfg80211: P2P find phase offload
include/net/cfg80211.h | 72 +++++++++++++++++ include/uapi/linux/nl80211.h | 15 ++++ net/wireless/nl80211.c | 181 +++++++++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 19 +++++ net/wireless/trace.h | 42 ++++++++++ 5 files changed, 329 insertions(+)
Signature · 1 line
1.8.1.2
PATCH v9 1/1 cfg80211: P2P find phase offload
Allow to implement P2P find phase in the driver/firmware.
Offload scheme designed as follows:
- Driver provide methods start_p2p_find and stop_p2p_find in the cfg80211_ops;
- Driver indicate firmware or driver responds to the probe requests by setting feature NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD
- wpa_supplicant analyses methods supported to discover p2p offload support;
- wpa_supplicant analyses feature flags to discover p2p probe response offload support;
to perform p2p scan, wpa_supplicant:
- perform legacy scan, through driver's cfg80211_ops 'scan' method
- configure rx management filter to get probe-request and probe-response frames
- start p2p find via driver's cfg80211_ops start_p2p_find method
- driver start p2p find with hardware and notify wpa_supplicant with cfg80211_p2p_find_notify_start()
- driver/firmware toggle search/listen states. Received probe-request and probe-response frames passed to the wpa_supplicant via cfg80211_rx_mgmt
- when wpa_supplicant wants to stop p2p find, it calls driver's cfg80211_ops stop_p2p_find method. Alternatively, driver/firmware may decide to stop p2p find. In all cases, driver notifies wpa_supplicant using cfg80211_p2p_find_notify_end()
All driver to user space communication done through nl80211 layer.
Offloaded P2P find does not support variations like progressive scan.
--- include/net/cfg80211.h | 72 +++++++++++++++++ include/uapi/linux/nl80211.h | 15 ++++ net/wireless/nl80211.c | 181 +++++++++++++++++++++++++++++++++++++++++++ net/wireless/rdev-ops.h | 19 +++++ net/wireless/trace.h | 42 ++++++++++ 5 files changed, 329 insertions(+)
include/net/cfg80211.h +72 -0
@@ -1799,6 +1799,38 @@ struct cfg80211_update_ft_ies_params { };/** +* struct cfg80211_p2p_find_params - parameters for P2P find +* @probe_ie: extra IE's for probe frames +* @probe_ie_len: length, bytes, of @probe_ie +* @probe_resp_ie: extra IE's for probe response frames +* @probe_resp_ie_len: length, bytes, of @probe_resp_ie +* Driver/firmware may add additional IE's as well as modify +* provided ones; typical IE's to be added are +* WLAN_EID_EXT_SUPP_RATES, WLAN_EID_DS_PARAMS, +* WLAN_EID_HT_CAPABILITY. +* @min_discoverable_interval: and +* @max_discoverable_interval: min/max for random multiplier of 100TU's +* for the listen state duration +* @listen_channel: channels to listen on; not NULL +* @n_channels: number of channels to operate on +* @channels: channels to operate on +* may be NULL, in this case driver suppose to scan for all social +* channels; or channel set should be non-empty (n_channels > 0) +*/ +struct cfg80211_p2p_find_params { +const u8 *probe_ie; +size_t probe_ie_len; +const u8 *probe_resp_ie; +size_t probe_resp_ie_len; +u32 min_discoverable_interval; +u32 max_discoverable_interval; +struct ieee80211_channel *listen_channel; + +int n_channels; +struct ieee80211_channel **channels; +}; + +/** * struct cfg80211_ops - backend description for wireless configuration * * This struct is registered by fullmac card drivers and/or wireless stacks
@@ -2037,6 +2069,20 @@ struct cfg80211_update_ft_ies_params {* driver can take the most appropriate actions. * @crit_proto_stop: Indicates critical protocol no longer needs increased link * reliability. This operation can not fail. +* +* @start_p2p_find: start P2P find phase +* Parameters include IEs for probe/probe-resp frames; +* and channels to operate on. +* Parameters are not retained after call, driver need to copy data if +* it need it later. +* P2P find can't run concurrently with ROC or scan, +* conflict with scan detected by cfg80211 and -EBUSY returned; +* and driver should check for ROC and return -EBUSY to indicate conflict. +* While performing P2P discovery, driver should report all received +* probe-request and probe-response frames via cfg80211_rx_mgmt +* @stop_p2p_find: stop P2P find phase +* After stopping p2p find, driver should call +* cfg80211_p2p_find_notify_end() to inform upper layers */ struct cfg80211_ops {int (*suspend)(struct wiphy *wiphy,struct cfg80211_wowlan *wow);
@@ -2272,6 +2318,12 @@ struct cfg80211_ops { u16 duration);void (*crit_proto_stop)(struct wiphy *wiphy,struct wireless_dev *wdev); + +int (*start_p2p_find)(struct wiphy *wiphy, +struct wireless_dev *wdev, +struct cfg80211_p2p_find_params *params); +void (*stop_p2p_find)(struct wiphy *wiphy, +struct wireless_dev *wdev); };/*
@@ -4185,6 +4237,26 @@ void cfg80211_report_wowlan_wakeup(struct wireless_dev *wdev,*/ void cfg80211_crit_proto_stopped (struct wireless_dev *wdev,gfp_t gfp); +/** +* cfg80211_p2p_find_notify_start - report p2p find phase started +* @wdev: the wireless device reporting the event +* @gfp: allocation flags +*/ +void cfg80211_p2p_find_notify_start (struct wireless_dev *wdev,gfp_t gfp); + +/** +* cfg80211_p2p_find_notify_end - report p2p find phase ended +* @wdev: the wireless device reporting the event +* @gfp: allocation flags +* +* p2p find phase may be ended either unsolicited or in response to +* ops->stop_p2p_find +* +* In any case, if @start_p2p_find from driver's struct cfg80211_ops called, +* @cfg80211_p2p_find_notify_end should be eventually called +*/ +void cfg80211_p2p_find_notify_end (struct wireless_dev *wdev,gfp_t gfp); +/* Logging, debugging and troubleshooting/diagnostic helpers. */ /* wiphy_printk helpers, similar to dev_printk */
include/uapi/linux/nl80211.h +15 -0
@@ -810,6 +810,9 @@ enum nl80211_commands {NL80211_CMD_CRIT_PROTOCOL_START ,NL80211_CMD_CRIT_PROTOCOL_STOP , +NL80211_CMD_START_P2P_FIND , + NL80211_CMD_STOP_P2P_FIND, +/* add new commands above here */ /* used to define NL80211_CMD_MAX below */
@@ -1436,6 +1439,11 @@ enum nl80211_commands {* allowed to be used with the first @NL80211_CMD_SET_STATION command to * update a TDLS peer STA entry. * +* @NL80211_ATTR_MIN_DISCOVERABLE_INTERVAL: +* @NL80211_ATTR_MAX_DISCOVERABLE_INTERVAL: min/max discoverable interval +* for the p2p find, multiple of 100 TUs, represented as u32 +* @NL80211_ATTR_LISTEN_FREQ: Listen channel frequency, represented as u32 +* * @NL80211_ATTR_MAX: highest attribute number currently defined * @__NL80211_ATTR_AFTER_LAST: internal use */
@@ -1736,6 +1744,10 @@ enum nl80211_attrs {NL80211_ATTR_PEER_AID , +NL80211_ATTR_MIN_DISCOVERABLE_INTERVAL , +NL80211_ATTR_MAX_DISCOVERABLE_INTERVAL , +NL80211_ATTR_LISTEN_FREQ , +/* add attributes here, update the policy in nl80211.c */ __NL80211_ATTR_AFTER_LAST,
@@ -3579,6 +3591,8 @@ enum nl80211_ap_sme_features {* Peering Management entity which may be implemented by registering for * beacons or NL80211_CMD_NEW_PEER_CANDIDATE events. The mesh beacon is * still generated by the driver. +* @NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD: When in P2P find phase, +* the device responds to probe-requests in hardware. */ enum nl80211_feature_flags {NL80211_FEATURE_SK_TX_STATUS =1 <<0 ,
@@ -3599,6 +3613,7 @@ enum nl80211_feature_flags {NL80211_FEATURE_FULL_AP_CLIENT_STATE =1 <<15 ,NL80211_FEATURE_USERSPACE_MPM =1 <<16 ,NL80211_FEATURE_ACTIVE_MONITOR =1 <<17 , + NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD = 1 << 18, };/**
net/wireless/nl80211.c +181 -0
211 lines not on this page · raw message
net/wireless/rdev-ops.h +19 -0
@@ -923,4 +923,23 @@ static inline void rdev_crit_proto_stop(struct cfg80211_registered_device *rdev, trace_rdev_return_void(&rdev->wiphy); } +static inline int rdev_start_p2p_find (struct cfg80211_registered_device *rdev, +struct wireless_dev *wdev, +struct cfg80211_p2p_find_params *params) +{ +int ret; +trace_rdev_start_p2p_find (&rdev->wiphy, wdev, params); + ret = rdev->ops->start_p2p_find (&rdev->wiphy, wdev, params); +trace_rdev_return_int (&rdev->wiphy, ret); +return ret; +} + +static inline void rdev_stop_p2p_find (struct cfg80211_registered_device *rdev, +struct wireless_dev *wdev) +{ +trace_rdev_stop_p2p_find (&rdev->wiphy, wdev); + rdev->ops->stop_p2p_find (&rdev->wiphy, wdev); +trace_rdev_return_void (&rdev->wiphy); +} +#endif /* __CFG80211_RDEV_OPS */
net/wireless/trace.h +42 -0
54 lines not on this page · raw message
Signature · 1 line
1.8.1.2
Hi,
In discussion about P2P find phase offload, I see one bit that was not cleared, and want to discuss it prior to coding: probe replying policy.
option 1: all or nothing. If device indicates NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD, it should answer all matching probes, and wpa_s should never answer probes. If device don't indicate offload, it never answer probes and wpa_s do answer all matching probes.
option 2: flexible. If device indicates NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD, it may answer some matching probes, and wpa_s should answer ones that device missed for some reason. To enable this, add 'flags' parameter to cfg80211_rx_mgmt() saying whether frame was replied by device/driver.
Real question here is whether there are devices that can answer probes, but not always. If such devices are real, option 2 is better. I know that for 60g, I'd like to add some more bits to 'flags' from option 2, so I am biased to this option.
Comments?
Hi,
Overall, looks like option 2 is more favorable due to the flexibility, and below is an example for where this flexibility might be useful.
The wpa_supplicant has logic to determine if to respond to a probe request or not based on the local device ID and local device types, and will not respond to probe requests if:
1. The probe request contains a device ID IE and the device ID does not match the local one.
2. The probe request contains specific devices types, and the requested device types do not match the local ones.
Based on the p2p_find offload API you defined, the FW/driver will lack the information of the local Device ID and local device types, so in such cases the FW/driver will not know if it should reply to the response or not.
Obviously, the lacking information could be added to the API, but in its absence, it would be useful to have the flexibility of the flag.
Hope this help a bit,
Ilan.
Quoted 35 lines
-----Original Message-----
From: [email protected] [mailto:linux-wireless- [email protected]] On Behalf Of Vladimir Kondratiev
Sent: Wednesday, June 19, 2013 18:26
To: Johannes Berg
Cc: [email protected]; Luis R . Rodriguez; John W . Linville; Jouni Malinen
Subject: [RFC] P2P find phase offloadHi,
In discussion about P2P find phase offload, I see one bit that was not cleared, and want to discuss it prior to coding: probe replying policy.
option 1: all or nothing. If device indicates
NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD, it should answer all matching probes, andwpa_sshould never answer probes. If device don't indicate offload, it never answer probes andwpa_sdo answer all matching probes.option 2: flexible. If device indicates
NL80211_FEATURE_P2P_PROBE_RESP_OFFLOAD, it may answer some matching probes, andwpa_sshould answer ones that device missed for some reason. To enable this, add 'flags' parameter tocfg80211_rx_mgmt()saying whether frame was replied by device/driver.Real question here is whether there are devices that can answer probes, but not always.
If such devices are real, option 2 is better. I know that for 60g, I'd like to add some more bits to 'flags' from option 2, so I am biased to this option.Comments?
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to [email protected] More majordomo info at
http://vger.kernel.org/majordomo-info.html