335-v4.20-0002-brcmfmac-fix-full-timeout-waiting-for-action-frame-o.patch 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. From fbf07000960d9c8a13fdc17c6de0230d681c7543 Mon Sep 17 00:00:00 2001
  2. From: Chung-Hsien Hsu <stanley.hsu@cypress.com>
  3. Date: Thu, 27 Sep 2018 14:59:49 +0000
  4. Subject: [PATCH] brcmfmac: fix full timeout waiting for action frame
  5. on-channel tx
  6. The driver sends an action frame down and waits for a completion signal
  7. triggered by the received BRCMF_E_ACTION_FRAME_OFF_CHAN_COMPLETE event
  8. to continue the process. However, the action frame could be transmitted
  9. either on the current channel or on an off channel. For the on-channel
  10. case, only BRCMF_E_ACTION_FRAME_COMPLETE event will be received when
  11. the frame is transmitted, which make the driver always wait a full
  12. timeout duration. This patch has the completion signal be triggered by
  13. receiving the BRCMF_E_ACTION_FRAME_COMPLETE event for the on-channel
  14. case.
  15. This change fixes WFA p2p certification 5.1.19 failure.
  16. Signed-off-by: Chung-Hsien Hsu <stanley.hsu@cypress.com>
  17. Signed-off-by: Chi-Hsien Lin <chi-hsien.lin@cypress.com>
  18. Signed-off-by: Kalle Valo <kvalo@codeaurora.org>
  19. ---
  20. drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c | 17 +++++++++++++++--
  21. drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h | 2 ++
  22. 2 files changed, 17 insertions(+), 2 deletions(-)
  23. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  24. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.c
  25. @@ -1464,10 +1464,12 @@ int brcmf_p2p_notify_action_tx_complete(
  26. return 0;
  27. if (e->event_code == BRCMF_E_ACTION_FRAME_COMPLETE) {
  28. - if (e->status == BRCMF_E_STATUS_SUCCESS)
  29. + if (e->status == BRCMF_E_STATUS_SUCCESS) {
  30. set_bit(BRCMF_P2P_STATUS_ACTION_TX_COMPLETED,
  31. &p2p->status);
  32. - else {
  33. + if (!p2p->wait_for_offchan_complete)
  34. + complete(&p2p->send_af_done);
  35. + } else {
  36. set_bit(BRCMF_P2P_STATUS_ACTION_TX_NOACK, &p2p->status);
  37. /* If there is no ack, we don't need to wait for
  38. * WLC_E_ACTION_FRAME_OFFCHAN_COMPLETE event
  39. @@ -1518,6 +1520,17 @@ static s32 brcmf_p2p_tx_action_frame(str
  40. p2p->af_sent_channel = le32_to_cpu(af_params->channel);
  41. p2p->af_tx_sent_jiffies = jiffies;
  42. + if (test_bit(BRCMF_P2P_STATUS_DISCOVER_LISTEN, &p2p->status) &&
  43. + p2p->af_sent_channel ==
  44. + ieee80211_frequency_to_channel(p2p->remain_on_channel.center_freq))
  45. + p2p->wait_for_offchan_complete = false;
  46. + else
  47. + p2p->wait_for_offchan_complete = true;
  48. +
  49. + brcmf_dbg(TRACE, "Waiting for %s tx completion event\n",
  50. + (p2p->wait_for_offchan_complete) ?
  51. + "off-channel" : "on-channel");
  52. +
  53. timeout = wait_for_completion_timeout(&p2p->send_af_done,
  54. P2P_AF_MAX_WAIT_TIME);
  55. --- a/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  56. +++ b/drivers/net/wireless/broadcom/brcm80211/brcmfmac/p2p.h
  57. @@ -124,6 +124,7 @@ struct afx_hdl {
  58. * @gon_req_action: about to send go negotiation requets frame.
  59. * @block_gon_req_tx: drop tx go negotiation requets frame.
  60. * @p2pdev_dynamically: is p2p device if created by module param or supplicant.
  61. + * @wait_for_offchan_complete: wait for off-channel tx completion event.
  62. */
  63. struct brcmf_p2p_info {
  64. struct brcmf_cfg80211_info *cfg;
  65. @@ -144,6 +145,7 @@ struct brcmf_p2p_info {
  66. bool gon_req_action;
  67. bool block_gon_req_tx;
  68. bool p2pdev_dynamically;
  69. + bool wait_for_offchan_complete;
  70. };
  71. s32 brcmf_p2p_attach(struct brcmf_cfg80211_info *cfg, bool p2pdev_forced);