From patchwork Tue Nov 29 05:24:37 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz.Dziedzic@tieto.com X-Patchwork-Id: 128215 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from maxx.maxx.shmoo.com (maxx.shmoo.com [205.134.188.171]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "maxx.shmoo.com", Issuer "CA Cert Signing Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 742F81007D2 for ; Tue, 29 Nov 2011 16:24:36 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 536589C143; Tue, 29 Nov 2011 00:24:33 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Ta0r4P-URjjr; Tue, 29 Nov 2011 00:24:33 -0500 (EST) Received: from maxx.shmoo.com (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id DDE129C145; Tue, 29 Nov 2011 00:24:28 -0500 (EST) X-Original-To: mailman-post+hostap@maxx.shmoo.com Delivered-To: mailman-post+hostap@maxx.shmoo.com Received: from localhost (localhost [127.0.0.1]) by maxx.maxx.shmoo.com (Postfix) with ESMTP id 7B8DF9C145 for ; Tue, 29 Nov 2011 00:24:27 -0500 (EST) X-Virus-Scanned: amavisd-new at maxx.shmoo.com Received: from maxx.maxx.shmoo.com ([127.0.0.1]) by localhost (maxx.shmoo.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IjXr0-mzjA7S for ; Tue, 29 Nov 2011 00:24:22 -0500 (EST) Received: from ebb06.tieto.com (ebb06.tieto.com [131.207.168.38]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "ebb06.tieto.com", Issuer "VeriSign Class 3 Secure Server CA - G3" (not verified)) by maxx.maxx.shmoo.com (Postfix) with ESMTPS id 8FC2F9C143 for ; Tue, 29 Nov 2011 00:24:21 -0500 (EST) X-AuditID: 83cfa826-b7b5bae000001ca6-cc-4ed46c835a76 Received: from FIHGA-EXHUB01.eu.tieto.com ( [131.207.136.34]) by ebb06.tieto.com (SMTP Mailer) with SMTP id C6.42.07334.38C64DE4; Tue, 29 Nov 2011 07:24:19 +0200 (EET) Received: from EXMB01.eu.tieto.com ([131.207.136.90]) by FIHGA-EXHUB01.eu.tieto.com ([131.207.136.34]) with mapi; Tue, 29 Nov 2011 07:24:19 +0200 From: To: Date: Tue, 29 Nov 2011 07:24:37 +0200 Subject: RE: [PATCH v2 4/4] P2P: Handle driver NOA notification Thread-Topic: [PATCH v2 4/4] P2P: Handle driver NOA notification Thread-Index: AcytxuVHnSDMNqP+RoGNS+Bn43UXbgAj/puw Message-ID: <3078A9B976EF864C8DDD0C499FFD07911E3B76DBDF@EXMB01.eu.tieto.com> References: <3078A9B976EF864C8DDD0C499FFD07911E3B76D9B3@EXMB01.eu.tieto.com> In-Reply-To: <3078A9B976EF864C8DDD0C499FFD07911E3B76D9B3@EXMB01.eu.tieto.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Brightmail-Tracker: AAAAAgPmCRAZdsY7 Cc: j@w1.fi, johannes@sipsolutions.net X-BeenThere: hostap@lists.shmoo.com X-Mailman-Version: 2.1.9 Precedence: list List-Id: HostAP Project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: hostap-bounces@lists.shmoo.com Errors-To: hostap-bounces@lists.shmoo.com Update NOA attribute in beacon and probe response frames after we will get NOA change/set notification from the driver. --- src/p2p/p2p.h | 22 +++++++++++++++++ src/p2p/p2p_group.c | 49 +++++++++++++++++++++++++++++++++++++++ wpa_supplicant/events.c | 10 +++++-- wpa_supplicant/p2p_supplicant.c | 19 +++++++++++++++ wpa_supplicant/p2p_supplicant.h | 3 ++ 5 files changed, 100 insertions(+), 3 deletions(-) -- 1.7.0.4 diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 51a46c8..e64361d 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1547,4 +1547,26 @@ int p2p_in_progress(struct p2p_data *p2p); */ int p2p_other_scan_completed(struct p2p_data *p2p); +/** + * p2p_group_handle_driver_notify_noa - Handle driver notification about + * NOA change/set + * @p2p_group: P2P group context from p2p_group_init() + * @index: Instance of NOA timeing + * @oppps_ctwindow: Opportunistic power save capability + * BIT(7): 1 - enabled, 0 disabled + * BITS(0-6) - Client Traffic Window in TU + * @count_type: Indicates the number of absence intervals + * 255 - mean a continous schedule + * 0 - mean NOA disabled + * @duration: Duration in units of microseconds that P2P_GO + * can remain absent following the start of NOA + * interval + * @interval: NOA interval in units of microseconds + * @start_time: The start time for the schedule expressed in terms + * of lower 4 bytes of the TSF timer + */ +void p2p_group_handle_driver_notify_noa(struct p2p_group *group, u8 index, + u8 oppps_ctwindow, u8 count_type, + u32 duration, u32 interval, + u32 start_time); #endif /* P2P_H */ diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index be5075a..a9d3158 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -696,3 +696,52 @@ const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next) return iter->addr; } + + +void p2p_group_handle_driver_notify_noa(struct p2p_group *group, u8 index, + u8 oppps_ctwindow, u8 count_type, + u32 duration, u32 interval, + u32 start_time) +{ + struct wpabuf *req; + struct p2p_noa_desc desc = {0}, *noa_desc; + + wpa_printf(MSG_DEBUG, "%s called, index: %d, oppps: %d, count: %d, " + "duration: %d, interval: %d, start: %d\n", + __func__, index, oppps_ctwindow, count_type, + duration, interval, start_time); + + noa_desc = &desc; + req = wpabuf_alloc(100); + if (req == NULL) + return; + + desc.count_type = count_type; + desc.duration = duration; + desc.interval = interval; + desc.start_time = start_time; + + /* Check if NOA disabled */ + if(count_type == 0) + noa_desc = NULL; + + /* Build NOA attr */ + p2p_buf_add_noa(req, + index, + !!(oppps_ctwindow & BIT(7)), + oppps_ctwindow & ~BIT(7), + noa_desc, NULL); + + /* Check if we should clear NOA attr */ + if (!(oppps_ctwindow & BIT(7)) && !noa_desc) { + /* Remove NOA attr */ + wpabuf_free(req); + req = NULL; + } + + /* Update beacon, probe_resp IEs */ + p2p_group_notif_noa(group, req); + + if (req) + wpabuf_free(req); +} diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 509b05e..d3e8086 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2471,10 +2471,14 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, break; case EVENT_DRIVER_NOTIFY_NOA: #ifdef CONFIG_P2P - /* TODO: Update Beacon and probe response here - * p2p_group_notif_noa() - */ wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_DRIVER_NOTIFY_NOA"); + wpas_handle_notify_noa(wpa_s, + data->driver_notify_noa.index, + data->driver_notify_noa.oppps_ctwindow, + data->driver_notify_noa.count_type, + data->driver_notify_noa.duration, + data->driver_notify_noa.interval, + data->driver_notify_noa.start_time); #endif /* CONFIG_P2P */ break; default: diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index c82b7f8..087250d 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4161,3 +4161,22 @@ int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s) return p2p_in_progress(wpa_s->global->p2p); } + + +void wpas_handle_notify_noa(void *ctx, u8 index, u8 oppps_ctwindow, + u8 count_type, u32 duration, u32 interval, + u32 start_time) +{ + struct wpa_supplicant *wpa_s = ctx; + + if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) + return; + + if (!wpa_s->ap_iface) + return; + + p2p_group_handle_driver_notify_noa(wpa_s->ap_iface->bss[0]->p2p_group, + index, oppps_ctwindow, + count_type, duration, interval, + start_time); +} diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 3adb076..271e312 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -129,4 +129,7 @@ void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s, struct wps_event_fail *fail); int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s); +void wpas_handle_notify_noa(void *ctx, u8 index, u8 oppps_ctwindow, + u8 count_type, u32 duration, u32 interval, + u32 start_time); #endif /* P2P_SUPPLICANT_H */ -- 1.7.0.4 -----Original Message----- From: hostap-bounces@lists.shmoo.com [mailto:hostap-bounces@lists.shmoo.com] On Behalf Of Janusz.Dziedzic@tieto.com Sent: 28 listopada 2011 13:12 To: hostap@lists.shmoo.com Cc: j@w1.fi; johannes@sipsolutions.net Subject: [PATCH 4/4] P2P: Handle driver NOA notification Update NOA attribute in beacon and probe response frames after we will get NOA change/set notification from the driver. --- src/p2p/p2p.h | 22 +++++++++++++++++ src/p2p/p2p_group.c | 49 +++++++++++++++++++++++++++++++++++++++ wpa_supplicant/events.c | 10 +++++-- wpa_supplicant/p2p_supplicant.c | 19 +++++++++++++++ wpa_supplicant/p2p_supplicant.h | 3 ++ 5 files changed, 100 insertions(+), 3 deletions(-) diff --git a/src/p2p/p2p.h b/src/p2p/p2p.h index 51a46c8..e64361d 100644 --- a/src/p2p/p2p.h +++ b/src/p2p/p2p.h @@ -1547,4 +1547,26 @@ int p2p_in_progress(struct p2p_data *p2p); */ int p2p_other_scan_completed(struct p2p_data *p2p); +/** + * p2p_group_handle_driver_notify_noa - Handle driver notification about + * NOA change/set + * @p2p_group: P2P group context from p2p_group_init() + * @index: Instance of NOA timeing + * @oppps_ctwindow: Opportunistic power save capability + * BIT(7): 1 - enabled, 0 disabled + * BITS(0-6) - Client Traffic Window in TU + * @count_type: Indicates the number of absence intervals + * 255 - mean a continous schedule + * 0 - mean NOA disabled + * @duration: Duration in units of microseconds that P2P_GO + * can remain absent following the start of NOA + * interval + * @interval: NOA interval in units of microseconds + * @start_time: The start time for the schedule expressed in terms + * of lower 4 bytes of the TSF timer + */ +void p2p_group_handle_driver_notify_noa(struct p2p_group *group, u8 index, + u8 oppps_ctwindow, u8 count_type, + u32 duration, u32 interval, + u32 start_time); #endif /* P2P_H */ diff --git a/src/p2p/p2p_group.c b/src/p2p/p2p_group.c index be5075a..560a2f6 100644 --- a/src/p2p/p2p_group.c +++ b/src/p2p/p2p_group.c @@ -696,3 +696,52 @@ const u8 * p2p_iterate_group_members(struct p2p_group *group, void **next) return iter->addr; } + + +void p2p_group_handle_driver_notify_noa(struct p2p_group *group, u8 index, + u8 oppps_ctwindow, u8 count_type, + u32 duration, u32 interval, + u32 start_time) +{ + struct wpabuf *req; + struct p2p_noa_desc desc = {0}, *noa_desc; + + wpa_printf(MSG_DEBUG, "%s called, index: %d, oppps: %d, count: %d, " + "duration: %d, interval: %d, start: %d\n", + __func__, index, oppps_ctwindow, count_type, + duration, interval, start_time); + + noa_desc = &desc; + req = wpabuf_alloc(100); + if (req == NULL) + return; + + desc.count_type = count_type; + desc.duration = duration; + desc.interval = interval; + desc.start_time = start_time; + + /* Check if NOA disabled */ + if(count_type == 0) + noa_desc = NULL; + + /* Build NOA attr */ + p2p_buf_add_noa(req, + index, + 0, + 0, + noa_desc, NULL); + + /* Check if we should clear NOA attr */ + if (!(oppps_ctwindow & BIT(7)) && !noa_desc) { + /* Remove NOA attr */ + wpabuf_free(req); + req = NULL; + } + + /* Update beacon, probe_resp IEs */ + p2p_group_notif_noa(group, req); + + if (req) + wpabuf_free(req); +} diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c index 509b05e..d3e8086 100644 --- a/wpa_supplicant/events.c +++ b/wpa_supplicant/events.c @@ -2471,10 +2471,14 @@ void wpa_supplicant_event(void *ctx, enum wpa_event_type event, break; case EVENT_DRIVER_NOTIFY_NOA: #ifdef CONFIG_P2P - /* TODO: Update Beacon and probe response here - * p2p_group_notif_noa() - */ wpa_dbg(wpa_s, MSG_DEBUG, "EVENT_DRIVER_NOTIFY_NOA"); + wpas_handle_notify_noa(wpa_s, + data->driver_notify_noa.index, + data->driver_notify_noa.oppps_ctwindow, + data->driver_notify_noa.count_type, + data->driver_notify_noa.duration, + data->driver_notify_noa.interval, + data->driver_notify_noa.start_time); #endif /* CONFIG_P2P */ break; default: diff --git a/wpa_supplicant/p2p_supplicant.c b/wpa_supplicant/p2p_supplicant.c index c82b7f8..087250d 100644 --- a/wpa_supplicant/p2p_supplicant.c +++ b/wpa_supplicant/p2p_supplicant.c @@ -4161,3 +4161,22 @@ int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s) return p2p_in_progress(wpa_s->global->p2p); } + + +void wpas_handle_notify_noa(void *ctx, u8 index, u8 oppps_ctwindow, + u8 count_type, u32 duration, u32 interval, + u32 start_time) +{ + struct wpa_supplicant *wpa_s = ctx; + + if (wpa_s->global->p2p_disabled || wpa_s->global->p2p == NULL) + return; + + if (!wpa_s->ap_iface) + return; + + p2p_group_handle_driver_notify_noa(wpa_s->ap_iface->bss[0]->p2p_group, + index, oppps_ctwindow, + count_type, duration, interval, + start_time); +} diff --git a/wpa_supplicant/p2p_supplicant.h b/wpa_supplicant/p2p_supplicant.h index 3adb076..271e312 100644 --- a/wpa_supplicant/p2p_supplicant.h +++ b/wpa_supplicant/p2p_supplicant.h @@ -129,4 +129,7 @@ void wpas_p2p_wps_failed(struct wpa_supplicant *wpa_s, struct wps_event_fail *fail); int wpas_p2p_in_progress(struct wpa_supplicant *wpa_s); +void wpas_handle_notify_noa(void *ctx, u8 index, u8 oppps_ctwindow, + u8 count_type, u32 duration, u32 interval, + u32 start_time); #endif /* P2P_SUPPLICANT_H */