diff options
Diffstat (limited to 'net/mac80211/tx.c')
-rw-r--r-- | net/mac80211/tx.c | 266 |
1 files changed, 156 insertions, 110 deletions
diff --git a/net/mac80211/tx.c b/net/mac80211/tx.c index 07bd8db00af8..9f7fb4eec37b 100644 --- a/net/mac80211/tx.c +++ b/net/mac80211/tx.c | |||
@@ -20,7 +20,6 @@ | |||
20 | #include <linux/bitmap.h> | 20 | #include <linux/bitmap.h> |
21 | #include <linux/rcupdate.h> | 21 | #include <linux/rcupdate.h> |
22 | #include <linux/export.h> | 22 | #include <linux/export.h> |
23 | #include <linux/time.h> | ||
24 | #include <net/net_namespace.h> | 23 | #include <net/net_namespace.h> |
25 | #include <net/ieee80211_radiotap.h> | 24 | #include <net/ieee80211_radiotap.h> |
26 | #include <net/cfg80211.h> | 25 | #include <net/cfg80211.h> |
@@ -595,23 +594,8 @@ ieee80211_tx_h_select_key(struct ieee80211_tx_data *tx) | |||
595 | else if (!is_multicast_ether_addr(hdr->addr1) && | 594 | else if (!is_multicast_ether_addr(hdr->addr1) && |
596 | (key = rcu_dereference(tx->sdata->default_unicast_key))) | 595 | (key = rcu_dereference(tx->sdata->default_unicast_key))) |
597 | tx->key = key; | 596 | tx->key = key; |
598 | else if (info->flags & IEEE80211_TX_CTL_INJECTED) | 597 | else |
599 | tx->key = NULL; | ||
600 | else if (!tx->sdata->drop_unencrypted) | ||
601 | tx->key = NULL; | ||
602 | else if (tx->skb->protocol == tx->sdata->control_port_protocol) | ||
603 | tx->key = NULL; | ||
604 | else if (ieee80211_is_robust_mgmt_frame(tx->skb) && | ||
605 | !(ieee80211_is_action(hdr->frame_control) && | ||
606 | tx->sta && test_sta_flag(tx->sta, WLAN_STA_MFP))) | ||
607 | tx->key = NULL; | ||
608 | else if (ieee80211_is_mgmt(hdr->frame_control) && | ||
609 | !ieee80211_is_robust_mgmt_frame(tx->skb)) | ||
610 | tx->key = NULL; | 598 | tx->key = NULL; |
611 | else { | ||
612 | I802_DEBUG_INC(tx->local->tx_handlers_drop_unencrypted); | ||
613 | return TX_DROP; | ||
614 | } | ||
615 | 599 | ||
616 | if (tx->key) { | 600 | if (tx->key) { |
617 | bool skip_hw = false; | 601 | bool skip_hw = false; |
@@ -1137,11 +1121,13 @@ static bool ieee80211_tx_prep_agg(struct ieee80211_tx_data *tx, | |||
1137 | 1121 | ||
1138 | /* | 1122 | /* |
1139 | * initialises @tx | 1123 | * initialises @tx |
1124 | * pass %NULL for the station if unknown, a valid pointer if known | ||
1125 | * or an ERR_PTR() if the station is known not to exist | ||
1140 | */ | 1126 | */ |
1141 | static ieee80211_tx_result | 1127 | static ieee80211_tx_result |
1142 | ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | 1128 | ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, |
1143 | struct ieee80211_tx_data *tx, | 1129 | struct ieee80211_tx_data *tx, |
1144 | struct sk_buff *skb) | 1130 | struct sta_info *sta, struct sk_buff *skb) |
1145 | { | 1131 | { |
1146 | struct ieee80211_local *local = sdata->local; | 1132 | struct ieee80211_local *local = sdata->local; |
1147 | struct ieee80211_hdr *hdr; | 1133 | struct ieee80211_hdr *hdr; |
@@ -1164,17 +1150,22 @@ ieee80211_tx_prepare(struct ieee80211_sub_if_data *sdata, | |||
1164 | 1150 | ||
1165 | hdr = (struct ieee80211_hdr *) skb->data; | 1151 | hdr = (struct ieee80211_hdr *) skb->data; |
1166 | 1152 | ||
1167 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { | 1153 | if (likely(sta)) { |
1168 | tx->sta = rcu_dereference(sdata->u.vlan.sta); | 1154 | if (!IS_ERR(sta)) |
1169 | if (!tx->sta && sdata->dev->ieee80211_ptr->use_4addr) | 1155 | tx->sta = sta; |
1170 | return TX_DROP; | 1156 | } else { |
1171 | } else if (info->flags & (IEEE80211_TX_CTL_INJECTED | | 1157 | if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN) { |
1172 | IEEE80211_TX_INTFL_NL80211_FRAME_TX) || | 1158 | tx->sta = rcu_dereference(sdata->u.vlan.sta); |
1173 | tx->sdata->control_port_protocol == tx->skb->protocol) { | 1159 | if (!tx->sta && sdata->wdev.use_4addr) |
1174 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | 1160 | return TX_DROP; |
1161 | } else if (info->flags & (IEEE80211_TX_INTFL_NL80211_FRAME_TX | | ||
1162 | IEEE80211_TX_CTL_INJECTED) || | ||
1163 | tx->sdata->control_port_protocol == tx->skb->protocol) { | ||
1164 | tx->sta = sta_info_get_bss(sdata, hdr->addr1); | ||
1165 | } | ||
1166 | if (!tx->sta && !is_multicast_ether_addr(hdr->addr1)) | ||
1167 | tx->sta = sta_info_get(sdata, hdr->addr1); | ||
1175 | } | 1168 | } |
1176 | if (!tx->sta) | ||
1177 | tx->sta = sta_info_get(sdata, hdr->addr1); | ||
1178 | 1169 | ||
1179 | if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && | 1170 | if (tx->sta && ieee80211_is_data_qos(hdr->frame_control) && |
1180 | !ieee80211_is_qos_nullfunc(hdr->frame_control) && | 1171 | !ieee80211_is_qos_nullfunc(hdr->frame_control) && |
@@ -1422,8 +1413,9 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, | |||
1422 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); | 1413 | struct ieee80211_sub_if_data *sdata = vif_to_sdata(vif); |
1423 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1414 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
1424 | struct ieee80211_tx_data tx; | 1415 | struct ieee80211_tx_data tx; |
1416 | struct sk_buff *skb2; | ||
1425 | 1417 | ||
1426 | if (ieee80211_tx_prepare(sdata, &tx, skb) == TX_DROP) | 1418 | if (ieee80211_tx_prepare(sdata, &tx, NULL, skb) == TX_DROP) |
1427 | return false; | 1419 | return false; |
1428 | 1420 | ||
1429 | info->band = band; | 1421 | info->band = band; |
@@ -1440,6 +1432,14 @@ bool ieee80211_tx_prepare_skb(struct ieee80211_hw *hw, | |||
1440 | *sta = NULL; | 1432 | *sta = NULL; |
1441 | } | 1433 | } |
1442 | 1434 | ||
1435 | /* this function isn't suitable for fragmented data frames */ | ||
1436 | skb2 = __skb_dequeue(&tx.skbs); | ||
1437 | if (WARN_ON(skb2 != skb || !skb_queue_empty(&tx.skbs))) { | ||
1438 | ieee80211_free_txskb(hw, skb2); | ||
1439 | ieee80211_purge_tx_queue(hw, &tx.skbs); | ||
1440 | return false; | ||
1441 | } | ||
1442 | |||
1443 | return true; | 1443 | return true; |
1444 | } | 1444 | } |
1445 | EXPORT_SYMBOL(ieee80211_tx_prepare_skb); | 1445 | EXPORT_SYMBOL(ieee80211_tx_prepare_skb); |
@@ -1448,7 +1448,8 @@ EXPORT_SYMBOL(ieee80211_tx_prepare_skb); | |||
1448 | * Returns false if the frame couldn't be transmitted but was queued instead. | 1448 | * Returns false if the frame couldn't be transmitted but was queued instead. |
1449 | */ | 1449 | */ |
1450 | static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, | 1450 | static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, |
1451 | struct sk_buff *skb, bool txpending) | 1451 | struct sta_info *sta, struct sk_buff *skb, |
1452 | bool txpending) | ||
1452 | { | 1453 | { |
1453 | struct ieee80211_local *local = sdata->local; | 1454 | struct ieee80211_local *local = sdata->local; |
1454 | struct ieee80211_tx_data tx; | 1455 | struct ieee80211_tx_data tx; |
@@ -1464,7 +1465,7 @@ static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, | |||
1464 | 1465 | ||
1465 | /* initialises tx */ | 1466 | /* initialises tx */ |
1466 | led_len = skb->len; | 1467 | led_len = skb->len; |
1467 | res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); | 1468 | res_prepare = ieee80211_tx_prepare(sdata, &tx, sta, skb); |
1468 | 1469 | ||
1469 | if (unlikely(res_prepare == TX_DROP)) { | 1470 | if (unlikely(res_prepare == TX_DROP)) { |
1470 | ieee80211_free_txskb(&local->hw, skb); | 1471 | ieee80211_free_txskb(&local->hw, skb); |
@@ -1520,7 +1521,8 @@ static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, | |||
1520 | return 0; | 1521 | return 0; |
1521 | } | 1522 | } |
1522 | 1523 | ||
1523 | void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | 1524 | void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, |
1525 | struct sta_info *sta, struct sk_buff *skb) | ||
1524 | { | 1526 | { |
1525 | struct ieee80211_local *local = sdata->local; | 1527 | struct ieee80211_local *local = sdata->local; |
1526 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); | 1528 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
@@ -1555,7 +1557,7 @@ void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | |||
1555 | } | 1557 | } |
1556 | 1558 | ||
1557 | ieee80211_set_qos_hdr(sdata, skb); | 1559 | ieee80211_set_qos_hdr(sdata, skb); |
1558 | ieee80211_tx(sdata, skb, false); | 1560 | ieee80211_tx(sdata, sta, skb, false); |
1559 | } | 1561 | } |
1560 | 1562 | ||
1561 | static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb) | 1563 | static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb) |
@@ -1776,7 +1778,7 @@ netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, | |||
1776 | goto fail_rcu; | 1778 | goto fail_rcu; |
1777 | 1779 | ||
1778 | info->band = chandef->chan->band; | 1780 | info->band = chandef->chan->band; |
1779 | ieee80211_xmit(sdata, skb); | 1781 | ieee80211_xmit(sdata, NULL, skb); |
1780 | rcu_read_unlock(); | 1782 | rcu_read_unlock(); |
1781 | 1783 | ||
1782 | return NETDEV_TX_OK; | 1784 | return NETDEV_TX_OK; |
@@ -1788,21 +1790,89 @@ fail: | |||
1788 | return NETDEV_TX_OK; /* meaning, we dealt with the skb */ | 1790 | return NETDEV_TX_OK; /* meaning, we dealt with the skb */ |
1789 | } | 1791 | } |
1790 | 1792 | ||
1791 | /* | 1793 | static inline bool ieee80211_is_tdls_setup(struct sk_buff *skb) |
1792 | * Measure Tx frame arrival time for Tx latency statistics calculation | ||
1793 | * A single Tx frame latency should be measured from when it is entering the | ||
1794 | * Kernel until we receive Tx complete confirmation indication and the skb is | ||
1795 | * freed. | ||
1796 | */ | ||
1797 | static void ieee80211_tx_latency_start_msrmnt(struct ieee80211_local *local, | ||
1798 | struct sk_buff *skb) | ||
1799 | { | 1794 | { |
1800 | struct ieee80211_tx_latency_bin_ranges *tx_latency; | 1795 | u16 ethertype = (skb->data[12] << 8) | skb->data[13]; |
1801 | 1796 | ||
1802 | tx_latency = rcu_dereference(local->tx_latency); | 1797 | return ethertype == ETH_P_TDLS && |
1803 | if (!tx_latency) | 1798 | skb->len > 14 && |
1804 | return; | 1799 | skb->data[14] == WLAN_TDLS_SNAP_RFTYPE; |
1805 | skb->tstamp = ktime_get(); | 1800 | } |
1801 | |||
1802 | static int ieee80211_lookup_ra_sta(struct ieee80211_sub_if_data *sdata, | ||
1803 | struct sk_buff *skb, | ||
1804 | struct sta_info **sta_out) | ||
1805 | { | ||
1806 | struct sta_info *sta; | ||
1807 | |||
1808 | switch (sdata->vif.type) { | ||
1809 | case NL80211_IFTYPE_AP_VLAN: | ||
1810 | sta = rcu_dereference(sdata->u.vlan.sta); | ||
1811 | if (sta) { | ||
1812 | *sta_out = sta; | ||
1813 | return 0; | ||
1814 | } else if (sdata->wdev.use_4addr) { | ||
1815 | return -ENOLINK; | ||
1816 | } | ||
1817 | /* fall through */ | ||
1818 | case NL80211_IFTYPE_AP: | ||
1819 | case NL80211_IFTYPE_OCB: | ||
1820 | case NL80211_IFTYPE_ADHOC: | ||
1821 | if (is_multicast_ether_addr(skb->data)) { | ||
1822 | *sta_out = ERR_PTR(-ENOENT); | ||
1823 | return 0; | ||
1824 | } | ||
1825 | sta = sta_info_get_bss(sdata, skb->data); | ||
1826 | break; | ||
1827 | case NL80211_IFTYPE_WDS: | ||
1828 | sta = sta_info_get(sdata, sdata->u.wds.remote_addr); | ||
1829 | break; | ||
1830 | #ifdef CONFIG_MAC80211_MESH | ||
1831 | case NL80211_IFTYPE_MESH_POINT: | ||
1832 | /* determined much later */ | ||
1833 | *sta_out = NULL; | ||
1834 | return 0; | ||
1835 | #endif | ||
1836 | case NL80211_IFTYPE_STATION: | ||
1837 | if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { | ||
1838 | sta = sta_info_get(sdata, skb->data); | ||
1839 | if (sta) { | ||
1840 | bool tdls_peer, tdls_auth; | ||
1841 | |||
1842 | tdls_peer = test_sta_flag(sta, | ||
1843 | WLAN_STA_TDLS_PEER); | ||
1844 | tdls_auth = test_sta_flag(sta, | ||
1845 | WLAN_STA_TDLS_PEER_AUTH); | ||
1846 | |||
1847 | if (tdls_peer && tdls_auth) { | ||
1848 | *sta_out = sta; | ||
1849 | return 0; | ||
1850 | } | ||
1851 | |||
1852 | /* | ||
1853 | * TDLS link during setup - throw out frames to | ||
1854 | * peer. Allow TDLS-setup frames to unauthorized | ||
1855 | * peers for the special case of a link teardown | ||
1856 | * after a TDLS sta is removed due to being | ||
1857 | * unreachable. | ||
1858 | */ | ||
1859 | if (tdls_peer && !tdls_auth && | ||
1860 | !ieee80211_is_tdls_setup(skb)) | ||
1861 | return -EINVAL; | ||
1862 | } | ||
1863 | |||
1864 | } | ||
1865 | |||
1866 | sta = sta_info_get(sdata, sdata->u.mgd.bssid); | ||
1867 | if (!sta) | ||
1868 | return -ENOLINK; | ||
1869 | break; | ||
1870 | default: | ||
1871 | return -EINVAL; | ||
1872 | } | ||
1873 | |||
1874 | *sta_out = sta ?: ERR_PTR(-ENOENT); | ||
1875 | return 0; | ||
1806 | } | 1876 | } |
1807 | 1877 | ||
1808 | /** | 1878 | /** |
@@ -1824,7 +1894,8 @@ static void ieee80211_tx_latency_start_msrmnt(struct ieee80211_local *local, | |||
1824 | * Returns: the (possibly reallocated) skb or an ERR_PTR() code | 1894 | * Returns: the (possibly reallocated) skb or an ERR_PTR() code |
1825 | */ | 1895 | */ |
1826 | static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | 1896 | static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, |
1827 | struct sk_buff *skb, u32 info_flags) | 1897 | struct sk_buff *skb, u32 info_flags, |
1898 | struct sta_info *sta) | ||
1828 | { | 1899 | { |
1829 | struct ieee80211_local *local = sdata->local; | 1900 | struct ieee80211_local *local = sdata->local; |
1830 | struct ieee80211_tx_info *info; | 1901 | struct ieee80211_tx_info *info; |
@@ -1837,9 +1908,8 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | |||
1837 | const u8 *encaps_data; | 1908 | const u8 *encaps_data; |
1838 | int encaps_len, skip_header_bytes; | 1909 | int encaps_len, skip_header_bytes; |
1839 | int nh_pos, h_pos; | 1910 | int nh_pos, h_pos; |
1840 | struct sta_info *sta = NULL; | 1911 | bool wme_sta = false, authorized = false; |
1841 | bool wme_sta = false, authorized = false, tdls_auth = false; | 1912 | bool tdls_peer; |
1842 | bool tdls_peer = false, tdls_setup_frame = false; | ||
1843 | bool multicast; | 1913 | bool multicast; |
1844 | u16 info_id = 0; | 1914 | u16 info_id = 0; |
1845 | struct ieee80211_chanctx_conf *chanctx_conf; | 1915 | struct ieee80211_chanctx_conf *chanctx_conf; |
@@ -1847,6 +1917,9 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | |||
1847 | enum ieee80211_band band; | 1917 | enum ieee80211_band band; |
1848 | int ret; | 1918 | int ret; |
1849 | 1919 | ||
1920 | if (IS_ERR(sta)) | ||
1921 | sta = NULL; | ||
1922 | |||
1850 | /* convert Ethernet header to proper 802.11 header (based on | 1923 | /* convert Ethernet header to proper 802.11 header (based on |
1851 | * operation mode) */ | 1924 | * operation mode) */ |
1852 | ethertype = (skb->data[12] << 8) | skb->data[13]; | 1925 | ethertype = (skb->data[12] << 8) | skb->data[13]; |
@@ -1854,8 +1927,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | |||
1854 | 1927 | ||
1855 | switch (sdata->vif.type) { | 1928 | switch (sdata->vif.type) { |
1856 | case NL80211_IFTYPE_AP_VLAN: | 1929 | case NL80211_IFTYPE_AP_VLAN: |
1857 | sta = rcu_dereference(sdata->u.vlan.sta); | 1930 | if (sdata->wdev.use_4addr) { |
1858 | if (sta) { | ||
1859 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); | 1931 | fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); |
1860 | /* RA TA DA SA */ | 1932 | /* RA TA DA SA */ |
1861 | memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); | 1933 | memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); |
@@ -1874,7 +1946,7 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | |||
1874 | goto free; | 1946 | goto free; |
1875 | } | 1947 | } |
1876 | band = chanctx_conf->def.chan->band; | 1948 | band = chanctx_conf->def.chan->band; |
1877 | if (sta) | 1949 | if (sdata->wdev.use_4addr) |
1878 | break; | 1950 | break; |
1879 | /* fall through */ | 1951 | /* fall through */ |
1880 | case NL80211_IFTYPE_AP: | 1952 | case NL80211_IFTYPE_AP: |
@@ -1978,38 +2050,10 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | |||
1978 | break; | 2050 | break; |
1979 | #endif | 2051 | #endif |
1980 | case NL80211_IFTYPE_STATION: | 2052 | case NL80211_IFTYPE_STATION: |
1981 | if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { | 2053 | /* we already did checks when looking up the RA STA */ |
1982 | sta = sta_info_get(sdata, skb->data); | 2054 | tdls_peer = test_sta_flag(sta, WLAN_STA_TDLS_PEER); |
1983 | if (sta) { | ||
1984 | authorized = test_sta_flag(sta, | ||
1985 | WLAN_STA_AUTHORIZED); | ||
1986 | wme_sta = sta->sta.wme; | ||
1987 | tdls_peer = test_sta_flag(sta, | ||
1988 | WLAN_STA_TDLS_PEER); | ||
1989 | tdls_auth = test_sta_flag(sta, | ||
1990 | WLAN_STA_TDLS_PEER_AUTH); | ||
1991 | } | ||
1992 | |||
1993 | if (tdls_peer) | ||
1994 | tdls_setup_frame = | ||
1995 | ethertype == ETH_P_TDLS && | ||
1996 | skb->len > 14 && | ||
1997 | skb->data[14] == WLAN_TDLS_SNAP_RFTYPE; | ||
1998 | } | ||
1999 | 2055 | ||
2000 | /* | 2056 | if (tdls_peer) { |
2001 | * TDLS link during setup - throw out frames to peer. We allow | ||
2002 | * TDLS-setup frames to unauthorized peers for the special case | ||
2003 | * of a link teardown after a TDLS sta is removed due to being | ||
2004 | * unreachable. | ||
2005 | */ | ||
2006 | if (tdls_peer && !tdls_auth && !tdls_setup_frame) { | ||
2007 | ret = -EINVAL; | ||
2008 | goto free; | ||
2009 | } | ||
2010 | |||
2011 | /* send direct packets to authorized TDLS peers */ | ||
2012 | if (tdls_peer && tdls_auth) { | ||
2013 | /* DA SA BSSID */ | 2057 | /* DA SA BSSID */ |
2014 | memcpy(hdr.addr1, skb->data, ETH_ALEN); | 2058 | memcpy(hdr.addr1, skb->data, ETH_ALEN); |
2015 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); | 2059 | memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); |
@@ -2071,26 +2115,19 @@ static struct sk_buff *ieee80211_build_hdr(struct ieee80211_sub_if_data *sdata, | |||
2071 | goto free; | 2115 | goto free; |
2072 | } | 2116 | } |
2073 | 2117 | ||
2074 | /* | ||
2075 | * There's no need to try to look up the destination | ||
2076 | * if it is a multicast address (which can only happen | ||
2077 | * in AP mode) | ||
2078 | */ | ||
2079 | multicast = is_multicast_ether_addr(hdr.addr1); | 2118 | multicast = is_multicast_ether_addr(hdr.addr1); |
2080 | if (!multicast) { | ||
2081 | sta = sta_info_get(sdata, hdr.addr1); | ||
2082 | if (sta) { | ||
2083 | authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); | ||
2084 | wme_sta = sta->sta.wme; | ||
2085 | } | ||
2086 | } | ||
2087 | 2119 | ||
2088 | /* For mesh, the use of the QoS header is mandatory */ | 2120 | /* sta is always NULL for mesh */ |
2089 | if (ieee80211_vif_is_mesh(&sdata->vif)) | 2121 | if (sta) { |
2122 | authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); | ||
2123 | wme_sta = sta->sta.wme; | ||
2124 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { | ||
2125 | /* For mesh, the use of the QoS header is mandatory */ | ||
2090 | wme_sta = true; | 2126 | wme_sta = true; |
2127 | } | ||
2091 | 2128 | ||
2092 | /* receiver and we are QoS enabled, use a QoS type frame */ | 2129 | /* receiver does QoS (which also means we do) use it */ |
2093 | if (wme_sta && local->hw.queues >= IEEE80211_NUM_ACS) { | 2130 | if (wme_sta) { |
2094 | fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); | 2131 | fc |= cpu_to_le16(IEEE80211_STYPE_QOS_DATA); |
2095 | hdrlen += 2; | 2132 | hdrlen += 2; |
2096 | } | 2133 | } |
@@ -2260,7 +2297,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2260 | u32 info_flags) | 2297 | u32 info_flags) |
2261 | { | 2298 | { |
2262 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | 2299 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
2263 | struct ieee80211_local *local = sdata->local; | 2300 | struct sta_info *sta; |
2264 | 2301 | ||
2265 | if (unlikely(skb->len < ETH_HLEN)) { | 2302 | if (unlikely(skb->len < ETH_HLEN)) { |
2266 | kfree_skb(skb); | 2303 | kfree_skb(skb); |
@@ -2269,10 +2306,12 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2269 | 2306 | ||
2270 | rcu_read_lock(); | 2307 | rcu_read_lock(); |
2271 | 2308 | ||
2272 | /* Measure frame arrival for Tx latency statistics calculation */ | 2309 | if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) { |
2273 | ieee80211_tx_latency_start_msrmnt(local, skb); | 2310 | kfree_skb(skb); |
2311 | goto out; | ||
2312 | } | ||
2274 | 2313 | ||
2275 | skb = ieee80211_build_hdr(sdata, skb, info_flags); | 2314 | skb = ieee80211_build_hdr(sdata, skb, info_flags, sta); |
2276 | if (IS_ERR(skb)) | 2315 | if (IS_ERR(skb)) |
2277 | goto out; | 2316 | goto out; |
2278 | 2317 | ||
@@ -2280,7 +2319,7 @@ void __ieee80211_subif_start_xmit(struct sk_buff *skb, | |||
2280 | dev->stats.tx_bytes += skb->len; | 2319 | dev->stats.tx_bytes += skb->len; |
2281 | dev->trans_start = jiffies; | 2320 | dev->trans_start = jiffies; |
2282 | 2321 | ||
2283 | ieee80211_xmit(sdata, skb); | 2322 | ieee80211_xmit(sdata, sta, skb); |
2284 | out: | 2323 | out: |
2285 | rcu_read_unlock(); | 2324 | rcu_read_unlock(); |
2286 | } | 2325 | } |
@@ -2308,10 +2347,17 @@ ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata, | |||
2308 | .local = sdata->local, | 2347 | .local = sdata->local, |
2309 | .sdata = sdata, | 2348 | .sdata = sdata, |
2310 | }; | 2349 | }; |
2350 | struct sta_info *sta; | ||
2311 | 2351 | ||
2312 | rcu_read_lock(); | 2352 | rcu_read_lock(); |
2313 | 2353 | ||
2314 | skb = ieee80211_build_hdr(sdata, skb, info_flags); | 2354 | if (ieee80211_lookup_ra_sta(sdata, skb, &sta)) { |
2355 | kfree_skb(skb); | ||
2356 | skb = ERR_PTR(-EINVAL); | ||
2357 | goto out; | ||
2358 | } | ||
2359 | |||
2360 | skb = ieee80211_build_hdr(sdata, skb, info_flags, sta); | ||
2315 | if (IS_ERR(skb)) | 2361 | if (IS_ERR(skb)) |
2316 | goto out; | 2362 | goto out; |
2317 | 2363 | ||
@@ -2369,7 +2415,7 @@ static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, | |||
2369 | return true; | 2415 | return true; |
2370 | } | 2416 | } |
2371 | info->band = chanctx_conf->def.chan->band; | 2417 | info->band = chanctx_conf->def.chan->band; |
2372 | result = ieee80211_tx(sdata, skb, true); | 2418 | result = ieee80211_tx(sdata, NULL, skb, true); |
2373 | } else { | 2419 | } else { |
2374 | struct sk_buff_head skbs; | 2420 | struct sk_buff_head skbs; |
2375 | 2421 | ||
@@ -3107,7 +3153,7 @@ ieee80211_get_buffered_bc(struct ieee80211_hw *hw, | |||
3107 | 3153 | ||
3108 | if (sdata->vif.type == NL80211_IFTYPE_AP) | 3154 | if (sdata->vif.type == NL80211_IFTYPE_AP) |
3109 | sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev); | 3155 | sdata = IEEE80211_DEV_TO_SUB_IF(skb->dev); |
3110 | if (!ieee80211_tx_prepare(sdata, &tx, skb)) | 3156 | if (!ieee80211_tx_prepare(sdata, &tx, NULL, skb)) |
3111 | break; | 3157 | break; |
3112 | dev_kfree_skb_any(skb); | 3158 | dev_kfree_skb_any(skb); |
3113 | } | 3159 | } |
@@ -3239,6 +3285,6 @@ void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, | |||
3239 | */ | 3285 | */ |
3240 | local_bh_disable(); | 3286 | local_bh_disable(); |
3241 | IEEE80211_SKB_CB(skb)->band = band; | 3287 | IEEE80211_SKB_CB(skb)->band = band; |
3242 | ieee80211_xmit(sdata, skb); | 3288 | ieee80211_xmit(sdata, NULL, skb); |
3243 | local_bh_enable(); | 3289 | local_bh_enable(); |
3244 | } | 3290 | } |