From nobody Thu Sep 14 21:21:12 2023 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 4Rmqxj26wsz4sRqG; Thu, 14 Sep 2023 21:21:13 +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 4Rmqxj1JpVz3C17; Thu, 14 Sep 2023 21:21:13 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1694726473; 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=JECifPXkwhzhe68ZD717YWK4B0QFM8A9EjN9nQW4NbY=; b=EmR34MDnHl2nCcCfeu+QtJYWs+AKeDOjpkkAaLg/f2U69WcfWuziFiHJZWJHelKOj/3igc v3qrbkCS5w9D/W3GfFfHzWXUgtquy1HiseWiKCVoxAnOAC5v32mREV4Nu9rfVuzcdUA6X7 an+zvRJSAIb25Oa2bI0cXLirEpL0ne7mtYbvPChPhxOT78RF1KqKsFTujFGgSn7SiMQGAu JgZ4SLxHMwsEwbDHd447llzt45gDVpBCaiBWbtWFvxXAJcNxgw9qqg37evJydeANILpF8R WTZmEjjquz/Gzls20R++3mIb+vsR4UXq/Ymfgp6Mczyqv9I3ITNBNDibeQiUVg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1694726473; a=rsa-sha256; cv=none; b=IiKLdCsQdABKlz2LggYGEOMeQCP50lBjB3DoXgG6kCJxoJw8MOU4eOCPYBNMuNh56IpoU7 I3CFyo0LLmp3N/TtngvrxcBH32KrAqbZvDGe7bksI5qZ/FKBSsHt818qYn+Wws3tr9DFDD lWfR5bd9tnjU+mhYbfgpn+Mgv0gbA8SsO/hI+pyhAllbrXGWyrjJzp4pztINJjZ7CMwOxB acz1MQo+3c11QqK/cM7D+n2hKpvoIT2nSg8iL/muAngn//LTXH/y/m/Lqs/YPhDtr274/h MhG+tUSzloCU+BpaXeaZq0oRl/mxylYRIhfax/ncLMSp1W4AODmPTavxeZrWjg== 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=1694726473; 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=JECifPXkwhzhe68ZD717YWK4B0QFM8A9EjN9nQW4NbY=; b=FDd47r8MC+XY66BCcc/sOSAALij86RdbtO6ekSVtL/ww/+uiLCn/E6XkP+DiFLSWfgjzZm Ef6A+sw4wYf7SkpmZAna7u7MySwblgw7OOR8o6Ajy1jJl/lIwNok+MKlqcgvYa+18oHFTM tNWRPYgPYWdrY8afZQR4joLrTd9ozB2T4jpAM4zXNHyMT7xjzjpIqHpybIa3prYh+mKmm5 +T6Lqe6OhoseQbi4NtrjGMC0uH1wmYPxxCrRsRCIPbShbWG4rwaM+5CA6PydIskli6ligI 9lGes5m4aovxpKrYWEzvb5lAx3Iw32mPjSj/qzXbyJGibdWc+Kj6zsN2WjBQbw== 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 4Rmqxj09V8z1C3N; Thu, 14 Sep 2023 21:21:13 +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 38ELLCuC023388; Thu, 14 Sep 2023 21:21:12 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38ELLCsL023385; Thu, 14 Sep 2023 21:21:12 GMT (envelope-from git) Date: Thu, 14 Sep 2023 21:21:12 GMT Message-Id: <202309142121.38ELLCsL023385@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: 33396ec29f1d - main - net80211: improve scan debugging 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: 33396ec29f1daae31f4738f0da98dce168ca73c6 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=33396ec29f1daae31f4738f0da98dce168ca73c6 commit 33396ec29f1daae31f4738f0da98dce168ca73c6 Author: Bjoern A. Zeeb AuthorDate: 2023-09-14 17:36:29 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-09-14 21:20:54 +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 MFC after: 3 days --- 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 *);