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@xxxxxxxx> Signed-off-by: Charlie Groh <ga58taw@xxxxxxxx> Signed-off-by: Julius Niedworok <julius.n@xxxxxxx> --- 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)