target_if_son.c 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. /*
  2. * Copyright (c) 2017-2020 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. *
  6. * Permission to use, copy, modify, and/or distribute this software for
  7. * any purpose with or without fee is hereby granted, provided that the
  8. * above copyright notice and this permission notice appear in all
  9. * copies.
  10. *
  11. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  12. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  13. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  14. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  15. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  16. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  17. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  18. * PERFORMANCE OF THIS SOFTWARE.
  19. */
  20. #include <target_if_son.h>
  21. #include <target_if.h>
  22. #include <wlan_lmac_if_def.h>
  23. #include <wmi_unified_api.h>
  24. #include <cdp_txrx_ctrl.h>
  25. #if defined(QCA_SUPPORT_SON)
  26. u_int32_t son_ol_get_peer_rate(struct wlan_objmgr_peer *peer, u_int8_t type)
  27. {
  28. return ol_if_peer_get_rate(peer, type);
  29. }
  30. #else
  31. u_int32_t son_ol_get_peer_rate(struct wlan_objmgr_peer *peer, u_int8_t type)
  32. {
  33. return 0;
  34. }
  35. #endif
  36. #if defined(QCA_SUPPORT_SON) || defined(WLAN_FEATURE_SON)
  37. QDF_STATUS son_ol_send_null(struct wlan_objmgr_pdev *pdev,
  38. u_int8_t *macaddr,
  39. struct wlan_objmgr_vdev *vdev)
  40. {
  41. struct stats_request_params param = {0};
  42. struct wlan_objmgr_psoc *psoc = NULL;
  43. wmi_unified_t wmi_handle;
  44. psoc = wlan_pdev_get_psoc(pdev);
  45. if (!psoc)
  46. return QDF_STATUS_E_FAILURE;
  47. param.vdev_id = wlan_vdev_get_id(vdev);
  48. param.stats_id = WMI_HOST_REQUEST_INST_STAT;
  49. wmi_handle = get_wmi_unified_hdl_from_psoc(psoc);
  50. if (!wmi_handle)
  51. return QDF_STATUS_E_FAILURE;
  52. return wmi_unified_stats_request_send(wmi_handle, macaddr, &param);
  53. }
  54. #if defined(WMI_NON_TLV_SUPPORT) || defined(WMI_TLV_AND_NON_TLV_SUPPORT)
  55. QDF_STATUS son_ol_peer_ext_stats_enable(struct wlan_objmgr_pdev *pdev,
  56. uint8_t *peer_addr,
  57. struct wlan_objmgr_vdev *vdev,
  58. uint32_t stats_count, uint32_t enable)
  59. {
  60. struct peer_set_params param = {0};
  61. struct wlan_objmgr_psoc *psoc = NULL;
  62. struct target_psoc_info *tgt_hdl;
  63. target_resource_config *tgt_cfg;
  64. wmi_unified_t wmi_handle;
  65. psoc = wlan_pdev_get_psoc(pdev);
  66. if (!psoc)
  67. return QDF_STATUS_E_INVAL;
  68. tgt_hdl = wlan_psoc_get_tgt_if_handle(psoc);
  69. if (!tgt_hdl)
  70. return QDF_STATUS_E_INVAL;
  71. tgt_cfg = target_psoc_get_wlan_res_cfg(tgt_hdl);
  72. if (!tgt_cfg)
  73. return QDF_STATUS_E_INVAL;
  74. if (enable && stats_count >= tgt_cfg->max_peer_ext_stats)
  75. return QDF_STATUS_E_NOMEM;
  76. wmi_handle = get_wmi_unified_hdl_from_pdev(pdev);
  77. if (!wmi_handle)
  78. return QDF_STATUS_E_INVAL;
  79. param.param_id = WMI_HOST_PEER_EXT_STATS_ENABLE;
  80. param.vdev_id = wlan_vdev_get_id(vdev);
  81. param.param_value = enable;
  82. return wmi_set_peer_param_send(wmi_handle, peer_addr, &param);
  83. }
  84. #endif
  85. void target_if_son_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
  86. {
  87. /* wlan son related function handler */
  88. tx_ops->son_tx_ops.son_send_null = son_ol_send_null;
  89. tx_ops->son_tx_ops.get_peer_rate = son_ol_get_peer_rate;
  90. tx_ops->son_tx_ops.peer_ext_stats_enable = son_ol_peer_ext_stats_enable;
  91. return;
  92. }
  93. #else
  94. void target_if_son_register_tx_ops(struct wlan_lmac_if_tx_ops *tx_ops)
  95. {
  96. return;
  97. }
  98. QDF_STATUS son_ol_send_null(struct wlan_objmgr_pdev *pdev,
  99. u_int8_t *macaddr,
  100. struct wlan_objmgr_vdev *vdev)
  101. {
  102. return QDF_STATUS_SUCCESS;
  103. }
  104. #endif