diff --git a/umac/mlme/include/wlan_vdev_mlme.h b/umac/mlme/include/wlan_vdev_mlme.h index b20502d783..5d291e4e5e 100644 --- a/umac/mlme/include/wlan_vdev_mlme.h +++ b/umac/mlme/include/wlan_vdev_mlme.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -175,6 +175,7 @@ struct vdev_mlme_obj { struct vdev_mlme_proto vdev_proto; #ifdef VDEV_SM_LOCK_SUPPORT qdf_spinlock_t sm_lock; + qdf_mutex_t vdev_cmd_lock; #endif struct wlan_sm *sm_hdl; struct wlan_objmgr_vdev *vdev; diff --git a/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.c b/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.c index dc6374c49c..82ca2d9df3 100644 --- a/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.c +++ b/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -1851,6 +1851,8 @@ QDF_STATUS mlme_vdev_sm_create(struct vdev_mlme_obj *vdev_mlme) mlme_vdev_sm_spinlock_create(vdev_mlme); + mlme_vdev_cmd_mutex_create(vdev_mlme); + return QDF_STATUS_SUCCESS; } @@ -1873,12 +1875,16 @@ QDF_STATUS mlme_vdev_sm_create(struct vdev_mlme_obj *vdev_mlme) mlme_vdev_sm_spinlock_create(vdev_mlme); + mlme_vdev_cmd_mutex_create(vdev_mlme); + return QDF_STATUS_SUCCESS; } #endif QDF_STATUS mlme_vdev_sm_destroy(struct vdev_mlme_obj *vdev_mlme) { + mlme_vdev_cmd_mutex_destroy(vdev_mlme); + mlme_vdev_sm_spinlock_destroy(vdev_mlme); wlan_sm_delete(vdev_mlme->sm_hdl); diff --git a/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.h b/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.h index cfcf05e305..5a01eba5fa 100644 --- a/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.h +++ b/umac/mlme/vdev_mgr/core/src/vdev_mlme_sm.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -131,6 +131,60 @@ static inline void mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj *vdev_mlme) qdf_spin_unlock_bh(&vdev_mlme->sm_lock); } +/** + * mlme_vdev_cmd_mutex_create - Create VDEV MLME cmd mutex + * @vdev_mlme_obj: VDEV MLME comp object + * + * Creates VDEV MLME cmd mutex + * + * Return: void + */ +static inline void +mlme_vdev_cmd_mutex_create(struct vdev_mlme_obj *vdev_mlme) +{ + qdf_mutex_create(&vdev_mlme->vdev_cmd_lock); +} + +/** + * mlme_vdev_cmd_mutex_destroy - Destroy VDEV MLME cmd mutex + * @vdev_mlme_obj: VDEV MLME comp object + * + * Destroy VDEV MLME cmd mutex + * + * Return: void + */ +static inline void +mlme_vdev_cmd_mutex_destroy(struct vdev_mlme_obj *vdev_mlme) +{ + qdf_mutex_destroy(&vdev_mlme->vdev_cmd_lock); +} + +/** + * mlme_vdev_cmd_mutex_acquire - acquire mutex + * @vdev_mlme_obj: vdev mlme comp object + * + * acquire vdev mlme cmd mutex + * + * return: void + */ +static inline void mlme_vdev_cmd_mutex_acquire(struct vdev_mlme_obj *vdev_mlme) +{ + qdf_mutex_acquire(&vdev_mlme->vdev_cmd_lock); +} + +/** + * mlme_vdev_cmd_mutex_release - release mutex + * @vdev_mlme_obj: vdev mlme comp object + * + * release vdev mlme cmd mutex + * + * return: void + */ +static inline void mlme_vdev_cmd_mutex_release(struct vdev_mlme_obj *vdev_mlme) +{ + qdf_mutex_release(&vdev_mlme->vdev_cmd_lock); +} + #else static inline void mlme_vdev_sm_spinlock_create(struct vdev_mlme_obj *vdev_mlme) { @@ -150,5 +204,25 @@ static inline void mlme_vdev_sm_spin_lock(struct vdev_mlme_obj *vdev_mlme) static inline void mlme_vdev_sm_spin_unlock(struct vdev_mlme_obj *vdev_mlme) { } + +static inline void +mlme_vdev_cmd_mutex_create(struct vdev_mlme_obj *vdev_mlme) +{ + mlme_info("VDEV CMD lock is disabled!!!"); +} + +static inline void +mlme_vdev_cmd_mutex_destroy(struct vdev_mlme_obj *vdev_mlme) +{ + mlme_info("VDEV CMD lock is disabled!!!"); +} + +static inline void mlme_vdev_cmd_mutex_acquire(struct vdev_mlme_obj *vdev_mlme) +{ +} + +static inline void mlme_vdev_cmd_mutex_release(struct vdev_mlme_obj *vdev_mlme) +{ +} #endif #endif diff --git a/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h b/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h index 7686809d3f..4459c3e8d4 100644 --- a/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h +++ b/umac/mlme/vdev_mgr/dispatcher/inc/wlan_vdev_mlme_api.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -134,5 +134,23 @@ QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev); * FAILURE: otherwise failure */ QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev); + +/** + * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity + * + * API to take VDEV MLME command lock + * + * Return: void + */ +void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev); + +/** + * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity + * + * API to release VDEV MLME command lock + * + * Return: void + */ +void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev); #endif #endif diff --git a/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c b/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c index 2efb0d3721..0e6604414f 100644 --- a/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c +++ b/umac/mlme/vdev_mgr/dispatcher/src/wlan_vdev_mlme_api.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2018 The Linux Foundation. All rights reserved. + * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -177,4 +177,31 @@ QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev) return QDF_STATUS_E_FAILURE; } + +void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev) +{ + struct vdev_mlme_obj *vdev_mlme; + + vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); + if (!vdev_mlme) { + mlme_err("vdev component object is NULL"); + return; + } + + mlme_vdev_cmd_mutex_acquire(vdev_mlme); +} + +void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev) +{ + struct vdev_mlme_obj *vdev_mlme; + + vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev); + if (!vdev_mlme) { + mlme_err("vdev component object is NULL"); + return; + } + + mlme_vdev_cmd_mutex_release(vdev_mlme); +} + #endif