Parcourir la source

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
Srinivas Pitla il y a 6 ans
Parent
commit
0b50f1289c

+ 2 - 1
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;

+ 7 - 1
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);

+ 75 - 1
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

+ 19 - 1
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

+ 28 - 1
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