فهرست منبع

qcacmn: Add APIs to get component private object for pdev/vdev/peer

Add APIs to get component private object pointer. The caller has
to acquired its object lock, before calling this function, and
the lock has to be released after returning

Change-Id: I93b1001d936ba35af557b78edf45a11d58ae5308
CRs-Fixed: 1107371
Srinivas Pitla 8 سال پیش
والد
کامیت
1a2ef8c613

+ 17 - 1
umac/cmn_services/obj_mgr/inc/wlan_objmgr_pdev_obj.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 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
@@ -326,6 +326,22 @@ struct wlan_objmgr_vdev *wlan_objmgr_find_vdev_by_id_from_pdev(
 struct wlan_objmgr_vdev *wlan_objmgr_find_vdev_by_macaddr_from_pdev(
 		struct wlan_objmgr_pdev *pdev, uint8_t *macaddr);
 
+/**
+ * wlan_objmgr_pdev_get_comp_private_obj() - get pdev component private object
+ * @pdev: PDEV object
+ * @id: Component id
+ *
+ * API to get component private object
+ *
+ * Caller need to acquire lock with wlan_pdev_obj_lock()
+ *
+ * Return: void *ptr on SUCCESS
+ *         NULL on Failure
+ */
+void *wlan_objmgr_pdev_get_comp_private_obj(
+		struct wlan_objmgr_pdev *pdev,
+		enum wlan_umac_comp_id id);
+
 /**
  * wlan_pdev_obj_lock() - Acquire PDEV spinlock
  * @pdev: PDEV object

+ 17 - 1
umac/cmn_services/obj_mgr/inc/wlan_objmgr_peer_obj.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 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
@@ -283,6 +283,22 @@ QDF_STATUS wlan_objmgr_trigger_peer_comp_priv_object_deletion(
 		struct wlan_objmgr_peer *peer,
 		enum wlan_umac_comp_id id);
 
+/**
+ * wlan_objmgr_peer_get_comp_private_obj() - get peer component private object
+ * @peer: PEER object
+ * @id: Component id
+ *
+ * API to get component private object
+ *
+ * Caller need to acquire lock with wlan_peer_obj_lock()
+ *
+ * Return: void *ptr on SUCCESS
+ *         NULL on Failure
+ */
+void *wlan_objmgr_peer_get_comp_private_obj(
+		struct wlan_objmgr_peer *peer,
+		enum wlan_umac_comp_id id);
+
 /**
  * wlan_peer_obj_lock() - Acquire PEER spinlock
  * @psoc: PEER object

+ 2 - 0
umac/cmn_services/obj_mgr/inc/wlan_objmgr_psoc_obj.h

@@ -754,6 +754,8 @@ static inline uint8_t *wlan_psoc_get_hw_macaddr(struct wlan_objmgr_psoc *psoc)
  * This API is used to get the component private object pointer tied to the
  * corresponding psoc object
  *
+ * Caller need to acquire lock with wlan_psoc_obj_lock()
+ *
  * Return: Component private object
  */
 void *wlan_objmgr_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc,

+ 17 - 1
umac/cmn_services/obj_mgr/inc/wlan_objmgr_vdev_obj.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 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
@@ -458,6 +458,22 @@ QDF_STATUS wlan_objmgr_trigger_vdev_comp_priv_object_deletion(
 		struct wlan_objmgr_vdev *vdev,
 		enum wlan_umac_comp_id id);
 
+/**
+ * wlan_objmgr_vdev_get_comp_private_obj() - get vdev component private object
+ * @vdev: VDEV object
+ * @id: Component id
+ *
+ * API to get component private object
+ *
+ * Caller need to acquire lock with wlan_vdev_obj_lock()
+ *
+ * Return: void *ptr on SUCCESS
+ *         NULL on Failure
+ */
+void *wlan_objmgr_vdev_get_comp_private_obj(
+		struct wlan_objmgr_vdev *vdev,
+		enum wlan_umac_comp_id id);
+
 /* Util APIs */
 
 /**

+ 25 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_pdev_obj.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 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
@@ -626,3 +626,27 @@ struct wlan_objmgr_vdev *wlan_objmgr_find_vdev_by_macaddr_from_pdev(
 	wlan_pdev_obj_unlock(pdev);
 	return NULL;
 }
+
+void *wlan_objmgr_pdev_get_comp_private_obj(
+		struct wlan_objmgr_pdev *pdev,
+		enum wlan_umac_comp_id id)
+{
+	void *comp_priv_obj;
+
+	/* This API is invoked with lock acquired, don't add any debug prints */
+
+	/* component id is invalid */
+	if (id >= WLAN_UMAC_MAX_COMPONENTS) {
+		QDF_BUG(0);
+		return NULL;
+	}
+
+	if (pdev == NULL) {
+		QDF_BUG(0);
+		return NULL;
+	}
+
+	comp_priv_obj = pdev->pdev_comp_priv_obj[id];
+	return comp_priv_obj;
+}
+EXPORT_SYMBOL(wlan_objmgr_pdev_get_comp_private_obj);

+ 25 - 1
umac/cmn_services/obj_mgr/src/wlan_objmgr_peer_obj.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2016-2017 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
@@ -461,3 +461,27 @@ QDF_STATUS wlan_objmgr_trigger_peer_comp_priv_object_deletion(
 	}
 	return obj_status;
 }
+
+void *wlan_objmgr_peer_get_comp_private_obj(
+		struct wlan_objmgr_peer *peer,
+		enum wlan_umac_comp_id id)
+{
+	void *comp_priv_obj;
+
+	/* This API is invoked with lock acquired, don't add any debug prints */
+
+	/* component id is invalid */
+	if (id >= WLAN_UMAC_MAX_COMPONENTS) {
+		QDF_BUG(0);
+		return NULL;
+	}
+
+	if (peer == NULL) {
+		QDF_BUG(0);
+		return NULL;
+	}
+
+	comp_priv_obj = peer->peer_comp_priv_obj[id];
+	return comp_priv_obj;
+}
+EXPORT_SYMBOL(wlan_objmgr_peer_get_comp_private_obj);

+ 12 - 4
umac/cmn_services/obj_mgr/src/wlan_objmgr_psoc_obj.c

@@ -884,13 +884,21 @@ void *wlan_objmgr_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc,
 {
 	void *comp_private_obj;
 
-	if (!psoc)
+	/* This API is invoked with lock acquired, don't add any debug prints */
+
+	/* component id is invalid */
+	if (id >= WLAN_UMAC_MAX_COMPONENTS) {
+		QDF_BUG(0);
 		return NULL;
+	}
+
+	if (psoc == NULL) {
+		QDF_BUG(0);
+		return NULL;
+	}
 
-	wlan_psoc_obj_lock(psoc);
 	comp_private_obj = psoc->soc_comp_priv_obj[id];
-	wlan_psoc_obj_unlock(psoc);
 
 	return comp_private_obj;
 }
-
+EXPORT_SYMBOL(wlan_objmgr_psoc_get_comp_private_obj);

+ 24 - 0
umac/cmn_services/obj_mgr/src/wlan_objmgr_vdev_obj.c

@@ -592,3 +592,27 @@ QDF_STATUS wlan_objmgr_vdev_peer_detach(struct wlan_objmgr_vdev *vdev,
 	return QDF_STATUS_SUCCESS;
 }
 
+void *wlan_objmgr_vdev_get_comp_private_obj(
+		struct wlan_objmgr_vdev *vdev,
+		enum wlan_umac_comp_id id)
+{
+	void *comp_priv_obj;
+
+	/* This API is invoked with lock acquired, don't add any debug prints */
+
+	/* component id is invalid */
+	if (id >= WLAN_UMAC_MAX_COMPONENTS) {
+		QDF_BUG(0);
+		return NULL;
+	}
+
+	if (vdev == NULL) {
+		QDF_BUG(0);
+		return NULL;
+	}
+
+	comp_priv_obj = vdev->vdev_comp_priv_obj[id];
+
+	return comp_priv_obj;
+}
+EXPORT_SYMBOL(wlan_objmgr_vdev_get_comp_private_obj);