wifi: mac80211: add some support for RX OMI power saving

In order to save power, it can be desirable to change the
RX operating mode using OMI to reduce the bandwidth. As the
handshake must be done in the HTC+ field, it cannot be done
by mac80211 directly, so expose functions to the driver to
request and finalize the necessary updates.

Note that RX OMI really only changes what the peer (AP) will
transmit to us, but in order to use it to actually save some
power (by reducing the listen bandwidth) we also update rate
scaling and then the channel context's mindef accordingly.

The updates are split into two in order to sequence them
correctly, when reducing bandwidth first reduce the rate
scaling and thus TX, then send OMI, then reduce the listen
bandwidth (chandef); when increasing bandwidth this is the
other way around. This also requires tracking in different
variables which part is applicable already.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250101070249.2c1a1934bd73.I4e90fd503504e37f9eac5bdae62e3f07e7071275@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
Johannes Berg
2025-01-01 07:05:21 +02:00
parent 1b8e2e7fc0
commit da7f40c05c
7 changed files with 323 additions and 5 deletions

View File

@@ -2340,6 +2340,8 @@ enum ieee80211_sta_rx_bandwidth {
IEEE80211_STA_RX_BW_320,
};
#define IEEE80211_STA_RX_BW_MAX IEEE80211_STA_RX_BW_320
/**
* struct ieee80211_sta_rates - station rate selection table
*
@@ -7738,6 +7740,50 @@ ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width)
}
}
/**
* ieee80211_prepare_rx_omi_bw - prepare for sending BW RX OMI
* @link_sta: the link STA the OMI is going to be sent to
* @bw: the bandwidth requested
*
* When the driver decides to do RX OMI to change bandwidth with a STA
* it calls this function to prepare, then sends the OMI, and finally
* calls ieee80211_finalize_rx_omi_bw().
*
* Note that the (link) STA rate control is updated accordingly as well,
* but the chanctx might not be updated if there are other users.
* If the intention is to reduce the listen bandwidth, the driver must
* ensure there are no TDLS stations nor other uses of the chanctx.
*
* Also note that in order to sequence correctly, narrowing bandwidth
* will only happen in ieee80211_finalize_rx_omi_bw(), whereas widening
* again (e.g. going back to normal) will happen here.
*
* Note that we treat this symmetrically, so if the driver calls this
* and tells the peer to only send with a lower bandwidth, we assume
* that the driver also wants to only send at that lower bandwidth, to
* allow narrowing of the chanctx request for this station/interface.
*
* Finally, the driver must ensure that if the function returned %true,
* ieee80211_finalize_rx_omi_bw() is also called, even for example in
* case of HW restart.
*
* Context: Must be called with wiphy mutex held, and will call back
* into the driver, so ensure no driver locks are held.
*
* Return: %true if changes are going to be made, %false otherwise
*/
bool ieee80211_prepare_rx_omi_bw(struct ieee80211_link_sta *link_sta,
enum ieee80211_sta_rx_bandwidth bw);
/**
* ieee80211_finalize_rx_omi_bw - finalize BW RX OMI update
* @link_sta: the link STA the OMI was sent to
*
* See ieee80211_client_prepare_rx_omi_bw(). Context is the same here
* as well.
*/
void ieee80211_finalize_rx_omi_bw(struct ieee80211_link_sta *link_sta);
/* for older drivers - let's not document these ... */
int ieee80211_emulate_add_chanctx(struct ieee80211_hw *hw,
struct ieee80211_chanctx_conf *ctx);