Bläddra i källkod

qcacld-3.0: Pass txrx context durring pktlog deinit

pktlog deinit should not use cds_get_context.
Using cds_get_context for the txrx context was
causing the device to crash on the next insmod
because the deinit is happenning durring the deinitialization
of the txrx context after it has allready been unlinked from
as a global context.

Change-Id: I487951a6dd50680884223e7027e5bce1c8ddfa07
CRs-Fixed: 2004404
Houston Hoffman 8 år sedan
förälder
incheckning
8c48504b55

+ 5 - 6
core/dp/txrx/ol_txrx.c

@@ -1091,18 +1091,18 @@ void htt_pkt_log_init(void *ppdev, void *scn)
  *
  * Return: void
  */
-static void htt_pktlogmod_exit(struct ol_txrx_pdev_t *handle, void *scn)
+static void htt_pktlogmod_exit(struct ol_txrx_pdev_t *handle)
 {
-	if (scn && cds_get_conparam() != QDF_GLOBAL_FTM_MODE &&
+	if (cds_get_conparam() != QDF_GLOBAL_FTM_MODE &&
 		!QDF_IS_EPPING_ENABLED(cds_get_conparam()) &&
 			handle->pkt_log_init) {
-		pktlogmod_exit(scn);
+		pktlogmod_exit(handle);
 		handle->pkt_log_init = false;
 	}
 }
 #else
 void htt_pkt_log_init(void *handle, void *ol_sc) { }
-static void htt_pktlogmod_exit(ol_txrx_pdev_handle handle, void *sc)  { }
+static void htt_pktlogmod_exit(ol_txrx_pdev_handle handle)  { }
 #endif
 
 /**
@@ -1619,7 +1619,6 @@ static void ol_txrx_pdev_detach(void *ppdev, int force)
 {
 	ol_txrx_pdev_handle pdev = ppdev;
 	int i;
-	struct hif_opaque_softc *osc =  cds_get_context(QDF_MODULE_ID_HIF);
 
 	/*checking to ensure txrx pdev structure is not NULL */
 	if (!pdev) {
@@ -1632,7 +1631,7 @@ static void ol_txrx_pdev_detach(void *ppdev, int force)
 	/* check that the pdev has no vdevs allocated */
 	TXRX_ASSERT1(TAILQ_EMPTY(&pdev->vdev_list));
 
-	htt_pktlogmod_exit(pdev, osc);
+	htt_pktlogmod_exit(pdev);
 
 	OL_RX_REORDER_TIMEOUT_CLEANUP(pdev);
 

+ 5 - 4
core/utils/pktlog/include/pktlog_ac.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -61,7 +61,7 @@ struct ol_ath_generic_softc_t;
 typedef struct ol_ath_generic_softc_t *ol_ath_generic_softc_handle;
 extern void pktlog_disable_adapter_logging(struct hif_opaque_softc *scn);
 extern int pktlog_alloc_buf(struct hif_opaque_softc *scn);
-extern void pktlog_release_buf(struct hif_opaque_softc *scn);
+extern void pktlog_release_buf(ol_txrx_pdev_handle pdev_txrx_handle);
 
 ssize_t pktlog_read_proc_entry(char *buf, size_t nbytes, loff_t *ppos,
 		struct ath_pktlog_info *pl_info, bool *read_complete);
@@ -80,7 +80,8 @@ struct ol_pl_arch_dep_funcs {
 
 struct ol_pl_os_dep_funcs {
 	int (*pktlog_attach)(struct hif_opaque_softc *scn);
-	void (*pktlog_detach)(struct hif_opaque_softc *scn);
+	void (*pktlog_detach)(struct ol_txrx_pdev_t *handle);
+
 };
 
 struct ath_pktlog_wmi_params {
@@ -137,7 +138,7 @@ int pktlog_enable(struct hif_opaque_softc *scn, int32_t log_state,
 int pktlog_setsize(struct hif_opaque_softc *scn, int32_t log_state);
 int pktlog_disable(struct hif_opaque_softc *scn);
 int pktlogmod_init(void *context);
-void pktlogmod_exit(void *context);
+void pktlogmod_exit(struct ol_txrx_pdev_t *handle);
 int pktlog_htc_attach(void);
 void pktlog_process_fw_msg(uint32_t *msg_word);
 

+ 2 - 4
core/utils/pktlog/include/pktlog_ac_api.h

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2014, 2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2014, 2016-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -55,8 +55,6 @@ typedef struct hif_opaque_softc *hif_opaque_softc_handle;
 struct net_device;
 typedef struct net_device *net_device_handle;
 
-void ol_pl_set_name(hif_opaque_softc_handle scn, net_device_handle dev);
-
 void ol_pl_sethandle(ol_pktlog_dev_handle *pl_handle,
 		     hif_opaque_softc_handle scn);
 
@@ -106,7 +104,7 @@ typedef void *ol_pktlog_dev_handle;
 		(void)scn;		\
 	} while (0)
 
-#define ol_pl_set_name(scn, dev)	\
+#define ol_pl_set_name(dev)	\
 	do {				\
 		(void)scn;		\
 		(void)dev;		\

+ 23 - 28
core/utils/pktlog/linux_ac.c

@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2012-2016 The Linux Foundation. All rights reserved.
+ * Copyright (c) 2012-2017 The Linux Foundation. All rights reserved.
  *
  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  *
@@ -79,7 +79,7 @@ static struct ath_pktlog_info *g_pktlog_info;
 static struct proc_dir_entry *g_pktlog_pde;
 
 static int pktlog_attach(struct hif_opaque_softc *sc);
-static void pktlog_detach(struct hif_opaque_softc *sc);
+static void pktlog_detach(struct ol_txrx_pdev_t *handle);
 static int pktlog_open(struct inode *i, struct file *f);
 static int pktlog_release(struct inode *i, struct file *f);
 static int pktlog_mmap(struct file *f, struct vm_area_struct *vma);
@@ -96,27 +96,28 @@ static struct file_operations pktlog_fops = {
 /*
  * Linux implementation of helper functions
  */
-
-static struct ol_pktlog_dev_t *get_pl_handle(struct hif_opaque_softc *scn)
+static struct ol_pktlog_dev_t *cds_get_pl_handle(void)
 {
 	ol_txrx_pdev_handle pdev_txrx_handle;
 	pdev_txrx_handle = cds_get_context(QDF_MODULE_ID_TXRX);
-	if (!pdev_txrx_handle)
+	if (!pdev_txrx_handle) {
+		QDF_ASSERT(0);
 		return NULL;
+	}
 	return pdev_txrx_handle->pl_dev;
 }
 
-void ol_pl_set_name(hif_opaque_softc_handle scn, net_device_handle dev)
+static struct ol_pktlog_dev_t *ol_get_pl_handle(
+		ol_txrx_pdev_handle pdev_txrx_handle)
 {
-	ol_txrx_pdev_handle pdev_txrx_handle;
-	pdev_txrx_handle = cds_get_context(QDF_MODULE_ID_TXRX);
-	if (pdev_txrx_handle && pdev_txrx_handle->pl_dev && dev)
-		pdev_txrx_handle->pl_dev->name = dev->name;
+	if (!pdev_txrx_handle)
+		return NULL;
+	return pdev_txrx_handle->pl_dev;
 }
 
 void pktlog_disable_adapter_logging(struct hif_opaque_softc *scn)
 {
-	struct ol_pktlog_dev_t *pl_dev = get_pl_handle(scn);
+	struct ol_pktlog_dev_t *pl_dev = cds_get_pl_handle();
 	if (pl_dev)
 		pl_dev->pl_info->log_state = 0;
 }
@@ -164,14 +165,12 @@ int pktlog_alloc_buf(struct hif_opaque_softc *scn)
 	return 0;
 }
 
-void pktlog_release_buf(struct hif_opaque_softc *scn)
+void pktlog_release_buf(ol_txrx_pdev_handle pdev_txrx_handle)
 {
 	unsigned long page_cnt;
 	unsigned long vaddr;
 	struct page *vpg;
 	struct ath_pktlog_info *pl_info;
-	ol_txrx_pdev_handle pdev_txrx_handle;
-	pdev_txrx_handle = cds_get_context(QDF_MODULE_ID_TXRX);
 
 	if (!pdev_txrx_handle || !pdev_txrx_handle->pl_dev) {
 		printk(PKTLOG_TAG
@@ -219,7 +218,7 @@ qdf_sysctl_decl(ath_sysctl_pktlog_enable, ctl, write, filp, buffer, lenp, ppos)
 		return -EINVAL;
 	}
 
-	pl_dev = get_pl_handle((struct hif_opaque_softc *)scn);
+	pl_dev = cds_get_pl_handle();
 
 	if (!pl_dev) {
 		printk("%s: Invalid pktlog context\n", __func__);
@@ -275,7 +274,7 @@ qdf_sysctl_decl(ath_sysctl_pktlog_size, ctl, write, filp, buffer, lenp, ppos)
 		return -EINVAL;
 	}
 
-	pl_dev = get_pl_handle((struct hif_opaque_softc *)scn);
+	pl_dev = cds_get_pl_handle();
 
 	if (!pl_dev) {
 		printk("%s: Invalid pktlog handle\n", __func__);
@@ -307,7 +306,7 @@ qdf_sysctl_decl(ath_sysctl_pktlog_size, ctl, write, filp, buffer, lenp, ppos)
 /* Register sysctl table */
 static int pktlog_sysctl_register(struct hif_opaque_softc *scn)
 {
-	struct ol_pktlog_dev_t *pl_dev = get_pl_handle(scn);
+	struct ol_pktlog_dev_t *pl_dev = cds_get_pl_handle();
 	struct ath_pktlog_info_lnx *pl_info_lnx;
 	char *proc_name;
 
@@ -416,7 +415,7 @@ static int pktlog_attach(struct hif_opaque_softc *scn)
 	char *proc_name;
 	struct proc_dir_entry *proc_entry;
 
-	pl_dev = get_pl_handle(scn);
+	pl_dev = cds_get_pl_handle();
 
 	if (pl_dev != NULL) {
 		pl_info_lnx = kmalloc(sizeof(*pl_info_lnx), GFP_KERNEL);
@@ -495,13 +494,13 @@ static void pktlog_sysctl_unregister(struct ol_pktlog_dev_t *pl_dev)
 	}
 }
 
-static void pktlog_detach(struct hif_opaque_softc *scn)
+static void pktlog_detach(struct ol_txrx_pdev_t *handle)
 {
 	struct ol_txrx_pdev_t *txrx_pdev;
 	struct ol_pktlog_dev_t *pl_dev;
 	struct ath_pktlog_info *pl_info;
 
-	txrx_pdev = cds_get_context(QDF_MODULE_ID_TXRX);
+	txrx_pdev = handle;
 	if (!txrx_pdev) {
 		printk("%s: Invalid txrx_pdev context\n", __func__);
 		ASSERT(0);
@@ -521,7 +520,7 @@ static void pktlog_detach(struct hif_opaque_softc *scn)
 	pktlog_cleanup(pl_info);
 
 	if (pl_info->buf) {
-		pktlog_release_buf(scn);
+		pktlog_release_buf(txrx_pdev);
 		pl_dev->tgt_pktlog_alloced = false;
 	}
 
@@ -914,20 +913,16 @@ attach_fail:
 	return ret;
 }
 
-void pktlogmod_exit(void *context)
+void pktlogmod_exit(struct ol_txrx_pdev_t *handle)
 {
-	struct hif_opaque_softc *scn = (struct hif_opaque_softc *)context;
 	struct ol_pktlog_dev_t *pl_dev;
 
-	if (!scn)
-		return;
-
-	pl_dev = get_pl_handle(scn);
+	pl_dev = ol_get_pl_handle(handle);
 
 	if (!pl_dev || g_pktlog_pde == NULL)
 		return;
 
-	pktlog_detach(scn);
+	pktlog_detach(handle);
 	/*
 	 *  pdev kill needs to be implemented
 	 */

+ 1 - 1
core/utils/pktlog/pktlog_ac.c

@@ -503,7 +503,7 @@ int pktlog_setsize(struct hif_opaque_softc *scn, int32_t size)
 			printk("Cannot unsubscribe pktlog from the WDI\n");
 			return -EFAULT;
 		}
-		pktlog_release_buf(scn);
+		pktlog_release_buf(pdev_txrx_handle);
 		pl_dev->is_pktlog_cb_subscribed = false;
 		pl_dev->tgt_pktlog_alloced = false;
 	}