ieee80211_ratectl_none.c revision 283567
1/*-
2 * Copyright (c) 2010 Bernhard Schmidt <bschmidt@FreeBSD.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright
9 *    notice, this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright
11 *    notice, this list of conditions and the following disclaimer in the
12 *    documentation and/or other materials provided with the distribution.
13 *
14 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_ratectl_none.c 283567 2015-05-26 12:51:14Z glebius $");
28
29#include "opt_wlan.h"
30
31#include <sys/param.h>
32#include <sys/systm.h>
33#include <sys/counter.h>
34#include <sys/kernel.h>
35#include <sys/malloc.h>
36#include <sys/module.h>
37#include <sys/socket.h>
38#include <sys/sysctl.h>
39
40#include <net/if.h>
41#include <net/if_media.h>
42#include <net/ethernet.h>
43
44#ifdef INET
45#include <netinet/in.h>
46#include <netinet/if_ether.h>
47#endif
48
49#include <net80211/ieee80211_var.h>
50#include <net80211/ieee80211_ratectl.h>
51
52static void
53none_init(struct ieee80211vap *vap)
54{
55}
56
57static void
58none_deinit(struct ieee80211vap *vap)
59{
60	IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL);
61}
62
63static void
64none_node_init(struct ieee80211_node *ni)
65{
66	ni->ni_txrate = ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL;
67}
68
69static void
70none_node_deinit(struct ieee80211_node *ni)
71{
72}
73
74static int
75none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused)
76{
77	int rix = 0;
78
79	ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL;
80	return rix;
81}
82
83static void
84none_tx_complete(const struct ieee80211vap *vap,
85    const struct ieee80211_node *ni, int ok,
86    void *arg1, void *arg2 __unused)
87{
88}
89
90static void
91none_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni,
92    void *arg1, void *arg2, void *arg3)
93{
94}
95
96static void
97none_setinterval(const struct ieee80211vap *vap, int msecs)
98{
99}
100
101/* number of references from net80211 layer */
102static	int nrefs = 0;
103
104static const struct ieee80211_ratectl none = {
105	.ir_name	= "none",
106	.ir_attach	= NULL,
107	.ir_detach	= NULL,
108	.ir_init	= none_init,
109	.ir_deinit	= none_deinit,
110	.ir_node_init	= none_node_init,
111	.ir_node_deinit	= none_node_deinit,
112	.ir_rate	= none_rate,
113	.ir_tx_complete	= none_tx_complete,
114	.ir_tx_update	= none_tx_update,
115	.ir_setinterval	= none_setinterval,
116};
117IEEE80211_RATECTL_MODULE(ratectl_none, 1);
118IEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none);
119