Commit f698d856 authored by Jasper Bryant-Greene's avatar Jasper Bryant-Greene Committed by John W. Linville
Browse files

replace net_device arguments with ieee80211_{local,sub_if_data} as appropriate



This patch replaces net_device arguments to mac80211 internal functions
with ieee80211_{local,sub_if_data} as appropriate.

It also does the same for many 802.11s mesh functions, and changes the
mesh path table to be indexed on sub_if_data rather than net_device.

If the mesh part needs to be a separate patch let me know, but since
mesh uses a lot of mac80211 functions which were being converted anyway,
the changes go hand-in-hand somewhat.

This patch probably does not convert all the functions which could be
converted, but it is a large chunk and followup patches will be
provided.
Signed-off-by: default avatarJasper Bryant-Greene <jasper@amiton.co.nz>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent fef1643b
...@@ -66,13 +66,16 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name, ...@@ -66,13 +66,16 @@ static int ieee80211_add_iface(struct wiphy *wiphy, char *name,
static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex) static int ieee80211_del_iface(struct wiphy *wiphy, int ifindex)
{ {
struct net_device *dev; struct net_device *dev;
struct ieee80211_sub_if_data *sdata;
/* we're under RTNL */ /* we're under RTNL */
dev = __dev_get_by_index(&init_net, ifindex); dev = __dev_get_by_index(&init_net, ifindex);
if (!dev) if (!dev)
return -ENODEV; return -ENODEV;
ieee80211_if_remove(dev); sdata = IEEE80211_DEV_TO_SUB_IF(dev);
ieee80211_if_remove(sdata);
return 0; return 0;
} }
...@@ -842,13 +845,13 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, ...@@ -842,13 +845,13 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
return -ENOENT; return -ENOENT;
} }
err = mesh_path_add(dst, dev); err = mesh_path_add(dst, sdata);
if (err) { if (err) {
rcu_read_unlock(); rcu_read_unlock();
return err; return err;
} }
mpath = mesh_path_lookup(dst, dev); mpath = mesh_path_lookup(dst, sdata);
if (!mpath) { if (!mpath) {
rcu_read_unlock(); rcu_read_unlock();
return -ENXIO; return -ENXIO;
...@@ -862,10 +865,12 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev, ...@@ -862,10 +865,12 @@ static int ieee80211_add_mpath(struct wiphy *wiphy, struct net_device *dev,
static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev, static int ieee80211_del_mpath(struct wiphy *wiphy, struct net_device *dev,
u8 *dst) u8 *dst)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
if (dst) if (dst)
return mesh_path_del(dst, dev); return mesh_path_del(dst, sdata);
mesh_path_flush(dev); mesh_path_flush(sdata);
return 0; return 0;
} }
...@@ -897,7 +902,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy, ...@@ -897,7 +902,7 @@ static int ieee80211_change_mpath(struct wiphy *wiphy,
return -ENOENT; return -ENOENT;
} }
mpath = mesh_path_lookup(dst, dev); mpath = mesh_path_lookup(dst, sdata);
if (!mpath) { if (!mpath) {
rcu_read_unlock(); rcu_read_unlock();
return -ENOENT; return -ENOENT;
...@@ -965,7 +970,7 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev, ...@@ -965,7 +970,7 @@ static int ieee80211_get_mpath(struct wiphy *wiphy, struct net_device *dev,
return -ENOTSUPP; return -ENOTSUPP;
rcu_read_lock(); rcu_read_lock();
mpath = mesh_path_lookup(dst, dev); mpath = mesh_path_lookup(dst, sdata);
if (!mpath) { if (!mpath) {
rcu_read_unlock(); rcu_read_unlock();
return -ENOENT; return -ENOENT;
...@@ -993,7 +998,7 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev, ...@@ -993,7 +998,7 @@ static int ieee80211_dump_mpath(struct wiphy *wiphy, struct net_device *dev,
return -ENOTSUPP; return -ENOTSUPP;
rcu_read_lock(); rcu_read_lock();
mpath = mesh_path_lookup_by_idx(idx, dev); mpath = mesh_path_lookup_by_idx(idx, sdata);
if (!mpath) { if (!mpath) {
rcu_read_unlock(); rcu_read_unlock();
return -ENOENT; return -ENOENT;
......
...@@ -201,7 +201,7 @@ static ssize_t sta_agg_status_write(struct file *file, ...@@ -201,7 +201,7 @@ static ssize_t sta_agg_status_write(struct file *file,
tid_num = tid_num - 100; tid_num = tid_num - 100;
if (tid_static_rx[tid_num] == 1) { if (tid_static_rx[tid_num] == 1) {
strcpy(state, "off "); strcpy(state, "off ");
ieee80211_sta_stop_rx_ba_session(dev, da, tid_num, 0, ieee80211_sta_stop_rx_ba_session(sta->sdata, da, tid_num, 0,
WLAN_REASON_QSTA_REQUIRE_SETUP); WLAN_REASON_QSTA_REQUIRE_SETUP);
sta->ampdu_mlme.tid_state_rx[tid_num] |= sta->ampdu_mlme.tid_state_rx[tid_num] |=
HT_AGG_STATE_DEBUGFS_CTL; HT_AGG_STATE_DEBUGFS_CTL;
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
* mac80211 - events * mac80211 - events
*/ */
#include <linux/netdevice.h>
#include <net/iw_handler.h> #include <net/iw_handler.h>
#include "ieee80211_i.h" #include "ieee80211_i.h"
...@@ -17,7 +16,7 @@ ...@@ -17,7 +16,7 @@
* (in the variable hdr) must be long enough to extract the TKIP * (in the variable hdr) must be long enough to extract the TKIP
* fields like TSC * fields like TSC
*/ */
void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
struct ieee80211_hdr *hdr) struct ieee80211_hdr *hdr)
{ {
union iwreq_data wrqu; union iwreq_data wrqu;
...@@ -32,7 +31,7 @@ void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, ...@@ -32,7 +31,7 @@ void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx,
print_mac(mac, hdr->addr2)); print_mac(mac, hdr->addr2));
memset(&wrqu, 0, sizeof(wrqu)); memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = strlen(buf); wrqu.data.length = strlen(buf);
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf); wireless_send_event(sdata->dev, IWEVCUSTOM, &wrqu, buf);
kfree(buf); kfree(buf);
} }
......
...@@ -851,65 +851,65 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht, ...@@ -851,65 +851,65 @@ u32 ieee80211_handle_ht(struct ieee80211_local *local, int enable_ht,
/* ieee80211_ioctl.c */ /* ieee80211_ioctl.c */
extern const struct iw_handler_def ieee80211_iw_handler_def; extern const struct iw_handler_def ieee80211_iw_handler_def;
int ieee80211_set_freq(struct net_device *dev, int freq); int ieee80211_set_freq(struct ieee80211_sub_if_data *sdata, int freq);
/* ieee80211_sta.c */ /* ieee80211_sta.c */
void ieee80211_sta_timer(unsigned long data); void ieee80211_sta_timer(unsigned long data);
void ieee80211_sta_work(struct work_struct *work); void ieee80211_sta_work(struct work_struct *work);
void ieee80211_sta_scan_work(struct work_struct *work); void ieee80211_sta_scan_work(struct work_struct *work);
void ieee80211_sta_rx_mgmt(struct net_device *dev, struct sk_buff *skb, void ieee80211_sta_rx_mgmt(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status); struct ieee80211_rx_status *rx_status);
int ieee80211_sta_set_ssid(struct net_device *dev, char *ssid, size_t len); int ieee80211_sta_set_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t len);
int ieee80211_sta_get_ssid(struct net_device *dev, char *ssid, size_t *len); int ieee80211_sta_get_ssid(struct ieee80211_sub_if_data *sdata, char *ssid, size_t *len);
int ieee80211_sta_set_bssid(struct net_device *dev, u8 *bssid); int ieee80211_sta_set_bssid(struct ieee80211_sub_if_data *sdata, u8 *bssid);
int ieee80211_sta_req_scan(struct net_device *dev, u8 *ssid, size_t ssid_len); int ieee80211_sta_req_scan(struct ieee80211_sub_if_data *sdata, u8 *ssid, size_t ssid_len);
void ieee80211_sta_req_auth(struct net_device *dev, void ieee80211_sta_req_auth(struct ieee80211_sub_if_data *sdata,
struct ieee80211_if_sta *ifsta); struct ieee80211_if_sta *ifsta);
int ieee80211_sta_scan_results(struct net_device *dev, int ieee80211_sta_scan_results(struct ieee80211_local *local,
struct iw_request_info *info, struct iw_request_info *info,
char *buf, size_t len); char *buf, size_t len);
ieee80211_rx_result ieee80211_sta_rx_scan( ieee80211_rx_result ieee80211_sta_rx_scan(
struct net_device *dev, struct sk_buff *skb, struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
struct ieee80211_rx_status *rx_status); struct ieee80211_rx_status *rx_status);
void ieee80211_rx_bss_list_init(struct ieee80211_local *local); void ieee80211_rx_bss_list_init(struct ieee80211_local *local);
void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local); void ieee80211_rx_bss_list_deinit(struct ieee80211_local *local);
int ieee80211_sta_set_extra_ie(struct net_device *dev, char *ie, size_t len); int ieee80211_sta_set_extra_ie(struct ieee80211_sub_if_data *sdata, char *ie, size_t len);
struct sta_info *ieee80211_ibss_add_sta(struct net_device *dev, struct sta_info *ieee80211_ibss_add_sta(struct ieee80211_sub_if_data *sdata,
struct sk_buff *skb, u8 *bssid, struct sk_buff *skb, u8 *bssid,
u8 *addr, u64 supp_rates); u8 *addr, u64 supp_rates);
int ieee80211_sta_deauthenticate(struct net_device *dev, u16 reason); int ieee80211_sta_deauthenticate(struct ieee80211_sub_if_data *sdata, u16 reason);
int ieee80211_sta_disassociate(struct net_device *dev, u16 reason); int ieee80211_sta_disassociate(struct ieee80211_sub_if_data *sdata, u16 reason);
void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
u32 changed); u32 changed);
u32 ieee80211_reset_erp_info(struct net_device *dev); u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie, int ieee80211_ht_cap_ie_to_ht_info(struct ieee80211_ht_cap *ht_cap_ie,
struct ieee80211_ht_info *ht_info); struct ieee80211_ht_info *ht_info);
int ieee80211_ht_addt_info_ie_to_ht_bss_info( int ieee80211_ht_addt_info_ie_to_ht_bss_info(
struct ieee80211_ht_addt_info *ht_add_info_ie, struct ieee80211_ht_addt_info *ht_add_info_ie,
struct ieee80211_ht_bss_info *bss_info); struct ieee80211_ht_bss_info *bss_info);
void ieee80211_send_addba_request(struct net_device *dev, const u8 *da, void ieee80211_send_addba_request(struct ieee80211_sub_if_data *sdata, const u8 *da,
u16 tid, u8 dialog_token, u16 start_seq_num, u16 tid, u8 dialog_token, u16 start_seq_num,
u16 agg_size, u16 timeout); u16 agg_size, u16 timeout);
void ieee80211_send_delba(struct net_device *dev, const u8 *da, u16 tid, void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata, const u8 *da, u16 tid,
u16 initiator, u16 reason_code); u16 initiator, u16 reason_code);
void ieee80211_send_bar(struct net_device *dev, u8 *ra, u16 tid, u16 ssn); void ieee80211_send_bar(struct ieee80211_sub_if_data *sdata, u8 *ra, u16 tid, u16 ssn);
void ieee80211_sta_stop_rx_ba_session(struct net_device *dev, u8 *da, void ieee80211_sta_stop_rx_ba_session(struct ieee80211_sub_if_data *sdata, u8 *da,
u16 tid, u16 initiator, u16 reason); u16 tid, u16 initiator, u16 reason);
void sta_addba_resp_timer_expired(unsigned long data); void sta_addba_resp_timer_expired(unsigned long data);
void ieee80211_sta_tear_down_BA_sessions(struct net_device *dev, u8 *addr); void ieee80211_sta_tear_down_BA_sessions(struct ieee80211_sub_if_data *sdata, u8 *addr);
u64 ieee80211_sta_get_rates(struct ieee80211_local *local, u64 ieee80211_sta_get_rates(struct ieee80211_local *local,
struct ieee802_11_elems *elems, struct ieee802_11_elems *elems,
enum ieee80211_band band); enum ieee80211_band band);
void ieee80211_sta_tx(struct net_device *dev, struct sk_buff *skb, void ieee80211_sta_tx(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb,
int encrypt); int encrypt);
void ieee802_11_parse_elems(u8 *start, size_t len, void ieee802_11_parse_elems(u8 *start, size_t len,
struct ieee802_11_elems *elems); struct ieee802_11_elems *elems);
#ifdef CONFIG_MAC80211_MESH #ifdef CONFIG_MAC80211_MESH
void ieee80211_start_mesh(struct net_device *dev); void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata);
#else #else
static inline void ieee80211_start_mesh(struct net_device *dev) static inline void ieee80211_start_mesh(struct ieee80211_sub_if_data *sdata)
{} {}
#endif #endif
...@@ -920,7 +920,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -920,7 +920,7 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
struct vif_params *params); struct vif_params *params);
int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata, int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
enum ieee80211_if_types type); enum ieee80211_if_types type);
void ieee80211_if_remove(struct net_device *dev); void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
void ieee80211_remove_interfaces(struct ieee80211_local *local); void ieee80211_remove_interfaces(struct ieee80211_local *local);
/* tx handling */ /* tx handling */
...@@ -938,7 +938,7 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len, ...@@ -938,7 +938,7 @@ u8 *ieee80211_get_bssid(struct ieee80211_hdr *hdr, size_t len,
enum ieee80211_if_types type); enum ieee80211_if_types type);
int ieee80211_frame_duration(struct ieee80211_local *local, size_t len, int ieee80211_frame_duration(struct ieee80211_local *local, size_t len,
int rate, int erp, int short_preamble); int rate, int erp, int short_preamble);
void mac80211_ev_michael_mic_failure(struct net_device *dev, int keyidx, void mac80211_ev_michael_mic_failure(struct ieee80211_sub_if_data *sdata, int keyidx,
struct ieee80211_hdr *hdr); struct ieee80211_hdr *hdr);
#ifdef CONFIG_MAC80211_NOINLINE #ifdef CONFIG_MAC80211_NOINLINE
......
...@@ -56,7 +56,7 @@ static void ieee80211_teardown_sdata(struct net_device *dev) ...@@ -56,7 +56,7 @@ static void ieee80211_teardown_sdata(struct net_device *dev)
case IEEE80211_IF_TYPE_MESH_POINT: case IEEE80211_IF_TYPE_MESH_POINT:
/* Allow compiler to elide mesh_rmc_free call. */ /* Allow compiler to elide mesh_rmc_free call. */
if (ieee80211_vif_is_mesh(&sdata->vif)) if (ieee80211_vif_is_mesh(&sdata->vif))
mesh_rmc_free(dev); mesh_rmc_free(sdata);
/* fall through */ /* fall through */
case IEEE80211_IF_TYPE_STA: case IEEE80211_IF_TYPE_STA:
case IEEE80211_IF_TYPE_IBSS: case IEEE80211_IF_TYPE_IBSS:
...@@ -241,15 +241,13 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name, ...@@ -241,15 +241,13 @@ int ieee80211_if_add(struct ieee80211_local *local, const char *name,
return ret; return ret;
} }
void ieee80211_if_remove(struct net_device *dev) void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
ASSERT_RTNL(); ASSERT_RTNL();
list_del_rcu(&sdata->list); list_del_rcu(&sdata->list);
synchronize_rcu(); synchronize_rcu();
unregister_netdevice(dev); unregister_netdevice(sdata->dev);
} }
/* /*
......
...@@ -347,8 +347,8 @@ static int ieee80211_open(struct net_device *dev) ...@@ -347,8 +347,8 @@ static int ieee80211_open(struct net_device *dev)
goto err_stop; goto err_stop;
if (ieee80211_vif_is_mesh(&sdata->vif)) if (ieee80211_vif_is_mesh(&sdata->vif))
ieee80211_start_mesh(sdata->dev); ieee80211_start_mesh(sdata);
changed |= ieee80211_reset_erp_info(dev); changed |= ieee80211_reset_erp_info(sdata);
ieee80211_bss_info_change_notify(sdata, changed); ieee80211_bss_info_change_notify(sdata, changed);
ieee80211_enable_keys(sdata); ieee80211_enable_keys(sdata);
...@@ -448,7 +448,7 @@ static int ieee80211_stop(struct net_device *dev) ...@@ -448,7 +448,7 @@ static int ieee80211_stop(struct net_device *dev)
list_for_each_entry_rcu(sta, &local->sta_list, list) { list_for_each_entry_rcu(sta, &local->sta_list, list) {
if (sta->sdata == sdata) if (sta->sdata == sdata)
ieee80211_sta_tear_down_BA_sessions(dev, sta->addr); ieee80211_sta_tear_down_BA_sessions(sdata, sta->addr);
} }
rcu_read_unlock(); rcu_read_unlock();
...@@ -706,7 +706,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) ...@@ -706,7 +706,7 @@ int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid)
sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num; sta->ampdu_mlme.tid_tx[tid]->ssn = start_seq_num;
ieee80211_send_addba_request(sta->sdata->dev, ra, tid, ieee80211_send_addba_request(sta->sdata, ra, tid,
sta->ampdu_mlme.tid_tx[tid]->dialog_token, sta->ampdu_mlme.tid_tx[tid]->dialog_token,
sta->ampdu_mlme.tid_tx[tid]->ssn, sta->ampdu_mlme.tid_tx[tid]->ssn,
0x40, 5000); 0x40, 5000);
...@@ -889,7 +889,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) ...@@ -889,7 +889,7 @@ void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid)
} }
if (*state & HT_AGG_STATE_INITIATOR_MSK) if (*state & HT_AGG_STATE_INITIATOR_MSK)
ieee80211_send_delba(sta->sdata->dev, ra, tid, ieee80211_send_delba(sta->sdata, ra, tid,
WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE);
agg_queue = sta->tid_to_tx_q[tid]; agg_queue = sta->tid_to_tx_q[tid];
...@@ -1200,10 +1200,8 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, ...@@ -1200,10 +1200,8 @@ void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
changed); changed);
} }
u32 ieee80211_reset_erp_info(struct net_device *dev) u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
sdata->bss_conf.use_cts_prot = 0; sdata->bss_conf.use_cts_prot = 0;
sdata->bss_conf.use_short_preamble = 0; sdata->bss_conf.use_short_preamble = 0;
return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE; return BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_ERP_PREAMBLE;
...@@ -1438,7 +1436,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) ...@@ -1438,7 +1436,7 @@ void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb)
tid = qc[0] & 0xf; tid = qc[0] & 0xf;
ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10) ssn = ((le16_to_cpu(hdr->seq_ctrl) + 0x10)
& IEEE80211_SCTL_SEQ); & IEEE80211_SCTL_SEQ);
ieee80211_send_bar(sta->sdata->dev, hdr->addr1, ieee80211_send_bar(sta->sdata, hdr->addr1,
tid, ssn); tid, ssn);
} }
} }
......
...@@ -39,14 +39,13 @@ void ieee80211s_stop(void) ...@@ -39,14 +39,13 @@ void ieee80211s_stop(void)
* mesh_matches_local - check if the config of a mesh point matches ours * mesh_matches_local - check if the config of a mesh point matches ours
* *
* @ie: information elements of a management frame from the mesh peer * @ie: information elements of a management frame from the mesh peer
* @dev: local mesh interface * @sdata: local mesh subif
* *
* This function checks if the mesh configuration of a mesh point matches the * This function checks if the mesh configuration of a mesh point matches the
* local mesh configuration, i.e. if both nodes belong to the same mesh network. * local mesh configuration, i.e. if both nodes belong to the same mesh network.
*/ */
bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev) bool mesh_matches_local(struct ieee802_11_elems *ie, struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_if_sta *sta = &sdata->u.sta; struct ieee80211_if_sta *sta = &sdata->u.sta;
/* /*
...@@ -73,10 +72,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev) ...@@ -73,10 +72,8 @@ bool mesh_matches_local(struct ieee802_11_elems *ie, struct net_device *dev)
* mesh_peer_accepts_plinks - check if an mp is willing to establish peer links * mesh_peer_accepts_plinks - check if an mp is willing to establish peer links
* *
* @ie: information elements of a management frame from the mesh peer * @ie: information elements of a management frame from the mesh peer
* @dev: local mesh interface
*/ */
bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie, bool mesh_peer_accepts_plinks(struct ieee802_11_elems *ie)
struct net_device *dev)
{ {
return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0; return (*(ie->mesh_config + CAPAB_OFFSET) & ACCEPT_PLINKS) != 0;
} }
...@@ -111,9 +108,8 @@ void mesh_ids_set_default(struct ieee80211_if_sta *sta) ...@@ -111,9 +108,8 @@ void mesh_ids_set_default(struct ieee80211_if_sta *sta)
memcpy(sta->mesh_cc_id, def_id, 4); memcpy(sta->mesh_cc_id, def_id, 4);
} }
int mesh_rmc_init(struct net_device *dev) int mesh_rmc_init(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
int i; int i;
sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL); sdata->u.sta.rmc = kmalloc(sizeof(struct mesh_rmc), GFP_KERNEL);
...@@ -125,9 +121,8 @@ int mesh_rmc_init(struct net_device *dev) ...@@ -125,9 +121,8 @@ int mesh_rmc_init(struct net_device *dev)
return 0; return 0;
} }
void mesh_rmc_free(struct net_device *dev) void mesh_rmc_free(struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct mesh_rmc *rmc = sdata->u.sta.rmc; struct mesh_rmc *rmc = sdata->u.sta.rmc;
struct rmc_entry *p, *n; struct rmc_entry *p, *n;
int i; int i;
...@@ -158,9 +153,8 @@ void mesh_rmc_free(struct net_device *dev) ...@@ -158,9 +153,8 @@ void mesh_rmc_free(struct net_device *dev)
* it. * it.
*/ */
int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
struct net_device *dev) struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct mesh_rmc *rmc = sdata->u.sta.rmc; struct mesh_rmc *rmc = sdata->u.sta.rmc;
u32 seqnum = 0; u32 seqnum = 0;
int entries = 0; int entries = 0;
...@@ -194,10 +188,9 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr, ...@@ -194,10 +188,9 @@ int mesh_rmc_check(u8 *sa, struct ieee80211s_hdr *mesh_hdr,
return 0; return 0;
} }
void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev) void mesh_mgmt_ies_add(struct sk_buff *skb, struct ieee80211_sub_if_data *sdata)
{ {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_local *local = sdata->local;
struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct ieee80211_supported_band *sband; struct ieee80211_supported_band *sband;
u8 *pos; u8 *pos;
int len, i, rate; int len, i, rate;
...@@ -262,10 +255,10 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev) ...@@ -262,10 +255,10 @@ void mesh_mgmt_ies_add(struct sk_buff *skb, struct net_device *dev)
return; return;
} }
u32 mesh_table_hash(u8 *addr, struct net_device *dev, struct mesh_table *tbl) u32 mesh_table_hash(u8 *addr, struct ieee80211_sub_if_data *sdata, struct mesh_table *tbl)
{ {
/* Use last four bytes of hw addr and interface index as hash index */ /* Use last four bytes of hw addr and interface index as hash index */
return jhash_2words(*(u32 *)(addr+2), dev->ifindex, tbl->hash_rnd) return jhash_2words(*(u32 *)(addr+2), sdata->dev->ifindex, tbl->hash_rnd)
& tbl->hash_mask; & tbl->hash_mask;
} }
...@@ -434,7 +427,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata) ...@@ -434,7 +427,7 @@ void ieee80211_mesh_init_sdata(struct ieee80211_sub_if_data *sdata)
ifsta->preq_id = 0; ifsta->preq_id = 0;
ifsta->dsn = 0; ifsta->dsn = 0;
atomic_set(&ifsta->mpaths, 0); atomic_set(&ifsta->mpaths, 0);
mesh_rmc_init(sdata->dev); mesh_rmc_init(sdata);
ifsta->last_preq = jiffies; ifsta->last_preq = jiffies;
/* Allocate all mesh structures when creating the first mesh interface. */ /* Allocate all mesh structures when creating the first mesh interface. */
if (!mesh_allocated) if (!mesh_allocated)
......
...@@ -47,7 +47,7 @@ enum mesh_path_flags { ...@@ -47,7 +47,7 @@ enum mesh_path_flags {
* struct mesh_path - mac80211 mesh path structure * struct mesh_path - mac80211 mesh path structure
* *
* @dst: mesh path destination mac address * @dst: mesh path destination mac address
* @dev: mesh path device * @sdata: mesh subif
* @next_hop: mesh neighbor to which frames for this destination will be * @next_hop: mesh neighbor to which frames for this destination will be
* forwarded * forwarded
* @timer: mesh path discovery timer * @timer: mesh path discovery timer
...@@ -64,14 +64,14 @@ enum mesh_path_flags { ...@@ -64,14 +64,14 @@ enum mesh_path_flags {
* @state_lock: mesh pat state lock * @state_lock: mesh pat state lock
* *
* *
* The combination of dst and dev is unique in the mesh path table. Since the * The combination of dst and sdata is unique in the mesh path table. Since the