diff mbox

[RFC,2/2] mac80211: Copy tx'ed beacons to monitor mode

Message ID 1441102364-32516-3-git-send-email-helmut.schaa@googlemail.com (mailing list archive)
State RFC
Delegated to: Johannes Berg
Headers show

Commit Message

Helmut Schaa Sept. 1, 2015, 10:12 a.m. UTC
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(+)

Comments

Felix Fietkau Sept. 1, 2015, 2:04 p.m. UTC | #1
On 2015-09-01 12:12, Helmut Schaa wrote:
> 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.
How about also adding a hw flag to allow drivers to indicate that they
submit tx status for beacons.

- Felix
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Helmut Schaa Sept. 1, 2015, 2:30 p.m. UTC | #2
On Tue, Sep 1, 2015 at 4:04 PM, Felix Fietkau <nbd@openwrt.org> wrote:
> On 2015-09-01 12:12, Helmut Schaa wrote:
>> 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.
> How about also adding a hw flag to allow drivers to indicate that they
> submit tx status for beacons.

Makes sense, yes. Waiting for other comments before resending ...
Helmut
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Johannes Berg Sept. 1, 2015, 3:53 p.m. UTC | #3
On Tue, 2015-09-01 at 12:12 +0200, Helmut Schaa wrote:
> 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.

Generally looks fine.

> @@ -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);
> +> 	> }


I don't really like the assignment in the if much - you could move the
variable declarations into it though.

send_to_cooked should be false, since very old versions of hostapd use
that and would really not expect the beacons there

That has me wondering if we can start to think about removing cooked
monitor mode - does anyone know if we perhaps broke it accidentally
anyway? ;-)

johannes
--
To unsubscribe from this list: send the line "unsubscribe linux-wireless" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

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);