Browse Source

mac80211: clean up rate info bandwidth setting

There's no need to do the same thing three times in
the different switch cases, pull that out to a single
place.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Johannes Berg 7 years ago
parent
commit
35f4962c01
1 changed files with 2 additions and 4 deletions
  1. 2 4
      net/mac80211/util.c

+ 2 - 4
net/mac80211/util.c

@@ -2793,12 +2793,13 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 
 
 	memset(&ri, 0, sizeof(ri));
 	memset(&ri, 0, sizeof(ri));
 
 
+	ri.bw = status->bw;
+
 	/* Fill cfg80211 rate info */
 	/* Fill cfg80211 rate info */
 	switch (status->encoding) {
 	switch (status->encoding) {
 	case RX_ENC_HT:
 	case RX_ENC_HT:
 		ri.mcs = status->rate_idx;
 		ri.mcs = status->rate_idx;
 		ri.flags |= RATE_INFO_FLAGS_MCS;
 		ri.flags |= RATE_INFO_FLAGS_MCS;
-		ri.bw = status->bw;
 		if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
 		if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
 			ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
 			ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
 		break;
 		break;
@@ -2806,7 +2807,6 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 		ri.flags |= RATE_INFO_FLAGS_VHT_MCS;
 		ri.flags |= RATE_INFO_FLAGS_VHT_MCS;
 		ri.mcs = status->rate_idx;
 		ri.mcs = status->rate_idx;
 		ri.nss = status->nss;
 		ri.nss = status->nss;
-		ri.bw = status->bw;
 		if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
 		if (status->enc_flags & RX_ENC_FLAG_SHORT_GI)
 			ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
 			ri.flags |= RATE_INFO_FLAGS_SHORT_GI;
 		break;
 		break;
@@ -2818,8 +2818,6 @@ u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
 		int shift = 0;
 		int shift = 0;
 		int bitrate;
 		int bitrate;
 
 
-		ri.bw = status->bw;
-
 		switch (status->bw) {
 		switch (status->bw) {
 		case RATE_INFO_BW_10:
 		case RATE_INFO_BW_10:
 			shift = 1;
 			shift = 1;