From nobody Sun Mar 27 20:13:55 2022 X-Original-To: dev-commits-src-branches@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 61A561A52F86; Sun, 27 Mar 2022 20:13: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 4KRRqS0LV6z4nkS; Sun, 27 Mar 2022 20:13:55 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412036; 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=ZeREqga0jzrFOniJ6bw62cix/M1CMuuR7IjMHAfSWN8=; b=y0ZvbdGPTKu0iMeIk4rxO+8/l7ONBNFU44beSa5av+cvnmWZzzBjRqyxmPtn8tES+5tUX/ HCOYTX6zMCkq1R2t2YD6w0IWDggsdtec7nPdQhGtvmK8EmlP8nGKMGWWII7lx7Af8gw9bh jGe5hUZIESDtXcf7eD/cPv/3aj42z0DZC5SXd/77iTIxtAyGMzP05BN9VnowZbKwyaFDKH 13Yb3IBAujajOwRXFKazdZ5+SSrIkVjZckEftnmkTCPaaNHsWlEaTCza59CfjdV6CUZbQX 3mSnYJkvORzZKASxOQ3Bkvc0rNLcRVBre9gOG4ByHQXor2681lN6WauHWf4+Iw== 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 8A9D71C003; Sun, 27 Mar 2022 20:13:55 +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 22RKDtq1037014; Sun, 27 Mar 2022 20:13:55 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22RKDtxW037013; Sun, 27 Mar 2022 20:13:55 GMT (envelope-from git) Date: Sun, 27 Mar 2022 20:13:55 GMT Message-Id: <202203272013.22RKDtxW037013@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: dd39ea27f356 - stable/13 - net80211: introduce (*iv_update_bss)() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-branches@freebsd.org X-BeenThere: dev-commits-src-branches@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: dd39ea27f356f660736d5eb45b0a5aece63698bb Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412036; 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=ZeREqga0jzrFOniJ6bw62cix/M1CMuuR7IjMHAfSWN8=; b=J/ZcYyUb//SxBmuhO+AA9tIGdhIGjLsZuC3uhdRGcEYdxfOl/Y2c+gJh8iIoyLZkbE8n26 oxYPiPJqwFVGfgjP31zjB0a/O9S2uS5Z/RGr1emAyCknyF8Jox0FsVRxIBlcC3q2ppJNdF TZCSQT2Eh/0+lmID0mRUQG+R4kc2wuYUwtV4ImU6jgdNRREoMPyTf1zStDtjV175Co/hm6 +Vnvd6uT5MJMEXpLPCnrZRo6yMa4qbNC6ji6qCilnxEtVVFaqI7MkUt/xt49ZiJdJEkOH/ e3I/QFr6LNHZxjGtkbbK0OEBjfpvc1mt5V1a0M0hgS+MxfyAcs6AgcJq1Y0DIQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412036; a=rsa-sha256; cv=none; b=EjaJHhHqh+aLODLXfkd5ePnoynIngx6Y4bBbvHVkHbIJZkTJHI0jQPbZMeK8Gc6QYSKgcS CsII+ZBF23gSljGyt+FnmDis0snQnnQ5hExfmXJAdYXbZGnmNM8ZPxWAo42Ms5wG5dl2h2 so/Tx8ppsexNUhMh3vzYfZsbKivj60IENU0A+cfeeF1Ni2JS8qtSOe/v9XZsU6wHi26i7a 948Wbs38mwmdkWYALmmg7jmF+z5b6/VxTYAYkDsb94fuLld/Lvt/EKBZMQ40tvmYLTvTPj 5OgxerlFjD+woF5NhIRtkhNwy+WdDQpmkDxCQSEgQ3TZp06s41TFb733deRixw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=dd39ea27f356f660736d5eb45b0a5aece63698bb commit dd39ea27f356f660736d5eb45b0a5aece63698bb Author: Bjoern A. Zeeb AuthorDate: 2022-03-22 14:46:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 18:02:20 +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 (cherry picked from commit 91b4225aa1d81155668db6deed22084abf2ce23c) --- 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);