From: phessler Date: Wed, 31 May 2017 12:24:06 +0000 (+0000) Subject: add ieee80211_min_basic_rate() to iwm(4), to select the lowest available X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=db6584cc9e945ab0bd8f05ee13e7bd402d35573d;p=openbsd add ieee80211_min_basic_rate() to iwm(4), to select the lowest available datarate for management frames based on revs 1.187 and r 1.188 from iwn(4) OK stsp@ --- diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c index 8c81e5e1628..dc45533a968 100644 --- a/sys/dev/pci/if_iwm.c +++ b/sys/dev/pci/if_iwm.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwm.c,v 1.187 2017/05/31 09:17:39 stsp Exp $ */ +/* $OpenBSD: if_iwm.c,v 1.188 2017/05/31 12:24:06 phessler Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -418,6 +418,7 @@ int iwm_lmac_scan(struct iwm_softc *); int iwm_config_umac_scan(struct iwm_softc *); int iwm_umac_scan(struct iwm_softc *); uint8_t iwm_ridx2rate(struct ieee80211_rateset *, int); +int iwm_rval2ridx(int); void iwm_ack_rates(struct iwm_softc *, struct iwm_node *, int *, int *); void iwm_mac_ctxt_cmd_common(struct iwm_softc *, struct iwm_node *, struct iwm_mac_ctx_cmd *, uint32_t, int); @@ -3986,8 +3987,7 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node *in, if (IEEE80211_IS_MULTICAST(wh->i_addr1) || type != IEEE80211_FC0_TYPE_DATA) { /* for non-data, use the lowest supported rate */ - ridx = (IEEE80211_IS_CHAN_5GHZ(ni->ni_chan)) ? - IWM_RIDX_OFDM : IWM_RIDX_CCK; + ridx = iwm_rval2ridx(ieee80211_min_basic_rate(ic)); tx->data_retry_limit = IWM_MGMT_DFAULT_RETRY_LIMIT; } else if (ic->ic_fixed_mcs != -1) { ridx = sc->sc_fixed_ridx; @@ -5012,6 +5012,19 @@ iwm_ridx2rate(struct ieee80211_rateset *rs, int ridx) return 0; } +int +iwm_rval2ridx(int rval) +{ + int ridx; + + for (ridx = 0; ridx < nitems(iwm_rates); ridx++) { + if (rval == iwm_rates[ridx].rate) + break; + } + + return ridx; +} + void iwm_ack_rates(struct iwm_softc *sc, struct iwm_node *in, int *cck_rates, int *ofdm_rates)