]> git.ipfire.org Git - thirdparty/linux.git/blame - net/mac80211/rate.h
fs: indicate request originates from old mount API
[thirdparty/linux.git] / net / mac80211 / rate.h
CommitLineData
d2912cb1 1/* SPDX-License-Identifier: GPL-2.0-only */
f0706e82
JB
2/*
3 * Copyright 2002-2005, Instant802 Networks, Inc.
4 * Copyright 2005, Devicescape Software, Inc.
5 * Copyright (c) 2006 Jiri Benc <jbenc@suse.cz>
b4f85443 6 * Copyright (C) 2022 Intel Corporation
f0706e82
JB
7 */
8
9#ifndef IEEE80211_RATE_H
10#define IEEE80211_RATE_H
11
12#include <linux/netdevice.h>
13#include <linux/skbuff.h>
14#include <linux/types.h>
15#include <net/mac80211.h>
16#include "ieee80211_i.h"
17#include "sta_info.h"
8f727ef3 18#include "driver-ops.h"
f0706e82 19
f0706e82 20struct rate_control_ref {
631ad703 21 const struct rate_control_ops *ops;
f0706e82 22 void *priv;
f0706e82
JB
23};
24
4b7679a5 25void rate_control_get_rate(struct ieee80211_sub_if_data *sdata,
e6a9854b
JB
26 struct sta_info *sta,
27 struct ieee80211_tx_rate_control *txrc);
f0706e82 28
18fb84d9 29void rate_control_tx_status(struct ieee80211_local *local,
18fb84d9 30 struct ieee80211_tx_status *st);
f0706e82 31
eb6d9293
DV
32void rate_control_rate_init(struct sta_info *sta);
33void rate_control_rate_update(struct ieee80211_local *local,
b4f85443
JB
34 struct ieee80211_supported_band *sband,
35 struct sta_info *sta,
36 unsigned int link_id,
37 u32 changed);
f0706e82 38
f0706e82 39static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
35c347ac 40 struct sta_info *sta, gfp_t gfp)
f0706e82 41{
35c347ac
JB
42 spin_lock_init(&sta->rate_ctrl_lock);
43 return ref->ops->alloc_sta(ref->priv, &sta->sta, gfp);
f0706e82
JB
44}
45
4b7679a5 46static inline void rate_control_free_sta(struct sta_info *sta)
f0706e82 47{
4b7679a5
JB
48 struct rate_control_ref *ref = sta->rate_ctrl;
49 struct ieee80211_sta *ista = &sta->sta;
50 void *priv_sta = sta->rate_ctrl_priv;
51
52 ref->ops->free_sta(ref->priv, ista, priv_sta);
f0706e82
JB
53}
54
e9f207f0
JB
55static inline void rate_control_add_sta_debugfs(struct sta_info *sta)
56{
57#ifdef CONFIG_MAC80211_DEBUGFS
58 struct rate_control_ref *ref = sta->rate_ctrl;
fc4a25c5 59 if (ref && sta->debugfs_dir && ref->ops->add_sta_debugfs)
e9f207f0 60 ref->ops->add_sta_debugfs(ref->priv, sta->rate_ctrl_priv,
fc4a25c5 61 sta->debugfs_dir);
e9f207f0
JB
62#endif
63}
64
6cb5f3ea
JB
65extern const struct file_operations rcname_ops;
66
67static inline void rate_control_add_debugfs(struct ieee80211_local *local)
68{
69#ifdef CONFIG_MAC80211_DEBUGFS
70 struct dentry *debugfsdir;
71
72 if (!local->rate_ctrl)
73 return;
74
75 if (!local->rate_ctrl->ops->add_debugfs)
76 return;
77
78 debugfsdir = debugfs_create_dir("rc", local->hw.wiphy->debugfsdir);
79 local->debugfs.rcdir = debugfsdir;
80 debugfs_create_file("name", 0400, debugfsdir,
81 local->rate_ctrl, &rcname_ops);
82
83 local->rate_ctrl->ops->add_debugfs(&local->hw, local->rate_ctrl->priv,
84 debugfsdir);
85#endif
86}
87
de03f8ac 88void ieee80211_check_rate_mask(struct ieee80211_link_data *link);
e8e4f528 89
209c671d
AS
90/* Get a reference to the rate control algorithm. If `name' is NULL, get the
91 * first available algorithm. */
ff688089
JB
92int ieee80211_init_rate_ctrl_alg(struct ieee80211_local *local,
93 const char *name);
94void rate_control_deinitialize(struct ieee80211_local *local);
95
4b475898
JB
96
97/* Rate control algorithms */
cccf129f 98#ifdef CONFIG_MAC80211_RC_MINSTREL
c1b1203d
JP
99int rc80211_minstrel_init(void);
100void rc80211_minstrel_exit(void);
cccf129f
FF
101#else
102static inline int rc80211_minstrel_init(void)
103{
104 return 0;
105}
106static inline void rc80211_minstrel_exit(void)
107{
108}
109#endif
110
111
f0706e82 112#endif /* IEEE80211_RATE_H */