From nobody Tue Mar 22 18:52:48 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 410FF1A299F4; Tue, 22 Mar 2022 18:52:49 +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 4KNLG854ZZz3slY; Tue, 22 Mar 2022 18:52:48 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647975168; 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=Dcr4jwE8Zx+MOoqXoZK9BdYPL788EgVKPV/VcUyT49o=; b=WyQN+DBNzzzpTkdDZJw8NKCy/rHOR1lCFxt9HrDcamoqsAQoSDxgVY5P5xivoUP8xSLDLV n2nurQ3zxzZpOz/KtH08Kk1CCper4IOCzP9sL4zR3FBlME0GHgAsnAatKjNR/KJX6v4CGA ZKbjlNPb3cBpvV3GLLHu3efNlX9hcVZy4DYHCLXrRVzzTB9qaVHWDgzZ7UEjohbyuAX2uI aUDo6I5uEIImwOZowx+rhSt5/0cRJ7x7N71I+Ms8noS2SqIiZClVKfBlzqIT9z5+/qMFYY atQtuyEn2I/RlsuvmV16Pmx0fE4QccPaUsm398yhgcPN4+cF4Xou9JsNsrdUvA== 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 8985115081; Tue, 22 Mar 2022 18:52:48 +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 22MIqmP0099360; Tue, 22 Mar 2022 18:52:48 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22MIqmWH099359; Tue, 22 Mar 2022 18:52:48 GMT (envelope-from git) Date: Tue, 22 Mar 2022 18:52:48 GMT Message-Id: <202203221852.22MIqmWH099359@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: 91b4225aa1d8 - main - net80211: introduce (*iv_update_bss)() 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: 91b4225aa1d81155668db6deed22084abf2ce23c Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647975168; 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=Dcr4jwE8Zx+MOoqXoZK9BdYPL788EgVKPV/VcUyT49o=; b=wREmPnpUsI8RXgbMHMzWHvYq8xRmPKnk9+JnNlVvrD9UvB+29w7UMq5eFucD9r5/5WnPxn uocDwpwmj1fA4NhG1QMZt0tl9QStaDgIfFrkfDaoHD5fUit6xz1xoQoGKbOq5bfKI608l6 ssZ2PTpcwb226C4ilZWZEbV8OvcC/kvV5piF4eNM3OAgDLgNXKNTR/511UfUzcU9GHbLfe ltFlyqC55u5qzHodLnzhkgfTJ4b5FiAsnltUMgjXstA4lUiQscx0ZlkDFFxeJ4YAvpqU9J s8QsyzuZCPh1oaLZFAUCxzKjlhUBKWik0E2bZR1MAoJR4mOFslv/VW6pq5S9CQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647975168; a=rsa-sha256; cv=none; b=hEtOuINctq51ZMUSQF6ZWEinjShzKTkd7QbONpltQHlacN0Yk7I5yvGe726ShuGA+yewF0 n/BNZLdjuabrTrQt9lKuZnAP/iyY8lCBRHkzo43OygPreGPf1ti7CWGLODGLZtXdHcQUZX 72IMjsHK3jGn9qkeqcPCbKO1HA7yh11g0l9KLbg77MfUNzVkU/itcc7qoGKVq/FCrMn6Ei yet6dPH9rtgHdtEuRapAtA85bRMDV2Ez/f0FBOFdoVUZqCggDfrzZqbmAJGi5BTgDGL3xt MKqKapLrmy8Sw6xhpPp1FyggaQ0467Pz2JCWxfAqaXlmZ8caMQQOAo8x69DTOg== 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=91b4225aa1d81155668db6deed22084abf2ce23c commit 91b4225aa1d81155668db6deed22084abf2ce23c Author: Bjoern A. Zeeb AuthorDate: 2022-03-22 14:46:51 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-22 18:51:43 +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 MFC after: 3 days X-MFC: move (*iv_update_bss) to spare area --- sys/net80211/ieee80211_node.c | 8 +++----- sys/net80211/ieee80211_proto.c | 14 ++++++++++++++ sys/net80211/ieee80211_var.h | 3 +++ sys/net80211/ieee80211_wds.c | 6 ++---- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/sys/net80211/ieee80211_node.c b/sys/net80211/ieee80211_node.c index 43f90f860a2d..a739b0586088 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..e9d2d652db40 100644 --- a/sys/net80211/ieee80211_var.h +++ b/sys/net80211/ieee80211_var.h @@ -565,6 +565,9 @@ struct ieee80211vap { /* state machine processing */ int (*iv_newstate)(struct ieee80211vap *, enum ieee80211_state, int); + struct ieee80211_node * (*iv_update_bss)(struct ieee80211vap *, + struct ieee80211_node *); + /* 802.3 output method for raw frame xmit */ int (*iv_output)(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *); 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);