Commit | Line | Data |
---|---|---|
16878352 SW |
1 | /*- |
2 | * Copyright (c) 2010 Bernhard Schmidt <bschmidt@FreeBSD.org> | |
3 | * All rights reserved. | |
4 | * | |
b9334f94 SZ |
5 | * Redistribution and use in source and binary forms, with or without |
6 | * modification, are permitted provided that the following conditions | |
7 | * are met: | |
b9334f94 SZ |
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 | |
16878352 SW |
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. | |
b9334f94 SZ |
24 | */ |
25 | ||
085ff963 MD |
26 | #include <sys/cdefs.h> |
27 | __FBSDID("$FreeBSD$"); | |
28 | ||
16878352 SW |
29 | #include "opt_wlan.h" |
30 | ||
b9334f94 | 31 | #include <sys/param.h> |
16878352 | 32 | #include <sys/systm.h> |
b9334f94 | 33 | #include <sys/kernel.h> |
16878352 SW |
34 | #include <sys/malloc.h> |
35 | #include <sys/module.h> | |
36 | #include <sys/socket.h> | |
37 | #include <sys/sysctl.h> | |
38 | ||
b9334f94 | 39 | #include <net/if.h> |
bff82488 | 40 | #include <net/if_var.h> |
b9334f94 | 41 | #include <net/if_media.h> |
16878352 | 42 | #include <net/ethernet.h> |
b9334f94 | 43 | |
16878352 SW |
44 | #include <netproto/802_11/ieee80211_var.h> |
45 | #include <netproto/802_11/ieee80211_ratectl.h> | |
b3cbafa9 JT |
46 | |
47 | static void | |
16878352 | 48 | none_init(struct ieee80211vap *vap) |
b3cbafa9 JT |
49 | { |
50 | } | |
51 | ||
b9334f94 | 52 | static void |
16878352 | 53 | none_deinit(struct ieee80211vap *vap) |
b9334f94 | 54 | { |
4f655ef5 | 55 | IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); |
b9334f94 SZ |
56 | } |
57 | ||
58 | static void | |
16878352 | 59 | none_node_init(struct ieee80211_node *ni) |
b9334f94 | 60 | { |
16878352 | 61 | ni->ni_txrate = ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL; |
b9334f94 SZ |
62 | } |
63 | ||
64 | static void | |
16878352 | 65 | none_node_deinit(struct ieee80211_node *ni) |
b9334f94 SZ |
66 | { |
67 | } | |
68 | ||
16878352 SW |
69 | static int |
70 | none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) | |
b9334f94 | 71 | { |
16878352 SW |
72 | int rix = 0; |
73 | ||
74 | ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL; | |
75 | return rix; | |
b9334f94 SZ |
76 | } |
77 | ||
78 | static void | |
16878352 SW |
79 | none_tx_complete(const struct ieee80211vap *vap, |
80 | const struct ieee80211_node *ni, int ok, | |
81 | void *arg1, void *arg2 __unused) | |
b9334f94 SZ |
82 | { |
83 | } | |
84 | ||
85 | static void | |
16878352 SW |
86 | none_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni, |
87 | void *arg1, void *arg2, void *arg3) | |
b9334f94 SZ |
88 | { |
89 | } | |
90 | ||
91 | static void | |
16878352 | 92 | none_setinterval(const struct ieee80211vap *vap, int msecs) |
b9334f94 SZ |
93 | { |
94 | } | |
16878352 SW |
95 | |
96 | /* number of references from net80211 layer */ | |
97 | static int nrefs = 0; | |
98 | ||
99 | static const struct ieee80211_ratectl none = { | |
100 | .ir_name = "none", | |
101 | .ir_attach = NULL, | |
102 | .ir_detach = NULL, | |
103 | .ir_init = none_init, | |
104 | .ir_deinit = none_deinit, | |
105 | .ir_node_init = none_node_init, | |
106 | .ir_node_deinit = none_node_deinit, | |
107 | .ir_rate = none_rate, | |
108 | .ir_tx_complete = none_tx_complete, | |
109 | .ir_tx_update = none_tx_update, | |
110 | .ir_setinterval = none_setinterval, | |
111 | }; | |
112 | IEEE80211_RATECTL_MODULE(ratectl_none, 1); | |
113 | IEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none); |