diff mbox series

[RFC,v2,2/6] mac80211: add tx-power annotation in control path

Message ID 20220920104032.496697-3-jelonek.jonas@gmail.com
State New
Headers show
Series mac80211: add TPC support in control path | expand

Commit Message

Jonas Jelonek Sept. 20, 2022, 10:40 a.m. UTC
This patch adds members to ieee80211_tx_info and ieee80211_sta_rates
structures to allow tx-power annotation per packet/per mrr stage.
The added members are always tx-power indices referring to the tx-power
set described by ieee80211_hw->txpower_ranges.

The annotation in ieee80211_tx_info is for probing and compatibility
reasons only, e.g. drivers that only support RC/TPC per packet and do
not yet use ieee80211_sta_rates.

Signed-off-by: Thomas Huehn <thomas.huehn@hs-nordhausen.de>
Signed-off-by: Jonas Jelonek <jelonek.jonas@gmail.com>
---
 include/net/mac80211.h | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

Comments

Johannes Berg Jan. 12, 2023, 10:31 a.m. UTC | #1
On Tue, 2022-09-20 at 12:40 +0200, Jonas Jelonek wrote:
> 
>   * @rate_idx The actual used rate.
>   * @try_count How often the rate was tried.
> - * @tx_power_idx An idx into the ieee80211_hw->tx_power_levels list of the
> - * 	corresponding wifi hardware. The idx shall point to the power level
> - * 	that was used when sending the packet.
> + * @tx_power_idx An idx into the the tx-power set described by
> + * 	ieee80211_hw->txpower_ranges for the corresponding wifi hardware.
> + * 	The idx shall point to the tx-power level that was used when sending
> + * 	the packet at this rate. A negative value is considered as 'invalid'
> + * 	or 'no power level reported by the driver'.

maybe fix the kernel-doc (at least for this entry) while at it and add
the missing colon.

johannes
diff mbox series

Patch

diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index a047fb5fc207..67d9087e031f 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -1073,6 +1073,10 @@  ieee80211_rate_get_vht_nss(const struct ieee80211_tx_rate *rate)
  * @control.use_cts_prot: use RTS/CTS
  * @control.short_preamble: use short preamble (CCK only)
  * @control.skip_table: skip externally configured rate table
+ * @control.txpower_idx: Tx-power level index for whole packet,
+ * 	referring to an idx described by ieee80211_hw->txpower_ranges. A
+ * 	negative idx means 'invalid', 'unset' or 'default'. Behavior in this
+ * 	case is driver-specific.
  * @control.jiffies: timestamp for expiry on powersave clients
  * @control.vif: virtual interface (may be NULL)
  * @control.hw_key: key to encrypt with (may be NULL)
@@ -1121,7 +1125,7 @@  struct ieee80211_tx_info {
 					u8 use_cts_prot:1;
 					u8 short_preamble:1;
 					u8 skip_table:1;
-					/* 2 bytes free */
+					s16 txpower_idx;
 				};
 				/* only needed before rate control */
 				unsigned long jiffies;
@@ -1182,14 +1186,16 @@  ieee80211_info_get_tx_time_est(struct ieee80211_tx_info *info)
  *
  * @rate_idx The actual used rate.
  * @try_count How often the rate was tried.
- * @tx_power_idx An idx into the ieee80211_hw->tx_power_levels list of the
- * 	corresponding wifi hardware. The idx shall point to the power level
- * 	that was used when sending the packet.
+ * @tx_power_idx An idx into the the tx-power set described by
+ * 	ieee80211_hw->txpower_ranges for the corresponding wifi hardware.
+ * 	The idx shall point to the tx-power level that was used when sending
+ * 	the packet at this rate. A negative value is considered as 'invalid'
+ * 	or 'no power level reported by the driver'.
  */
 struct ieee80211_rate_status {
 	struct rate_info rate_idx;
 	u8 try_count;
-	u8 tx_power_idx;
+	s16 tx_power_idx;
 };
 
 /**
@@ -2113,6 +2119,10 @@  enum ieee80211_sta_rx_bandwidth {
  * @rcu_head: RCU head used for freeing the table on update
  * @rate: transmit rates/flags to be used by default.
  *	Overriding entries per-packet is possible by using cb tx control.
+ * @rate.txpower_idx: An idx pointing to a tx-power level described by
+ * 	ieee80211_hw->txpower_ranges that should be used for the mrr stage.
+ * 	A negative value means 'invalid', 'unset' or 'default' power level,
+ * 	actual behavior is driver-specific.
  */
 struct ieee80211_sta_rates {
 	struct rcu_head rcu_head;
@@ -2122,6 +2132,7 @@  struct ieee80211_sta_rates {
 		u8 count_cts;
 		u8 count_rts;
 		u16 flags;
+		s16 txpower_idx;
 	} rate[IEEE80211_TX_RATE_TABLE_SIZE];
 };