Blame view

net/mac80211/rate.h 2.88 KB
d2912cb15   Thomas Gleixner   treewide: Replace...
1
  /* SPDX-License-Identifier: GPL-2.0-only */
f0706e828   Jiri Benc   [MAC80211]: Add m...
2
3
4
5
  /*
   * Copyright 2002-2005, Instant802 Networks, Inc.
   * Copyright 2005, Devicescape Software, Inc.
   * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
f0706e828   Jiri Benc   [MAC80211]: Add m...
6
7
8
9
10
11
12
13
14
15
16
   */
  
  #ifndef IEEE80211_RATE_H
  #define IEEE80211_RATE_H
  
  #include <linux/netdevice.h>
  #include <linux/skbuff.h>
  #include <linux/types.h>
  #include <net/mac80211.h>
  #include "ieee80211_i.h"
  #include "sta_info.h"
8f727ef3c   Johannes Berg   mac80211: notify ...
17
  #include "driver-ops.h"
f0706e828   Jiri Benc   [MAC80211]: Add m...
18

f0706e828   Jiri Benc   [MAC80211]: Add m...
19
  struct rate_control_ref {
631ad703b   Johannes Berg   mac80211: make ra...
20
  	const struct rate_control_ops *ops;
f0706e828   Jiri Benc   [MAC80211]: Add m...
21
  	void *priv;
f0706e828   Jiri Benc   [MAC80211]: Add m...
22
  };
4b7679a56   Johannes Berg   mac80211: clean u...
23
  void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
e6a9854b0   Johannes Berg   mac80211/drivers:...
24
25
  			   struct sta_info *sta,
  			   struct ieee80211_tx_rate_control *txrc);
f0706e828   Jiri Benc   [MAC80211]: Add m...
26

18fb84d98   Felix Fietkau   mac80211: make ra...
27
28
29
  void rate_control_tx_status(struct ieee80211_local *local,
  			    struct ieee80211_supported_band *sband,
  			    struct ieee80211_tx_status *st);
f0706e828   Jiri Benc   [MAC80211]: Add m...
30

eb6d9293d   Denys Vlasenko   mac80211: deinlin...
31
32
  void rate_control_rate_init(struct sta_info *sta);
  void rate_control_rate_update(struct ieee80211_local *local,
81cb7623a   Sujith   mac80211: Extend ...
33
  				    struct ieee80211_supported_band *sband,
eb6d9293d   Denys Vlasenko   mac80211: deinlin...
34
  				    struct sta_info *sta, u32 changed);
f0706e828   Jiri Benc   [MAC80211]: Add m...
35

f0706e828   Jiri Benc   [MAC80211]: Add m...
36
  static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
35c347ac5   Johannes Berg   mac80211: lock ra...
37
  					   struct sta_info *sta, gfp_t gfp)
f0706e828   Jiri Benc   [MAC80211]: Add m...
38
  {
35c347ac5   Johannes Berg   mac80211: lock ra...
39
40
  	spin_lock_init(&sta->rate_ctrl_lock);
  	return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
f0706e828   Jiri Benc   [MAC80211]: Add m...
41
  }
4b7679a56   Johannes Berg   mac80211: clean u...
42
  static inline void rate_control_free_sta(struct sta_info *sta)
f0706e828   Jiri Benc   [MAC80211]: Add m...
43
  {
4b7679a56   Johannes Berg   mac80211: clean u...
44
45
46
47
48
  	struct rate_control_ref *ref = sta->rate_ctrl;
  	struct ieee80211_sta *ista = &sta->sta;
  	void *priv_sta = sta->rate_ctrl_priv;
  
  	ref->ops->free_sta(ref->priv, ista, priv_sta);
f0706e828   Jiri Benc   [MAC80211]: Add m...
49
  }
e9f207f0f   Jiri Benc   [MAC80211]: Add d...
50
51
52
53
  static inline void rate_control_add_sta_debugfs(struct sta_info *sta)
  {
  #ifdef CONFIG_MAC80211_DEBUGFS
  	struct rate_control_ref *ref = sta->rate_ctrl;
fc4a25c5b   Johannes Berg   mac80211: remove ...
54
  	if (ref && sta->debugfs_dir && ref->ops->add_sta_debugfs)
e9f207f0f   Jiri Benc   [MAC80211]: Add d...
55
  		ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv,
fc4a25c5b   Johannes Berg   mac80211: remove ...
56
  					  sta->debugfs_dir);
e9f207f0f   Jiri Benc   [MAC80211]: Add d...
57
58
  #endif
  }
6cb5f3ea4   Johannes Berg   mac80211: populat...
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
  extern const struct file_operations rcname_ops;
  
  static inline void rate_control_add_debugfs(struct ieee80211_local *local)
  {
  #ifdef CONFIG_MAC80211_DEBUGFS
  	struct dentry *debugfsdir;
  
  	if (!local->rate_ctrl)
  		return;
  
  	if (!local->rate_ctrl->ops->add_debugfs)
  		return;
  
  	debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir);
  	local->debugfs.rcdir = debugfsdir;
  	debugfs_create_file("name", 0400, debugfsdir,
  			    local->rate_ctrl, &rcname_ops);
  
  	local->rate_ctrl->ops->add_debugfs(&local->hw, local->rate_ctrl->priv,
  					   debugfsdir);
  #endif
  }
e8e4f5280   Johannes Berg   mac80211: reject/...
81
  void ieee80211_check_rate_mask(struct ieee80211_sub_if_data *sdata);
209c671db   Andres Salomon   mac80211: make ra...
82
83
  /* Get a reference to the rate control algorithm. If `name' is NULL, get the
   * first available algorithm. */
ff6880892   Johannes Berg   [MAC80211]: move ...
84
85
86
  int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
  				 const char *name);
  void rate_control_deinitialize(struct ieee80211_local *local);
4b475898e   Johannes Berg   mac80211: better ...
87
88
  
  /* Rate control algorithms */
cccf129f8   Felix Fietkau   mac80211: add the...
89
  #ifdef CONFIG_MAC80211_RC_MINSTREL
c1b1203d6   Joe Perches   net: misc: Remove...
90
91
  int rc80211_minstrel_init(void);
  void rc80211_minstrel_exit(void);
cccf129f8   Felix Fietkau   mac80211: add the...
92
93
94
95
96
97
98
99
100
  #else
  static inline int rc80211_minstrel_init(void)
  {
  	return 0;
  }
  static inline void rc80211_minstrel_exit(void)
  {
  }
  #endif
f0706e828   Jiri Benc   [MAC80211]: Add m...
101
  #endif /* IEEE80211_RATE_H */