rate.h
Go to the documentation of this file.
00001 /*
00002  * Copyright 2002-2005, Instant802 Networks, Inc.
00003  * Copyright 2005, Devicescape Software, Inc.
00004  * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
00005  *
00006  * This program is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU General Public License version 2 as
00008  * published by the Free Software Foundation.
00009  */
00010 
00011 #ifndef IEEE80211_RATE_H
00012 #define IEEE80211_RATE_H
00013 
00014 #include <linux/netdevice.h>
00015 #include <linux/skbuff.h>
00016 #include <linux/types.h>
00017 #include <net/mac80211.h>
00018 #include "ieee80211_i.h"
00019 #include "sta_info.h"
00020 #include "driver-ops.h"
00021 
00022 struct rate_control_ref {
00023         struct ieee80211_local *local;
00024         struct rate_control_ops *ops;
00025         void *priv;
00026 };
00027 
00028 void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
00029                            struct sta_info *sta,
00030                            struct ieee80211_tx_rate_control *txrc);
00031 
00032 static inline void rate_control_tx_status(struct ieee80211_local *local,
00033                                           struct ieee80211_supported_band *sband,
00034                                           struct sta_info *sta,
00035                                           struct sk_buff *skb)
00036 {
00037         struct rate_control_ref *ref = local->rate_ctrl;
00038         struct ieee80211_sta *ista = &sta->sta;
00039         void *priv_sta = sta->rate_ctrl_priv;
00040 
00041         if (!ref || !test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
00042                 return;
00043 
00044         ref->ops->tx_status(ref->priv, sband, ista, priv_sta, skb);
00045 }
00046 
00047 
00048 static inline void rate_control_rate_init(struct sta_info *sta)
00049 {
00050         struct ieee80211_local *local = sta->sdata->local;
00051         struct rate_control_ref *ref = sta->rate_ctrl;
00052         struct ieee80211_sta *ista = &sta->sta;
00053         void *priv_sta = sta->rate_ctrl_priv;
00054         struct ieee80211_supported_band *sband;
00055 
00056         if (!ref)
00057                 return;
00058 
00059         sband = local->hw.wiphy->bands[local->hw.conf.channel->band];
00060 
00061         ref->ops->rate_init(ref->priv, sband, ista, priv_sta);
00062         set_sta_flag(sta, WLAN_STA_RATE_CONTROL);
00063 }
00064 
00065 static inline void rate_control_rate_update(struct ieee80211_local *local,
00066                                     struct ieee80211_supported_band *sband,
00067                                     struct sta_info *sta, u32 changed)
00068 {
00069         struct rate_control_ref *ref = local->rate_ctrl;
00070         struct ieee80211_sta *ista = &sta->sta;
00071         void *priv_sta = sta->rate_ctrl_priv;
00072 
00073         if (ref && ref->ops->rate_update)
00074                 ref->ops->rate_update(ref->priv, sband, ista,
00075                                       priv_sta, changed);
00076         drv_sta_rc_update(local, sta->sdata, &sta->sta, changed);
00077 }
00078 
00079 static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
00080                                            struct ieee80211_sta *sta,
00081                                            gfp_t gfp)
00082 {
00083         return ref->ops->alloc_sta(ref->priv, sta, gfp);
00084 }
00085 
00086 static inline void rate_control_free_sta(struct sta_info *sta)
00087 {
00088         struct rate_control_ref *ref = sta->rate_ctrl;
00089         struct ieee80211_sta *ista = &sta->sta;
00090         void *priv_sta = sta->rate_ctrl_priv;
00091 
00092         ref->ops->free_sta(ref->priv, ista, priv_sta);
00093 }
00094 
00095 static inline void rate_control_add_sta_debugfs(struct sta_info *sta)
00096 {
00097 #ifdef CONFIG_MAC80211_DEBUGFS
00098         struct rate_control_ref *ref = sta->rate_ctrl;
00099         if (ref && sta->debugfs.dir && ref->ops->add_sta_debugfs)
00100                 ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv,
00101                                           sta->debugfs.dir);
00102 #endif
00103 }
00104 
00105 static inline void rate_control_remove_sta_debugfs(struct sta_info *sta)
00106 {
00107 #ifdef CONFIG_MAC80211_DEBUGFS
00108         struct rate_control_ref *ref = sta->rate_ctrl;
00109         if (ref && ref->ops->remove_sta_debugfs)
00110                 ref->ops->remove_sta_debugfs(ref->priv, sta->rate_ctrl_priv);
00111 #endif
00112 }
00113 
00114 /* Get a reference to the rate control algorithm. If `name' is NULL, get the
00115  * first available algorithm. */
00116 int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
00117                                  const char *name);
00118 void rate_control_deinitialize(struct ieee80211_local *local);
00119 
00120 
00121 /* Rate control algorithms */
00122 #ifdef CONFIG_MAC80211_RC_PID
00123 extern int rc80211_pid_init(void);
00124 extern void rc80211_pid_exit(void);
00125 #else
00126 static inline int rc80211_pid_init(void)
00127 {
00128         return 0;
00129 }
00130 static inline void rc80211_pid_exit(void)
00131 {
00132 }
00133 #endif
00134 
00135 #ifdef CONFIG_MAC80211_RC_MINSTREL
00136 extern int rc80211_minstrel_init(void);
00137 extern void rc80211_minstrel_exit(void);
00138 #else
00139 static inline int rc80211_minstrel_init(void)
00140 {
00141         return 0;
00142 }
00143 static inline void rc80211_minstrel_exit(void)
00144 {
00145 }
00146 #endif
00147 
00148 #ifdef CONFIG_MAC80211_RC_MINSTREL_HT
00149 extern int rc80211_minstrel_ht_init(void);
00150 extern void rc80211_minstrel_ht_exit(void);
00151 #else
00152 static inline int rc80211_minstrel_ht_init(void)
00153 {
00154         return 0;
00155 }
00156 static inline void rc80211_minstrel_ht_exit(void)
00157 {
00158 }
00159 #endif
00160 
00161 
00162 #endif /* IEEE80211_RATE_H */


ros_rt_wmp
Author(s): Danilo Tardioli, dantard@unizar.es
autogenerated on Mon Oct 6 2014 08:27:10