diff options
author | Thomas Pedersen <thomas@adapt-ip.com> | 2020-04-01 18:18:02 -0700 |
---|---|---|
committer | Johannes Berg <johannes.berg@intel.com> | 2020-04-24 12:33:43 +0200 |
commit | b572510100165ba037ba43dbbb0f05e8da12c741 (patch) | |
tree | 417043581dccf5f926c048cb6c6df52b5ccfd3ce /include/linux/ieee80211.h | |
parent | bdee75d2ac23a1db30d3c689665a584c20220f97 (diff) | |
download | lwn-b572510100165ba037ba43dbbb0f05e8da12c741.tar.gz lwn-b572510100165ba037ba43dbbb0f05e8da12c741.zip |
ieee80211: share 802.11 unit conversion helpers
MHZ_TO_KHZ, and KHZ_TO_MHZ are useful to drivers and
elsewhere so export these in the common ieee80211 header.
Move the power helpers also because we might as well.
Signed-off-by: Thomas Pedersen <thomas@adapt-ip.com>
Link: https://lore.kernel.org/r/20200402011810.22947-2-thomas@adapt-ip.com
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Diffstat (limited to 'include/linux/ieee80211.h')
-rw-r--r-- | include/linux/ieee80211.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/linux/ieee80211.h b/include/linux/ieee80211.h index 38f513ce7528..a561db435a4b 100644 --- a/include/linux/ieee80211.h +++ b/include/linux/ieee80211.h @@ -3330,6 +3330,16 @@ static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size) #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024)) #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x)) +/* convert frequencies */ +#define MHZ_TO_KHZ(freq) ((freq) * 1000) +#define KHZ_TO_MHZ(freq) ((freq) / 1000) + +/* convert powers */ +#define DBI_TO_MBI(gain) ((gain) * 100) +#define MBI_TO_DBI(gain) ((gain) / 100) +#define DBM_TO_MBM(gain) ((gain) * 100) +#define MBM_TO_DBM(gain) ((gain) / 100) + /** * ieee80211_action_contains_tpc - checks if the frame contains TPC element * @skb: the skb containing the frame, length will be checked |