Commit 1870cd71 authored by Johannes Berg's avatar Johannes Berg Committed by John W. Linville

mac80211: clean up __ieee80211_tx args

__ieee80211_tx takes a struct ieee80211_tx_data argument, but only
uses a few of its members, namely 'skb' and 'sta'. Make that explicit,
so that less internal knowledge is required in ieee80211_tx_pending
and the possibility of introducing errors here is removed.
Signed-off-by: default avatarJohannes Berg <johannes@sipsolutions.net>
Reviewed-by: default avatarLuis R. Rodriguez <lrodriguez@atheros.com>
Signed-off-by: default avatarJohn W. Linville <linville@tuxdriver.com>
parent 2a577d98
...@@ -1084,9 +1084,10 @@ static int ieee80211_tx_prepare(struct ieee80211_local *local, ...@@ -1084,9 +1084,10 @@ static int ieee80211_tx_prepare(struct ieee80211_local *local,
} }
static int __ieee80211_tx(struct ieee80211_local *local, static int __ieee80211_tx(struct ieee80211_local *local,
struct ieee80211_tx_data *tx) struct sk_buff **skbp,
struct sta_info *sta)
{ {
struct sk_buff *skb = tx->skb, *next; struct sk_buff *skb = *skbp, *next;
struct ieee80211_tx_info *info; struct ieee80211_tx_info *info;
int ret; int ret;
bool fragm = false; bool fragm = false;
...@@ -1111,23 +1112,23 @@ static int __ieee80211_tx(struct ieee80211_local *local, ...@@ -1111,23 +1112,23 @@ static int __ieee80211_tx(struct ieee80211_local *local,
* We will later move this down into the only driver that * We will later move this down into the only driver that
* needs it, iwlwifi. * needs it, iwlwifi.
*/ */
if (tx->sta && local->hw.ampdu_queues && if (sta && local->hw.ampdu_queues &&
info->flags & IEEE80211_TX_CTL_AMPDU) { info->flags & IEEE80211_TX_CTL_AMPDU) {
unsigned long flags; unsigned long flags;
u8 *qc = ieee80211_get_qos_ctl((void *) skb->data); u8 *qc = ieee80211_get_qos_ctl((void *) skb->data);
int tid = *qc & IEEE80211_QOS_CTL_TID_MASK; int tid = *qc & IEEE80211_QOS_CTL_TID_MASK;
spin_lock_irqsave(&tx->sta->lock, flags); spin_lock_irqsave(&sta->lock, flags);
skb_set_queue_mapping(skb, local->hw.queues + skb_set_queue_mapping(skb, local->hw.queues +
tx->sta->tid_to_tx_q[tid]); sta->tid_to_tx_q[tid]);
spin_unlock_irqrestore(&tx->sta->lock, flags); spin_unlock_irqrestore(&sta->lock, flags);
} }
next = skb->next; next = skb->next;
ret = local->ops->tx(local_to_hw(local), skb); ret = local->ops->tx(local_to_hw(local), skb);
if (ret != NETDEV_TX_OK) if (ret != NETDEV_TX_OK)
return IEEE80211_TX_AGAIN; return IEEE80211_TX_AGAIN;
tx->skb = skb = next; *skbp = skb = next;
ieee80211_led_tx(local, 1); ieee80211_led_tx(local, 1);
fragm = true; fragm = true;
} }
...@@ -1223,7 +1224,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb) ...@@ -1223,7 +1224,7 @@ static int ieee80211_tx(struct net_device *dev, struct sk_buff *skb)
retries = 0; retries = 0;
retry: retry:
ret = __ieee80211_tx(local, &tx); ret = __ieee80211_tx(local, &tx.skb, tx.sta);
switch (ret) { switch (ret) {
case IEEE80211_TX_OK: case IEEE80211_TX_OK:
break; break;
...@@ -1831,7 +1832,6 @@ void ieee80211_tx_pending(unsigned long data) ...@@ -1831,7 +1832,6 @@ void ieee80211_tx_pending(unsigned long data)
struct net_device *dev = local->mdev; struct net_device *dev = local->mdev;
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
unsigned long flags; unsigned long flags;
struct ieee80211_tx_data tx;
int i, ret; int i, ret;
bool next; bool next;
...@@ -1862,14 +1862,15 @@ void ieee80211_tx_pending(unsigned long data) ...@@ -1862,14 +1862,15 @@ void ieee80211_tx_pending(unsigned long data)
netif_start_subqueue(local->mdev, i); netif_start_subqueue(local->mdev, i);
while (!skb_queue_empty(&local->pending[i])) { while (!skb_queue_empty(&local->pending[i])) {
tx.flags = 0; struct sk_buff *skb = skb_dequeue(&local->pending[i]);
tx.skb = skb_dequeue(&local->pending[i]); struct sta_info *sta;
hdr = (struct ieee80211_hdr *)tx.skb->data;
tx.sta = sta_info_get(local, hdr->addr1); hdr = (struct ieee80211_hdr *)skb->data;
sta = sta_info_get(local, hdr->addr1);
ret = __ieee80211_tx(local, &tx); ret = __ieee80211_tx(local, &skb, sta);
if (ret != IEEE80211_TX_OK) { if (ret != IEEE80211_TX_OK) {
skb_queue_head(&local->pending[i], tx.skb); skb_queue_head(&local->pending[i], skb);
break; break;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment