19a9a302fSBernhard Schmidt /*- 29a9a302fSBernhard Schmidt * Copyright (c) 2010 Bernhard Schmidt <bschmidt@FreeBSD.org> 39a9a302fSBernhard Schmidt * All rights reserved. 49a9a302fSBernhard Schmidt * 59a9a302fSBernhard Schmidt * Redistribution and use in source and binary forms, with or without 69a9a302fSBernhard Schmidt * modification, are permitted provided that the following conditions 79a9a302fSBernhard Schmidt * are met: 89a9a302fSBernhard Schmidt * 1. Redistributions of source code must retain the above copyright 99a9a302fSBernhard Schmidt * notice, this list of conditions and the following disclaimer. 109a9a302fSBernhard Schmidt * 2. Redistributions in binary form must reproduce the above copyright 119a9a302fSBernhard Schmidt * notice, this list of conditions and the following disclaimer in the 129a9a302fSBernhard Schmidt * documentation and/or other materials provided with the distribution. 139a9a302fSBernhard Schmidt * 149a9a302fSBernhard Schmidt * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 159a9a302fSBernhard Schmidt * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 169a9a302fSBernhard Schmidt * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 179a9a302fSBernhard Schmidt * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 189a9a302fSBernhard Schmidt * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 199a9a302fSBernhard Schmidt * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 209a9a302fSBernhard Schmidt * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 219a9a302fSBernhard Schmidt * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 229a9a302fSBernhard Schmidt * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 239a9a302fSBernhard Schmidt * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 249a9a302fSBernhard Schmidt */ 259a9a302fSBernhard Schmidt 269a9a302fSBernhard Schmidt #include <sys/cdefs.h> 279a9a302fSBernhard Schmidt __FBSDID("$FreeBSD$"); 289a9a302fSBernhard Schmidt 299a9a302fSBernhard Schmidt #include "opt_wlan.h" 309a9a302fSBernhard Schmidt 319a9a302fSBernhard Schmidt #include <sys/param.h> 32eedc7fd9SGleb Smirnoff #include <sys/systm.h> 339a9a302fSBernhard Schmidt #include <sys/kernel.h> 34eedc7fd9SGleb Smirnoff #include <sys/malloc.h> 359a9a302fSBernhard Schmidt #include <sys/module.h> 369a9a302fSBernhard Schmidt #include <sys/socket.h> 379a9a302fSBernhard Schmidt #include <sys/sysctl.h> 389a9a302fSBernhard Schmidt 399a9a302fSBernhard Schmidt #include <net/if.h> 409a9a302fSBernhard Schmidt #include <net/if_media.h> 41eedc7fd9SGleb Smirnoff #include <net/ethernet.h> 429a9a302fSBernhard Schmidt 439a9a302fSBernhard Schmidt #ifdef INET 449a9a302fSBernhard Schmidt #include <netinet/in.h> 459a9a302fSBernhard Schmidt #include <netinet/if_ether.h> 469a9a302fSBernhard Schmidt #endif 479a9a302fSBernhard Schmidt 489a9a302fSBernhard Schmidt #include <net80211/ieee80211_var.h> 499a9a302fSBernhard Schmidt #include <net80211/ieee80211_ratectl.h> 509a9a302fSBernhard Schmidt 519a9a302fSBernhard Schmidt static void 529a9a302fSBernhard Schmidt none_init(struct ieee80211vap *vap) 539a9a302fSBernhard Schmidt { 549a9a302fSBernhard Schmidt } 559a9a302fSBernhard Schmidt 569a9a302fSBernhard Schmidt static void 579a9a302fSBernhard Schmidt none_deinit(struct ieee80211vap *vap) 589a9a302fSBernhard Schmidt { 59*b9b53389SAdrian Chadd IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL); 609a9a302fSBernhard Schmidt } 619a9a302fSBernhard Schmidt 629a9a302fSBernhard Schmidt static void 639a9a302fSBernhard Schmidt none_node_init(struct ieee80211_node *ni) 649a9a302fSBernhard Schmidt { 657438cee6SBernhard Schmidt ni->ni_txrate = ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL; 669a9a302fSBernhard Schmidt } 679a9a302fSBernhard Schmidt 689a9a302fSBernhard Schmidt static void 699a9a302fSBernhard Schmidt none_node_deinit(struct ieee80211_node *ni) 709a9a302fSBernhard Schmidt { 719a9a302fSBernhard Schmidt } 729a9a302fSBernhard Schmidt 739a9a302fSBernhard Schmidt static int 749a9a302fSBernhard Schmidt none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused) 759a9a302fSBernhard Schmidt { 769a9a302fSBernhard Schmidt int rix = 0; 779a9a302fSBernhard Schmidt 789a9a302fSBernhard Schmidt ni->ni_txrate = ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL; 799a9a302fSBernhard Schmidt return rix; 809a9a302fSBernhard Schmidt } 819a9a302fSBernhard Schmidt 829a9a302fSBernhard Schmidt static void 839a9a302fSBernhard Schmidt none_tx_complete(const struct ieee80211vap *vap, 849a9a302fSBernhard Schmidt const struct ieee80211_node *ni, int ok, 859a9a302fSBernhard Schmidt void *arg1, void *arg2 __unused) 869a9a302fSBernhard Schmidt { 879a9a302fSBernhard Schmidt } 889a9a302fSBernhard Schmidt 899a9a302fSBernhard Schmidt static void 909a9a302fSBernhard Schmidt none_tx_update(const struct ieee80211vap *vap, const struct ieee80211_node *ni, 919a9a302fSBernhard Schmidt void *arg1, void *arg2, void *arg3) 929a9a302fSBernhard Schmidt { 939a9a302fSBernhard Schmidt } 949a9a302fSBernhard Schmidt 959a9a302fSBernhard Schmidt static void 969a9a302fSBernhard Schmidt none_setinterval(const struct ieee80211vap *vap, int msecs) 979a9a302fSBernhard Schmidt { 989a9a302fSBernhard Schmidt } 999a9a302fSBernhard Schmidt 1009a9a302fSBernhard Schmidt /* number of references from net80211 layer */ 1019a9a302fSBernhard Schmidt static int nrefs = 0; 1029a9a302fSBernhard Schmidt 1039a9a302fSBernhard Schmidt static const struct ieee80211_ratectl none = { 1049a9a302fSBernhard Schmidt .ir_name = "none", 1059a9a302fSBernhard Schmidt .ir_attach = NULL, 1069a9a302fSBernhard Schmidt .ir_detach = NULL, 1079a9a302fSBernhard Schmidt .ir_init = none_init, 1089a9a302fSBernhard Schmidt .ir_deinit = none_deinit, 1099a9a302fSBernhard Schmidt .ir_node_init = none_node_init, 1109a9a302fSBernhard Schmidt .ir_node_deinit = none_node_deinit, 1119a9a302fSBernhard Schmidt .ir_rate = none_rate, 1129a9a302fSBernhard Schmidt .ir_tx_complete = none_tx_complete, 1139a9a302fSBernhard Schmidt .ir_tx_update = none_tx_update, 1149a9a302fSBernhard Schmidt .ir_setinterval = none_setinterval, 1159a9a302fSBernhard Schmidt }; 1169a9a302fSBernhard Schmidt IEEE80211_RATECTL_MODULE(ratectl_none, 1); 1179a9a302fSBernhard Schmidt IEEE80211_RATECTL_ALG(none, IEEE80211_RATECTL_NONE, none); 118