Browse Source

qcacmn: Adding cdp interface for wdi events

Adding subscribe and unsubscribe functions for wdi events in
cdp layer to enable for legacy alone and disable for lithium
data path.

Change-Id: Ibdf449393d0cb59c4c46c712c7a72695e086ab6c
Nandha Kishore Easwaran 8 years ago
parent
commit
2668994354
2 changed files with 68 additions and 0 deletions
  1. 62 0
      dp/inc/cdp_txrx_ctrl.h
  2. 6 0
      dp/inc/cdp_txrx_ops.h

+ 62 - 0
dp/inc/cdp_txrx_ctrl.h

@@ -341,4 +341,66 @@ cdp_peer_set_nawds(ol_txrx_soc_handle soc,
 			(peer, value);
 	return;
 }
+
+/**
+ * @brief Subscribe to a specified WDI event.
+ * @details
+ *  This function adds the provided wdi_event_subscribe object to a list of
+ *  subscribers for the specified WDI event.
+ *  When the event in question happens, each subscriber for the event will
+ *  have their callback function invoked.
+ *  The order in which callback functions from multiple subscribers are
+ *  invoked is unspecified.
+ *
+ * @param soc - pointer to the soc
+ * @param pdev - the data physical device object
+ * @param event_cb_sub - the callback and context for the event subscriber
+ * @param event - which event's notifications are being subscribed to
+ * @return - int
+ */
+static inline int
+cdp_wdi_event_sub(ol_txrx_soc_handle soc,
+		struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
+{
+	if (!soc || !soc->ops || !soc->ops->ctrl_ops) {
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
+			"%s invalid instance", __func__);
+		return 0;
+	}
+
+	if (soc->ops->ctrl_ops->txrx_wdi_event_sub)
+		return soc->ops->ctrl_ops->txrx_wdi_event_sub
+			(pdev, event_cb_sub, event);
+	return 0;
+}
+
+/**
+ * @brief Unsubscribe from a specified WDI event.
+ * @details
+ *  This function removes the provided event subscription object from the
+ *  list of subscribers for its event.
+ *  This function shall only be called if there was a successful prior call
+ *  to event_sub() on the same wdi_event_subscribe object.
+ *
+ * @param soc - pointer to the soc
+ * @param pdev - the data physical device object
+ * @param event_cb_sub - the callback and context for the event subscriber
+ * @param event - which event's notifications are being subscribed to
+ * @return - int
+ */
+static inline int
+cdp_wdi_event_unsub(ol_txrx_soc_handle soc,
+		struct cdp_pdev *pdev, void *event_cb_sub, uint32_t event)
+{
+	if (!soc || !soc->ops || !soc->ops->ctrl_ops) {
+		QDF_TRACE(QDF_MODULE_ID_DP, QDF_TRACE_LEVEL_FATAL,
+			"%s invalid instance", __func__);
+		return 0;
+	}
+
+	if (soc->ops->ctrl_ops->txrx_wdi_event_unsub)
+		return soc->ops->ctrl_ops->txrx_wdi_event_unsub
+			(pdev, event_cb_sub, event);
+	return 0;
+}
 #endif

+ 6 - 0
dp/inc/cdp_txrx_ops.h

@@ -390,6 +390,12 @@ struct cdp_ctrl_ops {
 	 */
 	enum cdp_host_reo_dest_ring (*txrx_get_pdev_reo_dest)(
 						struct cdp_pdev *pdev);
+
+	int (*txrx_wdi_event_sub)(struct cdp_pdev *pdev, void *event_cb_sub,
+			uint32_t event);
+
+	int (*txrx_wdi_event_unsub)(struct cdp_pdev *pdev, void *event_cb_sub,
+			uint32_t event);
 };
 
 struct cdp_me_ops {