From patchwork Thu Mar 21 14:47:55 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janusz Dziedzic X-Patchwork-Id: 2313921 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork2.kernel.org (Postfix) with ESMTP id 47B63DF264 for ; Thu, 21 Mar 2013 14:48:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933485Ab3CUOsQ (ORCPT ); Thu, 21 Mar 2013 10:48:16 -0400 Received: from mail-ee0-f44.google.com ([74.125.83.44]:55556 "EHLO mail-ee0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932865Ab3CUOsP (ORCPT ); Thu, 21 Mar 2013 10:48:15 -0400 Received: by mail-ee0-f44.google.com with SMTP id l10so1762491eei.17 for ; Thu, 21 Mar 2013 07:48:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=XNpi1yl7zkCoMyPLVRbTvrIPN/KEJ0XcbhZuiOjLU94=; b=ityQYNF+x8agx1hOeKtK1GHlyfhe8PLGIUZR8M2iJjDhGmqa4YJwge6St0bsNQaOBi uDZaOTQpRAliwfX/7iJHMHZVI6ls2mdwI97vKnEDgl+a/BtnMpbCEQD+UiEx4BkqcH+G jVB2YnaRbrbjwdY/VRBXiqqEeSkkVkBGgV+XLrFfBc3njVu+iVVRCkx2CIVZZzLtaYNe vTj7pkAUvGwCUwb0E2I2xbw2RgR9xG1tttiv4/+UBzJOAX7wWPRt3pOZ0FNCsa7U6fo7 QtfElzI2+X+D4oGfQbBP2f5WwqNS0I8v+ESzNv//tUXGhMmL3IVUH2dbr0Mtxkse0Xys JCxg== X-Received: by 10.15.21.4 with SMTP id c4mr43649196eeu.34.1363877294281; Thu, 21 Mar 2013 07:48:14 -0700 (PDT) Received: from localhost.localdomain ([91.198.246.8]) by mx.google.com with ESMTPS id r4sm8843548eeo.12.2013.03.21.07.48.12 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 21 Mar 2013 07:48:13 -0700 (PDT) From: Janusz Dziedzic To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Janusz Dziedzic , Janusz Dziedzic Subject: [PATCH v2 2/4] mac80211: use ieee80211_p2p_noa_attr structure Date: Thu, 21 Mar 2013 15:47:55 +0100 Message-Id: <1363877277-5108-2-git-send-email-janusz.dziedzic@gmail.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1363877277-5108-1-git-send-email-janusz.dziedzic@gmail.com> References: <1363877277-5108-1-git-send-email-janusz.dziedzic@gmail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org Use ieee80211_p2p_noa_attr structure during P2P_PS (oppps) detection. Signed-off-by: Janusz Dziedzic --- net/mac80211/mlme.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c index fdc06e3..14612cd 100644 --- a/net/mac80211/mlme.c +++ b/net/mac80211/mlme.c @@ -1655,18 +1655,20 @@ static void ieee80211_set_associated(struct ieee80211_sub_if_data *sdata, rcu_read_lock(); ies = rcu_dereference(cbss->ies); if (ies) { - u8 noa[2]; + struct ieee80211_p2p_noa_attr noa; int ret; ret = cfg80211_get_p2p_attr( ies->data, ies->len, IEEE80211_P2P_ATTR_ABSENCE_NOTICE, - noa, sizeof(noa)); + (u8 *) &noa, sizeof(noa)); if (ret >= 2) { - bss_conf->p2p_oppps = noa[1] & 0x80; - bss_conf->p2p_ctwindow = noa[1] & 0x7f; + bss_conf->p2p_oppps = noa.oppps_ctwindow & + IEEE80211_P2P_OPPPS_ENABLE_BIT; + bss_conf->p2p_ctwindow = noa.oppps_ctwindow & + IEEE80211_P2P_OPPPS_CTWINDOW_MASK; bss_info_changed |= BSS_CHANGED_P2P_PS; - sdata->u.mgd.p2p_noa_index = noa[0]; + sdata->u.mgd.p2p_noa_index = noa.index; } } rcu_read_unlock(); @@ -2953,18 +2955,20 @@ ieee80211_rx_mgmt_beacon(struct ieee80211_sub_if_data *sdata, } if (sdata->vif.p2p) { - u8 noa[2]; + struct ieee80211_p2p_noa_attr noa; int ret; ret = cfg80211_get_p2p_attr(mgmt->u.beacon.variable, len - baselen, IEEE80211_P2P_ATTR_ABSENCE_NOTICE, - noa, sizeof(noa)); - if (ret >= 2 && sdata->u.mgd.p2p_noa_index != noa[0]) { - bss_conf->p2p_oppps = noa[1] & 0x80; - bss_conf->p2p_ctwindow = noa[1] & 0x7f; + (u8 *) &noa, sizeof(noa)); + if (ret >= 2 && sdata->u.mgd.p2p_noa_index != noa.index) { + bss_conf->p2p_oppps = noa.oppps_ctwindow & + IEEE80211_P2P_OPPPS_ENABLE_BIT; + bss_conf->p2p_ctwindow = noa.oppps_ctwindow & + IEEE80211_P2P_OPPPS_CTWINDOW_MASK; changed |= BSS_CHANGED_P2P_PS; - sdata->u.mgd.p2p_noa_index = noa[0]; + sdata->u.mgd.p2p_noa_index = noa.index; /* * make sure we update all information, the CRC * mechanism doesn't look at P2P attributes.