git: 47ff90e57ef3 - releng/13.2 - LinuxKPI: 802.11: implement ieee80211_tx_status_ext()

From: Bjoern A. Zeeb <bz_at_FreeBSD.org>
Date: Thu, 23 Feb 2023 19:34:32 UTC
The branch releng/13.2 has been updated by bz:

URL: https://cgit.FreeBSD.org/src/commit/?id=47ff90e57ef3a2e9ad39133d558064ef490e42c0

commit 47ff90e57ef3a2e9ad39133d558064ef490e42c0
Author:     Bjoern A. Zeeb <bz@FreeBSD.org>
AuthorDate: 2023-01-31 15:35:59 +0000
Commit:     Bjoern A. Zeeb <bz@FreeBSD.org>
CommitDate: 2023-02-23 19:32:34 +0000

    LinuxKPI: 802.11: implement ieee80211_tx_status_ext()
    
    Add an implementation of ieee80211_tx_status_ext() extending the
    internal linuxkpi_ieee80211_tx_status() implementation.
    
    Sponsored by:   The FreeBSD Foundation
    Approved by:    re (cperciva)
    
    (cherry picked from commit a839757109891573123d8777b539fafa2d2198bb)
    (cherry picked from commit df109ed24233e367ef7060a25ab1b55e2afcddc8)
---
 sys/compat/linuxkpi/common/include/net/mac80211.h | 31 +++++++++--------
 sys/compat/linuxkpi/common/src/linux_80211.c      | 41 +++++++++++++++++++----
 2 files changed, 51 insertions(+), 21 deletions(-)

diff --git a/sys/compat/linuxkpi/common/include/net/mac80211.h b/sys/compat/linuxkpi/common/include/net/mac80211.h
index fee8b88d8feb..2b3f6b8e3ab1 100644
--- a/sys/compat/linuxkpi/common/include/net/mac80211.h
+++ b/sys/compat/linuxkpi/common/include/net/mac80211.h
@@ -1028,6 +1028,8 @@ 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 *);
+void linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *,
+    struct ieee80211_tx_status *);
 
 /* -------------------------------------------------------------------------- */
 
@@ -1988,13 +1990,6 @@ ieee80211_sta_set_buffered(struct ieee80211_sta *sta, uint8_t tid, bool t)
 	TODO();
 }
 
-static __inline void
-ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
-{
-
-	linuxkpi_ieee80211_tx_status(hw, skb);
-}
-
 static __inline void
 ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf, uint8_t tid,
     struct ieee80211_key_seq *seq)
@@ -2130,6 +2125,13 @@ ieee80211_wake_queue(struct ieee80211_hw *hw, uint16_t q)
 	TODO();
 }
 
+static __inline void
+ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
+{
+
+	linuxkpi_ieee80211_tx_status(hw, skb);
+}
+
 static __inline void
 ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, struct sk_buff *skb)
 {
@@ -2144,6 +2146,14 @@ ieee80211_tx_status_ni(struct ieee80211_hw *hw, struct sk_buff *skb)
 	ieee80211_tx_status(hw, skb);
 }
 
+static __inline void
+ieee80211_tx_status_ext(struct ieee80211_hw *hw,
+    struct ieee80211_tx_status *txstat)
+{
+
+	linuxkpi_ieee80211_tx_status_ext(hw, txstat);
+}
+
 static __inline void
 ieee80211_tx_info_clear_status(struct ieee80211_tx_info *info)
 {
@@ -2355,13 +2365,6 @@ ieee80211_get_tx_rates(struct ieee80211_vif *vif, struct ieee80211_sta *sta,
 	TODO();
 }
 
-static __inline void
-ieee80211_tx_status_ext(struct ieee80211_hw *hw,
-    struct ieee80211_tx_status *txstat)
-{
-	TODO();
-}
-
 static __inline void
 ieee80211_color_change_finish(struct ieee80211_vif *vif)
 {
diff --git a/sys/compat/linuxkpi/common/src/linux_80211.c b/sys/compat/linuxkpi/common/src/linux_80211.c
index e0457e0e5fa0..57dd174b62a1 100644
--- a/sys/compat/linuxkpi/common/src/linux_80211.c
+++ b/sys/compat/linuxkpi/common/src/linux_80211.c
@@ -4280,8 +4280,8 @@ linuxkpi_ieee80211_txq_get_depth(struct ieee80211_txq *txq,
  * passed back from the driver.  rawx_mit() saves the ni on the m and the
  * m on the skb for us to be able to give feedback to net80211.
  */
-void
-linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb,
+static void
+_lkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb,
     int status)
 {
 	struct ieee80211_node *ni;
@@ -4296,20 +4296,28 @@ linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb,
 		ieee80211_tx_complete(ni, m, status);
 		/* ni & mbuf were consumed. */
 	}
+}
 
+void
+linuxkpi_ieee80211_free_txskb(struct ieee80211_hw *hw, struct sk_buff *skb,
+    int status)
+{
+
+	_lkpi_ieee80211_free_txskb(hw, skb, status);
 	kfree_skb(skb);
 }
 
 void
-linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
+linuxkpi_ieee80211_tx_status_ext(struct ieee80211_hw *hw,
+    struct ieee80211_tx_status *txstat)
 {
+	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);
-
+	skb = txstat->skb;
 	if (skb->m != NULL) {
 		struct mbuf *m;
 
@@ -4320,6 +4328,7 @@ linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 		ni = NULL;
 	}
 
+	info = txstat->info;
 	if (info->flags & IEEE80211_TX_STAT_ACK) {
 		status = 0;	/* No error. */
 		txs.status = IEEE80211_RATECTL_TX_SUCCESS;
@@ -4342,7 +4351,7 @@ linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 			txs.flags |= IEEE80211_RATECTL_STATUS_LONG_RETRY;
 		}
 #if 0		/* Unused in net80211 currently. */
-		/* XXX-BZ conver;t check .flags for MCS/VHT/.. */
+		/* XXX-BZ convert check .flags for MCS/VHT/.. */
 		txs.final_rate = info->status.rates[0].idx;
 		txs.flags |= IEEE80211_RATECTL_STATUS_FINAL_RATE;
 #endif
@@ -4390,7 +4399,25 @@ linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
 		    info->status.status_driver_data[1]);
 #endif
 
-	linuxkpi_ieee80211_free_txskb(hw, skb, status);
+	if (txstat->free_list) {
+		_lkpi_ieee80211_free_txskb(hw, skb, status);
+		list_add_tail(&skb->list, txstat->free_list);
+	} else {
+		linuxkpi_ieee80211_free_txskb(hw, skb, status);
+	}
+}
+
+void
+linuxkpi_ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
+{
+	struct ieee80211_tx_status status;
+
+	memset(&status, 0, sizeof(status));
+	status.info = IEEE80211_SKB_CB(skb);
+	status.skb = skb;
+	/* sta, n_rates, rates, free_list? */
+
+	ieee80211_tx_status_ext(hw, &status);
 }
 
 /*