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