An S1G PPDU formats the TIM differently compared to non-S1G PPDU's, meaning in order for an S1G STA and AP to correctly coordinate power save, the TIM PVB shall be encoded as per IEEE80211-2024 9.4.2.5.1 Figure 9-213. An S1G PPDU uses the notion of "pages" where each page can represent 2048 AIDs, for a maximum theoretical limit of 8192 AIDs. However as there is no page slicing support, we will be limiting the PVB to a single page describing entire range of AIDs within the bitmap. This is permitted as per IEEE80211-2024 9.4.2.5.1: "If the Page Slice Number subfield is 31, then the entire page indicated by the Page Index subfield value is encoded in the Partial Virtual Bitmap field of the TIM elements with the same page index." When this configuration is used, the PVB is broken down into a list of encoded blocks. Each encoded block has a maximum length of 10 bytes and can describe 64 AIDs. We currently only support block bitmap encoding. Each encoded block contains a block control byte, which contains the block offset. The block offset represents the block index the current encoded block describes. Following the block control is the block bitmap and between 0 and 8 subblocks. Each subblock is 1 byte and can describe at most 8 AIDs, where the respective bit set in the block bitmap indicates the presence of the subblock. However, there are some further limitations. Firstly, the TIM element has a maximum length of 255 bytes - and given that each encoded block has a maximum length of 10 bytes, 32 * 10 = 320 this exceeds the maximum TIM element length. As a comprimise until page slicing is implemented, we set a maximum block count of 25 (25 * 10 + 1 + 1 + 1) meaning we can describe 25 * 64 = 1600 AIDs. This fits within the existing mac80211 bitmap and is more than enough for current implementations. In the future, when page slicing support is added this will need to be modified. Parsing support for the S1G PPDU PVB format is added on the STA side to allow full power save support for S1G drivers. Notes: (1) I've run hwsim tests and (obviously) tested the S1G power save path, but the 2 hwsim power save tests only check multicast traffic and even then only 1 sta. So would be good for someone to confirm that this hasn't broken non-S1G tim encoding. Even though it's only code being shuffled around, that wouldn't be ideal :) Trace Example: Tag: Traffic Indication Map (TIM): DTIM 2 of 10 bitmap Tag Number: Traffic Indication Map (TIM) (5) Tag length: 6 DTIM count: 2 DTIM period: 10 Bitmap Control: 0x3e .... ...0 = Traffic Indication: 0x0 ..11 111. = Page Slice Number: 31 00.. .... = Page Index: 0 Partial Virtual Bitmap Encoded Block 0 Block Control Byte: 0x00 Block Bitmap Block Bitmap: 0x01, Subblock 1 present Subblock 0 .... ..1. = STA AID13: 0x1 .... .1.. = STA AID13: 0x2 Lachlan Hodges (2): wifi: mac80211: support encoding S1G TIM PVB wifi: mac80211: support parsing S1G TIM PVB drivers/net/wireless/ath/carl9170/rx.c | 2 +- drivers/net/wireless/intersil/p54/txrx.c | 2 +- .../net/wireless/ralink/rt2x00/rt2x00dev.c | 2 +- drivers/net/wireless/realtek/rtlwifi/ps.c | 2 +- include/linux/ieee80211.h | 110 ++++++++++- net/mac80211/mesh_ps.c | 2 +- net/mac80211/mlme.c | 15 +- net/mac80211/tx.c | 173 ++++++++++++++---- 8 files changed, 257 insertions(+), 51 deletions(-) -- 2.43.0