svn commit: r315780 - head/sys/dev/iwm

Adrian Chadd adrian at FreeBSD.org
Thu Mar 23 04:43:06 UTC 2017


Author: adrian
Date: Thu Mar 23 04:43:04 2017
New Revision: 315780
URL: https://svnweb.freebsd.org/changeset/base/315780

Log:
  [iwm] Remove a couple of unneeded IWM_UCODE_TLV_FLAGS_* flags.
  
  * All the supported firmwares have these flags set.
  
  * This removes the following flags:
    IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT,
    IWM_UCODE_TLV_FLAGS_NEWBT_COEX,
    IWM_UCODE_TLV_FLAGS_BF_UPDATED,
    IWM_UCODE_TLV_FLAGS_D3_CONTINUITY_API,
    IWM_UCODE_TLV_FLAGS_STA_KEY_CMD,
    IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD,
    IWM_UCODE_TLV_FLAGS_SCHED_SCAN,
    IWM_UCODE_TLV_FLAGS_RX_ENERGY_API,
    IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2
  
  * Also remove definitions and code for dealing with the v1 time-event api.
  
  * Remove unneeded calc_rssi() function.
  
  Obtained from:	dragonflybsd.git d078c812418d0e2c3392e99fa25fc776d07bdfad

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_power.c
  head/sys/dev/iwm/if_iwm_time_event.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==============================================================================
--- head/sys/dev/iwm/if_iwm.c	Thu Mar 23 04:35:52 2017	(r315779)
+++ head/sys/dev/iwm/if_iwm.c	Thu Mar 23 04:43:04 2017	(r315780)
@@ -316,7 +316,6 @@ static int	iwm_mvm_load_ucode_wait_alive
                                               enum iwm_ucode_type);
 static int	iwm_run_init_mvm_ucode(struct iwm_softc *, int);
 static int	iwm_rx_addbuf(struct iwm_softc *, int, int);
-static int	iwm_mvm_calc_rssi(struct iwm_softc *, struct iwm_rx_phy_info *);
 static int	iwm_mvm_get_signal_strength(struct iwm_softc *,
 					    struct iwm_rx_phy_info *);
 static void	iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *,
@@ -345,7 +344,7 @@ static int	iwm_raw_xmit(struct ieee80211
 static int	iwm_mvm_flush_tx_path(struct iwm_softc *sc,
 				      uint32_t tfd_msk, uint32_t flags);
 static int	iwm_mvm_send_add_sta_cmd_status(struct iwm_softc *,
-					        struct iwm_mvm_add_sta_cmd_v7 *,
+					        struct iwm_mvm_add_sta_cmd *,
                                                 int *);
 static int	iwm_mvm_sta_send_to_fw(struct iwm_softc *, struct iwm_node *,
                                        int);
@@ -867,12 +866,6 @@ iwm_read_firmware(struct iwm_softc *sc, 
 		    "section type %d\n", error, tlv_type);
 	}
 
-	if (!(sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT)) {
-		device_printf(sc->sc_dev,
-		    "device uses unsupported power ops\n");
-		error = ENOTSUP;
-	}
-
  out:
 	if (error) {
 		fw->fw_status = IWM_FW_STATUS_NONE;
@@ -3043,38 +3036,6 @@ fail:
 }
 
 /* iwlwifi: mvm/rx.c */
-#define IWM_RSSI_OFFSET 50
-static int
-iwm_mvm_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);
-
-	IWM_DPRINTF(sc, IWM_DEBUG_RECV,
-	    "Rssi In A %d B %d Max %d AGCA %d AGCB %d\n",
-	    rssi_a_dbm, rssi_b_dbm, max_rssi_dbm, agc_a, agc_b);
-
-	return max_rssi_dbm;
-}
-
-/* iwlwifi: mvm/rx.c */
 /*
  * iwm_mvm_get_signal_strength - use new rx PHY INFO API
  * values are reported by the fw as positive values - need to negate
@@ -3193,17 +3154,7 @@ iwm_mvm_rx_rx_mpdu(struct iwm_softc *sc,
 		goto fail;
 	}
 
-	if (sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_RX_ENERGY_API) {
-		rssi = iwm_mvm_get_signal_strength(sc, phy_info);
-	} else {
-		rssi = iwm_mvm_calc_rssi(sc, phy_info);
-	}
-
-	/* Note: RSSI is absolute (ie a -ve value) */
-	if (rssi < IWM_MIN_DBM)
-		rssi = IWM_MIN_DBM;
-	else if (rssi > IWM_MAX_DBM)
-		rssi = IWM_MAX_DBM;
+	rssi = iwm_mvm_get_signal_strength(sc, phy_info);
 
 	/* Map it to relative value */
 	rssi = rssi - sc->sc_noise;
@@ -3882,7 +3833,7 @@ iwm_mvm_flush_tx_path(struct iwm_softc *
 
 static int
 iwm_mvm_send_add_sta_cmd_status(struct iwm_softc *sc,
-	struct iwm_mvm_add_sta_cmd_v7 *cmd, int *status)
+	struct iwm_mvm_add_sta_cmd *cmd, int *status)
 {
 	return iwm_mvm_send_cmd_pdu_status(sc, IWM_ADD_STA, sizeof(*cmd),
 	    cmd, status);
@@ -3892,7 +3843,7 @@ iwm_mvm_send_add_sta_cmd_status(struct i
 static int
 iwm_mvm_sta_send_to_fw(struct iwm_softc *sc, struct iwm_node *in, int update)
 {
-	struct iwm_mvm_add_sta_cmd_v7 add_sta_cmd;
+	struct iwm_mvm_add_sta_cmd add_sta_cmd;
 	int ret;
 	uint32_t status;
 
@@ -3950,7 +3901,7 @@ static int
 iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta,
 	const uint8_t *addr, uint16_t mac_id, uint16_t color)
 {
-	struct iwm_mvm_add_sta_cmd_v7 cmd;
+	struct iwm_mvm_add_sta_cmd cmd;
 	int ret;
 	uint32_t status;
 

Modified: head/sys/dev/iwm/if_iwm_power.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_power.c	Thu Mar 23 04:35:52 2017	(r315779)
+++ head/sys/dev/iwm/if_iwm_power.c	Thu Mar 23 04:43:04 2017	(r315780)
@@ -290,9 +290,6 @@ iwm_mvm_power_update_device(struct iwm_s
 		.flags = htole16(IWM_DEVICE_POWER_FLAGS_POWER_SAVE_ENA_MSK),
 	};
 
-	if (!(sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD))
-		return 0;
-
 	cmd.flags |= htole16(IWM_DEVICE_POWER_FLAGS_CAM_MSK);
 	IWM_DPRINTF(sc, IWM_DEBUG_PWRSAVE | IWM_DEBUG_CMD,
 	    "Sending device power command with flags = 0x%X\n", cmd.flags);
@@ -322,13 +319,9 @@ iwm_mvm_enable_beacon_filter(struct iwm_
 int
 iwm_mvm_disable_beacon_filter(struct iwm_softc *sc)
 {
-	struct iwm_beacon_filter_cmd cmd;
+	struct iwm_beacon_filter_cmd cmd = {};
 	int ret;
 
-	memset(&cmd, 0, sizeof(cmd));
-	if ((sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_BF_UPDATED) == 0)
-		return 0;
-
 	ret = iwm_mvm_beacon_filter_send_cmd(sc, &cmd);
 	if (ret == 0)
 		sc->sc_bf.bf_enabled = 0;

Modified: head/sys/dev/iwm/if_iwm_time_event.c
==============================================================================
--- head/sys/dev/iwm/if_iwm_time_event.c	Thu Mar 23 04:35:52 2017	(r315779)
+++ head/sys/dev/iwm/if_iwm_time_event.c	Thu Mar 23 04:43:04 2017	(r315780)
@@ -164,77 +164,17 @@ __FBSDID("$FreeBSD$");
 #define IWM_MVM_ROC_TE_TYPE_NORMAL IWM_TE_P2P_DEVICE_DISCOVERABLE
 #define IWM_MVM_ROC_TE_TYPE_MGMT_TX IWM_TE_P2P_CLIENT_ASSOC
 
-/* used to convert from time event API v2 to v1 */
-#define IWM_TE_V2_DEP_POLICY_MSK (IWM_TE_V2_DEP_OTHER | IWM_TE_V2_DEP_TSF |\
-			     IWM_TE_V2_EVENT_SOCIOPATHIC)
-static inline uint16_t
-iwm_te_v2_get_notify(uint16_t policy)
-{
-	return le16toh(policy) & IWM_TE_V2_NOTIF_MSK;
-}
-
-static inline uint16_t
-iwm_te_v2_get_dep_policy(uint16_t policy)
-{
-	return (le16toh(policy) & IWM_TE_V2_DEP_POLICY_MSK) >>
-		IWM_TE_V2_PLACEMENT_POS;
-}
-
-static inline uint16_t
-iwm_te_v2_get_absence(uint16_t policy)
-{
-	return (le16toh(policy) & IWM_TE_V2_ABSENCE) >> IWM_TE_V2_ABSENCE_POS;
-}
-
-static void
-iwm_mvm_te_v2_to_v1(const struct iwm_time_event_cmd_v2 *cmd_v2,
-	struct iwm_time_event_cmd_v1 *cmd_v1)
-{
-	cmd_v1->id_and_color = cmd_v2->id_and_color;
-	cmd_v1->action = cmd_v2->action;
-	cmd_v1->id = cmd_v2->id;
-	cmd_v1->apply_time = cmd_v2->apply_time;
-	cmd_v1->max_delay = cmd_v2->max_delay;
-	cmd_v1->depends_on = cmd_v2->depends_on;
-	cmd_v1->interval = cmd_v2->interval;
-	cmd_v1->duration = cmd_v2->duration;
-	if (cmd_v2->repeat == IWM_TE_V2_REPEAT_ENDLESS)
-		cmd_v1->repeat = htole32(IWM_TE_V1_REPEAT_ENDLESS);
-	else
-		cmd_v1->repeat = htole32(cmd_v2->repeat);
-	cmd_v1->max_frags = htole32(cmd_v2->max_frags);
-	cmd_v1->interval_reciprocal = 0; /* unused */
-
-	cmd_v1->dep_policy = htole32(iwm_te_v2_get_dep_policy(cmd_v2->policy));
-	cmd_v1->is_present = htole32(!iwm_te_v2_get_absence(cmd_v2->policy));
-	cmd_v1->notify = htole32(iwm_te_v2_get_notify(cmd_v2->policy));
-}
-
-static int
-iwm_mvm_send_time_event_cmd(struct iwm_softc *sc,
-	const struct iwm_time_event_cmd_v2 *cmd)
-{
-	struct iwm_time_event_cmd_v1 cmd_v1;
-
-	if (sc->sc_capaflags & IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2)
-		return iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD,
-		    IWM_CMD_SYNC, sizeof(*cmd), cmd);
-
-	iwm_mvm_te_v2_to_v1(cmd, &cmd_v1);
-	return iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, IWM_CMD_SYNC,
-	    sizeof(cmd_v1), &cmd_v1);
-}
-
 static int
 iwm_mvm_time_event_send_add(struct iwm_softc *sc, struct iwm_node *in,
-	void *te_data, struct iwm_time_event_cmd_v2 *te_cmd)
+	void *te_data, struct iwm_time_event_cmd *te_cmd)
 {
 	int ret;
 
 	IWM_DPRINTF(sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET,
 	    "Add new TE, duration %d TU\n", le32toh(te_cmd->duration));
 
-	ret = iwm_mvm_send_time_event_cmd(sc, te_cmd);
+	ret = iwm_mvm_send_cmd_pdu(sc, IWM_TIME_EVENT_CMD, IWM_CMD_SYNC,
+	    sizeof(*te_cmd), te_cmd);
 	if (ret) {
 		IWM_DPRINTF(sc, IWM_DEBUG_CMD | IWM_DEBUG_RESET,
 		    "%s: Couldn't send IWM_TIME_EVENT_CMD: %d\n",
@@ -248,9 +188,7 @@ void
 iwm_mvm_protect_session(struct iwm_softc *sc, struct iwm_node *in,
 	uint32_t duration, uint32_t max_delay)
 {
-	struct iwm_time_event_cmd_v2 time_cmd;
-
-	memset(&time_cmd, 0, sizeof(time_cmd));
+	struct iwm_time_event_cmd time_cmd = {};
 
 	time_cmd.action = htole32(IWM_FW_CTXT_ACTION_ADD);
 	time_cmd.id_and_color =

Modified: head/sys/dev/iwm/if_iwmreg.h
==============================================================================
--- head/sys/dev/iwm/if_iwmreg.h	Thu Mar 23 04:35:52 2017	(r315779)
+++ head/sys/dev/iwm/if_iwmreg.h	Thu Mar 23 04:43:04 2017	(r315780)
@@ -611,21 +611,12 @@ enum iwm_dtd_diode_reg {
  * @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
- * @IWM_UCODE_TLV_FLAGS_BF_UPDATED: new beacon filtering API
  * @IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID: not sending a probe with the SSID element
  *	from the probe request template.
- * @IWM_UCODE_TLV_FLAGS_D3_CONTINUITY_API: modified D3 API to allow keeping
- *	connection when going back to D0
  * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL: new NS offload (small version)
  * @IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE: new NS offload (large version)
- * @IWM_UCODE_TLV_FLAGS_SCHED_SCAN: this uCode image supports scheduled scan.
- * @IWM_UCODE_TLV_FLAGS_STA_KEY_CMD: new ADD_STA and ADD_STA_KEY command API
- * @IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD: support device wide power command
- *	containing CAM (Continuous Active Mode) indication.
  * @IWM_UCODE_TLV_FLAGS_P2P_PS: P2P client power save is supported (only on a
  *	single bound interface).
  * @IWM_UCODE_TLV_FLAGS_UAPSD_SUPPORT: General support for uAPSD
@@ -641,20 +632,11 @@ enum iwm_ucode_tlv_flag {
 	IWM_UCODE_TLV_FLAGS_MFP			= (1 << 2),
 	IWM_UCODE_TLV_FLAGS_P2P			= (1 << 3),
 	IWM_UCODE_TLV_FLAGS_DW_BC_TABLE		= (1 << 4),
-	IWM_UCODE_TLV_FLAGS_NEWBT_COEX		= (1 << 5),
-	IWM_UCODE_TLV_FLAGS_PM_CMD_SUPPORT	= (1 << 6),
 	IWM_UCODE_TLV_FLAGS_SHORT_BL		= (1 << 7),
-	IWM_UCODE_TLV_FLAGS_RX_ENERGY_API	= (1 << 8),
-	IWM_UCODE_TLV_FLAGS_TIME_EVENT_API_V2	= (1 << 9),
 	IWM_UCODE_TLV_FLAGS_D3_6_IPV6_ADDRS	= (1 << 10),
-	IWM_UCODE_TLV_FLAGS_BF_UPDATED		= (1 << 11),
 	IWM_UCODE_TLV_FLAGS_NO_BASIC_SSID	= (1 << 12),
-	IWM_UCODE_TLV_FLAGS_D3_CONTINUITY_API	= (1 << 14),
 	IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_SMALL	= (1 << 15),
 	IWM_UCODE_TLV_FLAGS_NEW_NSOFFL_LARGE	= (1 << 16),
-	IWM_UCODE_TLV_FLAGS_SCHED_SCAN		= (1 << 17),
-	IWM_UCODE_TLV_FLAGS_STA_KEY_CMD		= (1 << 19),
-	IWM_UCODE_TLV_FLAGS_DEVICE_PS_CMD	= (1 << 20),
 	IWM_UCODE_TLV_FLAGS_P2P_PS		= (1 << 21),
 	IWM_UCODE_TLV_FLAGS_BSS_P2P_PS_DCM	= (1 << 22),
 	IWM_UCODE_TLV_FLAGS_BSS_P2P_PS_SCM	= (1 << 23),
@@ -2390,52 +2372,7 @@ enum {
 	IWM_T2_V2_START_IMMEDIATELY = (1 << 11),
 }; /* IWM_MAC_EVENT_ACTION_API_E_VER_2 */
 
-
-/**
- * struct iwm_time_event_cmd_api_v1 - configuring Time Events
- * with struct IWM_MAC_TIME_EVENT_DATA_API_S_VER_1 (see also
- * with version 2. determined by IWM_UCODE_TLV_FLAGS)
- * ( IWM_TIME_EVENT_CMD = 0x29 )
- * @id_and_color: ID and color of the relevant MAC
- * @action: action to perform, one of IWM_FW_CTXT_ACTION_*
- * @id: this field has two meanings, depending on the action:
- *	If the action is ADD, then it means the type of event to add.
- *	For all other actions it is the unique event ID assigned when the
- *	event was added by the FW.
- * @apply_time: When to start the Time Event (in GP2)
- * @max_delay: maximum delay to event's start (apply time), in TU
- * @depends_on: the unique ID of the event we depend on (if any)
- * @interval: interval between repetitions, in TU
- * @interval_reciprocal: 2^32 / interval
- * @duration: duration of event in TU
- * @repeat: how many repetitions to do, can be IWM_TE_REPEAT_ENDLESS
- * @dep_policy: one of IWM_TE_V1_INDEPENDENT, IWM_TE_V1_DEP_OTHER, IWM_TE_V1_DEP_TSF
- *	and IWM_TE_V1_EVENT_SOCIOPATHIC
- * @is_present: 0 or 1, are we present or absent during the Time Event
- * @max_frags: maximal number of fragments the Time Event can be divided to
- * @notify: notifications using IWM_TE_V1_NOTIF_* (whom to notify when)
- */
-struct iwm_time_event_cmd_v1 {
-	/* COMMON_INDEX_HDR_API_S_VER_1 */
-	uint32_t id_and_color;
-	uint32_t action;
-	uint32_t id;
-	/* IWM_MAC_TIME_EVENT_DATA_API_S_VER_1 */
-	uint32_t apply_time;
-	uint32_t max_delay;
-	uint32_t dep_policy;
-	uint32_t depends_on;
-	uint32_t is_present;
-	uint32_t max_frags;
-	uint32_t interval;
-	uint32_t interval_reciprocal;
-	uint32_t duration;
-	uint32_t repeat;
-	uint32_t notify;
-} __packed; /* IWM_MAC_TIME_EVENT_CMD_API_S_VER_1 */
-
-
-/* Time event - defines for command API v2 */
+/* Time event - defines for command API */
 
 /*
  * @IWM_TE_V2_FRAG_NONE: fragmentation of the time event is NOT allowed.
@@ -2466,7 +2403,7 @@ enum {
 #define IWM_TE_V2_PLACEMENT_POS	12
 #define IWM_TE_V2_ABSENCE_POS	15
 
-/* Time event policy values (for time event cmd api v2)
+/* Time event policy values
  * A notification (both event and fragment) includes a status indicating weather
  * the FW was able to schedule the event or not. For fragment start/end
  * notification the status is always success. There is no start/end fragment
@@ -2512,7 +2449,7 @@ enum {
 };
 
 /**
- * struct iwm_time_event_cmd_api_v2 - configuring Time Events
+ * struct iwm_time_event_cmd_api - configuring Time Events
  * with struct IWM_MAC_TIME_EVENT_DATA_API_S_VER_2 (see also
  * with version 1. determined by IWM_UCODE_TLV_FLAGS)
  * ( IWM_TIME_EVENT_CMD = 0x29 )
@@ -2535,7 +2472,7 @@ enum {
  *	IWM_TE_EVENT_SOCIOPATHIC
  *	using IWM_TE_ABSENCE and using IWM_TE_NOTIF_*
  */
-struct iwm_time_event_cmd_v2 {
+struct iwm_time_event_cmd {
 	/* COMMON_INDEX_HDR_API_S_VER_1 */
 	uint32_t id_and_color;
 	uint32_t action;
@@ -5690,7 +5627,7 @@ struct iwm_mvm_keyinfo {
 #define IWM_ADD_STA_BAID_SHIFT		8
 
 /**
- * struct iwm_mvm_add_sta_cmd_v7 - Add/modify a station in the fw's sta table.
+ * struct iwm_mvm_add_sta_cmd - Add/modify a station in the fw's sta table.
  * ( REPLY_ADD_STA = 0x18 )
  * @add_modify: 1: modify existing, 0: add new station
  * @awake_acs:
@@ -5726,7 +5663,7 @@ struct iwm_mvm_keyinfo {
  * ADD_STA sets up the table entry for one station, either creating a new
  * entry, or modifying a pre-existing one.
  */
-struct iwm_mvm_add_sta_cmd_v7 {
+struct iwm_mvm_add_sta_cmd {
 	uint8_t add_modify;
 	uint8_t awake_acs;
 	uint16_t tid_disable_tx;


More information about the svn-src-head mailing list