linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature
@ 2019-11-22 17:14 James Prestwood
  2019-11-22 17:14 ` [PATCH v3 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path James Prestwood
  2019-12-13  9:53 ` [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature Johannes Berg
  0 siblings, 2 replies; 4+ messages in thread
From: James Prestwood @ 2019-11-22 17:14 UTC (permalink / raw)
  To: linux-wireless; +Cc: James Prestwood

Support for this is already in nl80211, and some code paths in
mac80211_hwsim already set the rx_status to allow the parent TSF
value to be sent to user space.

Signed-off-by: James Prestwood <prestwoj@gmail.com>
---
 drivers/net/wireless/mac80211_hwsim.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 772e54f0696f..e9bc599481d4 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -2825,6 +2825,7 @@ static int mac80211_hwsim_new_radio(struct genl_info *info,
 			       NL80211_FEATURE_DYNAMIC_SMPS |
 			       NL80211_FEATURE_SCAN_RANDOM_MAC_ADDR;
 	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_VHT_IBSS);
+	wiphy_ext_feature_set(hw->wiphy, NL80211_EXT_FEATURE_BSS_PARENT_TSF);
 
 	hw->wiphy->interface_modes = param->iftypes;
 
-- 
2.17.1


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

* [PATCH v3 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path
  2019-11-22 17:14 [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature James Prestwood
@ 2019-11-22 17:14 ` James Prestwood
  2019-12-13  9:52   ` Johannes Berg
  2019-12-13  9:53 ` [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature Johannes Berg
  1 sibling, 1 reply; 4+ messages in thread
From: James Prestwood @ 2019-11-22 17:14 UTC (permalink / raw)
  To: linux-wireless; +Cc: James Prestwood

This patch sets the required rx_status mactime and flags in order for
the parent TSF value to be calculated and sent to userspace. This is
already done elsewhere, but this patch allows this to work for the
wmediumd code path.

Signed-off-by: James Prestwood <prestwoj@gmail.com>
---
 drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index e9bc599481d4..01b2ac9707cc 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -3238,6 +3238,8 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
 	int frame_data_len;
 	void *frame_data;
 	struct sk_buff *skb = NULL;
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb_2->data;
+	u64 now;
 
 	if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] ||
 	    !info->attrs[HWSIM_ATTR_FRAME] ||
@@ -3300,6 +3302,18 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
 	rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]);
 	rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]);
 
+	if (ieee80211_is_beacon(hdr->frame_control) ||
+	    ieee80211_is_probe_resp(hdr->frame_control)) {
+		rx_status.boottime_ns = ktime_get_boottime_ns();
+		now = data2->abs_bcn_ts;
+	} else {
+		now = mac80211_hwsim_get_tsf_raw();
+	}
+
+	rx_status.mactime = now + data2->tsf_offset;
+
+	rx_status.flag |= RX_FLAG_MACTIME_START;
+
 	memcpy(IEEE80211_SKB_RXCB(skb), &rx_status, sizeof(rx_status));
 	data2->rx_pkts++;
 	data2->rx_bytes += skb->len;
-- 
2.17.1


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

* Re: [PATCH v3 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path
  2019-11-22 17:14 ` [PATCH v3 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path James Prestwood
@ 2019-12-13  9:52   ` Johannes Berg
  0 siblings, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2019-12-13  9:52 UTC (permalink / raw)
  To: James Prestwood, linux-wireless

On Fri, 2019-11-22 at 09:14 -0800, James Prestwood wrote:
> This patch sets the required rx_status mactime and flags in order for
> the parent TSF value to be calculated and sent to userspace. This is
> already done elsewhere, but this patch allows this to work for the
> wmediumd code path.
> 
> Signed-off-by: James Prestwood <prestwoj@gmail.com>
> ---
>  drivers/net/wireless/mac80211_hwsim.c | 14 ++++++++++++++
>  1 file changed, 14 insertions(+)
> 
> diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
> index e9bc599481d4..01b2ac9707cc 100644
> --- a/drivers/net/wireless/mac80211_hwsim.c
> +++ b/drivers/net/wireless/mac80211_hwsim.c
> @@ -3238,6 +3238,8 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
>  	int frame_data_len;
>  	void *frame_data;
>  	struct sk_buff *skb = NULL;
> +	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb_2->data;
> +	u64 now;
>  
>  	if (!info->attrs[HWSIM_ATTR_ADDR_RECEIVER] ||
>  	    !info->attrs[HWSIM_ATTR_FRAME] ||
> @@ -3300,6 +3302,18 @@ static int hwsim_cloned_frame_received_nl(struct sk_buff *skb_2,
>  	rx_status.rate_idx = nla_get_u32(info->attrs[HWSIM_ATTR_RX_RATE]);
>  	rx_status.signal = nla_get_u32(info->attrs[HWSIM_ATTR_SIGNAL]);
>  
> +	if (ieee80211_is_beacon(hdr->frame_control) ||
> +	    ieee80211_is_probe_resp(hdr->frame_control)) {
> +		rx_status.boottime_ns = ktime_get_boottime_ns();
> +		now = data2->abs_bcn_ts;

I'm pretty sure this should be data, not data2, like in the other code
paths?

Also, please rebase - I already did the boottime_ns before overlapping
your change, so you can also get rid of the 'hdr' variable.

johannes



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

* Re: [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature
  2019-11-22 17:14 [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature James Prestwood
  2019-11-22 17:14 ` [PATCH v3 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path James Prestwood
@ 2019-12-13  9:53 ` Johannes Berg
  1 sibling, 0 replies; 4+ messages in thread
From: Johannes Berg @ 2019-12-13  9:53 UTC (permalink / raw)
  To: James Prestwood, linux-wireless

On Fri, 2019-11-22 at 09:14 -0800, James Prestwood wrote:
> Support for this is already in nl80211, and some code paths in
> mac80211_hwsim already set the rx_status to allow the parent TSF
> value to be sent to user space.

This really should come *after* the second patch, not before.

I'd have reordered it, but now that you need to fix the second patch
anyway it'll be easier if you also reorder and reword this.

johannes


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

end of thread, other threads:[~2019-12-13  9:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-22 17:14 [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature James Prestwood
2019-11-22 17:14 ` [PATCH v3 2/2] mac80211_hwsim: set rx_status mactime/flag for wmediumd path James Prestwood
2019-12-13  9:52   ` Johannes Berg
2019-12-13  9:53 ` [PATCH v3 1/2] mac80211_hwsim: enable parent TSF feature Johannes Berg

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