diff options
Diffstat (limited to 'include/net/mac80211.h')
-rw-r--r-- | include/net/mac80211.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 003e4a03874e..f5f5b1ff1584 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1800,4 +1800,72 @@ void ieee80211_notify_mac(struct ieee80211_hw *hw, | |||
1800 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, | 1800 | struct ieee80211_sta *ieee80211_find_sta(struct ieee80211_hw *hw, |
1801 | const u8 *addr); | 1801 | const u8 *addr); |
1802 | 1802 | ||
1803 | |||
1804 | /* Rate control API */ | ||
1805 | /** | ||
1806 | * struct rate_selection - rate information for/from rate control algorithms | ||
1807 | * | ||
1808 | * @rate_idx: selected transmission rate index | ||
1809 | * @nonerp_idx: Non-ERP rate to use instead if ERP cannot be used | ||
1810 | * @probe_idx: rate for probing (or -1) | ||
1811 | * @max_rate_idx: maximum rate index that can be used, this is | ||
1812 | * input to the algorithm and will be enforced | ||
1813 | */ | ||
1814 | struct rate_selection { | ||
1815 | s8 rate_idx, nonerp_idx, probe_idx, max_rate_idx; | ||
1816 | }; | ||
1817 | |||
1818 | struct rate_control_ops { | ||
1819 | struct module *module; | ||
1820 | const char *name; | ||
1821 | void *(*alloc)(struct ieee80211_hw *hw, struct dentry *debugfsdir); | ||
1822 | void (*clear)(void *priv); | ||
1823 | void (*free)(void *priv); | ||
1824 | |||
1825 | void *(*alloc_sta)(void *priv, struct ieee80211_sta *sta, gfp_t gfp); | ||
1826 | void (*rate_init)(void *priv, struct ieee80211_supported_band *sband, | ||
1827 | struct ieee80211_sta *sta, void *priv_sta); | ||
1828 | void (*free_sta)(void *priv, struct ieee80211_sta *sta, | ||
1829 | void *priv_sta); | ||
1830 | |||
1831 | void (*tx_status)(void *priv, struct ieee80211_supported_band *sband, | ||
1832 | struct ieee80211_sta *sta, void *priv_sta, | ||
1833 | struct sk_buff *skb); | ||
1834 | void (*get_rate)(void *priv, struct ieee80211_supported_band *sband, | ||
1835 | struct ieee80211_sta *sta, void *priv_sta, | ||
1836 | struct sk_buff *skb, | ||
1837 | struct rate_selection *sel); | ||
1838 | |||
1839 | void (*add_sta_debugfs)(void *priv, void *priv_sta, | ||
1840 | struct dentry *dir); | ||
1841 | void (*remove_sta_debugfs)(void *priv, void *priv_sta); | ||
1842 | }; | ||
1843 | |||
1844 | static inline int rate_supported(struct ieee80211_sta *sta, | ||
1845 | enum ieee80211_band band, | ||
1846 | int index) | ||
1847 | { | ||
1848 | return (sta == NULL || sta->supp_rates[band] & BIT(index)); | ||
1849 | } | ||
1850 | |||
1851 | static inline s8 | ||
1852 | rate_lowest_index(struct ieee80211_supported_band *sband, | ||
1853 | struct ieee80211_sta *sta) | ||
1854 | { | ||
1855 | int i; | ||
1856 | |||
1857 | for (i = 0; i < sband->n_bitrates; i++) | ||
1858 | if (rate_supported(sta, sband->band, i)) | ||
1859 | return i; | ||
1860 | |||
1861 | /* warn when we cannot find a rate. */ | ||
1862 | WARN_ON(1); | ||
1863 | |||
1864 | return 0; | ||
1865 | } | ||
1866 | |||
1867 | |||
1868 | int ieee80211_rate_control_register(struct rate_control_ops *ops); | ||
1869 | void ieee80211_rate_control_unregister(struct rate_control_ops *ops); | ||
1870 | |||
1803 | #endif /* MAC80211_H */ | 1871 | #endif /* MAC80211_H */ |