From nobody Thu Sep 21 17:19:40 2023 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 4Rs2Fm6LlYz4tk0s; Thu, 21 Sep 2023 17:19:40 +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 4Rs2Fm5JGDz4fPD; Thu, 21 Sep 2023 17:19:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695316780; 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=abrxRczz8TPFhAak+YYSUfOeflXSVmG7rz+UUaAZtPM=; b=L//D6d7KvrhWrNDSQBy9mJRAaz6DBAjNVceYkLyJzvAs1dDCmyv53c4l87iRPoyMPXzDrJ VPkscPb/qN+9y7j2tNPBFcfztqvON6pSZShnRbQM+YDJYmrG5DpLYa1yUV+tCmOvO+TpTn yFDBfe7jBE1zLudxrh6VMy7cPAIoE+BNJyYa70tv8pPxVRWEtORChl826TfnOt9wdpo0uJ UVpu8tEAqKPwTrKac6+zzGRxbbKRNHaoiT9pCI+lFG2p4D8sWMGktN58Zy46Is052GfAuG JIg5ovtl4bXK/rTFEkTrqm/dPt6MYux9gaQoxbKdVQBDL9LQbrpVJdlJQl6MPw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1695316780; a=rsa-sha256; cv=none; b=CSNx4AIdnLPeaXgacEKrgC4WbUgzveq9djLj1bIP+nGLPip/GM+rWXYOBcYeXU6xsLweYl ZmQ1LpaGAqpySApN1y5RWLqDQXFfQa2QPRG7USvS7MU/xdkO3smsIhW1yEfBvJ6XnFb8Eq fJUyzVjAPXOiQXR6jI6ek960FfJBVgj44nth8wa7EKutauFXxwXZ6ac8+iAENqYjBeMOOc jawIbt+Ggk0EyKFUJJBY9B5Sez9RbCc+bMCaKCB+HZItD6W/VfNOu6RhDDHJ5GRLlUAdh4 RUsNwpqskQS32dFcVx31GYdBn+3xgu8avXDx5D+qtVCFjMOJZuSZjZ3ppnAtig== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1695316780; 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=abrxRczz8TPFhAak+YYSUfOeflXSVmG7rz+UUaAZtPM=; b=V2550JJnQudc09rJd+xhlaW6XtUJSE+1pGHGT4fqzb/U+yBYfBrdNY3EAYOKKdoH3/ItBd 9h1ALh3FDpiSSuv9+0FI6Dc0oKol9f6VHVsYVH7T7YNHGqVyfcbS877Ch6vAlASZmXi7tG iyh22MT3o3ywnJL+j1trSFuiISK7ZVEwLzOAJXYVoUthcgdoMW0AC9IjovKUrAPJOj36aK xGsXd4v+QD4AkV88UjwbOHDa/vi5z2t/ZlQMBwtOuUr99pWm4IYgo+Qnrd1eeo9e1R0f2q 9DjRhr4XNoViV8eIk/JugHn3mv/ApxhjpoiQsXk/FbvN3Xr4gxFBomXAulgoFQ== 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 4Rs2Fm3scpznHM; Thu, 21 Sep 2023 17:19:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 38LHJe8m076628; Thu, 21 Sep 2023 17:19:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 38LHJeUB076625; Thu, 21 Sep 2023 17:19:40 GMT (envelope-from git) Date: Thu, 21 Sep 2023 17:19:40 GMT Message-Id: <202309211719.38LHJeUB076625@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: 6ffb7bd469b2 - main - LinuxKPI: 802.11: setup a default link[0] and adjust related needs 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/main X-Git-Reftype: branch X-Git-Commit: 6ffb7bd469b26f2ff6cc62cedca6ffe884076196 Auto-Submitted: auto-generated The branch main has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=6ffb7bd469b26f2ff6cc62cedca6ffe884076196 commit 6ffb7bd469b26f2ff6cc62cedca6ffe884076196 Author: Bjoern A. Zeeb AuthorDate: 2023-09-21 12:49:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-09-21 17:09:01 +0000 LinuxKPI: 802.11: setup a default link[0] and adjust related needs Setup more link_conf/deflink fields for vif/sta as are needed to allow us to work with the KPI bits in a non-MLO configuration. In lkpi_sta_scan_to_auth() set the bss_conf values before calling into the driver for chanctx setup/updates as certain values (e.g., beacon_int) need to be set before; we still call the MO function for the updates after to keep the expected workflow. Deal with the (to be dealt with otherwise later) net80211 ni swaps and update the addresses on the deflink as well as otherwise firmware will hit asserts or things will not work (e.g. indicating the peer is us). Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/src/linux_80211.c | 63 ++++++++++++++++++---------- 1 file changed, 41 insertions(+), 22 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index ffad61ba934a..09a315de9fd6 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -107,9 +107,6 @@ SYSCTL_INT(_compat_linuxkpi_80211, OID_AUTO, debug, CTLFLAG_RWTUN, #define PREP_TX_INFO_DURATION 0 /* Let the driver do its thing. */ #endif -/* c.f. ieee80211_ioctl.c */ -static const uint8_t zerobssid[IEEE80211_ADDR_LEN]; - /* This is DSAP | SSAP | CTRL | ProtoID/OrgCode{3}. */ const uint8_t rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; @@ -269,9 +266,17 @@ lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], sta->deflink.supp_rates[band] |= BIT(i); } } + sta->deflink.smps_mode = IEEE80211_SMPS_OFF; IMPROVE("ht, vht, he, ... bandwidth, smps_mode, .."); /* bandwidth = IEEE80211_STA_RX_... */ + /* Link configuration. */ + IEEE80211_ADDR_COPY(sta->deflink.addr, sta->addr); + sta->link[0] = &sta->deflink; + for (i = 1; i < nitems(sta->link); i++) { + IMPROVE("more links; only link[0] = deflink currently."); + } + /* Deferred TX path. */ mtx_init(&lsta->txq_mtx, "lsta_txq", NULL, MTX_DEF); TASK_INIT(&lsta->txq_task, 0, lkpi_80211_txq_task, lsta); @@ -969,6 +974,23 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int conf->min_def.center_freq2 = 0; IMPROVE("currently 20_NOHT only"); + /* Set bss info (bss_info_changed). */ + bss_changed = 0; + vif->bss_conf.bssid = ni->ni_bssid; + bss_changed |= BSS_CHANGED_BSSID; + vif->bss_conf.txpower = ni->ni_txpower; + bss_changed |= BSS_CHANGED_TXPOWER; + vif->cfg.idle = false; + bss_changed |= BSS_CHANGED_IDLE; + + /* vif->bss_conf.basic_rates ? Where exactly? */ + + /* Should almost assert it is this. */ + vif->cfg.assoc = false; + vif->cfg.aid = 0; + + bss_changed |= lkpi_update_dtim_tsf(vif, ni, vap, __func__, __LINE__); + error = 0; if (vif->chanctx_conf != NULL) { changed = IEEE80211_CHANCTX_CHANGE_MIN_WIDTH; @@ -988,6 +1010,9 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int } else { goto out; } + + vif->bss_conf.chanctx_conf = conf; + /* Assign vif chanctx. */ if (error == 0) error = lkpi_80211_mo_assign_vif_chanctx(hw, vif, @@ -1002,21 +1027,6 @@ lkpi_sta_scan_to_auth(struct ieee80211vap *vap, enum ieee80211_state nstate, int } IMPROVE("update radiotap chan fields too"); - /* Set bss info (bss_info_changed). */ - bss_changed = 0; - vif->bss_conf.bssid = ni->ni_bssid; - bss_changed |= BSS_CHANGED_BSSID; - vif->bss_conf.txpower = ni->ni_txpower; - bss_changed |= BSS_CHANGED_TXPOWER; - vif->cfg.idle = false; - bss_changed |= BSS_CHANGED_IDLE; - - /* Should almost assert it is this. */ - vif->cfg.assoc = false; - vif->cfg.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); @@ -2131,12 +2141,14 @@ lkpi_iv_update_bss(struct ieee80211vap *vap, struct ieee80211_node *ni) lsta->ni = ni; sta = LSTA_TO_STA(lsta); IEEE80211_ADDR_COPY(sta->addr, lsta->ni->ni_macaddr); + IEEE80211_ADDR_COPY(sta->deflink.addr, sta->addr); } lsta = obss->ni_drv_data; if (lsta != NULL) { lsta->ni = obss; sta = LSTA_TO_STA(lsta); IEEE80211_ADDR_COPY(sta->addr, lsta->ni->ni_macaddr); + IEEE80211_ADDR_COPY(sta->deflink.addr, sta->addr); } out: @@ -2277,6 +2289,9 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], #if 1 vif->chanctx_conf = NULL; vif->bss_conf.vif = vif; + /* vap->iv_myaddr is not set until net80211::vap_setup or vap_attach. */ + IEEE80211_ADDR_COPY(vif->bss_conf.addr, mac); + vif->bss_conf.link_id = 0; /* Non-MLO operation. */ vif->bss_conf.chandef.width = NL80211_CHAN_WIDTH_20_NOHT; vif->bss_conf.use_short_preamble = false; /* vap->iv_flags IEEE80211_F_SHPREAMBLE */ vif->bss_conf.use_short_slot = false; /* vap->iv_flags IEEE80211_F_SHSLOT */ @@ -2287,15 +2302,13 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], vif->cfg.assoc = false; vif->cfg.idle = true; vif->cfg.ps = false; + IMPROVE("Check other fields and then figure out whats is left elsewhere of them"); /* * We need to initialize it to something as the bss_info_changed call * will try to copy from it in iwlwifi and NULL is a panic. * We will set the proper one in scan_to_auth() before being assoc. - * NB: the logic there with using an array as bssid_override and checking - * for non-NULL later is flawed but in their workflow does not seem to - * matter. */ - vif->bss_conf.bssid = zerobssid; + vif->bss_conf.bssid = ieee80211broadcastaddr; #endif #if 0 vif->bss_conf.dtim_period = 0; /* IEEE80211_DTIM_DEFAULT ; must stay 0. */ @@ -2306,6 +2319,12 @@ lkpi_ic_vap_create(struct ieee80211com *ic, const char name[IFNAMSIZ], vif->bss_conf.beacon_int = 16; #endif + /* Link Config */ + vif->link_conf[0] = &vif->bss_conf; + for (i = 0; i < nitems(vif->link_conf); i++) { + IMPROVE("more than 1 link one day"); + } + /* Setup queue defaults; driver may override in (*add_interface). */ for (i = 0; i < IEEE80211_NUM_ACS; i++) { if (ieee80211_hw_check(hw, QUEUE_CONTROL))