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