1214069Sbschmidt/*-
2214069Sbschmidt * Copyright (c) 2010 Bernhard Schmidt <bschmidt@FreeBSD.org>
3214069Sbschmidt * All rights reserved.
4214069Sbschmidt *
5214069Sbschmidt * Redistribution and use in source and binary forms, with or without
6214069Sbschmidt * modification, are permitted provided that the following conditions
7214069Sbschmidt * are met:
8214069Sbschmidt * 1. Redistributions of source code must retain the above copyright
9214069Sbschmidt *    notice, this list of conditions and the following disclaimer.
10214069Sbschmidt * 2. Redistributions in binary form must reproduce the above copyright
11214069Sbschmidt *    notice, this list of conditions and the following disclaimer in the
12214069Sbschmidt *    documentation and/or other materials provided with the distribution.
13214069Sbschmidt *
14214069Sbschmidt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
15214069Sbschmidt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
16214069Sbschmidt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
17214069Sbschmidt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18214069Sbschmidt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19214069Sbschmidt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20214069Sbschmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21214069Sbschmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22214069Sbschmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23214069Sbschmidt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24214069Sbschmidt */
25214069Sbschmidt
26214069Sbschmidt#include <sys/cdefs.h>
27214069Sbschmidt__FBSDID("$FreeBSD$");
28214069Sbschmidt
29214069Sbschmidt#include "opt_wlan.h"
30214069Sbschmidt
31214069Sbschmidt#include <sys/param.h>
32257179Sglebius#include <sys/systm.h>
33214069Sbschmidt#include <sys/kernel.h>
34257179Sglebius#include <sys/malloc.h>
35214069Sbschmidt#include <sys/module.h>
36214069Sbschmidt#include <sys/socket.h>
37214069Sbschmidt#include <sys/sysctl.h>
38214069Sbschmidt
39214069Sbschmidt#include <net/if.h>
40214069Sbschmidt#include <net/if_media.h>
41257179Sglebius#include <net/ethernet.h>
42214069Sbschmidt
43214069Sbschmidt#ifdef INET
44214069Sbschmidt#include <netinet/in.h>
45214069Sbschmidt#include <netinet/if_ether.h>
46214069Sbschmidt#endif
47214069Sbschmidt
48214069Sbschmidt#include <net80211/ieee80211_var.h>
49214069Sbschmidt#include <net80211/ieee80211_ratectl.h>
50214069Sbschmidt
51214069Sbschmidtstatic void
52214069Sbschmidtnone_init(struct ieee80211vap *vap)
53214069Sbschmidt{
54214069Sbschmidt}
55214069Sbschmidt
56214069Sbschmidtstatic void
57214069Sbschmidtnone_deinit(struct ieee80211vap *vap)
58214069Sbschmidt{
59283538Sadrian	IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL);
60214069Sbschmidt}
61214069Sbschmidt
62214069Sbschmidtstatic void
63214069Sbschmidtnone_node_init(struct ieee80211_node *ni)
64214069Sbschmidt{
65215244Sbschmidt	ni->ni_txrate = ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL;
66214069Sbschmidt}
67214069Sbschmidt
68214069Sbschmidtstatic void
69214069Sbschmidtnone_node_deinit(struct ieee80211_node *ni)
70214069Sbschmidt{
71214069Sbschmidt}
72214069Sbschmidt
73214069Sbschmidtstatic int
74214069Sbschmidtnone_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused)
75214069Sbschmidt{
76214069Sbschmidt	int rix = 0;
77214069Sbschmidt
78214069Sbschmidt	ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL;
79214069Sbschmidt	return rix;
80214069Sbschmidt}
81214069Sbschmidt
82214069Sbschmidtstatic void
83214069Sbschmidtnone_tx_complete(const struct ieee80211vap *vap,
84214069Sbschmidt    const struct ieee80211_node *ni, int ok,
85214069Sbschmidt    void *arg1, void *arg2 __unused)
86214069Sbschmidt{
87214069Sbschmidt}
88214069Sbschmidt
89214069Sbschmidtstatic void
90214069Sbschmidtnone_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni,
91214069Sbschmidt    void *arg1, void *arg2, void *arg3)
92214069Sbschmidt{
93214069Sbschmidt}
94214069Sbschmidt
95214069Sbschmidtstatic void
96214069Sbschmidtnone_setinterval(const struct ieee80211vap *vap, int msecs)
97214069Sbschmidt{
98214069Sbschmidt}
99214069Sbschmidt
100214069Sbschmidt/* number of references from net80211 layer */
101214069Sbschmidtstatic	int nrefs = 0;
102214069Sbschmidt
103214069Sbschmidtstatic const struct ieee80211_ratectl none = {
104214069Sbschmidt	.ir_name	= "none",
105214069Sbschmidt	.ir_attach	= NULL,
106214069Sbschmidt	.ir_detach	= NULL,
107214069Sbschmidt	.ir_init	= none_init,
108214069Sbschmidt	.ir_deinit	= none_deinit,
109214069Sbschmidt	.ir_node_init	= none_node_init,
110214069Sbschmidt	.ir_node_deinit	= none_node_deinit,
111214069Sbschmidt	.ir_rate	= none_rate,
112214069Sbschmidt	.ir_tx_complete	= none_tx_complete,
113214069Sbschmidt	.ir_tx_update	= none_tx_update,
114214069Sbschmidt	.ir_setinterval	= none_setinterval,
115214069Sbschmidt};
116214069SbschmidtIEEE80211_RATECTL_MODULE(ratectl_none, 1);
117214069SbschmidtIEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none);
118