From nobody Fri Apr 15 15:56:53 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 3C39A7CD851; Fri, 15 Apr 2022 15:56:54 +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 4Kg1D54HT0z3FtL; Fri, 15 Apr 2022 15:56:53 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650038213; 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=KKc88v43JosT5BNUij/5PsSrrI7QtNwAj6yqCc7UknM=; b=TeQ5VvvGqLEsKyt1eQ6vywq4VzgCdhjAMh+lIKJP10O65V5pg+/KcyFA9ndEcSjabqamje 4H4WXmRazzfyJWYIwhPX5VfiLh0RalmQPN8d9nONEpV58m4jy2NUEWXmjD0BML+uQwpUY0 M0JcXm1whhdfz0YbcQuUkgD/y2dBaBq4eomsRQx6hOc5CjZqPEtcMZXjoJSwVKa/HMY9qO h0jdL1VeVb9q8pMRQQdiV7axKyWRR9WbdoChdw6ZwtWHZyVuJaGDMYk7D9Ri9Jy0+hVpDD 7wspK4R4hBooRkhbuMOVaJjyL9k8Apm2Wjyt4UtB2Z4R9Efy+kzWFJ4zXpvs/g== 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 2B572182BA; Fri, 15 Apr 2022 15:56:53 +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 23FFurtZ084365; Fri, 15 Apr 2022 15:56:53 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23FFurkf084364; Fri, 15 Apr 2022 15:56:53 GMT (envelope-from git) Date: Fri, 15 Apr 2022 15:56:53 GMT Message-Id: <202204151556.23FFurkf084364@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: 383b3e8f509f - main - LinuxKPI: 802.11: start adding rate control to ieee80211_tx_status() 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: 383b3e8f509f9658329d33d7da5473b881c37349 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650038213; 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=KKc88v43JosT5BNUij/5PsSrrI7QtNwAj6yqCc7UknM=; b=ZJBHCIoXrGtdvLxPZssQASZTqeX24V4kyNT2565mQWvEEj/8bAFW+ZXMVcR5WsHQAWhYqE a/t8K+BHxI3HnepEzebnxXB2EENUqOO3PIQtFjVFffKz7PzrXvFisSMU/dX3ffWBbwm6Q1 66yWD5ydRPC5KpE7zhFHxHTBWaRehIF4tNVU7oWBDyww3prLPnLcRGEdXKzbGUjVzpDfbz 3SxTzpACon30B3zU3eOnxnP8pgRx5jPEnydZBB9TSjUHX8mxIVl6LrXrRFRWJk/EQq7Yhr DoOMjx1E0B/dqjmwGmV1eGkx66MGnIz30gjzEGVbi5he/WZDFzdgndjUNicHAg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650038213; a=rsa-sha256; cv=none; b=jBEyMyQ26ElHi5RzLQW5V2mW6dQtFNtH+frUuj7mvIMEum/xStXNJKj0+xhUw581O3lJSh P7F68dtgNzD+ctUsvWTlDIvI7FaQEYH4YeCuvAAS1DkRwHfYijbgd84eGkY93tE3U94I8r XWwdnO/5Jg+nNRBYkTB9Q+cIPaZZZvb/eQS7eKNydoF5uDk28E47/WkKOoD+8Kt/k4jFie 109uK09y+wBx0cyV5cI3N3U5jJ6PrW309V5ytvh/c1eQHYEzS9ns+bUrGKrOWBGmFrkMgp PQcgeUMDfLsGPhPR07G1laoj625mf2KXog8M09RH8+zlEm//ev9K5mPyRPazEQ== 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=383b3e8f509f9658329d33d7da5473b881c37349 commit 383b3e8f509f9658329d33d7da5473b881c37349 Author: Bjoern A. Zeeb AuthorDate: 2022-04-15 13:39:38 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-04-15 15:54:03 +0000 LinuxKPI: 802.11: start adding rate control to ieee80211_tx_status() Start adding rate control feedback in ieee80211_tx_status() in order for net80211 to be able to report something back (which may not yet be the view of the firmware). iwlwifi is reporting back an MSC 0 even with HT disabled (to be investigated) so we cannot (yet) use the firmware/driver rate feedback directly. Sponsored by: The FreeBSD Foundation MFC after: 3 days --- sys/compat/linuxkpi/common/include/net/mac80211.h | 38 +-------- sys/compat/linuxkpi/common/src/linux_80211.c | 93 +++++++++++++++++++++++ 2 files changed, 96 insertions(+), 35 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h index 18e95eb33558..dcb104947305 100644 --- a/sys/compat/linuxkpi/common/include/net/mac80211.h +++ b/sys/compat/linuxkpi/common/include/net/mac80211.h @@ -907,6 +907,7 @@ void linuxkpi_ieee80211_connection_loss(struct ieee80211_vif *); void linuxkpi_ieee80211_beacon_loss(struct ieee80211_vif *); struct sk_buff *linuxkpi_ieee80211_probereq_get(struct ieee80211_hw *, uint8_t *, uint8_t *, size_t, size_t); +void linuxkpi_ieee80211_tx_status(struct ieee80211_hw *, struct sk_buff *); /* -------------------------------------------------------------------------- */ @@ -1754,41 +1755,8 @@ ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t) static __inline void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) { - struct ieee80211_tx_info *info; - int status; - - info = IEEE80211_SKB_CB(skb); - - /* XXX-BZ this check is probably over-simplified? */ - /* XXX-BZ but then we have no full feedback in net80211 yet. */ - if (info->flags & IEEE80211_TX_STAT_ACK) - status = 0; /* No error. */ - else - status = 1; -#if 0 - printf("XXX-BZ: %s: hw %p skb %p status %d : flags %#x " - "band %u hw_queue %u tx_time_est %d : " - "rates [ %u %u %#x, %u %u %#x, %u %u %#x, %u %u %#x ] " - "ack_signal %u ampdu_ack_len %u ampdu_len %u antenna %u tx_time %u " - "is_valid_ack_signal %u status_driver_data [ %p %p ]\n", - __func__, hw, skb, status, info->flags, - info->band, info->hw_queue, info->tx_time_est, - info->status.rates[0].idx, info->status.rates[0].count, - info->status.rates[0].flags, - info->status.rates[1].idx, info->status.rates[1].count, - info->status.rates[1].flags, - info->status.rates[2].idx, info->status.rates[2].count, - info->status.rates[2].flags, - info->status.rates[3].idx, info->status.rates[3].count, - info->status.rates[3].flags, - info->status.ack_signal, info->status.ampdu_ack_len, - info->status.ampdu_len, info->status.antenna, - info->status.tx_time, info->status.is_valid_ack_signal, - info->status.status_driver_data[0], - info->status.status_driver_data[1]); -#endif - IMPROVE(); - linuxkpi_ieee80211_free_txskb(hw, skb, status); + + linuxkpi_ieee80211_tx_status(hw, skb); } static __inline void diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c index f13c204b9ccc..e5a4aee842eb 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4064,6 +4064,99 @@ linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb, kfree_skb(skb); } +void +linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) +{ + struct ieee80211_tx_info *info; + struct ieee80211_ratectl_tx_status txs; + struct ieee80211_node *ni; + int status; + + info = IEEE80211_SKB_CB(skb); + + if (skb->m != NULL) { + struct mbuf *m; + + m = skb->m; + ni = m->m_pkthdr.PH_loc.ptr; + memset(&txs, 0, sizeof(txs)); + } else { + ni = NULL; + } + + if (info->flags & IEEE80211_TX_STAT_ACK) { + status = 0; /* No error. */ + txs.status = IEEE80211_RATECTL_TX_SUCCESS; + } else { + status = 1; + txs.status = IEEE80211_RATECTL_TX_FAIL_UNSPECIFIED; + } + + if (ni != NULL) { + int ridx __diagused; +#ifdef LINUXKPI_DEBUG_80211 + int old_rate; + + old_rate = ni->ni_vap->iv_bss->ni_txrate; +#endif + txs.pktlen = skb->len; + txs.flags |= IEEE80211_RATECTL_STATUS_PKTLEN; + if (info->status.rates[0].count > 1) { + txs.long_retries = info->status.rates[0].count - 1; /* 1 + retries in drivers. */ + txs.flags |= IEEE80211_RATECTL_STATUS_LONG_RETRY; + } +#if 0 /* Unused in net80211 currently. */ + /* XXX-BZ conver;t check .flags for MCS/VHT/.. */ + txs.final_rate = info->status.rates[0].idx; + txs.flags |= IEEE80211_RATECTL_STATUS_FINAL_RATE; +#endif + if (info->status.is_valid_ack_signal) { + txs.rssi = info->status.ack_signal; /* XXX-BZ CONVERT? */ + txs.flags |= IEEE80211_RATECTL_STATUS_RSSI; + } + + IMPROVE("only update of rate matches but that requires us to get a proper rate"); + ieee80211_ratectl_tx_complete(ni, &txs); + ridx = ieee80211_ratectl_rate(ni->ni_vap->iv_bss, NULL, 0); + +#ifdef LINUXKPI_DEBUG_80211 + if (linuxkpi_debug_80211 & D80211_TRACE_TX) { + printf("TX-RATE: %s: old %d new %d ridx %d, " + "long_retries %d\n", __func__, + old_rate, ni->ni_vap->iv_bss->ni_txrate, + ridx, txs.long_retries); + } +#endif + } + +#ifdef LINUXKPI_DEBUG_80211 + if (linuxkpi_debug_80211 & D80211_TRACE_TX) + printf("TX-STATUS: %s: hw %p skb %p status %d : flags %#x " + "band %u hw_queue %u tx_time_est %d : " + "rates [ %u %u %#x, %u %u %#x, %u %u %#x, %u %u %#x ] " + "ack_signal %u ampdu_ack_len %u ampdu_len %u antenna %u " + "tx_time %u is_valid_ack_signal %u " + "status_driver_data [ %p %p ]\n", + __func__, hw, skb, status, info->flags, + info->band, info->hw_queue, info->tx_time_est, + info->status.rates[0].idx, info->status.rates[0].count, + info->status.rates[0].flags, + info->status.rates[1].idx, info->status.rates[1].count, + info->status.rates[1].flags, + info->status.rates[2].idx, info->status.rates[2].count, + info->status.rates[2].flags, + info->status.rates[3].idx, info->status.rates[3].count, + info->status.rates[3].flags, + info->status.ack_signal, info->status.ampdu_ack_len, + info->status.ampdu_len, info->status.antenna, + info->status.tx_time, info->status.is_valid_ack_signal, + info->status.status_driver_data[0], + info->status.status_driver_data[1]); +#endif + + linuxkpi_ieee80211_free_txskb(hw, skb, status); +} + /* * This is an internal bandaid for the moment for the way we glue * skbs and mbufs together for TX. Once we have skbs backed by