From nobody Mon Nov 28 17:26:56 2022 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4NLXTD3v9pz4jQwB; Mon, 28 Nov 2022 17:26:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4NLXTD31Bkz43J3; Mon, 28 Nov 2022 17:26:56 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669656416; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oe9XHVZ08THe0j6jTrvEUxuGJBIsCFCRR9xJdnRmQCM=; b=kBAVC4L0bouWCrnxLoLS2OphspjaimyVimFsMqZSXuwB5WeeFyR4A8AcuKBZ4Z41srndSz Sa7SQgo5VJwaWoAbErj/HJnbWYMvln5Kl8R29izKjF+kTZ+T/N6NkQCQd51AgTa5mjAubb nLPcPE2kTa1Qvdva/ZJipt3CizNX7iV3k+jebV43ywK2t8KsHycAzMJxIzReNyJRJetWz2 +UCU2L40lHbwB393dWZGpwgt2VXYnoZK4KjfN12lj18MopHukwGayfRnre6jIQVm25hQ9X SrbjuxbozZcIOlfvX5fsP3upzZ/HLqmtCvNjnY9ikrfw9qEWPRLZD2a19UXlPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1669656416; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=oe9XHVZ08THe0j6jTrvEUxuGJBIsCFCRR9xJdnRmQCM=; b=VH+6UxVwyheU9QYpipMQqGng76zyqBY9UCcEpwVAuicacJQBckuWDblm2fj8V4CCp1s7Jv ZDjmgKEMmO2R4o6UuSxii443Si3QNH8g21EIeLAxxesqrA8XTrkDp9/eFgtGv3OBSGqv3m K1Fj9olXuBL6MJRTGp+OBLf/JPmsZJQPBw2TOXNFtjfGKgDzd0TkFBfsJW8PSebDw+O0o6 zMWuJLAolveSXWVm3ORlg6hRB0ood3kpifEzSu0lPFjz8qpFkGK3I4ljHDgC4ikCMKwSdr jdsU0uEPCeORcun/SyhpjY3tUKXKtaC4LfvLNupO029RpOeq8pwo3w6gXAiymw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1669656416; a=rsa-sha256; cv=none; b=AXnj0nzBJI7yE/hCVuh8cHaeQebRT33igSP05enW0AomtmS6tnGgunyP3AAVkG/joIaVfb AsFeZUkrKpwSggMLSbhWiLfZx8N+xV60pV3ECeI58PsKyqxqnoEUuWDfsi9ctfaA4SiPgV Tu1iQptApcbpYh2wkXbgCVpzO0xEh9eBAWb1ivQeNSaY/IZBRXXWnlXBK3pmpWubLIYxax qa5jM/Htn0hp8+3J0rFHXTDn/m5+BZqLeSOrjrmcGn3Hf6ClTphd55lzoGtJG12Mso6gr4 yCBXTK59cRNFl3tgDwOtp+dXOTU0JQnI90H3iBqSH/CdZFZDk5ZaNuS9Gri9ng== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4NLXTD1hV2zm5V; Mon, 28 Nov 2022 17:26:56 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ASHQu5N081032; Mon, 28 Nov 2022 17:26:56 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ASHQu7d081031; Mon, 28 Nov 2022 17:26:56 GMT (envelope-from git) Date: Mon, 28 Nov 2022 17:26:56 GMT Message-Id: <202211281726.2ASHQu7d081031@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 390fb97e18a6 - stable/13 - LinuxKPI: 802.11: add MO tracing List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: bz X-Git-Repository: src X-Git-Refname: refs/heads/stable/13 X-Git-Reftype: branch X-Git-Commit: 390fb97e18a65f26f29477557dee53a5d128d459 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=390fb97e18a65f26f29477557dee53a5d128d459 commit 390fb97e18a65f26f29477557dee53a5d128d459 Author: Bjoern A. Zeeb AuthorDate: 2022-10-23 21:48:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-11-28 16:30:10 +0000 LinuxKPI: 802.11: add MO tracing Add a macro to each implemented mac80211 operation. This currently turns into a printf if LINUXKPI_80211_DEBUG is defined but in the future could become a different probe as well. This is helpful for quick analysis and boot-time problem debugging when DTrace and other frameworks may be harder to use. Sponsored by: The FreeBSD Foundation (cherry picked from commit 64d3da006376576201677809474f8cebf061c81c) --- sys/compat/linuxkpi/common/src/linux_80211.c | 16 --------- sys/compat/linuxkpi/common/src/linux_80211.h | 20 +++++++++++ .../linuxkpi/common/src/linux_80211_macops.c | 42 ++++++++++++++++++++++ 3 files changed, 62 insertions(+), 16 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index bbaa20956f48..110aaabbc58c 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -88,22 +88,6 @@ SYSCTL_NODE(_compat_linuxkpi, OID_AUTO, 80211, CTLFLAG_RW | CTLFLAG_MPSAFE, 0, SYSCTL_INT(_compat_linuxkpi_80211, OID_AUTO, debug, CTLFLAG_RWTUN, &linuxkpi_debug_80211, 0, "LinuxKPI 802.11 debug level"); -#ifndef D80211_TODO -#define D80211_TODO 0x1 -#endif -#ifndef D80211_IMPROVE -#define D80211_IMPROVE 0x2 -#endif -#define D80211_TRACE 0x10 -#define D80211_TRACEOK 0x20 -#define D80211_TRACE_TX 0x100 -#define D80211_TRACE_TX_DUMP 0x200 -#define D80211_TRACE_RX 0x1000 -#define D80211_TRACE_RX_DUMP 0x2000 -#define D80211_TRACE_RX_BEACONS 0x4000 -#define D80211_TRACEX (D80211_TRACE_TX|D80211_TRACE_RX) -#define D80211_TRACEX_DUMP (D80211_TRACE_TX_DUMP|D80211_TRACE_RX_DUMP) -#define D80211_TRACE_STA 0x10000 #define UNIMPLEMENTED if (linuxkpi_debug_80211 & D80211_TODO) \ printf("XXX-TODO %s:%d: UNIMPLEMENTED\n", __func__, __LINE__) #define TRACEOK() if (linuxkpi_debug_80211 & D80211_TRACEOK) \ diff --git a/sys/compat/linuxkpi/common/src/linux_80211.h b/sys/compat/linuxkpi/common/src/linux_80211.h index 65e78ba0fc08..587549ee786a 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.h +++ b/sys/compat/linuxkpi/common/src/linux_80211.h @@ -42,6 +42,26 @@ #ifndef _LKPI_SRC_LINUX_80211_H #define _LKPI_SRC_LINUX_80211_H +/* #define LINUXKPI_DEBUG_80211 */ + +#ifndef D80211_TODO +#define D80211_TODO 0x1 +#endif +#ifndef D80211_IMPROVE +#define D80211_IMPROVE 0x2 +#endif +#define D80211_TRACE 0x10 +#define D80211_TRACEOK 0x20 +#define D80211_TRACE_TX 0x100 +#define D80211_TRACE_TX_DUMP 0x200 +#define D80211_TRACE_RX 0x1000 +#define D80211_TRACE_RX_DUMP 0x2000 +#define D80211_TRACE_RX_BEACONS 0x4000 +#define D80211_TRACEX (D80211_TRACE_TX|D80211_TRACE_RX) +#define D80211_TRACEX_DUMP (D80211_TRACE_TX_DUMP|D80211_TRACE_RX_DUMP) +#define D80211_TRACE_STA 0x10000 +#define D80211_TRACE_MO 0x100000 + struct lkpi_radiotap_tx_hdr { struct ieee80211_radiotap_header wt_ihdr; uint8_t wt_flags; diff --git a/sys/compat/linuxkpi/common/src/linux_80211_macops.c b/sys/compat/linuxkpi/common/src/linux_80211_macops.c index 4fede921f017..5e08ad570668 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211_macops.c +++ b/sys/compat/linuxkpi/common/src/linux_80211_macops.c @@ -39,6 +39,16 @@ __FBSDID("$FreeBSD$"); #include "linux_80211.h" +/* Could be a different tracing framework later. */ +#ifdef LINUXKPI_DEBUG_80211 +#define LKPI_80211_TRACE_MO(fmt, ...) \ + if (linuxkpi_debug_80211 & D80211_TRACE_MO) \ + printf("LKPI_80211_TRACE_MO %s:%d:_" fmt "\n", \ + __func__, __LINE__, __VA_ARGS__) +#else +#define LKPI_80211_TRACE_MO(...) do { } while(0) +#endif + int lkpi_80211_mo_start(struct ieee80211_hw *hw) { @@ -56,6 +66,7 @@ lkpi_80211_mo_start(struct ieee80211_hw *hw) error = EEXIST; goto out; } + LKPI_80211_TRACE_MO("hw %p", hw); error = lhw->ops->start(hw); if (error == 0) lhw->sc_flags |= LKPI_MAC80211_DRV_STARTED; @@ -73,6 +84,7 @@ lkpi_80211_mo_stop(struct ieee80211_hw *hw) if (lhw->ops->stop == NULL) return; + LKPI_80211_TRACE_MO("hw %p", hw); lhw->ops->stop(hw); lhw->sc_flags &= ~LKPI_MAC80211_DRV_STARTED; } @@ -89,6 +101,7 @@ lkpi_80211_mo_get_antenna(struct ieee80211_hw *hw, u32 *txs, u32 *rxs) goto out; } + LKPI_80211_TRACE_MO("hw %p", hw); error = lhw->ops->get_antenna(hw, txs, rxs); out: @@ -107,6 +120,7 @@ lkpi_80211_mo_set_frag_threshold(struct ieee80211_hw *hw, uint32_t frag_th) goto out; } + LKPI_80211_TRACE_MO("hw %p frag_th %u", hw, frag_th); error = lhw->ops->set_frag_threshold(hw, frag_th); out: @@ -125,6 +139,7 @@ lkpi_80211_mo_set_rts_threshold(struct ieee80211_hw *hw, uint32_t rts_th) goto out; } + LKPI_80211_TRACE_MO("hw %p rts_th %u", hw, rts_th); error = lhw->ops->set_rts_threshold(hw, rts_th); out: @@ -155,6 +170,7 @@ lkpi_80211_mo_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) } LKPI_80211_LVIF_UNLOCK(lvif); + LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif); error = lhw->ops->add_interface(hw, vif); if (error == 0) { LKPI_80211_LVIF_LOCK(lvif); @@ -184,6 +200,7 @@ lkpi_80211_mo_remove_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vi } LKPI_80211_LVIF_UNLOCK(lvif); + LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif); lhw->ops->remove_interface(hw, vif); LKPI_80211_LVIF_LOCK(lvif); lvif->added_to_drv = false; @@ -206,6 +223,7 @@ lkpi_80211_mo_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif, } lhw->scan_flags |= LKPI_LHW_SCAN_RUNNING; + LKPI_80211_TRACE_MO("hw %p vif %p sr %p", hw, vif, sr); error = lhw->ops->hw_scan(hw, vif, sr); if (error != 0) lhw->scan_flags &= ~LKPI_LHW_SCAN_RUNNING; @@ -223,6 +241,7 @@ lkpi_80211_mo_cancel_hw_scan(struct ieee80211_hw *hw, struct ieee80211_vif *vif) if (lhw->ops->cancel_hw_scan == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif); lhw->ops->cancel_hw_scan(hw, vif); } @@ -235,6 +254,7 @@ lkpi_80211_mo_sw_scan_complete(struct ieee80211_hw *hw, struct ieee80211_vif *vi if (lhw->ops->sw_scan_complete == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif); lhw->ops->sw_scan_complete(hw, vif); lhw->scan_flags &= ~LKPI_LHW_SCAN_RUNNING; } @@ -249,6 +269,7 @@ lkpi_80211_mo_sw_scan_start(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (lhw->ops->sw_scan_start == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p", hw, vif); lhw->ops->sw_scan_start(hw, vif, addr); } @@ -267,6 +288,7 @@ lkpi_80211_mo_prepare_multicast(struct ieee80211_hw *hw, if (lhw->ops->prepare_multicast == NULL) return (0); + LKPI_80211_TRACE_MO("hw %p mc_list %p", hw, mc_list); ptr = lhw->ops->prepare_multicast(hw, mc_list); return (ptr); } @@ -284,6 +306,7 @@ lkpi_80211_mo_configure_filter(struct ieee80211_hw *hw, unsigned int changed_fla if (mc_ptr == 0) return; + LKPI_80211_TRACE_MO("hw %p changed_flags %#x total_flags %p mc_ptr %ju", hw, changed_flags, total_flags, (uintmax_t)mc_ptr); lhw->ops->configure_filter(hw, changed_flags, total_flags, mc_ptr); } @@ -313,6 +336,7 @@ lkpi_80211_mo_sta_add(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto out; } + LKPI_80211_TRACE_MO("hw %p vif %p sta %p", hw, vif, sta); error = lhw->ops->sta_add(hw, vif, sta); if (error == 0) lsta->added_to_drv = true; @@ -342,6 +366,7 @@ lkpi_80211_mo_sta_remove(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto out; } + LKPI_80211_TRACE_MO("hw %p vif %p sta %p", hw, vif, sta); error = lhw->ops->sta_remove(hw, vif, sta); if (error == 0) lsta->added_to_drv = false; @@ -361,6 +386,7 @@ lkpi_80211_mo_sta_state(struct ieee80211_hw *hw, struct ieee80211_vif *vif, lhw = HW_TO_LHW(hw); lsta = STA_TO_LSTA(sta); if (lhw->ops->sta_state != NULL) { + LKPI_80211_TRACE_MO("hw %p vif %p sta %p nstate %d", hw, vif, sta, nstate); error = lhw->ops->sta_state(hw, vif, sta, lsta->state, nstate); if (error == 0) { if (nstate == IEEE80211_STA_NOTEXIST) @@ -405,6 +431,7 @@ lkpi_80211_mo_config(struct ieee80211_hw *hw, uint32_t changed) goto out; } + LKPI_80211_TRACE_MO("hw %p changed %u", hw, changed); error = lhw->ops->config(hw, changed); out: @@ -425,6 +452,7 @@ lkpi_80211_mo_assign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif * goto out; } + LKPI_80211_TRACE_MO("hw %p vif %p chanctx_conf %p", hw, vif, chanctx_conf); error = lhw->ops->assign_vif_chanctx(hw, vif, NULL, chanctx_conf); if (error == 0) vif->chanctx_conf = chanctx_conf; @@ -446,6 +474,7 @@ lkpi_80211_mo_unassign_vif_chanctx(struct ieee80211_hw *hw, struct ieee80211_vif if (*chanctx_conf == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p chanctx_conf %p", hw, vif, *chanctx_conf); lhw->ops->unassign_vif_chanctx(hw, vif, NULL, *chanctx_conf); *chanctx_conf = NULL; } @@ -464,6 +493,7 @@ lkpi_80211_mo_add_chanctx(struct ieee80211_hw *hw, goto out; } + LKPI_80211_TRACE_MO("hw %p chanctx_conf %p", hw, chanctx_conf); error = lhw->ops->add_chanctx(hw, chanctx_conf); out: @@ -480,6 +510,7 @@ lkpi_80211_mo_change_chanctx(struct ieee80211_hw *hw, if (lhw->ops->change_chanctx == NULL) return; + LKPI_80211_TRACE_MO("hw %p chanctx_conf %p changed %u", hw, chanctx_conf, changed); lhw->ops->change_chanctx(hw, chanctx_conf, changed); } @@ -493,6 +524,7 @@ lkpi_80211_mo_remove_chanctx(struct ieee80211_hw *hw, if (lhw->ops->remove_chanctx == NULL) return; + LKPI_80211_TRACE_MO("hw %p chanctx_conf %p", hw, chanctx_conf); lhw->ops->remove_chanctx(hw, chanctx_conf); } @@ -506,6 +538,7 @@ lkpi_80211_mo_bss_info_changed(struct ieee80211_hw *hw, struct ieee80211_vif *vi if (lhw->ops->bss_info_changed == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p conf %p changed %#jx", hw, vif, conf, (uintmax_t)changed); lhw->ops->bss_info_changed(hw, vif, conf, changed); } @@ -523,6 +556,7 @@ lkpi_80211_mo_conf_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, goto out; } + LKPI_80211_TRACE_MO("hw %p vif %p ac %u txpq %p", hw, vif, ac, txqp); error = lhw->ops->conf_tx(hw, vif, 0, ac, txqp); out: @@ -539,6 +573,7 @@ lkpi_80211_mo_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (lhw->ops->flush == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p nqueues %u drop %d", hw, vif, nqueues, drop); lhw->ops->flush(hw, vif, nqueues, drop); } @@ -552,6 +587,7 @@ lkpi_80211_mo_mgd_prepare_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif, if (lhw->ops->mgd_prepare_tx == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p txinfo %p", hw, vif, txinfo); lhw->ops->mgd_prepare_tx(hw, vif, txinfo); } @@ -565,6 +601,7 @@ lkpi_80211_mo_mgd_complete_tx(struct ieee80211_hw *hw, struct ieee80211_vif *vif if (lhw->ops->mgd_complete_tx == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p txinfo %p", hw, vif, txinfo); lhw->ops->mgd_complete_tx(hw, vif, txinfo); } @@ -578,6 +615,7 @@ lkpi_80211_mo_tx(struct ieee80211_hw *hw, struct ieee80211_tx_control *txctrl, if (lhw->ops->tx == NULL) return; + LKPI_80211_TRACE_MO("hw %p txctrl %p skb %p", hw, txctrl, skb); lhw->ops->tx(hw, txctrl, skb); } @@ -590,6 +628,7 @@ lkpi_80211_mo_wake_tx_queue(struct ieee80211_hw *hw, struct ieee80211_txq *txq) if (lhw->ops->wake_tx_queue == NULL) return; + LKPI_80211_TRACE_MO("hw %p txq %p", hw, txq); lhw->ops->wake_tx_queue(hw, txq); } @@ -602,6 +641,7 @@ lkpi_80211_mo_sync_rx_queues(struct ieee80211_hw *hw) if (lhw->ops->sync_rx_queues == NULL) return; + LKPI_80211_TRACE_MO("hw %p", hw); lhw->ops->sync_rx_queues(hw); } @@ -615,6 +655,7 @@ lkpi_80211_mo_sta_pre_rcu_remove(struct ieee80211_hw *hw, if (lhw->ops->sta_pre_rcu_remove == NULL) return; + LKPI_80211_TRACE_MO("hw %p vif %p sta %p", hw, vif, sta); lhw->ops->sta_pre_rcu_remove(hw, vif, sta); } @@ -632,6 +673,7 @@ lkpi_80211_mo_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, goto out; } + LKPI_80211_TRACE_MO("hw %p cmd %d vif %p sta %p kc %p", hw, cmd, vif, sta, kc); error = lhw->ops->set_key(hw, cmd, vif, sta, kc); out: