Hi, On Fri, 30 Aug 2024 at 09:33, Mingyen Hsieh <mingyen.hsieh@xxxxxxxxxxxx> wrote: > > From: Ming Yen Hsieh <mingyen.hsieh@xxxxxxxxxxxx> > > Add definitions related to EHT mode and airtime calculation > according to the 802.11BE_D4.0. > > Co-developed-by: Bo Jiao <Bo.Jiao@xxxxxxxxxxxx> > Signed-off-by: Bo Jiao <Bo.Jiao@xxxxxxxxxxxx> > Signed-off-by: Deren Wu <deren.wu@xxxxxxxxxxxx> > Signed-off-by: Quan Zhou <quan.zhou@xxxxxxxxxxxx> > Signed-off-by: Ming Yen Hsieh <MingYen.Hsieh@xxxxxxxxxxxx> > --- > net/mac80211/airtime.c | 352 ++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 349 insertions(+), 3 deletions(-) > > diff --git a/net/mac80211/airtime.c b/net/mac80211/airtime.c > index fdf8b658fede..1fd9bea61379 100644 > --- a/net/mac80211/airtime.c > +++ b/net/mac80211/airtime.c (snip) > @@ -55,10 +55,21 @@ > #define HE_DURATION_S(shift, streams, gi, bps) \ > (HE_DURATION(streams, gi, bps) >> shift) > > +/* gi in HE/EHT is identical. It matches enum nl80211_eht_gi as well */ > +#define EHT_GI_08 HE_GI_08 > +#define EHT_GI_16 HE_GI_16 > +#define EHT_GI_32 HE_GI_32 > + > +#define EHT_DURATION(streams, gi, bps) \ > + HE_DURATION(streams, gi, bps) > +#define EHT_DURATION_S(shift, streams, gi, bps) \ > + HE_DURATION_S(shift, streams, gi, bps) > + > #define BW_20 0 > #define BW_40 1 > #define BW_80 2 > #define BW_160 3 > +#define BW_320 4 ... > + EHT_GROUP(16, EHT_GI_32, BW_320), > }; You define BW_320 and groups for it, but currently ieee80211_get_rate_duration() rejects rx_statuses with a bw > 160, so you will need to allow BW_320 (for EHT only?) as well. > static u32 > @@ -443,11 +771,20 @@ static u32 ieee80211_get_rate_duration(struct ieee80211_hw *hw, > idx = status->rate_idx; > group = HE_GROUP_IDX(streams, status->he_gi, bw); > break; > + case RX_ENC_EHT: > + streams = status->nss; > + idx = status->rate_idx; > + group = EHT_GROUP_IDX(streams, status->eht.gi, bw); > + break; > default: > WARN_ON_ONCE(1); > return 0; > } > > + if (WARN_ON_ONCE((status->encoding != RX_ENC_EHT && streams > 8) || > + (status->encoding == RX_ENC_EHT && streams > 16))) > + return 0; > + > if (WARN_ON_ONCE((status->encoding != RX_ENC_HE && streams > 4) || > (status->encoding == RX_ENC_HE && streams > 8))) > return 0; RX_ENC_EHT with > 4 streams would trigger the existing WARN_ON() and make this not work. Probably not what you indented. Best Regards, Jonas