summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2020-06-22 08:05:52 +0000
committerstsp <stsp@openbsd.org>2020-06-22 08:05:52 +0000
commita2ba379f1820886ad63adf142a02b9a6dd27ff93 (patch)
treeb99b8fb92eab308f07b3cc927eb0e40d4b3e0fb4
parentUpdate definition of the iwx_ac_to_tx_fifo map. (diff)
downloadwireguard-openbsd-a2ba379f1820886ad63adf142a02b9a6dd27ff93.tar.xz
wireguard-openbsd-a2ba379f1820886ad63adf142a02b9a6dd27ff93.zip
Prepare for newer iwx(4) firmware scan command versions.
Add declarations of "version 2" scan flags from iwlwifi and prepare the iwx_scan_channel_cfg_umac struct for life beyond version 1. None of this is needed yet. But we will need this at some point and I've already written the diff, hoping it would prevent firmware errors (which of course it didn't).
-rw-r--r--sys/dev/pci/if_iwx.c22
-rw-r--r--sys/dev/pci/if_iwxreg.h59
2 files changed, 72 insertions, 9 deletions
diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c
index 21a400269e9..33b0fc431db 100644
--- a/sys/dev/pci/if_iwx.c
+++ b/sys/dev/pci/if_iwx.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwx.c,v 1.34 2020/06/22 07:52:24 stsp Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.35 2020/06/22 08:05:52 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -4938,12 +4938,26 @@ iwx_umac_scan_fill_channels(struct iwx_softc *sc,
c <= &ic->ic_channels[IEEE80211_CHAN_MAX] &&
nchan < sc->sc_capa_n_scan_channels;
c++) {
+ uint8_t channel_num;
+
if (c->ic_flags == 0)
continue;
- chan->channel_num = ieee80211_mhz2ieee(c->ic_freq, 0);
- chan->iter_count = 1;
- chan->iter_interval = htole16(0);
+ channel_num = ieee80211_mhz2ieee(c->ic_freq, 0);
+ if (isset(sc->sc_ucode_api,
+ IWX_UCODE_TLV_API_SCAN_EXT_CHAN_VER)) {
+ chan->v2.channel_num = channel_num;
+ if (IEEE80211_IS_CHAN_2GHZ(c))
+ chan->v2.band = IWX_PHY_BAND_24;
+ else
+ chan->v2.band = IWX_PHY_BAND_5;
+ chan->v2.iter_count = 1;
+ chan->v2.iter_interval = 0;
+ } else {
+ chan->v1.channel_num = channel_num;
+ chan->v1.iter_count = 1;
+ chan->v1.iter_interval = htole16(0);
+ }
if (n_ssids != 0 && !bgscan)
chan->flags = htole32(1 << 0); /* select SSID 0 */
chan++;
diff --git a/sys/dev/pci/if_iwxreg.h b/sys/dev/pci/if_iwxreg.h
index 7ecd1f8e0f6..bd0f6f3c6e9 100644
--- a/sys/dev/pci/if_iwxreg.h
+++ b/sys/dev/pci/if_iwxreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwxreg.h,v 1.12 2020/06/22 07:39:41 stsp Exp $ */
+/* $OpenBSD: if_iwxreg.h,v 1.13 2020/06/22 08:05:52 stsp Exp $ */
/*-
* Based on BSD-licensed source modules in the Linux iwlwifi driver,
@@ -5668,6 +5668,45 @@ struct iwx_scan_config {
#define IWX_UMAC_SCAN_GEN_FLAGS2_ALLOW_CHNL_REORDER (1 << 1)
/**
+ * UMAC scan general flags version 2
+ *
+ * The FW flags were reordered and hence the driver introduce version 2
+ *
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC: periodic or scheduled
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL: pass all probe responses and beacons
+ * during scan iterations
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE: send complete notification
+ * on every iteration instead of only once after the last iteration
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1: fragmented scan LMAC1
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2: fragmented scan LMAC2
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_MATCH: does this scan check for profile matching
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS: use all valid chains for RX
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL: works with adaptive dwell
+ * for active channel
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE: can be preempted by other requests
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_NTF_START: send notification of scan start
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID: matching on multiple SSIDs
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE: all the channels scanned
+ * as passive
+ * @IWX_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN: at the end of 2.4GHz and
+ * 5.2Ghz bands scan, trigger scan on 6GHz band to discover
+ * the reported collocated APs
+ */
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_PERIODIC (1 << 0)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_PASS_ALL (1 << 1)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_NTFY_ITER_COMPLETE (1 << 2)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC1 (1 << 3)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_FRAGMENTED_LMAC2 (1 << 4)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_MATCH (1 << 5)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_USE_ALL_RX_CHAINS (1 << 6)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_ADAPTIVE_DWELL (1 << 7)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_PREEMPTIVE (1 << 8)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_NTF_START (1 << 9)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_MULTI_SSID (1 << 10)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_FORCE_PASSIVE (1 << 11)
+#define IWX_UMAC_SCAN_GEN_FLAGS_V2_TRIGGER_UHB_SCAN (1 << 12)
+
+/**
* struct iwx_scan_channel_cfg_umac
* @flags: bitmap - 0-19: directed scan to i'th ssid.
* @channel_num: channel number 1-13 etc.
@@ -5676,10 +5715,20 @@ struct iwx_scan_config {
*/
struct iwx_scan_channel_cfg_umac {
uint32_t flags;
- uint8_t channel_num;
- uint8_t iter_count;
- uint16_t iter_interval;
-} __packed; /* SCAN_CHANNEL_CFG_S_VER1 */
+ union {
+ struct {
+ uint8_t channel_num;
+ uint8_t iter_count;
+ uint16_t iter_interval;
+ } v1; /* SCAN_CHANNEL_CFG_S_VER1 */
+ struct {
+ uint8_t channel_num;
+ uint8_t band;
+ uint8_t iter_count;
+ uint8_t iter_interval;
+ } v2; /* SCAN_CHANNEL_CFG_S_VER{2,3,4} */
+ };
+} __packed;
/**
* struct iwx_scan_umac_schedule