wlan_p2p_cfg.c 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. /*
  2. * Copyright (c) 2018-2020 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: This file contains p2p configures interface definitions
  20. */
  21. #include <wlan_objmgr_psoc_obj.h>
  22. #include "wlan_p2p_public_struct.h"
  23. #include "wlan_p2p_cfg_api.h"
  24. #include "../../core/src/wlan_p2p_main.h"
  25. #include "wlan_mlme_ucfg_api.h"
  26. static inline struct p2p_soc_priv_obj *
  27. wlan_psoc_get_p2p_object(struct wlan_objmgr_psoc *psoc)
  28. {
  29. return wlan_objmgr_psoc_get_comp_private_obj(psoc,
  30. WLAN_UMAC_COMP_P2P);
  31. }
  32. QDF_STATUS
  33. cfg_p2p_get_go_keepalive_period(struct wlan_objmgr_psoc *psoc,
  34. uint32_t *period)
  35. {
  36. struct p2p_soc_priv_obj *p2p_soc_obj;
  37. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  38. if (!p2p_soc_obj) {
  39. *period = 0;
  40. p2p_err("p2p psoc null");
  41. return QDF_STATUS_E_INVAL;
  42. }
  43. *period = p2p_soc_obj->param.go_keepalive_period;
  44. return QDF_STATUS_SUCCESS;
  45. }
  46. QDF_STATUS
  47. cfg_p2p_get_go_link_monitor_period(struct wlan_objmgr_psoc *psoc,
  48. uint32_t *period)
  49. {
  50. struct p2p_soc_priv_obj *p2p_soc_obj;
  51. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  52. if (!p2p_soc_obj) {
  53. *period = 0;
  54. p2p_err("p2p psoc null");
  55. return QDF_STATUS_E_INVAL;
  56. }
  57. *period = p2p_soc_obj->param.go_link_monitor_period;
  58. return QDF_STATUS_SUCCESS;
  59. }
  60. QDF_STATUS
  61. cfg_p2p_get_device_addr_admin(struct wlan_objmgr_psoc *psoc,
  62. bool *enable)
  63. {
  64. struct p2p_soc_priv_obj *p2p_soc_obj;
  65. p2p_soc_obj = wlan_psoc_get_p2p_object(psoc);
  66. if (!p2p_soc_obj) {
  67. *enable = false;
  68. p2p_err("p2p psoc null");
  69. return QDF_STATUS_E_INVAL;
  70. }
  71. *enable = p2p_soc_obj->param.p2p_device_addr_admin;
  72. return QDF_STATUS_SUCCESS;
  73. }
  74. bool cfg_p2p_is_roam_config_disabled(struct wlan_objmgr_psoc *psoc)
  75. {
  76. uint32_t sta_roam_disable = 0;
  77. if (ucfg_mlme_get_roam_disable_config(psoc, &sta_roam_disable) ==
  78. QDF_STATUS_SUCCESS)
  79. return sta_roam_disable & LFR3_STA_ROAM_DISABLE_BY_P2P;
  80. return false;
  81. }