cfg_nan.c 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /*
  2. * Copyright (c) 2018 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: contains NAN INI configurations
  20. */
  21. #include "wlan_objmgr_psoc_obj.h"
  22. #include "cfg_nan_api.h"
  23. #include "../../core/src/nan_main_i.h"
  24. static inline struct nan_psoc_priv_obj
  25. *cfg_nan_get_priv_obj(struct wlan_objmgr_psoc *psoc)
  26. {
  27. if (!psoc) {
  28. nan_err("PSOC obj null");
  29. return NULL;
  30. }
  31. return wlan_objmgr_psoc_get_comp_private_obj(psoc, WLAN_UMAC_COMP_NAN);
  32. }
  33. bool cfg_nan_get_enable(struct wlan_objmgr_psoc *psoc)
  34. {
  35. struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
  36. if (!nan_obj) {
  37. nan_err("NAN obj null");
  38. return false;
  39. }
  40. return nan_obj->cfg_param.enable;
  41. }
  42. bool cfg_nan_get_datapath_enable(struct wlan_objmgr_psoc *psoc)
  43. {
  44. struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
  45. if (!nan_obj) {
  46. nan_err("NAN obj null");
  47. return false;
  48. }
  49. return nan_obj->cfg_param.dp_enable;
  50. }
  51. uint32_t cfg_nan_get_ndi_channel(struct wlan_objmgr_psoc *psoc)
  52. {
  53. struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
  54. if (!nan_obj) {
  55. nan_err("NAN obj null");
  56. return 0;
  57. }
  58. return nan_obj->cfg_param.ndi_ch;
  59. }
  60. bool cfg_nan_get_ndi_mac_randomize(struct wlan_objmgr_psoc *psoc)
  61. {
  62. struct nan_psoc_priv_obj *nan_obj = cfg_nan_get_priv_obj(psoc);
  63. if (!nan_obj) {
  64. nan_err("NAN obj null");
  65. return false;
  66. }
  67. return nan_obj->cfg_param.ndi_mac_randomize;
  68. }