xref: /freebsd/sys/net80211/ieee80211_ratectl_none.c (revision 38075f7d5c87176f7b317c368712444a2f450a5e)
19a9a302fSBernhard Schmidt /*-
24d846d26SWarner 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 #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
none_init(struct ieee80211vap * vap)529a9a302fSBernhard Schmidt none_init(struct ieee80211vap *vap)
539a9a302fSBernhard Schmidt {
549a9a302fSBernhard Schmidt }
559a9a302fSBernhard Schmidt 
569a9a302fSBernhard Schmidt static void
none_deinit(struct ieee80211vap * vap)579a9a302fSBernhard Schmidt none_deinit(struct ieee80211vap *vap)
589a9a302fSBernhard Schmidt {
59b9b53389SAdrian Chadd 	IEEE80211_FREE(vap->iv_rs, M_80211_RATECTL);
609a9a302fSBernhard Schmidt }
619a9a302fSBernhard Schmidt 
629a9a302fSBernhard Schmidt static void
none_node_init(struct ieee80211_node * ni)639a9a302fSBernhard Schmidt none_node_init(struct ieee80211_node *ni)
649a9a302fSBernhard Schmidt {
65*38075f7dSAdrian Chadd 	ieee80211_node_set_txrate_dot11rate(ni,
66*38075f7dSAdrian Chadd 	    ni->ni_rates.rs_rates[0] & IEEE80211_RATE_VAL);
679a9a302fSBernhard Schmidt }
689a9a302fSBernhard Schmidt 
699a9a302fSBernhard Schmidt static void
none_node_deinit(struct ieee80211_node * ni)709a9a302fSBernhard Schmidt none_node_deinit(struct ieee80211_node *ni)
719a9a302fSBernhard Schmidt {
729a9a302fSBernhard Schmidt }
739a9a302fSBernhard Schmidt 
749a9a302fSBernhard Schmidt static int
none_rate(struct ieee80211_node * ni,void * arg __unused,uint32_t iarg __unused)759a9a302fSBernhard Schmidt none_rate(struct ieee80211_node *ni, void *arg __unused, uint32_t iarg __unused)
769a9a302fSBernhard Schmidt {
779a9a302fSBernhard Schmidt 	int rix = 0;
789a9a302fSBernhard Schmidt 
79*38075f7dSAdrian Chadd 	ieee80211_node_set_txrate_dot11rate(ni,
80*38075f7dSAdrian Chadd 	    ni->ni_rates.rs_rates[rix] & IEEE80211_RATE_VAL);
819a9a302fSBernhard Schmidt 	return rix;
829a9a302fSBernhard Schmidt }
839a9a302fSBernhard Schmidt 
849a9a302fSBernhard Schmidt static void
none_tx_complete(const struct ieee80211_node * ni,const struct ieee80211_ratectl_tx_status * status)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
none_tx_update(struct ieee80211vap * vap,struct ieee80211_ratectl_tx_stats * stats)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
none_setinterval(const struct ieee80211vap * vap,int msecs)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