-/* $OpenBSD: ieee80211.c,v 1.58 2016/01/13 14:33:07 stsp Exp $ */
+/* $OpenBSD: ieee80211.c,v 1.59 2017/05/30 11:00:38 stsp Exp $ */
/* $NetBSD: ieee80211.c,v 1.19 2004/06/06 05:45:29 dyoung Exp $ */
/*-
}
}
+int
+ieee80211_min_basic_rate(struct ieee80211com *ic)
+{
+ struct ieee80211_rateset *rs = &ic->ic_bss->ni_rates;
+ int i;
+
+ for (i = 0; i < rs->rs_nrates; i++) {
+ if (rs->rs_rates[i] & IEEE80211_RATE_BASIC)
+ return i;
+ }
+
+ return 0;
+}
+
+int
+ieee80211_max_basic_rate(struct ieee80211com *ic)
+{
+ struct ieee80211_rateset *rs = &ic->ic_bss->ni_rates;
+ int i, best, rval, best_rval;
+
+ /* Defaults to 1 Mbit/s on 2GHz and 6 Mbit/s on 5GHz. */
+ best = 0;
+ best_rval = (rs->rs_rates[best] & IEEE80211_RATE_VAL);
+
+ for (i = 0; i < rs->rs_nrates; i++) {
+ if ((rs->rs_rates[i] & IEEE80211_RATE_BASIC) == 0)
+ continue;
+ rval = (rs->rs_rates[i] & IEEE80211_RATE_VAL);
+ if (rval > best_rval) {
+ best_rval = rval;
+ best = i;
+ }
+ }
+
+ return best;
+}
+
/*
* Set the current phy mode and recalculate the active channel
* set based on the available channels for this mode. Also
-/* $OpenBSD: ieee80211_var.h,v 1.77 2017/02/02 16:47:53 stsp Exp $ */
+/* $OpenBSD: ieee80211_var.h,v 1.78 2017/05/30 11:00:38 stsp Exp $ */
/* $NetBSD: ieee80211_var.h,v 1.7 2004/05/06 03:07:10 dyoung Exp $ */
/*-
u_int ieee80211_chan2ieee(struct ieee80211com *,
const struct ieee80211_channel *);
u_int ieee80211_ieee2mhz(u_int, u_int);
+int ieee80211_min_basic_rate(struct ieee80211com *);
+int ieee80211_max_basic_rate(struct ieee80211com *);
int ieee80211_setmode(struct ieee80211com *, enum ieee80211_phymode);
enum ieee80211_phymode ieee80211_next_mode(struct ifnet *);
enum ieee80211_phymode ieee80211_chan2mode(struct ieee80211com *,