diff options
author | Sungjoon Park <sungjoon.park@broadcom.corp-partner.google.com> | 2023-09-06 21:08:32 +0900 |
---|---|---|
committer | Isaac Chiou <isaacchiou@google.com> | 2023-09-18 11:11:31 +0000 |
commit | aa13c699889241b213a9e1f503293b29497fed90 (patch) | |
tree | 0d46fd4ad3ca16b3269c19a66395b31191447947 | |
parent | a65b5be81a9acb5eb514f8b7272f940d53d74ca4 (diff) | |
download | bcm4389-aa13c699889241b213a9e1f503293b29497fed90.tar.gz |
bcmdhd: Check for send_mb_data function return value before calling wait for d3ack timeout function
Even though send mailbox data has failed, wait for d3 ack timeout function is called.
Instead check for send_mbdata return value and wait for d3 ack timeout.
Like as Google pointed out, we didn't check the dhdpcie_send_mb_data return before we wait the D3 ack.
In the shared log, it shows that dhdpcie_send_mb_data is failed due to Link down but it wait D3 ack and 5sec timeout has occurred.
[12781.871037][ T1607] [16:03:00.681649][dhd][wlan]dhdpcie_send_mb_data: PCIe link was down
[12781.871068][ T1607] [16:03:00.681683][dhd][wlan]Failed: deassert Inband device_wake
[12781.871091][ T1607] [16:03:00.681706][dhd][wlan]dhdpcie_send_mb_data: PCIe link was down
...
[12786.045799][ T1607] [16:03:04.856414][dhd][wlan]dhdpcie_bus_suspend: resumed on timeout for D3 ACK d3_inform_cnt 0
So, if "dhdpcie_send_mb_data(bus, H2D_HOST_D3_INFORM);" is failed, then we don't need to wait for D3 ACK and skip the dhd_os_d3ack_wait for this case.
Bug: 294195335
Test: Verified in BRCM internal test
Test: Regression test
Change-Id: I3251f491375d0ad39645fb2c3801bab13687f956
Signed-off-by: Sungjoon Park <sungjoon.park@broadcom.corp-partner.google.com>
-rw-r--r-- | dhd_pcie.c | 14 |
1 files changed, 8 insertions, 6 deletions
@@ -9314,8 +9314,8 @@ dhdpcie_bus_suspend(struct dhd_bus *bus, bool state, bool byint) dhdpcie_bus_suspend(struct dhd_bus *bus, bool state) #endif /* DHD_PCIE_NATIVE_RUNTIMEPM */ { - int timeleft; - int rc = 0; + int timeleft = 0; + int rc = 0, ret = BCME_OK; unsigned long flags; #ifdef DHD_PCIE_NATIVE_RUNTIMEPM int d3_read_retry = 0; @@ -9469,17 +9469,19 @@ dhdpcie_bus_suspend(struct dhd_bus *bus, bool state) #ifdef PCIE_INB_DW if (INBAND_DW_ENAB(bus)) { DHD_BUS_INB_DW_LOCK(bus->inb_lock, flags); - dhdpcie_send_mb_data(bus, H2D_HOST_D3_INFORM); + ret = dhdpcie_send_mb_data(bus, H2D_HOST_D3_INFORM); DHD_BUS_INB_DW_UNLOCK(bus->inb_lock, flags); } else #endif /* PCIE_INB_DW */ { - dhdpcie_send_mb_data(bus, H2D_HOST_D3_INFORM); + ret = dhdpcie_send_mb_data(bus, H2D_HOST_D3_INFORM); } - /* Wait for D3 ACK for D3_ACK_RESP_TIMEOUT seconds */ + if (!bus->is_linkdown && ret == BCME_OK) { + /* Wait for D3 ACK for D3_ACK_RESP_TIMEOUT seconds */ + timeleft = dhd_os_d3ack_wait(bus->dhd, &bus->wait_for_d3_ack); + } - timeleft = dhd_os_d3ack_wait(bus->dhd, &bus->wait_for_d3_ack); #ifdef DHD_RECOVER_TIMEOUT /* XXX: WAR for missing D3 ACK MB interrupt */ if (bus->wait_for_d3_ack == 0) { |