From nobody Wed Mar 30 15:49:37 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 1036C1A53F12; Wed, 30 Mar 2022 15:49:38 +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 4KT9q53MMSz3kFC; Wed, 30 Mar 2022 15:49:37 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648655377; 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=q9YeQ2kADP4jjxOHJgTVaICTeY5PEw92xF+FZgtrsRw=; b=qEMEVhgl5kGOAXMaP+iygGTvobHf5kOJqp9q22Ru6SHtnvTWsHbL0d7rQbaMq0FFwoRjtJ eKHb6kDr5axTI640C6hviVN3ahQtHKHqhLpxJewinrd4wyPMcdUWTEw94cMkXoa1iqmXFw 1ZwpG/0eA4tUeu9uEcRMJ8T3kzMMN9r80LLAXNou65Kpbfdt5swFFVDF+fGKT786gqDbM/ hER3wEgnxbUkH5dDfvl1B0aYYCKaAw2C3T83VF9gyRGn9nCrcZFj9WpmaiGoMwVhglx6s4 gvgLVRqoUkoeHr8+KzAeGHbqooEybfPgCKhwwzgu+/mWPXM+Kr5ouQ/+e4YHbg== 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 4B718156EC; Wed, 30 Mar 2022 15:49:37 +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 22UFnba7019108; Wed, 30 Mar 2022 15:49:37 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22UFnbl7019107; Wed, 30 Mar 2022 15:49:37 GMT (envelope-from git) Date: Wed, 30 Mar 2022 15:49:37 GMT Message-Id: <202203301549.22UFnbl7019107@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: eb730e379a0d - releng/13.1 - net80211: introduce (*iv_update_bss)() 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/releng/13.1 X-Git-Reftype: branch X-Git-Commit: eb730e379a0d0111d2f8b6a89c11b5f80e8ed47c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648655377; 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=q9YeQ2kADP4jjxOHJgTVaICTeY5PEw92xF+FZgtrsRw=; b=R8WdyvZwObzWsRrXoO45xbi1h1ACaTGxfs/W7Vm1HmmhdKeqlx/b2ONhtkhGsV4GI5SA/4 V5FtilE/e4VMdFiDKkFTXcKgjs+z1KH34l+OClgDZFusGBufQbpkyYr2N6pYF3Y2HyPXV3 /mQ9gE1L41ArsDVAC2x+RTLbxkIZzYjzDyFCjACFDaCZXaFQEnEpdAVy8dbh0RzPUDr6H9 eZylZfri4m9iLOUOcpcQEvYCtCfrS23Vdopl7qCK36OdnidmvBYZtr+IOHjtFG2XyruBE2 j02WIWG6oVqK25Fa6FrCgF5IgBvAHcsIJs3+7pNlJnkbfUZ8mismDnES+1TqUQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648655377; a=rsa-sha256; cv=none; b=s5palTypTyl9sjFwpNt5SWhLIeD912KkBu2I+/L7iOBnvPk6Mxs/HhhKKYbfifi7SvgGXs CXyHOiLQdrfJ5JUKOhtTcSU8X0jJ8P9fhmsp1G0XUd//zcSWcDPzq70vrSD3J1OZ8XlISC U/1+gUIKuiO/BVMnbbDknmh6D+k+m3O/Db1EGl8lD/6Eph36ZDtqNzV9WisE/OIxu8CSMB jp9zNgsCeMnVKhcYwUehjQvcFD/zFAjyvKvDRaAb/Wgk2OThppXJmgFAOI8uGJtQR6+wGG U4I5uRfjHj4XE875SZemDWzs0is7f+dGt9qASE+tZ55A4WFajB0fGYOkdwX+kQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch releng/13.1 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=eb730e379a0d0111d2f8b6a89c11b5f80e8ed47c commit eb730e379a0d0111d2f8b6a89c11b5f80e8ed47c Author: Bjoern A. Zeeb AuthorDate: 2022-03-22 14:46:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-30 15:44:56 +0000 net80211: introduce (*iv_update_bss)() Introduce (*iv_update_bss)() with a default implementation to allow drivers to overload/intercept the time when we swap iv_bss. This helps firmware based drivers to synchronize state with firmware. Otherwise, for some state changes, we begin with one ni (and in LinuxKPI lsta) and try to finish with another ni (and a new lsta in different state) and may no longer have access to the previous state. This also saves us from constantly checking for ni changes complicating code. No functional changes intended. Sponsored by: The FreeBSD Foundation Approved by: re (gjb) (cherry picked from commit 91b4225aa1d81155668db6deed22084abf2ce23c) (cherry picked from commit dd39ea27f356f660736d5eb45b0a5aece63698bb) --- sys/net80211/ieee80211_node.c | 8 +++----- sys/net80211/ieee80211_proto.c | 14 ++++++++++++++ sys/net80211/ieee80211_var.h | 8 +++++++- sys/net80211/ieee80211_wds.c | 6 ++---- 4 files changed, 26 insertions(+), 10 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 3df534edfa55..66629ab87af3 100644 --- a/sys/net80211/ieee80211_node.c +++ b/sys/net80211/ieee80211_node.c @@ -197,7 +197,7 @@ ieee80211_node_vdetach(struct ieee80211vap *vap) ieee80211_node_table_reset(&ic->ic_sta, vap); if (vap->iv_bss != NULL) { ieee80211_free_node(vap->iv_bss); - vap->iv_bss = NULL; + vap->iv_update_bss(vap, NULL); } if (vap->iv_aid_bitmap != NULL) { IEEE80211_FREE(vap->iv_aid_bitmap, M_80211_NODE); @@ -453,8 +453,7 @@ ieee80211_reset_bss(struct ieee80211vap *vap) ni = ieee80211_alloc_node(&ic->ic_sta, vap, vap->iv_myaddr); KASSERT(ni != NULL, ("unable to setup initial BSS node")); - obss = vap->iv_bss; - vap->iv_bss = ieee80211_ref_node(ni); + obss = vap->iv_update_bss(vap, ieee80211_ref_node(ni)); if (obss != NULL) { copy_bss(ni, obss); ni->ni_intval = ic->ic_bintval; @@ -846,7 +845,7 @@ ieee80211_sta_join1(struct ieee80211_node *selbs) /* * Committed to selbs, setup state. */ - obss = vap->iv_bss; + obss = vap->iv_update_bss(vap, selbs); /* NB: caller assumed to bump refcnt */ /* * Check if old+new node have the same address in which * case we can reassociate when operating in sta mode. @@ -855,7 +854,6 @@ ieee80211_sta_join1(struct ieee80211_node *selbs) canreassoc = (obss != NULL && vap->iv_state == IEEE80211_S_RUN && IEEE80211_ADDR_EQ(obss->ni_macaddr, selbs->ni_macaddr)); - vap->iv_bss = selbs; /* NB: caller assumed to bump refcnt */ if (obss != NULL) { struct ieee80211_node_table *nt = obss->ni_table; diff --git a/sys/net80211/ieee80211_proto.c b/sys/net80211/ieee80211_proto.c index 98a04e5251f0..2228983050a2 100644 --- a/sys/net80211/ieee80211_proto.c +++ b/sys/net80211/ieee80211_proto.c @@ -249,6 +249,8 @@ static void vap_update_erp_protmode(void *, int); static void vap_update_preamble(void *, int); static void vap_update_ht_protmode(void *, int); static void ieee80211_newstate_cb(void *, int); +static struct ieee80211_node *vap_update_bss(struct ieee80211vap *, + struct ieee80211_node *); static int null_raw_xmit(struct ieee80211_node *ni, struct mbuf *m, @@ -394,6 +396,7 @@ ieee80211_proto_vattach(struct ieee80211vap *vap) vap->iv_update_beacon = null_update_beacon; vap->iv_deliver_data = ieee80211_deliver_data; vap->iv_protmode = IEEE80211_PROT_CTSONLY; + vap->iv_update_bss = vap_update_bss; /* attach support for operating mode */ ic->ic_vattach[vap->iv_opmode](vap); @@ -824,6 +827,17 @@ ieee80211_reset_erp(struct ieee80211com *ic) /* XXX TODO: schedule a new per-VAP ERP calculation */ } +static struct ieee80211_node * +vap_update_bss(struct ieee80211vap *vap, struct ieee80211_node *ni) +{ + struct ieee80211_node *obss; + + obss = vap->iv_bss; + vap->iv_bss = ni; + + return (obss); +} + /* * Deferred slot time update. * diff --git a/sys/net80211/ieee80211_var.h b/sys/net80211/ieee80211_var.h index e70b7f8e2bb6..a361e2c72028 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -605,7 +605,13 @@ struct ieee80211vap { struct ieee80211_rx_histogram *rx_histogram; struct ieee80211_tx_histogram *tx_histogram; - uint64_t iv_spare[6]; + struct ieee80211_node * (*iv_update_bss)(struct ieee80211vap *, + struct ieee80211_node *); + +#ifdef __ILP32__ + uint32_t iv_spare0; +#endif + uint64_t iv_spare[5]; }; MALLOC_DECLARE(M_80211_VAP); diff --git a/sys/net80211/ieee80211_wds.c b/sys/net80211/ieee80211_wds.c index b73988b10d5e..464e658797e6 100644 --- a/sys/net80211/ieee80211_wds.c +++ b/sys/net80211/ieee80211_wds.c @@ -179,8 +179,7 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) /* * Committed to new node, setup state. */ - obss = vap->iv_bss; - vap->iv_bss = ni; + obss = vap->iv_update_bss(vap, ni); ni->ni_wdsvap = vap; } IEEE80211_NODE_UNLOCK(nt); @@ -201,8 +200,7 @@ ieee80211_create_wds(struct ieee80211vap *vap, struct ieee80211_channel *chan) */ ni = ieee80211_node_create_wds(vap, vap->iv_des_bssid, chan); if (ni != NULL) { - obss = vap->iv_bss; - vap->iv_bss = ieee80211_ref_node(ni); + obss = vap->iv_update_bss(vap, ieee80211_ref_node(ni)); ni->ni_flags |= IEEE80211_NODE_AREF; if (obss != NULL) ieee80211_free_node(obss);