summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorstsp <stsp@openbsd.org>2020-05-26 11:55:54 +0000
committerstsp <stsp@openbsd.org>2020-05-26 11:55:54 +0000
commit7edb0d6a1868fac2522669b31befb1ba4679dd7c (patch)
treed93072d7531ced85a7db3dacd8cd5d0bb94e7500
parentRewrite m88k mutex code as a slight variation of the MI mutex code. (diff)
downloadwireguard-openbsd-7edb0d6a1868fac2522669b31befb1ba4679dd7c.tar.xz
wireguard-openbsd-7edb0d6a1868fac2522669b31befb1ba4679dd7c.zip
Support iwx(4) firmware's BEACON_FILTER_CONFIG_API_S_VER_4 command.
Newer iwx(4) firmware versions will require a larger beacon filter command. The extra fields fields are initialized to zero even on Linux but newer firmware will require a size change anyway. ok mpi@
-rw-r--r--sys/dev/pci/if_iwx.c12
-rw-r--r--sys/dev/pci/if_iwxreg.h14
2 files changed, 22 insertions, 4 deletions
diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c
index 9d4cb9f0aa4..9b5802fb38a 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.12 2020/05/16 11:26:51 stsp Exp $ */
+/* $OpenBSD: if_iwx.c,v 1.13 2020/05/26 11:55:54 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -4403,8 +4403,16 @@ int
iwx_beacon_filter_send_cmd(struct iwx_softc *sc,
struct iwx_beacon_filter_cmd *cmd)
{
+ size_t len;
+
+ if (isset(sc->sc_ucode_api, IWX_UCODE_TLV_API_BEACON_FILTER_V4))
+ len = sizeof(struct iwx_beacon_filter_cmd);
+ else
+ len = offsetof(struct iwx_beacon_filter_cmd,
+ bf_threshold_absolute_low);
+
return iwx_send_cmd_pdu(sc, IWX_REPLY_BEACON_FILTERING_CMD,
- 0, sizeof(struct iwx_beacon_filter_cmd), cmd);
+ 0, len, cmd);
}
int
diff --git a/sys/dev/pci/if_iwxreg.h b/sys/dev/pci/if_iwxreg.h
index 3ca42ff579a..9713622c83a 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.4 2020/05/16 11:26:51 stsp Exp $ */
+/* $OpenBSD: if_iwxreg.h,v 1.5 2020/05/26 11:55:54 stsp Exp $ */
/*-
* Based on BSD-licensed source modules in the Linux iwlwifi driver,
@@ -909,6 +909,7 @@ enum msix_ivar_for_cause {
#define IWX_UCODE_TLV_API_ADAPTIVE_DWELL 32
#define IWX_UCODE_TLV_API_NEW_RX_STATS 35
#define IWX_UCODE_TLV_API_ADAPTIVE_DWELL_V2 42
+#define IWX_UCODE_TLV_API_BEACON_FILTER_V4 47
#define IWX_UCODE_TLV_API_REDUCED_SCAN_CONFIG 56
#define IWX_UCODE_TLV_API_SCAN_EXT_CHAN_VER 58
#define IWX_NUM_UCODE_TLV_API 128
@@ -3996,6 +3997,13 @@ struct iwx_uapsd_misbehaving_ap_notif {
* @ba_escape_timer: Fully receive and parse beacon if no beacons were passed
* for a longer period of time then this escape-timeout. Units: Beacons.
* @ba_enable_beacon_abort: 1, beacon abort is enabled; 0, disabled.
+ * @bf_threshold_absolute_low: See below.
+ * @bf_threshold_absolute_high: Send Beacon to driver if Energy value calculated
+ * for this beacon crossed this absolute threshold. For the 'Increase'
+ * direction the bf_energy_absolute_low[i] is used. For the 'Decrease'
+ * direction the bf_energy_absolute_high[i] is used. Zero value means
+ * that this specific threshold is ignored for beacon filtering, and
+ * beacon will not be forced to be sent to driver due to this setting.
*/
struct iwx_beacon_filter_cmd {
uint32_t bf_energy_delta;
@@ -4009,7 +4017,9 @@ struct iwx_beacon_filter_cmd {
uint32_t bf_escape_timer;
uint32_t ba_escape_timer;
uint32_t ba_enable_beacon_abort;
-} __packed;
+ uint32_t bf_threshold_absolute_low[2];
+ uint32_t bf_threshold_absolute_high[2];
+} __packed; /* BEACON_FILTER_CONFIG_API_S_VER_4 */
/* Beacon filtering and beacon abort */
#define IWX_BF_ENERGY_DELTA_DEFAULT 5