Skip to content

Commit

Permalink
mac80211: add vif to flush call
Browse files Browse the repository at this point in the history
This will allow the low level driver to make decision based
on the vif such as queues etc...
Since the vif might be NULL, we can't add it to the tracing
functions.

Signed-off-by: Emmanuel Grumbach <[email protected]>
[fix staging rtl8821ae driver]
Signed-off-by: Johannes Berg <[email protected]>
  • Loading branch information
egrumbach authored and jmberg-intel committed Apr 9, 2014
1 parent 78f22b6 commit 77be2c5
Show file tree
Hide file tree
Showing 20 changed files with 48 additions and 30 deletions.
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ar5523/ar5523.c
Original file line number Diff line number Diff line change
Expand Up @@ -1090,7 +1090,8 @@ static int ar5523_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
return ret;
}

static void ar5523_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void ar5523_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct ar5523 *ar = hw->priv;

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath10k/mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -3544,7 +3544,8 @@ static int ath10k_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
return ret;
}

static void ath10k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void ath10k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct ath10k *ar = hw->priv;
bool skip;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ath/ath9k/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1883,7 +1883,8 @@ static bool ath9k_has_tx_pending(struct ath_softc *sc)
return !!npend;
}

static void ath9k_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void ath9k_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct ath_softc *sc = hw->priv;
struct ath_hw *ah = sc->sc_ah;
Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/ath/carl9170/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1707,7 +1707,9 @@ static int carl9170_op_get_survey(struct ieee80211_hw *hw, int idx,
return 0;
}

static void carl9170_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void carl9170_op_flush(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct ar9170 *ar = hw->priv;
unsigned int vid;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/brcm80211/brcmsmac/mac80211_if.c
Original file line number Diff line number Diff line change
Expand Up @@ -897,7 +897,8 @@ static bool brcms_tx_flush_completed(struct brcms_info *wl)
return result;
}

static void brcms_ops_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void brcms_ops_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct brcms_info *wl = hw->priv;
int ret;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/cw1200/sta.c
Original file line number Diff line number Diff line change
Expand Up @@ -936,7 +936,8 @@ static int __cw1200_flush(struct cw1200_common *priv, bool drop)
return ret;
}

void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct cw1200_common *priv = hw->priv;

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/cw1200/sta.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,8 @@ int cw1200_set_key(struct ieee80211_hw *dev, enum set_key_cmd cmd,

int cw1200_set_rts_threshold(struct ieee80211_hw *hw, u32 value);

void cw1200_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
void cw1200_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop);

u64 cw1200_prepare_multicast(struct ieee80211_hw *hw,
struct netdev_hw_addr_list *mc_list);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/iwlegacy/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -4755,7 +4755,8 @@ il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
}
EXPORT_SYMBOL(il_mac_change_interface);

void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
void il_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct il_priv *il = hw->priv;
unsigned long timeout = jiffies + msecs_to_jiffies(500);
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/iwlegacy/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,8 @@ void il_mac_remove_interface(struct ieee80211_hw *hw,
struct ieee80211_vif *vif);
int il_mac_change_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
enum nl80211_iftype newtype, bool newp2p);
void il_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
void il_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop);
int il_alloc_txq_mem(struct il_priv *il);
void il_free_txq_mem(struct il_priv *il);

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/iwlwifi/dvm/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -1091,7 +1091,8 @@ static void iwlagn_configure_filter(struct ieee80211_hw *hw,
FIF_BCN_PRBRESP_PROMISC | FIF_CONTROL;
}

static void iwlagn_mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void iwlagn_mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct iwl_priv *priv = IWL_MAC80211_GET_DVM(hw);

Expand Down
4 changes: 3 additions & 1 deletion drivers/net/wireless/mac80211_hwsim.c
Original file line number Diff line number Diff line change
Expand Up @@ -1676,7 +1676,9 @@ static int mac80211_hwsim_ampdu_action(struct ieee80211_hw *hw,
return 0;
}

static void mac80211_hwsim_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void mac80211_hwsim_flush(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u32 queues, bool drop)
{
/* Not implemented, queues only on kernel side */
}
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/p54/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,8 @@ static unsigned int p54_flush_count(struct p54_common *priv)
return total;
}

static void p54_flush(struct ieee80211_hw *dev, u32 queues, bool drop)
static void p54_flush(struct ieee80211_hw *dev, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct p54_common *priv = dev->priv;
unsigned int total, i;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/rt2x00/rt2x00.h
Original file line number Diff line number Diff line change
Expand Up @@ -1448,7 +1448,8 @@ int rt2x00mac_conf_tx(struct ieee80211_hw *hw,
struct ieee80211_vif *vif, u16 queue,
const struct ieee80211_tx_queue_params *params);
void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw);
void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop);
void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop);
int rt2x00mac_set_antenna(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
int rt2x00mac_get_antenna(struct ieee80211_hw *hw, u32 *tx_ant, u32 *rx_ant);
void rt2x00mac_get_ringparam(struct ieee80211_hw *hw,
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/rt2x00/rt2x00mac.c
Original file line number Diff line number Diff line change
Expand Up @@ -747,7 +747,8 @@ void rt2x00mac_rfkill_poll(struct ieee80211_hw *hw)
}
EXPORT_SYMBOL_GPL(rt2x00mac_rfkill_poll);

void rt2x00mac_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
void rt2x00mac_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct rt2x00_dev *rt2x00dev = hw->priv;
struct data_queue *queue;
Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/rtlwifi/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1387,7 +1387,8 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
* before switch channel or power save, or tx buffer packet
* maybe send after offchannel or rf sleep, this may cause
* dis-association by AP */
static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void rtl_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);

Expand Down
3 changes: 2 additions & 1 deletion drivers/net/wireless/ti/wlcore/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -5184,7 +5184,8 @@ static void wl12xx_op_channel_switch(struct ieee80211_hw *hw,
mutex_unlock(&wl->mutex);
}

static void wlcore_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void wlcore_op_flush(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct wl1271 *wl = hw->priv;

Expand Down
14 changes: 3 additions & 11 deletions drivers/staging/rtl8821ae/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -1414,23 +1414,15 @@ static void rtl_op_rfkill_poll(struct ieee80211_hw *hw)
* before switch channel or power save, or tx buffer packet
* maybe send after offchannel or rf sleep, this may cause
* dis-association by AP */
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,10,0))
static void rtl_op_flush(struct ieee80211_hw *hw, u32 queues, bool drop)
static void rtl_op_flush(struct ieee80211_hw *hw,
struct ieee80211_vif *vif,
u32 queues, bool drop)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);

if (rtlpriv->intf_ops->flush)
rtlpriv->intf_ops->flush(hw, queues, drop);
}
#else
static void rtl_op_flush(struct ieee80211_hw *hw, bool drop)
{
struct rtl_priv *rtlpriv = rtl_priv(hw);

if (rtlpriv->intf_ops->flush)
rtlpriv->intf_ops->flush(hw, drop);
}
#endif

const struct ieee80211_ops rtl_ops = {
.start = rtl_op_start,
Expand Down
4 changes: 3 additions & 1 deletion include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -2609,6 +2609,7 @@ enum ieee80211_roc_type {
* of queues to flush, which is useful if different virtual interfaces
* use different hardware queues; it may also indicate all queues.
* If the parameter @drop is set to %true, pending frames may be dropped.
* Note that vif can be NULL.
* The callback can sleep.
*
* @channel_switch: Drivers that need (or want) to offload the channel
Expand Down Expand Up @@ -2871,7 +2872,8 @@ struct ieee80211_ops {
struct netlink_callback *cb,
void *data, int len);
#endif
void (*flush)(struct ieee80211_hw *hw, u32 queues, bool drop);
void (*flush)(struct ieee80211_hw *hw, struct ieee80211_vif *vif,
u32 queues, bool drop);
void (*channel_switch)(struct ieee80211_hw *hw,
struct ieee80211_channel_switch *ch_switch);
int (*set_antenna)(struct ieee80211_hw *hw, u32 tx_ant, u32 rx_ant);
Expand Down
8 changes: 7 additions & 1 deletion net/mac80211/driver-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -726,13 +726,19 @@ static inline void drv_rfkill_poll(struct ieee80211_local *local)
}

static inline void drv_flush(struct ieee80211_local *local,
struct ieee80211_sub_if_data *sdata,
u32 queues, bool drop)
{
struct ieee80211_vif *vif = sdata ? &sdata->vif : NULL;

might_sleep();

if (sdata)
check_sdata_in_driver(sdata);

trace_drv_flush(local, queues, drop);
if (local->ops->flush)
local->ops->flush(&local->hw, queues, drop);
local->ops->flush(&local->hw, vif, queues, drop);
trace_drv_return_void(local);
}

Expand Down
2 changes: 1 addition & 1 deletion net/mac80211/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ void ieee80211_flush_queues(struct ieee80211_local *local,
ieee80211_stop_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_FLUSH);

drv_flush(local, queues, false);
drv_flush(local, sdata, queues, false);

ieee80211_wake_queues_by_reason(&local->hw, IEEE80211_MAX_QUEUE_MAP,
IEEE80211_QUEUE_STOP_REASON_FLUSH);
Expand Down

0 comments on commit 77be2c5

Please sign in to comment.