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