tx.c (0b4f5b1d6385826093dc3cd9035b186f0d77a5dc) | tx.c (55de908ab292c03f1eb280f51170ddb9c6b57e31) |
---|---|
1/* 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 * Copyright 2005-2006, Devicescape Software, Inc. 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 310 unchanged lines hidden (view full) --- 319 * from each queue should be OK to make some room for new frames. */ 320static void purge_old_ps_buffers(struct ieee80211_local *local) 321{ 322 int total = 0, purged = 0; 323 struct sk_buff *skb; 324 struct ieee80211_sub_if_data *sdata; 325 struct sta_info *sta; 326 | 1/* 2 * Copyright 2002-2005, Instant802 Networks, Inc. 3 * Copyright 2005-2006, Devicescape Software, Inc. 4 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> 5 * Copyright 2007 Johannes Berg <johannes@sipsolutions.net> 6 * 7 * This program is free software; you can redistribute it and/or modify 8 * it under the terms of the GNU General Public License version 2 as --- 310 unchanged lines hidden (view full) --- 319 * from each queue should be OK to make some room for new frames. */ 320static void purge_old_ps_buffers(struct ieee80211_local *local) 321{ 322 int total = 0, purged = 0; 323 struct sk_buff *skb; 324 struct ieee80211_sub_if_data *sdata; 325 struct sta_info *sta; 326 |
327 /* 328 * virtual interfaces are protected by RCU 329 */ 330 rcu_read_lock(); 331 | |
332 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 333 struct ieee80211_if_ap *ap; 334 if (sdata->vif.type != NL80211_IFTYPE_AP) 335 continue; 336 ap = &sdata->u.ap; 337 skb = skb_dequeue(&ap->ps_bc_buf); 338 if (skb) { 339 purged++; --- 15 unchanged lines hidden (view full) --- 355 if (skb) { 356 purged++; 357 ieee80211_free_txskb(&local->hw, skb); 358 break; 359 } 360 } 361 } 362 | 327 list_for_each_entry_rcu(sdata, &local->interfaces, list) { 328 struct ieee80211_if_ap *ap; 329 if (sdata->vif.type != NL80211_IFTYPE_AP) 330 continue; 331 ap = &sdata->u.ap; 332 skb = skb_dequeue(&ap->ps_bc_buf); 333 if (skb) { 334 purged++; --- 15 unchanged lines hidden (view full) --- 350 if (skb) { 351 purged++; 352 ieee80211_free_txskb(&local->hw, skb); 353 break; 354 } 355 } 356 } 357 |
363 rcu_read_unlock(); 364 | |
365 local->total_ps_buffered = total; 366 ps_dbg_hw(&local->hw, "PS buffers full - purged %d frames\n", purged); 367} 368 369static ieee80211_tx_result 370ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) 371{ 372 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); --- 994 unchanged lines hidden (view full) --- 1367 1368 return 0; 1369} 1370 1371/* 1372 * Returns false if the frame couldn't be transmitted but was queued instead. 1373 */ 1374static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, | 358 local->total_ps_buffered = total; 359 ps_dbg_hw(&local->hw, "PS buffers full - purged %d frames\n", purged); 360} 361 362static ieee80211_tx_result 363ieee80211_tx_h_multicast_ps_buf(struct ieee80211_tx_data *tx) 364{ 365 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(tx->skb); --- 994 unchanged lines hidden (view full) --- 1360 1361 return 0; 1362} 1363 1364/* 1365 * Returns false if the frame couldn't be transmitted but was queued instead. 1366 */ 1367static bool ieee80211_tx(struct ieee80211_sub_if_data *sdata, |
1375 struct sk_buff *skb, bool txpending) | 1368 struct sk_buff *skb, bool txpending, 1369 enum ieee80211_band band) |
1376{ 1377 struct ieee80211_local *local = sdata->local; 1378 struct ieee80211_tx_data tx; 1379 ieee80211_tx_result res_prepare; 1380 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1381 bool result = true; 1382 int led_len; 1383 1384 if (unlikely(skb->len < 10)) { 1385 dev_kfree_skb(skb); 1386 return true; 1387 } 1388 | 1370{ 1371 struct ieee80211_local *local = sdata->local; 1372 struct ieee80211_tx_data tx; 1373 ieee80211_tx_result res_prepare; 1374 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1375 bool result = true; 1376 int led_len; 1377 1378 if (unlikely(skb->len < 10)) { 1379 dev_kfree_skb(skb); 1380 return true; 1381 } 1382 |
1389 rcu_read_lock(); 1390 | |
1391 /* initialises tx */ 1392 led_len = skb->len; 1393 res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); 1394 1395 if (unlikely(res_prepare == TX_DROP)) { 1396 ieee80211_free_txskb(&local->hw, skb); | 1383 /* initialises tx */ 1384 led_len = skb->len; 1385 res_prepare = ieee80211_tx_prepare(sdata, &tx, skb); 1386 1387 if (unlikely(res_prepare == TX_DROP)) { 1388 ieee80211_free_txskb(&local->hw, skb); |
1397 goto out; | 1389 return true; |
1398 } else if (unlikely(res_prepare == TX_QUEUED)) { | 1390 } else if (unlikely(res_prepare == TX_QUEUED)) { |
1399 goto out; | 1391 return true; |
1400 } 1401 | 1392 } 1393 |
1402 info->band = local->hw.conf.channel->band; | 1394 info->band = band; |
1403 1404 /* set up hw_queue value early */ 1405 if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || 1406 !(local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) 1407 info->hw_queue = 1408 sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; 1409 1410 if (!invoke_tx_handlers(&tx)) 1411 result = __ieee80211_tx(local, &tx.skbs, led_len, 1412 tx.sta, txpending); | 1395 1396 /* set up hw_queue value early */ 1397 if (!(info->flags & IEEE80211_TX_CTL_TX_OFFCHAN) || 1398 !(local->hw.flags & IEEE80211_HW_QUEUE_CONTROL)) 1399 info->hw_queue = 1400 sdata->vif.hw_queue[skb_get_queue_mapping(skb)]; 1401 1402 if (!invoke_tx_handlers(&tx)) 1403 result = __ieee80211_tx(local, &tx.skbs, led_len, 1404 tx.sta, txpending); |
1413 out: 1414 rcu_read_unlock(); | 1405 |
1415 return result; 1416} 1417 1418/* device xmit handlers */ 1419 1420static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, 1421 struct sk_buff *skb, 1422 int head_need, bool may_encrypt) --- 18 unchanged lines hidden (view full) --- 1441 wiphy_debug(local->hw.wiphy, 1442 "failed to reallocate TX buffer\n"); 1443 return -ENOMEM; 1444 } 1445 1446 return 0; 1447} 1448 | 1406 return result; 1407} 1408 1409/* device xmit handlers */ 1410 1411static int ieee80211_skb_resize(struct ieee80211_sub_if_data *sdata, 1412 struct sk_buff *skb, 1413 int head_need, bool may_encrypt) --- 18 unchanged lines hidden (view full) --- 1432 wiphy_debug(local->hw.wiphy, 1433 "failed to reallocate TX buffer\n"); 1434 return -ENOMEM; 1435 } 1436 1437 return 0; 1438} 1439 |
1449void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb) | 1440void ieee80211_xmit(struct ieee80211_sub_if_data *sdata, struct sk_buff *skb, 1441 enum ieee80211_band band) |
1450{ 1451 struct ieee80211_local *local = sdata->local; 1452 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1453 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1454 int headroom; 1455 bool may_encrypt; 1456 | 1442{ 1443 struct ieee80211_local *local = sdata->local; 1444 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1445 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; 1446 int headroom; 1447 bool may_encrypt; 1448 |
1457 rcu_read_lock(); 1458 | |
1459 may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); 1460 1461 headroom = local->tx_headroom; 1462 if (may_encrypt) 1463 headroom += IEEE80211_ENCRYPT_HEADROOM; 1464 headroom -= skb_headroom(skb); 1465 headroom = max_t(int, 0, headroom); 1466 1467 if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { 1468 ieee80211_free_txskb(&local->hw, skb); | 1449 may_encrypt = !(info->flags & IEEE80211_TX_INTFL_DONT_ENCRYPT); 1450 1451 headroom = local->tx_headroom; 1452 if (may_encrypt) 1453 headroom += IEEE80211_ENCRYPT_HEADROOM; 1454 headroom -= skb_headroom(skb); 1455 headroom = max_t(int, 0, headroom); 1456 1457 if (ieee80211_skb_resize(sdata, skb, headroom, may_encrypt)) { 1458 ieee80211_free_txskb(&local->hw, skb); |
1469 rcu_read_unlock(); | |
1470 return; 1471 } 1472 1473 hdr = (struct ieee80211_hdr *) skb->data; 1474 info->control.vif = &sdata->vif; 1475 1476 if (ieee80211_vif_is_mesh(&sdata->vif) && 1477 ieee80211_is_data(hdr->frame_control) && 1478 !is_multicast_ether_addr(hdr->addr1) && 1479 mesh_nexthop_resolve(skb, sdata)) { 1480 /* skb queued: don't free */ | 1459 return; 1460 } 1461 1462 hdr = (struct ieee80211_hdr *) skb->data; 1463 info->control.vif = &sdata->vif; 1464 1465 if (ieee80211_vif_is_mesh(&sdata->vif) && 1466 ieee80211_is_data(hdr->frame_control) && 1467 !is_multicast_ether_addr(hdr->addr1) && 1468 mesh_nexthop_resolve(skb, sdata)) { 1469 /* skb queued: don't free */ |
1481 rcu_read_unlock(); | |
1482 return; 1483 } 1484 1485 ieee80211_set_qos_hdr(sdata, skb); | 1470 return; 1471 } 1472 1473 ieee80211_set_qos_hdr(sdata, skb); |
1486 ieee80211_tx(sdata, skb, false); 1487 rcu_read_unlock(); | 1474 ieee80211_tx(sdata, skb, false, band); |
1488} 1489 1490static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb) 1491{ 1492 struct ieee80211_radiotap_iterator iterator; 1493 struct ieee80211_radiotap_header *rthdr = 1494 (struct ieee80211_radiotap_header *) skb->data; 1495 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); --- 73 unchanged lines hidden (view full) --- 1569 1570 return true; 1571} 1572 1573netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1574 struct net_device *dev) 1575{ 1576 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | 1475} 1476 1477static bool ieee80211_parse_tx_radiotap(struct sk_buff *skb) 1478{ 1479 struct ieee80211_radiotap_iterator iterator; 1480 struct ieee80211_radiotap_header *rthdr = 1481 (struct ieee80211_radiotap_header *) skb->data; 1482 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); --- 73 unchanged lines hidden (view full) --- 1556 1557 return true; 1558} 1559 1560netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb, 1561 struct net_device *dev) 1562{ 1563 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
1577 struct ieee80211_channel *chan = local->hw.conf.channel; | 1564 struct ieee80211_chanctx_conf *chanctx_conf; 1565 struct ieee80211_channel *chan; |
1578 struct ieee80211_radiotap_header *prthdr = 1579 (struct ieee80211_radiotap_header *)skb->data; 1580 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1581 struct ieee80211_hdr *hdr; 1582 struct ieee80211_sub_if_data *tmp_sdata, *sdata; 1583 u16 len_rthdr; 1584 int hdrlen; 1585 | 1566 struct ieee80211_radiotap_header *prthdr = 1567 (struct ieee80211_radiotap_header *)skb->data; 1568 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 1569 struct ieee80211_hdr *hdr; 1570 struct ieee80211_sub_if_data *tmp_sdata, *sdata; 1571 u16 len_rthdr; 1572 int hdrlen; 1573 |
1586 /* 1587 * Frame injection is not allowed if beaconing is not allowed 1588 * or if we need radar detection. Beaconing is usually not allowed when 1589 * the mode or operation (Adhoc, AP, Mesh) does not support DFS. 1590 * Passive scan is also used in world regulatory domains where 1591 * your country is not known and as such it should be treated as 1592 * NO TX unless the channel is explicitly allowed in which case 1593 * your current regulatory domain would not have the passive scan 1594 * flag. 1595 * 1596 * Since AP mode uses monitor interfaces to inject/TX management 1597 * frames we can make AP mode the exception to this rule once it 1598 * supports radar detection as its implementation can deal with 1599 * radar detection by itself. We can do that later by adding a 1600 * monitor flag interfaces used for AP support. 1601 */ 1602 if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR | 1603 IEEE80211_CHAN_PASSIVE_SCAN))) 1604 goto fail; 1605 | |
1606 /* check for not even having the fixed radiotap header part */ 1607 if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) 1608 goto fail; /* too short to be possibly valid */ 1609 1610 /* is it a header version we can trust to find length from? */ 1611 if (unlikely(prthdr->it_version)) 1612 goto fail; /* only version 0 is supported */ 1613 --- 69 unchanged lines hidden (view full) --- 1683 tmp_sdata->vif.type == NL80211_IFTYPE_WDS) 1684 continue; 1685 if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) { 1686 sdata = tmp_sdata; 1687 break; 1688 } 1689 } 1690 | 1574 /* check for not even having the fixed radiotap header part */ 1575 if (unlikely(skb->len < sizeof(struct ieee80211_radiotap_header))) 1576 goto fail; /* too short to be possibly valid */ 1577 1578 /* is it a header version we can trust to find length from? */ 1579 if (unlikely(prthdr->it_version)) 1580 goto fail; /* only version 0 is supported */ 1581 --- 69 unchanged lines hidden (view full) --- 1651 tmp_sdata->vif.type == NL80211_IFTYPE_WDS) 1652 continue; 1653 if (ether_addr_equal(tmp_sdata->vif.addr, hdr->addr2)) { 1654 sdata = tmp_sdata; 1655 break; 1656 } 1657 } 1658 |
1691 ieee80211_xmit(sdata, skb); | 1659 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 1660 if (!chanctx_conf) { 1661 tmp_sdata = rcu_dereference(local->monitor_sdata); 1662 if (tmp_sdata) 1663 chanctx_conf = 1664 rcu_dereference(tmp_sdata->vif.chanctx_conf); 1665 } 1666 if (!chanctx_conf) 1667 goto fail_rcu; 1668 1669 chan = chanctx_conf->channel; 1670 1671 /* 1672 * Frame injection is not allowed if beaconing is not allowed 1673 * or if we need radar detection. Beaconing is usually not allowed when 1674 * the mode or operation (Adhoc, AP, Mesh) does not support DFS. 1675 * Passive scan is also used in world regulatory domains where 1676 * your country is not known and as such it should be treated as 1677 * NO TX unless the channel is explicitly allowed in which case 1678 * your current regulatory domain would not have the passive scan 1679 * flag. 1680 * 1681 * Since AP mode uses monitor interfaces to inject/TX management 1682 * frames we can make AP mode the exception to this rule once it 1683 * supports radar detection as its implementation can deal with 1684 * radar detection by itself. We can do that later by adding a 1685 * monitor flag interfaces used for AP support. 1686 */ 1687 if ((chan->flags & (IEEE80211_CHAN_NO_IBSS | IEEE80211_CHAN_RADAR | 1688 IEEE80211_CHAN_PASSIVE_SCAN))) 1689 goto fail_rcu; 1690 1691 ieee80211_xmit(sdata, skb, chan->band); |
1692 rcu_read_unlock(); 1693 1694 return NETDEV_TX_OK; 1695 | 1692 rcu_read_unlock(); 1693 1694 return NETDEV_TX_OK; 1695 |
1696fail_rcu: 1697 rcu_read_unlock(); |
|
1696fail: 1697 dev_kfree_skb(skb); 1698 return NETDEV_TX_OK; /* meaning, we dealt with the skb */ 1699} 1700 1701/** 1702 * ieee80211_subif_start_xmit - netif start_xmit function for Ethernet-type 1703 * subinterfaces (wlan#, WDS, and VLAN interfaces) --- 25 unchanged lines hidden (view full) --- 1729 int encaps_len, skip_header_bytes; 1730 int nh_pos, h_pos; 1731 struct sta_info *sta = NULL; 1732 bool wme_sta = false, authorized = false, tdls_auth = false; 1733 bool tdls_direct = false; 1734 bool multicast; 1735 u32 info_flags = 0; 1736 u16 info_id = 0; | 1698fail: 1699 dev_kfree_skb(skb); 1700 return NETDEV_TX_OK; /* meaning, we dealt with the skb */ 1701} 1702 1703/** 1704 * ieee80211_subif_start_xmit - netif start_xmit function for Ethernet-type 1705 * subinterfaces (wlan#, WDS, and VLAN interfaces) --- 25 unchanged lines hidden (view full) --- 1731 int encaps_len, skip_header_bytes; 1732 int nh_pos, h_pos; 1733 struct sta_info *sta = NULL; 1734 bool wme_sta = false, authorized = false, tdls_auth = false; 1735 bool tdls_direct = false; 1736 bool multicast; 1737 u32 info_flags = 0; 1738 u16 info_id = 0; |
1739 struct ieee80211_chanctx_conf *chanctx_conf; 1740 struct ieee80211_sub_if_data *ap_sdata; 1741 enum ieee80211_band band; |
|
1737 1738 if (unlikely(skb->len < ETH_HLEN)) 1739 goto fail; 1740 1741 /* convert Ethernet header to proper 802.11 header (based on 1742 * operation mode) */ 1743 ethertype = (skb->data[12] << 8) | skb->data[13]; 1744 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); 1745 | 1742 1743 if (unlikely(skb->len < ETH_HLEN)) 1744 goto fail; 1745 1746 /* convert Ethernet header to proper 802.11 header (based on 1747 * operation mode) */ 1748 ethertype = (skb->data[12] << 8) | skb->data[13]; 1749 fc = cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_DATA); 1750 |
1751 rcu_read_lock(); 1752 |
|
1746 switch (sdata->vif.type) { 1747 case NL80211_IFTYPE_AP_VLAN: | 1753 switch (sdata->vif.type) { 1754 case NL80211_IFTYPE_AP_VLAN: |
1748 rcu_read_lock(); | |
1749 sta = rcu_dereference(sdata->u.vlan.sta); 1750 if (sta) { 1751 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); 1752 /* RA TA DA SA */ 1753 memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); 1754 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 1755 memcpy(hdr.addr3, skb->data, ETH_ALEN); 1756 memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); 1757 hdrlen = 30; 1758 authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); 1759 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1760 } | 1755 sta = rcu_dereference(sdata->u.vlan.sta); 1756 if (sta) { 1757 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); 1758 /* RA TA DA SA */ 1759 memcpy(hdr.addr1, sta->sta.addr, ETH_ALEN); 1760 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 1761 memcpy(hdr.addr3, skb->data, ETH_ALEN); 1762 memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); 1763 hdrlen = 30; 1764 authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); 1765 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1766 } |
1761 rcu_read_unlock(); | 1767 ap_sdata = container_of(sdata->bss, struct ieee80211_sub_if_data, 1768 u.ap); 1769 chanctx_conf = rcu_dereference(ap_sdata->vif.chanctx_conf); 1770 if (!chanctx_conf) 1771 goto fail_rcu; 1772 band = chanctx_conf->channel->band; |
1762 if (sta) 1763 break; 1764 /* fall through */ 1765 case NL80211_IFTYPE_AP: 1766 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); 1767 /* DA BSSID SA */ 1768 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1769 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 1770 memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); 1771 hdrlen = 24; | 1773 if (sta) 1774 break; 1775 /* fall through */ 1776 case NL80211_IFTYPE_AP: 1777 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS); 1778 /* DA BSSID SA */ 1779 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1780 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 1781 memcpy(hdr.addr3, skb->data + ETH_ALEN, ETH_ALEN); 1782 hdrlen = 24; |
1783 if (sdata->vif.type == NL80211_IFTYPE_AP) 1784 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 1785 if (!chanctx_conf) 1786 goto fail_rcu; 1787 band = chanctx_conf->channel->band; |
|
1772 break; 1773 case NL80211_IFTYPE_WDS: 1774 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); 1775 /* RA TA DA SA */ 1776 memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); 1777 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 1778 memcpy(hdr.addr3, skb->data, ETH_ALEN); 1779 memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); 1780 hdrlen = 30; | 1788 break; 1789 case NL80211_IFTYPE_WDS: 1790 fc |= cpu_to_le16(IEEE80211_FCTL_FROMDS | IEEE80211_FCTL_TODS); 1791 /* RA TA DA SA */ 1792 memcpy(hdr.addr1, sdata->u.wds.remote_addr, ETH_ALEN); 1793 memcpy(hdr.addr2, sdata->vif.addr, ETH_ALEN); 1794 memcpy(hdr.addr3, skb->data, ETH_ALEN); 1795 memcpy(hdr.addr4, skb->data + ETH_ALEN, ETH_ALEN); 1796 hdrlen = 30; |
1797 /* 1798 * This is the exception! WDS style interfaces are prohibited 1799 * when channel contexts are in used so this must be valid 1800 */ 1801 band = local->hw.conf.channel->band; |
|
1781 break; 1782#ifdef CONFIG_MAC80211_MESH 1783 case NL80211_IFTYPE_MESH_POINT: 1784 if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { 1785 /* Do not send frames with mesh_ttl == 0 */ 1786 sdata->u.mesh.mshstats.dropped_frames_ttl++; | 1802 break; 1803#ifdef CONFIG_MAC80211_MESH 1804 case NL80211_IFTYPE_MESH_POINT: 1805 if (!sdata->u.mesh.mshcfg.dot11MeshTTL) { 1806 /* Do not send frames with mesh_ttl == 0 */ 1807 sdata->u.mesh.mshstats.dropped_frames_ttl++; |
1787 goto fail; | 1808 goto fail_rcu; |
1788 } | 1809 } |
1789 rcu_read_lock(); | 1810 |
1790 if (!is_multicast_ether_addr(skb->data)) { 1791 mpath = mesh_path_lookup(skb->data, sdata); 1792 if (!mpath) 1793 mppath = mpp_path_lookup(skb->data, sdata); 1794 } 1795 1796 /* 1797 * Use address extension if it is a packet from 1798 * another interface or if we know the destination 1799 * is being proxied by a portal (i.e. portal address 1800 * differs from proxied address) 1801 */ 1802 if (ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN) && 1803 !(mppath && !ether_addr_equal(mppath->mpp, skb->data))) { 1804 hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, 1805 skb->data, skb->data + ETH_ALEN); | 1811 if (!is_multicast_ether_addr(skb->data)) { 1812 mpath = mesh_path_lookup(skb->data, sdata); 1813 if (!mpath) 1814 mppath = mpp_path_lookup(skb->data, sdata); 1815 } 1816 1817 /* 1818 * Use address extension if it is a packet from 1819 * another interface or if we know the destination 1820 * is being proxied by a portal (i.e. portal address 1821 * differs from proxied address) 1822 */ 1823 if (ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN) && 1824 !(mppath && !ether_addr_equal(mppath->mpp, skb->data))) { 1825 hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, 1826 skb->data, skb->data + ETH_ALEN); |
1806 rcu_read_unlock(); | |
1807 meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, 1808 sdata, NULL, NULL); 1809 } else { 1810 /* DS -> MBSS (802.11-2012 13.11.3.3). 1811 * For unicast with unknown forwarding information, 1812 * destination might be in the MBSS or if that fails 1813 * forwarded to another mesh gate. In either case 1814 * resolution will be handled in ieee80211_xmit(), so 1815 * leave the original DA. This also works for mcast */ 1816 const u8 *mesh_da = skb->data; 1817 1818 if (mppath) 1819 mesh_da = mppath->mpp; 1820 else if (mpath) 1821 mesh_da = mpath->dst; | 1827 meshhdrlen = ieee80211_new_mesh_header(&mesh_hdr, 1828 sdata, NULL, NULL); 1829 } else { 1830 /* DS -> MBSS (802.11-2012 13.11.3.3). 1831 * For unicast with unknown forwarding information, 1832 * destination might be in the MBSS or if that fails 1833 * forwarded to another mesh gate. In either case 1834 * resolution will be handled in ieee80211_xmit(), so 1835 * leave the original DA. This also works for mcast */ 1836 const u8 *mesh_da = skb->data; 1837 1838 if (mppath) 1839 mesh_da = mppath->mpp; 1840 else if (mpath) 1841 mesh_da = mpath->dst; |
1822 rcu_read_unlock(); | |
1823 1824 hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, 1825 mesh_da, sdata->vif.addr); 1826 if (is_multicast_ether_addr(mesh_da)) 1827 /* DA TA mSA AE:SA */ 1828 meshhdrlen = 1829 ieee80211_new_mesh_header(&mesh_hdr, 1830 sdata, 1831 skb->data + ETH_ALEN, 1832 NULL); 1833 else 1834 /* RA TA mDA mSA AE:DA SA */ 1835 meshhdrlen = 1836 ieee80211_new_mesh_header(&mesh_hdr, 1837 sdata, 1838 skb->data, 1839 skb->data + ETH_ALEN); 1840 1841 } | 1842 1843 hdrlen = ieee80211_fill_mesh_addresses(&hdr, &fc, 1844 mesh_da, sdata->vif.addr); 1845 if (is_multicast_ether_addr(mesh_da)) 1846 /* DA TA mSA AE:SA */ 1847 meshhdrlen = 1848 ieee80211_new_mesh_header(&mesh_hdr, 1849 sdata, 1850 skb->data + ETH_ALEN, 1851 NULL); 1852 else 1853 /* RA TA mDA mSA AE:DA SA */ 1854 meshhdrlen = 1855 ieee80211_new_mesh_header(&mesh_hdr, 1856 sdata, 1857 skb->data, 1858 skb->data + ETH_ALEN); 1859 1860 } |
1861 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 1862 if (!chanctx_conf) 1863 goto fail_rcu; 1864 band = chanctx_conf->channel->band; |
|
1842 break; 1843#endif 1844 case NL80211_IFTYPE_STATION: 1845 if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { 1846 bool tdls_peer = false; 1847 | 1865 break; 1866#endif 1867 case NL80211_IFTYPE_STATION: 1868 if (sdata->wdev.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS) { 1869 bool tdls_peer = false; 1870 |
1848 rcu_read_lock(); | |
1849 sta = sta_info_get(sdata, skb->data); 1850 if (sta) { 1851 authorized = test_sta_flag(sta, 1852 WLAN_STA_AUTHORIZED); 1853 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1854 tdls_peer = test_sta_flag(sta, 1855 WLAN_STA_TDLS_PEER); 1856 tdls_auth = test_sta_flag(sta, 1857 WLAN_STA_TDLS_PEER_AUTH); 1858 } | 1871 sta = sta_info_get(sdata, skb->data); 1872 if (sta) { 1873 authorized = test_sta_flag(sta, 1874 WLAN_STA_AUTHORIZED); 1875 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1876 tdls_peer = test_sta_flag(sta, 1877 WLAN_STA_TDLS_PEER); 1878 tdls_auth = test_sta_flag(sta, 1879 WLAN_STA_TDLS_PEER_AUTH); 1880 } |
1859 rcu_read_unlock(); | |
1860 1861 /* 1862 * If the TDLS link is enabled, send everything 1863 * directly. Otherwise, allow TDLS setup frames 1864 * to be transmitted indirectly. 1865 */ 1866 tdls_direct = tdls_peer && (tdls_auth || 1867 !(ethertype == ETH_P_TDLS && skb->len > 14 && 1868 skb->data[14] == WLAN_TDLS_SNAP_RFTYPE)); 1869 } 1870 1871 if (tdls_direct) { 1872 /* link during setup - throw out frames to peer */ 1873 if (!tdls_auth) | 1881 1882 /* 1883 * If the TDLS link is enabled, send everything 1884 * directly. Otherwise, allow TDLS setup frames 1885 * to be transmitted indirectly. 1886 */ 1887 tdls_direct = tdls_peer && (tdls_auth || 1888 !(ethertype == ETH_P_TDLS && skb->len > 14 && 1889 skb->data[14] == WLAN_TDLS_SNAP_RFTYPE)); 1890 } 1891 1892 if (tdls_direct) { 1893 /* link during setup - throw out frames to peer */ 1894 if (!tdls_auth) |
1874 goto fail; | 1895 goto fail_rcu; |
1875 1876 /* DA SA BSSID */ 1877 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1878 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1879 memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN); 1880 hdrlen = 24; 1881 } else if (sdata->u.mgd.use_4addr && 1882 cpu_to_be16(ethertype) != sdata->control_port_protocol) { --- 8 unchanged lines hidden (view full) --- 1891 } else { 1892 fc |= cpu_to_le16(IEEE80211_FCTL_TODS); 1893 /* BSSID SA DA */ 1894 memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); 1895 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1896 memcpy(hdr.addr3, skb->data, ETH_ALEN); 1897 hdrlen = 24; 1898 } | 1896 1897 /* DA SA BSSID */ 1898 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1899 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1900 memcpy(hdr.addr3, sdata->u.mgd.bssid, ETH_ALEN); 1901 hdrlen = 24; 1902 } else if (sdata->u.mgd.use_4addr && 1903 cpu_to_be16(ethertype) != sdata->control_port_protocol) { --- 8 unchanged lines hidden (view full) --- 1912 } else { 1913 fc |= cpu_to_le16(IEEE80211_FCTL_TODS); 1914 /* BSSID SA DA */ 1915 memcpy(hdr.addr1, sdata->u.mgd.bssid, ETH_ALEN); 1916 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1917 memcpy(hdr.addr3, skb->data, ETH_ALEN); 1918 hdrlen = 24; 1919 } |
1920 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 1921 if (!chanctx_conf) 1922 goto fail_rcu; 1923 band = chanctx_conf->channel->band; |
|
1899 break; 1900 case NL80211_IFTYPE_ADHOC: 1901 /* DA SA BSSID */ 1902 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1903 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1904 memcpy(hdr.addr3, sdata->u.ibss.bssid, ETH_ALEN); 1905 hdrlen = 24; | 1924 break; 1925 case NL80211_IFTYPE_ADHOC: 1926 /* DA SA BSSID */ 1927 memcpy(hdr.addr1, skb->data, ETH_ALEN); 1928 memcpy(hdr.addr2, skb->data + ETH_ALEN, ETH_ALEN); 1929 memcpy(hdr.addr3, sdata->u.ibss.bssid, ETH_ALEN); 1930 hdrlen = 24; |
1931 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 1932 if (!chanctx_conf) 1933 goto fail_rcu; 1934 band = chanctx_conf->channel->band; |
|
1906 break; 1907 default: | 1935 break; 1936 default: |
1908 goto fail; | 1937 goto fail_rcu; |
1909 } 1910 1911 /* 1912 * There's no need to try to look up the destination 1913 * if it is a multicast address (which can only happen 1914 * in AP mode) 1915 */ 1916 multicast = is_multicast_ether_addr(hdr.addr1); 1917 if (!multicast) { | 1938 } 1939 1940 /* 1941 * There's no need to try to look up the destination 1942 * if it is a multicast address (which can only happen 1943 * in AP mode) 1944 */ 1945 multicast = is_multicast_ether_addr(hdr.addr1); 1946 if (!multicast) { |
1918 rcu_read_lock(); | |
1919 sta = sta_info_get(sdata, hdr.addr1); 1920 if (sta) { 1921 authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); 1922 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1923 } | 1947 sta = sta_info_get(sdata, hdr.addr1); 1948 if (sta) { 1949 authorized = test_sta_flag(sta, WLAN_STA_AUTHORIZED); 1950 wme_sta = test_sta_flag(sta, WLAN_STA_WME); 1951 } |
1924 rcu_read_unlock(); | |
1925 } 1926 1927 /* For mesh, the use of the QoS header is mandatory */ 1928 if (ieee80211_vif_is_mesh(&sdata->vif)) 1929 wme_sta = true; 1930 1931 /* receiver and we are QoS enabled, use a QoS type frame */ 1932 if (wme_sta && local->hw.queues >= IEEE80211_NUM_ACS) { --- 11 unchanged lines hidden (view full) --- 1944 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { 1945#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1946 net_info_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", 1947 dev->name, hdr.addr1); 1948#endif 1949 1950 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); 1951 | 1952 } 1953 1954 /* For mesh, the use of the QoS header is mandatory */ 1955 if (ieee80211_vif_is_mesh(&sdata->vif)) 1956 wme_sta = true; 1957 1958 /* receiver and we are QoS enabled, use a QoS type frame */ 1959 if (wme_sta && local->hw.queues >= IEEE80211_NUM_ACS) { --- 11 unchanged lines hidden (view full) --- 1971 !ether_addr_equal(sdata->vif.addr, skb->data + ETH_ALEN)))) { 1972#ifdef CONFIG_MAC80211_VERBOSE_DEBUG 1973 net_info_ratelimited("%s: dropped frame to %pM (unauthorized port)\n", 1974 dev->name, hdr.addr1); 1975#endif 1976 1977 I802_DEBUG_INC(local->tx_handlers_drop_unauth_port); 1978 |
1952 goto fail; | 1979 goto fail_rcu; |
1953 } 1954 1955 if (unlikely(!multicast && skb->sk && 1956 skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) { 1957 struct sk_buff *orig_skb = skb; 1958 1959 skb = skb_clone(skb, GFP_ATOMIC); 1960 if (skb) { --- 38 unchanged lines hidden (view full) --- 1999 2000 /* can't happen -- skb is a clone if info_id != 0 */ 2001 WARN_ON(info_id); 2002 2003 skb = skb_clone(skb, GFP_ATOMIC); 2004 kfree_skb(tmp_skb); 2005 2006 if (!skb) | 1980 } 1981 1982 if (unlikely(!multicast && skb->sk && 1983 skb_shinfo(skb)->tx_flags & SKBTX_WIFI_STATUS)) { 1984 struct sk_buff *orig_skb = skb; 1985 1986 skb = skb_clone(skb, GFP_ATOMIC); 1987 if (skb) { --- 38 unchanged lines hidden (view full) --- 2026 2027 /* can't happen -- skb is a clone if info_id != 0 */ 2028 WARN_ON(info_id); 2029 2030 skb = skb_clone(skb, GFP_ATOMIC); 2031 kfree_skb(tmp_skb); 2032 2033 if (!skb) |
2007 goto fail; | 2034 goto fail_rcu; |
2008 } 2009 2010 hdr.frame_control = fc; 2011 hdr.duration_id = 0; 2012 hdr.seq_ctrl = 0; 2013 2014 skip_header_bytes = ETH_HLEN; 2015 if (ethertype == ETH_P_AARP || ethertype == ETH_P_IPX) { --- 31 unchanged lines hidden (view full) --- 2047 */ 2048 2049 if (head_need > 0 || skb_cloned(skb)) { 2050 head_need += IEEE80211_ENCRYPT_HEADROOM; 2051 head_need += local->tx_headroom; 2052 head_need = max_t(int, 0, head_need); 2053 if (ieee80211_skb_resize(sdata, skb, head_need, true)) { 2054 ieee80211_free_txskb(&local->hw, skb); | 2035 } 2036 2037 hdr.frame_control = fc; 2038 hdr.duration_id = 0; 2039 hdr.seq_ctrl = 0; 2040 2041 skip_header_bytes = ETH_HLEN; 2042 if (ethertype == ETH_P_AARP || ethertype == ETH_P_IPX) { --- 31 unchanged lines hidden (view full) --- 2074 */ 2075 2076 if (head_need > 0 || skb_cloned(skb)) { 2077 head_need += IEEE80211_ENCRYPT_HEADROOM; 2078 head_need += local->tx_headroom; 2079 head_need = max_t(int, 0, head_need); 2080 if (ieee80211_skb_resize(sdata, skb, head_need, true)) { 2081 ieee80211_free_txskb(&local->hw, skb); |
2055 return NETDEV_TX_OK; | 2082 goto fail_rcu; |
2056 } 2057 } 2058 2059 if (encaps_data) { 2060 memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len); 2061 nh_pos += encaps_len; 2062 h_pos += encaps_len; 2063 } --- 35 unchanged lines hidden (view full) --- 2099 info = IEEE80211_SKB_CB(skb); 2100 memset(info, 0, sizeof(*info)); 2101 2102 dev->trans_start = jiffies; 2103 2104 info->flags = info_flags; 2105 info->ack_frame_id = info_id; 2106 | 2083 } 2084 } 2085 2086 if (encaps_data) { 2087 memcpy(skb_push(skb, encaps_len), encaps_data, encaps_len); 2088 nh_pos += encaps_len; 2089 h_pos += encaps_len; 2090 } --- 35 unchanged lines hidden (view full) --- 2126 info = IEEE80211_SKB_CB(skb); 2127 memset(info, 0, sizeof(*info)); 2128 2129 dev->trans_start = jiffies; 2130 2131 info->flags = info_flags; 2132 info->ack_frame_id = info_id; 2133 |
2107 ieee80211_xmit(sdata, skb); | 2134 ieee80211_xmit(sdata, skb, band); 2135 rcu_read_unlock(); |
2108 2109 return NETDEV_TX_OK; 2110 | 2136 2137 return NETDEV_TX_OK; 2138 |
2139 fail_rcu: 2140 rcu_read_unlock(); |
|
2111 fail: 2112 dev_kfree_skb(skb); 2113 return NETDEV_TX_OK; 2114} 2115 2116 2117/* 2118 * ieee80211_clear_tx_pending may not be called in a context where --- 15 unchanged lines hidden (view full) --- 2134static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, 2135 struct sk_buff *skb) 2136{ 2137 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2138 struct ieee80211_sub_if_data *sdata; 2139 struct sta_info *sta; 2140 struct ieee80211_hdr *hdr; 2141 bool result; | 2141 fail: 2142 dev_kfree_skb(skb); 2143 return NETDEV_TX_OK; 2144} 2145 2146 2147/* 2148 * ieee80211_clear_tx_pending may not be called in a context where --- 15 unchanged lines hidden (view full) --- 2164static bool ieee80211_tx_pending_skb(struct ieee80211_local *local, 2165 struct sk_buff *skb) 2166{ 2167 struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); 2168 struct ieee80211_sub_if_data *sdata; 2169 struct sta_info *sta; 2170 struct ieee80211_hdr *hdr; 2171 bool result; |
2172 struct ieee80211_chanctx_conf *chanctx_conf; |
|
2142 2143 sdata = vif_to_sdata(info->control.vif); 2144 2145 if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) { | 2173 2174 sdata = vif_to_sdata(info->control.vif); 2175 2176 if (info->flags & IEEE80211_TX_INTFL_NEED_TXPROCESSING) { |
2146 result = ieee80211_tx(sdata, skb, true); | 2177 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); 2178 if (unlikely(!chanctx_conf)) { 2179 dev_kfree_skb(skb); 2180 return true; 2181 } 2182 result = ieee80211_tx(sdata, skb, true, 2183 chanctx_conf->channel->band); |
2147 } else { 2148 struct sk_buff_head skbs; 2149 2150 __skb_queue_head_init(&skbs); 2151 __skb_queue_tail(&skbs, skb); 2152 2153 hdr = (struct ieee80211_hdr *)skb->data; 2154 sta = sta_info_get(sdata, hdr->addr1); --- 125 unchanged lines hidden (view full) --- 2280 u16 *tim_offset, u16 *tim_length) 2281{ 2282 struct ieee80211_local *local = hw_to_local(hw); 2283 struct sk_buff *skb = NULL; 2284 struct ieee80211_tx_info *info; 2285 struct ieee80211_sub_if_data *sdata = NULL; 2286 struct ieee80211_if_ap *ap = NULL; 2287 struct beacon_data *beacon; | 2184 } else { 2185 struct sk_buff_head skbs; 2186 2187 __skb_queue_head_init(&skbs); 2188 __skb_queue_tail(&skbs, skb); 2189 2190 hdr = (struct ieee80211_hdr *)skb->data; 2191 sta = sta_info_get(sdata, hdr->addr1); --- 125 unchanged lines hidden (view full) --- 2317 u16 *tim_offset, u16 *tim_length) 2318{ 2319 struct ieee80211_local *local = hw_to_local(hw); 2320 struct sk_buff *skb = NULL; 2321 struct ieee80211_tx_info *info; 2322 struct ieee80211_sub_if_data *sdata = NULL; 2323 struct ieee80211_if_ap *ap = NULL; 2324 struct beacon_data *beacon; |
2288 enum ieee80211_band band = local->oper_channel->band; | 2325 enum ieee80211_band band; |
2289 struct ieee80211_tx_rate_control txrc; | 2326 struct ieee80211_tx_rate_control txrc; |
2327 struct ieee80211_chanctx_conf *chanctx_conf; |
|
2290 2291 rcu_read_lock(); 2292 2293 sdata = vif_to_sdata(vif); | 2328 2329 rcu_read_lock(); 2330 2331 sdata = vif_to_sdata(vif); |
2332 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
|
2294 | 2333 |
2295 if (!ieee80211_sdata_running(sdata)) | 2334 if (!ieee80211_sdata_running(sdata) || !chanctx_conf) |
2296 goto out; 2297 2298 if (tim_offset) 2299 *tim_offset = 0; 2300 if (tim_length) 2301 *tim_length = 0; 2302 2303 if (sdata->vif.type == NL80211_IFTYPE_AP) { --- 100 unchanged lines hidden (view full) --- 2404 cpu_to_le16(sdata->vif.bss_conf.beacon_int); 2405 mgmt->u.beacon.capab_info |= cpu_to_le16( 2406 sdata->u.mesh.security ? WLAN_CAPABILITY_PRIVACY : 0); 2407 2408 pos = skb_put(skb, 2); 2409 *pos++ = WLAN_EID_SSID; 2410 *pos++ = 0x0; 2411 | 2335 goto out; 2336 2337 if (tim_offset) 2338 *tim_offset = 0; 2339 if (tim_length) 2340 *tim_length = 0; 2341 2342 if (sdata->vif.type == NL80211_IFTYPE_AP) { --- 100 unchanged lines hidden (view full) --- 2443 cpu_to_le16(sdata->vif.bss_conf.beacon_int); 2444 mgmt->u.beacon.capab_info |= cpu_to_le16( 2445 sdata->u.mesh.security ? WLAN_CAPABILITY_PRIVACY : 0); 2446 2447 pos = skb_put(skb, 2); 2448 *pos++ = WLAN_EID_SSID; 2449 *pos++ = 0x0; 2450 |
2451 band = chanctx_conf->channel->band; 2452 |
|
2412 if (ieee80211_add_srates_ie(sdata, skb, true, band) || 2413 mesh_add_ds_params_ie(skb, sdata) || 2414 ieee80211_add_ext_srates_ie(sdata, skb, true, band) || 2415 mesh_add_rsn_ie(skb, sdata) || 2416 mesh_add_ht_cap_ie(skb, sdata) || 2417 mesh_add_ht_oper_ie(skb, sdata) || 2418 mesh_add_meshid_ie(skb, sdata) || 2419 mesh_add_meshconf_ie(skb, sdata) || 2420 mesh_add_vendor_ies(skb, sdata)) { 2421 pr_err("o11s: couldn't add ies!\n"); 2422 goto out; 2423 } 2424 } else { 2425 WARN_ON(1); 2426 goto out; 2427 } 2428 | 2453 if (ieee80211_add_srates_ie(sdata, skb, true, band) || 2454 mesh_add_ds_params_ie(skb, sdata) || 2455 ieee80211_add_ext_srates_ie(sdata, skb, true, band) || 2456 mesh_add_rsn_ie(skb, sdata) || 2457 mesh_add_ht_cap_ie(skb, sdata) || 2458 mesh_add_ht_oper_ie(skb, sdata) || 2459 mesh_add_meshid_ie(skb, sdata) || 2460 mesh_add_meshconf_ie(skb, sdata) || 2461 mesh_add_vendor_ies(skb, sdata)) { 2462 pr_err("o11s: couldn't add ies!\n"); 2463 goto out; 2464 } 2465 } else { 2466 WARN_ON(1); 2467 goto out; 2468 } 2469 |
2470 band = chanctx_conf->channel->band; 2471 |
|
2429 info = IEEE80211_SKB_CB(skb); 2430 2431 info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 2432 info->flags |= IEEE80211_TX_CTL_NO_ACK; 2433 info->band = band; 2434 2435 memset(&txrc, 0, sizeof(txrc)); 2436 txrc.hw = hw; --- 214 unchanged lines hidden (view full) --- 2651{ 2652 struct ieee80211_local *local = hw_to_local(hw); 2653 struct sk_buff *skb = NULL; 2654 struct ieee80211_tx_data tx; 2655 struct ieee80211_sub_if_data *sdata; 2656 struct ieee80211_if_ap *bss = NULL; 2657 struct beacon_data *beacon; 2658 struct ieee80211_tx_info *info; | 2472 info = IEEE80211_SKB_CB(skb); 2473 2474 info->flags |= IEEE80211_TX_INTFL_DONT_ENCRYPT; 2475 info->flags |= IEEE80211_TX_CTL_NO_ACK; 2476 info->band = band; 2477 2478 memset(&txrc, 0, sizeof(txrc)); 2479 txrc.hw = hw; --- 214 unchanged lines hidden (view full) --- 2694{ 2695 struct ieee80211_local *local = hw_to_local(hw); 2696 struct sk_buff *skb = NULL; 2697 struct ieee80211_tx_data tx; 2698 struct ieee80211_sub_if_data *sdata; 2699 struct ieee80211_if_ap *bss = NULL; 2700 struct beacon_data *beacon; 2701 struct ieee80211_tx_info *info; |
2702 struct ieee80211_chanctx_conf *chanctx_conf; |
|
2659 2660 sdata = vif_to_sdata(vif); 2661 bss = &sdata->u.ap; 2662 2663 rcu_read_lock(); 2664 beacon = rcu_dereference(bss->beacon); | 2703 2704 sdata = vif_to_sdata(vif); 2705 bss = &sdata->u.ap; 2706 2707 rcu_read_lock(); 2708 beacon = rcu_dereference(bss->beacon); |
2709 chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf); |
|
2665 | 2710 |
2666 if (sdata->vif.type != NL80211_IFTYPE_AP || !beacon || !beacon->head) | 2711 if (sdata->vif.type != NL80211_IFTYPE_AP || !beacon || !beacon->head || 2712 !chanctx_conf) |
2667 goto out; 2668 2669 if (bss->dtim_count != 0 || !bss->dtim_bc_mc) 2670 goto out; /* send buffered bc/mc only after DTIM beacon */ 2671 2672 while (1) { 2673 skb = skb_dequeue(&bss->ps_bc_buf); 2674 if (!skb) --- 13 unchanged lines hidden (view full) --- 2688 if (!ieee80211_tx_prepare(sdata, &tx, skb)) 2689 break; 2690 dev_kfree_skb_any(skb); 2691 } 2692 2693 info = IEEE80211_SKB_CB(skb); 2694 2695 tx.flags |= IEEE80211_TX_PS_BUFFERED; | 2713 goto out; 2714 2715 if (bss->dtim_count != 0 || !bss->dtim_bc_mc) 2716 goto out; /* send buffered bc/mc only after DTIM beacon */ 2717 2718 while (1) { 2719 skb = skb_dequeue(&bss->ps_bc_buf); 2720 if (!skb) --- 13 unchanged lines hidden (view full) --- 2734 if (!ieee80211_tx_prepare(sdata, &tx, skb)) 2735 break; 2736 dev_kfree_skb_any(skb); 2737 } 2738 2739 info = IEEE80211_SKB_CB(skb); 2740 2741 tx.flags |= IEEE80211_TX_PS_BUFFERED; |
2696 info->band = local->oper_channel->band; | 2742 info->band = chanctx_conf->channel->band; |
2697 2698 if (invoke_tx_handlers(&tx)) 2699 skb = NULL; 2700 out: 2701 rcu_read_unlock(); 2702 2703 return skb; 2704} 2705EXPORT_SYMBOL(ieee80211_get_buffered_bc); 2706 | 2743 2744 if (invoke_tx_handlers(&tx)) 2745 skb = NULL; 2746 out: 2747 rcu_read_unlock(); 2748 2749 return skb; 2750} 2751EXPORT_SYMBOL(ieee80211_get_buffered_bc); 2752 |
2707void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata, 2708 struct sk_buff *skb, int tid) | 2753void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata, 2754 struct sk_buff *skb, int tid, 2755 enum ieee80211_band band) |
2709{ 2710 int ac = ieee802_1d_to_ac[tid & 7]; 2711 2712 skb_set_mac_header(skb, 0); 2713 skb_set_network_header(skb, 0); 2714 skb_set_transport_header(skb, 0); 2715 2716 skb_set_queue_mapping(skb, ac); 2717 skb->priority = tid; 2718 2719 /* 2720 * The other path calling ieee80211_xmit is from the tasklet, 2721 * and while we can handle concurrent transmissions locking 2722 * requirements are that we do not come into tx with bhs on. 2723 */ 2724 local_bh_disable(); | 2756{ 2757 int ac = ieee802_1d_to_ac[tid & 7]; 2758 2759 skb_set_mac_header(skb, 0); 2760 skb_set_network_header(skb, 0); 2761 skb_set_transport_header(skb, 0); 2762 2763 skb_set_queue_mapping(skb, ac); 2764 skb->priority = tid; 2765 2766 /* 2767 * The other path calling ieee80211_xmit is from the tasklet, 2768 * and while we can handle concurrent transmissions locking 2769 * requirements are that we do not come into tx with bhs on. 2770 */ 2771 local_bh_disable(); |
2725 ieee80211_xmit(sdata, skb); | 2772 ieee80211_xmit(sdata, skb, band); |
2726 local_bh_enable(); 2727} | 2773 local_bh_enable(); 2774} |