blob: 86c2fccc930e9a34d714238114fae9547d5bb64e [file] [log] [blame]
Srinivas Dasari2c29e002017-03-08 19:00:51 +05301/* Copyright (c) 2017, The Linux Foundation. All rights reserved.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 */
12
13#ifndef _NET_CNSS_GENETLINK_H_
14#define _NET_CNSS_GENETLINK_H_
15
16#define CLD80211_MAX_COMMANDS 40
17#define CLD80211_MAX_NL_DATA 4096
18
19/**
20 * enum cld80211_attr - Driver/Application embeds the data in nlmsg with the
21 * help of below attributes
22 *
23 * @CLD80211_ATTR_VENDOR_DATA: Embed all other attributes in this nested
24 * attribute.
25 * @CLD80211_ATTR_DATA: Embed complete data in this attribute
26 *
27 * Any new message in future can be added as another attribute
28 */
29enum cld80211_attr {
30 CLD80211_ATTR_VENDOR_DATA = 1,
31 CLD80211_ATTR_DATA,
32 /* add new attributes above here */
33
34 __CLD80211_ATTR_AFTER_LAST,
35 CLD80211_ATTR_MAX = __CLD80211_ATTR_AFTER_LAST - 1
36};
37
38/**
39 * enum cld80211_multicast_groups - List of multicast groups supported
40 *
41 * @CLD80211_MCGRP_SVC_MSGS: WLAN service message will be sent to this group.
42 * Ex: Status ind messages
43 * @CLD80211_MCGRP_HOST_LOGS: All logging related messages from driver will be
44 * sent to this multicast group
45 * @CLD80211_MCGRP_FW_LOGS: Firmware logging messages will be sent to this group
46 * @CLD80211_MCGRP_PER_PKT_STATS: Messages related packet stats debugging infra
47 * will be sent to this group
48 * @CLD80211_MCGRP_DIAG_EVENTS: Driver/Firmware status logging diag events will
49 * be sent to this group
50 * @CLD80211_MCGRP_FATAL_EVENTS: Any fatal message generated in driver/firmware
51 * will be sent to this group
52 * @CLD80211_MCGRP_OEM_MSGS: All OEM message will be sent to this group
53 * Ex: LOWI messages
54 */
55enum cld80211_multicast_groups {
56 CLD80211_MCGRP_SVC_MSGS,
57 CLD80211_MCGRP_HOST_LOGS,
58 CLD80211_MCGRP_FW_LOGS,
59 CLD80211_MCGRP_PER_PKT_STATS,
60 CLD80211_MCGRP_DIAG_EVENTS,
61 CLD80211_MCGRP_FATAL_EVENTS,
62 CLD80211_MCGRP_OEM_MSGS,
63};
64
65/**
66 * typedef cld80211_cb - Callback to be called when an nlmsg is received with
67 * the registered cmd_id command from userspace
68 * @data: Payload of the message to be sent to driver
69 * @data_len: Length of the payload
70 * @cb_ctx: callback context to be returned to driver when the callback
71 * is called
72 * @pid: process id of the sender
73 */
74typedef void (*cld80211_cb)(const void *data, int data_len,
75 void *cb_ctx, int pid);
76
77/**
78 * register_cld_cmd_cb() - Allows cld driver to register for commands with
79 * callback
80 * @cmd_id: Command to be registered. Valid range [1, CLD80211_MAX_COMMANDS]
81 * @cb: Callback to be called when an nlmsg is received with cmd_id command
82 * from userspace
83 * @cb_ctx: context provided by driver; Send this as cb_ctx of func()
84 * to driver
85 */
86int register_cld_cmd_cb(u8 cmd_id, cld80211_cb cb, void *cb_ctx);
87
88/**
89 * deregister_cld_cmd_cb() - Allows cld driver to de-register the command it
90 * has already registered
91 * @cmd_id: Command to be deregistered.
92 */
93int deregister_cld_cmd_cb(u8 cmd_id);
94
95/**
96 * cld80211_get_genl_family() - Returns current netlink family context
97 */
98struct genl_family *cld80211_get_genl_family(void);
99
100#endif /* _NET_CNSS_GENETLINK_H_ */