All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/4] Mesh sync fixes
@ 2012-04-12 21:32 Javier Cardona
  2012-04-12 21:32 ` [PATCH 1/4] mac80211: Set the correct values for hwmp (1) and airtimeLinkMetric (1) Javier Cardona
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Javier Cardona @ 2012-04-12 21:32 UTC (permalink / raw)
  To: John W. Linville
  Cc: Javier Cardona, Marco Porsch, Pavel Zubarev, Johannes Berg,
	devel, ashok, linux-wireless

We noticed these while testing mesh synchronization.

Javier Cardona (4):
  mac80211: Set the correct values for hwmp (1) and airtimeLinkMetric
    (1)
  mac80211_hwsim: fixup for tsf setting
  mac80211: Choose a new toffset setpoint if a big tsf jump is
    detected.
  mac80211: Take into account TSF adjustment latency in Toffset
    setpoint

 drivers/net/wireless/mac80211_hwsim.c |    1 +
 include/linux/ieee80211.h             |    4 ++--
 net/mac80211/mesh_sync.c              |   32 ++++++++++++++++++++++++++------
 3 files changed, 29 insertions(+), 8 deletions(-)

-- 
1.7.5.4


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

* [PATCH 1/4] mac80211: Set the correct values for hwmp (1) and airtimeLinkMetric (1)
  2012-04-12 21:32 [PATCH 0/4] Mesh sync fixes Javier Cardona
@ 2012-04-12 21:32 ` Javier Cardona
  2012-04-12 21:32 ` [PATCH 2/4] mac80211_hwsim: fixup for tsf setting Javier Cardona
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Javier Cardona @ 2012-04-12 21:32 UTC (permalink / raw)
  To: John W. Linville
  Cc: Javier Cardona, Marco Porsch, Pavel Zubarev, Johannes Berg,
	devel, ashok, linux-wireless

Per sections 8.4.2.100.2 and 8.4.2.100.3 of Std 802.11-2012

Reported-by: Shinichi Hotori <hotorinn@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 include/linux/ieee80211.h |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h
index db84e2f..ce9af89 100644
--- a/include/linux/ieee80211.h
+++ b/include/linux/ieee80211.h
@@ -1458,7 +1458,7 @@ enum {
  * be specified in a vendor specific information element
  */
 enum {
-	IEEE80211_PATH_PROTOCOL_HWMP = 0,
+	IEEE80211_PATH_PROTOCOL_HWMP = 1,
 	IEEE80211_PATH_PROTOCOL_VENDOR = 255,
 };
 
@@ -1470,7 +1470,7 @@ enum {
  * specified in a vendor specific information element
  */
 enum {
-	IEEE80211_PATH_METRIC_AIRTIME = 0,
+	IEEE80211_PATH_METRIC_AIRTIME = 1,
 	IEEE80211_PATH_METRIC_VENDOR = 255,
 };
 
-- 
1.7.5.4


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

* [PATCH 2/4] mac80211_hwsim: fixup for tsf setting
  2012-04-12 21:32 [PATCH 0/4] Mesh sync fixes Javier Cardona
  2012-04-12 21:32 ` [PATCH 1/4] mac80211: Set the correct values for hwmp (1) and airtimeLinkMetric (1) Javier Cardona
@ 2012-04-12 21:32 ` Javier Cardona
  2012-04-12 21:32 ` [PATCH 3/4] mac80211: Choose a new toffset setpoint if a big tsf jump is detected Javier Cardona
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Javier Cardona @ 2012-04-12 21:32 UTC (permalink / raw)
  To: John W. Linville
  Cc: Javier Cardona, Marco Porsch, Pavel Zubarev, Johannes Berg,
	devel, ashok, linux-wireless

Last patch I sent failed to take into account the offset of each phy.

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 drivers/net/wireless/mac80211_hwsim.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c
index 2d2bfce..3edd473 100644
--- a/drivers/net/wireless/mac80211_hwsim.c
+++ b/drivers/net/wireless/mac80211_hwsim.c
@@ -694,6 +694,7 @@ static bool mac80211_hwsim_tx_frame_no_nl(struct ieee80211_hw *hw,
 		    ieee80211_is_probe_resp(mgmt->frame_control))
 			mgmt->u.beacon.timestamp = cpu_to_le64(
 				rx_status.mactime +
+				(data->tsf_offset - data2->tsf_offset) +
 				24 * 8 * 10 / txrate->bitrate);
 
 		memcpy(IEEE80211_SKB_RXCB(nskb), &rx_status, sizeof(rx_status));
-- 
1.7.5.4


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

* [PATCH 3/4] mac80211: Choose a new toffset setpoint if a big tsf jump is detected.
  2012-04-12 21:32 [PATCH 0/4] Mesh sync fixes Javier Cardona
  2012-04-12 21:32 ` [PATCH 1/4] mac80211: Set the correct values for hwmp (1) and airtimeLinkMetric (1) Javier Cardona
  2012-04-12 21:32 ` [PATCH 2/4] mac80211_hwsim: fixup for tsf setting Javier Cardona
@ 2012-04-12 21:32 ` Javier Cardona
  2012-04-12 21:32 ` [PATCH 4/4] mac80211: Take into account TSF adjustment latency in Toffset setpoint Javier Cardona
  2012-04-18  1:59 ` [PATCH 0/4] Mesh sync fixes Johannes Berg
  4 siblings, 0 replies; 6+ messages in thread
From: Javier Cardona @ 2012-04-12 21:32 UTC (permalink / raw)
  To: John W. Linville
  Cc: Javier Cardona, Marco Porsch, Pavel Zubarev, Johannes Berg,
	devel, ashok, linux-wireless

Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/mesh_sync.c |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index f78b013..22a5f1e 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -22,7 +22,14 @@
 /* This is not in the standard.  It represents a tolerable tbtt drift below
  * which we do no TSF adjustment.
  */
-#define TBTT_MINIMUM_ADJUSTMENT 10
+#define TOFFSET_MINIMUM_ADJUSTMENT 10
+
+/* This is not in the standard.  It represents the maximum Toffset jump above
+ * which we'll invalidate the Toffset setpoint and choose a new setpoint.  This
+ * could be, for instance, in case a neighbor is restarted and its TSF counter
+ * reset.
+ * */
+#define TOFFSET_MAXIMUM_ADJUSTMENT 30000		/* 30 ms */
 
 struct sync_method {
 	u8 method;
@@ -156,15 +163,22 @@ static void mesh_sync_offset_rx_bcn_presp(struct ieee80211_sub_if_data *sdata,
 	if (test_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN)) {
 		s64 t_clockdrift = sta->t_offset_setpoint
 				   - sta->t_offset;
-
-		msync_dbg("STA %pM : sta->t_offset=%lld,"
-			  " sta->t_offset_setpoint=%lld,"
-			  " t_clockdrift=%lld",
+		msync_dbg("STA %pM : sta->t_offset=%lld, sta->t_offset_setpoint=%lld, t_clockdrift=%lld",
 			  sta->sta.addr,
 			  (long long) sta->t_offset,
 			  (long long)
 			  sta->t_offset_setpoint,
 			  (long long) t_clockdrift);
+
+		if (t_clockdrift > TOFFSET_MAXIMUM_ADJUSTMENT ||
+			t_clockdrift < -TOFFSET_MAXIMUM_ADJUSTMENT) {
+			msync_dbg("STA %pM : t_clockdrift=%lld too large, setpoint reset",
+				  sta->sta.addr,
+				  (long long) t_clockdrift);
+			clear_sta_flag(sta, WLAN_STA_TOFFSET_KNOWN);
+			goto no_sync;
+		}
+
 		rcu_read_unlock();
 
 		spin_lock_bh(&ifmsh->sync_offset_lock);
@@ -200,7 +214,7 @@ static void mesh_sync_offset_adjust_tbtt(struct ieee80211_sub_if_data *sdata)
 	spin_lock_bh(&ifmsh->sync_offset_lock);
 
 	if (ifmsh->sync_offset_clockdrift_max >
-		TBTT_MINIMUM_ADJUSTMENT) {
+		TOFFSET_MINIMUM_ADJUSTMENT) {
 		/* Since ajusting the tsf here would
 		 * require a possibly blocking call
 		 * to the driver tsf setter, we punt
-- 
1.7.5.4


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

* [PATCH 4/4] mac80211: Take into account TSF adjustment latency in Toffset setpoint
  2012-04-12 21:32 [PATCH 0/4] Mesh sync fixes Javier Cardona
                   ` (2 preceding siblings ...)
  2012-04-12 21:32 ` [PATCH 3/4] mac80211: Choose a new toffset setpoint if a big tsf jump is detected Javier Cardona
@ 2012-04-12 21:32 ` Javier Cardona
  2012-04-18  1:59 ` [PATCH 0/4] Mesh sync fixes Johannes Berg
  4 siblings, 0 replies; 6+ messages in thread
From: Javier Cardona @ 2012-04-12 21:32 UTC (permalink / raw)
  To: John W. Linville
  Cc: Javier Cardona, Shinichi Hotori, Yu Niiro, Marco Porsch,
	Pavel Zubarev, Johannes Berg, devel, ashok, linux-wireless

When testing mesh synchronization we observed a global TSF slowdown that
was dependent on the number of synchronized mesh stations.  This seems
to be caused by the TSF adjustment (read/write) latency.

Adding a small margin to the Toffset setpoint solved the problem.

Signed-off-by: Shinichi Hotori <hotorinn@gmail.com>
Signed-off-by: Yu Niiro <yu.niiro@gmail.com>
Signed-off-by: Javier Cardona <javier@cozybit.com>
---
 net/mac80211/mesh_sync.c |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/net/mac80211/mesh_sync.c b/net/mac80211/mesh_sync.c
index 22a5f1e..ff60d6b 100644
--- a/net/mac80211/mesh_sync.c
+++ b/net/mac80211/mesh_sync.c
@@ -24,11 +24,17 @@
  */
 #define TOFFSET_MINIMUM_ADJUSTMENT 10
 
+/* This is not in the standard. It is a margin added to the
+ * Toffset setpoint to mitigate TSF overcorrection
+ * introduced by TSF adjustment latency.
+ */
+#define TOFFSET_SET_MARGIN 20
+
 /* This is not in the standard.  It represents the maximum Toffset jump above
  * which we'll invalidate the Toffset setpoint and choose a new setpoint.  This
  * could be, for instance, in case a neighbor is restarted and its TSF counter
  * reset.
- * */
+ */
 #define TOFFSET_MAXIMUM_ADJUSTMENT 30000		/* 30 ms */
 
 struct sync_method {
-- 
1.7.5.4


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

* Re: [PATCH 0/4] Mesh sync fixes
  2012-04-12 21:32 [PATCH 0/4] Mesh sync fixes Javier Cardona
                   ` (3 preceding siblings ...)
  2012-04-12 21:32 ` [PATCH 4/4] mac80211: Take into account TSF adjustment latency in Toffset setpoint Javier Cardona
@ 2012-04-18  1:59 ` Johannes Berg
  4 siblings, 0 replies; 6+ messages in thread
From: Johannes Berg @ 2012-04-18  1:59 UTC (permalink / raw)
  To: Javier Cardona
  Cc: John W. Linville, Marco Porsch, Pavel Zubarev, devel, ashok,
	linux-wireless

On Thu, 2012-04-12 at 14:32 -0700, Javier Cardona wrote:
> We noticed these while testing mesh synchronization.

I think these patches were merged, but there seems to have been some
confusion about what changes belong into what patch -- please try to be
more careful about that.

Also -- no users for TOFFSET_SET_MARGIN?

johannes


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

end of thread, other threads:[~2012-04-18  2:00 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-12 21:32 [PATCH 0/4] Mesh sync fixes Javier Cardona
2012-04-12 21:32 ` [PATCH 1/4] mac80211: Set the correct values for hwmp (1) and airtimeLinkMetric (1) Javier Cardona
2012-04-12 21:32 ` [PATCH 2/4] mac80211_hwsim: fixup for tsf setting Javier Cardona
2012-04-12 21:32 ` [PATCH 3/4] mac80211: Choose a new toffset setpoint if a big tsf jump is detected Javier Cardona
2012-04-12 21:32 ` [PATCH 4/4] mac80211: Take into account TSF adjustment latency in Toffset setpoint Javier Cardona
2012-04-18  1:59 ` [PATCH 0/4] Mesh sync fixes Johannes Berg

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.