wlan_p2p_cfg.c 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115
  1. /*
  2. * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2024 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for
  6. * any purpose with or without fee is hereby granted, provided that the
  7. * above copyright notice and this permission notice appear in all
  8. * copies.
  9. *
  10. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  11. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  12. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  13. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  14. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  15. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  16. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  17. * PERFORMANCE OF THIS SOFTWARE.
  18. */
  19. /**
  20. * DOC: This file contains p2p configures interface definitions
  21. */
  22. #include <wlan_objmgr_psoc_obj.h>
  23. #include "wlan_p2p_public_struct.h"
  24. #include "wlan_p2p_cfg_api.h"
  25. #include "../../core/src/wlan_p2p_main.h"
  26. #include "wlan_mlme_ucfg_api.h"
  27. static inline struct p2p_soc_priv_obj *
  28. wlan_psoc_get_p2p_object(struct wlan_objmgr_psoc *psoc)
  29. {
  30. return wlan_objmgr_psoc_get_comp_private_obj(psoc,
  31. WLAN_UMAC_COMP_P2P);
  32. }
  33. QDF_STATUS
  34. cfg_p2p_get_go_keepalive_period(struct wlan_objmgr_psoc *psoc,
  35. uint32_t *period)
  36. {
  37. struct p2p_soc_priv_obj *p2p_soc_obj;
  38. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  39. if (!p2p_soc_obj) {
  40. *period = 0;
  41. p2p_err("p2p psoc null");
  42. return QDF_STATUS_E_INVAL;
  43. }
  44. *period = p2p_soc_obj->param.go_keepalive_period;
  45. return QDF_STATUS_SUCCESS;
  46. }
  47. QDF_STATUS
  48. cfg_p2p_get_go_link_monitor_period(struct wlan_objmgr_psoc *psoc,
  49. uint32_t *period)
  50. {
  51. struct p2p_soc_priv_obj *p2p_soc_obj;
  52. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  53. if (!p2p_soc_obj) {
  54. *period = 0;
  55. p2p_err("p2p psoc null");
  56. return QDF_STATUS_E_INVAL;
  57. }
  58. *period = p2p_soc_obj->param.go_link_monitor_period;
  59. return QDF_STATUS_SUCCESS;
  60. }
  61. QDF_STATUS
  62. cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc *psoc,
  63. bool *enable)
  64. {
  65. struct p2p_soc_priv_obj *p2p_soc_obj;
  66. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  67. if (!p2p_soc_obj) {
  68. *enable = false;
  69. p2p_err("p2p psoc null");
  70. return QDF_STATUS_E_INVAL;
  71. }
  72. *enable = p2p_soc_obj->param.p2p_device_addr_admin;
  73. return QDF_STATUS_SUCCESS;
  74. }
  75. bool cfg_p2p_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc)
  76. {
  77. uint32_t sta_roam_disable = 0;
  78. if (ucfg_mlme_get_roam_disable_config(psoc, &sta_roam_disable) ==
  79. QDF_STATUS_SUCCESS)
  80. return sta_roam_disable & LFR3_STA_ROAM_DISABLE_BY_P2P;
  81. return false;
  82. }
  83. bool
  84. cfg_p2p_is_go_ignore_non_p2p_probe_req(struct wlan_objmgr_psoc *psoc)
  85. {
  86. struct p2p_soc_priv_obj *p2p_soc_obj;
  87. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  88. if (!p2p_soc_obj) {
  89. p2p_err("p2p psoc null");
  90. return false;
  91. }
  92. return p2p_soc_obj->param.go_ignore_non_p2p_probe_req;
  93. }