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>
32214069Sbschmidt#include <sys/kernel.h>
33214069Sbschmidt#include <sys/module.h>
34214069Sbschmidt#include <sys/socket.h>
35214069Sbschmidt#include <sys/sysctl.h>
36214069Sbschmidt
37214069Sbschmidt#include <net/if.h>
38214069Sbschmidt#include <net/if_media.h>
39214069Sbschmidt
40214069Sbschmidt#ifdef INET
41214069Sbschmidt#include <netinet/in.h>
42214069Sbschmidt#include <netinet/if_ether.h>
43214069Sbschmidt#endif
44214069Sbschmidt
45214069Sbschmidt#include <net80211/ieee80211_var.h>
46214069Sbschmidt#include <net80211/ieee80211_ratectl.h>
47214069Sbschmidt
48214069Sbschmidtstatic void
49214069Sbschmidtnone_init(struct ieee80211vap *vap)
50214069Sbschmidt{
51214069Sbschmidt}
52214069Sbschmidt
53214069Sbschmidtstatic void
54214069Sbschmidtnone_deinit(struct ieee80211vap *vap)
55214069Sbschmidt{
56214069Sbschmidt	free(vap->iv_rs, M_80211_RATECTL);
57214069Sbschmidt}
58214069Sbschmidt
59214069Sbschmidtstatic void
60214069Sbschmidtnone_node_init(struct ieee80211_node *ni)
61214069Sbschmidt{
62215244Sbschmidt	ni->ni_txrate = ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL;
63214069Sbschmidt}
64214069Sbschmidt
65214069Sbschmidtstatic void
66214069Sbschmidtnone_node_deinit(struct ieee80211_node *ni)
67214069Sbschmidt{
68214069Sbschmidt}
69214069Sbschmidt
70214069Sbschmidtstatic int
71214069Sbschmidtnone_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused)
72214069Sbschmidt{
73214069Sbschmidt	int rix = 0;
74214069Sbschmidt
75214069Sbschmidt	ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL;
76214069Sbschmidt	return rix;
77214069Sbschmidt}
78214069Sbschmidt
79214069Sbschmidtstatic void
80214069Sbschmidtnone_tx_complete(const struct ieee80211vap *vap,
81214069Sbschmidt    const struct ieee80211_node *ni, int ok,
82214069Sbschmidt    void *arg1, void *arg2 __unused)
83214069Sbschmidt{
84214069Sbschmidt}
85214069Sbschmidt
86214069Sbschmidtstatic void
87214069Sbschmidtnone_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni,
88214069Sbschmidt    void *arg1, void *arg2, void *arg3)
89214069Sbschmidt{
90214069Sbschmidt}
91214069Sbschmidt
92214069Sbschmidtstatic void
93214069Sbschmidtnone_setinterval(const struct ieee80211vap *vap, int msecs)
94214069Sbschmidt{
95214069Sbschmidt}
96214069Sbschmidt
97214069Sbschmidt/* number of references from net80211 layer */
98214069Sbschmidtstatic	int nrefs = 0;
99214069Sbschmidt
100214069Sbschmidtstatic const struct ieee80211_ratectl none = {
101214069Sbschmidt	.ir_name	= "none",
102214069Sbschmidt	.ir_attach	= NULL,
103214069Sbschmidt	.ir_detach	= NULL,
104214069Sbschmidt	.ir_init	= none_init,
105214069Sbschmidt	.ir_deinit	= none_deinit,
106214069Sbschmidt	.ir_node_init	= none_node_init,
107214069Sbschmidt	.ir_node_deinit	= none_node_deinit,
108214069Sbschmidt	.ir_rate	= none_rate,
109214069Sbschmidt	.ir_tx_complete	= none_tx_complete,
110214069Sbschmidt	.ir_tx_update	= none_tx_update,
111214069Sbschmidt	.ir_setinterval	= none_setinterval,
112214069Sbschmidt};
113214069SbschmidtIEEE80211_RATECTL_MODULE(ratectl_none, 1);
114214069SbschmidtIEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none);
115