Skip to contentSkip to conversation

mac80211: fix TX status reporting for ieee80211s

PATCH In review Yuan-Chi Pang 2 participants 5 messages Aug 31, 2018 – Sep 6, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 mac80211: fix TX status reporting for ieee80211s

ieee80211s_update_metric works only if wireless
driver passes tx_status of data frame to mac80211

Make API and caller of ieee80211s_update_metric to be similar to rate_control_tx_status

---
 net/mac80211/mesh.h      | 2 +-
 net/mac80211/mesh_hwmp.c | 8 ++------
 net/mac80211/status.c    | 4 +++-
 3 files changed, 6 insertions(+), 8 deletions(-)
net/mac80211/mesh.h +1 -1
index ee56f18..3c6095a 100644
@@ -217,7 +217,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
 void ieee80211s_init(void);
 void ieee80211s_update_metric(struct ieee80211_local *local,
-			      struct sta_info *sta, struct sk_buff *skb);
+			struct sta_info *sta, struct ieee80211_tx_status *st);
 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata);
 void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata);
 int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
net/mac80211/mesh_hwmp.c +2 -6
index daf9db3..4286673 100644
@@ -295,15 +295,11 @@ int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,
 }
 
 void ieee80211s_update_metric(struct ieee80211_local *local,
-		struct sta_info *sta, struct sk_buff *skb)
+		struct sta_info *sta, struct ieee80211_tx_status *st)
 {
-	struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	struct ieee80211_tx_info *txinfo = st->info;
 	int failed;
 
-	if (!ieee80211_is_data(hdr->frame_control))
-		return;
-
 	failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
 
 	/* moving average, scaled to 100.
net/mac80211/status.c +3 -1
index 9a6d720..dfcd419 100644
@@ -811,7 +811,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
 
 		rate_control_tx_status(local, sband, status);
 		if (ieee80211_vif_is_mesh(&sta->sdata->vif))
-			ieee80211s_update_metric(local, sta, skb);
+			ieee80211s_update_metric(local, sta, status);
 
 		if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
 			ieee80211_frame_acked(sta, skb);
@@ -972,6 +972,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 		}
 
 		rate_control_tx_status(local, sband, status);
+		if (ieee80211_vif_is_mesh(&sta->sdata->vif))
+			ieee80211s_update_metric(local, sta, status);
 	}
 
 	if (acked || noack_success) {
Signature · 1 line
2.7.4
maintainer
#1 lore raw

net/mac80211/mesh.h void mesh_rmc_free(struct ieee80211_sub_if_data *sdata); · line 220

Quoted 4 lines · Yuan-Chi Pang

void ieee80211s_init(void);
void ieee80211s_update_metric(struct ieee80211_local *local,

net/mac80211/mesh.h +1 -1
-			      struct sta_info *sta, struct sk_buff *skb);
+			struct sta_info *sta, struct ieee80211_tx_status *st);

please keep things indented properly

net/mac80211/mesh_hwmp.c int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata, · line 298

Quoted 3 lines

void ieee80211s_update_metric(struct ieee80211_local *local,

net/mac80211/mesh_hwmp.c +1 -1
-		struct sta_info *sta, struct sk_buff *skb)
+		struct sta_info *sta, struct ieee80211_tx_status *st)

and maybe fix the indentation here while you're changing it

net/mac80211/mesh_hwmp.c int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata, · line 305

Quoted 8 lines

{

net/mac80211/mesh_hwmp.c +1 -4
-	struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	struct ieee80211_tx_info *txinfo = st->info;
 	int failed;
 
-	if (!ieee80211_is_data(hdr->frame_control))
-		return;

Why are you removing this condition? You didn't say anything about that.

I sort of see why (you no longer even have the skb/hdr), but you should indicate why this is OK.

net/mac80211/status.c void ieee80211_tx_status_ext(struct ieee80211_hw *hw,

Quoted 3 lines
net/mac80211/status.c +2 -0
 		rate_control_tx_status(local, sband, status);
+		if (ieee80211_vif_is_mesh(&sta->sdata->vif))
+			ieee80211s_update_metric(local, sta, status)

This is the only "real" change I guess, some more description about it would be good.

I can sort of reverse engineer it from your commit log, but you should be more explicit.

johannes

#2 lore raw

PATCH 1/1 mac80211: fix TX status reporting for ieee80211s

TX status reporting to ieee80211s is through ieee80211s_update_metric. There are two problems about ieee80211s_update_metric:

1. The purpose is to estimate the fail probability to a specific link. No need to restrict to data frame.

2. Current implementation does not work if wireless driver does not pass tx_status with skb.

Fix this by removing ieee80211_is_data condition, passing ieee80211_tx_status directly to ieee80211s_update_metric, and putting it in both __ieee80211_tx_status and ieee80211_tx_status_ext.

---
 net/mac80211/mesh.h      | 2 +-
 net/mac80211/mesh_hwmp.c | 8 ++------
 net/mac80211/status.c    | 4 +++-
 3 files changed, 6 insertions(+), 8 deletions(-)
net/mac80211/mesh.h +1 -1
index ee56f18..7ffe56a 100644
@@ -217,7 +217,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data *sdata);
 int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
 void ieee80211s_init(void);
 void ieee80211s_update_metric(struct ieee80211_local *local,
-			      struct sta_info *sta, struct sk_buff *skb);
+			 struct sta_info *sta, struct ieee80211_tx_status *st);
 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata);
 void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata);
 int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
net/mac80211/mesh_hwmp.c +2 -6
index daf9db3..4286673 100644
@@ -295,15 +295,11 @@ int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,
 }
 
 void ieee80211s_update_metric(struct ieee80211_local *local,
-		struct sta_info *sta, struct sk_buff *skb)
+		struct sta_info *sta, struct ieee80211_tx_status *st)
 {
-	struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
+	struct ieee80211_tx_info *txinfo = st->info;
 	int failed;
 
-	if (!ieee80211_is_data(hdr->frame_control))
-		return;
-
 	failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
 
 	/* moving average, scaled to 100.
net/mac80211/status.c +3 -1
index 9a6d720..dfcd419 100644
@@ -811,7 +811,7 @@ static void __ieee80211_tx_status(struct ieee80211_hw *hw,
 
 		rate_control_tx_status(local, sband, status);
 		if (ieee80211_vif_is_mesh(&sta->sdata->vif))
-			ieee80211s_update_metric(local, sta, skb);
+			ieee80211s_update_metric(local, sta, status);
 
 		if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
 			ieee80211_frame_acked(sta, skb);
@@ -972,6 +972,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw *hw,
 		}
 
 		rate_control_tx_status(local, sband, status);
+		if (ieee80211_vif_is_mesh(&sta->sdata->vif))
+			ieee80211s_update_metric(local, sta, status);
 	}
 
 	if (acked || noack_success) {
Signature · 1 line
2.7.4
#3 lore raw
Quoted 34 lines · Yuan-Chi Pang

TX status reporting to ieee80211s is through ieee80211s_update_metric.
There are two problems about ieee80211s_update_metric:

1. The purpose is to estimate the fail probability to a specific link. No need to restrict to data frame.

2. Current implementation does not work if wireless driver does not pass tx_status with skb.

Fix this by removing ieee80211_is_data condition, passing ieee80211_tx_status directly to ieee80211s_update_metric, and putting it in both __ieee80211_tx_status and ieee80211_tx_status_ext.

---
 net/mac80211/mesh.h      | 2 +-
 net/mac80211/mesh_hwmp.c | 8 ++------
 net/mac80211/status.c    | 4 +++-

 3 files changed, 6 insertions(+), 8 deletions(-)
net/mac80211/mesh.h +1 -1
index ee56f18..7ffe56a 100644
@@ -217,7 +217,7 @@ void mesh_rmc_free(struct ieee80211_sub_if_data
 *sdata);
  int mesh_rmc_init(struct ieee80211_sub_if_data *sdata);
  void ieee80211s_init(void);
  void ieee80211s_update_metric(struct ieee80211_local *local,
-			      struct sta_info *sta, struct sk_buff
 *skb);
+			 struct sta_info *sta, struct
 ieee80211_tx_status *st);
Quoted 4 lines

 void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata); void ieee80211_mesh_teardown_sdata(struct ieee80211_sub_if_data *sdata);
 int ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);

I received the comment of my previous submission that I should fix indentation. But if I use the same indentation as before, I got "line over 80 characters" warning by checkpatch. What should I do?

Quoted 52 lines
net/mac80211/mesh_hwmp.c +0 -0
index daf9db3..4286673 100644
@@ -295,15 +295,11 @@ int mesh_path_error_tx(struct
 ieee80211_sub_if_data *sdata,
  }


 void ieee80211s_update_metric(struct ieee80211_local *local,

net/mac80211/mesh_hwmp.c +1 -1
-		struct sta_info *sta, struct sk_buff *skb)
+		struct sta_info *sta, struct ieee80211_tx_status

*st)
 {

net/mac80211/mesh_hwmp.c +0 -2
-	struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb);
-	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb-
Quoted 1 line

data;

net/mac80211/mesh_hwmp.c +1 -0
+	struct ieee80211_tx_info *txinfo = st->info;

  int failed;

net/mac80211/mesh_hwmp.c +0 -3
-	if (!ieee80211_is_data(hdr->frame_control))
-		return;
-

  failed = !(txinfo->flags & IEEE80211_TX_STAT_ACK);
  /* moving average, scaled to 100.

net/mac80211/status.c +0 -0
index 9a6d720..dfcd419 100644
@@ -811,7 +811,7 @@ static void __ieee80211_tx_status(struct
 ieee80211_hw *hw,


  rate_control_tx_status(local, sband, status); if (ieee80211_vif_is_mesh(&sta->sdata->vif))

net/mac80211/status.c +1 -1
-			ieee80211s_update_metric(local, sta, skb);
+			ieee80211s_update_metric(local, sta,

status);

  if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked)
  ieee80211_frame_acked(sta, skb);

net/mac80211/status.c +0 -0
@@ -972,6 +972,8 @@ void ieee80211_tx_status_ext(struct ieee80211_hw
 *hw,
  		}


  rate_control_tx_status(local, sband, status);

net/mac80211/status.c +2 -0
+		if (ieee80211_vif_is_mesh(&sta->sdata->vif))
+			ieee80211s_update_metric(local, sta,

status);
  }

  if (acked || noack_success) {

maintainer
#4 lore raw
Quoted 13 lines · Yuan-Chi Pang

I received the comment of my previous submission that I should fix indentation. But if I use the same indentation as before, I got "line over 80 characters" warning by checkpatch. What should I do?

Quoted 8 lines
net/mac80211/mesh_hwmp.c +0 -0
index daf9db3..4286673 100644
@@ -295,15 +295,11 @@ int mesh_path_error_tx(struct
 ieee80211_sub_if_data *sdata,
 }
 
Quoted 4 lines

net/mac80211/mesh_hwmp.c int mesh_path_error_tx(struct ieee80211_sub_if_data *sdata,

Quoted 4 lines
net/mac80211/mesh_hwmp.c +1 -1
 void ieee80211s_update_metric(struct ieee80211_local *local,
-		struct sta_info *sta, struct sk_buff *skb)
+		struct sta_info *sta, struct ieee80211_tx_status
 *st)

Here? Seems easy - add a linebreak between sta and status?

johannes