From patchwork Tue Sep 1 10:12:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Helmut Schaa X-Patchwork-Id: 7104491 X-Patchwork-Delegate: johannes@sipsolutions.net Return-Path: X-Original-To: patchwork-linux-wireless@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id DC23DBEEC1 for ; Tue, 1 Sep 2015 10:14:58 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 03C972056E for ; Tue, 1 Sep 2015 10:14:58 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 27DA02056C for ; Tue, 1 Sep 2015 10:14:57 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755663AbbIAKO4 (ORCPT ); Tue, 1 Sep 2015 06:14:56 -0400 Received: from mail-wi0-f181.google.com ([209.85.212.181]:36319 "EHLO mail-wi0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755272AbbIAKOy (ORCPT ); Tue, 1 Sep 2015 06:14:54 -0400 Received: by wibz8 with SMTP id z8so26633093wib.1 for ; Tue, 01 Sep 2015 03:14:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=aw/loVOoNmsixp2AzI75KPJYTtsvybDQ05Q+Rbg+n8c=; b=pMU2p2vASii7n459v1wRPmD9AlFzqOcFuL3kFYlQpaqoDFmtGLh+HmI9yfW25j0wXT r/vSiusc4gPno8+gr1nKzsQDzMp1KsE1PoLnG3y0ct3wjau+ia5q1J5xy7u3+agO0yAi 0bKte2z3uZ0k5zP6Zf+6SiNYmJQDOe53OS9AnxX3JsCrDVSYc6OCCdZrdfx7T5ga8KcG 7QSDmUeKFeYJFxkPVnCn+/zNiYGykqwpOEGV4LiNEGAtJ+MlikzASsuDwH35JpSReIXh PHPzxbk0mSrP0hiCAQ18c4iMdCsOWY5Wwq72TVRJTfc944TO4uw6vZgQQ+q/UIR0eAyc wHDA== X-Received: by 10.180.86.137 with SMTP id p9mr2486359wiz.38.1441102493341; Tue, 01 Sep 2015 03:14:53 -0700 (PDT) Received: from hschaa-desktop.site (HSI-KBW-217-008-059-040.hsi.kabelbw.de. [217.8.59.40]) by smtp.gmail.com with ESMTPSA id pu6sm26424212wjc.34.2015.09.01.03.14.52 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 01 Sep 2015 03:14:52 -0700 (PDT) From: Helmut Schaa To: linux-wireless@vger.kernel.org Cc: johannes@sipsolutions.net, Helmut Schaa Subject: [RFC 2/2] mac80211: Copy tx'ed beacons to monitor mode Date: Tue, 1 Sep 2015 12:12:44 +0200 Message-Id: <1441102364-32516-3-git-send-email-helmut.schaa@googlemail.com> X-Mailer: git-send-email 1.8.4.5 In-Reply-To: <1441102364-32516-1-git-send-email-helmut.schaa@googlemail.com> References: <1441102364-32516-1-git-send-email-helmut.schaa@googlemail.com> Sender: linux-wireless-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-wireless@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When debugging wireless powersave issues on the AP side it's quite helpful to see our own beacons that are transmitted by the hardware/driver. However, this is not that easy since beacons don't pass through the regular TX queues. Preferably drivers would call ieee80211_tx_status also for tx'ed beacons but that's not always possible. Hence, just send a copy of each beacon generated by ieee80211_beacon_get_tim to monitor devices when they are getting fetched by the driver. --- net/mac80211/tx.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 84e0e8c..f522579 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c @@ -3512,6 +3512,9 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, { struct ieee80211_mutable_offsets offs = {}; struct sk_buff *bcn = __ieee80211_beacon_get(hw, vif, &offs, false); + struct sk_buff *copy; + struct ieee80211_supported_band *sband; + int shift; if (tim_offset) *tim_offset = offs.tim_offset; @@ -3519,6 +3522,13 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, if (tim_length) *tim_length = offs.tim_length; + /* send a copy to monitor interfaces */ + if (hw_to_local(hw)->monitors && (copy = skb_copy(bcn, GFP_ATOMIC))) { + shift = ieee80211_vif_get_shift(vif); + sband = hw->wiphy->bands[ieee80211_get_sdata_band(vif_to_sdata(vif))]; + ieee80211_tx_monitor(hw_to_local(hw), copy, sband, 1, shift, true); + } + return bcn; } EXPORT_SYMBOL(ieee80211_beacon_get_tim);