osif_sync.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2022 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: Operating System Interface, Synchronization (osif_sync)
  21. *
  22. * osif_sync is a collection of APIs for synchronizing and safely interacting
  23. * with external processes/threads via various operating system interfaces. It
  24. * relies heavily on the Driver Synchronization Core, which defines the
  25. * synchronization primitives and behavior.
  26. *
  27. * While DSC is great at doing the required synchronization, it (by design) does
  28. * not address the gap between receiving a callback and involing the appropriate
  29. * DSC protections. For example, given an input net_device pointer from the
  30. * kernel, how does one safely acquire the appropriate DSC context? osif_sync
  31. * implements this logic via wrapping DSC APIs with a registration mechanism.
  32. *
  33. * For example, after the creation of a new dsc_vdev context, osif_sync allows
  34. * it to be registered with a specific net_device pointer as a key. Future
  35. * operations against this net_device can use this pointer to atomically lookup
  36. * the DSC context, and start either a DSC transition or DSC operation. If this
  37. * is successful, the operation continues and is guaranteed protected from major
  38. * state changes. Otherwise, the operation attempt is rejected.
  39. *
  40. * See also: wlan_dsc.h
  41. */
  42. #ifndef __OSIF_SYNC_H
  43. #define __OSIF_SYNC_H
  44. #include "osif_driver_sync.h"
  45. #include "osif_psoc_sync.h"
  46. #include "osif_vdev_sync.h"
  47. /**
  48. * osif_sync_init() - global initializer
  49. *
  50. * Return: None
  51. */
  52. void osif_sync_init(void);
  53. /**
  54. * osif_sync_deinit() - global de-initializer
  55. *
  56. * Return: None
  57. */
  58. void osif_sync_deinit(void);
  59. #endif /* __OSIF_SYNC_H */