From nobody Tue Mar 22 18:52:51 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 67C491A29E0B; Tue, 22 Mar 2022 18:52:52 +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 4KNLGD0zHbz3sVP; Tue, 22 Mar 2022 18:52:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647975172; 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=T+AgEo+mSYJuVLMb6H4eOKGlOLEAIKERHkJ9oBRJ56I=; b=Fomj0MFyZRnv80D6G9QWIpNSa3cKIhrQ5EYAXVsHxXqYYkFYc1i6qFzL2FkQXqM2svPxUx yGnveE1PcFKh2BADCIVmPZAeAdZoy3TopSyGL+9RsjRtkCTApw9nMQ5T9yiQchhNdGn9wb XAlUxOF548kZEwfQe2MSgJksEvIdBXeB7l1hM1TZIcJshQDq03BItXZ3KxMjfY2gygzY+5 IxbY34UN0LwvZvpAjXjsgsCYxcB7/meDROKR9x4IilHVJCFrV2TTBXdvR7afkPevQhhcjv VK6qKl/m664dcbrsk5Z8M+3B9NqIYknNCBxW/4njaQ3n3J3r5zSJlTBffYyVog== 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 E69E915009; Tue, 22 Mar 2022 18:52:51 +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 22MIqpON099437; Tue, 22 Mar 2022 18:52:51 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22MIqpsq099436; Tue, 22 Mar 2022 18:52:51 GMT (envelope-from git) Date: Tue, 22 Mar 2022 18:52:51 GMT Message-Id: <202203221852.22MIqpsq099436@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: fa8f007de913 - main - LinuxKPI: 802.11: factor out dtim/tsf updates 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: fa8f007de913623c066bf8f09213f92ee8cbca3a Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1647975172; 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=T+AgEo+mSYJuVLMb6H4eOKGlOLEAIKERHkJ9oBRJ56I=; b=wmDKeorcTx1lkRyfowE/t15+ZfYVBYJgtgM8ul8zOs54fwEUMaJ+80BJ7f2nDFEawjhdA2 rBtM26CBgFGu37t5aslYD+9BXGStQhycKhWqaAesAdFPS11baWgGR/ifoqD+DIoqj3wUMz lS10n5IvIdtNBSLlb8wH3xvmYwZflY1RaGzcjaCGRmjFBMwbwRw8DLYUPQWIFaHO7OMi3n gBWOFt1Hzx7i2xRq0w+H9Yd3jVkhr6M/jfqwGO97f+maSWTUhW5EFoj/nAnzF9Y8FO273y wEY62jtFfNqJeTpFuyv4xyIUMpLFwTu4GAKMqrrQY8OoGieOqXoM+Gpf+dVySw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1647975172; a=rsa-sha256; cv=none; b=HhZOGT4kyD8PNWGYWz4y2cn+bXl7uNh0/VJXXo9MI+faRIDOQw+A/IjQl5gpbY+xPX4ZsZ cmpX8AgR6U6PPCfFscJCqwBvTFX17p5nX0VJkky0VJ779zebvQDMxDBZ4feas8gvyUsGUK tJEpU0ylVAN4HKZ+vu9CWv/sTG3B0Wt70IElbuNmExBSLzvlfNp1strUd6Ajm9uPUphyqK 8l5RhBYFeT6ey2V9NbeDrpJ6fD67Cdz6cwjKiDwno7Pf1NyvEjKPuAo53G5ae1IQSzHAVG 5NjJHwPNd/0RNtKQy0gz2HC9vxNuXY2GyQedJawZ2WMViWu30ET8kxf7lB2gCQ== 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=fa8f007de913623c066bf8f09213f92ee8cbca3a commit fa8f007de913623c066bf8f09213f92ee8cbca3a Author: Bjoern A. Zeeb AuthorDate: 2022-03-22 18:16:56 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-22 18:51:43 +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 MFC after: 3 days --- 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)