osif_sync.h 2.4 KB

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