From nobody Wed Nov 29 16:38:28 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 4SgQ4N6WP9z52xDd; Wed, 29 Nov 2023 16:38:28 +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 4SgQ4N4f8cz3JYg; Wed, 29 Nov 2023 16:38:28 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275908; 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=wiSF7XCWWht9Q9aYk4tYhQJSE2AcO2BmHpfEpNB9anA=; b=F2j04uEXWOGFl4Tur8TngFmbP1+mSx5FlNoNWKu8AEQIQV+lABNelBk6wmNaSle7ON8icD hT04IbRzBTPQe2mGU0Xn4/k7Yz6QhZN+ozbVNnIhNVqh3mBwih6FJ+vg/xlvAuJzuhdZLb 6X8aYkh+5hVYlz27ChLjUhJYoF5c3oTrP2c5R3NWsCRdgf52r/MqWhSRnv8h2/OUUsa2vz HdjlOunyrxwlgjkvxBORdz6xDtt6divWHKqDEAH3d/I+9xolY9b7tXJIRawyYTPRYkYv94 /a//SG/op7Ge0mxzLB76YoaW0DQP1kK19+VZ3HotLhyIpJYyA6EQBNCjWqcJKg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1701275908; 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=wiSF7XCWWht9Q9aYk4tYhQJSE2AcO2BmHpfEpNB9anA=; b=ZvCMyZzXSpWCVf+D5+f2ABABJBWz8kxdH/v+xPrVVzmxzDcdYX8rnszs6PKW4NcG+oW0kG TcO/ZP81eltOGFhtgn40phDUkxxtBHJ/Z12iLfMAwrsXqLYAkXoyrN2KafoKnSuXXsbPmu lqyVwbWwBSGAxcL6wzDhGKC3Yku6i+aWQs/+qjkUojBaxPieWj6fQQk4OBWvZD0Mwz1LP2 uGyRDHGa937bbYzMjxEC1eR4f1d12Dvu+22SeXY4oYmw+D7McKj2J2Vb6mK/CHAusNZyr2 C88ermlVbfdV1apT0v/k8tob/dfeAmDUDYdYbvnYnSHuAIF32scKuaL9oPY2cQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1701275908; a=rsa-sha256; cv=none; b=sAlWmJUqcKkKPXpsR122LWSUdmXGY6VC05RZp3ZOFvx0S7PGFfDGno9r8CeR9x1nVbxv0D nyrBRGGRfJiZgT8EO7f66QjgxagNprvDK7/Ncx2xh9YbU37VRLiUF9BPdEzSBxgvzi29Hd 6Wu/rWwgHHpuyATUkPiLY0gFnSmdD5WxIUNFvzcbliVtePk259zZNf24vV81c8WI5GdOcc LVAbKHo74Nszfoz5tL6IfZLNsQoAGLnQ62GVSjU/xHu62nkveOdny1e7Ui7G5ICiyqR55C cUuSYzb+FW9a/JMUuB4ORB3E0qe0adYe6XIgEuDv7R0987v6yC2zsTp4ER3qaw== 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 4SgQ4N3SGyz1Cb1; Wed, 29 Nov 2023 16:38:28 +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 3ATGcSrU045914; Wed, 29 Nov 2023 16:38:28 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 3ATGcSVb045911; Wed, 29 Nov 2023 16:38:28 GMT (envelope-from git) Date: Wed, 29 Nov 2023 16:38:28 GMT Message-Id: <202311291638.3ATGcSVb045911@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: 5bb9354a0374 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: 5bb9354a0374c080009cef230797e27aeb0e3147 Auto-Submitted: auto-generated The branch stable/13 has been updated by bz: URL: https://cgit.FreeBSD.org/src/commit/?id=5bb9354a0374c080009cef230797e27aeb0e3147 commit 5bb9354a0374c080009cef230797e27aeb0e3147 Author: Bjoern A. Zeeb AuthorDate: 2023-09-21 12:49:15 +0000 Commit: Bjoern A. Zeeb CommitDate: 2023-11-29 16:36:08 +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 (cherry picked from commit 6ffb7bd469b26f2ff6cc62cedca6ffe884076196) --- 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 1785fb077145..98ffcbfbef74 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))