From patchwork Fri Dec 7 22:14:01 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marco Porsch X-Patchwork-Id: 1851931 Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by patchwork1.kernel.org (Postfix) with ESMTP id 7BC8D40E3E for ; Fri, 7 Dec 2012 22:14:55 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1424721Ab2LGWOs (ORCPT ); Fri, 7 Dec 2012 17:14:48 -0500 Received: from mail-pb0-f46.google.com ([209.85.160.46]:58397 "EHLO mail-pb0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1424713Ab2LGWOl (ORCPT ); Fri, 7 Dec 2012 17:14:41 -0500 Received: by mail-pb0-f46.google.com with SMTP id wy7so648555pbc.19 for ; Fri, 07 Dec 2012 14:14:41 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:in-reply-to:references :x-gm-message-state; bh=+Ld27t3P3n2li8aU6UwlQHBX+p8qr5tYcfk9jOr6nyg=; b=kvE2ZD+mkq/Nj38n2hJGDl3NyfaXxQA24r1EP1lsVzo1ecLApUIMLYE/2lNPbrrzCf EGqHpxogsGc5INwjH0nOW0xcB0lr7zd+nKhY18+U5/+MG46rpkfnENJQyC4locRDjC9m ike9njIN7hdPO/1eis77oMEAh/Hkn+QkOXJ5oKRHroZugMKoq8TBhPyJroQsDvvNTmtI HmsAYQV6F7Jsy8E0q980TiIW4B8JX07fQpHfhPgar8qd43JpTZYy9wX7ssG1Rv6N0+EY AwOuIZAWGIkaElBYyK8oJk5/pwKbdbg7IHHPAN3C2TX7pCdMiGGjnU+nmOaU0NbmZGhO Yl0w== Received: by 10.66.88.37 with SMTP id bd5mr16847073pab.75.1354918481424; Fri, 07 Dec 2012 14:14:41 -0800 (PST) Received: from X220-marco.lan (70-35-43-50.static.wiline.com. [70.35.43.50]) by mx.google.com with ESMTPS id i3sm7243695pav.18.2012.12.07.14.14.40 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 07 Dec 2012 14:14:40 -0800 (PST) From: Marco Porsch To: johannes@sipsolutions.net Cc: linux-wireless@vger.kernel.org, devel@lists.open80211s.org, Marco Porsch Subject: [RFCv3 3/5] mac80211: move add_tim to subfunction Date: Fri, 7 Dec 2012 14:14:01 -0800 Message-Id: <1354918443-3076-4-git-send-email-marco@cozybit.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1354918443-3076-1-git-send-email-marco@cozybit.com> References: <1354918443-3076-1-git-send-email-marco@cozybit.com> X-Gm-Message-State: ALoCoQnKjbxarrVPG9NlzuXfsHgtBN+y+tdcB8Ik8qkEUAVUucSl5gFCbl6ElP395rGl1CTcRF4y Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org This functions will be used for mesh beacons, too. Signed-off-by: Marco Porsch --- net/mac80211/tx.c | 48 +++++++++++++++++++++++++++++------------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index d287a4f..7155199 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -2261,9 +2261,9 @@ void ieee80211_tx_pending(unsigned long data) /* functions for drivers to get certain frames */ -static void ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, - struct ps_data *ps, - struct sk_buff *skb) +static void __ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, + struct ps_data *ps, + struct sk_buff *skb) { u8 *pos, *tim; int aid0 = 0; @@ -2325,6 +2325,31 @@ static void ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, } } +static int ieee80211_beacon_add_tim(struct ieee80211_sub_if_data *sdata, + struct ps_data *ps, + struct sk_buff *skb) +{ + struct ieee80211_local *local = sdata->local; + + /* Not very nice, but we want to allow the driver to call + * ieee80211_beacon_get() as a response to the set_tim() callback. + * That, however, is already invoked under the sta_lock to guarantee + * consistent and race-free update of the tim bitmap in mac80211 and + * the driver. + */ + if (local->tim_in_locked_section) { + __ieee80211_beacon_add_tim(sdata, ps, skb); + } else { + unsigned long flags; + + spin_lock_irqsave(&local->tim_lock, flags); + __ieee80211_beacon_add_tim(sdata, ps, skb); + spin_unlock_irqrestore(&local->tim_lock, flags); + } + + return 0; +} + struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, struct ieee80211_vif *vif, u16 *tim_offset, u16 *tim_length) @@ -2369,22 +2394,7 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, memcpy(skb_put(skb, beacon->head_len), beacon->head, beacon->head_len); - /* - * Not very nice, but we want to allow the driver to call - * ieee80211_beacon_get() as a response to the set_tim() - * callback. That, however, is already invoked under the - * sta_lock to guarantee consistent and race-free update - * of the tim bitmap in mac80211 and the driver. - */ - if (local->tim_in_locked_section) { - ieee80211_beacon_add_tim(sdata, &ap->ps, skb); - } else { - unsigned long flags; - - spin_lock_irqsave(&local->tim_lock, flags); - ieee80211_beacon_add_tim(sdata, &ap->ps, skb); - spin_unlock_irqrestore(&local->tim_lock, flags); - } + ieee80211_beacon_add_tim(sdata, &ap->ps, skb); if (tim_offset) *tim_offset = beacon->head_len;