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