1 /*
2  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 /**
18  * DOC: wlan_hdd_coap.h
19  *
20  * Add Vendor subcommand QCA_NL80211_VENDOR_SUBCMD_COAP_OFFLOAD
21  */
22 
23 #ifndef __WLAN_HDD_COAP_H
24 #define __WLAN_HDD_COAP_H
25 
26 #ifdef WLAN_FEATURE_COAP
27 #include <net/cfg80211.h>
28 
29 /**
30  * wlan_hdd_cfg80211_coap_offload() - configure CoAP offloading
31  * @wiphy: pointer to wireless wiphy structure.
32  * @wdev: pointer to wireless_dev structure.
33  * @data: pointer to netlink TLV buffer
34  * @data_len: the length of @data in bytes
35  *
36  * Return: An error code or 0 on success.
37  */
38 int wlan_hdd_cfg80211_coap_offload(struct wiphy *wiphy,
39 				   struct wireless_dev *wdev,
40 				   const void *data, int data_len);
41 
42 extern const struct nla_policy
43 	coap_offload_policy[QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_MAX + 1];
44 
45 #define FEATURE_COAP_OFFLOAD_COMMANDS					\
46 {									\
47 	.info.vendor_id = QCA_NL80211_VENDOR_ID,			\
48 	.info.subcmd = QCA_NL80211_VENDOR_SUBCMD_COAP_OFFLOAD,		\
49 	.flags = WIPHY_VENDOR_CMD_NEED_WDEV |				\
50 		WIPHY_VENDOR_CMD_NEED_NETDEV |				\
51 		WIPHY_VENDOR_CMD_NEED_RUNNING,				\
52 	.doit = wlan_hdd_cfg80211_coap_offload,				\
53 	vendor_command_policy(coap_offload_policy,			\
54 			      QCA_WLAN_VENDOR_ATTR_COAP_OFFLOAD_MAX)	\
55 },
56 #else /* WLAN_FEATURE_COAP */
57 #define FEATURE_COAP_OFFLOAD_COMMANDS
58 #endif /* WLAN_FEATURE_COAP */
59 
60 #endif /* __WLAN_HDD_COAP_H */
61