1 /* 2 * Copyright (c) 2006 The DragonFly Project. All rights reserved. 3 * 4 * This code is derived from software contributed to The DragonFly Project 5 * by Sepherosa Ziehau <sepherosa@gmail.com> 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in 15 * the documentation and/or other materials provided with the 16 * distribution. 17 * 3. Neither the name of The DragonFly Project nor the names of its 18 * contributors may be used to endorse or promote products derived 19 * from this software without specific, prior written permission. 20 * 21 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 22 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 23 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 24 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 25 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 26 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, 27 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 28 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 29 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 30 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT 31 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 32 * SUCH DAMAGE. 33 * 34 * $DragonFly: src/sys/netproto/802_11/wlan/ieee80211_ratectl_none.c,v 1.3 2008/01/15 09:01:13 sephe Exp $ 35 */ 36 37 #include <sys/param.h> 38 #include <sys/kernel.h> 39 40 #include <net/if.h> 41 #include <net/if_media.h> 42 #include <net/if_arp.h> 43 44 #include <netproto/802_11/ieee80211_var.h> 45 46 static void *none_ratectl_attach(struct ieee80211com *); 47 static void none_ratectl_detach(void *); 48 static void none_ratectl_data_alloc(struct ieee80211_node *); 49 static void none_ratectl_data_free(struct ieee80211_node *); 50 static void none_ratectl_data_dup(const struct ieee80211_node *, 51 struct ieee80211_node *); 52 static void none_ratectl_newstate(void *, enum ieee80211_state); 53 static void none_ratectl_tx_complete(void *, struct ieee80211_node *, 54 int, const struct ieee80211_ratectl_res[], 55 int, int, int, int); 56 static void none_ratectl_newassoc(void *, struct ieee80211_node *, int); 57 static int none_ratectl_findrate(void *, struct ieee80211_node *, int, 58 int[], int); 59 60 const struct ieee80211_ratectl ieee80211_ratectl_none = { 61 .rc_name = "none", 62 .rc_ratectl = IEEE80211_RATECTL_NONE, 63 .rc_attach = none_ratectl_attach, 64 .rc_detach = none_ratectl_detach, 65 .rc_data_alloc = none_ratectl_data_alloc, 66 .rc_data_free = none_ratectl_data_free, 67 .rc_data_dup = none_ratectl_data_dup, 68 .rc_newstate = none_ratectl_newstate, 69 .rc_tx_complete = none_ratectl_tx_complete, 70 .rc_newassoc = none_ratectl_newassoc, 71 .rc_findrate = none_ratectl_findrate 72 }; 73 74 static void * 75 none_ratectl_attach(struct ieee80211com *ic __unused) 76 { 77 struct ieee80211_ratectl_state *rc_st = &ic->ic_ratectl; 78 79 rc_st->rc_st_attach(ic, IEEE80211_RATECTL_NONE); 80 return NULL; 81 } 82 83 static void 84 none_ratectl_detach(void *arg __unused) 85 { 86 } 87 88 static void 89 none_ratectl_data_alloc(struct ieee80211_node *ni __unused) 90 { 91 } 92 93 static void 94 none_ratectl_data_free(struct ieee80211_node *ni __unused) 95 { 96 } 97 98 static void 99 none_ratectl_data_dup(const struct ieee80211_node *oni __unused, 100 struct ieee80211_node *nni __unused) 101 { 102 } 103 104 static void 105 none_ratectl_newstate(void *arg __unused, enum ieee80211_state state __unused) 106 { 107 } 108 109 static void 110 none_ratectl_tx_complete(void *arg __unused, struct ieee80211_node *ni __unused, 111 int frame_len __unused, 112 const struct ieee80211_ratectl_res res[] __unused, 113 int res_len __unused, 114 int data_retries __unused, int rts_retries __unused, 115 int is_fail __unused) 116 { 117 } 118 119 static void 120 none_ratectl_newassoc(void *arg __unused, struct ieee80211_node *ni __unused, 121 int is_new __unused) 122 { 123 } 124 125 static int 126 none_ratectl_findrate(void * arg __unused, struct ieee80211_node *ni, 127 int frame_len __unused, int rateidx[], int rateidx_len) 128 { 129 int i; 130 131 for (i = 0; i < rateidx_len; ++i) 132 rateidx[i] = ni->ni_txrate; 133 return rateidx_len; 134 } 135