From nobody Mon Apr 18 09:33:54 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 2406A11E4C95; Mon, 18 Apr 2022 09:33:56 +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 4KhhZp3M2vz3Cy2; Mon, 18 Apr 2022 09:33:54 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650274435; 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=PIB26NoovzEo9Gf6rdc6vcGHXeuS9wnH8HPJPl6DMKM=; b=A2WpVCQkJouMmyyTCFWKiMMp00mFQWUvvHIfcamIEk6MqfQZEQYO8GwvPUpfIs34/jrw0M SBGJrvZwJ4SUxEkneJI6QAVzPn03SGFXhLLqpzXSuP17GyMLnhHcfGZ0G9WO/SDoZTTdVQ ji2kuPIHPpXXep1xMf+RjXCpGr+wj1ayQ6WqPtxpYEBWPPEu65WoiHlb2D+TbbVKdxSr1S 2UV2mTqW6Kn9ruQnYQUBC5hoD0V6w2b8d5da7p9k//wWPfSObDxy2RjFOINPfJ+575tch5 xuLttHxew/lnBGlVSb72Cb9MQYTTgKy7v3O7aexRvCnObaaujjhWX6bMcYjeVA== 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 3318C1052F; Mon, 18 Apr 2022 09:33:54 +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 23I9Xs2c018589; Mon, 18 Apr 2022 09:33:54 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 23I9XsQT018588; Mon, 18 Apr 2022 09:33:54 GMT (envelope-from git) Date: Mon, 18 Apr 2022 09:33:54 GMT Message-Id: <202204180933.23I9XsQT018588@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: f71daf6a11b7 - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: f71daf6a11b7b67bba34e6be5c737acedbeda803 Auto-Submitted: auto-generated ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1650274435; 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=PIB26NoovzEo9Gf6rdc6vcGHXeuS9wnH8HPJPl6DMKM=; b=dzMWw6tQ67Clai5Oe7SWsWpCjhXP30tGZjH7yzYGnjkNNcm3WXPCc9HEKYCSROCAHtaEiY mm3FSe72V7zpY9E6SlH9P7NlTLFgGslsAazAO6xitZsSCu4AIJ4XGklbqf9MaTLe6yISOe oTwvt6XFCeh0KalmVsHQCMpHDXkkRwZouhdw6z87oUPMFEglsOyt/A8uRGsI9YjJrwrkhH JwOAuI8RuS1toDC0mQPwNa9NITkFXnZfh4ONV3KZMcEraYfWGyqoJdMDv6yD7PwrZjngNe vzbCTNrh//wESWpigKsBPNkhAMYVGOTjI3ejJjii3NDdwGkO/HnYpoakBxwSsg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1650274435; a=rsa-sha256; cv=none; b=Ovv0Cnu/kv4WoujhKVO8ZZ6DZTxmyK0r2FayLRI+hr/Q2R4G6MdalS+ulH04khVMBeNXDs MAFOPIuySEDtKsGo3LnesVDBq4iF7VQHb+KO54rCCHTUhbbxXCNrpwQTcxkfMAbpAu0QfP 9br5Cruq4Jd+FkXo1CuOZlK8mExvtiLc107B7m8KmkZtRP88KBP/TYNSVdKbhwr91btH3a RQpQr8JTEpBN3XnXFw5T+IX5gZIWcqXE9kSxMGTpenBi9tLNkc1sLNHXmNRHtI9omDzpUp 66A2EGLeMFL14BZYHMmTiXVD/xbh8lvrP03OQROh4dKiwxrZsqYkbAw3QSz8wg== 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=f71daf6a11b7b67bba34e6be5c737acedbeda803 commit f71daf6a11b7b67bba34e6be5c737acedbeda803 Author: Bjoern A. Zeeb AuthorDate: 2022-04-15 13:39:38 +0000 Commit: Bjoern A. Zeeb CommitDate: 2022-04-18 09:32:58 +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 (cherry picked from commit 383b3e8f509f9658329d33d7da5473b881c37349) --- 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 59101e334376..601c240ee553 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 9355098295a9..b80d8b62087b 100644 --- a/sys/compat/linuxkpi/common/src/linux_80211.c +++ b/sys/compat/linuxkpi/common/src/linux_80211.c @@ -4180,6 +4180,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