summaryrefslogtreecommitdiff
path: root/sys
diff options
context:
space:
mode:
authorStefan Sperling <stsp@cvs.openbsd.org>2019-10-28 17:38:07 +0000
committerStefan Sperling <stsp@cvs.openbsd.org>2019-10-28 17:38:07 +0000
commit537e49cd165fedecd95e39ae5ee3e794133339cf (patch)
treea662d0fe0987aa4d0b299e0cfe1d4543bf6de7e6 /sys
parent8457498ad46f62bdc5e950f01e06b7898543801f (diff)
Remove unneeded IWM_UCODE_TLV_FLAGS_RX_ENERGY_API flag.
All supported firmware versions have this feature flag set. Remove now unneeded iwm_calc_rssi() function. Patch by Imre Vadasz. ok patrick@
Diffstat (limited to 'sys')
-rw-r--r--sys/dev/pci/if_iwm.c36
-rw-r--r--sys/dev/pci/if_iwmreg.h4
2 files changed, 3 insertions, 37 deletions
diff --git a/sys/dev/pci/if_iwm.c b/sys/dev/pci/if_iwm.c
index c3fda6b116e..9ae811b4d83 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.260 2019/10/28 17:34:48 stsp Exp $ */
+/* $OpenBSD: if_iwm.c,v 1.261 2019/10/28 17:38:06 stsp Exp $ */
/*
* Copyright (c) 2014, 2016 genua gmbh <info@genua.de>
@@ -364,7 +364,6 @@ int iwm_load_ucode_wait_alive(struct iwm_softc *, enum iwm_ucode_type);
int iwm_send_dqa_cmd(struct iwm_softc *);
int iwm_run_init_mvm_ucode(struct iwm_softc *, int);
int iwm_rx_addbuf(struct iwm_softc *, int, int);
-int iwm_calc_rssi(struct iwm_softc *, struct iwm_rx_phy_info *);
int iwm_get_signal_strength(struct iwm_softc *, struct iwm_rx_phy_info *);
void iwm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *,
struct iwm_rx_data *);
@@ -3409,33 +3408,6 @@ iwm_rx_addbuf(struct iwm_softc *sc, int size, int idx)
return 0;
}
-#define IWM_RSSI_OFFSET 50
-int
-iwm_calc_rssi(struct iwm_softc *sc, struct iwm_rx_phy_info *phy_info)
-{
- int rssi_a, rssi_b, rssi_a_dbm, rssi_b_dbm, max_rssi_dbm;
- uint32_t agc_a, agc_b;
- uint32_t val;
-
- val = le32toh(phy_info->non_cfg_phy[IWM_RX_INFO_AGC_IDX]);
- agc_a = (val & IWM_OFDM_AGC_A_MSK) >> IWM_OFDM_AGC_A_POS;
- agc_b = (val & IWM_OFDM_AGC_B_MSK) >> IWM_OFDM_AGC_B_POS;
-
- val = le32toh(phy_info->non_cfg_phy[IWM_RX_INFO_RSSI_AB_IDX]);
- rssi_a = (val & IWM_OFDM_RSSI_INBAND_A_MSK) >> IWM_OFDM_RSSI_A_POS;
- rssi_b = (val & IWM_OFDM_RSSI_INBAND_B_MSK) >> IWM_OFDM_RSSI_B_POS;
-
- /*
- * dBm = rssi dB - agc dB - constant.
- * Higher AGC (higher radio gain) means lower signal.
- */
- rssi_a_dbm = rssi_a - IWM_RSSI_OFFSET - agc_a;
- rssi_b_dbm = rssi_b - IWM_RSSI_OFFSET - agc_b;
- max_rssi_dbm = MAX(rssi_a_dbm, rssi_b_dbm);
-
- return max_rssi_dbm;
-}
-
/*
* RSSI values are reported by the FW as positive values - need to negate
* to obtain their dBM. Account for missing antennas by replacing 0
@@ -3548,11 +3520,7 @@ iwm_rx_rx_mpdu(struct iwm_softc *sc, struct iwm_rx_packet *pkt,
device_timestamp = le32toh(phy_info->system_timestamp);
- if (sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_RX_ENERGY_API) {
- rssi = iwm_get_signal_strength(sc, phy_info);
- } else {
- rssi = iwm_calc_rssi(sc, phy_info);
- }
+ rssi = iwm_get_signal_strength(sc, phy_info);
rssi = (0 - IWM_MIN_DBM) + rssi; /* normalize */
rssi = MIN(rssi, ic->ic_max_rssi); /* clip to max. 100% */
diff --git a/sys/dev/pci/if_iwmreg.h b/sys/dev/pci/if_iwmreg.h
index 011ec4079df..bfef2e6af93 100644
--- a/sys/dev/pci/if_iwmreg.h
+++ b/sys/dev/pci/if_iwmreg.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: if_iwmreg.h,v 1.32 2019/10/28 17:28:23 stsp Exp $ */
+/* $OpenBSD: if_iwmreg.h,v 1.33 2019/10/28 17:38:06 stsp Exp $ */
/******************************************************************************
*
@@ -565,7 +565,6 @@
* @IWM_UCODE_TLV_FLAGS_UAPSD: This uCode image supports uAPSD
* @IWM_UCODE_TLV_FLAGS_SHORT_BL: 16 entries of black list instead of 64 in scan
* offload profile config command.
- * @IWM_UCODE_TLV_FLAGS_RX_ENERGY_API: supports rx signal strength api
* @IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2: using the new time event API.
* @IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS: D3 image supports up to six
* (rather than two) IPv6 addresses
@@ -597,7 +596,6 @@
#define IWM_UCODE_TLV_FLAGS_NEWBT_COEX (1 << 5)
#define IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT (1 << 6)
#define IWM_UCODE_TLV_FLAGS_SHORT_BL (1 << 7)
-#define IWM_UCODE_TLV_FLAGS_RX_ENERGY_API (1 << 8)
#define IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2 (1 << 9)
#define IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS (1 << 10)
#define IWM_UCODE_TLV_FLAGS_BF_UPDATED (1 << 11)