From nobody Sun Oct 23 21:53:59 2022 X-Original-To: dev-commits-src-main@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 4MwX600pcpz4gR3H; Sun, 23 Oct 2022 21:54:00 +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 4MwX5z6mFLz3MSM; Sun, 23 Oct 2022 21:53:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666562040; 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=6VSkNYIBo8QtbC4/wQAdSAlghMdfCzUc+zsWOiAf+N4=; b=OwJeN91rCUwCsIpkNLrnlwYpDIK0ijgNXPcl4R0DqoXZ7OaZ+j4SjssN0jqJPUWLnbUjth dU8imGssY5B4U3782Q9Roip47m49olr4QU9T0gWTlDL0U8qF0/Rp4NSv7O2kGK30maRR92 gk7TBhojDyM3JGUbPXb5yocDDb2TwlbITDx7OvnSPBs0i3WcaHSRhqeXI7ddi33vUn2rK3 0ndRdCFB2UY4CIb7qlERjV9qST1c0X22sKL5i/vD8IrZMA7tpFsPglC7BdA3xyNpa/xlIM MnE3FzAXCYseo7F0H/Zb1a2FNFq+0HsJS+HvaDqURfeQ58yoBnbh0dQ35i1PgQ== 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 4MwX5z5pLlz12C6; Sun, 23 Oct 2022 21:53:59 +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 29NLrxiF071936; Sun, 23 Oct 2022 21:53:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 29NLrx5u071935; Sun, 23 Oct 2022 21:53:59 GMT (envelope-from git) Date: Sun, 23 Oct 2022 21:53:59 GMT Message-Id: <202210232153.29NLrx5u071935@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: "Bjoern A. Zeeb" Subject: git: 64d3da006376 - main - LinuxKPI: 802.11: add MO tracing List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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/main X-Git-Reftype: branch X-Git-Commit: 64d3da006376576201677809474f8cebf061c81c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1666562040; 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=6VSkNYIBo8QtbC4/wQAdSAlghMdfCzUc+zsWOiAf+N4=; b=o/p6pCaoE1GpJ2ZmO3rsT3tX6w6AWD+Fdyel5RouFpyjPF3PqZmSeoYaCP29y0QZC7o7jY Kb7e/AodgN1HUH6HtOw6/O6qcnfaWHIhXSv3OlAVcrtLgpzNNBd6axKMr2WwRP3P0R34mV fLscwDWCE/64+1HUWO0YFI0e/pW+XzbrP+0Lc+bcB/XujfcPM/3crQAgOEzmyCWncdh4IS /KivUk9veWyktOJ8EBJuqI1dtlt4I1EL2g4Nj4zG8vGojTjoi/H8U6LSEKuRLLUVsi49qF FUI3aEVS2Q+klmHxhmWX74NZ2MrYmPzxZUhVSkrulE28mVNu8g+OLjRSlNxpGA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1666562040; a=rsa-sha256; cv=none; b=Mzg7MH2aLF84ojumwYCraxRf+yjMjrDwEHZGe1jvoZHH7F2+bP4moVKVPGwd4zYDIXdmh6 yW4TvFclsGG2h5cvwghYFlSAXg1ddEyWFzsk8GO15/PP5sCa4nivHKU5T7I+RK6nicXIl9 NOYMDBPZ2XOQtLrqkrQUCCFWOvG3MFcC/IP2dQ9kG8PUm4oDnUXJySzKI8BnzVPKBiCS7U D7WJZC8DqrU6+VzrAYrYRCOgBAXDVovQ2GGFVbpFXRnnOznppi7MYKfPVyIujKR0NMcsjC jKNOnoCwnKMDQANgSdyhOOmthPhH2tziw9wGss+c5cYbUbcfSyWNWwEAX3rQFw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=64d3da006376576201677809474f8cebf061c81c commit 64d3da006376576201677809474f8cebf061c81c Author: Bjoern A. Zeeb AuthorDate: 2022-10-23 21:48:22 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-10-23 21:48:22 +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 MFC after: 3 days --- 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 1eb520b2140f..b4438c0b1518 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: