1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
// SPDX-License-Identifier: GPL-2.0-only
/*
* mac80211_hwsim - software simulator of 802.11 radio(s) for mac80211
* Copyright (c) 2008, Jouni Malinen <j@w1.fi>
* Copyright (c) 2011, Javier Lopez <jlopex@gmail.com>
* Copyright (c) 2016 - 2017 Intel Deutschland GmbH
* Copyright (C) 2018 - 2026 Intel Corporation
*/
#ifndef __MAC80211_HWSIM_I_H
#define __MAC80211_HWSIM_I_H
#include <net/mac80211.h>
#include "mac80211_hwsim.h"
#include "mac80211_hwsim_nan.h"
struct hwsim_sta_nan_sched {
/* Later members are protected by this lock */
spinlock_t lock;
u16 committed_dw;
struct {
u8 map_id;
struct cfg80211_chan_def chans[CFG80211_NAN_SCHED_NUM_TIME_SLOTS];
} maps[CFG80211_NAN_MAX_PEER_MAPS];
};
struct hwsim_sta_priv {
u32 magic;
unsigned int last_link;
u16 active_links_rx;
/* NAN peer schedule - must be accessed under nan_sched.lock */
struct hwsim_sta_nan_sched nan_sched;
};
#define HWSIM_STA_MAGIC 0x6d537749
struct mac80211_hwsim_link_data {
u32 link_id;
u64 beacon_int /* beacon interval in us */;
struct hrtimer beacon_timer;
};
#define HWSIM_NUM_CHANNELS_2GHZ 14
#define HWSIM_NUM_CHANNELS_5GHZ 40
#define HWSIM_NUM_CHANNELS_6GHZ 59
#define HWSIM_NUM_S1G_CHANNELS_US 51
#define HWSIM_NUM_RATES 12
#define HWSIM_NUM_CIPHERS 11
struct mac80211_hwsim_data {
struct list_head list;
struct rhash_head rht;
struct ieee80211_hw *hw;
struct device *dev;
struct ieee80211_supported_band bands[NUM_NL80211_BANDS];
struct ieee80211_channel channels_2ghz[HWSIM_NUM_CHANNELS_2GHZ];
struct ieee80211_channel channels_5ghz[HWSIM_NUM_CHANNELS_5GHZ];
struct ieee80211_channel channels_6ghz[HWSIM_NUM_CHANNELS_6GHZ];
struct ieee80211_channel channels_s1g[HWSIM_NUM_S1G_CHANNELS_US];
struct ieee80211_rate rates[HWSIM_NUM_RATES];
struct ieee80211_iface_combination if_combination;
struct ieee80211_iface_limit if_limits[5];
int n_if_limits;
/* Storage space for channels, etc. */
struct mac80211_hwsim_phy_data *phy_data;
struct ieee80211_iface_combination if_combination_radio;
struct wiphy_radio_freq_range radio_range[NUM_NL80211_BANDS];
struct wiphy_radio radio[NUM_NL80211_BANDS];
u32 ciphers[HWSIM_NUM_CIPHERS];
struct mac_address addresses[3];
int channels, idx;
bool use_chanctx;
bool destroy_on_close;
u32 portid;
char alpha2[2];
const struct ieee80211_regdomain *regd;
struct ieee80211_channel *tmp_chan;
struct ieee80211_channel *roc_chan;
u32 roc_duration;
struct delayed_work roc_start;
struct delayed_work roc_done;
struct delayed_work hw_scan;
struct cfg80211_scan_request *hw_scan_request;
struct ieee80211_vif *hw_scan_vif;
int scan_chan_idx;
u8 scan_addr[ETH_ALEN];
struct {
struct ieee80211_channel *channel;
unsigned long next_start, start, end;
} survey_data[HWSIM_NUM_CHANNELS_2GHZ +
HWSIM_NUM_CHANNELS_5GHZ +
HWSIM_NUM_CHANNELS_6GHZ];
struct ieee80211_channel *channel;
enum nl80211_chan_width bw;
unsigned int rx_filter;
bool started, idle, scanning;
struct mutex mutex;
enum ps_mode {
PS_DISABLED, PS_ENABLED, PS_AUTO_POLL, PS_MANUAL_POLL
} ps;
bool ps_poll_pending;
struct dentry *debugfs;
struct cfg80211_chan_def radar_background_chandef;
atomic_t pending_cookie;
struct sk_buff_head pending; /* packets pending */
/*
* Only radios in the same group can communicate together (the
* channel has to match too). Each bit represents a group. A
* radio can be in more than one group.
*/
u64 group;
/* group shared by radios created in the same netns */
int netgroup;
/* wmediumd portid responsible for netgroup of this radio */
u32 wmediumd;
/* difference between this hw's clock and the real clock, in usecs */
spinlock_t tsf_offset_lock;
s64 tsf_offset;
/* Stats */
u64 tx_pkts;
u64 rx_pkts;
u64 tx_bytes;
u64 rx_bytes;
u64 tx_dropped;
u64 tx_failed;
/* RSSI in rx status of the receiver */
int rx_rssi;
/* only used when pmsr capability is supplied */
struct cfg80211_pmsr_capabilities pmsr_capa;
struct cfg80211_pmsr_request *pmsr_request;
struct wireless_dev *pmsr_request_wdev;
struct mac80211_hwsim_link_data link_data[IEEE80211_MLD_MAX_NUM_LINKS];
struct mac80211_hwsim_nan_data nan;
};
extern spinlock_t hwsim_radio_lock;
extern struct list_head hwsim_radios;
ktime_t mac80211_hwsim_tsf_to_boottime(struct mac80211_hwsim_data *data,
u64 tsf);
u64 mac80211_hwsim_boottime_to_tsf(struct mac80211_hwsim_data *data,
ktime_t ts);
u64 mac80211_hwsim_get_tsf(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
void mac80211_hwsim_tx_frame(struct ieee80211_hw *hw,
struct sk_buff *skb,
struct ieee80211_channel *chan);
void ieee80211_hwsim_wake_tx_queue(struct ieee80211_hw *hw,
struct ieee80211_txq *txq);
#endif /* __MAC80211_HWSIM_I_H */
|