qcacmn: Add lock for MLME command queuing to Serialization

MLME commands need to be queued back to back in few scnearios,
added lock to avoid interleaving between commands queueing.

Change-Id: If34aee5849938cbd76183af971ea058ce63505ee
CRs-Fixed: 2384147
This commit is contained in:
Srinivas Pitla
2018-11-30 19:19:04 +05:30
committed by nshrivas
parent 65e6fc1a43
commit 0b50f1289c
5 changed files with 131 additions and 5 deletions

View File

@@ -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;

View File

@@ -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);

View File

@@ -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

View File

@@ -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

View File

@@ -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