| .. | .. |
|---|
| 1 | | -/* |
|---|
| 2 | | - * Copyright (c) 2015-2016 Quantenna Communications, Inc. |
|---|
| 3 | | - * All rights reserved. |
|---|
| 4 | | - * |
|---|
| 5 | | - * This program is free software; you can redistribute it and/or |
|---|
| 6 | | - * modify it under the terms of the GNU General Public License |
|---|
| 7 | | - * as published by the Free Software Foundation; either version 2 |
|---|
| 8 | | - * of the License, or (at your option) any later version. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - */ |
|---|
| 1 | +/* SPDX-License-Identifier: GPL-2.0+ */ |
|---|
| 2 | +/* Copyright (c) 2015-2016 Quantenna Communications. All rights reserved. */ |
|---|
| 16 | 3 | |
|---|
| 17 | 4 | #ifndef _QTN_FMAC_CORE_H_ |
|---|
| 18 | 5 | #define _QTN_FMAC_CORE_H_ |
|---|
| .. | .. |
|---|
| 33 | 20 | #include <linux/ctype.h> |
|---|
| 34 | 21 | #include <linux/workqueue.h> |
|---|
| 35 | 22 | #include <linux/slab.h> |
|---|
| 23 | +#include <linux/platform_device.h> |
|---|
| 36 | 24 | |
|---|
| 37 | 25 | #include "qlink.h" |
|---|
| 38 | 26 | #include "trans.h" |
|---|
| 27 | +#include "qlink_util.h" |
|---|
| 39 | 28 | |
|---|
| 40 | 29 | #undef pr_fmt |
|---|
| 41 | 30 | #define pr_fmt(fmt) KBUILD_MODNAME ": %s: " fmt, __func__ |
|---|
| .. | .. |
|---|
| 64 | 53 | atomic_t size; |
|---|
| 65 | 54 | }; |
|---|
| 66 | 55 | |
|---|
| 67 | | -enum qtnf_sta_state { |
|---|
| 68 | | - QTNF_STA_DISCONNECTED, |
|---|
| 69 | | - QTNF_STA_CONNECTING, |
|---|
| 70 | | - QTNF_STA_CONNECTED |
|---|
| 71 | | -}; |
|---|
| 72 | | - |
|---|
| 73 | 56 | struct qtnf_vif { |
|---|
| 74 | 57 | struct wireless_dev wdev; |
|---|
| 75 | 58 | u8 bssid[ETH_ALEN]; |
|---|
| .. | .. |
|---|
| 77 | 60 | u8 vifid; |
|---|
| 78 | 61 | u8 bss_priority; |
|---|
| 79 | 62 | u8 bss_status; |
|---|
| 80 | | - enum qtnf_sta_state sta_state; |
|---|
| 81 | 63 | u16 mgmt_frames_bitmask; |
|---|
| 82 | 64 | struct net_device *netdev; |
|---|
| 83 | 65 | struct qtnf_wmac *mac; |
|---|
| 84 | 66 | |
|---|
| 85 | 67 | struct work_struct reset_work; |
|---|
| 68 | + struct work_struct high_pri_tx_work; |
|---|
| 69 | + struct sk_buff_head high_pri_tx_queue; |
|---|
| 86 | 70 | struct qtnf_sta_list sta_list; |
|---|
| 87 | 71 | unsigned long cons_tx_timeout_cnt; |
|---|
| 88 | 72 | int generation; |
|---|
| .. | .. |
|---|
| 92 | 76 | |
|---|
| 93 | 77 | struct qtnf_mac_info { |
|---|
| 94 | 78 | u8 bands_cap; |
|---|
| 95 | | - u8 dev_mac[ETH_ALEN]; |
|---|
| 96 | 79 | u8 num_tx_chain; |
|---|
| 97 | 80 | u8 num_rx_chain; |
|---|
| 98 | 81 | u16 max_ap_assoc_sta; |
|---|
| .. | .. |
|---|
| 102 | 85 | u8 sretry_limit; |
|---|
| 103 | 86 | u8 coverage_class; |
|---|
| 104 | 87 | u8 radar_detect_widths; |
|---|
| 105 | | - u32 max_acl_mac_addrs; |
|---|
| 88 | + u8 max_scan_ssids; |
|---|
| 89 | + u16 max_acl_mac_addrs; |
|---|
| 106 | 90 | struct ieee80211_ht_cap ht_cap_mod_mask; |
|---|
| 107 | 91 | struct ieee80211_vht_cap vht_cap_mod_mask; |
|---|
| 108 | 92 | struct ieee80211_iface_combination *if_comb; |
|---|
| .. | .. |
|---|
| 111 | 95 | u8 *extended_capabilities_mask; |
|---|
| 112 | 96 | u8 extended_capabilities_len; |
|---|
| 113 | 97 | struct wiphy_wowlan_support *wowlan; |
|---|
| 114 | | -}; |
|---|
| 115 | | - |
|---|
| 116 | | -struct qtnf_chan_stats { |
|---|
| 117 | | - u32 chan_num; |
|---|
| 118 | | - u32 cca_tx; |
|---|
| 119 | | - u32 cca_rx; |
|---|
| 120 | | - u32 cca_busy; |
|---|
| 121 | | - u32 cca_try; |
|---|
| 122 | | - s8 chan_noise; |
|---|
| 123 | 98 | }; |
|---|
| 124 | 99 | |
|---|
| 125 | 100 | struct qtnf_wmac { |
|---|
| .. | .. |
|---|
| 132 | 107 | struct cfg80211_scan_request *scan_req; |
|---|
| 133 | 108 | struct mutex mac_lock; /* lock during wmac speicific ops */ |
|---|
| 134 | 109 | struct delayed_work scan_timeout; |
|---|
| 110 | + struct ieee80211_regdomain *rd; |
|---|
| 111 | + struct platform_device *pdev; |
|---|
| 135 | 112 | }; |
|---|
| 136 | 113 | |
|---|
| 137 | 114 | struct qtnf_hw_info { |
|---|
| 138 | | - u16 ql_proto_ver; |
|---|
| 115 | + u32 ql_proto_ver; |
|---|
| 139 | 116 | u8 num_mac; |
|---|
| 140 | 117 | u8 mac_bitmap; |
|---|
| 141 | 118 | u32 fw_ver; |
|---|
| 142 | | - u32 hw_capab; |
|---|
| 143 | | - struct ieee80211_regdomain *rd; |
|---|
| 144 | 119 | u8 total_tx_chain; |
|---|
| 145 | 120 | u8 total_rx_chain; |
|---|
| 146 | 121 | char fw_version[ETHTOOL_FWVERS_LEN]; |
|---|
| 147 | 122 | u32 hw_version; |
|---|
| 148 | | - u8 max_scan_ssids; |
|---|
| 123 | + u8 hw_capab[QLINK_HW_CAPAB_NUM / BITS_PER_BYTE + 1]; |
|---|
| 149 | 124 | }; |
|---|
| 150 | 125 | |
|---|
| 151 | 126 | struct qtnf_vif *qtnf_mac_get_free_vif(struct qtnf_wmac *mac); |
|---|
| 152 | 127 | struct qtnf_vif *qtnf_mac_get_base_vif(struct qtnf_wmac *mac); |
|---|
| 153 | 128 | void qtnf_mac_iface_comb_free(struct qtnf_wmac *mac); |
|---|
| 154 | 129 | void qtnf_mac_ext_caps_free(struct qtnf_wmac *mac); |
|---|
| 155 | | -struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus); |
|---|
| 130 | +bool qtnf_slave_radar_get(void); |
|---|
| 131 | +bool qtnf_dfs_offload_get(void); |
|---|
| 132 | +struct wiphy *qtnf_wiphy_allocate(struct qtnf_bus *bus, |
|---|
| 133 | + struct platform_device *pdev); |
|---|
| 156 | 134 | int qtnf_core_net_attach(struct qtnf_wmac *mac, struct qtnf_vif *priv, |
|---|
| 157 | 135 | const char *name, unsigned char name_assign_type); |
|---|
| 158 | 136 | void qtnf_main_work_queue(struct work_struct *work); |
|---|
| 159 | 137 | int qtnf_cmd_send_update_phy_params(struct qtnf_wmac *mac, u32 changed); |
|---|
| 160 | | -int qtnf_cmd_send_get_phy_params(struct qtnf_wmac *mac); |
|---|
| 161 | 138 | |
|---|
| 162 | 139 | struct qtnf_wmac *qtnf_core_get_mac(const struct qtnf_bus *bus, u8 macid); |
|---|
| 163 | 140 | struct net_device *qtnf_classify_skb(struct qtnf_bus *bus, struct sk_buff *skb); |
|---|
| .. | .. |
|---|
| 169 | 146 | |
|---|
| 170 | 147 | void qtnf_netdev_updown(struct net_device *ndev, bool up); |
|---|
| 171 | 148 | void qtnf_scan_done(struct qtnf_wmac *mac, bool aborted); |
|---|
| 149 | +struct dentry *qtnf_get_debugfs_dir(void); |
|---|
| 150 | +bool qtnf_netdev_is_qtn(const struct net_device *ndev); |
|---|
| 172 | 151 | |
|---|
| 173 | 152 | static inline struct qtnf_vif *qtnf_netdev_get_priv(struct net_device *dev) |
|---|
| 174 | 153 | { |
|---|
| 175 | 154 | return *((void **)netdev_priv(dev)); |
|---|
| 176 | 155 | } |
|---|
| 177 | 156 | |
|---|
| 157 | +static inline bool qtnf_hwcap_is_set(const struct qtnf_hw_info *info, |
|---|
| 158 | + unsigned int bit) |
|---|
| 159 | +{ |
|---|
| 160 | + return qtnf_utils_is_bit_set(info->hw_capab, bit, |
|---|
| 161 | + sizeof(info->hw_capab)); |
|---|
| 162 | +} |
|---|
| 163 | + |
|---|
| 178 | 164 | #endif /* _QTN_FMAC_CORE_H_ */ |
|---|