@@ -549,11 +549,11 @@ struct wpa_scan_results * hostapd_driver_get_scan_results(
int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
- int duration)
+ int duration, int interval)
{
if (hapd->driver && hapd->driver->set_noa)
return hapd->driver->set_noa(hapd->drv_priv, count, start,
- duration);
+ duration, interval);
return -1;
}
@@ -81,7 +81,7 @@ int hostapd_driver_scan(struct hostapd_data *hapd,
struct wpa_scan_results * hostapd_driver_get_scan_results(
struct hostapd_data *hapd);
int hostapd_driver_set_noa(struct hostapd_data *hapd, u8 count, int start,
- int duration);
+ int duration, int interval);
int hostapd_drv_set_key(const char *ifname,
struct hostapd_data *hapd,
enum wpa_alg alg, const u8 *addr,
@@ -167,6 +167,7 @@ struct hostapd_data {
int noa_enabled;
int noa_start;
int noa_duration;
+ int noa_interval;
#endif /* CONFIG_P2P */
};
@@ -37,31 +37,35 @@ int hostapd_p2p_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
int hostapd_p2p_set_noa(struct hostapd_data *hapd, u8 count, int start,
- int duration)
+ int duration, int interval)
{
wpa_printf(MSG_DEBUG, "P2P: Set NoA parameters: count=%u start=%d "
- "duration=%d", count, start, duration);
+ "duration=%d interval=%d", count, start, duration, interval);
if (count == 0) {
hapd->noa_enabled = 0;
hapd->noa_start = 0;
hapd->noa_duration = 0;
+ hapd->noa_interval = 0;
}
if (count != 255) {
wpa_printf(MSG_DEBUG, "P2P: Non-periodic NoA - set "
"NoA parameters");
- return hostapd_driver_set_noa(hapd, count, start, duration);
+ return hostapd_driver_set_noa(hapd, count, start,
+ duration, interval);
}
hapd->noa_enabled = 1;
hapd->noa_start = start;
hapd->noa_duration = duration;
+ hapd->noa_interval = interval;
if (hapd->num_sta_no_p2p == 0) {
wpa_printf(MSG_DEBUG, "P2P: No legacy STAs connected - update "
"periodic NoA parameters");
- return hostapd_driver_set_noa(hapd, count, start, duration);
+ return hostapd_driver_set_noa(hapd, count, start,
+ duration, interval);
}
wpa_printf(MSG_DEBUG, "P2P: Legacy STA(s) connected - do not enable "
@@ -77,7 +81,7 @@ void hostapd_p2p_non_p2p_sta_connected(struct hostapd_data *hapd)
if (hapd->noa_enabled) {
wpa_printf(MSG_DEBUG, "P2P: Disable periodic NoA");
- hostapd_driver_set_noa(hapd, 0, 0, 0);
+ hostapd_driver_set_noa(hapd, 0, 0, 0, 0);
}
}
@@ -89,7 +93,7 @@ void hostapd_p2p_non_p2p_sta_disconnected(struct hostapd_data *hapd)
if (hapd->noa_enabled) {
wpa_printf(MSG_DEBUG, "P2P: Enable periodic NoA");
hostapd_driver_set_noa(hapd, 255, hapd->noa_start,
- hapd->noa_duration);
+ hapd->noa_duration, hapd->noa_interval);
}
}
@@ -20,7 +20,7 @@
int hostapd_p2p_get_mib_sta(struct hostapd_data *hapd, struct sta_info *sta,
char *buf, size_t buflen);
int hostapd_p2p_set_noa(struct hostapd_data *hapd, u8 count, int start,
- int duration);
+ int duration, int interval);
void hostapd_p2p_non_p2p_sta_connected(struct hostapd_data *hapd);
void hostapd_p2p_non_p2p_sta_disconnected(struct hostapd_data *hapd);
@@ -2032,13 +2032,15 @@ struct wpa_driver_ops {
* @count: Count
* @start: Start time in ms from next TBTT
* @duration: Duration in ms
+ * @interval: Interval in ms
* Returns: 0 on success or -1 on failure
*
* This function is used to set Notice of Absence parameters for GO. It
* is used only for testing. To disable NoA, all parameters are set to
* 0.
*/
- int (*set_noa)(void *priv, u8 count, int start, int duration);
+ int (*set_noa)(void *priv, u8 count, int start, int duration,
+ int interval);
/**
* set_p2p_powersave - Set P2P power save options
@@ -2947,8 +2947,10 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
if (os_strcmp(cmd, "noa") == 0) {
char *pos;
- int count, start, duration;
- /* GO NoA parameters: count,start_offset(ms),duration(ms) */
+ int count, start, duration, interval;
+ /* GO NoA parameters:
+ * count,start_offset(ms),duration(ms), interval(ms)
+ */
count = atoi(param);
pos = os_strchr(param, ',');
if (pos == NULL)
@@ -2960,13 +2962,22 @@ static int p2p_ctrl_set(struct wpa_supplicant *wpa_s, char *cmd)
return -1;
pos++;
duration = atoi(pos);
- if (count < 0 || count > 255 || start < 0 || duration < 0)
+ pos = os_strchr(pos, ',');
+ if (pos == NULL)
+ return -1;
+ pos++;
+ interval = atoi(pos);
+ if (count < 0 || count > 255 || start < 0 ||
+ duration < 0 || interval < 0)
return -1;
if (count == 0 && duration > 0)
return -1;
+ if (interval < duration)
+ return -1;
wpa_printf(MSG_DEBUG, "CTRL_IFACE: P2P_SET GO NoA: count=%d "
- "start=%d duration=%d", count, start, duration);
- return wpas_p2p_set_noa(wpa_s, count, start, duration);
+ "start=%d duration=%d interval=%d", count, start,
+ duration, interval);
+ return wpas_p2p_set_noa(wpa_s, count, start, duration, interval);
}
if (os_strcmp(cmd, "ps") == 0)
@@ -3859,12 +3859,12 @@ void wpas_p2p_update_config(struct wpa_supplicant *wpa_s)
int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start,
- int duration)
+ int duration, int interval)
{
if (!wpa_s->ap_iface)
return -1;
return hostapd_p2p_set_noa(wpa_s->ap_iface->bss[0], count, start,
- duration);
+ duration, interval);
}
@@ -113,7 +113,7 @@ void wpas_p2p_disassoc_notif(struct wpa_supplicant *wpa_s, const u8 *bssid,
u16 reason_code, const u8 *ie, size_t ie_len);
void wpas_p2p_update_config(struct wpa_supplicant *wpa_s);
int wpas_p2p_set_noa(struct wpa_supplicant *wpa_s, u8 count, int start,
- int duration);
+ int duration, int interval);
int wpas_p2p_set_cross_connect(struct wpa_supplicant *wpa_s, int enabled);
void wpas_p2p_notif_connected(struct wpa_supplicant *wpa_s);
void wpas_p2p_notif_disconnected(struct wpa_supplicant *wpa_s);