]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
wifi: rtw89: open C2H event waiting window first before sending H2C command
authorZong-Zhe Yang <kevin_yang@realtek.com>
Mon, 15 Sep 2025 06:53:52 +0000 (14:53 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Thu, 18 Sep 2025 01:18:37 +0000 (09:18 +0800)
commita27136f1050a653f8d267d6b906880186b695d70
treea5aad22ec2d7c180b56600b2296c8dfe1db93db4
parentbc2a5a12fa6259e190c7edb03e63b28ab480101b
wifi: rtw89: open C2H event waiting window first before sending H2C command

Some H2C commands need to wait for target C2H events to confirm they
are executed well. The characteristics of a target C2H event will be
encoded into a value, called condition. Then, the corresponding H2C
command will wait for it. And, C2H events will complete a condition
according to their own characteristics. So, when conditions of both
side match, the corresponding H2C command will be completed.

Originally, condition waiting window is opened after the H2C command
is sent. However, for CPU-bound systems, target C2H event might be
already done before the H2C command opens condition waiting window.
Without that, C2H event won't match condition, and it will complete
nothing. Finally, H2C command wait will time out.

Hence, now open condition waiting window first for H2C commands which
need to wait for target C2H events. The waiting function is split to
two parts, prepare and evaluate. And, waiting side becomes the below
where prepare part and evaluate part must be a pair.

    waiting prepare: condition
        (open condition waiting window)

        Do the needed things to trigger completing side.
        Record errors that will cause no real completer.

    waiting evaluate: prepare, errors
        (start waiting for completion if things are fine;
         otherwise, clean up and return final result.)

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250915065352.39082-1-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.c
drivers/net/wireless/realtek/rtw89/core.h
drivers/net/wireless/realtek/rtw89/fw.c