From owner-svn-src-all@freebsd.org Wed Jul 26 05:40:54 2017 Return-Path: Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8414DB1EC7; Wed, 26 Jul 2017 05:40:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id A3CB0760C4; Wed, 26 Jul 2017 05:40:54 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id v6Q5erTg099402; Wed, 26 Jul 2017 05:40:53 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id v6Q5erqv099399; Wed, 26 Jul 2017 05:40:53 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <201707260540.v6Q5erqv099399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Wed, 26 Jul 2017 05:40:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r321509 - head/sys/dev/iwm X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/iwm X-SVN-Commit-Revision: 321509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 26 Jul 2017 05:40:54 -0000 Author: adrian Date: Wed Jul 26 05:40:52 2017 New Revision: 321509 URL: https://svnweb.freebsd.org/changeset/base/321509 Log: [iwm] Sync statistics API definitions with Linux iwlwifi. Obtained from: dragonflybsd.git 75895a53a9c1ba60d75be9b4bf6e49a37f91a7cf Modified: head/sys/dev/iwm/if_iwm.c head/sys/dev/iwm/if_iwmreg.h head/sys/dev/iwm/if_iwmvar.h Modified: head/sys/dev/iwm/if_iwm.c ============================================================================== --- head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:29:08 2017 (r321508) +++ head/sys/dev/iwm/if_iwm.c Wed Jul 26 05:40:52 2017 (r321509) @@ -325,8 +325,10 @@ static int iwm_mvm_get_signal_strength(struct iwm_soft struct iwm_rx_phy_info *); static void iwm_mvm_rx_rx_phy_cmd(struct iwm_softc *, struct iwm_rx_packet *); -static int iwm_get_noise(struct iwm_softc *sc, +static int iwm_get_noise(struct iwm_softc *, const struct iwm_mvm_statistics_rx_non_phy *); +static void iwm_mvm_handle_rx_statistics(struct iwm_softc *, + struct iwm_rx_packet *); static boolean_t iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct mbuf *, uint32_t, boolean_t); static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *, @@ -3159,6 +3161,15 @@ iwm_get_noise(struct iwm_softc *sc, #endif } +static void +iwm_mvm_handle_rx_statistics(struct iwm_softc *sc, struct iwm_rx_packet *pkt) +{ + struct iwm_notif_statistics_v10 *stats = (void *)&pkt->data; + + memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); + sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); +} + /* * iwm_mvm_rx_rx_mpdu - IWM_REPLY_RX_MPDU_CMD handler * @@ -5292,13 +5303,9 @@ iwm_handle_rxb(struct iwm_softc *sc, struct mbuf *m) case IWM_CALIB_RES_NOTIF_PHY_DB: break; - case IWM_STATISTICS_NOTIFICATION: { - struct iwm_notif_statistics *stats; - stats = (void *)pkt->data; - memcpy(&sc->sc_stats, stats, sizeof(sc->sc_stats)); - sc->sc_noise = iwm_get_noise(sc, &stats->rx.general); + case IWM_STATISTICS_NOTIFICATION: + iwm_mvm_handle_rx_statistics(sc, pkt); break; - } case IWM_NVM_ACCESS_CMD: case IWM_MCC_UPDATE_CMD: Modified: head/sys/dev/iwm/if_iwmreg.h ============================================================================== --- head/sys/dev/iwm/if_iwmreg.h Wed Jul 26 05:29:08 2017 (r321508) +++ head/sys/dev/iwm/if_iwmreg.h Wed Jul 26 05:40:52 2017 (r321509) @@ -2898,6 +2898,18 @@ struct iwm_mcast_filter_cmd { uint8_t addr_list[0]; } __packed; /* IWM_MCAST_FILTERING_CMD_API_S_VER_1 */ +/* + * The first MAC indices (starting from 0) + * are available to the driver, AUX follows + */ +#define IWM_MAC_INDEX_AUX 4 +#define IWM_MAC_INDEX_MIN_DRIVER 0 +#define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX +#define IWM_NUM_MAC_INDEX (IWM_MAC_INDEX_AUX + 1) + +/*********************************** + * Statistics API + ***********************************/ struct iwm_mvm_statistics_dbg { uint32_t burst_check; uint32_t burst_count; @@ -2914,24 +2926,6 @@ struct iwm_mvm_statistics_div { uint32_t reserved2; } __packed; /* IWM_STATISTICS_SLOW_DIV_API_S_VER_2 */ -struct iwm_mvm_statistics_general_common { - uint32_t temperature; /* radio temperature */ - uint32_t temperature_m; /* radio voltage */ - struct iwm_mvm_statistics_dbg dbg; - uint32_t sleep_time; - uint32_t slots_out; - uint32_t slots_idle; - uint32_t ttl_timestamp; - struct iwm_mvm_statistics_div div; - uint32_t rx_enable_counter; - /* - * num_of_sos_states: - * count the number of times we have to re-tune - * in order to get out of bad PHY status - */ - uint32_t num_of_sos_states; -} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_5 */ - struct iwm_mvm_statistics_rx_non_phy { uint32_t bogus_cts; /* CTS received when not expecting CTS */ uint32_t bogus_ack; /* ACK received when not expecting ACK */ @@ -3002,6 +2996,23 @@ struct iwm_mvm_statistics_rx_ht_phy { uint32_t unsupport_mcs; } __packed; /* IWM_STATISTICS_HT_RX_PHY_API_S_VER_1 */ +struct iwm_mvm_statistics_tx_non_phy { + uint32_t preamble_cnt; + uint32_t rx_detected_cnt; + uint32_t bt_prio_defer_cnt; + uint32_t bt_prio_kill_cnt; + uint32_t few_bytes_cnt; + uint32_t cts_timeout; + uint32_t ack_timeout; + uint32_t expected_ack_cnt; + uint32_t actual_ack_cnt; + uint32_t dump_msdu_cnt; + uint32_t burst_abort_next_frame_mismatch_cnt; + uint32_t burst_abort_missing_next_frame_cnt; + uint32_t cts_timeout_collision; + uint32_t ack_or_ba_timeout_collision; +} __packed; /* IWM_STATISTICS_TX_NON_PHY_API_S_VER_3 */ + #define IWM_MAX_CHAINS 3 struct iwm_mvm_statistics_tx_non_phy_agg { @@ -3032,20 +3043,7 @@ struct iwm_mvm_statistics_tx_channel_width { }; /* IWM_STATISTICS_TX_CHANNEL_WIDTH_API_S_VER_1 */ struct iwm_mvm_statistics_tx { - uint32_t preamble_cnt; - uint32_t rx_detected_cnt; - uint32_t bt_prio_defer_cnt; - uint32_t bt_prio_kill_cnt; - uint32_t few_bytes_cnt; - uint32_t cts_timeout; - uint32_t ack_timeout; - uint32_t expected_ack_cnt; - uint32_t actual_ack_cnt; - uint32_t dump_msdu_cnt; - uint32_t burst_abort_next_frame_mismatch_cnt; - uint32_t burst_abort_missing_next_frame_cnt; - uint32_t cts_timeout_collision; - uint32_t ack_or_ba_timeout_collision; + struct iwm_mvm_statistics_tx_non_phy general; struct iwm_mvm_statistics_tx_non_phy_agg agg; struct iwm_mvm_statistics_tx_channel_width channel_width; } __packed; /* IWM_STATISTICS_TX_API_S_VER_4 */ @@ -3062,17 +3060,38 @@ struct iwm_mvm_statistics_bt_activity { uint32_t lo_priority_rx_denied_cnt; } __packed; /* IWM_STATISTICS_BT_ACTIVITY_API_S_VER_1 */ -struct iwm_mvm_statistics_general { - struct iwm_mvm_statistics_general_common common; +struct iwm_mvm_statistics_general_v8 { + uint32_t radio_temperature; + uint32_t radio_voltage; + struct iwm_mvm_statistics_dbg dbg; + uint32_t sleep_time; + uint32_t slots_out; + uint32_t slots_idle; + uint32_t ttl_timestamp; + struct iwm_mvm_statistics_div slow_div; + uint32_t rx_enable_counter; + /* + * num_of_sos_states: + * count the number of times we have to re-tune + * in order to get out of bad PHY status + */ + uint32_t num_of_sos_states; uint32_t beacon_filtered; uint32_t missed_beacons; - int8_t beacon_filter_average_energy; - int8_t beacon_filter_reason; - int8_t beacon_filter_current_energy; - int8_t beacon_filter_reserved; + uint8_t beacon_filter_average_energy; + uint8_t beacon_filter_reason; + uint8_t beacon_filter_current_energy; + uint8_t beacon_filter_reserved; uint32_t beacon_filter_delta_time; struct iwm_mvm_statistics_bt_activity bt_activity; -} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_5 */ + uint64_t rx_time; + uint64_t on_time_rf; + uint64_t on_time_scan; + uint64_t tx_time; + uint32_t beacon_counter[IWM_NUM_MAC_INDEX]; + uint8_t beacon_average_energy[IWM_NUM_MAC_INDEX]; + uint8_t reserved[4 - (IWM_NUM_MAC_INDEX % 4)]; +} __packed; /* IWM_STATISTICS_GENERAL_API_S_VER_8 */ struct iwm_mvm_statistics_rx { struct iwm_mvm_statistics_rx_phy ofdm; @@ -3086,24 +3105,23 @@ struct iwm_mvm_statistics_rx { * * By default, uCode issues this notification after receiving a beacon * while associated. To disable this behavior, set DISABLE_NOTIF flag in the - * IWM_REPLY_STATISTICS_CMD 0x9c, above. - * - * Statistics counters continue to increment beacon after beacon, but are - * cleared when changing channels or when driver issues IWM_REPLY_STATISTICS_CMD - * 0x9c with CLEAR_STATS bit set (see above). - * - * uCode also issues this notification during scans. uCode clears statistics - * appropriately so that each notification contains statistics for only the - * one channel that has just been scanned. + * IWM_STATISTICS_CMD (0x9c), below. */ -struct iwm_notif_statistics { /* IWM_STATISTICS_NTFY_API_S_VER_8 */ +struct iwm_notif_statistics_v10 { uint32_t flag; struct iwm_mvm_statistics_rx rx; struct iwm_mvm_statistics_tx tx; - struct iwm_mvm_statistics_general general; -} __packed; + struct iwm_mvm_statistics_general_v8 general; +} __packed; /* IWM_STATISTICS_NTFY_API_S_VER_10 */ +#define IWM_STATISTICS_FLG_CLEAR 0x1 +#define IWM_STATISTICS_FLG_DISABLE_NOTIF 0x2 + +struct iwm_statistics_cmd { + uint32_t flags; +} __packed; /* IWM_STATISTICS_CMD_API_S_VER_1 */ + /*********************************** * Smart Fifo API ***********************************/ @@ -3186,14 +3204,6 @@ struct iwm_sf_cfg_cmd { /* * BEGIN mvm/fw-api-mac.h */ - -/* - * The first MAC indices (starting from 0) - * are available to the driver, AUX follows - */ -#define IWM_MAC_INDEX_AUX 4 -#define IWM_MAC_INDEX_MIN_DRIVER 0 -#define IWM_NUM_MAC_INDEX_DRIVER IWM_MAC_INDEX_AUX enum iwm_ac { IWM_AC_BK, Modified: head/sys/dev/iwm/if_iwmvar.h ============================================================================== --- head/sys/dev/iwm/if_iwmvar.h Wed Jul 26 05:29:08 2017 (r321508) +++ head/sys/dev/iwm/if_iwmvar.h Wed Jul 26 05:40:52 2017 (r321509) @@ -529,7 +529,7 @@ struct iwm_softc { /* phy contexts. we only use the first one */ struct iwm_mvm_phy_ctxt sc_phyctxt[IWM_NUM_PHY_CTX]; - struct iwm_notif_statistics sc_stats; + struct iwm_notif_statistics_v10 sc_stats; int sc_noise; caddr_t sc_drvbpf;