mac80211: add vif to testmode cmd

Pass the wdev from cfg80211 on to the driver as the vif
if given and it's valid for the driver.

Signed-off-by: David Spinadel <david.spinadel@intel.com>
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
This commit is contained in:
David Spinadel 2013-07-31 18:06:22 +03:00 committed by Johannes Berg
parent fc73f11f5f
commit 52981cd794
5 changed files with 19 additions and 6 deletions

View File

@ -1364,6 +1364,7 @@ static const struct nla_policy hwsim_testmode_policy[HWSIM_TM_ATTR_MAX + 1] = {
static int hwsim_fops_ps_write(void *dat, u64 val); static int hwsim_fops_ps_write(void *dat, u64 val);
static int mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw, static int mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
void *data, int len) void *data, int len)
{ {
struct mac80211_hwsim_data *hwsim = hw->priv; struct mac80211_hwsim_data *hwsim = hw->priv;

View File

@ -356,7 +356,8 @@ out:
return ret; return ret;
} }
int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len) int wl1271_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
void *data, int len)
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct nlattr *tb[WL1271_TM_ATTR_MAX + 1]; struct nlattr *tb[WL1271_TM_ATTR_MAX + 1];

View File

@ -26,6 +26,7 @@
#include <net/mac80211.h> #include <net/mac80211.h>
int wl1271_tm_cmd(struct ieee80211_hw *hw, void *data, int len); int wl1271_tm_cmd(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
void *data, int len);
#endif /* __WL1271_TESTMODE_H__ */ #endif /* __WL1271_TESTMODE_H__ */

View File

@ -2516,8 +2516,8 @@ enum ieee80211_roc_type {
* in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout * in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
* accordingly. This callback is not required and may sleep. * accordingly. This callback is not required and may sleep.
* *
* @testmode_cmd: Implement a cfg80211 test mode command. * @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may
* The callback can sleep. * be %NULL. The callback can sleep.
* @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep. * @testmode_dump: Implement a cfg80211 test mode dump. The callback can sleep.
* *
* @flush: Flush all pending frames from the hardware queue, making sure * @flush: Flush all pending frames from the hardware queue, making sure
@ -2778,7 +2778,8 @@ struct ieee80211_ops {
void (*rfkill_poll)(struct ieee80211_hw *hw); void (*rfkill_poll)(struct ieee80211_hw *hw);
void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class); void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
#ifdef CONFIG_NL80211_TESTMODE #ifdef CONFIG_NL80211_TESTMODE
int (*testmode_cmd)(struct ieee80211_hw *hw, void *data, int len); int (*testmode_cmd)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
void *data, int len);
int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb, int (*testmode_dump)(struct ieee80211_hw *hw, struct sk_buff *skb,
struct netlink_callback *cb, struct netlink_callback *cb,
void *data, int len); void *data, int len);

View File

@ -2305,11 +2305,20 @@ static int ieee80211_testmode_cmd(struct wiphy *wiphy,
void *data, int len) void *data, int len)
{ {
struct ieee80211_local *local = wiphy_priv(wiphy); struct ieee80211_local *local = wiphy_priv(wiphy);
struct ieee80211_vif *vif = NULL;
if (!local->ops->testmode_cmd) if (!local->ops->testmode_cmd)
return -EOPNOTSUPP; return -EOPNOTSUPP;
return local->ops->testmode_cmd(&local->hw, data, len); if (wdev) {
struct ieee80211_sub_if_data *sdata;
sdata = IEEE80211_WDEV_TO_SUB_IF(wdev);
if (sdata->flags & IEEE80211_SDATA_IN_DRIVER)
vif = &sdata->vif;
}
return local->ops->testmode_cmd(&local->hw, vif, data, len);
} }
static int ieee80211_testmode_dump(struct wiphy *wiphy, static int ieee80211_testmode_dump(struct wiphy *wiphy,