diff options
author | Johannes Berg <johannes@sipsolutions.net> | 2009-11-25 11:46:19 -0500 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2009-12-21 18:38:52 -0500 |
commit | 47846c9b0c10808d9337d2e7d09361f3e0a0a71a (patch) | |
tree | 8e5d0dbf3309b7868fa73a888f9561ffea1580e3 /net/mac80211/tx.c | |
parent | abe60632f311d515b082b450504ee24006023951 (diff) |
mac80211: reduce reliance on netdev
For bluetooth 3, we will most likely not have
a netdev for a virtual interface (sdata), so
prepare for that by reducing the reliance on
having a netdev. This patch moves the name
and address fields into the sdata struct and
uses them from there all over. Some work is
needed to keep them sync'ed, but that's not
a lot of work and in slow paths anyway.
In doing so, this also reduces the number of
pointer dereferences in many places, because
of things like sdata->dev->dev_addr becoming
sdata->vif.addr.
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.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index b913bfc34a9f..ac48c86ae6b3 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -223,7 +223,7 @@ ieee80211_tx_h_check_assoc(struct ieee80211_tx_data *tx) | |||
223 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 223 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
224 | printk(KERN_DEBUG "%s: dropped data frame to not " | 224 | printk(KERN_DEBUG "%s: dropped data frame to not " |
225 | "associated station %pM\n", | 225 | "associated station %pM\n", |
226 | tx->dev->name, hdr->addr1); | 226 | tx->sdata->name, hdr->addr1); |
227 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | 227 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
228 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); | 228 | I802_DEBUG_INC(tx->local->tx_handlers_drop_not_assoc); |
229 | return TX_DROP; | 229 | return TX_DROP; |
@@ -331,7 +331,7 @@ ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) | |||
331 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 331 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
332 | if (net_ratelimit()) | 332 | if (net_ratelimit()) |
333 | printk(KERN_DEBUG "%s: BC TX buffer full - dropping the oldest frame\n", | 333 | printk(KERN_DEBUG "%s: BC TX buffer full - dropping the oldest frame\n", |
334 | tx->dev->name); | 334 | tx->sdata->name); |
335 | #endif | 335 | #endif |
336 | dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); | 336 | dev_kfree_skb(skb_dequeue(&tx->sdata->bss->ps_bc_buf)); |
337 | } else | 337 | } else |
@@ -391,7 +391,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
391 | if (net_ratelimit()) { | 391 | if (net_ratelimit()) { |
392 | printk(KERN_DEBUG "%s: STA %pM TX " | 392 | printk(KERN_DEBUG "%s: STA %pM TX " |
393 | "buffer full - dropping oldest frame\n", | 393 | "buffer full - dropping oldest frame\n", |
394 | tx->dev->name, sta->sta.addr); | 394 | tx->sdata->name, sta->sta.addr); |
395 | } | 395 | } |
396 | #endif | 396 | #endif |
397 | dev_kfree_skb(old); | 397 | dev_kfree_skb(old); |
@@ -416,7 +416,7 @@ ieee80211_tx_h_unicast_ps_buf(struct ieee80211_tx_data *tx) | |||
416 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG | 416 | #ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG |
417 | else if (unlikely(staflags & WLAN_STA_PS_STA)) { | 417 | else if (unlikely(staflags & WLAN_STA_PS_STA)) { |
418 | printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll " | 418 | printk(KERN_DEBUG "%s: STA %pM in PS mode, but pspoll " |
419 | "set -> send frame\n", tx->dev->name, | 419 | "set -> send frame\n", tx->sdata->name, |
420 | sta->sta.addr); | 420 | sta->sta.addr); |
421 | } | 421 | } |
422 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ | 422 | #endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */ |
@@ -549,7 +549,7 @@ ieee80211_tx_h_rate_ctrl(struct ieee80211_tx_data *tx) | |||
549 | "%s: Dropped data frame as no usable bitrate found while " | 549 | "%s: Dropped data frame as no usable bitrate found while " |
550 | "scanning and associated. Target station: " | 550 | "scanning and associated. Target station: " |
551 | "%pM on %d GHz band\n", | 551 | "%pM on %d GHz band\n", |
552 | tx->dev->name, hdr->addr1, | 552 | tx->sdata->name, hdr->addr1, |
553 | tx->channel->band ? 5 : 2)) | 553 | tx->channel->band ? 5 : 2)) |
554 | return TX_DROP; | 554 | return TX_DROP; |
555 | 555 | ||
@@ -1021,7 +1021,6 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1021 | 1021 | ||
1022 | memset(tx, 0, sizeof(*tx)); | 1022 | memset(tx, 0, sizeof(*tx)); |
1023 | tx->skb = skb; | 1023 | tx->skb = skb; |
1024 | tx->dev = sdata->dev; /* use original interface */ | ||
1025 | tx->local = local; | 1024 | tx->local = local; |
1026 | tx->sdata = sdata; | 1025 | tx->sdata = sdata; |
1027 | tx->channel = local->hw.conf.channel; | 1026 | tx->channel = local->hw.conf.channel; |
@@ -1474,7 +1473,7 @@ static void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, | |||
1474 | continue; | 1473 | continue; |
1475 | if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) | 1474 | if (tmp_sdata->vif.type != NL80211_IFTYPE_AP) |
1476 | continue; | 1475 | continue; |
1477 | if (compare_ether_addr(tmp_sdata->dev->dev_addr, | 1476 | if (compare_ether_addr(tmp_sdata->vif.addr, |
1478 | hdr->addr2) == 0) { | 1477 | hdr->addr2) == 0) { |
1479 | sdata = tmp_sdata; | 1478 | sdata = tmp_sdata; |
1480 | break; | 1479 | break; |
@@ -1638,7 +1637,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1638 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1637 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1639 | /* RA TA DA SA */ | 1638 | /* RA TA DA SA */ |
1640 | memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); | 1639 | memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); |
1641 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1640 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1642 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1641 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1643 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1642 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1644 | hdrlen = 30; | 1643 | hdrlen = 30; |
@@ -1652,7 +1651,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1652 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); | 1651 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); |
1653 | /* DA BSSID SA */ | 1652 | /* DA BSSID SA */ |
1654 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 1653 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
1655 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1654 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1656 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); | 1655 | memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); |
1657 | hdrlen = 24; | 1656 | hdrlen = 24; |
1658 | break; | 1657 | break; |
@@ -1660,7 +1659,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1660 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1659 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1661 | /* RA TA DA SA */ | 1660 | /* RA TA DA SA */ |
1662 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); | 1661 | memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); |
1663 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1662 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1664 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1663 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1665 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1664 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1666 | hdrlen = 30; | 1665 | hdrlen = 30; |
@@ -1674,8 +1673,8 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1674 | goto fail; | 1673 | goto fail; |
1675 | } | 1674 | } |
1676 | 1675 | ||
1677 | if (compare_ether_addr(dev->dev_addr, | 1676 | if (compare_ether_addr(sdata->vif.addr, |
1678 | skb->data + ETH_ALEN) == 0) { | 1677 | skb->data + ETH_ALEN) == 0) { |
1679 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, | 1678 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, |
1680 | skb->data, skb->data + ETH_ALEN); | 1679 | skb->data, skb->data + ETH_ALEN); |
1681 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, | 1680 | meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, |
@@ -1705,7 +1704,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1705 | } | 1704 | } |
1706 | } | 1705 | } |
1707 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, | 1706 | hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, |
1708 | mesh_da, dev->dev_addr); | 1707 | mesh_da, sdata->vif.addr); |
1709 | rcu_read_unlock(); | 1708 | rcu_read_unlock(); |
1710 | if (is_mesh_mcast) | 1709 | if (is_mesh_mcast) |
1711 | meshhdrlen = | 1710 | meshhdrlen = |
@@ -1730,7 +1729,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1730 | if (sdata->u.mgd.use_4addr && ethertype != ETH_P_PAE) { | 1729 | if (sdata->u.mgd.use_4addr && ethertype != ETH_P_PAE) { |
1731 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1730 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1732 | /* RA TA DA SA */ | 1731 | /* RA TA DA SA */ |
1733 | memcpy(hdr.addr2, dev->dev_addr, ETH_ALEN); | 1732 | memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); |
1734 | memcpy(hdr.addr3, skb->data, ETH_ALEN); | 1733 | memcpy(hdr.addr3, skb->data, ETH_ALEN); |
1735 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); | 1734 | memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); |
1736 | hdrlen = 30; | 1735 | hdrlen = 30; |
@@ -1781,7 +1780,7 @@ netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
1781 | unlikely(!is_multicast_ether_addr(hdr.addr1) && | 1780 | unlikely(!is_multicast_ether_addr(hdr.addr1) && |
1782 | !(sta_flags & WLAN_STA_AUTHORIZED) && | 1781 | !(sta_flags & WLAN_STA_AUTHORIZED) && |
1783 | !(ethertype == ETH_P_PAE && | 1782 | !(ethertype == ETH_P_PAE && |
1784 | compare_ether_addr(dev->dev_addr, | 1783 | compare_ether_addr(sdata->vif.addr, |
1785 | skb->data + ETH_ALEN) == 0))) { | 1784 | skb->data + ETH_ALEN) == 0))) { |
1786 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG | 1785 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
1787 | if (net_ratelimit()) | 1786 | if (net_ratelimit()) |
@@ -2145,8 +2144,8 @@ struct sk_buff *ieee80211_beacon_get_tim(struct ieee80211_hw *hw, | |||
2145 | mgmt->frame_control = | 2144 | mgmt->frame_control = |
2146 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); | 2145 | cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON); |
2147 | memset(mgmt->da, 0xff, ETH_ALEN); | 2146 | memset(mgmt->da, 0xff, ETH_ALEN); |
2148 | memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN); | 2147 | memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN); |
2149 | memcpy(mgmt->bssid, sdata->dev->dev_addr, ETH_ALEN); | 2148 | memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN); |
2150 | mgmt->u.beacon.beacon_int = | 2149 | mgmt->u.beacon.beacon_int = |
2151 | cpu_to_le16(sdata->vif.bss_conf.beacon_int); | 2150 | cpu_to_le16(sdata->vif.bss_conf.beacon_int); |
2152 | mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */ | 2151 | mgmt->u.beacon.capab_info = 0x0; /* 0x0 for MPs */ |