linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mac80211: allow drivers to report (non-)monitor frames
@ 2015-11-30 12:54 Grzegorz Bajorski
  2015-11-30 13:14 ` Johannes Berg
  2015-12-11 13:39 ` [PATCHv2] " Grzegorz Bajorski
  0 siblings, 2 replies; 5+ messages in thread
From: Grzegorz Bajorski @ 2015-11-30 12:54 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Grzegorz Bajorski

This allows drivers to tell mac80211 whether given
frame is to be processed regularly but skip
monitor interface delivery or vice versa.

Signed-off-by: Grzegorz Bajorski <grzegorz.bajorski@tieto.com>
---
 include/net/mac80211.h | 11 +++++++++++
 net/mac80211/rx.c      |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7c30faf..a35e584 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1014,6 +1014,14 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
  *	is stored in the @ampdu_delimiter_crc field)
  * @RX_FLAG_LDPC: LDPC was used
+ * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
+ *	processing it in any regular way.
+ *	This is useful if drivers offload some frames but still want to report
+ *	them for sniffing purposes.
+ * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
+ *	monitor interfaces.
+ *	This is useful if drivers offload some frames but still want to report
+ *	them for sniffing purposes.
  * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
  * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -1054,6 +1062,8 @@ enum mac80211_rx_flags {
 	RX_FLAG_MACTIME_END		= BIT(21),
 	RX_FLAG_VHT			= BIT(22),
 	RX_FLAG_LDPC			= BIT(23),
+	RX_FLAG_ONLY_MONITOR		= BIT(24),
+	RX_FLAG_SKIP_MONITOR		= BIT(25),
 	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),
 	RX_FLAG_10MHZ			= BIT(28),
 	RX_FLAG_5MHZ			= BIT(29),
@@ -1072,6 +1082,7 @@ enum mac80211_rx_flags {
  * @RX_VHT_FLAG_160MHZ: 160 MHz was used
  * @RX_VHT_FLAG_BF: packet was beamformed
  */
+
 enum mac80211_rx_vht_flags {
 	RX_VHT_FLAG_80MHZ		= BIT(0),
 	RX_VHT_FLAG_160MHZ		= BIT(1),
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1f82753..43ad7a5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -122,7 +122,8 @@ static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len,
 	hdr = (void *)(skb->data + rtap_vendor_space);
 
 	if (status->flag & (RX_FLAG_FAILED_FCS_CRC |
-			    RX_FLAG_FAILED_PLCP_CRC))
+			    RX_FLAG_FAILED_PLCP_CRC |
+			    RX_FLAG_ONLY_MONITOR))
 		return true;
 
 	if (unlikely(skb->len < 16 + present_fcs_len + rtap_vendor_space))
@@ -507,7 +508,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 		return NULL;
 	}
 
-	if (!local->monitors) {
+	if (!local->monitors || (status->flag & RX_FLAG_SKIP_MONITOR)) {
 		if (should_drop_frame(origskb, present_fcs_len,
 				      rtap_vendor_space)) {
 			dev_kfree_skb(origskb);
-- 
2.3.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: allow drivers to report (non-)monitor frames
  2015-11-30 12:54 [PATCH] mac80211: allow drivers to report (non-)monitor frames Grzegorz Bajorski
@ 2015-11-30 13:14 ` Johannes Berg
  2015-12-01  8:07   ` Grzegorz Bajorski
  2015-12-11 13:39 ` [PATCHv2] " Grzegorz Bajorski
  1 sibling, 1 reply; 5+ messages in thread
From: Johannes Berg @ 2015-11-30 13:14 UTC (permalink / raw)
  To: Grzegorz Bajorski, linux-wireless

On Mon, 2015-11-30 at 13:54 +0100, Grzegorz Bajorski wrote:
> This allows drivers to tell mac80211 whether given
> frame is to be processed regularly but skip
> monitor interface delivery or vice versa.
> 
Can you give an example, and perhaps a corresponding driver patch?

johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: allow drivers to report (non-)monitor frames
  2015-11-30 13:14 ` Johannes Berg
@ 2015-12-01  8:07   ` Grzegorz Bajorski
  2015-12-01  8:32     ` Johannes Berg
  0 siblings, 1 reply; 5+ messages in thread
From: Grzegorz Bajorski @ 2015-12-01  8:07 UTC (permalink / raw)
  To: Johannes Berg; +Cc: linux-wireless

already sent in [PATCH] ath10k: deliver mgmt frames from htt to
monitor vifs only.

2015-11-30 14:14 GMT+01:00 Johannes Berg <johannes@sipsolutions.net>:
> On Mon, 2015-11-30 at 13:54 +0100, Grzegorz Bajorski wrote:
>> This allows drivers to tell mac80211 whether given
>> frame is to be processed regularly but skip
>> monitor interface delivery or vice versa.
>>
> Can you give an example, and perhaps a corresponding driver patch?
>
> johannes



-- 
Pozdrawiam / Best Regards
Grzegorz Bajorski

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] mac80211: allow drivers to report (non-)monitor frames
  2015-12-01  8:07   ` Grzegorz Bajorski
@ 2015-12-01  8:32     ` Johannes Berg
  0 siblings, 0 replies; 5+ messages in thread
From: Johannes Berg @ 2015-12-01  8:32 UTC (permalink / raw)
  To: Grzegorz Bajorski; +Cc: linux-wireless

On Tue, 2015-12-01 at 09:07 +0100, Grzegorz Bajorski wrote:
> already sent in [PATCH] ath10k: deliver mgmt frames from htt to
> monitor vifs only.
> 

I see. Perhaps you can resend this patch with a bit of a description of
why you'd want that?

johannes

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCHv2] mac80211: allow drivers to report (non-)monitor frames
  2015-11-30 12:54 [PATCH] mac80211: allow drivers to report (non-)monitor frames Grzegorz Bajorski
  2015-11-30 13:14 ` Johannes Berg
@ 2015-12-11 13:39 ` Grzegorz Bajorski
  1 sibling, 0 replies; 5+ messages in thread
From: Grzegorz Bajorski @ 2015-12-11 13:39 UTC (permalink / raw)
  To: linux-wireless; +Cc: johannes, Grzegorz Bajorski

Some drivers offload some frames internally (e.g.
AddBa). Reporting such frames to mac80211 would
only confuse MLME. However it would be useful to
be able to pass such frames to monitor interfaces
for sniffing purposes, e.g. when running AP +
monitor.

To do that allow drivers to tell mac80211 whether
a given frame should be:
 - processed but not delivered to any monitor vif
 - not processed but delievered to monitor vifs
   only

Signed-off-by: Grzegorz Bajorski <grzegorz.bajorski@tieto.com>
---

Notes:
    v2:
     * fix commit log [Johannes]

 include/net/mac80211.h | 11 +++++++++++
 net/mac80211/rx.c      |  5 +++--
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 7c30faf..a35e584 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1014,6 +1014,14 @@ ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
  * @RX_FLAG_AMPDU_DELIM_CRC_KNOWN: The delimiter CRC field is known (the CRC
  *	is stored in the @ampdu_delimiter_crc field)
  * @RX_FLAG_LDPC: LDPC was used
+ * @RX_FLAG_ONLY_MONITOR: Report frame only to monitor interfaces without
+ *	processing it in any regular way.
+ *	This is useful if drivers offload some frames but still want to report
+ *	them for sniffing purposes.
+ * @RX_FLAG_SKIP_MONITOR: Process and report frame to all interfaces except
+ *	monitor interfaces.
+ *	This is useful if drivers offload some frames but still want to report
+ *	them for sniffing purposes.
  * @RX_FLAG_STBC_MASK: STBC 2 bit bitmask. 1 - Nss=1, 2 - Nss=2, 3 - Nss=3
  * @RX_FLAG_10MHZ: 10 MHz (half channel) was used
  * @RX_FLAG_5MHZ: 5 MHz (quarter channel) was used
@@ -1054,6 +1062,8 @@ enum mac80211_rx_flags {
 	RX_FLAG_MACTIME_END		= BIT(21),
 	RX_FLAG_VHT			= BIT(22),
 	RX_FLAG_LDPC			= BIT(23),
+	RX_FLAG_ONLY_MONITOR		= BIT(24),
+	RX_FLAG_SKIP_MONITOR		= BIT(25),
 	RX_FLAG_STBC_MASK		= BIT(26) | BIT(27),
 	RX_FLAG_10MHZ			= BIT(28),
 	RX_FLAG_5MHZ			= BIT(29),
@@ -1072,6 +1082,7 @@ enum mac80211_rx_flags {
  * @RX_VHT_FLAG_160MHZ: 160 MHz was used
  * @RX_VHT_FLAG_BF: packet was beamformed
  */
+
 enum mac80211_rx_vht_flags {
 	RX_VHT_FLAG_80MHZ		= BIT(0),
 	RX_VHT_FLAG_160MHZ		= BIT(1),
diff --git a/net/mac80211/rx.c b/net/mac80211/rx.c
index 1f82753..43ad7a5 100644
--- a/net/mac80211/rx.c
+++ b/net/mac80211/rx.c
@@ -122,7 +122,8 @@ static inline bool should_drop_frame(struct sk_buff *skb, int present_fcs_len,
 	hdr = (void *)(skb->data + rtap_vendor_space);
 
 	if (status->flag & (RX_FLAG_FAILED_FCS_CRC |
-			    RX_FLAG_FAILED_PLCP_CRC))
+			    RX_FLAG_FAILED_PLCP_CRC |
+			    RX_FLAG_ONLY_MONITOR))
 		return true;
 
 	if (unlikely(skb->len < 16 + present_fcs_len + rtap_vendor_space))
@@ -507,7 +508,7 @@ ieee80211_rx_monitor(struct ieee80211_local *local, struct sk_buff *origskb,
 		return NULL;
 	}
 
-	if (!local->monitors) {
+	if (!local->monitors || (status->flag & RX_FLAG_SKIP_MONITOR)) {
 		if (should_drop_frame(origskb, present_fcs_len,
 				      rtap_vendor_space)) {
 			dev_kfree_skb(origskb);
-- 
2.3.7


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2015-12-11 13:40 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-11-30 12:54 [PATCH] mac80211: allow drivers to report (non-)monitor frames Grzegorz Bajorski
2015-11-30 13:14 ` Johannes Berg
2015-12-01  8:07   ` Grzegorz Bajorski
2015-12-01  8:32     ` Johannes Berg
2015-12-11 13:39 ` [PATCHv2] " Grzegorz Bajorski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).