wifi: rtw89: release bit in rtw89_fw_h2c_del_pkt_offload()
authorZong-Zhe Yang <kevin_yang@realtek.com>
Wed, 19 Apr 2023 11:45:51 +0000 (11:45 +0000)
committerKalle Valo <kvalo@kernel.org>
Fri, 5 May 2023 11:59:32 +0000 (14:59 +0300)
commit25a7e5072ef1901e671e6f39df40b5028b241804
treee3ae4134a3d87906f20956ad10d5f837447a459d
parent5feecb40e735b7cb4173328fabfc49ddc2b3b1bc
wifi: rtw89: release bit in rtw89_fw_h2c_del_pkt_offload()

We have a pair of FW functions, rtw89_fw_h2c_add_pkt_offload() and
rtw89_fw_h2c_del_pkt_offload(). The rtw89_fw_h2c_add_pkt_offload()
acquires the bit itself, but the bit needs to be released by the
caller of rtw89_fw_h2c_del_pkt_offload(). This looks asymmetrical
and is not friendly to callers.

Second, if callers always releases the bits, it might make driver
unaligned to bitmap status of FW after some failures of calling
rtw89_fw_h2c_del_pkt_offload(). So, this commit move bit release
into rtw89_fw_h2c_del_pkt_offload().

In general, driver will call rtw89_fw_h2c_add_pkt_offload() and
rtw89_fw_h2c_del_pkt_offload(), and then, SW bitmap can align
with FW one. There is one exception when notify_fw is false.
It happens when driver detects FW problems and is going to
reset FW. Only in this case, driver needs to release bits
outside rtw89_fw_h2c_del_pkt_offload().

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Kalle Valo <kvalo@kernel.org>
Link: https://lore.kernel.org/r/8cf5d45c5b04e7b680d4eb9dda62056cdce14cec.camel@realtek.com
drivers/net/wireless/realtek/rtw89/fw.c