From nobody Sun Mar 27 20:14:06 2022 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 314D41A53948; 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 4KRRqg1T92z4nmv; Sun, 27 Mar 2022 20:14:07 +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=bN8b9Kp10xfeiDF4LnA9CTBOhu6ualOxKcCKF0iC4cA=; b=dRUhYWkmL7ExNPwLOnFzpJHM7YPbs2RMaSSI4ESFkfT+xHSif8JfmaTiVjxTqRDmb7mXkS 2iK3vSeBgBocdEPLtMaQ167YMm1vVkOQ2r5XEijkMd6h6PlkpZEMCFniCK8vnhuvt9fqkz eSSrf2NZmJfD6+WtDc+14MobD9ynRcaaQNJEWflZGeH4k8MuVSRWPjSu2Z3CNX7NOIRxqZ eyDPAqJ5lCHihldhImEQ0F4uZUiktfQbFXmp+bLEkxoXlMhe+q1DVCJdKnOyEJ3rCuGpA0 0tl5AkUGf8R3W0deD2EubXqOdt7QxofoSt3FgFlGaYbQJLU7eP8NwPwIMcGZpA== 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 E790E1BBF5; Sun, 27 Mar 2022 20:14:06 +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 22RKE6sN037269; Sun, 27 Mar 2022 20:14:06 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 22RKE6lI037268; Sun, 27 Mar 2022 20:14:06 GMT (envelope-from git) Date: Sun, 27 Mar 2022 20:14:06 GMT Message-Id: <202203272014.22RKE6lI037268@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: 34f8e38ea7a5 - stable/13 - LinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc() 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: 34f8e38ea7a5fccdf7f5de2cdcfabbdf68825480 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=bN8b9Kp10xfeiDF4LnA9CTBOhu6ualOxKcCKF0iC4cA=; b=pmiX+r59t7wT4KPTKwUC57wCTCobMI/cZefNjbP+HOmoJKeuWDOU66NFvYObT6IIZRdpsL SEWh7Y8utRsnWY2kQtI88srXZQo8WffyrvdmcfcfsQHZ1PSrBIkVONjqd+DuKzSPD8syuC Iz7m2NSG4UiyLss8HW0chV5jjHwE/nN/WhWs4EFut/iWEuX+0z2qRVR6IV2SlUHT5Gms8/ xtsI+iXd/v/xuhOE/ZzPCYfc9G2vREOW9QiGAo52ErQKG87+PDqEji2+gz53hnQE2/fgf3 VsbzGahwZ/sVQQtgS+YE+eJmmfxbvP1U0TnsHrk7VF+tiW6NrZcV3naxNc/YZg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1648412048; a=rsa-sha256; cv=none; b=rTSUErG2E69NoB79nejdCwHoweAR28lQyusuTIVcB2gi47UmZlUhVCGy689ozXgUSNVJBs NTmYrp0cR5DSbdtps3ZZ8fJFHlD1Q/xWtQ1ClE96VnPNVZDDHlznkbO0qeE7zj3WrENSCU GrMWk61NU53L4HhB4aZg3IZv1RpNqMKxy/jCg0e094UY9QCvtEN4jjQFXC0rRoTlrqQ0Tn zdjMlKm9rHp1POCNdD4Zk7/mQQ8SFkz7ldQbDKvYsdxVNhhURC/KY/Oe4HlmVrSwhLW320 TrbnvnIuIyBiauejDqDRsnyCN9zcdHG/sR2i/m/aHlMoaTIRDi0twEfRjPwSLQ== 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=34f8e38ea7a5fccdf7f5de2cdcfabbdf68825480 commit 34f8e38ea7a5fccdf7f5de2cdcfabbdf68825480 Author: Bjoern A. Zeeb AuthorDate: 2022-03-22 15:14:31 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-03-27 18:09:04 +0000 LinuxKPI: 802.11: factor out lkpi_lsta_alloc() from lkpi_ic_node_alloc() Split lkpi_ic_node_alloc() into two functions to make the code simpler and to allow lkpi_lsta_alloc() to be re-used from another part of the code related to (*iv_update_bss)(). Sponsored by: The FreeBSD Foundation (cherry picked from commit 4f61ef8b78b25761b1b859ce39213f92fcbb24ce) --- sys/compat/linuxkpi/common/src/linux_80211.c | 178 ++++++++++++++------------- 1 file changed, 95 insertions(+), 83 deletions(-) diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index ceb9c626c507..fd5d18bca5d4 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -112,6 +112,20 @@ SYSCTL_INT(_compat_linuxkpi, OID_AUTO, debug_80211, CTLFLAG_RWTUN, /* This is DSAP | SSAP | CTRL | ProtoID/OrgCode{3}. */ const uint8_t rfc1042_header[6] = { 0xaa, 0xaa, 0x03, 0x00, 0x00, 0x00 }; +const uint8_t tid_to_mac80211_ac[] = { + IEEE80211_AC_BE, + IEEE80211_AC_BK, + IEEE80211_AC_BK, + IEEE80211_AC_BE, + IEEE80211_AC_VI, + IEEE80211_AC_VI, + IEEE80211_AC_VO, + IEEE80211_AC_VO, +#if 0 + IEEE80211_AC_VO, /* We treat MGMT as TID 8, which is set as AC_VO */ +#endif +}; + const struct cfg80211_ops linuxkpi_mac80211cfgops = { /* * XXX TODO need a "glue layer" to link cfg80211 ops to @@ -125,6 +139,79 @@ static struct lkpi_sta *lkpi_find_lsta_by_ni(struct lkpi_vif *, static void lkpi_80211_txq_task(void *, int); static void lkpi_ieee80211_free_skb_mbuf(void *); +static struct lkpi_sta * +lkpi_lsta_alloc(struct ieee80211vap *vap, const uint8_t mac[IEEE80211_ADDR_LEN], + struct ieee80211_hw *hw, struct ieee80211_node *ni) +{ + struct lkpi_sta *lsta; + struct lkpi_vif *lvif; + struct ieee80211_vif *vif; + struct ieee80211_sta *sta; + int tid; + + lsta = malloc(sizeof(*lsta) + hw->sta_data_size, M_LKPI80211, + M_NOWAIT | M_ZERO); + if (lsta == NULL) + return (NULL); + + lsta->added_to_drv = false; + lsta->state = IEEE80211_STA_NOTEXIST; +#if 0 + /* + * This needs to be done in node_init() as ieee80211_alloc_node() + * will initialise the refcount after us. + */ + lsta->ni = ieee80211_ref_node(ni); +#endif + /* The back-pointer "drv_data" to net80211_node let's us get lsta. */ + ni->ni_drv_data = lsta; + + lvif = VAP_TO_LVIF(vap); + vif = LVIF_TO_VIF(lvif); + sta = LSTA_TO_STA(lsta); + + IEEE80211_ADDR_COPY(sta->addr, mac); + for (tid = 0; tid < nitems(sta->txq); tid++) { + struct lkpi_txq *ltxq; + + /* + * We are neither limiting ourselves to hw.queues here, + * nor do we check if driver wants IEEE80211_NUM_TIDS queue. + */ + + ltxq = malloc(sizeof(*ltxq) + hw->txq_data_size, + M_LKPI80211, M_NOWAIT | M_ZERO); + if (ltxq == NULL) + goto cleanup; + ltxq->seen_dequeue = false; + skb_queue_head_init(<xq->skbq); + /* iwlwifi//mvm/sta.c::tid_to_mac80211_ac[] */ + if (tid == IEEE80211_NUM_TIDS) { + IMPROVE(); + ltxq->txq.ac = IEEE80211_AC_VO; + } else { + ltxq->txq.ac = tid_to_mac80211_ac[tid & 7]; + } + ltxq->txq.tid = tid; + ltxq->txq.sta = sta; + ltxq->txq.vif = vif; + sta->txq[tid] = <xq->txq; + } + + /* Deferred TX path. */ + mtx_init(&lsta->txq_mtx, "lsta_txq", NULL, MTX_DEF); + TASK_INIT(&lsta->txq_task, 0, lkpi_80211_txq_task, lsta); + mbufq_init(&lsta->txq, IFQ_MAXLEN); + + return (lsta); + +cleanup: + for (; tid >= 0; tid--) + free(sta->txq[tid], M_LKPI80211); + free(lsta, M_LKPI80211); + return (NULL); +} + static enum nl80211_band lkpi_net80211_chan_to_nl80211_band(struct ieee80211_channel *c) { @@ -564,20 +651,6 @@ lkpi_update_mcast_filter(struct ieee80211com *ic, bool force) __func__, &mc_list, mc_list.count)); } -const uint8_t tid_to_mac80211_ac[] = { - IEEE80211_AC_BE, - IEEE80211_AC_BK, - IEEE80211_AC_BK, - IEEE80211_AC_BE, - IEEE80211_AC_VI, - IEEE80211_AC_VI, - IEEE80211_AC_VO, - IEEE80211_AC_VO, -#if 0 - IEEE80211_AC_VO, /* We treat MGMT as TID 8, which is set as AC_VO */ -#endif -}; - static void lkpi_stop_hw_scan(struct lkpi_hw *lhw, struct ieee80211_vif *vif) { @@ -2161,91 +2234,30 @@ lkpi_ic_node_alloc(struct ieee80211vap *vap, { struct ieee80211com *ic; struct lkpi_hw *lhw; + struct ieee80211_node *ni; struct ieee80211_hw *hw; struct lkpi_sta *lsta; - struct ieee80211_sta *sta; - struct lkpi_vif *lvif; - struct ieee80211_vif *vif; - struct ieee80211_node *ni; - int tid; ic = vap->iv_ic; lhw = ic->ic_softc; /* We keep allocations de-coupled so we can deal with the two worlds. */ - if (lhw->ic_node_alloc != NULL) { - ni = lhw->ic_node_alloc(vap, mac); - if (ni == NULL) - return (NULL); - } + if (lhw->ic_node_alloc == NULL) + return (NULL); + + ni = lhw->ic_node_alloc(vap, mac); + if (ni == NULL) + return (NULL); hw = LHW_TO_HW(lhw); - lsta = malloc(sizeof(*lsta) + hw->sta_data_size, M_LKPI80211, - M_NOWAIT | M_ZERO); + lsta = lkpi_lsta_alloc(vap, mac, hw, ni); if (lsta == NULL) { if (lhw->ic_node_free != NULL) lhw->ic_node_free(ni); return (NULL); } - lsta->added_to_drv = false; - lsta->state = IEEE80211_STA_NOTEXIST; -#if 0 - /* - * This needs to be done in node_init() as ieee80211_alloc_node() - * will initialise the refcount after us. - */ - lsta->ni = ieee80211_ref_node(ni); -#endif - /* The back-pointer "drv_data" to net80211_node let's us get lsta. */ - ni->ni_drv_data = lsta; - - lvif = VAP_TO_LVIF(vap); - vif = LVIF_TO_VIF(lvif); - sta = LSTA_TO_STA(lsta); - - IEEE80211_ADDR_COPY(sta->addr, mac); - for (tid = 0; tid < nitems(sta->txq); tid++) { - struct lkpi_txq *ltxq; - - /* - * We are neither limiting ourselves to hw.queues here, - * nor do we check if driver wants IEEE80211_NUM_TIDS queue. - */ - - ltxq = malloc(sizeof(*ltxq) + hw->txq_data_size, - M_LKPI80211, M_NOWAIT | M_ZERO); - if (ltxq == NULL) - goto cleanup; - ltxq->seen_dequeue = false; - skb_queue_head_init(<xq->skbq); - /* iwlwifi//mvm/sta.c::tid_to_mac80211_ac[] */ - if (tid == IEEE80211_NUM_TIDS) { - IMPROVE(); - ltxq->txq.ac = IEEE80211_AC_VO; - } else { - ltxq->txq.ac = tid_to_mac80211_ac[tid & 7]; - } - ltxq->txq.tid = tid; - ltxq->txq.sta = sta; - ltxq->txq.vif = vif; - sta->txq[tid] = <xq->txq; - } - - /* Deferred TX path. */ - mtx_init(&lsta->txq_mtx, "lsta_txq", NULL, MTX_DEF); - TASK_INIT(&lsta->txq_task, 0, lkpi_80211_txq_task, lsta); - mbufq_init(&lsta->txq, IFQ_MAXLEN); - return (ni); - -cleanup: - for (; tid >= 0; tid--) - free(sta->txq[tid], M_LKPI80211); - free(lsta, M_LKPI80211); - if (lhw->ic_node_free != NULL) - lhw->ic_node_free(ni); - return (NULL); } static int