All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC] mac80211: Use IFF_ECHO to force delivery of tx_status frames
@ 2019-02-26  9:40 Julius Niedworok
  2019-02-26 11:04 ` Oliver Hartkopp
  0 siblings, 1 reply; 15+ messages in thread
From: Julius Niedworok @ 2019-02-26  9:40 UTC (permalink / raw)
  To: linux-wireless
  Cc: julius.n, ga58taw, david, nc, David S. Miller, Johannes Berg,
	Edward Cree, Jiri Pirko, Ido Schimmel, Petr Machata,
	Kirill Tkhai, Alexander Duyck, Amritha Nambiar, Li RongQing,
	netdev, linux-kernel

At Technical University of Munich we use MAC 802.11 TX status frames to
perform several measurements in MAC 802.11 setups.

With ath based drivers this was possible until commit d94a461d7a7df6
("ath9k: use ieee80211_tx_status_noskb where possible") as the driver
ignored the IEEE80211_TX_CTL_REQ_TX_STATUS flag and always delivered
TX status frames. Since this commit, this behavior was changed and the
driver now adheres to IEEE80211_TX_CTL_REQ_TX_STATUS.

Due to performance reasons, IEEE80211_TX_CTL_REQ_TX_STATUS is not set for
data frames from interfaces in managed mode. Hence, frames that are sent
from a managed mode interface do never deliver TX status frames. This
remains true even if a monitor mode interface (e.g. a measurement
interface) is added to the same wireless hardware device. Thus, there is
no possibility for receiving TX status frames for frames sent on an
interface in managed mode if the driver adheres to
IEEE80211_TX_CTL_REQ_TX_STATUS.

In order to force delivery of TX status frames for research and debugging
purposes, implement the IFF_ECHO flag for ieee80211 devices. When this flag
is set for a specific interface, IEEE80211_TX_CTL_REQ_TX_STATUS is enabled
in all packets sent from that interface. IFF_ECHO can be set via
/sys/class/net/<dev>/flags. The default is disabled.

Co-developed-by: Charlie Groh <ga58taw@mytum.de>
Signed-off-by: Charlie Groh <ga58taw@mytum.de>
Signed-off-by: Julius Niedworok <julius.n@gmx.net>
---
 net/core/dev.c    | 8 ++++++++
 net/mac80211/tx.c | 6 ++++++
 2 files changed, 14 insertions(+)

diff --git a/net/core/dev.c b/net/core/dev.c
index 8e276e0..076b556 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7543,6 +7543,14 @@ int __dev_change_flags(struct net_device *dev, unsigned int flags,
 			       IFF_AUTOMEDIA)) |
 		     (dev->flags & (IFF_UP | IFF_VOLATILE | IFF_PROMISC |
 				    IFF_ALLMULTI));
+	/*
+	 *	Force TX status frames on ieee80211 devices.
+	 *	Since IFF_ECHO is used by CAN devices for a different
+	 *	purpose, we must check dev->ieee80211_ptr.
+	 */
+
+	if (dev->ieee80211_ptr)
+		dev->flags = (dev->flags & ~IFF_ECHO) | (flags & IFF_ECHO);
 
 	/*
 	 *	Load in the correct multicast list now the flags have changed.
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 928f13a..2a02f66 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -2463,6 +2463,9 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata,
 	if (IS_ERR(sta))
 		sta = NULL;
 
+	if (sdata->dev->flags & IFF_ECHO)
+		info_flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+
 	/* convert Ethernet header to proper 802.11 header (based on
 	 * operation mode) */
 	ethertype = (skb->data[12] << 8) | skb->data[13];
@@ -3468,6 +3471,9 @@ static bool ieee80211_xmit_fast(struct ieee80211_sub_if_data *sdata,
 		      (tid_tx ? IEEE80211_TX_CTL_AMPDU : 0);
 	info->control.flags = IEEE80211_TX_CTRL_FAST_XMIT;
 
+	if (sdata->dev->flags & IFF_ECHO)
+		info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
+
 	if (hdr->frame_control & cpu_to_le16(IEEE80211_STYPE_QOS_DATA)) {
 		tid = skb->priority & IEEE80211_QOS_CTL_TAG1D_MASK;
 		*ieee80211_get_qos_ctl(hdr) = tid;
-- 
2.10.1 (Apple Git-78)


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

end of thread, other threads:[~2019-03-28 20:01 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-02-26  9:40 [PATCH RFC] mac80211: Use IFF_ECHO to force delivery of tx_status frames Julius Niedworok
2019-02-26 11:04 ` Oliver Hartkopp
2019-02-26 13:13   ` Julius Niedworok
2019-02-26 13:33     ` Johannes Berg
2019-02-28  9:05       ` Julius Niedworok
2019-03-01  8:32         ` Johannes Berg
2019-03-02 15:16           ` Julius Niedworok
2019-03-06 20:02           ` [PATCH RFC v2] mac80211: debugfs option to force TX status frames Julius Niedworok
2019-03-07 15:42             ` Kalle Valo
2019-03-07 19:30               ` ga58taw
2019-03-11 14:03                 ` Kalle Valo
2019-03-11 14:52                   ` Jeremy Sowden
2019-03-19 15:07                     ` Julius Niedworok
2019-03-20 12:13                       ` Jeremy Sowden
2019-03-28 20:01           ` [PATCH v3] " Julius Niedworok

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.