xref: /wlan-dirver/qcacld-3.0/core/dp/txrx/wdi_event.h (revision 1240fc7c98a5a5c6056b3d260d6ade7605f836ed)
1 /*
2  * Copyright (c) 2013-2017 The Linux Foundation. All rights reserved.
3  *
4  * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
5  *
6  *
7  * Permission to use, copy, modify, and/or distribute this software for
8  * any purpose with or without fee is hereby granted, provided that the
9  * above copyright notice and this permission notice appear in all
10  * copies.
11  *
12  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
13  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
14  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
15  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
16  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
17  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
18  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
19  * PERFORMANCE OF THIS SOFTWARE.
20  */
21 
22 /*
23  * This file was originally distributed by Qualcomm Atheros, Inc.
24  * under proprietary terms before Copyright ownership was assigned
25  * to the Linux Foundation.
26  */
27 
28 #ifndef _WDI_EVENT_H_
29 #define _WDI_EVENT_H_
30 
31 #include "athdefs.h"
32 #include "qdf_nbuf.h"
33 #define WDI_EVENT_BASE 0x100    /* Event starting number */
34 
35 #define WDI_NO_VAL (-1)
36 enum WDI_EVENT {
37 	WDI_EVENT_TX_STATUS = WDI_EVENT_BASE,
38 	WDI_EVENT_RX_DESC,
39 	WDI_EVENT_RX_DESC_REMOTE,
40 	WDI_EVENT_RATE_FIND,
41 	WDI_EVENT_RATE_UPDATE,
42 	WDI_EVENT_SW_EVENT,
43 	WDI_EVENT_RX_PEER_INVALID,
44 	/* From WIN definations */
45 	WDI_EVENT_LITE_RX,
46 	WDI_EVENT_LITE_T2H,
47 	/* End of new event items */
48 
49 	WDI_EVENT_LAST
50 };
51 
52 struct wdi_event_rx_peer_invalid_msg {
53 	qdf_nbuf_t msdu;
54 	struct ieee80211_frame *wh;
55 	uint8_t vdev_id;
56 };
57 
58 #define WDI_NUM_EVENTS  (WDI_EVENT_LAST - WDI_EVENT_BASE)
59 
60 #define WDI_EVENT_NOTIFY_BASE   0x200
61 enum WDI_EVENT_NOTIFY {
62 	WDI_EVENT_SUB_DEALLOCATE = WDI_EVENT_NOTIFY_BASE,
63 	/* End of new notification types */
64 
65 	WDI_EVENT_NOTIFY_LAST
66 };
67 
68 /* Opaque event callback */
69 typedef void (*wdi_event_cb)(void *pdev, enum WDI_EVENT event, void *data,
70 					u_int16_t peer_id, uint32_t status);
71 
72 /* Opaque event notify */
73 typedef void (*wdi_event_notify)(enum WDI_EVENT_NOTIFY notify,
74 				 enum WDI_EVENT event);
75 
76 /**
77  * @typedef wdi_event_subscribe
78  * @brief Used by consumers to subscribe to WDI event notifications.
79  * @details
80  *  The event_subscribe struct includes pointers to other event_subscribe
81  *  objects.  These pointers are simply to simplify the management of
82  *  lists of event subscribers.  These pointers are set during the
83  *  event_sub() function, and shall not be modified except by the
84  *  WDI event management SW, until after the object's event subscription
85  *  is canceled by calling event_unsub().
86  */
87 
88 typedef struct wdi_event_subscribe_t {
89 	/* subscriber event callback structure head */
90 	wdi_event_cb callback;
91 	/* subscriber object that processes the event callback */
92 	void *context;
93 	struct {
94 		/*
95 		 * private - the event subscriber SW shall not use this struct
96 		 */
97 		struct wdi_event_subscribe_t *next;
98 		struct wdi_event_subscribe_t *prev;
99 	} priv;
100 } wdi_event_subscribe;
101 
102 #endif
103