forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
mac80211: use bitfield macros for encoded rate
Instead of hand-coding the bit manipulations, use the bitfield macros to generate the code for the encoded bitrate. Signed-off-by: Johannes Berg <[email protected]>
- Loading branch information
1 parent
8613c94
commit dcba665
Showing
2 changed files
with
50 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
* Copyright 2002-2005, Instant802 Networks, Inc. | ||
* Copyright 2006-2007 Jiri Benc <[email protected]> | ||
* Copyright 2013-2014 Intel Mobile Communications GmbH | ||
* Copyright (C) 2015 - 2016 Intel Deutschland GmbH | ||
* Copyright (C) 2015 - 2017 Intel Deutschland GmbH | ||
* | ||
* This program is free software; you can redistribute it and/or modify | ||
* it under the terms of the GNU General Public License version 2 as | ||
|
@@ -1957,27 +1957,32 @@ sta_get_last_rx_stats(struct sta_info *sta) | |
static void sta_stats_decode_rate(struct ieee80211_local *local, u16 rate, | ||
struct rate_info *rinfo) | ||
{ | ||
rinfo->bw = (rate & STA_STATS_RATE_BW_MASK) >> | ||
STA_STATS_RATE_BW_SHIFT; | ||
rinfo->bw = STA_STATS_GET(BW, rate); | ||
|
||
switch (rate & STA_STATS_RATE_TYPE_MASK) { | ||
switch (STA_STATS_GET(TYPE, rate)) { | ||
case STA_STATS_RATE_TYPE_VHT: | ||
rinfo->flags = RATE_INFO_FLAGS_VHT_MCS; | ||
rinfo->mcs = rate & 0xf; | ||
rinfo->nss = (rate & 0xf0) >> 4; | ||
rinfo->mcs = STA_STATS_GET(VHT_MCS, rate); | ||
rinfo->nss = STA_STATS_GET(VHT_NSS, rate); | ||
if (STA_STATS_GET(SGI, rate)) | ||
rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; | ||
break; | ||
case STA_STATS_RATE_TYPE_HT: | ||
rinfo->flags = RATE_INFO_FLAGS_MCS; | ||
rinfo->mcs = rate & 0xff; | ||
rinfo->mcs = STA_STATS_GET(HT_MCS, rate); | ||
if (STA_STATS_GET(SGI, rate)) | ||
rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; | ||
break; | ||
case STA_STATS_RATE_TYPE_LEGACY: { | ||
struct ieee80211_supported_band *sband; | ||
u16 brate; | ||
unsigned int shift; | ||
int band = STA_STATS_GET(LEGACY_BAND, rate); | ||
int rate_idx = STA_STATS_GET(LEGACY_IDX, rate); | ||
|
||
rinfo->flags = 0; | ||
sband = local->hw.wiphy->bands[(rate >> 4) & 0xf]; | ||
brate = sband->bitrates[rate & 0xf].bitrate; | ||
sband = local->hw.wiphy->bands[band]; | ||
brate = sband->bitrates[rate_idx].bitrate; | ||
if (rinfo->bw == RATE_INFO_BW_5) | ||
shift = 2; | ||
else if (rinfo->bw == RATE_INFO_BW_10) | ||
|
@@ -1988,9 +1993,6 @@ static void sta_stats_decode_rate(struct ieee80211_local *local, u16 rate, | |
break; | ||
} | ||
} | ||
|
||
if (rate & STA_STATS_RATE_SGI) | ||
rinfo->flags |= RATE_INFO_FLAGS_SHORT_GI; | ||
} | ||
|
||
static int sta_set_rate_info_rx(struct sta_info *sta, struct rate_info *rinfo) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters