blob: b8a7cfdb796679d6fde74363ec194d1b62cf22fe [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
Naveen Rawat063e3402017-09-18 12:20:20 -070026 * @CLD80211_ATTR_META_DATA: Embed meta data for above data. This will help
27 * wlan driver to peek into request message packet without opening up definition
28 * of complete request message.
Srinivas Dasari2c29e002017-03-08 19:00:51 +053029 *
30 * Any new message in future can be added as another attribute
31 */
32enum cld80211_attr {
33 CLD80211_ATTR_VENDOR_DATA = 1,
34 CLD80211_ATTR_DATA,
Naveen Rawat063e3402017-09-18 12:20:20 -070035 CLD80211_ATTR_META_DATA,
Srinivas Dasari2c29e002017-03-08 19:00:51 +053036 /* add new attributes above here */
37
38 __CLD80211_ATTR_AFTER_LAST,
39 CLD80211_ATTR_MAX = __CLD80211_ATTR_AFTER_LAST - 1
40};
41
42/**
43 * enum cld80211_multicast_groups - List of multicast groups supported
44 *
45 * @CLD80211_MCGRP_SVC_MSGS: WLAN service message will be sent to this group.
46 * Ex: Status ind messages
47 * @CLD80211_MCGRP_HOST_LOGS: All logging related messages from driver will be
48 * sent to this multicast group
49 * @CLD80211_MCGRP_FW_LOGS: Firmware logging messages will be sent to this group
50 * @CLD80211_MCGRP_PER_PKT_STATS: Messages related packet stats debugging infra
51 * will be sent to this group
52 * @CLD80211_MCGRP_DIAG_EVENTS: Driver/Firmware status logging diag events will
53 * be sent to this group
54 * @CLD80211_MCGRP_FATAL_EVENTS: Any fatal message generated in driver/firmware
55 * will be sent to this group
56 * @CLD80211_MCGRP_OEM_MSGS: All OEM message will be sent to this group
57 * Ex: LOWI messages
58 */
59enum cld80211_multicast_groups {
60 CLD80211_MCGRP_SVC_MSGS,
61 CLD80211_MCGRP_HOST_LOGS,
62 CLD80211_MCGRP_FW_LOGS,
63 CLD80211_MCGRP_PER_PKT_STATS,
64 CLD80211_MCGRP_DIAG_EVENTS,
65 CLD80211_MCGRP_FATAL_EVENTS,
66 CLD80211_MCGRP_OEM_MSGS,
67};
68
69/**
70 * typedef cld80211_cb - Callback to be called when an nlmsg is received with
71 * the registered cmd_id command from userspace
72 * @data: Payload of the message to be sent to driver
73 * @data_len: Length of the payload
74 * @cb_ctx: callback context to be returned to driver when the callback
75 * is called
76 * @pid: process id of the sender
77 */
78typedef void (*cld80211_cb)(const void *data, int data_len,
79 void *cb_ctx, int pid);
80
81/**
82 * register_cld_cmd_cb() - Allows cld driver to register for commands with
83 * callback
84 * @cmd_id: Command to be registered. Valid range [1, CLD80211_MAX_COMMANDS]
85 * @cb: Callback to be called when an nlmsg is received with cmd_id command
86 * from userspace
87 * @cb_ctx: context provided by driver; Send this as cb_ctx of func()
88 * to driver
89 */
90int register_cld_cmd_cb(u8 cmd_id, cld80211_cb cb, void *cb_ctx);
91
92/**
93 * deregister_cld_cmd_cb() - Allows cld driver to de-register the command it
94 * has already registered
95 * @cmd_id: Command to be deregistered.
96 */
97int deregister_cld_cmd_cb(u8 cmd_id);
98
99/**
100 * cld80211_get_genl_family() - Returns current netlink family context
101 */
102struct genl_family *cld80211_get_genl_family(void);
103
104#endif /* _NET_CNSS_GENETLINK_H_ */