1 /* 2 * HT-related code for XRadio drivers 3 * 4 * Copyright (c) 2013 5 * Xradio Technology Co., Ltd. <www.xradiotech.com> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as 9 * published by the Free Software Foundation. 10 */ 11 #ifndef XRADIO_HT_H_INCLUDED 12 #define XRADIO_HT_H_INCLUDED 13 14 #include <net/mac80211.h> 15 16 struct xradio_ht_info { 17 struct ieee80211_sta_ht_cap ht_cap; 18 enum nl80211_channel_type channel_type; 19 u16 operation_mode; 20 }; 21 xradio_is_ht(const struct xradio_ht_info * ht_info)22static inline int xradio_is_ht(const struct xradio_ht_info *ht_info) 23 { 24 return ht_info->channel_type != NL80211_CHAN_NO_HT; 25 } 26 27 28 #ifdef SUPPORT_HT40 29 xradio_is_2040BSS(const struct xradio_ht_info * ht_info)30static inline int xradio_is_2040BSS(const struct xradio_ht_info *ht_info) 31 { 32 return xradio_is_ht(ht_info) && 33 (ht_info->ht_cap.cap&IEEE80211_HT_CAP_SUP_WIDTH_20_40); 34 } 35 36 xradio_ht_ShortGI(const struct xradio_ht_info * ht_info)37static inline int xradio_ht_ShortGI(const struct xradio_ht_info *ht_info) 38 { 39 return xradio_is_ht(ht_info) 40 && (ht_info->ht_cap.cap 41 & (IEEE80211_HT_CAP_SGI_20 42 | IEEE80211_HT_CAP_SGI_40)); 43 } 44 45 #endif 46 xradio_ht_greenfield(const struct xradio_ht_info * ht_info)47static inline int xradio_ht_greenfield(const struct xradio_ht_info *ht_info) 48 { 49 int ret = (xradio_is_ht(ht_info) && 50 (ht_info->ht_cap.cap & IEEE80211_HT_CAP_GRN_FLD) && 51 !(ht_info->operation_mode & IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT)); 52 return ret; 53 } 54 xradio_ht_ampdu_density(const struct xradio_ht_info * ht_info)55static inline int xradio_ht_ampdu_density(const struct xradio_ht_info *ht_info) 56 { 57 if (!xradio_is_ht(ht_info)) 58 return 0; 59 return ht_info->ht_cap.ampdu_density; 60 } 61 62 #endif /* XRADIO_HT_H_INCLUDED */ 63