From nobody Wed Oct 4 15:23:39 2023 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 4S0z3v5PGTz4w6dh; Wed, 4 Oct 2023 15:23:39 +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 4S0z3v4pFkz4MJP; Wed, 4 Oct 2023 15:23:39 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696433019; 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=AAZknI050IRJHKENpKa6+6QbtVCgMsAbGNzamiB4z1Q=; b=nijWvdf3ujLbXVmfwb+L3WHkgxvTZTW64eDEyeV9rB4LVSRr462v4r0iH7g8tHeu/0NOrr FtNrsXqIjChSa33BJSmEuhSmC4AG+rIdHkb2PwMRLWwUrxUO7EAVn899X9oUU5/ELcbvcR DxiZzsTqSeWnzM9/0wzhU+H5DyFKLgJyg07nb/FkHqFoKwJBfR2T4imFOlKVItwMUti0H/ MuSPz/MePcroN+DOphWwM0p0fVjc9EwCEkJfABclZ+khjkciKEpPATHe3YR3qDWg/hsnBY WZcOTQjEQae3diMtDDfn607aOLOv+BjL3pCC4tfFyLsAyamaqtoWF2CUk1qYgg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1696433019; a=rsa-sha256; cv=none; b=f32oO++mXyN+C43rgCuUjfyuV2vJDK/+nnT5GHz1b95nkss+ACes4bMNQWungAJWtriEye gSc/UH6/eUIGlCRnPqHBjm29kC907MFGd8Aho4eIILf6p4UDBhkpRDXCTOVFVk9NKWF++t us60rmCrKJ51sGFkSICG6gV+ERbq8wrNiA6xzq78SMa9eOXO7pk58hSZTzPC1zTRyW7hri 0JS7X0vvZJrwCWzhXW59yQ/pvgudpEsYTISmxil0JxdRqmSz9/1dlLLdVm6AW0hMTIJWPd /QkkCqQtWds85YzPrN6431gMJW3X4N8VZ8AhNPU6K0GaFS9GDF+t867djmw1qA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1696433019; 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=AAZknI050IRJHKENpKa6+6QbtVCgMsAbGNzamiB4z1Q=; b=NeaCp8dNemn/gMEzVhThyJ2gHHaF2mpqjewGlAx7WatrNtzYA8LhzyYlDzRFRi+mMxnvfb Tc+9X41QtiysSSdbRsAhDnd2WXmH3TQBQPDBrq3JnGx91Acpb3GF3K1QwNGo0ZpmqzmJQo FJ1rT+DKrO1wjusn1Wr1Za64zHIJP7glRc7E41XetGF+x8T98zcT2FfWwxrom65ffZiu7Q sAPpds1WEfdcNfcPN3BvD8wgKtWAp4kvwVriOiLj//9CCjjAjRKPoRcup3v6pd0gZTNbFe R7EbP/LjSznSKpuUEfVpL7psmVg7SopRtdyo3gyGZsQbJwmE+4LIthHJTh7bjg== 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 4S0z3v3j3SzjdK; Wed, 4 Oct 2023 15:23:39 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 394FNde5086698; Wed, 4 Oct 2023 15:23:39 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 394FNdi0086695; Wed, 4 Oct 2023 15:23:39 GMT (envelope-from git) Date: Wed, 4 Oct 2023 15:23:39 GMT Message-Id: <202310041523.394FNdi0086695@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: 20ca85c50d78 - stable/14 - net80211: improve scan debugging 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/14 X-Git-Reftype: branch X-Git-Commit: 20ca85c50d782dab4bf4306db4ac0e6164a42b53 Auto-Submitted: auto-generated The branch stable/14 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=20ca85c50d782dab4bf4306db4ac0e6164a42b53 commit 20ca85c50d782dab4bf4306db4ac0e6164a42b53 Author: Bjoern A. Zeeb AuthorDate: 2023-09-14 17:36:29 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-10-04 15:19:17 +0000 net80211: improve scan debugging While debugging other problems I ran into the case where net80211 was thinking a scan was ongoing and new scans could not be started but given other logging there was clearly no more scan running. It was hard after the fact to quickly determine enough state to reconstruct or validate assumptions. Improve a MSG_SCAN debug logging and implement _db_show_scan() ddb output which can be printed along with show com /S or /a. Sponsored by: The FreeBSD Foundation (cherry picked from commit 33396ec29f1daae31f4738f0da98dce168ca73c6) --- sys/net80211/ieee80211_ddb.c | 74 ++++++++++++++++++++++++++++++++++++++---- sys/net80211/ieee80211_ioctl.c | 6 ++-- sys/net80211/ieee80211_scan.h | 6 +++- 3 files changed, 77 insertions(+), 9 deletions(-) diff --git a/sys/net80211/ieee80211_ddb.c b/sys/net80211/ieee80211_ddb.c index 4e2df134c7a9..525814d202b1 100644 --- a/sys/net80211/ieee80211_ddb.c +++ b/sys/net80211/ieee80211_ddb.c @@ -67,7 +67,7 @@ static void _db_show_sta(const struct ieee80211_node *); static void _db_show_vap(const struct ieee80211vap *, int, int); static void _db_show_com(const struct ieee80211com *, - int showvaps, int showsta, int showmesh, int showprocs); + int showvaps, int showsta, int showmesh, int showprocs, int); static void _db_show_all_vaps(void *, struct ieee80211com *); @@ -132,7 +132,7 @@ DB_SHOW_COMMAND(vap, db_show_vap) DB_SHOW_COMMAND(com, db_show_com) { const struct ieee80211com *ic; - int i, showprocs = 0, showvaps = 0, showsta = 0, showmesh = 0; + int i, showprocs = 0, showvaps = 0, showsta = 0, showmesh = 0, showscan = 0; if (!have_addr) { db_printf("usage: show com \n"); @@ -141,7 +141,10 @@ DB_SHOW_COMMAND(com, db_show_com) for (i = 0; modif[i] != '\0'; i++) switch (modif[i]) { case 'a': - showsta = showmesh = showvaps = showprocs = 1; + showsta = showmesh = showvaps = showprocs = showscan = 1; + break; + case 'S': + showscan = 1; break; case 's': showsta = 1; @@ -158,7 +161,7 @@ DB_SHOW_COMMAND(com, db_show_com) } ic = (const struct ieee80211com *) addr; - _db_show_com(ic, showvaps, showsta, showmesh, showprocs); + _db_show_com(ic, showvaps, showsta, showmesh, showprocs, showscan); } DB_SHOW_ALL_COMMAND(vaps, db_show_all_vaps) @@ -345,6 +348,61 @@ _db_show_tdma(const char *sep, const struct ieee80211_tdma_state *ts, int showpr } #endif /* IEEE80211_SUPPORT_TDMA */ +static void +_db_show_scan(const struct ieee80211_scan_state *ss, int showprocs) +{ + int i; + const struct ieee80211_scanner *ss_ops; + + db_printf("SCAN %p:", ss); + db_printf(" vap %p ic %p", ss->ss_vap, ss->ss_ic); + db_printf("\n"); + + db_printf("\tss_ops %p (%s) ss_priv %p", + ss->ss_ops, ss->ss_ops->scan_name, ss->ss_priv); + db_printf("\n"); + if (showprocs) { + ss_ops = ss->ss_ops; + DB_PRINTSYM("\t", "scan_attach", ss_ops->scan_attach); + DB_PRINTSYM("\t", "scan_detach", ss_ops->scan_detach); + DB_PRINTSYM("\t", "scan_start", ss_ops->scan_start); + DB_PRINTSYM("\t", "scan_restart", ss_ops->scan_restart); + DB_PRINTSYM("\t", "scan_cancel", ss_ops->scan_cancel); + DB_PRINTSYM("\t", "scan_end", ss_ops->scan_end); + DB_PRINTSYM("\t", "scan_flush", ss_ops->scan_flush); + DB_PRINTSYM("\t", "scan_pickchan", ss_ops->scan_pickchan); + DB_PRINTSYM("\t", "scan_add", ss_ops->scan_add); + DB_PRINTSYM("\t", "scan_age", ss_ops->scan_age); + DB_PRINTSYM("\t", "scan_assoc_fail", ss_ops->scan_assoc_fail); + DB_PRINTSYM("\t", "scan_assoc_success", ss_ops->scan_assoc_success); + DB_PRINTSYM("\t", "scan_iterate", ss_ops->scan_iterate); + DB_PRINTSYM("\t", "scan_spare0", ss_ops->scan_spare0); + DB_PRINTSYM("\t", "scan_spare1", ss_ops->scan_spare1); + DB_PRINTSYM("\t", "scan_spare2", ss_ops->scan_spare2); + DB_PRINTSYM("\t", "scan_spare3", ss_ops->scan_spare3); + } + + db_printf("\tss_flags %b", ss->ss_flags, IEEE80211_SS_FLAGS_BITS); + db_printf("\n"); + + db_printf("\tss_nssid %u", ss->ss_nssid); + for (i = 0; i < ss->ss_nssid && i < IEEE80211_SCAN_MAX_SSID; i++) + _db_show_ssid(" ss_nssid[%d]", i, + ss->ss_ssid[i].len, ss->ss_ssid[i].ssid); + db_printf("\n"); + + db_printf("\tss_chans:\n"); + for (i = 0; i < ss->ss_last && i < IEEE80211_SCAN_MAX; i++) { + db_printf("\t%-3d", i); + _db_show_channel(" ", ss->ss_chans[i]); + db_printf("\n"); + } + + db_printf("\tss_next %u ss_last %u ss_mindwell %lu ss_maxdwell %lu", + ss->ss_next, ss->ss_last, ss->ss_mindwell, ss->ss_maxdwell); + db_printf("\n"); +} + static void _db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) { @@ -532,7 +590,7 @@ _db_show_vap(const struct ieee80211vap *vap, int showmesh, int showprocs) static void _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, - int showmesh, int showprocs) + int showmesh, int showprocs, int showscan) { struct ieee80211vap *vap; @@ -679,6 +737,10 @@ _db_show_com(const struct ieee80211com *ic, int showvaps, int showsta, DB_PRINTSYM("\t", "ic_addba_response", ic->ic_addba_response); DB_PRINTSYM("\t", "ic_addba_stop", ic->ic_addba_stop); } + if (showscan) { + db_printf("\n"); + _db_show_scan(ic->ic_scan, showprocs); + } if (showvaps && !TAILQ_EMPTY(&ic->ic_vaps)) { db_printf("\n"); TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) @@ -707,7 +769,7 @@ _db_show_all_vaps(void *arg, struct ieee80211com *ic) db_printf(" %s(%p)", if_name(vap->iv_ifp), vap); db_printf("\n"); } else - _db_show_com(ic, 1, 1, 1, 1); + _db_show_com(ic, 1, 1, 1, 1, 1); } static void diff --git a/sys/net80211/ieee80211_ioctl.c b/sys/net80211/ieee80211_ioctl.c index 6fe39f588bab..674d163e3e67 100644 --- a/sys/net80211/ieee80211_ioctl.c +++ b/sys/net80211/ieee80211_ioctl.c @@ -2590,8 +2590,10 @@ ieee80211_scanreq(struct ieee80211vap *vap, struct ieee80211_scan_req *sr) sr->sr_flags |= IEEE80211_IOC_SCAN_NOPICK; IEEE80211_DPRINTF(vap, IEEE80211_MSG_SCAN, - "%s: flags 0x%x%s duration 0x%x mindwell %u maxdwell %u nssid %d\n", - __func__, sr->sr_flags, + "%s: vap %p iv_state %#x (%s) flags 0x%x%s " + "duration 0x%x mindwell %u maxdwell %u nssid %d\n", + __func__, vap, vap->iv_state, ieee80211_state_name[vap->iv_state], + sr->sr_flags, (vap->iv_ifp->if_flags & IFF_UP) == 0 ? " (!IFF_UP)" : "", sr->sr_duration, sr->sr_mindwell, sr->sr_maxdwell, sr->sr_nssid); /* diff --git a/sys/net80211/ieee80211_scan.h b/sys/net80211/ieee80211_scan.h index 4274f3948db6..a33864b102e2 100644 --- a/sys/net80211/ieee80211_scan.h +++ b/sys/net80211/ieee80211_scan.h @@ -147,6 +147,10 @@ struct ieee80211_scan_state { unsigned long ss_maxdwell; /* max dwell on channel */ }; +#define IEEE80211_SS_FLAGS_BITS \ + "\20\1NOPICK\2ACTIVE\3PICK1ST\4BGSCAN\5ONCE\6NOBCAST\7NOJOIN" \ + "\15GOTPICK" + /* * The upper 16 bits of the flags word is used to communicate * information to the scanning code that is NOT recorded in @@ -328,7 +332,7 @@ struct ieee80211_scanner { void (*scan_spare0)(void); void (*scan_spare1)(void); void (*scan_spare2)(void); - void (*scan_spare4)(void); + void (*scan_spare3)(void); }; void ieee80211_scanner_register(enum ieee80211_opmode, const struct ieee80211_scanner *);