Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 103175
b: refs/heads/master
c: 97b045d
h: refs/heads/master
i:
  103173: c9c0ae0
  103171: 40736e0
  103167: f0c8ccd
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Jun 26, 2008
1 parent 3ce95ef commit b222a0f
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 43 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 9965183a78ad5303b9154184a0f4056844e8baae
refs/heads/master: 97b045d62bffae5a91a286b56ac51db0c4385687
82 changes: 40 additions & 42 deletions trunk/net/mac80211/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -1083,13 +1083,46 @@ static int __ieee80211_tx(struct ieee80211_local *local, struct sk_buff *skb,
return IEEE80211_TX_OK;
}

/*
* Invoke TX handlers, return 0 on success and non-zero if the
* frame was dropped or queued.
*/
static int invoke_tx_handlers(struct ieee80211_tx_data *tx)
{
struct ieee80211_local *local = tx->local;
struct sk_buff *skb = tx->skb;
ieee80211_tx_handler *handler;
ieee80211_tx_result res = TX_DROP;
int i;

for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
res = (*handler)(tx);
if (res != TX_CONTINUE)
break;
}

if (unlikely(res == TX_DROP)) {
I802_DEBUG_INC(local->tx_handlers_drop);
dev_kfree_skb(skb);
for (i = 0; i < tx->num_extra_frag; i++)
if (tx->extra_frag[i])
dev_kfree_skb(tx->extra_frag[i]);
kfree(tx->extra_frag);
return -1;
} else if (unlikely(res == TX_QUEUED)) {
I802_DEBUG_INC(local->tx_handlers_queued);
return -1;
}

return 0;
}

static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
{
struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
struct sta_info *sta;
ieee80211_tx_handler *handler;
struct ieee80211_tx_data tx;
ieee80211_tx_result res = TX_DROP, res_prepare;
ieee80211_tx_result res_prepare;
struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb);
int ret, i;
u16 queue;
Expand Down Expand Up @@ -1118,26 +1151,8 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
tx.channel = local->hw.conf.channel;
info->band = tx.channel->band;

for (handler = ieee80211_tx_handlers; *handler != NULL;
handler++) {
res = (*handler)(&tx);
if (res != TX_CONTINUE)
break;
}

if (WARN_ON(tx.skb != skb))
goto drop;

if (unlikely(res == TX_DROP)) {
I802_DEBUG_INC(local->tx_handlers_drop);
goto drop;
}

if (unlikely(res == TX_QUEUED)) {
I802_DEBUG_INC(local->tx_handlers_queued);
rcu_read_unlock();
return 0;
}
if (invoke_tx_handlers(&tx))
goto out;

if (tx.extra_frag) {
for (i = 0; i < tx.num_extra_frag; i++) {
Expand Down Expand Up @@ -1198,6 +1213,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
store->last_frag_rate_ctrl_probe =
!!(tx.flags & IEEE80211_TX_PROBE_LAST_FRAG);
}
out:
rcu_read_unlock();
return 0;

Expand Down Expand Up @@ -1948,9 +1964,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
struct ieee80211_local *local = hw_to_local(hw);
struct sk_buff *skb = NULL;
struct sta_info *sta;
ieee80211_tx_handler *handler;
struct ieee80211_tx_data tx;
ieee80211_tx_result res = TX_DROP;
struct net_device *bdev;
struct ieee80211_sub_if_data *sdata;
struct ieee80211_if_ap *bss = NULL;
Expand Down Expand Up @@ -2001,25 +2015,9 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw,
tx.channel = local->hw.conf.channel;
info->band = tx.channel->band;

for (handler = ieee80211_tx_handlers; *handler != NULL; handler++) {
res = (*handler)(&tx);
if (res == TX_DROP || res == TX_QUEUED)
break;
}

if (WARN_ON(tx.skb != skb))
res = TX_DROP;

if (res == TX_DROP) {
I802_DEBUG_INC(local->tx_handlers_drop);
dev_kfree_skb(skb);
skb = NULL;
} else if (res == TX_QUEUED) {
I802_DEBUG_INC(local->tx_handlers_queued);
if (invoke_tx_handlers(&tx))
skb = NULL;
}

out:
out:
rcu_read_unlock();

return skb;
Expand Down

0 comments on commit b222a0f

Please sign in to comment.