提交 3b53fde8 编写于 作者: J Johannes Berg 提交者: John W. Linville

mac80211: let sta_info_get_by_idx get sta by sdata

Instead of filtering by device, directly look up by sdata.
Signed-off-by: NJohannes Berg <johannes@sipsolutions.net>
Signed-off-by: NJohn W. Linville <linville@tuxdriver.com>
上级 cb53a150
...@@ -398,13 +398,13 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo) ...@@ -398,13 +398,13 @@ static void sta_set_sinfo(struct sta_info *sta, struct station_info *sinfo)
static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev, static int ieee80211_dump_station(struct wiphy *wiphy, struct net_device *dev,
int idx, u8 *mac, struct station_info *sinfo) int idx, u8 *mac, struct station_info *sinfo)
{ {
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
struct sta_info *sta; struct sta_info *sta;
int ret = -ENOENT; int ret = -ENOENT;
rcu_read_lock(); rcu_read_lock();
sta = sta_info_get_by_idx(local, idx, dev); sta = sta_info_get_by_idx(sdata, idx);
if (sta) { if (sta) {
ret = 0; ret = 0;
memcpy(mac, sta->sta.addr, ETH_ALEN); memcpy(mac, sta->sta.addr, ETH_ALEN);
......
...@@ -116,14 +116,15 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr) ...@@ -116,14 +116,15 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr)
return sta; return sta;
} }
struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
struct net_device *dev) int idx)
{ {
struct ieee80211_local *local = sdata->local;
struct sta_info *sta; struct sta_info *sta;
int i = 0; int i = 0;
list_for_each_entry_rcu(sta, &local->sta_list, list) { list_for_each_entry_rcu(sta, &local->sta_list, list) {
if (dev && dev != sta->sdata->dev) if (sdata != sta->sdata)
continue; continue;
if (i < idx) { if (i < idx) {
++i; ++i;
......
...@@ -409,8 +409,8 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr); ...@@ -409,8 +409,8 @@ struct sta_info *sta_info_get(struct ieee80211_local *local, const u8 *addr);
/* /*
* Get STA info by index, BROKEN! * Get STA info by index, BROKEN!
*/ */
struct sta_info *sta_info_get_by_idx(struct ieee80211_local *local, int idx, struct sta_info *sta_info_get_by_idx(struct ieee80211_sub_if_data *sdata,
struct net_device *dev); int idx);
/* /*
* Create a new STA info, caller owns returned structure * Create a new STA info, caller owns returned structure
* until sta_info_insert(). * until sta_info_insert().
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册