wlan_pmo_tgt_lphb.c 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. /*
  2. * Copyright (c) 2017 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for
  5. * any purpose with or without fee is hereby granted, provided that the
  6. * above copyright notice and this permission notice appear in all
  7. * copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  10. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  11. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  12. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  13. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  14. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  15. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  16. * PERFORMANCE OF THIS SOFTWARE.
  17. */
  18. /**
  19. * DOC: Implements public API for pmo low power hear beat feature
  20. * to interact with target/WMI.
  21. */
  22. #include "wlan_pmo_tgt_api.h"
  23. #include "wlan_pmo_lphb_public_struct.h"
  24. #include "wlan_pmo_obj_mgmt_public_struct.h"
  25. QDF_STATUS pmo_tgt_send_lphb_enable(struct wlan_objmgr_psoc *psoc,
  26. struct pmo_lphb_enable_req *ts_lphb_enable)
  27. {
  28. QDF_STATUS status;
  29. struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
  30. PMO_ENTER();
  31. pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
  32. if (!pmo_tx_ops.send_lphb_enable) {
  33. pmo_err("send_lphb_enable is null");
  34. status = QDF_STATUS_E_NULL_VALUE;
  35. goto out;
  36. }
  37. status = pmo_tx_ops.send_lphb_enable(psoc, ts_lphb_enable);
  38. if (status != QDF_STATUS_SUCCESS)
  39. pmo_err("Failed to send lphb enable");
  40. out:
  41. PMO_EXIT();
  42. return status;
  43. }
  44. QDF_STATUS pmo_tgt_send_lphb_tcp_params(struct wlan_objmgr_psoc *psoc,
  45. struct pmo_lphb_tcp_params *ts_lphb_tcp_param)
  46. {
  47. QDF_STATUS status;
  48. struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
  49. PMO_ENTER();
  50. pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
  51. if (!pmo_tx_ops.send_lphb_tcp_params) {
  52. pmo_err("send_lphb_tcp_params is null");
  53. status = QDF_STATUS_E_NULL_VALUE;
  54. goto out;
  55. }
  56. status = pmo_tx_ops.send_lphb_tcp_params(psoc, ts_lphb_tcp_param);
  57. if (status != QDF_STATUS_SUCCESS)
  58. pmo_err("Failed to send lphb tcp params");
  59. out:
  60. PMO_EXIT();
  61. return status;
  62. }
  63. QDF_STATUS pmo_tgt_send_lphb_tcp_pkt_filter(struct wlan_objmgr_psoc *psoc,
  64. struct pmo_lphb_tcp_filter_req *ts_lphb_tcp_filter)
  65. {
  66. QDF_STATUS status;
  67. struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
  68. PMO_ENTER();
  69. pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
  70. if (!pmo_tx_ops.send_lphb_tcp_filter_req) {
  71. pmo_err("send_lphb_tcp_filter_req is null");
  72. status = QDF_STATUS_E_NULL_VALUE;
  73. goto out;
  74. }
  75. status = pmo_tx_ops.send_lphb_tcp_filter_req(psoc, ts_lphb_tcp_filter);
  76. if (status != QDF_STATUS_SUCCESS)
  77. pmo_err("Failed to send lphb tcp filter req");
  78. out:
  79. PMO_EXIT();
  80. return status;
  81. }
  82. QDF_STATUS pmo_tgt_send_lphb_udp_params(struct wlan_objmgr_psoc *psoc,
  83. struct pmo_lphb_udp_params *ts_lphb_udp_param)
  84. {
  85. QDF_STATUS status;
  86. struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
  87. PMO_ENTER();
  88. pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
  89. if (!pmo_tx_ops.send_lphb_upd_params) {
  90. pmo_err("send_lphb_upd_params is null");
  91. status = QDF_STATUS_E_NULL_VALUE;
  92. goto out;
  93. }
  94. status = pmo_tx_ops.send_lphb_upd_params(psoc, ts_lphb_udp_param);
  95. if (status != QDF_STATUS_SUCCESS)
  96. pmo_err("Failed to send lphb udp param");
  97. out:
  98. PMO_EXIT();
  99. return status;
  100. }
  101. QDF_STATUS pmo_tgt_send_lphb_udp_pkt_filter(struct wlan_objmgr_psoc *psoc,
  102. struct pmo_lphb_udp_filter_req *ts_lphb_udp_filter)
  103. {
  104. QDF_STATUS status;
  105. struct wlan_lmac_if_pmo_tx_ops pmo_tx_ops;
  106. PMO_ENTER();
  107. pmo_tx_ops = GET_PMO_TX_OPS_FROM_PSOC(psoc);
  108. if (!pmo_tx_ops.send_lphb_udp_filter_req) {
  109. pmo_err("send_lphb_udp_filter_req is null");
  110. status = QDF_STATUS_E_NULL_VALUE;
  111. goto out;
  112. }
  113. status = pmo_tx_ops.send_lphb_udp_filter_req(psoc, ts_lphb_udp_filter);
  114. if (status != QDF_STATUS_SUCCESS)
  115. pmo_err("Failed to send lphb udp filter req");
  116. out:
  117. PMO_EXIT();
  118. return status;
  119. }
  120. QDF_STATUS pmo_tgt_lphb_rsp_evt(struct wlan_objmgr_psoc *psoc,
  121. struct pmo_lphb_rsp *rsp_param)
  122. {
  123. struct pmo_psoc_priv_obj *psoc_ctx;
  124. psoc_ctx = pmo_psoc_get_priv(psoc);
  125. if (psoc_ctx->wow.lphb_cb && psoc_ctx->wow.lphb_cb_ctx) {
  126. pmo_info("callback:%p context:%p psoc:%p",
  127. psoc_ctx->wow.lphb_cb, psoc_ctx->wow.lphb_cb_ctx, psoc);
  128. psoc_ctx->wow.lphb_cb(psoc_ctx->wow.lphb_cb_ctx, rsp_param);
  129. } else {
  130. pmo_err("lphb rsp callback/context is null for psoc %p",
  131. psoc);
  132. }
  133. return QDF_STATUS_SUCCESS;
  134. }