Skip to content

Commit

Permalink
Merge branch 'for-john' of git://git.kernel.org/pub/scm/linux/kernel/…
Browse files Browse the repository at this point in the history
…git/jberg/mac80211-next
  • Loading branch information
linvjw committed Aug 16, 2013
2 parents 41caa76 + 27b3eb9 commit d074666
Show file tree
Hide file tree
Showing 28 changed files with 707 additions and 372 deletions.
1 change: 1 addition & 0 deletions Documentation/DocBook/80211.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,7 @@
<title>functions/definitions</title>
!Finclude/net/mac80211.h ieee80211_rx_status
!Finclude/net/mac80211.h mac80211_rx_flags
!Finclude/net/mac80211.h mac80211_tx_info_flags
!Finclude/net/mac80211.h mac80211_tx_control_flags
!Finclude/net/mac80211.h mac80211_rate_control_flags
!Finclude/net/mac80211.h ieee80211_tx_rate
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath6kl/testmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len)
ath6kl_warn("nla_put failed on testmode rx skb!\n");
}

int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len)
int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
void *data, int len)
{
struct ath6kl *ar = wiphy_priv(wiphy);
struct nlattr *tb[ATH6KL_TM_ATTR_MAX + 1];
Expand Down
7 changes: 5 additions & 2 deletions drivers/net/wireless/ath/ath6kl/testmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@
#ifdef CONFIG_NL80211_TESTMODE

void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf, size_t buf_len);
int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len);
int ath6kl_tm_cmd(struct wiphy *wiphy, struct wireless_dev *wdev,
void *data, int len);

#else

Expand All @@ -29,7 +30,9 @@ static inline void ath6kl_tm_rx_event(struct ath6kl *ar, void *buf,
{
}

static inline int ath6kl_tm_cmd(struct wiphy *wiphy, void *data, int len)
static inline int ath6kl_tm_cmd(struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len)
{
return 0;
}
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -3155,7 +3155,9 @@ static int brcmf_cfg80211_sched_scan_stop(struct wiphy *wiphy,
}

#ifdef CONFIG_NL80211_TESTMODE
static int brcmf_cfg80211_testmode(struct wiphy *wiphy, void *data, int len)
static int brcmf_cfg80211_testmode(struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len)
{
struct brcmf_cfg80211_info *cfg = wiphy_to_cfg(wiphy);
struct net_device *ndev = cfg_to_ndev(cfg);
Expand Down
2 changes: 1 addition & 1 deletion drivers/net/wireless/iwlwifi/dvm/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ static void iwlagn_tx_cmd_build_basic(struct iwl_priv *priv,
priv->lib->bt_params->advanced_bt_coexist &&
(ieee80211_is_auth(fc) || ieee80211_is_assoc_req(fc) ||
ieee80211_is_reassoc_req(fc) ||
skb->protocol == cpu_to_be16(ETH_P_PAE)))
info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO))
tx_flags |= TX_CMD_FLG_IGNORE_BT;


Expand Down
7 changes: 4 additions & 3 deletions drivers/net/wireless/iwlwifi/iwl-devtrace.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,11 @@
static inline bool iwl_trace_data(struct sk_buff *skb)
{
struct ieee80211_hdr *hdr = (void *)skb->data;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);

if (ieee80211_is_data(hdr->frame_control))
return skb->protocol != cpu_to_be16(ETH_P_PAE);
return false;
if (!ieee80211_is_data(hdr->frame_control))
return false;
return !(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO);
}

static inline size_t iwl_rx_trace_len(const struct iwl_trans *trans,
Expand Down
7 changes: 2 additions & 5 deletions drivers/net/wireless/iwlwifi/mvm/time-event.c
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@
#include "iwl-prph.h"

/* A TimeUnit is 1024 microsecond */
#define TU_TO_JIFFIES(_tu) (usecs_to_jiffies((_tu) * 1024))
#define MSEC_TO_TU(_msec) (_msec*1000/1024)

/*
Expand Down Expand Up @@ -191,8 +190,7 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
iwl_mvm_te_clear_data(mvm, te_data);
} else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {
te_data->running = true;
te_data->end_jiffies = jiffies +
TU_TO_JIFFIES(te_data->duration);
te_data->end_jiffies = TU_TO_EXP_TIME(te_data->duration);

if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) {
set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status);
Expand Down Expand Up @@ -329,8 +327,7 @@ void iwl_mvm_protect_session(struct iwl_mvm *mvm,
lockdep_assert_held(&mvm->mutex);

if (te_data->running &&
time_after(te_data->end_jiffies,
jiffies + TU_TO_JIFFIES(min_duration))) {
time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) {
IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n",
jiffies_to_msecs(te_data->end_jiffies - jiffies));
return;
Expand Down
9 changes: 4 additions & 5 deletions drivers/net/wireless/iwlwifi/mvm/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,10 @@ static void iwl_mvm_set_tx_cmd(struct iwl_mvm *mvm, struct sk_buff *skb,
tx_flags |= TX_CMD_FLG_ACK | TX_CMD_FLG_BAR;

/* High prio packet (wrt. BT coex) if it is EAPOL, MCAST or MGMT */
if (info->band == IEEE80211_BAND_2GHZ &&
(skb->protocol == cpu_to_be16(ETH_P_PAE) ||
is_multicast_ether_addr(hdr->addr1) ||
ieee80211_is_back_req(fc) ||
ieee80211_is_mgmt(fc)))
if (info->band == IEEE80211_BAND_2GHZ &&
(info->control.flags & IEEE80211_TX_CTRL_PORT_CTRL_PROTO ||
is_multicast_ether_addr(hdr->addr1) ||
ieee80211_is_back_req(fc) || ieee80211_is_mgmt(fc)))
tx_flags |= TX_CMD_FLG_BT_DIS;

if (ieee80211_has_morefrags(fc))
Expand Down
1 change: 1 addition & 0 deletions drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 mac80211_hwsim_testmode_cmd(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
void *data, int len)
{
struct mac80211_hwsim_data *hwsim = hw->priv;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ti/wlcore/testmode.c
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,8 @@ static int wl12xx_tm_cmd_get_mac(struct wl1271 *wl, struct nlattr *tb[])
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 nlattr *tb[WL1271_TM_ATTR_MAX + 1];
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ti/wlcore/testmode.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

#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__ */
4 changes: 4 additions & 0 deletions include/linux/ieee80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2288,4 +2288,8 @@ static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
return !!(tim->virtual_map[index] & mask);
}

/* convert time units */
#define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
#define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))

#endif /* LINUX_IEEE80211_H */
5 changes: 3 additions & 2 deletions include/net/cfg80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2081,7 +2081,7 @@ struct cfg80211_update_ft_ies_params {
* @mgmt_tx_cancel_wait: Cancel the wait time from transmitting a management
* frame on another channel
*
* @testmode_cmd: run a test mode command
* @testmode_cmd: run a test mode command; @wdev may be %NULL
* @testmode_dump: Implement a test mode dump. The cb->args[2] and up may be
* used by the function, but 0 and 1 must not be touched. Additionally,
* return error codes other than -ENOBUFS and -ENOENT will terminate the
Expand Down Expand Up @@ -2290,7 +2290,8 @@ struct cfg80211_ops {
void (*rfkill_poll)(struct wiphy *wiphy);

#ifdef CONFIG_NL80211_TESTMODE
int (*testmode_cmd)(struct wiphy *wiphy, void *data, int len);
int (*testmode_cmd)(struct wiphy *wiphy, struct wireless_dev *wdev,
void *data, int len);
int (*testmode_dump)(struct wiphy *wiphy, struct sk_buff *skb,
struct netlink_callback *cb,
void *data, int len);
Expand Down
109 changes: 103 additions & 6 deletions include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ struct ieee80211_bss_conf {
};

/**
* enum mac80211_tx_control_flags - flags to describe transmission information/status
* enum mac80211_tx_info_flags - flags to describe transmission information/status
*
* These flags are used with the @flags member of &ieee80211_tx_info.
*
Expand Down Expand Up @@ -471,7 +471,7 @@ struct ieee80211_bss_conf {
* Note: If you have to add new flags to the enumeration, then don't
* forget to update %IEEE80211_TX_TEMPORARY_FLAGS when necessary.
*/
enum mac80211_tx_control_flags {
enum mac80211_tx_info_flags {
IEEE80211_TX_CTL_REQ_TX_STATUS = BIT(0),
IEEE80211_TX_CTL_ASSIGN_SEQ = BIT(1),
IEEE80211_TX_CTL_NO_ACK = BIT(2),
Expand Down Expand Up @@ -507,6 +507,18 @@ enum mac80211_tx_control_flags {

#define IEEE80211_TX_CTL_STBC_SHIFT 23

/**
* enum mac80211_tx_control_flags - flags to describe transmit control
*
* @IEEE80211_TX_CTRL_PORT_CTRL_PROTO: this frame is a port control
* protocol frame (e.g. EAP)
*
* These flags are used in tx_info->control.flags.
*/
enum mac80211_tx_control_flags {
IEEE80211_TX_CTRL_PORT_CTRL_PROTO = BIT(0),
};

/*
* This definition is used as a mask to clear all temporary flags, which are
* set by the tx handlers for each transmission attempt by the mac80211 stack.
Expand Down Expand Up @@ -680,7 +692,8 @@ struct ieee80211_tx_info {
/* NB: vif can be NULL for injected frames */
struct ieee80211_vif *vif;
struct ieee80211_key_conf *hw_key;
/* 8 bytes free */
u32 flags;
/* 4 bytes free */
} control;
struct {
struct ieee80211_tx_rate rates[IEEE80211_TX_MAX_RATES];
Expand Down Expand Up @@ -2503,8 +2516,8 @@ enum ieee80211_roc_type {
* in IEEE 802.11-2007 section 17.3.8.6 and modify ACK timeout
* accordingly. This callback is not required and may sleep.
*
* @testmode_cmd: Implement a cfg80211 test mode command.
* The callback can sleep.
* @testmode_cmd: Implement a cfg80211 test mode command. The passed @vif may
* be %NULL. 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
Expand Down Expand Up @@ -2765,7 +2778,8 @@ struct ieee80211_ops {
void (*rfkill_poll)(struct ieee80211_hw *hw);
void (*set_coverage_class)(struct ieee80211_hw *hw, u8 coverage_class);
#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,
struct netlink_callback *cb,
void *data, int len);
Expand Down Expand Up @@ -3673,6 +3687,89 @@ void ieee80211_get_key_tx_seq(struct ieee80211_key_conf *keyconf,
void ieee80211_get_key_rx_seq(struct ieee80211_key_conf *keyconf,
int tid, struct ieee80211_key_seq *seq);

/**
* ieee80211_set_key_tx_seq - set key TX sequence counter
*
* @keyconf: the parameter passed with the set key
* @seq: new sequence data
*
* This function allows a driver to set the current TX IV/PNs for the
* given key. This is useful when resuming from WoWLAN sleep and the
* device may have transmitted frames using the PTK, e.g. replies to
* ARP requests.
*
* Note that this function may only be called when no TX processing
* can be done concurrently.
*/
void ieee80211_set_key_tx_seq(struct ieee80211_key_conf *keyconf,
struct ieee80211_key_seq *seq);

/**
* ieee80211_set_key_rx_seq - set key RX sequence counter
*
* @keyconf: the parameter passed with the set key
* @tid: The TID, or -1 for the management frame value (CCMP only);
* the value on TID 0 is also used for non-QoS frames. For
* CMAC, only TID 0 is valid.
* @seq: new sequence data
*
* This function allows a driver to set the current RX IV/PNs for the
* given key. This is useful when resuming from WoWLAN sleep and GTK
* rekey may have been done while suspended. It should not be called
* if IV checking is done by the device and not by mac80211.
*
* Note that this function may only be called when no RX processing
* can be done concurrently.
*/
void ieee80211_set_key_rx_seq(struct ieee80211_key_conf *keyconf,
int tid, struct ieee80211_key_seq *seq);

/**
* ieee80211_remove_key - remove the given key
* @keyconf: the parameter passed with the set key
*
* Remove the given key. If the key was uploaded to the hardware at the
* time this function is called, it is not deleted in the hardware but
* instead assumed to have been removed already.
*
* Note that due to locking considerations this function can (currently)
* only be called during key iteration (ieee80211_iter_keys().)
*/
void ieee80211_remove_key(struct ieee80211_key_conf *keyconf);

/**
* ieee80211_gtk_rekey_add - add a GTK key from rekeying during WoWLAN
* @vif: the virtual interface to add the key on
* @keyconf: new key data
*
* When GTK rekeying was done while the system was suspended, (a) new
* key(s) will be available. These will be needed by mac80211 for proper
* RX processing, so this function allows setting them.
*
* The function returns the newly allocated key structure, which will
* have similar contents to the passed key configuration but point to
* mac80211-owned memory. In case of errors, the function returns an
* ERR_PTR(), use IS_ERR() etc.
*
* Note that this function assumes the key isn't added to hardware
* acceleration, so no TX will be done with the key. Since it's a GTK
* on managed (station) networks, this is true anyway. If the driver
* calls this function from the resume callback and subsequently uses
* the return code 1 to reconfigure the device, this key will be part
* of the reconfiguration.
*
* Note that the driver should also call ieee80211_set_key_rx_seq()
* for the new key for each TID to set up sequence counters properly.
*
* IMPORTANT: If this replaces a key that is present in the hardware,
* then it will attempt to remove it during this call. In many cases
* this isn't what you want, so call ieee80211_remove_key() first for
* the key that's being replaced.
*/
struct ieee80211_key_conf *
ieee80211_gtk_rekey_add(struct ieee80211_vif *vif,
struct ieee80211_key_conf *keyconf);

/**
* ieee80211_gtk_rekey_notify - notify userspace supplicant of rekeying
* @vif: virtual interface the rekeying was done on
Expand Down
15 changes: 13 additions & 2 deletions net/mac80211/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -2302,14 +2302,25 @@ static void ieee80211_rfkill_poll(struct wiphy *wiphy)
}

#ifdef CONFIG_NL80211_TESTMODE
static int ieee80211_testmode_cmd(struct wiphy *wiphy, void *data, int len)
static int ieee80211_testmode_cmd(struct wiphy *wiphy,
struct wireless_dev *wdev,
void *data, int len)
{
struct ieee80211_local *local = wiphy_priv(wiphy);
struct ieee80211_vif *vif = NULL;

if (!local->ops->testmode_cmd)
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,
Expand Down
Loading

0 comments on commit d074666

Please sign in to comment.