1 /* 2 * Copyright (c) 2016-2019 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 #define cfg80211_debug_rl(params...) \ 46 QDF_TRACE_DEBUG_RL(QDF_MODULE_ID_OS_IF, params) 47 48 #define COMMON_VENDOR_COMMANDS \ 49 { \ 50 .info.vendor_id = OUI_QCA, \ 51 .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_SET_WIFI_CONFIGURATION,\ 52 .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ 53 WIPHY_VENDOR_CMD_NEED_NETDEV, \ 54 .doit = NULL \ 55 }, \ 56 { \ 57 .info.vendor_id = OUI_QCA, \ 58 .info.subcmd = QCA_NL80211_VENDOR_SUBCMD_GET_WIFI_CONFIGURATION,\ 59 .flags = WIPHY_VENDOR_CMD_NEED_WDEV | \ 60 WIPHY_VENDOR_CMD_NEED_NETDEV, \ 61 .doit = NULL \ 62 }, 63 64 #undef nla_parse 65 #undef nla_parse_nested 66 #if LINUX_VERSION_CODE < KERNEL_VERSION(4, 12, 0) 67 static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, 68 int maxtype, 69 const struct nlattr *head, 70 int len, 71 const struct nla_policy *policy) 72 { 73 return nla_parse(tb, maxtype, head, len, policy); 74 } 75 76 static inline int 77 wlan_cfg80211_nla_parse_nested(struct nlattr *tb[], 78 int maxtype, 79 const struct nlattr *nla, 80 const struct nla_policy *policy) 81 { 82 return nla_parse_nested(tb, maxtype, nla, policy); 83 } 84 #else 85 static inline int wlan_cfg80211_nla_parse(struct nlattr **tb, 86 int maxtype, 87 const struct nlattr *head, 88 int len, 89 const struct nla_policy *policy) 90 { 91 return nla_parse(tb, maxtype, head, len, policy, NULL); 92 } 93 94 static inline int 95 wlan_cfg80211_nla_parse_nested(struct nlattr *tb[], 96 int maxtype, 97 const struct nlattr *nla, 98 const struct nla_policy *policy) 99 { 100 return nla_parse_nested(tb, maxtype, nla, policy, NULL); 101 } 102 #endif 103 #define nla_parse(...) (obsolete, use wlan_cfg80211_nla_parse) 104 #define nla_parse_nested(...) (obsolete, use wlan_cfg80211_nla_parse_nested) 105 106 #if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 7, 0)) 107 static inline int 108 wlan_cfg80211_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) 109 { 110 return nla_put_u64(skb, attrtype, value); 111 } 112 #else 113 static inline int 114 wlan_cfg80211_nla_put_u64(struct sk_buff *skb, int attrtype, u64 value) 115 { 116 return nla_put_u64_64bit(skb, attrtype, value, NL80211_ATTR_PAD); 117 } 118 #endif 119 120 #endif 121