[iwm] if_iwm - Factor out and improve iwm_mvm_scan_rxon_flags() in if_iwm_scan.c.

From the original commit:

==

* Actually look at the first channel in the list. If it's a 2.4GHz channel,
  set IWM_PHY_BAND_24 flag. The IWM_PHY_BAND_5 flag is 0 anyway, so we
  don't need to look further.

* While there factor out the iwm_mvm_rrm_scan_needed() tlv capability check.

Taken-From: Linux iwlwifi
==

However, this only really does the latter.  The sc_ic channel list isn't the
scan channel list, it's the /whole list/ for the set of active channels,
so I don't know what the right thing to do is here.

So I'll commit this as an intermediary commit and we'll have to revisit whether
to finish the refactor as-is.

Tested:

* Intel 7260, STA mode

Obtained from:	dragonflybsd.git 53a009d6f66108b40d622ed90ea95eba5c0e5432
This commit is contained in:
adrian 2017-07-17 21:29:18 +00:00
parent ffa3f53018
commit 31ae60e1ab

View File

@ -179,6 +179,17 @@ iwm_mvm_scan_rx_chain(struct iwm_softc *sc)
return htole16(rx_chain);
}
#if 0
static uint32_t
iwm_mvm_scan_rxon_flags(struct ieee80211_channel *c)
{
if (IEEE80211_IS_CHAN_2GHZ(c))
return htole32(IWM_PHY_BAND_24);
else
return htole32(IWM_PHY_BAND_5);
}
#endif
static uint32_t
iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck)
{
@ -202,6 +213,14 @@ iwm_mvm_scan_rate_n_flags(struct iwm_softc *sc, int flags, int no_cck)
return htole32(IWM_RATE_6M_PLCP | tx_ant);
}
static inline boolean_t
iwm_mvm_rrm_scan_needed(struct iwm_softc *sc)
{
/* require rrm scan whenever the fw supports it */
return fw_has_capa(&sc->ucode_capa,
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT);
}
#ifdef IWM_DEBUG
static const char *
iwm_mvm_ebs_status_str(enum iwm_scan_ebs_status status)
@ -416,8 +435,7 @@ iwm_mvm_fill_probe_req(struct iwm_softc *sc, struct iwm_scan_probe_req *preq)
preq->band_data[0].len = htole16(frm - pos);
remain -= frm - pos;
if (fw_has_capa(&sc->ucode_capa,
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT)) {
if (iwm_mvm_rrm_scan_needed(sc)) {
if (remain < 3)
return ENOBUFS;
*frm++ = IEEE80211_ELEMID_DSPARMS;
@ -639,8 +657,7 @@ iwm_mvm_umac_scan(struct iwm_softc *sc)
IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
IWM_SCAN_CHANNEL_FLAG_CACHE_ADD;
if (fw_has_capa(&sc->ucode_capa,
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT))
if (iwm_mvm_rrm_scan_needed(sc))
req->general_flags |=
htole32(IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED);
@ -708,13 +725,14 @@ iwm_mvm_lmac_scan(struct iwm_softc *sc)
req->scan_flags = htole32(IWM_MVM_LMAC_SCAN_FLAG_PASS_ALL |
IWM_MVM_LMAC_SCAN_FLAG_ITER_COMPLETE |
IWM_MVM_LMAC_SCAN_FLAG_EXTENDED_DWELL);
if (fw_has_capa(&sc->ucode_capa,
IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT))
if (iwm_mvm_rrm_scan_needed(sc))
req->scan_flags |= htole32(IWM_MVM_LMAC_SCAN_FLAGS_RRM_ENABLED);
/* Note - IWM_PHY_BAND_5 is 0 anyway */
req->flags = htole32(IWM_PHY_BAND_24);
if (sc->nvm_data->sku_cap_band_52GHz_enable)
req->flags |= htole32(IWM_PHY_BAND_5);
req->filter_flags =
htole32(IWM_MAC_FILTER_ACCEPT_GRP | IWM_MAC_FILTER_IN_BEACON);