aboutsummaryrefslogtreecommitdiffstats
path: root/net/mac80211/tx.c
diff options
context:
space:
mode:
authorJohannes Berg <johannes@sipsolutions.net>2009-11-16 17:20:41 -0500
committerJohn W. Linville <linville@tuxdriver.com>2009-11-18 17:09:18 -0500
commitd84f323477260e773d5317ad7cbe50f76115cb47 (patch)
tree815047721ed953ab2b39aa606f95cee646fc5be6 /net/mac80211/tx.c
parent5f0b7de59fae1e57b2481c9756cd4a0f6308530f (diff)
mac80211: remove dev_hold/put calls
If we move the rcu sections a little, there's no need to touch the device refcount. Signed-off-by: Johannes Berg <johannes@sipsolutions.net> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r--net/mac80211/tx.c16
1 files changed, 5 insertions, 11 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c
index 3ad053f6de12..375cecc837a1 100644
--- a/net/mac80211/tx.c
+++ b/net/mac80211/tx.c
@@ -1430,8 +1430,6 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1430 int headroom; 1430 int headroom;
1431 bool may_encrypt; 1431 bool may_encrypt;
1432 1432
1433 dev_hold(sdata->dev);
1434
1435 if (need_dynamic_ps(local)) { 1433 if (need_dynamic_ps(local)) {
1436 if (local->hw.conf.flags & IEEE80211_CONF_PS) { 1434 if (local->hw.conf.flags & IEEE80211_CONF_PS) {
1437 ieee80211_stop_queues_by_reason(&local->hw, 1435 ieee80211_stop_queues_by_reason(&local->hw,
@@ -1446,6 +1444,8 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1446 1444
1447 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS; 1445 info->flags |= IEEE80211_TX_CTL_REQ_TX_STATUS;
1448 1446
1447 rcu_read_lock();
1448
1449 if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) { 1449 if (unlikely(sdata->vif.type == NL80211_IFTYPE_MONITOR)) {
1450 int hdrlen; 1450 int hdrlen;
1451 u16 len_rthdr; 1451 u16 len_rthdr;
@@ -1468,7 +1468,6 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1468 * support we will need a different mechanism. 1468 * support we will need a different mechanism.
1469 */ 1469 */
1470 1470
1471 rcu_read_lock();
1472 list_for_each_entry_rcu(tmp_sdata, &local->interfaces, 1471 list_for_each_entry_rcu(tmp_sdata, &local->interfaces,
1473 list) { 1472 list) {
1474 if (!netif_running(tmp_sdata->dev)) 1473 if (!netif_running(tmp_sdata->dev))
@@ -1477,13 +1476,10 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1477 continue; 1476 continue;
1478 if (compare_ether_addr(tmp_sdata->dev->dev_addr, 1477 if (compare_ether_addr(tmp_sdata->dev->dev_addr,
1479 hdr->addr2) == 0) { 1478 hdr->addr2) == 0) {
1480 dev_hold(tmp_sdata->dev);
1481 dev_put(sdata->dev);
1482 sdata = tmp_sdata; 1479 sdata = tmp_sdata;
1483 break; 1480 break;
1484 } 1481 }
1485 } 1482 }
1486 rcu_read_unlock();
1487 } 1483 }
1488 } 1484 }
1489 1485
@@ -1497,7 +1493,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1497 1493
1498 if (ieee80211_skb_resize(local, skb, headroom, may_encrypt)) { 1494 if (ieee80211_skb_resize(local, skb, headroom, may_encrypt)) {
1499 dev_kfree_skb(skb); 1495 dev_kfree_skb(skb);
1500 dev_put(sdata->dev); 1496 rcu_read_unlock();
1501 return; 1497 return;
1502 } 1498 }
1503 1499
@@ -1508,13 +1504,13 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
1508 !is_multicast_ether_addr(hdr->addr1)) 1504 !is_multicast_ether_addr(hdr->addr1))
1509 if (mesh_nexthop_lookup(skb, sdata)) { 1505 if (mesh_nexthop_lookup(skb, sdata)) {
1510 /* skb queued: don't free */ 1506 /* skb queued: don't free */
1511 dev_put(sdata->dev); 1507 rcu_read_unlock();
1512 return; 1508 return;
1513 } 1509 }
1514 1510
1515 ieee80211_select_queue(local, skb); 1511 ieee80211_select_queue(local, skb);
1516 ieee80211_tx(sdata, skb, false); 1512 ieee80211_tx(sdata, skb, false);
1517 dev_put(sdata->dev); 1513 rcu_read_unlock();
1518} 1514}
1519 1515
1520netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1516netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
@@ -1964,12 +1960,10 @@ void ieee80211_tx_pending(unsigned long data)
1964 } 1960 }
1965 1961
1966 sdata = vif_to_sdata(info->control.vif); 1962 sdata = vif_to_sdata(info->control.vif);
1967 dev_hold(sdata->dev);
1968 spin_unlock_irqrestore(&local->queue_stop_reason_lock, 1963 spin_unlock_irqrestore(&local->queue_stop_reason_lock,
1969 flags); 1964 flags);
1970 1965
1971 txok = ieee80211_tx_pending_skb(local, skb); 1966 txok = ieee80211_tx_pending_skb(local, skb);
1972 dev_put(sdata->dev);
1973 if (!txok) 1967 if (!txok)
1974 __skb_queue_head(&local->pending[i], skb); 1968 __skb_queue_head(&local->pending[i], skb);
1975 spin_lock_irqsave(&local->queue_stop_reason_lock, 1969 spin_lock_irqsave(&local->queue_stop_reason_lock,