mac80211: add rate to ieee80211_tx_status
RFC 1/1 mac80211: add rate to ieee80211_tx_status
This patch adds rate to ieee80211_tx_status. Downscaling in iwl4965 is done in FW. Rate scaling algorithm needs to know at which rate the packet was actually transmitted Patch 'cfg80211 API for channels/bitrates' removed the placeholder for this information that was present in ieee80211_tx_control.
---
This fix or something similar is required for bringing iwlwifi back to life. Please comments, suggestions
Thanks
include/net/mac80211.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/net/mac80211.h +2 -0
@@ -342,6 +342,7 @@ enum ieee80211_tx_status_flags {* * @control: a copy of the &struct ieee80211_tx_control passed to the driver * in the tx() callback. +* @rate: rate at which the packet was actually transmitted * @flags: transmit status flags, defined above * @retry_count: number of retries * @excessive_retries: set to 1 if the frame was retried many times
@@ -356,6 +357,7 @@ enum ieee80211_tx_status_flags {*/ struct ieee80211_tx_status {struct ieee80211_tx_control control; +struct ieee80211_rate rate;u8 flags;u8 retry_count;bool excessive_retries;
Signature · 1 line
1.5.2.2
Johannes Berg
maintainerQuoted 14 lines
include/net/mac80211.h +1
-0@@ -342,6 +342,7 @@ enum ieee80211_tx_status_flags {* * @control: a copy of the &struct ieee80211_tx_control passed to the driver * in the tx() callback. +* @rate: rate at which the packet was actually transmitted * @flags: transmit status flags, defined above * @retry_count: number of retries * @excessive_retries: set to 1 if the frame was retried many times
include/net/mac80211.h enum ieee80211_tx_status_flags { · line 360
Quoted 4 lines
include/net/mac80211.h +1
-0@@ -356,6 +357,7 @@ enum ieee80211_tx_status_flags {*/ struct ieee80211_tx_status {struct ieee80211_tx_control control; +struct ieee80211_rate rate;
Shouldn't that rather be a rate pointer? Seems a bit odd to me to copy that information. Felix, could this help you as well?
johannes
Quoted 13 lines · Johannes Berg
Quoted 13 lines
include/net/mac80211.h +1
-0@@ -342,6 +342,7 @@ enum ieee80211_tx_status_flags {* * @control: a copy of the &struct ieee80211_tx_control passed to the driver * in the tx() callback. +* @rate: rate at which the packet was actually transmitted * @flags: transmit status flags, defined above * @retry_count: number of retries * @excessive_retries: set to 1 if the frame was retried many times
Quoted 8 lines
include/net/mac80211.h enum ieee80211_tx_status_flags { · line 360
Quoted 5 lines
include/net/mac80211.h +1
-0@@ -356,6 +357,7 @@ enum ieee80211_tx_status_flags {*/ struct ieee80211_tx_status {struct ieee80211_tx_control control; +struct ieee80211_rate rate;Shouldn't that rather be a rate pointer? Seems a bit odd to me to copy that information. Felix, could this help you as well?
Where would be this pointer allocated? TX response is not the same flow as TX where we keep it on the stack. It's will be very error prone to be outside tx_status. From concept perspective you already have all transimission information in that structure.
For iwlwifi I actually need only u32 value but I was looking for something more general even it's a little pain.
I'm not sure but I guess we may as well separate ieee80211_tx_control form ieee80211_tx_status as they carry different information
Thanks
Tomas
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): 6231174111099834440@unknownmsgid
Quoted 10 lines · Johannes Berg
Quoted 6 lines
Where would be this pointer allocated? TX response is not the same flow as TX where we keep it on the stack. It's will be very error prone to be outside
tx_status. From concept perspective you already have all transimission information in that structure. For iwlwifi I actually need only u32 value but I was looking for something more general even it's a little pain.You don't need to allocate it, it can just point to the rate array you have registered, no? Rates information is static after all. Or do it like rx status where we pass the index into the rate array.
I prefer not. This is not just plcp rate there is also MCS flags that have to passed. With all combinations the array will be huge.
Tomas
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): -6799378017406559341@unknownmsgid
Quoted 11 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler
I prefer not. This is not just plcp rate there is also MCS flags that have to passed. With all combinations the array will be huge.
So you'd actually abuse the struct bitrate contents if you add the bitrate? I prefer that wouldn't be done, it makes the code impossible to follow.
I guess we need to rework the rate control algorithm API completely.
No I won't we add rate flags which are part of spec anyway and then plcp rate it self will be in bitrate.
num ieee80211_rate_flags {
IEEE80211_RATE_SHORT_PREAMBLE = 1<<0,
IEEE80211_RATE_MANDATORY_A = 1<<1,
IEEE80211_RATE_MANDATORY_B = 1<<2,
IEEE80211_RATE_MANDATORY_G = 1<<3,
IEEE80211_RATE_ERP_G = 1<<4,
IEEE80211_RATE_HT_GF = 1<<5, /* green field */
IEEE80211_RATE_HT_SGI = 1<<5, /* short guarding interval */
IEEE80211_RATE_HT_FAT = 1<<6, /* 40Mhz Channel */
IEEE80211_RATE_HT_SISO = 1<<7,
IEEE80211_RATE_HT_MIMO = 1<<8,
IEEE80211_RATE_ANT_A = 1<<8, /* Number of antenna - no
radio goes over 3 so 4 will be enough */
IEEE80211_RATE_ANT_B = 1<<8,
IEEE80211_RATE_ANT_C = 1<<8,
IEEE80211_RATE_ANT_D = 1<<8,};
/**
* struct ieee80211_rate - bitrate definition
*
* This structure describes a bitrate that an 802.11 PHY can
* operate with. The two values @hw_value and @hw_value_short
* are only for driver use when pointers to this structure are
* passed around.
*
* @flags: rate-specific flags
* @bitrate: bitrate in units of 100 Kbps
* @hw_value: driver/hardware value for this rate
* @hw_value_short: driver/hardware value for this rate when
* short preamble is used
*/
struct ieee80211_rate {
u32 flags;
u16 bitrate;
u16 hw_value, hw_value_short;
};Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): -4694429725714512287@unknownmsgid
Quoted 16 lines · Johannes Berg
Quoted 13 lines · Tomas Winkler
No I won't we add rate flags which are part of spec anyway and then plcp rate it self will be in bitrate.
IEEE80211_RATE_HT_GF = 1<<5, /* green field */ IEEE80211_RATE_HT_SGI = 1<<5, /* short guarding interval */ IEEE80211_RATE_HT_FAT = 1<<6, /* 40Mhz Channel */ IEEE80211_RATE_HT_SISO = 1<<7, IEEE80211_RATE_HT_MIMO = 1<<8, IEEE80211_RATE_ANT_A = 1<<8, /* Number of antenna - no radio goes over 3 so 4 will be enough */ IEEE80211_RATE_ANT_B = 1<<8, IEEE80211_RATE_ANT_C = 1<<8, IEEE80211_RATE_ANT_D = 1<<8,
Quoted 5 lines
Ah, I see. Since these flags aren't really rate specific, so shouldn't they rather be part of the TX control, TX status and RX status directly rather than inside the rate? The flags within the bitrate are meant to indicate hardware capabilities and/or spec flags (like ERP) not control flags like these are.
No, they are rate specific the are not modulation specific, each of them can change from packet to packet.
Thanks
Tomas
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): -2417195033053015320@unknownmsgid
Quoted 7 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler
No, they are rate specific the are not modulation specific, each of them can change from packet to packet.
Exactly. flags in the bitrate struct aren't meant to change from packet to packet but be specific to a bitrate. The way I see it these are TX control or rate control flags, not rate flags.
I see, I got it.
Yes you are right. they should be part of the statuses. Tomas
Quoted 2 lines
johannes
Quoted 6 lines · Tomas Winkler
Quoted 4 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler
No, they are rate specific the are not modulation specific, each of them can change from packet to packet.
Quoted 7 lines
Quoted 3 lines
Exactly. flags in the bitrate struct aren't meant to change from packet to packet but be specific to a bitrate. The way I see it these are TX control or rate control flags, not rate flags.
I see, I got it.
Yes you are right. they should be part of the statuses. Tomas
Last question before I got another patch out?
So what will be use of ieee80211_rate in tx_control then?
Quoted 3 lines
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): 5358276387473684738@unknownmsgid
Quoted 8 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler
Last question before I got another patch out?
So what will be use ofieee80211_rateintx_controlthen?Hmm? Not quite sure what you're asking. The
tx_controlhas a pointer to the bitrate right now so that contains what bitrate the rate control algorithm selected (whether or not the hw downscales by itself).
So we add rate flags and pointer to bit rate structure? Correct?
Thanks
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): 5605009721259660313@unknownmsgid
Quoted 21 lines · Johannes Berg
Quoted 6 lines · Tomas Winkler
Quoted 3 lines
Hmm? Not quite sure what you're asking. The
tx_controlhas a pointer to the bitrate right now so that contains what bitrate the rate control algorithm selected (whether or not the hw downscales by itself).So we add rate flags and pointer to bit rate structure? Correct?
I thought we just agreed not to because they're not bit rate but rather rate control specific. Think of it this way: the rate control algorithm selects a bitrate and those control flags you mentioned (SISO/MIMO/...), right?
So the rate control algorithm has to communicate the bitrate and the flags to the hardware. It currently communicates the bitrate selection by giving a bitrate structure pointer (it could simply give the bitrate in kbps or whatever but that would mean the driver needs to look up its
hw_valueso this is the reason for passing the pointer) and cannot currently communicate the control flags selection.
Quoted 4 lines
So the way I see it we'd add something like "u32
rate_control_flags" to structtx_controlfor the flags you wanted, and also add a similar field (to be able to reuse the flag definitions) to the tx status & rx status structs. It seems to me that makes most sense, no?
I think we're talking about the same
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): 49711.::ffff:[email protected]
Quoted 12 lines · Johannes Berg
I thought we just agreed not to because they're not bit rate but rather rate control specific. Think of it this way: the rate control algorithm selects a bitrate and those control flags you mentioned (SISO/MIMO/...), right?
So the rate control algorithm has to communicate the bitrate and the flags to the hardware. It currently communicates the bitrate selection by giving a bitrate structure pointer (it could simply give the bitrate in kbps or whatever but that would mean the driver needs to look up its
hw_valueso this is the reason for passing the pointer) and cannot currently communicate the control flags selection.
Quoted 4 lines
So the way I see it we'd add something like "u32
rate_control_flags" to structtx_controlfor the flags you wanted, and also add a similar field (to be able to reuse the flag definitions) to the tx status & rx status structs. It seems to me that makes most sense, no?
I'd like to have multiple rates in the tx status, including the number of attempts for each rate. The Minstrel rate control needs these to build its statistics properly.
- Felix
A message that is not in the archive (sent off-list or not yet received): -5971017268625562167@unknownmsgid
Quoted 6 lines · Johannes Berg
Quoted 3 lines · Felix Fietkau
I'd like to have multiple rates in the tx status, including the number of attempts for each rate. The Minstrel rate control needs these to build its statistics properly.
Quoted 8 lines
Maybe we should add two new structures:
(a) structieee80211_ratectrl_tx_status
and
(b) structieee80211_tx_ratectrlboth containing a struct
ieee80211_bitrate* and u32rate_ctrl_flags, then we can build arrays of these where necessary and/or embed them intx_statusandtx_control.
I think we should also remove ieee80211_tx_control from ieee80211_tx_status. Maybe we should add blob to tx_status let say of skb->cb[] size and field for rate scale algorithm version/name. Otherwise we will be inventing API for each rate scale algorithm... or maybe I'm giving up to reach something general...
Tomas
Quoted 2 lines
johannes
A message that is not in the archive (sent off-list or not yet received): -7767648866191425885@unknownmsgid
Quoted 6 lines · Johannes Berg
Quoted 2 lines · Tomas Winkler
I think we should also remove
ieee80211_tx_controlfromieee80211_tx_status.Not sure. Where is it used?
Let's try, if it's break we won't be in worst situation then now :)
Quoted 11 lines
Quoted 4 lines
Maybe we should add blob to
tx_statuslet say of skb->cb[] size and field for rate scale algorithm version/name. Otherwise we will be inventing API for each rate scale algorithm...I disagree, we should have something generic enough to allow some sort of "capability negotiation" between the driver and the rate control algorithm, otherwise we could just remove rate control algorithms completely and internalize them into drivers (with some "helper" functions for those who don't want to write their own)... Which I'm sure you might actually like but I don't ;)
So Felix how many rates do you need for each packet?
Thanks
Tomas
Quoted 2 lines
johannes
Quoted 4 lines · Tomas Winkler
Quoted 4 lines
Quoted 3 lines
Maybe we should add blob to
tx_statuslet say of skb->cb[] size and field for rate scale algorithm version/name. Otherwise we will be inventing API for each rate scale algorithm...
Quoted 8 lines
Quoted 6 lines
I disagree, we should have something generic enough to allow some sort of "capability negotiation" between the driver and the rate control algorithm, otherwise we could just remove rate control algorithms completely and internalize them into drivers (with some "helper" functions for those who don't want to write their own)... Which I'm sure you might actually like but I don't ;)
So Felix how many rates do you need for each packet?
The algorithm is designed to work with 4 different rates with adjustable retry counts. A good description can be found here:
http://madwifi.org/browser/madwifi/trunk/ath_rate/minstrel/minstrel.txt
- Felix
Quoted 12 lines · Felix Fietkau
Quoted 11 lines · Tomas Winkler
Quoted 10 lines
Quoted 3 lines
Maybe we should add blob to
tx_statuslet say of skb->cb[] size and field for rate scale algorithm version/name. Otherwise we will be inventing API for each rate scale algorithm...I disagree, we should have something generic enough to allow some sort of "capability negotiation" between the driver and the rate control algorithm, otherwise we could just remove rate control algorithms completely and internalize them into drivers (with some "helper" functions for those who don't want to write their own)... Which I'm sure you might actually like but I don't ;)
Quoted 5 lines
Quoted 1 line
So Felix how many rates do you need for each packet?
The algorithm is designed to work with 4 different rates with adjustable retry counts. A good description can be found here:
http://madwifi.org/browser/madwifi/trunk/ath_rate/minstrel/minstrel.txt
Will this work work you?
ieee80211_tx_ratectrl {
u32 bitrate ( or pointer to ieee80211_rate I prefer no) u32 flags
u32 retry_count
}
ieee80211_tx_status {
ieee80211_tx_ratectrl retry_count[ X] / * X >= 4 */
}Thanks
Tomas
Quoted 2 lines
- Felix
Quoted 11 lines · Tomas Winkler
Will this work work you?
ieee80211_tx_ratectrl{
u32 bitrate ( or pointer toieee80211_rateI prefer no) u32 flags
u32retry_count
}ieee80211_tx_status { ieee80211_tx_ratectrl retry_count[ X] / * X >= 4 */ }
I guess that would work, but shouln't the array below be dynamic based on what the driver can do? Many drivers can only work with one or two rates, IMHO.
- Felix
Quoted 9 lines · Felix Fietkau
Quoted 8 lines · Tomas Winkler
Will this work work you?
ieee80211_tx_ratectrl{
u32 bitrate ( or pointer toieee80211_rateI prefer no) u32 flags
u32retry_count
}
Quoted 5 lines
Quoted 3 lines
ieee80211_tx_status { ieee80211_tx_ratectrl retry_count[ X] / * X >= 4 */ }I guess that would work, but shouln't the array below be dynamic based on what the driver can do? Many drivers can only work with one or two rates, IMHO.
The problem that this structure is passed with each packett I don't like the idea that anybody would even try to allocate and free this structure as packets goes. However what about the following?
ieee80211_tx_status {
size_t nrates;
ieee80211_tx_ratectrl retry_count[0] ;
}Quoted 2 lines
- Felix
Quoted 17 lines · Tomas Winkler
Quoted 9 lines · Felix Fietkau
Quoted 8 lines · Tomas Winkler
Will this work work you?
ieee80211_tx_ratectrl{
u32 bitrate ( or pointer toieee80211_rateI prefer no) u32 flags
u32retry_count
}Quoted 5 lines
Quoted 3 lines
ieee80211_tx_status { ieee80211_tx_ratectrl retry_count[ X] / * X >= 4 */ }I guess that would work, but shouln't the array below be dynamic based on what the driver can do? Many drivers can only work with one or two rates, IMHO.
Quoted 9 lines
The problem that this structure is passed with each packett I don't like the idea that anybody would even try to allocate and free this structure as packets goes. However what about the following?
ieee80211_tx_status { size_t nrates; ieee80211_tx_ratectrl retry_count[0] ; }
Sorry I meantieee80211_tx_status {
Quoted 6 lines
size_t nrates; ieee80211_tx_ratectrl rates[0] ; }Quoted 2 lines
- Felix
Quoted 5 lines · On Mon, 4 Feb 2008 21:05:25 +0200 "Tomas Winkler" <[email protected]> wrote:
Sorry I meant
ieee80211_tx_status{Quoted 3 lines
size_t nrates; ieee80211_tx_ratectrl rates[0] ; }
FWIW, I'm OK with this. BTW, further changes to this may be required in the future as I plan to rework a bit the whole tx_status thing so that drivers won't have to report ACKed frames but failed and retransmitted frames only - this would reduce the load on slow buses such as USB.
--
Ciao
Stefano
Quoted 5 lines · Stefano Brivio
Quoted 2 lines · On Mon, 4 Feb 2008 21:05:25 +0200 "Tomas Winkler" <[email protected]> wrote:
Sorry I meant
ieee80211_tx_status{
Quoted 9 lines
Quoted 3 lines
Quoted 3 lines
size_t nrates; ieee80211_tx_ratectrl rates[0] ; }FWIW, I'm OK with this. BTW, further changes to this may be required in the future as I plan to rework a bit the whole
tx_statusthing so that drivers won't have to report ACKed frames but failed and retransmitted frames only - this would reduce the load on slow buses such as USB.
Just keep in mind that some driver requires to report ACKed frames to make rate scaling algorithm to work properly, this should be optional only.
Second I believe for some management frames it's good to notify mac about successful transmission regardless of rate scaling algorithm.
Thanks
Tomas
Quoted 4 lines
--
Ciao
Stefano
Johannes Berg
maintainerQuoted 6 lines
Just keep in mind that some driver requires to report ACKed frames to make rate scaling algorithm to work properly, this should be optional only.
Second I believe for some management frames it's good to notify mac about successful transmission regardless of rate scaling algorithm.
Hostapd wants that for EAPOL frames as well, so it has to be somehow triggerable per-frame.
johannes
Quoted 8 lines · Tomas Winkler
The problem that this structure is passed with each packett I don't like the idea that anybody would even try to allocate and free this structure as packets goes. However what about the following?
ieee80211_tx_status { size_t nrates; ieee80211_tx_ratectrl rates[0] ; }
Yes, I think that would be ok.
- Felix