From nobody Sun Mar 27 20:14:07 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 4E8431A53B23; Sun, 27 Mar 2022 20:14:08 +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 4KRRqh1Y4hz4nvc; Sun, 27 Mar 2022 20:14:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412048; 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=dMZ6fmg1g/Pig7UH5QCqKA7/ZHi3baYPw8HP/cOIgyY=; b=CTx8FFu+igz9hCQK1YhYiAR4pheNIHzyH1+ZCZBbAyp5saK4pry/fPJA4yB5KrMm5BD0+W jyk4BgH1urGHwespTg34he9YUsLtXkHDz/i+34I3To6G19NH3VwkY+MKdzQIkAKWq6D1l9 6m4NbIFa/hhdbgGD/1BCRvLcfSOMxWKsXlmTwWqyIH8hcuvKTSuQ8EfuLOHc2MvieR0Gop Lyf3URPXPAG+z186ODUyK/YO4GVXhQ0McohrVMHucRZLj88GXxKkKU+YU32gA3nl/ooP1R U/Tx/fO2d/hot9258xW3kvF2ZN+CJusHYrr/SpPwB3aWwHAMjmM7EdI/uSjrFg== 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 15AE01BBF6; Sun, 27 Mar 2022 20:14:08 +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 22RKE7es037293; Sun, 27 Mar 2022 20:14:07 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22RKE7rt037292; Sun, 27 Mar 2022 20:14:07 GMT (envelope-from git) Date: Sun, 27 Mar 2022 20:14:07 GMT Message-Id: <202203272014.22RKE7rt037292@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: bc472e0a3ef0 - stable/13 - LinuxKPI: 802.11: factor out dtim/tsf updates 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: bc472e0a3ef06cb8eb309b00e7fbdae64a21626a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1648412048; 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=dMZ6fmg1g/Pig7UH5QCqKA7/ZHi3baYPw8HP/cOIgyY=; b=ZBKf+UbJVz1oVWmB8IigvOyVe1L6dfdXWPItIiVjwict3NtuqePJJYz5vcJf6GAVy5W2j9 RqZnlJZJs7cb+PJoHAP399xyekInSB+No1ahUqUWA31/fD0xGac5f8SmmmBCs3n+T7BWrA yrS4Jq2l/KtL301oCUUEnPsaaBpERvLh+vT2wKAFNNRX0WiUwAKgZ9lG5K8hCYN43z4BLs n00DIV6DmjrZkrLn359pCmo9tm3wb3aJrMThBR3QaRK7b1iOBqXcXu/vuBg5soCZgT3ErL EL3qcSs2oXo9TFMClK4braoFy3q40ITYbyjUtKZPVqIN49Lo/JkQxSGkE7bimA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412048; a=rsa-sha256; cv=none; b=pDmCQbH21LYaCeUo4zA2n7VolMmPlsxFXbirboOp4x81FZoWCUEU3FcV4o4QP/1hGrSMV6 wuaDgmDvc+sopuuQgDBrmxfMk//dhv0d984JzJI5v4z+T76qqG2lFg9KIXeciAwv9LktIY DFLZkpolmab5tdfg/yQHypHg+VMayT3WDLe63tFJSpXQHj1dazW6gMKHgV5BQ24fRn5OEy UTZMkMxqsb7YfUMAg8zkd3+fXqyXGjQK8WKGysjvbWRYjY0hIBxwnlNgcCBD8uUyG0DwSM L5DXhVEct87BZkoj8pZlkqSdwt7oM+s6m3u2FDED72IbmFIOPz4j3HamgrUoBg== 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=bc472e0a3ef06cb8eb309b00e7fbdae64a21626a commit bc472e0a3ef06cb8eb309b00e7fbdae64a21626a Author: Bjoern A. Zeeb AuthorDate: 2022-03-22 18:16:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 18:09:09 +0000 LinuxKPI: 802.11: factor out dtim/tsf updates Factor out dtim/tsf setting/updates into lkpi_update_dtim_tsf() with tracing and add an extra update call. This avoids some code duplication and puts maintainance into a single place. Sponsored by: The FreeBSD Foundation (cherry picked from commit fa8f007de913623c066bf8f09213f92ee8cbca3a) --- sys/compat/linuxkpi/common/src/linux_80211.c | 84 ++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 22 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index fd5d18bca5d4..5721ff1127ee 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -651,6 +651,58 @@ lkpi_update_mcast_filter(struct ieee80211com *ic, bool force) __func__, &mc_list, mc_list.count)); } +static enum ieee80211_bss_changed +lkpi_update_dtim_tsf(struct ieee80211_vif *vif, struct ieee80211_node *ni, + struct ieee80211vap *vap, const char *_f, int _l) +{ + enum ieee80211_bss_changed bss_changed; + + bss_changed = 0; + + if (debug_80211 & D80211_TRACE) + printf("%s:%d [%s:%d] assoc %d aid %d beacon_int %u " + "dtim_period %u sync_dtim_count %u sync_tsf %ju " + "sync_device_ts %u bss_changed %#08x\n", + __func__, __LINE__, _f, _l, + vif->bss_conf.assoc, vif->bss_conf.aid, + vif->bss_conf.beacon_int, vif->bss_conf.dtim_period, + vif->bss_conf.sync_dtim_count, + (uintmax_t)vif->bss_conf.sync_tsf, + vif->bss_conf.sync_device_ts, + bss_changed); + + if (vif->bss_conf.beacon_int != ni->ni_intval) { + vif->bss_conf.beacon_int = ni->ni_intval; + /* iwlwifi FW bug workaround; iwl_mvm_mac_sta_state. */ + if (vif->bss_conf.beacon_int < 16) + vif->bss_conf.beacon_int = 16; + bss_changed |= BSS_CHANGED_BEACON_INT; + } + if (vif->bss_conf.dtim_period != vap->iv_dtim_period && + vap->iv_dtim_period > 0) { + vif->bss_conf.dtim_period = vap->iv_dtim_period; + bss_changed |= BSS_CHANGED_BEACON_INFO; + } + + vif->bss_conf.sync_dtim_count = vap->iv_dtim_count; + vif->bss_conf.sync_tsf = le64toh(ni->ni_tstamp.tsf); + /* vif->bss_conf.sync_device_ts = set in linuxkpi_ieee80211_rx. */ + + if (debug_80211 & D80211_TRACE) + printf("%s:%d [%s:%d] assoc %d aid %d beacon_int %u " + "dtim_period %u sync_dtim_count %u sync_tsf %ju " + "sync_device_ts %u bss_changed %#08x\n", + __func__, __LINE__, _f, _l, + vif->bss_conf.assoc, vif->bss_conf.aid, + vif->bss_conf.beacon_int, vif->bss_conf.dtim_period, + vif->bss_conf.sync_dtim_count, + (uintmax_t)vif->bss_conf.sync_tsf, + vif->bss_conf.sync_device_ts, + bss_changed); + + return (bss_changed); +} + static void lkpi_stop_hw_scan(struct lkpi_hw *lhw, struct ieee80211_vif *vif) { @@ -863,20 +915,13 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int bss_changed |= BSS_CHANGED_TXPOWER; vif->bss_conf.idle = false; bss_changed |= BSS_CHANGED_IDLE; - vif->bss_conf.beacon_int = ni->ni_intval; - /* iwlwifi FW bug workaround; iwl_mvm_mac_sta_state. */ - if (vif->bss_conf.beacon_int < 16) - vif->bss_conf.beacon_int = 16; - bss_changed |= BSS_CHANGED_BEACON_INT; - vif->bss_conf.dtim_period = vap->iv_dtim_period; - bss_changed |= BSS_CHANGED_BEACON_INFO; - vif->bss_conf.sync_dtim_count = vap->iv_dtim_count; - vif->bss_conf.sync_tsf = le64toh(ni->ni_tstamp.tsf); - /* vif->bss_conf.sync_device_ts = set in linuxkpi_ieee80211_rx. */ /* Should almost assert it is this. */ vif->bss_conf.assoc = false; vif->bss_conf.aid = 0; + + bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__); + /* RATES */ IMPROVE("bss info: not all needs to come now and rates are missing"); lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, bss_changed); @@ -1339,18 +1384,9 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int vif->bss_conf.qos ^= 1; bss_changed |= BSS_CHANGED_QOS; } - if (vif->bss_conf.beacon_int != ni->ni_intval) { - vif->bss_conf.beacon_int = ni->ni_intval; - /* iwlwifi FW bug workaround; iwl_mvm_mac_sta_state. */ - if (vif->bss_conf.beacon_int < 16) - vif->bss_conf.beacon_int = 16; - bss_changed |= BSS_CHANGED_BEACON_INT; - } - if (vif->bss_conf.dtim_period != vap->iv_dtim_period && - vap->iv_dtim_period > 0) { - vif->bss_conf.dtim_period = vap->iv_dtim_period; - bss_changed |= BSS_CHANGED_BEACON_INFO; - } + + bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__); + lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, bss_changed); /* - change_chanctx (if needed) @@ -1404,6 +1440,10 @@ lkpi_sta_assoc_to_run(struct ieee80211vap *vap, enum ieee80211_state nstate, int */ IMPROVE("Need that bssid setting, and the keys"); + bss_changed = 0; + bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__); + lkpi_80211_mo_bss_info_changed(hw, vif, &vif->bss_conf, bss_changed); + out: IEEE80211_LOCK(vap->iv_ic); if (ni != NULL)