1 /* 2 * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 /** 20 * DOC: declares driver functions interfacing with linux kernel 21 */ 22 23 24 #ifndef _WLAN_CFG80211_H_ 25 #define _WLAN_CFG80211_H_ 26 27 #include <linux/version.h> 28 #include <linux/netdevice.h> 29 #include <net/netlink.h> 30 #include <net/cfg80211.h> 31 #include <qca_vendor.h> 32 33 #define cfg80211_alert(params...) \ 34 QDF_TRACE_FATAL(QDF_MODULE_ID_OS_IF, params) 35 #define cfg80211_err(params...) \ 36 QDF_TRACE_ERROR(QDF_MODULE_ID_OS_IF, params) 37 #define cfg80211_warn(params...) \ 38 QDF_TRACE_WARN(QDF_MODULE_ID_OS_IF, params) 39 #define cfg80211_notice(params...) \ 40 QDF_TRACE_INFO(QDF_MODULE_ID_OS_IF, params) 41 #define cfg80211_info(params...) \ 42 QDF_TRACE_INFO(QDF_MODULE_ID_OS_IF, params) 43 #define cfg80211_debug(params...) \ 44 QDF_TRACE_DEBUG(QDF_MODULE_ID_OS_IF, params) 45 46 #define COMMON_VENDOR_COMMANDS \ 47 { \ 48 .info.vendor_id = OUI_QCA, \ 49 .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION,\ 50 .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ 51 WIPHY_VENDOR_CMD_NEED_NETDEV, \ 52 .doit = NULL \ 53 }, \ 54 { \ 55 .info.vendor_id = OUI_QCA, \ 56 .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION,\ 57 .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ 58 WIPHY_VENDOR_CMD_NEED_NETDEV, \ 59 .doit = NULL \ 60 }, 61 62 #undef nla_parse 63 #undef nla_parse_nested 64 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) 65 static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, 66 int maxtype, 67 const struct nlattr *head, 68 int len, 69 const struct nla_policy *policy) 70 { 71 return nla_parse(tb, maxtype, head, len, policy); 72 } 73 74 static inline int 75 wlan_cfg80211_nla_parse_nested(struct nlattr *tb[], 76 int maxtype, 77 const struct nlattr *nla, 78 const struct nla_policy *policy) 79 { 80 return nla_parse_nested(tb, maxtype, nla, policy); 81 } 82 #else 83 static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, 84 int maxtype, 85 const struct nlattr *head, 86 int len, 87 const struct nla_policy *policy) 88 { 89 return nla_parse(tb, maxtype, head, len, policy, NULL); 90 } 91 92 static inline int 93 wlan_cfg80211_nla_parse_nested(struct nlattr *tb[], 94 int maxtype, 95 const struct nlattr *nla, 96 const struct nla_policy *policy) 97 { 98 return nla_parse_nested(tb, maxtype, nla, policy, NULL); 99 } 100 #endif 101 #define nla_parse(...) (obsolete, use wlan_cfg80211_nla_parse) 102 #define nla_parse_nested(...) (obsolete, use wlan_cfg80211_nla_parse_nested) 103 104 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) 105 static inline int 106 wlan_cfg80211_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) 107 { 108 return nla_put_u64(skb, attrtype, value); 109 } 110 #else 111 static inline int 112 wlan_cfg80211_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) 113 { 114 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD); 115 } 116 #endif 117 118 #endif 119