Commit 1b8ec87a authored by Zhao, Gang's avatar Zhao, Gang Committed by Johannes Berg

cfg80211: change registered device pointer name

Name "dev" is too common and ambiguous, let all the pointer name
pointing to struct cfg80211_registered_device be "rdev". This can
improve code readability and consistency(since other places have
already called it rdev).
Signed-off-by: default avatarZhao, Gang <gamerh2o@gmail.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 308f7fcf
...@@ -251,8 +251,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev, ...@@ -251,8 +251,8 @@ int cfg80211_dev_rename(struct cfg80211_registered_device *rdev,
void ieee80211_set_bitrate_flags(struct wiphy *wiphy); void ieee80211_set_bitrate_flags(struct wiphy *wiphy);
void cfg80211_bss_expire(struct cfg80211_registered_device *dev); void cfg80211_bss_expire(struct cfg80211_registered_device *rdev);
void cfg80211_bss_age(struct cfg80211_registered_device *dev, void cfg80211_bss_age(struct cfg80211_registered_device *rdev,
unsigned long age_secs); unsigned long age_secs);
/* IBSS */ /* IBSS */
......
...@@ -1013,42 +1013,42 @@ static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev, ...@@ -1013,42 +1013,42 @@ static int nl80211_send_wowlan_tcp_caps(struct cfg80211_registered_device *rdev,
} }
static int nl80211_send_wowlan(struct sk_buff *msg, static int nl80211_send_wowlan(struct sk_buff *msg,
struct cfg80211_registered_device *dev, struct cfg80211_registered_device *rdev,
bool large) bool large)
{ {
struct nlattr *nl_wowlan; struct nlattr *nl_wowlan;
if (!dev->wiphy.wowlan) if (!rdev->wiphy.wowlan)
return 0; return 0;
nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED); nl_wowlan = nla_nest_start(msg, NL80211_ATTR_WOWLAN_TRIGGERS_SUPPORTED);
if (!nl_wowlan) if (!nl_wowlan)
return -ENOBUFS; return -ENOBUFS;
if (((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) && if (((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_ANY) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_ANY)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_DISCONNECT) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_DISCONNECT)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_MAGIC_PKT) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_MAGIC_PKT)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_SUPPORTS_GTK_REKEY) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_SUPPORTED)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_GTK_REKEY_FAILURE) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_GTK_REKEY_FAILURE)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_EAP_IDENTITY_REQ) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_EAP_IDENT_REQUEST)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_4WAY_HANDSHAKE) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) || nla_put_flag(msg, NL80211_WOWLAN_TRIG_4WAY_HANDSHAKE)) ||
((dev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) && ((rdev->wiphy.wowlan->flags & WIPHY_WOWLAN_RFKILL_RELEASE) &&
nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE))) nla_put_flag(msg, NL80211_WOWLAN_TRIG_RFKILL_RELEASE)))
return -ENOBUFS; return -ENOBUFS;
if (dev->wiphy.wowlan->n_patterns) { if (rdev->wiphy.wowlan->n_patterns) {
struct nl80211_pattern_support pat = { struct nl80211_pattern_support pat = {
.max_patterns = dev->wiphy.wowlan->n_patterns, .max_patterns = rdev->wiphy.wowlan->n_patterns,
.min_pattern_len = dev->wiphy.wowlan->pattern_min_len, .min_pattern_len = rdev->wiphy.wowlan->pattern_min_len,
.max_pattern_len = dev->wiphy.wowlan->pattern_max_len, .max_pattern_len = rdev->wiphy.wowlan->pattern_max_len,
.max_pkt_offset = dev->wiphy.wowlan->max_pkt_offset, .max_pkt_offset = rdev->wiphy.wowlan->max_pkt_offset,
}; };
if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN, if (nla_put(msg, NL80211_WOWLAN_TRIG_PKT_PATTERN,
...@@ -1056,7 +1056,7 @@ static int nl80211_send_wowlan(struct sk_buff *msg, ...@@ -1056,7 +1056,7 @@ static int nl80211_send_wowlan(struct sk_buff *msg,
return -ENOBUFS; return -ENOBUFS;
} }
if (large && nl80211_send_wowlan_tcp_caps(dev, msg)) if (large && nl80211_send_wowlan_tcp_caps(rdev, msg))
return -ENOBUFS; return -ENOBUFS;
nla_nest_end(msg, nl_wowlan); nla_nest_end(msg, nl_wowlan);
...@@ -1066,19 +1066,19 @@ static int nl80211_send_wowlan(struct sk_buff *msg, ...@@ -1066,19 +1066,19 @@ static int nl80211_send_wowlan(struct sk_buff *msg,
#endif #endif
static int nl80211_send_coalesce(struct sk_buff *msg, static int nl80211_send_coalesce(struct sk_buff *msg,
struct cfg80211_registered_device *dev) struct cfg80211_registered_device *rdev)
{ {
struct nl80211_coalesce_rule_support rule; struct nl80211_coalesce_rule_support rule;
if (!dev->wiphy.coalesce) if (!rdev->wiphy.coalesce)
return 0; return 0;
rule.max_rules = dev->wiphy.coalesce->n_rules; rule.max_rules = rdev->wiphy.coalesce->n_rules;
rule.max_delay = dev->wiphy.coalesce->max_delay; rule.max_delay = rdev->wiphy.coalesce->max_delay;
rule.pat.max_patterns = dev->wiphy.coalesce->n_patterns; rule.pat.max_patterns = rdev->wiphy.coalesce->n_patterns;
rule.pat.min_pattern_len = dev->wiphy.coalesce->pattern_min_len; rule.pat.min_pattern_len = rdev->wiphy.coalesce->pattern_min_len;
rule.pat.max_pattern_len = dev->wiphy.coalesce->pattern_max_len; rule.pat.max_pattern_len = rdev->wiphy.coalesce->pattern_max_len;
rule.pat.max_pkt_offset = dev->wiphy.coalesce->max_pkt_offset; rule.pat.max_pkt_offset = rdev->wiphy.coalesce->max_pkt_offset;
if (nla_put(msg, NL80211_ATTR_COALESCE_RULE, sizeof(rule), &rule)) if (nla_put(msg, NL80211_ATTR_COALESCE_RULE, sizeof(rule), &rule))
return -ENOBUFS; return -ENOBUFS;
...@@ -1209,7 +1209,7 @@ struct nl80211_dump_wiphy_state { ...@@ -1209,7 +1209,7 @@ struct nl80211_dump_wiphy_state {
bool split; bool split;
}; };
static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, static int nl80211_send_wiphy(struct cfg80211_registered_device *rdev,
struct sk_buff *msg, u32 portid, u32 seq, struct sk_buff *msg, u32 portid, u32 seq,
int flags, struct nl80211_dump_wiphy_state *state) int flags, struct nl80211_dump_wiphy_state *state)
{ {
...@@ -1221,7 +1221,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1221,7 +1221,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
int i; int i;
const struct ieee80211_txrx_stypes *mgmt_stypes = const struct ieee80211_txrx_stypes *mgmt_stypes =
dev->wiphy.mgmt_stypes; rdev->wiphy.mgmt_stypes;
u32 features; u32 features;
hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_WIPHY); hdr = nl80211hdr_put(msg, portid, seq, flags, NL80211_CMD_NEW_WIPHY);
...@@ -1231,9 +1231,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1231,9 +1231,9 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (WARN_ON(!state)) if (WARN_ON(!state))
return -EINVAL; return -EINVAL;
if (nla_put_u32(msg, NL80211_ATTR_WIPHY, dev->wiphy_idx) || if (nla_put_u32(msg, NL80211_ATTR_WIPHY, rdev->wiphy_idx) ||
nla_put_string(msg, NL80211_ATTR_WIPHY_NAME, nla_put_string(msg, NL80211_ATTR_WIPHY_NAME,
wiphy_name(&dev->wiphy)) || wiphy_name(&rdev->wiphy)) ||
nla_put_u32(msg, NL80211_ATTR_GENERATION, nla_put_u32(msg, NL80211_ATTR_GENERATION,
cfg80211_rdev_list_generation)) cfg80211_rdev_list_generation))
goto nla_put_failure; goto nla_put_failure;
...@@ -1241,43 +1241,43 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1241,43 +1241,43 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
switch (state->split_start) { switch (state->split_start) {
case 0: case 0:
if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT, if (nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_SHORT,
dev->wiphy.retry_short) || rdev->wiphy.retry_short) ||
nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG, nla_put_u8(msg, NL80211_ATTR_WIPHY_RETRY_LONG,
dev->wiphy.retry_long) || rdev->wiphy.retry_long) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD, nla_put_u32(msg, NL80211_ATTR_WIPHY_FRAG_THRESHOLD,
dev->wiphy.frag_threshold) || rdev->wiphy.frag_threshold) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD, nla_put_u32(msg, NL80211_ATTR_WIPHY_RTS_THRESHOLD,
dev->wiphy.rts_threshold) || rdev->wiphy.rts_threshold) ||
nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS, nla_put_u8(msg, NL80211_ATTR_WIPHY_COVERAGE_CLASS,
dev->wiphy.coverage_class) || rdev->wiphy.coverage_class) ||
nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS, nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCAN_SSIDS,
dev->wiphy.max_scan_ssids) || rdev->wiphy.max_scan_ssids) ||
nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS, nla_put_u8(msg, NL80211_ATTR_MAX_NUM_SCHED_SCAN_SSIDS,
dev->wiphy.max_sched_scan_ssids) || rdev->wiphy.max_sched_scan_ssids) ||
nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN, nla_put_u16(msg, NL80211_ATTR_MAX_SCAN_IE_LEN,
dev->wiphy.max_scan_ie_len) || rdev->wiphy.max_scan_ie_len) ||
nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN, nla_put_u16(msg, NL80211_ATTR_MAX_SCHED_SCAN_IE_LEN,
dev->wiphy.max_sched_scan_ie_len) || rdev->wiphy.max_sched_scan_ie_len) ||
nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS, nla_put_u8(msg, NL80211_ATTR_MAX_MATCH_SETS,
dev->wiphy.max_match_sets)) rdev->wiphy.max_match_sets))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) && if ((rdev->wiphy.flags & WIPHY_FLAG_IBSS_RSN) &&
nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN)) nla_put_flag(msg, NL80211_ATTR_SUPPORT_IBSS_RSN))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) && if ((rdev->wiphy.flags & WIPHY_FLAG_MESH_AUTH) &&
nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH)) nla_put_flag(msg, NL80211_ATTR_SUPPORT_MESH_AUTH))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) && if ((rdev->wiphy.flags & WIPHY_FLAG_AP_UAPSD) &&
nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD)) nla_put_flag(msg, NL80211_ATTR_SUPPORT_AP_UAPSD))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) && if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_FW_ROAM) &&
nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT)) nla_put_flag(msg, NL80211_ATTR_ROAM_SUPPORT))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) && if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) &&
nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT)) nla_put_flag(msg, NL80211_ATTR_TDLS_SUPPORT))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) && if ((rdev->wiphy.flags & WIPHY_FLAG_TDLS_EXTERNAL_SETUP) &&
nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP)) nla_put_flag(msg, NL80211_ATTR_TDLS_EXTERNAL_SETUP))
goto nla_put_failure; goto nla_put_failure;
state->split_start++; state->split_start++;
...@@ -1285,35 +1285,35 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1285,35 +1285,35 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
break; break;
case 1: case 1:
if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES, if (nla_put(msg, NL80211_ATTR_CIPHER_SUITES,
sizeof(u32) * dev->wiphy.n_cipher_suites, sizeof(u32) * rdev->wiphy.n_cipher_suites,
dev->wiphy.cipher_suites)) rdev->wiphy.cipher_suites))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS, if (nla_put_u8(msg, NL80211_ATTR_MAX_NUM_PMKIDS,
dev->wiphy.max_num_pmkids)) rdev->wiphy.max_num_pmkids))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) && if ((rdev->wiphy.flags & WIPHY_FLAG_CONTROL_PORT_PROTOCOL) &&
nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE)) nla_put_flag(msg, NL80211_ATTR_CONTROL_PORT_ETHERTYPE))
goto nla_put_failure; goto nla_put_failure;
if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX, if (nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_TX,
dev->wiphy.available_antennas_tx) || rdev->wiphy.available_antennas_tx) ||
nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX, nla_put_u32(msg, NL80211_ATTR_WIPHY_ANTENNA_AVAIL_RX,
dev->wiphy.available_antennas_rx)) rdev->wiphy.available_antennas_rx))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) && if ((rdev->wiphy.flags & WIPHY_FLAG_AP_PROBE_RESP_OFFLOAD) &&
nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD, nla_put_u32(msg, NL80211_ATTR_PROBE_RESP_OFFLOAD,
dev->wiphy.probe_resp_offload)) rdev->wiphy.probe_resp_offload))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.available_antennas_tx || if ((rdev->wiphy.available_antennas_tx ||
dev->wiphy.available_antennas_rx) && rdev->wiphy.available_antennas_rx) &&
dev->ops->get_antenna) { rdev->ops->get_antenna) {
u32 tx_ant = 0, rx_ant = 0; u32 tx_ant = 0, rx_ant = 0;
int res; int res;
res = rdev_get_antenna(dev, &tx_ant, &rx_ant); res = rdev_get_antenna(rdev, &tx_ant, &rx_ant);
if (!res) { if (!res) {
if (nla_put_u32(msg, if (nla_put_u32(msg,
NL80211_ATTR_WIPHY_ANTENNA_TX, NL80211_ATTR_WIPHY_ANTENNA_TX,
...@@ -1330,7 +1330,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1330,7 +1330,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
break; break;
case 2: case 2:
if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES, if (nl80211_put_iftypes(msg, NL80211_ATTR_SUPPORTED_IFTYPES,
dev->wiphy.interface_modes)) rdev->wiphy.interface_modes))
goto nla_put_failure; goto nla_put_failure;
state->split_start++; state->split_start++;
if (state->split) if (state->split)
...@@ -1344,7 +1344,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1344,7 +1344,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
band < IEEE80211_NUM_BANDS; band++) { band < IEEE80211_NUM_BANDS; band++) {
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
sband = dev->wiphy.bands[band]; sband = rdev->wiphy.bands[band];
if (!sband) if (!sband)
continue; continue;
...@@ -1421,7 +1421,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1421,7 +1421,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
i = 0; i = 0;
#define CMD(op, n) \ #define CMD(op, n) \
do { \ do { \
if (dev->ops->op) { \ if (rdev->ops->op) { \
i++; \ i++; \
if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \ if (nla_put_u32(msg, i, NL80211_CMD_ ## n)) \
goto nla_put_failure; \ goto nla_put_failure; \
...@@ -1445,32 +1445,32 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1445,32 +1445,32 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
CMD(set_pmksa, SET_PMKSA); CMD(set_pmksa, SET_PMKSA);
CMD(del_pmksa, DEL_PMKSA); CMD(del_pmksa, DEL_PMKSA);
CMD(flush_pmksa, FLUSH_PMKSA); CMD(flush_pmksa, FLUSH_PMKSA);
if (dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) if (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL)
CMD(remain_on_channel, REMAIN_ON_CHANNEL); CMD(remain_on_channel, REMAIN_ON_CHANNEL);
CMD(set_bitrate_mask, SET_TX_BITRATE_MASK); CMD(set_bitrate_mask, SET_TX_BITRATE_MASK);
CMD(mgmt_tx, FRAME); CMD(mgmt_tx, FRAME);
CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL); CMD(mgmt_tx_cancel_wait, FRAME_WAIT_CANCEL);
if (dev->wiphy.flags & WIPHY_FLAG_NETNS_OK) { if (rdev->wiphy.flags & WIPHY_FLAG_NETNS_OK) {
i++; i++;
if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS)) if (nla_put_u32(msg, i, NL80211_CMD_SET_WIPHY_NETNS))
goto nla_put_failure; goto nla_put_failure;
} }
if (dev->ops->set_monitor_channel || dev->ops->start_ap || if (rdev->ops->set_monitor_channel || rdev->ops->start_ap ||
dev->ops->join_mesh) { rdev->ops->join_mesh) {
i++; i++;
if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL)) if (nla_put_u32(msg, i, NL80211_CMD_SET_CHANNEL))
goto nla_put_failure; goto nla_put_failure;
} }
CMD(set_wds_peer, SET_WDS_PEER); CMD(set_wds_peer, SET_WDS_PEER);
if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) { if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_TDLS) {
CMD(tdls_mgmt, TDLS_MGMT); CMD(tdls_mgmt, TDLS_MGMT);
CMD(tdls_oper, TDLS_OPER); CMD(tdls_oper, TDLS_OPER);
} }
if (dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN) if (rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_SCHED_SCAN)
CMD(sched_scan_start, START_SCHED_SCAN); CMD(sched_scan_start, START_SCHED_SCAN);
CMD(probe_client, PROBE_CLIENT); CMD(probe_client, PROBE_CLIENT);
CMD(set_noack_map, SET_NOACK_MAP); CMD(set_noack_map, SET_NOACK_MAP);
if (dev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) { if (rdev->wiphy.flags & WIPHY_FLAG_REPORTS_OBSS) {
i++; i++;
if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS)) if (nla_put_u32(msg, i, NL80211_CMD_REGISTER_BEACONS))
goto nla_put_failure; goto nla_put_failure;
...@@ -1480,7 +1480,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1480,7 +1480,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (state->split) { if (state->split) {
CMD(crit_proto_start, CRIT_PROTOCOL_START); CMD(crit_proto_start, CRIT_PROTOCOL_START);
CMD(crit_proto_stop, CRIT_PROTOCOL_STOP); CMD(crit_proto_stop, CRIT_PROTOCOL_STOP);
if (dev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH) if (rdev->wiphy.flags & WIPHY_FLAG_HAS_CHANNEL_SWITCH)
CMD(channel_switch, CHANNEL_SWITCH); CMD(channel_switch, CHANNEL_SWITCH);
} }
CMD(set_qos_map, SET_QOS_MAP); CMD(set_qos_map, SET_QOS_MAP);
...@@ -1491,13 +1491,13 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1491,13 +1491,13 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
#undef CMD #undef CMD
if (dev->ops->connect || dev->ops->auth) { if (rdev->ops->connect || rdev->ops->auth) {
i++; i++;
if (nla_put_u32(msg, i, NL80211_CMD_CONNECT)) if (nla_put_u32(msg, i, NL80211_CMD_CONNECT))
goto nla_put_failure; goto nla_put_failure;
} }
if (dev->ops->disconnect || dev->ops->deauth) { if (rdev->ops->disconnect || rdev->ops->deauth) {
i++; i++;
if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT)) if (nla_put_u32(msg, i, NL80211_CMD_DISCONNECT))
goto nla_put_failure; goto nla_put_failure;
...@@ -1508,14 +1508,14 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1508,14 +1508,14 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (state->split) if (state->split)
break; break;
case 5: case 5:
if (dev->ops->remain_on_channel && if (rdev->ops->remain_on_channel &&
(dev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) && (rdev->wiphy.flags & WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL) &&
nla_put_u32(msg, nla_put_u32(msg,
NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION, NL80211_ATTR_MAX_REMAIN_ON_CHANNEL_DURATION,
dev->wiphy.max_remain_on_channel_duration)) rdev->wiphy.max_remain_on_channel_duration))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) && if ((rdev->wiphy.flags & WIPHY_FLAG_OFFCHAN_TX) &&
nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK)) nla_put_flag(msg, NL80211_ATTR_OFFCHANNEL_TX_OK))
goto nla_put_failure; goto nla_put_failure;
...@@ -1526,7 +1526,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1526,7 +1526,7 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
break; break;
case 6: case 6:
#ifdef CONFIG_PM #ifdef CONFIG_PM
if (nl80211_send_wowlan(msg, dev, state->split)) if (nl80211_send_wowlan(msg, rdev, state->split))
goto nla_put_failure; goto nla_put_failure;
state->split_start++; state->split_start++;
if (state->split) if (state->split)
...@@ -1536,10 +1536,10 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1536,10 +1536,10 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
#endif #endif
case 7: case 7:
if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES, if (nl80211_put_iftypes(msg, NL80211_ATTR_SOFTWARE_IFTYPES,
dev->wiphy.software_iftypes)) rdev->wiphy.software_iftypes))
goto nla_put_failure; goto nla_put_failure;
if (nl80211_put_iface_combinations(&dev->wiphy, msg, if (nl80211_put_iface_combinations(&rdev->wiphy, msg,
state->split)) state->split))
goto nla_put_failure; goto nla_put_failure;
...@@ -1547,12 +1547,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1547,12 +1547,12 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (state->split) if (state->split)
break; break;
case 8: case 8:
if ((dev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) && if ((rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME) &&
nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME, nla_put_u32(msg, NL80211_ATTR_DEVICE_AP_SME,
dev->wiphy.ap_sme_capa)) rdev->wiphy.ap_sme_capa))
goto nla_put_failure; goto nla_put_failure;
features = dev->wiphy.features; features = rdev->wiphy.features;
/* /*
* We can only add the per-channel limit information if the * We can only add the per-channel limit information if the
* dump is split, otherwise it makes it too big. Therefore * dump is split, otherwise it makes it too big. Therefore
...@@ -1563,16 +1563,16 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1563,16 +1563,16 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features)) if (nla_put_u32(msg, NL80211_ATTR_FEATURE_FLAGS, features))
goto nla_put_failure; goto nla_put_failure;
if (dev->wiphy.ht_capa_mod_mask && if (rdev->wiphy.ht_capa_mod_mask &&
nla_put(msg, NL80211_ATTR_HT_CAPABILITY_MASK, nla_put(msg, NL80211_ATTR_HT_CAPABILITY_MASK,
sizeof(*dev->wiphy.ht_capa_mod_mask), sizeof(*rdev->wiphy.ht_capa_mod_mask),
dev->wiphy.ht_capa_mod_mask)) rdev->wiphy.ht_capa_mod_mask))
goto nla_put_failure; goto nla_put_failure;
if (dev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME && if (rdev->wiphy.flags & WIPHY_FLAG_HAVE_AP_SME &&
dev->wiphy.max_acl_mac_addrs && rdev->wiphy.max_acl_mac_addrs &&
nla_put_u32(msg, NL80211_ATTR_MAC_ACL_MAX, nla_put_u32(msg, NL80211_ATTR_MAC_ACL_MAX,
dev->wiphy.max_acl_mac_addrs)) rdev->wiphy.max_acl_mac_addrs))
goto nla_put_failure; goto nla_put_failure;
/* /*
...@@ -1588,41 +1588,41 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1588,41 +1588,41 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
state->split_start++; state->split_start++;
break; break;
case 9: case 9:
if (dev->wiphy.extended_capabilities && if (rdev->wiphy.extended_capabilities &&
(nla_put(msg, NL80211_ATTR_EXT_CAPA, (nla_put(msg, NL80211_ATTR_EXT_CAPA,
dev->wiphy.extended_capabilities_len, rdev->wiphy.extended_capabilities_len,
dev->wiphy.extended_capabilities) || rdev->wiphy.extended_capabilities) ||
nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK, nla_put(msg, NL80211_ATTR_EXT_CAPA_MASK,
dev->wiphy.extended_capabilities_len, rdev->wiphy.extended_capabilities_len,
dev->wiphy.extended_capabilities_mask))) rdev->wiphy.extended_capabilities_mask)))
goto nla_put_failure; goto nla_put_failure;
if (dev->wiphy.vht_capa_mod_mask && if (rdev->wiphy.vht_capa_mod_mask &&
nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK, nla_put(msg, NL80211_ATTR_VHT_CAPABILITY_MASK,
sizeof(*dev->wiphy.vht_capa_mod_mask), sizeof(*rdev->wiphy.vht_capa_mod_mask),
dev->wiphy.vht_capa_mod_mask)) rdev->wiphy.vht_capa_mod_mask))
goto nla_put_failure; goto nla_put_failure;
state->split_start++; state->split_start++;
break; break;
case 10: case 10:
if (nl80211_send_coalesce(msg, dev)) if (nl80211_send_coalesce(msg, rdev))
goto nla_put_failure; goto nla_put_failure;
if ((dev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) && if ((rdev->wiphy.flags & WIPHY_FLAG_SUPPORTS_5_10_MHZ) &&
(nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) || (nla_put_flag(msg, NL80211_ATTR_SUPPORT_5_MHZ) ||
nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ))) nla_put_flag(msg, NL80211_ATTR_SUPPORT_10_MHZ)))
goto nla_put_failure; goto nla_put_failure;
if (dev->wiphy.max_ap_assoc_sta && if (rdev->wiphy.max_ap_assoc_sta &&
nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA, nla_put_u32(msg, NL80211_ATTR_MAX_AP_ASSOC_STA,
dev->wiphy.max_ap_assoc_sta)) rdev->wiphy.max_ap_assoc_sta))
goto nla_put_failure; goto nla_put_failure;
state->split_start++; state->split_start++;
break; break;
case 11: case 11:
if (dev->wiphy.n_vendor_commands) { if (rdev->wiphy.n_vendor_commands) {
const struct nl80211_vendor_cmd_info *info; const struct nl80211_vendor_cmd_info *info;
struct nlattr *nested; struct nlattr *nested;
...@@ -1630,15 +1630,15 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1630,15 +1630,15 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (!nested) if (!nested)
goto nla_put_failure; goto nla_put_failure;
for (i = 0; i < dev->wiphy.n_vendor_commands; i++) { for (i = 0; i < rdev->wiphy.n_vendor_commands; i++) {
info = &dev->wiphy.vendor_commands[i].info; info = &rdev->wiphy.vendor_commands[i].info;
if (nla_put(msg, i + 1, sizeof(*info), info)) if (nla_put(msg, i + 1, sizeof(*info), info))
goto nla_put_failure; goto nla_put_failure;
} }
nla_nest_end(msg, nested); nla_nest_end(msg, nested);
} }
if (dev->wiphy.n_vendor_events) { if (rdev->wiphy.n_vendor_events) {
const struct nl80211_vendor_cmd_info *info; const struct nl80211_vendor_cmd_info *info;
struct nlattr *nested; struct nlattr *nested;
...@@ -1647,8 +1647,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev, ...@@ -1647,8 +1647,8 @@ static int nl80211_send_wiphy(struct cfg80211_registered_device *dev,
if (!nested) if (!nested)
goto nla_put_failure; goto nla_put_failure;
for (i = 0; i < dev->wiphy.n_vendor_events; i++) { for (i = 0; i < rdev->wiphy.n_vendor_events; i++) {
info = &dev->wiphy.vendor_events[i]; info = &rdev->wiphy.vendor_events[i];
if (nla_put(msg, i + 1, sizeof(*info), info)) if (nla_put(msg, i + 1, sizeof(*info), info))
goto nla_put_failure; goto nla_put_failure;
} }
...@@ -1704,7 +1704,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1704,7 +1704,7 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
{ {
int idx = 0, ret; int idx = 0, ret;
struct nl80211_dump_wiphy_state *state = (void *)cb->args[0]; struct nl80211_dump_wiphy_state *state = (void *)cb->args[0];
struct cfg80211_registered_device *dev; struct cfg80211_registered_device *rdev;
rtnl_lock(); rtnl_lock();
if (!state) { if (!state) {
...@@ -1723,17 +1723,17 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb) ...@@ -1723,17 +1723,17 @@ static int nl80211_dump_wiphy(struct sk_buff *skb, struct netlink_callback *cb)
cb->args[0] = (long)state; cb->args[0] = (long)state;
} }
list_for_each_entry(dev, &cfg80211_rdev_list, list) { list_for_each_entry(rdev, &cfg80211_rdev_list, list) {
if (!net_eq(wiphy_net(&dev->wiphy), sock_net(skb->sk))) if (!net_eq(wiphy_net(&rdev->wiphy), sock_net(skb->sk)))
continue; continue;
if (++idx <= state->start) if (++idx <= state->start)
continue; continue;
if (state->filter_wiphy != -1 && if (state->filter_wiphy != -1 &&
state->filter_wiphy != dev->wiphy_idx) state->filter_wiphy != rdev->wiphy_idx)
continue; continue;
/* attempt to fit multiple wiphy data chunks into the skb */ /* attempt to fit multiple wiphy data chunks into the skb */
do { do {
ret = nl80211_send_wiphy(dev, skb, ret = nl80211_send_wiphy(rdev, skb,
NETLINK_CB(cb->skb).portid, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, cb->nlh->nlmsg_seq,
NLM_F_MULTI, state); NLM_F_MULTI, state);
...@@ -1781,14 +1781,14 @@ static int nl80211_dump_wiphy_done(struct netlink_callback *cb) ...@@ -1781,14 +1781,14 @@ static int nl80211_dump_wiphy_done(struct netlink_callback *cb)
static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info) static int nl80211_get_wiphy(struct sk_buff *skb, struct genl_info *info)
{ {
struct sk_buff *msg; struct sk_buff *msg;
struct cfg80211_registered_device *dev = info->user_ptr[0]; struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct nl80211_dump_wiphy_state state = {}; struct nl80211_dump_wiphy_state state = {};
msg = nlmsg_new(4096, GFP_KERNEL); msg = nlmsg_new(4096, GFP_KERNEL);
if (!msg) if (!msg)
return -ENOMEM; return -ENOMEM;
if (nl80211_send_wiphy(dev, msg, info->snd_portid, info->snd_seq, 0, if (nl80211_send_wiphy(rdev, msg, info->snd_portid, info->snd_seq, 0,
&state) < 0) { &state) < 0) {
nlmsg_free(msg); nlmsg_free(msg);
return -ENOBUFS; return -ENOBUFS;
...@@ -2362,7 +2362,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback * ...@@ -2362,7 +2362,7 @@ static int nl80211_dump_interface(struct sk_buff *skb, struct netlink_callback *
static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
{ {
struct sk_buff *msg; struct sk_buff *msg;
struct cfg80211_registered_device *dev = info->user_ptr[0]; struct cfg80211_registered_device *rdev = info->user_ptr[0];
struct wireless_dev *wdev = info->user_ptr[1]; struct wireless_dev *wdev = info->user_ptr[1];
msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL); msg = nlmsg_new(NLMSG_DEFAULT_SIZE, GFP_KERNEL);
...@@ -2370,7 +2370,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info) ...@@ -2370,7 +2370,7 @@ static int nl80211_get_interface(struct sk_buff *skb, struct genl_info *info)
return -ENOMEM; return -ENOMEM;
if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0, if (nl80211_send_iface(msg, info->snd_portid, info->snd_seq, 0,
dev, wdev) < 0) { rdev, wdev) < 0) {
nlmsg_free(msg); nlmsg_free(msg);
return -ENOBUFS; return -ENOBUFS;
} }
...@@ -3673,13 +3673,13 @@ static int nl80211_dump_station(struct sk_buff *skb, ...@@ -3673,13 +3673,13 @@ static int nl80211_dump_station(struct sk_buff *skb,
struct netlink_callback *cb) struct netlink_callback *cb)
{ {
struct station_info sinfo; struct station_info sinfo;
struct cfg80211_registered_device *dev; struct cfg80211_registered_device *rdev;
struct wireless_dev *wdev; struct wireless_dev *wdev;
u8 mac_addr[ETH_ALEN]; u8 mac_addr[ETH_ALEN];
int sta_idx = cb->args[2]; int sta_idx = cb->args[2];
int err; int err;
err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev); err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
if (err) if (err)
return err; return err;
...@@ -3688,14 +3688,14 @@ static int nl80211_dump_station(struct sk_buff *skb, ...@@ -3688,14 +3688,14 @@ static int nl80211_dump_station(struct sk_buff *skb,
goto out_err; goto out_err;
} }
if (!dev->ops->dump_station) { if (!rdev->ops->dump_station) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out_err; goto out_err;
} }
while (1) { while (1) {
memset(&sinfo, 0, sizeof(sinfo)); memset(&sinfo, 0, sizeof(sinfo));
err = rdev_dump_station(dev, wdev->netdev, sta_idx, err = rdev_dump_station(rdev, wdev->netdev, sta_idx,
mac_addr, &sinfo); mac_addr, &sinfo);
if (err == -ENOENT) if (err == -ENOENT)
break; break;
...@@ -3705,7 +3705,7 @@ static int nl80211_dump_station(struct sk_buff *skb, ...@@ -3705,7 +3705,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
if (nl80211_send_station(skb, if (nl80211_send_station(skb,
NETLINK_CB(cb->skb).portid, NETLINK_CB(cb->skb).portid,
cb->nlh->nlmsg_seq, NLM_F_MULTI, cb->nlh->nlmsg_seq, NLM_F_MULTI,
dev, wdev->netdev, mac_addr, rdev, wdev->netdev, mac_addr,
&sinfo) < 0) &sinfo) < 0)
goto out; goto out;
...@@ -3717,7 +3717,7 @@ static int nl80211_dump_station(struct sk_buff *skb, ...@@ -3717,7 +3717,7 @@ static int nl80211_dump_station(struct sk_buff *skb,
cb->args[2] = sta_idx; cb->args[2] = sta_idx;
err = skb->len; err = skb->len;
out_err: out_err:
nl80211_finish_wdev_dump(dev); nl80211_finish_wdev_dump(rdev);
return err; return err;
} }
...@@ -4378,18 +4378,18 @@ static int nl80211_dump_mpath(struct sk_buff *skb, ...@@ -4378,18 +4378,18 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
struct netlink_callback *cb) struct netlink_callback *cb)
{ {
struct mpath_info pinfo; struct mpath_info pinfo;
struct cfg80211_registered_device *dev; struct cfg80211_registered_device *rdev;
struct wireless_dev *wdev; struct wireless_dev *wdev;
u8 dst[ETH_ALEN]; u8 dst[ETH_ALEN];
u8 next_hop[ETH_ALEN]; u8 next_hop[ETH_ALEN];
int path_idx = cb->args[2]; int path_idx = cb->args[2];
int err; int err;
err = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev); err = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
if (err) if (err)
return err; return err;
if (!dev->ops->dump_mpath) { if (!rdev->ops->dump_mpath) {
err = -EOPNOTSUPP; err = -EOPNOTSUPP;
goto out_err; goto out_err;
} }
...@@ -4400,7 +4400,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, ...@@ -4400,7 +4400,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
} }
while (1) { while (1) {
err = rdev_dump_mpath(dev, wdev->netdev, path_idx, dst, err = rdev_dump_mpath(rdev, wdev->netdev, path_idx, dst,
next_hop, &pinfo); next_hop, &pinfo);
if (err == -ENOENT) if (err == -ENOENT)
break; break;
...@@ -4421,7 +4421,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb, ...@@ -4421,7 +4421,7 @@ static int nl80211_dump_mpath(struct sk_buff *skb,
cb->args[2] = path_idx; cb->args[2] = path_idx;
err = skb->len; err = skb->len;
out_err: out_err:
nl80211_finish_wdev_dump(dev); nl80211_finish_wdev_dump(rdev);
return err; return err;
} }
...@@ -6162,12 +6162,12 @@ static int nl80211_dump_survey(struct sk_buff *skb, ...@@ -6162,12 +6162,12 @@ static int nl80211_dump_survey(struct sk_buff *skb,
struct netlink_callback *cb) struct netlink_callback *cb)
{ {
struct survey_info survey; struct survey_info survey;
struct cfg80211_registered_device *dev; struct cfg80211_registered_device *rdev;
struct wireless_dev *wdev; struct wireless_dev *wdev;
int survey_idx = cb->args[2]; int survey_idx = cb->args[2];
int res; int res;
res = nl80211_prepare_wdev_dump(skb, cb, &dev, &wdev); res = nl80211_prepare_wdev_dump(skb, cb, &rdev, &wdev);
if (res) if (res)
return res; return res;
...@@ -6176,7 +6176,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, ...@@ -6176,7 +6176,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
goto out_err; goto out_err;
} }
if (!dev->ops->dump_survey) { if (!rdev->ops->dump_survey) {
res = -EOPNOTSUPP; res = -EOPNOTSUPP;
goto out_err; goto out_err;
} }
...@@ -6184,7 +6184,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, ...@@ -6184,7 +6184,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
while (1) { while (1) {
struct ieee80211_channel *chan; struct ieee80211_channel *chan;
res = rdev_dump_survey(dev, wdev->netdev, survey_idx, &survey); res = rdev_dump_survey(rdev, wdev->netdev, survey_idx, &survey);
if (res == -ENOENT) if (res == -ENOENT)
break; break;
if (res) if (res)
...@@ -6196,7 +6196,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, ...@@ -6196,7 +6196,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
goto out; goto out;
} }
chan = ieee80211_get_channel(&dev->wiphy, chan = ieee80211_get_channel(&rdev->wiphy,
survey.channel->center_freq); survey.channel->center_freq);
if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) { if (!chan || chan->flags & IEEE80211_CHAN_DISABLED) {
survey_idx++; survey_idx++;
...@@ -6215,7 +6215,7 @@ static int nl80211_dump_survey(struct sk_buff *skb, ...@@ -6215,7 +6215,7 @@ static int nl80211_dump_survey(struct sk_buff *skb,
cb->args[2] = survey_idx; cb->args[2] = survey_idx;
res = skb->len; res = skb->len;
out_err: out_err:
nl80211_finish_wdev_dump(dev); nl80211_finish_wdev_dump(rdev);
return res; return res;
} }
......
...@@ -81,10 +81,10 @@ static void bss_free(struct cfg80211_internal_bss *bss) ...@@ -81,10 +81,10 @@ static void bss_free(struct cfg80211_internal_bss *bss)
kfree(bss); kfree(bss);
} }
static inline void bss_ref_get(struct cfg80211_registered_device *dev, static inline void bss_ref_get(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
bss->refcount++; bss->refcount++;
if (bss->pub.hidden_beacon_bss) { if (bss->pub.hidden_beacon_bss) {
...@@ -95,10 +95,10 @@ static inline void bss_ref_get(struct cfg80211_registered_device *dev, ...@@ -95,10 +95,10 @@ static inline void bss_ref_get(struct cfg80211_registered_device *dev,
} }
} }
static inline void bss_ref_put(struct cfg80211_registered_device *dev, static inline void bss_ref_put(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
if (bss->pub.hidden_beacon_bss) { if (bss->pub.hidden_beacon_bss) {
struct cfg80211_internal_bss *hbss; struct cfg80211_internal_bss *hbss;
...@@ -114,10 +114,10 @@ static inline void bss_ref_put(struct cfg80211_registered_device *dev, ...@@ -114,10 +114,10 @@ static inline void bss_ref_put(struct cfg80211_registered_device *dev,
bss_free(bss); bss_free(bss);
} }
static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
if (!list_empty(&bss->hidden_list)) { if (!list_empty(&bss->hidden_list)) {
/* /*
...@@ -134,31 +134,31 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev, ...@@ -134,31 +134,31 @@ static bool __cfg80211_unlink_bss(struct cfg80211_registered_device *dev,
} }
list_del_init(&bss->list); list_del_init(&bss->list);
rb_erase(&bss->rbn, &dev->bss_tree); rb_erase(&bss->rbn, &rdev->bss_tree);
bss_ref_put(dev, bss); bss_ref_put(rdev, bss);
return true; return true;
} }
static void __cfg80211_bss_expire(struct cfg80211_registered_device *dev, static void __cfg80211_bss_expire(struct cfg80211_registered_device *rdev,
unsigned long expire_time) unsigned long expire_time)
{ {
struct cfg80211_internal_bss *bss, *tmp; struct cfg80211_internal_bss *bss, *tmp;
bool expired = false; bool expired = false;
lockdep_assert_held(&dev->bss_lock); lockdep_assert_held(&rdev->bss_lock);
list_for_each_entry_safe(bss, tmp, &dev->bss_list, list) { list_for_each_entry_safe(bss, tmp, &rdev->bss_list, list) {
if (atomic_read(&bss->hold)) if (atomic_read(&bss->hold))
continue; continue;
if (!time_after(expire_time, bss->ts)) if (!time_after(expire_time, bss->ts))
continue; continue;
if (__cfg80211_unlink_bss(dev, bss)) if (__cfg80211_unlink_bss(rdev, bss))
expired = true; expired = true;
} }
if (expired) if (expired)
dev->bss_generation++; rdev->bss_generation++;
} }
void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev, void ___cfg80211_scan_done(struct cfg80211_registered_device *rdev,
...@@ -322,21 +322,21 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev, ...@@ -322,21 +322,21 @@ int __cfg80211_stop_sched_scan(struct cfg80211_registered_device *rdev,
return 0; return 0;
} }
void cfg80211_bss_age(struct cfg80211_registered_device *dev, void cfg80211_bss_age(struct cfg80211_registered_device *rdev,
unsigned long age_secs) unsigned long age_secs)
{ {
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC); unsigned long age_jiffies = msecs_to_jiffies(age_secs * MSEC_PER_SEC);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
list_for_each_entry(bss, &dev->bss_list, list) list_for_each_entry(bss, &rdev->bss_list, list)
bss->ts -= age_jiffies; bss->ts -= age_jiffies;
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
void cfg80211_bss_expire(struct cfg80211_registered_device *dev) void cfg80211_bss_expire(struct cfg80211_registered_device *rdev)
{ {
__cfg80211_bss_expire(dev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE); __cfg80211_bss_expire(rdev, jiffies - IEEE80211_SCAN_RESULT_EXPIRE);
} }
const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len) const u8 *cfg80211_find_ie(u8 eid, const u8 *ies, int len)
...@@ -526,16 +526,16 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -526,16 +526,16 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
const u8 *ssid, size_t ssid_len, const u8 *ssid, size_t ssid_len,
u16 capa_mask, u16 capa_val) u16 capa_mask, u16 capa_val)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss, *res = NULL; struct cfg80211_internal_bss *bss, *res = NULL;
unsigned long now = jiffies; unsigned long now = jiffies;
trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask, trace_cfg80211_get_bss(wiphy, channel, bssid, ssid, ssid_len, capa_mask,
capa_val); capa_val);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
list_for_each_entry(bss, &dev->bss_list, list) { list_for_each_entry(bss, &rdev->bss_list, list) {
if ((bss->pub.capability & capa_mask) != capa_val) if ((bss->pub.capability & capa_mask) != capa_val)
continue; continue;
if (channel && bss->pub.channel != channel) if (channel && bss->pub.channel != channel)
...@@ -548,12 +548,12 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -548,12 +548,12 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
continue; continue;
if (is_bss(&bss->pub, bssid, ssid, ssid_len)) { if (is_bss(&bss->pub, bssid, ssid, ssid_len)) {
res = bss; res = bss;
bss_ref_get(dev, res); bss_ref_get(rdev, res);
break; break;
} }
} }
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
if (!res) if (!res)
return NULL; return NULL;
trace_cfg80211_return_bss(&res->pub); trace_cfg80211_return_bss(&res->pub);
...@@ -561,10 +561,10 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy, ...@@ -561,10 +561,10 @@ struct cfg80211_bss *cfg80211_get_bss(struct wiphy *wiphy,
} }
EXPORT_SYMBOL(cfg80211_get_bss); EXPORT_SYMBOL(cfg80211_get_bss);
static void rb_insert_bss(struct cfg80211_registered_device *dev, static void rb_insert_bss(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *bss) struct cfg80211_internal_bss *bss)
{ {
struct rb_node **p = &dev->bss_tree.rb_node; struct rb_node **p = &rdev->bss_tree.rb_node;
struct rb_node *parent = NULL; struct rb_node *parent = NULL;
struct cfg80211_internal_bss *tbss; struct cfg80211_internal_bss *tbss;
int cmp; int cmp;
...@@ -587,15 +587,15 @@ static void rb_insert_bss(struct cfg80211_registered_device *dev, ...@@ -587,15 +587,15 @@ static void rb_insert_bss(struct cfg80211_registered_device *dev,
} }
rb_link_node(&bss->rbn, parent, p); rb_link_node(&bss->rbn, parent, p);
rb_insert_color(&bss->rbn, &dev->bss_tree); rb_insert_color(&bss->rbn, &rdev->bss_tree);
} }
static struct cfg80211_internal_bss * static struct cfg80211_internal_bss *
rb_find_bss(struct cfg80211_registered_device *dev, rb_find_bss(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *res, struct cfg80211_internal_bss *res,
enum bss_compare_mode mode) enum bss_compare_mode mode)
{ {
struct rb_node *n = dev->bss_tree.rb_node; struct rb_node *n = rdev->bss_tree.rb_node;
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
int r; int r;
...@@ -614,7 +614,7 @@ rb_find_bss(struct cfg80211_registered_device *dev, ...@@ -614,7 +614,7 @@ rb_find_bss(struct cfg80211_registered_device *dev,
return NULL; return NULL;
} }
static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, static bool cfg80211_combine_bsses(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *new) struct cfg80211_internal_bss *new)
{ {
const struct cfg80211_bss_ies *ies; const struct cfg80211_bss_ies *ies;
...@@ -644,7 +644,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, ...@@ -644,7 +644,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev,
/* This is the bad part ... */ /* This is the bad part ... */
list_for_each_entry(bss, &dev->bss_list, list) { list_for_each_entry(bss, &rdev->bss_list, list) {
if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid)) if (!ether_addr_equal(bss->pub.bssid, new->pub.bssid))
continue; continue;
if (bss->pub.channel != new->pub.channel) if (bss->pub.channel != new->pub.channel)
...@@ -678,7 +678,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev, ...@@ -678,7 +678,7 @@ static bool cfg80211_combine_bsses(struct cfg80211_registered_device *dev,
/* Returned bss is reference counted and must be cleaned up appropriately. */ /* Returned bss is reference counted and must be cleaned up appropriately. */
static struct cfg80211_internal_bss * static struct cfg80211_internal_bss *
cfg80211_bss_update(struct cfg80211_registered_device *dev, cfg80211_bss_update(struct cfg80211_registered_device *rdev,
struct cfg80211_internal_bss *tmp, struct cfg80211_internal_bss *tmp,
bool signal_valid) bool signal_valid)
{ {
...@@ -689,14 +689,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -689,14 +689,14 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
tmp->ts = jiffies; tmp->ts = jiffies;
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) { if (WARN_ON(!rcu_access_pointer(tmp->pub.ies))) {
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return NULL; return NULL;
} }
found = rb_find_bss(dev, tmp, BSS_CMP_REGULAR); found = rb_find_bss(rdev, tmp, BSS_CMP_REGULAR);
if (found) { if (found) {
/* Update IEs */ /* Update IEs */
...@@ -783,7 +783,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -783,7 +783,7 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
* is allocated on the stack since it's not needed in the * is allocated on the stack since it's not needed in the
* more common case of an update * more common case of an update
*/ */
new = kzalloc(sizeof(*new) + dev->wiphy.bss_priv_size, new = kzalloc(sizeof(*new) + rdev->wiphy.bss_priv_size,
GFP_ATOMIC); GFP_ATOMIC);
if (!new) { if (!new) {
ies = (void *)rcu_dereference(tmp->pub.beacon_ies); ies = (void *)rcu_dereference(tmp->pub.beacon_ies);
...@@ -799,9 +799,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -799,9 +799,9 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
INIT_LIST_HEAD(&new->hidden_list); INIT_LIST_HEAD(&new->hidden_list);
if (rcu_access_pointer(tmp->pub.proberesp_ies)) { if (rcu_access_pointer(tmp->pub.proberesp_ies)) {
hidden = rb_find_bss(dev, tmp, BSS_CMP_HIDE_ZLEN); hidden = rb_find_bss(rdev, tmp, BSS_CMP_HIDE_ZLEN);
if (!hidden) if (!hidden)
hidden = rb_find_bss(dev, tmp, hidden = rb_find_bss(rdev, tmp,
BSS_CMP_HIDE_NUL); BSS_CMP_HIDE_NUL);
if (hidden) { if (hidden) {
new->pub.hidden_beacon_bss = &hidden->pub; new->pub.hidden_beacon_bss = &hidden->pub;
...@@ -818,24 +818,24 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev, ...@@ -818,24 +818,24 @@ cfg80211_bss_update(struct cfg80211_registered_device *dev,
* expensive search for any probe responses that should * expensive search for any probe responses that should
* be grouped with this beacon for updates ... * be grouped with this beacon for updates ...
*/ */
if (!cfg80211_combine_bsses(dev, new)) { if (!cfg80211_combine_bsses(rdev, new)) {
kfree(new); kfree(new);
goto drop; goto drop;
} }
} }
list_add_tail(&new->list, &dev->bss_list); list_add_tail(&new->list, &rdev->bss_list);
rb_insert_bss(dev, new); rb_insert_bss(rdev, new);
found = new; found = new;
} }
dev->bss_generation++; rdev->bss_generation++;
bss_ref_get(dev, found); bss_ref_get(rdev, found);
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return found; return found;
drop: drop:
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return NULL; return NULL;
} }
...@@ -1007,7 +1007,7 @@ EXPORT_SYMBOL(cfg80211_inform_bss_width_frame); ...@@ -1007,7 +1007,7 @@ EXPORT_SYMBOL(cfg80211_inform_bss_width_frame);
void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
if (!pub) if (!pub)
...@@ -1015,15 +1015,15 @@ void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) ...@@ -1015,15 +1015,15 @@ void cfg80211_ref_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
bss_ref_get(dev, bss); bss_ref_get(rdev, bss);
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
EXPORT_SYMBOL(cfg80211_ref_bss); EXPORT_SYMBOL(cfg80211_ref_bss);
void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
if (!pub) if (!pub)
...@@ -1031,15 +1031,15 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) ...@@ -1031,15 +1031,15 @@ void cfg80211_put_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
bss_ref_put(dev, bss); bss_ref_put(rdev, bss);
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
EXPORT_SYMBOL(cfg80211_put_bss); EXPORT_SYMBOL(cfg80211_put_bss);
void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
{ {
struct cfg80211_registered_device *dev = wiphy_to_dev(wiphy); struct cfg80211_registered_device *rdev = wiphy_to_dev(wiphy);
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
if (WARN_ON(!pub)) if (WARN_ON(!pub))
...@@ -1047,12 +1047,12 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub) ...@@ -1047,12 +1047,12 @@ void cfg80211_unlink_bss(struct wiphy *wiphy, struct cfg80211_bss *pub)
bss = container_of(pub, struct cfg80211_internal_bss, pub); bss = container_of(pub, struct cfg80211_internal_bss, pub);
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
if (!list_empty(&bss->list)) { if (!list_empty(&bss->list)) {
if (__cfg80211_unlink_bss(dev, bss)) if (__cfg80211_unlink_bss(rdev, bss))
dev->bss_generation++; rdev->bss_generation++;
} }
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
} }
EXPORT_SYMBOL(cfg80211_unlink_bss); EXPORT_SYMBOL(cfg80211_unlink_bss);
...@@ -1465,7 +1465,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info, ...@@ -1465,7 +1465,7 @@ ieee80211_bss(struct wiphy *wiphy, struct iw_request_info *info,
} }
static int ieee80211_scan_results(struct cfg80211_registered_device *dev, static int ieee80211_scan_results(struct cfg80211_registered_device *rdev,
struct iw_request_info *info, struct iw_request_info *info,
char *buf, size_t len) char *buf, size_t len)
{ {
...@@ -1473,18 +1473,18 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev, ...@@ -1473,18 +1473,18 @@ static int ieee80211_scan_results(struct cfg80211_registered_device *dev,
char *end_buf = buf + len; char *end_buf = buf + len;
struct cfg80211_internal_bss *bss; struct cfg80211_internal_bss *bss;
spin_lock_bh(&dev->bss_lock); spin_lock_bh(&rdev->bss_lock);
cfg80211_bss_expire(dev); cfg80211_bss_expire(rdev);
list_for_each_entry(bss, &dev->bss_list, list) { list_for_each_entry(bss, &rdev->bss_list, list) {
if (buf + len - current_ev <= IW_EV_ADDR_LEN) { if (buf + len - current_ev <= IW_EV_ADDR_LEN) {
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return -E2BIG; return -E2BIG;
} }
current_ev = ieee80211_bss(&dev->wiphy, info, bss, current_ev = ieee80211_bss(&rdev->wiphy, info, bss,
current_ev, end_buf); current_ev, end_buf);
} }
spin_unlock_bh(&dev->bss_lock); spin_unlock_bh(&rdev->bss_lock);
return current_ev - buf; return current_ev - buf;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment