Browse Source

qcacmn: Add support for pipe specific callbacks

Packetlog framework needs pipe specific callbacks. Change is done to
support pipe specific callbacks.

Change-Id: Iabd442acc8bef19ad9b8ad9ff2660e273a859f54
CRs-Fixed: 1072220
Venkateswara Swamy Bandaru 8 years ago
parent
commit
26f6f1ebae
4 changed files with 43 additions and 6 deletions
  1. 4 0
      hif/inc/hif.h
  2. 9 6
      hif/src/ce/ce_main.c
  3. 1 0
      hif/src/ce/ce_main.h
  4. 29 0
      hif/src/hif_main.c

+ 4 - 0
hif/inc/hif.h

@@ -731,6 +731,10 @@ uint32_t hif_register_ext_group_int_handler(struct hif_opaque_softc *hif_ctx,
 		uint32_t numirq, uint32_t irq[], ext_intr_handler handler,
 		void *context);
 
+void hif_update_pipe_callback(struct hif_opaque_softc *osc,
+				u_int8_t pipeid,
+				struct hif_msg_callbacks *callbacks);
+
 #ifdef __cplusplus
 }
 #endif

+ 9 - 6
hif/src/ce/ce_main.c

@@ -1350,7 +1350,7 @@ hif_pci_ce_send_done(struct CE_handle *copyeng, void *ce_context,
 	struct hif_softc *scn = HIF_GET_SOFTC(hif_state);
 	unsigned int sw_idx = sw_index, hw_idx = hw_index;
 	struct hif_msg_callbacks *msg_callbacks =
-		&hif_state->msg_callbacks_current;
+		&pipe_info->pipe_callbacks;
 
 	do {
 		/*
@@ -1420,7 +1420,7 @@ hif_pci_ce_recv_data(struct CE_handle *copyeng, void *ce_context,
 	struct hif_pci_softc *hif_pci_sc = HIF_GET_PCI_SOFTC(hif_state);
 #endif
 	struct hif_msg_callbacks *msg_callbacks =
-		&hif_state->msg_callbacks_current;
+		 &pipe_info->pipe_callbacks;
 
 	do {
 #ifdef HIF_PCI
@@ -1518,6 +1518,9 @@ int hif_completion_thread_startup(struct HIF_CE_state *hif_state)
 
 		if (attr.src_nentries)
 			qdf_spinlock_create(&pipe_info->completion_freeq_lock);
+
+		qdf_mem_copy(&pipe_info->pipe_callbacks, hif_msg_callbacks,
+					sizeof(pipe_info->pipe_callbacks));
 	}
 
 	A_TARGET_ACCESS_UNLIKELY(scn);
@@ -1824,11 +1827,11 @@ void hif_send_buffer_cleanup_on_pipe(struct HIF_CE_pipe_info *pipe_info)
 				return;
 			/* Indicate the completion to higher
 			 * layer to free the buffer */
-			if (hif_state->msg_callbacks_current.
+			if (pipe_info->pipe_callbacks.
 					txCompletionHandler)
-				hif_state->msg_callbacks_current.
-				    txCompletionHandler(hif_state->
-					    msg_callbacks_current.Context,
+				pipe_info->pipe_callbacks.
+				    txCompletionHandler(pipe_info->
+					    pipe_callbacks.Context,
 					    netbuf, id, toeplitz_hash_result);
 		}
 	}

+ 1 - 0
hif/src/ce/ce_main.h

@@ -95,6 +95,7 @@ struct HIF_CE_pipe_info {
 	uint32_t nbuf_alloc_err_count;
 	uint32_t nbuf_dma_err_count;
 	uint32_t nbuf_ce_enqueue_err_count;
+	struct hif_msg_callbacks pipe_callbacks;
 };
 
 /**

+ 29 - 0
hif/src/hif_main.c

@@ -918,6 +918,35 @@ bool hif_is_load_or_unload_in_progress(struct hif_softc *scn)
 	return false;
 }
 
+/**
+ * hif_update_pipe_callback() - API to register pipe specific callbacks
+ * @osc: Opaque softc
+ * @pipeid: pipe id
+ * @callbacks: callbacks to register
+ *
+ * Return: void
+ */
+
+void hif_update_pipe_callback(struct hif_opaque_softc *osc,
+					u_int8_t pipeid,
+					struct hif_msg_callbacks *callbacks)
+{
+	struct hif_softc *scn = HIF_GET_SOFTC(osc);
+	struct HIF_CE_state *hif_state = HIF_GET_CE_STATE(scn);
+	struct HIF_CE_pipe_info *pipe_info;
+
+	QDF_BUG(pipeid < CE_COUNT_MAX);
+
+	HIF_INFO_LO("+%s pipeid %d\n", __func__, pipeid);
+
+	pipe_info = &hif_state->pipe_info[pipeid];
+
+	qdf_mem_copy(&pipe_info->pipe_callbacks,
+			callbacks, sizeof(pipe_info->pipe_callbacks));
+
+	HIF_INFO_LO("-%s\n", __func__);
+}
+
 /**
  * hif_is_recovery_in_progress() - API to query upper layers if recovery in
  * progress