diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index a4dad10c53a7..976fbec05230 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -581,14 +581,14 @@ static void __hdd_hostapd_uninit(struct net_device *dev) /** * hdd_hostapd_uninit() - SSR wrapper for __hdd_hostapd_uninit - * @dev: pointer to net_device + * @net_dev: pointer to net_device * * Return: 0 on success, error number otherwise */ -static void hdd_hostapd_uninit(struct net_device *dev) +static void hdd_hostapd_uninit(struct net_device *net_dev) { cds_ssr_protect(__func__); - __hdd_hostapd_uninit(dev); + __hdd_hostapd_uninit(net_dev); cds_ssr_unprotect(__func__); } @@ -608,20 +608,25 @@ static int __hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu) /** * hdd_hostapd_change_mtu() - SSR wrapper for __hdd_hostapd_change_mtu - * @dev: pointer to net_device + * @net_dev: pointer to net_device * @new_mtu: new mtu * * Return: 0 on success, error number otherwise */ -static int hdd_hostapd_change_mtu(struct net_device *dev, int new_mtu) +static int hdd_hostapd_change_mtu(struct net_device *net_dev, int new_mtu) { - int ret; + struct osif_vdev_sync *vdev_sync; + int errno; - cds_ssr_protect(__func__); - ret = __hdd_hostapd_change_mtu(dev, new_mtu); - cds_ssr_unprotect(__func__); + errno = osif_vdev_sync_op_start(net_dev, &vdev_sync); + if (errno) + return errno; - return ret; + errno = __hdd_hostapd_change_mtu(net_dev, new_mtu); + + osif_vdev_sync_op_stop(vdev_sync); + + return errno; } #ifdef QCA_HT_2040_COEX @@ -715,20 +720,25 @@ static int __hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) /** * hdd_hostapd_set_mac_address() - set mac address - * @dev: pointer to net_device + * @net_dev: pointer to net_device * @addr: mac address * * Return: 0 on success, error number otherwise */ -static int hdd_hostapd_set_mac_address(struct net_device *dev, void *addr) +static int hdd_hostapd_set_mac_address(struct net_device *net_dev, void *addr) { - int ret; + struct osif_vdev_sync *vdev_sync; + int errno; - cds_ssr_protect(__func__); - ret = __hdd_hostapd_set_mac_address(dev, addr); - cds_ssr_unprotect(__func__); + errno = osif_vdev_sync_op_start(net_dev, &vdev_sync); + if (errno) + return errno; - return ret; + errno = __hdd_hostapd_set_mac_address(net_dev, addr); + + osif_vdev_sync_op_stop(vdev_sync); + + return errno; } static void hdd_clear_sta(struct hdd_adapter *adapter, uint8_t sta_id) @@ -1571,27 +1581,21 @@ static void hdd_fill_station_info(struct hdd_adapter *adapter, * * Return: none */ -static void -hdd_stop_sap_due_to_invalid_channel(struct work_struct *work) +static void hdd_stop_sap_due_to_invalid_channel(struct work_struct *work) { - /* - * Extract the adapter from work structure. sap_stop_bss_work - * is part of adapter context. - */ - struct hdd_adapter *sap_adapter = container_of(work, - struct hdd_adapter, - sap_stop_bss_work); - cds_ssr_protect(__func__); - if (sap_adapter == NULL) { - cds_err("sap_adapter is NULL, no work needed"); - cds_ssr_unprotect(__func__); + struct hdd_adapter *sap_adapter = container_of(work, struct hdd_adapter, + sap_stop_bss_work); + struct osif_vdev_sync *vdev_sync; + + if (osif_vdev_sync_op_start(sap_adapter->dev, &vdev_sync)) return; - } + hdd_debug("work started for sap session[%d]", sap_adapter->vdev_id); wlan_hdd_stop_sap(sap_adapter); wlansap_cleanup_cac_timer(WLAN_HDD_GET_SAP_CTX_PTR(sap_adapter)); hdd_debug("work finished for sap"); - cds_ssr_unprotect(__func__); + + osif_vdev_sync_op_stop(vdev_sync); } /** diff --git a/core/hdd/src/wlan_hdd_ioctl.c b/core/hdd/src/wlan_hdd_ioctl.c index 8ee7158f27ed..5a3f6ae1f11f 100644 --- a/core/hdd/src/wlan_hdd_ioctl.c +++ b/core/hdd/src/wlan_hdd_ioctl.c @@ -18,6 +18,7 @@ /* Include Files */ +#include "osif_sync.h" #include #include #include @@ -7661,7 +7662,7 @@ exit: /** * hdd_ioctl() - ioctl handler (wrapper) for wlan network interfaces - * @dev: device upon which the ioctl was received + * @net_dev: device upon which the ioctl was received * @ifr: ioctl request information * @cmd: ioctl command * @@ -7670,12 +7671,19 @@ exit: * * Return: 0 on success, non-zero on error */ -int hdd_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd) +int hdd_ioctl(struct net_device *net_dev, struct ifreq *ifr, int cmd) { - int ret; + struct osif_vdev_sync *vdev_sync; + int errno; - cds_ssr_protect(__func__); - ret = __hdd_ioctl(dev, ifr, cmd); - cds_ssr_unprotect(__func__); - return ret; + errno = osif_vdev_sync_op_start(net_dev, &vdev_sync); + if (errno) + return errno; + + errno = __hdd_ioctl(net_dev, ifr, cmd); + + osif_vdev_sync_op_stop(vdev_sync); + + return errno; } + diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 9f95fe8a5c06..be0b16442af3 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -698,22 +698,30 @@ int hdd_validate_channel_and_bandwidth(struct hdd_adapter *adapter, return 0; } -static int __hdd_netdev_notifier_call(struct notifier_block *nb, - unsigned long state, void *data) -{ #if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 11, 0)) - struct netdev_notifier_info *dev_notif_info = data; - struct net_device *dev = dev_notif_info->dev; +static inline struct net_device *hdd_net_dev_from_notifier(void *context) +{ + struct netdev_notifier_info *info = context; + + return info->dev; +} #else - struct net_device *dev = data; +static inline struct net_device *hdd_net_dev_from_notifier(void *context) +{ + return context; +} #endif + +static int __hdd_netdev_notifier_call(struct net_device *net_dev, + unsigned long state) +{ struct hdd_adapter *adapter; struct hdd_context *hdd_ctx; struct wlan_objmgr_vdev *vdev; - hdd_enter_dev(dev); + hdd_enter_dev(net_dev); - if (!dev->ieee80211_ptr) { + if (!net_dev->ieee80211_ptr) { hdd_debug("ieee80211_ptr is null"); return NOTIFY_DONE; } @@ -730,13 +738,13 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, } /* Make sure that this callback corresponds to our device. */ - adapter = hdd_get_adapter_by_iface_name(hdd_ctx, dev->name); + adapter = hdd_get_adapter_by_iface_name(hdd_ctx, net_dev->name); if (!adapter) { - hdd_debug("failed to look up adapter for '%s'", dev->name); + hdd_debug("failed to look up adapter for '%s'", net_dev->name); return NOTIFY_DONE; } - if (adapter != WLAN_HDD_GET_PRIV_PTR(dev)) { + if (adapter != WLAN_HDD_GET_PRIV_PTR(net_dev)) { hdd_err("HDD adapter mismatch!"); return NOTIFY_DONE; } @@ -751,7 +759,7 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, return NOTIFY_DONE; } - hdd_debug("%s New Net Device State = %lu", dev->name, state); + hdd_debug("%s New Net Device State = %lu", net_dev->name, state); switch (state) { case NETDEV_REGISTER: @@ -793,7 +801,7 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, * flag after which driver does not send the cfg80211_scan_done. * Ensure to cleanup the scan queue in NETDEV_GOING_DOWN */ - wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, dev); + wlan_cfg80211_cleanup_scan_queue(hdd_ctx->pdev, net_dev); break; default: @@ -807,21 +815,27 @@ static int __hdd_netdev_notifier_call(struct notifier_block *nb, * hdd_netdev_notifier_call() - netdev notifier callback function * @nb: pointer to notifier block * @state: state - * @ndev: ndev pointer + * @context: notifier callback context pointer * * Return: 0 on success, error number otherwise. */ static int hdd_netdev_notifier_call(struct notifier_block *nb, unsigned long state, - void *ndev) + void *context) { - int ret; + struct net_device *net_dev = hdd_net_dev_from_notifier(context); + struct osif_vdev_sync *vdev_sync; + int errno; - cds_ssr_protect(__func__); - ret = __hdd_netdev_notifier_call(nb, state, ndev); - cds_ssr_unprotect(__func__); + errno = osif_vdev_sync_op_start(net_dev, &vdev_sync); + if (errno) + return errno; - return ret; + errno = __hdd_netdev_notifier_call(net_dev, state); + + osif_vdev_sync_op_stop(vdev_sync); + + return errno; } struct notifier_block hdd_netdev_notifier = { @@ -3146,7 +3160,7 @@ err_hdd_hdd_init_deinit_lock: /** * hdd_open() - Wrapper function for __hdd_open to protect it from SSR - * @dev: Pointer to net_device structure + * @net_dev: Pointer to net_device structure * * This is called in response to ifconfig up * @@ -3327,17 +3341,17 @@ static void __hdd_uninit(struct net_device *dev) /** * hdd_uninit() - Wrapper function to protect __hdd_uninit from SSR - * @dev: pointer to net_device structure + * @net_dev: pointer to net_device structure * * This is called during the netdev unregister to uninitialize all data * associated with the device * * Return: none */ -static void hdd_uninit(struct net_device *dev) +static void hdd_uninit(struct net_device *net_dev) { cds_ssr_protect(__func__); - __hdd_uninit(dev); + __hdd_uninit(net_dev); cds_ssr_unprotect(__func__); } @@ -3462,8 +3476,8 @@ static int __hdd_set_mac_address(struct net_device *dev, void *addr) /** * hdd_set_mac_address() - Wrapper function to protect __hdd_set_mac_address() - * function from SSR - * @dev: pointer to net_device structure + * function from SSR + * @net_dev: pointer to net_device structure * @addr: Pointer to the sockaddr * * This function sets the user specified mac address using @@ -3471,15 +3485,20 @@ static int __hdd_set_mac_address(struct net_device *dev, void *addr) * * Return: 0 for success. */ -static int hdd_set_mac_address(struct net_device *dev, void *addr) +static int hdd_set_mac_address(struct net_device *net_dev, void *addr) { - int ret; + struct osif_vdev_sync *vdev_sync; + int errno; - cds_ssr_protect(__func__); - ret = __hdd_set_mac_address(dev, addr); - cds_ssr_unprotect(__func__); + errno = osif_vdev_sync_op_start(net_dev, &vdev_sync); + if (errno) + return errno; - return ret; + errno = __hdd_set_mac_address(net_dev, addr); + + osif_vdev_sync_op_stop(vdev_sync); + + return errno; } static uint8_t *wlan_hdd_get_derived_intf_addr(struct hdd_context *hdd_ctx) @@ -3704,18 +3723,22 @@ out: hdd_exit(); } - /** * hdd_set_multicast_list() - SSR wrapper function for __hdd_set_multicast_list - * @dev: pointer to net_device + * @net_dev: pointer to net_device * * Return: none */ -static void hdd_set_multicast_list(struct net_device *dev) +static void hdd_set_multicast_list(struct net_device *net_dev) { - cds_ssr_protect(__func__); - __hdd_set_multicast_list(dev); - cds_ssr_unprotect(__func__); + struct osif_vdev_sync *vdev_sync; + + if (osif_vdev_sync_op_start(net_dev, &vdev_sync)) + return; + + __hdd_set_multicast_list(net_dev); + + osif_vdev_sync_op_stop(vdev_sync); } static const struct net_device_ops wlan_drv_ops = {