iwx: beacon filter command v4

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

iwx: beacon filter command v4

Stefan Sperling-5
I have started looking into updating iwx(4) to newer firmware.
This newer firmware is not working yet but I already have a few simple
changes which could be reviewed and committed. This is the first one:

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.

This is a fairly straightforward adaptation of changes made in iwlwifi.

ok?

Tested on -46 and -48 firmware.

diff 83ac15007194e8c54722e3f86d4805975b1b47a8 cad9585f8bd2c9a5a5bcdc5cd1fa273652ba3309
blob - 96350c02d07ea7a54cb27f04257ced45814b15d6
blob + b65fa80f56f6dd878b1ac48bbed7ae2d191ffc76
--- sys/dev/pci/if_iwx.c
+++ sys/dev/pci/if_iwx.c
@@ -4411,8 +4411,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
blob - 3ca42ff579a929d5f5d71b80e8afe1943aec60f2
lob + 04653f5d23e199b791eef8421b881a6a1854343a
--- sys/dev/pci/if_iwxreg.h
+++ sys/dev/pci/if_iwxreg.h
@@ -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