All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Berg <johannes@sipsolutions.net>
To: Marco Porsch <marco@cozybit.com>
Cc: mcgrof@qca.qualcomm.com, jouni@qca.qualcomm.com,
	vthiagar@qca.qualcomm.com, senthilb@qca.qualcomm.com,
	sleffler@google.com, linux-wireless@vger.kernel.org,
	devel@lists.open80211s.org, ath9k-devel@lists.ath9k.org
Subject: Re: [PATCHv2 1/3] mac80211: move mesh sync beacon handler into neighbour_update
Date: Wed, 20 Feb 2013 15:50:50 +0100	[thread overview]
Message-ID: <1361371850.8629.24.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1361203709-16669-1-git-send-email-marco@cozybit.com> (sfid-20130218_170844_711843_DDA91A7F)

On Mon, 2013-02-18 at 17:08 +0100, Marco Porsch wrote:

> +	/*
> +	 * If available, calculate the time the beacon timestamp field was
> +	 * received from the rx_status->mactime field. Otherwise get the
> +	 * current TSF as approximation before entering rcu-read section.
> +	 */
> +	if (ieee80211_have_rx_timestamp(rx_status))
> +		t_r = ieee80211_calculate_rx_timestamp(local, rx_status,
> +						       24 + 12 +
> +						       elems->total_len +
> +						       FCS_LEN,
> +						       24);

That doesn't seem right -- it's calculating the timestamp at the end of
the frame, but you said you wanted the timestamp at the "timestamp
field" time, which is just 24 bytes into the frame.

> +static void mesh_sync_offset_rx_bcn(struct sta_info *sta,
> +				    struct ieee80211_mgmt *mgmt,
> +				    struct ieee802_11_elems *elems,
> +				    u64 t_r)
>  {
> +	struct ieee80211_sub_if_data *sdata = sta->sdata;
>  	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
> -	struct ieee80211_local *local = sdata->local;
> -	struct sta_info *sta;
> -	u64 t_t, t_r;
> +	u64 t_t;
>  
>  	WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET);
>  
>  	/* standard mentions only beacons */
> -	if (stype != IEEE80211_STYPE_BEACON)
> +	if (!ieee80211_is_beacon(mgmt->frame_control))
>  		return;

This is a bit odd -- why should a function that's called _rx_bcn() have
to check it? Seems the check should be outside the API boundary.
 

> -	if (ieee80211_have_rx_timestamp(rx_status))
> -		/* time when timestamp field was received */
> -		t_r = ieee80211_calculate_rx_timestamp(local, rx_status,
> -						       24 + 12 +
> -						       elems->total_len +
> -						       FCS_LEN,
> -						       24);

I see this was already wrong ...

johannes


WARNING: multiple messages have this Message-ID (diff)
From: Johannes Berg <johannes@sipsolutions.net>
To: ath9k-devel@lists.ath9k.org
Subject: [ath9k-devel] [PATCHv2 1/3] mac80211: move mesh sync beacon handler into neighbour_update
Date: Wed, 20 Feb 2013 15:50:50 +0100	[thread overview]
Message-ID: <1361371850.8629.24.camel@jlt4.sipsolutions.net> (raw)
In-Reply-To: <1361203709-16669-1-git-send-email-marco@cozybit.com> (sfid-20130218_170844_711843_DDA91A7F)

On Mon, 2013-02-18 at 17:08 +0100, Marco Porsch wrote:

> +	/*
> +	 * If available, calculate the time the beacon timestamp field was
> +	 * received from the rx_status->mactime field. Otherwise get the
> +	 * current TSF as approximation before entering rcu-read section.
> +	 */
> +	if (ieee80211_have_rx_timestamp(rx_status))
> +		t_r = ieee80211_calculate_rx_timestamp(local, rx_status,
> +						       24 + 12 +
> +						       elems->total_len +
> +						       FCS_LEN,
> +						       24);

That doesn't seem right -- it's calculating the timestamp at the end of
the frame, but you said you wanted the timestamp at the "timestamp
field" time, which is just 24 bytes into the frame.

> +static void mesh_sync_offset_rx_bcn(struct sta_info *sta,
> +				    struct ieee80211_mgmt *mgmt,
> +				    struct ieee802_11_elems *elems,
> +				    u64 t_r)
>  {
> +	struct ieee80211_sub_if_data *sdata = sta->sdata;
>  	struct ieee80211_if_mesh *ifmsh = &sdata->u.mesh;
> -	struct ieee80211_local *local = sdata->local;
> -	struct sta_info *sta;
> -	u64 t_t, t_r;
> +	u64 t_t;
>  
>  	WARN_ON(ifmsh->mesh_sp_id != IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET);
>  
>  	/* standard mentions only beacons */
> -	if (stype != IEEE80211_STYPE_BEACON)
> +	if (!ieee80211_is_beacon(mgmt->frame_control))
>  		return;

This is a bit odd -- why should a function that's called _rx_bcn() have
to check it? Seems the check should be outside the API boundary.
 

> -	if (ieee80211_have_rx_timestamp(rx_status))
> -		/* time when timestamp field was received */
> -		t_r = ieee80211_calculate_rx_timestamp(local, rx_status,
> -						       24 + 12 +
> -						       elems->total_len +
> -						       FCS_LEN,
> -						       24);

I see this was already wrong ...

johannes

  parent reply	other threads:[~2013-02-20 14:51 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-18 16:08 [PATCHv2 1/3] mac80211: move mesh sync beacon handler into neighbour_update Marco Porsch
2013-02-18 16:08 ` [ath9k-devel] " Marco Porsch
2013-02-18 16:08 ` [PATCHv2 2/3] mac80211: mesh power save doze scheduling Marco Porsch
2013-02-18 16:08   ` [ath9k-devel] " Marco Porsch
2013-02-18 16:41   ` Christian Lamparter
2013-02-18 16:41     ` [ath9k-devel] " Christian Lamparter
2013-02-20 15:01   ` Johannes Berg
2013-02-20 15:01     ` [ath9k-devel] " Johannes Berg
2013-02-25 10:06     ` Marco Porsch
2013-02-25 10:06       ` [ath9k-devel] " Marco Porsch
2013-02-26 20:52       ` Johannes Berg
2013-02-26 20:52         ` [ath9k-devel] " Johannes Berg
2013-02-18 16:08 ` [PATCHv2 3/3] ath9k: mesh powersave support Marco Porsch
2013-02-18 16:08   ` [ath9k-devel] " Marco Porsch
2013-02-20 14:50 ` Johannes Berg [this message]
2013-02-20 14:50   ` [ath9k-devel] [PATCHv2 1/3] mac80211: move mesh sync beacon handler into neighbour_update Johannes Berg
2013-02-20 18:26   ` Thomas Pedersen
2013-02-20 18:26     ` [ath9k-devel] " Thomas Pedersen
2013-02-20 20:00     ` Johannes Berg
2013-02-20 20:00       ` [ath9k-devel] " Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1361371850.8629.24.camel@jlt4.sipsolutions.net \
    --to=johannes@sipsolutions.net \
    --cc=ath9k-devel@lists.ath9k.org \
    --cc=devel@lists.open80211s.org \
    --cc=jouni@qca.qualcomm.com \
    --cc=linux-wireless@vger.kernel.org \
    --cc=marco@cozybit.com \
    --cc=mcgrof@qca.qualcomm.com \
    --cc=senthilb@qca.qualcomm.com \
    --cc=sleffler@google.com \
    --cc=vthiagar@qca.qualcomm.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.