wifi: rtw89: release bit in rtw89_fw_h2c_del_pkt_offload()
Ping-Ke Shih
maintainerPATCH 1/5 wifi: rtw89: release bit in rtw89_fw_h2c_del_pkt_offload()
From: Zong-Zhe Yang <[email protected]>
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().
--- drivers/net/wireless/realtek/rtw89/fw.c | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-)
drivers/net/wireless/realtek/rtw89/fw.c +3 -4
@@ -997,8 +997,8 @@ void rtw89_fw_release_general_pkt_list_vif(struct rtw89_dev *rtwdev,list_for_each_entry_safe (info, tmp, pkt_list, list) {if (notify_fw)rtw89_fw_h2c_del_pkt_offload (rtwdev, info->id); -rtw89_core_release_bit_map (rtwdev->pkt_offload, - info->id); +else +rtw89_core_release_bit_map (rtwdev->pkt_offload, info->id);list_del (&info->list);kfree (info); }
@@ -2466,6 +2466,7 @@ int rtw89_fw_h2c_del_pkt_offload(struct rtw89_dev *rtwdev, u8 id) goto fail; } +rtw89_core_release_bit_map (rtwdev->pkt_offload, id);return 0 ; fail:dev_kfree_skb_any (skb);
@@ -3020,8 +3021,6 @@ static void rtw89_release_pkt_list(struct rtw89_dev *rtwdev)list_for_each_entry_safe (info, tmp, &pkt_list[idx], list) {rtw89_fw_h2c_del_pkt_offload (rtwdev, info->id); -rtw89_core_release_bit_map (rtwdev->pkt_offload, - info->id);list_del (&info->list);kfree (info); }
Signature · 1 line
2.25.1
Quoted 20 lines · Ping-Ke Shih
From: Zong-Zhe Yang <[email protected]>
We have a pair of FW functions,
rtw89_fw_h2c_add_pkt_offload()andrtw89_fw_h2c_del_pkt_offload(). Thertw89_fw_h2c_add_pkt_offload()acquires the bit itself, but the bit needs to be released by the caller ofrtw89_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 intortw89_fw_h2c_del_pkt_offload().In general, driver will call
rtw89_fw_h2c_add_pkt_offload()andrtw89_fw_h2c_del_pkt_offload(), and then, SW bitmap can align with FW one. There is one exception whennotify_fwis false. It happens when driver detects FW problems and is going to reset FW. Only in this case, driver needs to release bits outsidertw89_fw_h2c_del_pkt_offload().
Quoted 2 lines
Signed-off-by Zong-Zhe Yang <[email protected]>Signed-off-by Ping-Ke Shih <[email protected]>
5 patches applied to wireless-next.git, thanks.
25a7e5072ef1 wifi: rtw89: release bit in rtw89_fw_h2c_del_pkt_offload() 3ea1cd8d027f wifi: rtw89: refine packet offload delete flow of 6 GHz probe 8febd68be526 wifi: rtw89: packet offload wait for FW response 32bb12eb73dc wifi: rtw89: mac: handle C2H receive/done ACK in interrupt context b9b632f43f1c wifi: rtw89: scan offload wait for FW done ACK
Signature · 3 lines
https://patchwork.kernel.org/project/linux-wireless/patch/[email protected]/ https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches