| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * Copyright 2002-2005, Instant802 Networks, Inc. |
|---|
| 3 | 4 | * Copyright 2005-2006, Devicescape Software, Inc. |
|---|
| 4 | 5 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> |
|---|
| 5 | 6 | * Copyright 2008-2010 Johannes Berg <johannes@sipsolutions.net> |
|---|
| 6 | 7 | * Copyright 2013-2014 Intel Mobile Communications GmbH |
|---|
| 7 | | - * |
|---|
| 8 | | - * This program is free software; you can redistribute it and/or modify |
|---|
| 9 | | - * it under the terms of the GNU General Public License version 2 as |
|---|
| 10 | | - * published by the Free Software Foundation. |
|---|
| 11 | 8 | */ |
|---|
| 12 | 9 | |
|---|
| 13 | 10 | #include <linux/export.h> |
|---|
| .. | .. |
|---|
| 52 | 49 | int ac; |
|---|
| 53 | 50 | |
|---|
| 54 | 51 | if (info->flags & (IEEE80211_TX_CTL_NO_PS_BUFFER | |
|---|
| 55 | | - IEEE80211_TX_CTL_AMPDU)) { |
|---|
| 52 | + IEEE80211_TX_CTL_AMPDU | |
|---|
| 53 | + IEEE80211_TX_CTL_HW_80211_ENCAP)) { |
|---|
| 56 | 54 | ieee80211_free_txskb(&local->hw, skb); |
|---|
| 57 | 55 | return; |
|---|
| 58 | 56 | } |
|---|
| .. | .. |
|---|
| 69 | 67 | |
|---|
| 70 | 68 | info->control.jiffies = jiffies; |
|---|
| 71 | 69 | info->control.vif = &sta->sdata->vif; |
|---|
| 72 | | - info->flags |= IEEE80211_TX_INTFL_NEED_TXPROCESSING | |
|---|
| 73 | | - IEEE80211_TX_INTFL_RETRANSMISSION; |
|---|
| 70 | + info->control.flags |= IEEE80211_TX_INTCFL_NEED_TXPROCESSING; |
|---|
| 71 | + info->flags |= IEEE80211_TX_INTFL_RETRANSMISSION; |
|---|
| 74 | 72 | info->flags &= ~IEEE80211_TX_TEMPORARY_FLAGS; |
|---|
| 75 | 73 | |
|---|
| 76 | 74 | sta->status_stats.filtered++; |
|---|
| .. | .. |
|---|
| 187 | 185 | struct ieee80211_mgmt *mgmt = (void *) skb->data; |
|---|
| 188 | 186 | struct ieee80211_local *local = sta->local; |
|---|
| 189 | 187 | struct ieee80211_sub_if_data *sdata = sta->sdata; |
|---|
| 190 | | - struct ieee80211_tx_info *txinfo = IEEE80211_SKB_CB(skb); |
|---|
| 191 | | - |
|---|
| 192 | | - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { |
|---|
| 193 | | - sta->status_stats.last_ack = jiffies; |
|---|
| 194 | | - if (txinfo->status.is_valid_ack_signal) { |
|---|
| 195 | | - sta->status_stats.last_ack_signal = |
|---|
| 196 | | - (s8)txinfo->status.ack_signal; |
|---|
| 197 | | - sta->status_stats.ack_signal_filled = true; |
|---|
| 198 | | - ewma_avg_signal_add(&sta->status_stats.avg_ack_signal, |
|---|
| 199 | | - -txinfo->status.ack_signal); |
|---|
| 200 | | - } |
|---|
| 201 | | - } |
|---|
| 202 | 188 | |
|---|
| 203 | 189 | if (ieee80211_is_data_qos(mgmt->frame_control)) { |
|---|
| 204 | 190 | struct ieee80211_hdr *hdr = (void *) skb->data; |
|---|
| .. | .. |
|---|
| 257 | 243 | tid_tx->bar_pending = true; |
|---|
| 258 | 244 | } |
|---|
| 259 | 245 | |
|---|
| 260 | | -static int ieee80211_tx_radiotap_len(struct ieee80211_tx_info *info) |
|---|
| 246 | +static int ieee80211_tx_radiotap_len(struct ieee80211_tx_info *info, |
|---|
| 247 | + struct ieee80211_tx_status *status) |
|---|
| 261 | 248 | { |
|---|
| 262 | 249 | int len = sizeof(struct ieee80211_radiotap_header); |
|---|
| 263 | 250 | |
|---|
| 264 | 251 | /* IEEE80211_RADIOTAP_RATE rate */ |
|---|
| 265 | | - if (info->status.rates[0].idx >= 0 && |
|---|
| 266 | | - !(info->status.rates[0].flags & (IEEE80211_TX_RC_MCS | |
|---|
| 267 | | - RATE_INFO_FLAGS_DMG | |
|---|
| 268 | | - RATE_INFO_FLAGS_EDMG | |
|---|
| 269 | | - IEEE80211_TX_RC_VHT_MCS))) |
|---|
| 252 | + if (status && status->rate && !(status->rate->flags & |
|---|
| 253 | + (RATE_INFO_FLAGS_MCS | |
|---|
| 254 | + RATE_INFO_FLAGS_DMG | |
|---|
| 255 | + RATE_INFO_FLAGS_EDMG | |
|---|
| 256 | + RATE_INFO_FLAGS_VHT_MCS | |
|---|
| 257 | + RATE_INFO_FLAGS_HE_MCS))) |
|---|
| 258 | + len += 2; |
|---|
| 259 | + else if (info->status.rates[0].idx >= 0 && |
|---|
| 260 | + !(info->status.rates[0].flags & |
|---|
| 261 | + (IEEE80211_TX_RC_MCS | IEEE80211_TX_RC_VHT_MCS))) |
|---|
| 270 | 262 | len += 2; |
|---|
| 271 | 263 | |
|---|
| 272 | 264 | /* IEEE80211_RADIOTAP_TX_FLAGS */ |
|---|
| .. | .. |
|---|
| 277 | 269 | |
|---|
| 278 | 270 | /* IEEE80211_RADIOTAP_MCS |
|---|
| 279 | 271 | * IEEE80211_RADIOTAP_VHT */ |
|---|
| 280 | | - if (info->status.rates[0].idx >= 0) { |
|---|
| 272 | + if (status && status->rate) { |
|---|
| 273 | + if (status->rate->flags & RATE_INFO_FLAGS_MCS) |
|---|
| 274 | + len += 3; |
|---|
| 275 | + else if (status->rate->flags & RATE_INFO_FLAGS_VHT_MCS) |
|---|
| 276 | + len = ALIGN(len, 2) + 12; |
|---|
| 277 | + else if (status->rate->flags & RATE_INFO_FLAGS_HE_MCS) |
|---|
| 278 | + len = ALIGN(len, 2) + 12; |
|---|
| 279 | + } else if (info->status.rates[0].idx >= 0) { |
|---|
| 281 | 280 | if (info->status.rates[0].flags & IEEE80211_TX_RC_MCS) |
|---|
| 282 | 281 | len += 3; |
|---|
| 283 | 282 | else if (info->status.rates[0].flags & IEEE80211_TX_RC_VHT_MCS) |
|---|
| .. | .. |
|---|
| 291 | 290 | ieee80211_add_tx_radiotap_header(struct ieee80211_local *local, |
|---|
| 292 | 291 | struct ieee80211_supported_band *sband, |
|---|
| 293 | 292 | struct sk_buff *skb, int retry_count, |
|---|
| 294 | | - int rtap_len, int shift) |
|---|
| 293 | + int rtap_len, int shift, |
|---|
| 294 | + struct ieee80211_tx_status *status) |
|---|
| 295 | 295 | { |
|---|
| 296 | 296 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
|---|
| 297 | 297 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
|---|
| 298 | 298 | struct ieee80211_radiotap_header *rthdr; |
|---|
| 299 | 299 | unsigned char *pos; |
|---|
| 300 | + u16 legacy_rate = 0; |
|---|
| 300 | 301 | u16 txflags; |
|---|
| 301 | 302 | |
|---|
| 302 | 303 | rthdr = skb_push(skb, rtap_len); |
|---|
| .. | .. |
|---|
| 315 | 316 | */ |
|---|
| 316 | 317 | |
|---|
| 317 | 318 | /* IEEE80211_RADIOTAP_RATE */ |
|---|
| 318 | | - if (info->status.rates[0].idx >= 0 && |
|---|
| 319 | | - !(info->status.rates[0].flags & (IEEE80211_TX_RC_MCS | |
|---|
| 319 | + |
|---|
| 320 | + if (status && status->rate) { |
|---|
| 321 | + if (!(status->rate->flags & (RATE_INFO_FLAGS_MCS | |
|---|
| 320 | 322 | RATE_INFO_FLAGS_DMG | |
|---|
| 321 | 323 | RATE_INFO_FLAGS_EDMG | |
|---|
| 322 | | - IEEE80211_TX_RC_VHT_MCS))) { |
|---|
| 323 | | - u16 rate; |
|---|
| 324 | + RATE_INFO_FLAGS_VHT_MCS | |
|---|
| 325 | + RATE_INFO_FLAGS_HE_MCS))) |
|---|
| 326 | + legacy_rate = status->rate->legacy; |
|---|
| 327 | + } else if (info->status.rates[0].idx >= 0 && |
|---|
| 328 | + !(info->status.rates[0].flags & (IEEE80211_TX_RC_MCS | |
|---|
| 329 | + IEEE80211_TX_RC_VHT_MCS))) |
|---|
| 330 | + legacy_rate = |
|---|
| 331 | + sband->bitrates[info->status.rates[0].idx].bitrate; |
|---|
| 324 | 332 | |
|---|
| 333 | + if (legacy_rate) { |
|---|
| 325 | 334 | rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_RATE); |
|---|
| 326 | | - rate = sband->bitrates[info->status.rates[0].idx].bitrate; |
|---|
| 327 | | - *pos = DIV_ROUND_UP(rate, 5 * (1 << shift)); |
|---|
| 335 | + *pos = DIV_ROUND_UP(legacy_rate, 5 * (1 << shift)); |
|---|
| 328 | 336 | /* padding for tx flags */ |
|---|
| 329 | 337 | pos += 2; |
|---|
| 330 | 338 | } |
|---|
| .. | .. |
|---|
| 348 | 356 | *pos = retry_count; |
|---|
| 349 | 357 | pos++; |
|---|
| 350 | 358 | |
|---|
| 351 | | - if (info->status.rates[0].idx < 0) |
|---|
| 359 | + if (status && status->rate && |
|---|
| 360 | + (status->rate->flags & RATE_INFO_FLAGS_MCS)) { |
|---|
| 361 | + rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_MCS); |
|---|
| 362 | + pos[0] = IEEE80211_RADIOTAP_MCS_HAVE_MCS | |
|---|
| 363 | + IEEE80211_RADIOTAP_MCS_HAVE_GI | |
|---|
| 364 | + IEEE80211_RADIOTAP_MCS_HAVE_BW; |
|---|
| 365 | + if (status->rate->flags & RATE_INFO_FLAGS_SHORT_GI) |
|---|
| 366 | + pos[1] |= IEEE80211_RADIOTAP_MCS_SGI; |
|---|
| 367 | + if (status->rate->bw == RATE_INFO_BW_40) |
|---|
| 368 | + pos[1] |= IEEE80211_RADIOTAP_MCS_BW_40; |
|---|
| 369 | + pos[2] = status->rate->mcs; |
|---|
| 370 | + pos += 3; |
|---|
| 371 | + } else if (status && status->rate && |
|---|
| 372 | + (status->rate->flags & RATE_INFO_FLAGS_VHT_MCS)) { |
|---|
| 373 | + u16 known = local->hw.radiotap_vht_details & |
|---|
| 374 | + (IEEE80211_RADIOTAP_VHT_KNOWN_GI | |
|---|
| 375 | + IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH); |
|---|
| 376 | + |
|---|
| 377 | + rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_VHT); |
|---|
| 378 | + |
|---|
| 379 | + /* required alignment from rthdr */ |
|---|
| 380 | + pos = (u8 *)rthdr + ALIGN(pos - (u8 *)rthdr, 2); |
|---|
| 381 | + |
|---|
| 382 | + /* u16 known - IEEE80211_RADIOTAP_VHT_KNOWN_* */ |
|---|
| 383 | + put_unaligned_le16(known, pos); |
|---|
| 384 | + pos += 2; |
|---|
| 385 | + |
|---|
| 386 | + /* u8 flags - IEEE80211_RADIOTAP_VHT_FLAG_* */ |
|---|
| 387 | + if (status->rate->flags & RATE_INFO_FLAGS_SHORT_GI) |
|---|
| 388 | + *pos |= IEEE80211_RADIOTAP_VHT_FLAG_SGI; |
|---|
| 389 | + pos++; |
|---|
| 390 | + |
|---|
| 391 | + /* u8 bandwidth */ |
|---|
| 392 | + switch (status->rate->bw) { |
|---|
| 393 | + case RATE_INFO_BW_160: |
|---|
| 394 | + *pos = 11; |
|---|
| 395 | + break; |
|---|
| 396 | + case RATE_INFO_BW_80: |
|---|
| 397 | + *pos = 4; |
|---|
| 398 | + break; |
|---|
| 399 | + case RATE_INFO_BW_40: |
|---|
| 400 | + *pos = 1; |
|---|
| 401 | + break; |
|---|
| 402 | + default: |
|---|
| 403 | + *pos = 0; |
|---|
| 404 | + break; |
|---|
| 405 | + } |
|---|
| 406 | + pos++; |
|---|
| 407 | + |
|---|
| 408 | + /* u8 mcs_nss[4] */ |
|---|
| 409 | + *pos = (status->rate->mcs << 4) | status->rate->nss; |
|---|
| 410 | + pos += 4; |
|---|
| 411 | + |
|---|
| 412 | + /* u8 coding */ |
|---|
| 413 | + pos++; |
|---|
| 414 | + /* u8 group_id */ |
|---|
| 415 | + pos++; |
|---|
| 416 | + /* u16 partial_aid */ |
|---|
| 417 | + pos += 2; |
|---|
| 418 | + } else if (status && status->rate && |
|---|
| 419 | + (status->rate->flags & RATE_INFO_FLAGS_HE_MCS)) { |
|---|
| 420 | + struct ieee80211_radiotap_he *he; |
|---|
| 421 | + |
|---|
| 422 | + rthdr->it_present |= cpu_to_le32(1 << IEEE80211_RADIOTAP_HE); |
|---|
| 423 | + |
|---|
| 424 | + /* required alignment from rthdr */ |
|---|
| 425 | + pos = (u8 *)rthdr + ALIGN(pos - (u8 *)rthdr, 2); |
|---|
| 426 | + he = (struct ieee80211_radiotap_he *)pos; |
|---|
| 427 | + |
|---|
| 428 | + he->data1 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA1_FORMAT_SU | |
|---|
| 429 | + IEEE80211_RADIOTAP_HE_DATA1_DATA_MCS_KNOWN | |
|---|
| 430 | + IEEE80211_RADIOTAP_HE_DATA1_DATA_DCM_KNOWN | |
|---|
| 431 | + IEEE80211_RADIOTAP_HE_DATA1_BW_RU_ALLOC_KNOWN); |
|---|
| 432 | + |
|---|
| 433 | + he->data2 = cpu_to_le16(IEEE80211_RADIOTAP_HE_DATA2_GI_KNOWN); |
|---|
| 434 | + |
|---|
| 435 | +#define HE_PREP(f, val) le16_encode_bits(val, IEEE80211_RADIOTAP_HE_##f) |
|---|
| 436 | + |
|---|
| 437 | + he->data6 |= HE_PREP(DATA6_NSTS, status->rate->nss); |
|---|
| 438 | + |
|---|
| 439 | +#define CHECK_GI(s) \ |
|---|
| 440 | + BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_DATA5_GI_##s != \ |
|---|
| 441 | + (int)NL80211_RATE_INFO_HE_GI_##s) |
|---|
| 442 | + |
|---|
| 443 | + CHECK_GI(0_8); |
|---|
| 444 | + CHECK_GI(1_6); |
|---|
| 445 | + CHECK_GI(3_2); |
|---|
| 446 | + |
|---|
| 447 | + he->data3 |= HE_PREP(DATA3_DATA_MCS, status->rate->mcs); |
|---|
| 448 | + he->data3 |= HE_PREP(DATA3_DATA_DCM, status->rate->he_dcm); |
|---|
| 449 | + |
|---|
| 450 | + he->data5 |= HE_PREP(DATA5_GI, status->rate->he_gi); |
|---|
| 451 | + |
|---|
| 452 | + switch (status->rate->bw) { |
|---|
| 453 | + case RATE_INFO_BW_20: |
|---|
| 454 | + he->data5 |= HE_PREP(DATA5_DATA_BW_RU_ALLOC, |
|---|
| 455 | + IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_20MHZ); |
|---|
| 456 | + break; |
|---|
| 457 | + case RATE_INFO_BW_40: |
|---|
| 458 | + he->data5 |= HE_PREP(DATA5_DATA_BW_RU_ALLOC, |
|---|
| 459 | + IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_40MHZ); |
|---|
| 460 | + break; |
|---|
| 461 | + case RATE_INFO_BW_80: |
|---|
| 462 | + he->data5 |= HE_PREP(DATA5_DATA_BW_RU_ALLOC, |
|---|
| 463 | + IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_80MHZ); |
|---|
| 464 | + break; |
|---|
| 465 | + case RATE_INFO_BW_160: |
|---|
| 466 | + he->data5 |= HE_PREP(DATA5_DATA_BW_RU_ALLOC, |
|---|
| 467 | + IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_160MHZ); |
|---|
| 468 | + break; |
|---|
| 469 | + case RATE_INFO_BW_HE_RU: |
|---|
| 470 | +#define CHECK_RU_ALLOC(s) \ |
|---|
| 471 | + BUILD_BUG_ON(IEEE80211_RADIOTAP_HE_DATA5_DATA_BW_RU_ALLOC_##s##T != \ |
|---|
| 472 | + NL80211_RATE_INFO_HE_RU_ALLOC_##s + 4) |
|---|
| 473 | + |
|---|
| 474 | + CHECK_RU_ALLOC(26); |
|---|
| 475 | + CHECK_RU_ALLOC(52); |
|---|
| 476 | + CHECK_RU_ALLOC(106); |
|---|
| 477 | + CHECK_RU_ALLOC(242); |
|---|
| 478 | + CHECK_RU_ALLOC(484); |
|---|
| 479 | + CHECK_RU_ALLOC(996); |
|---|
| 480 | + CHECK_RU_ALLOC(2x996); |
|---|
| 481 | + |
|---|
| 482 | + he->data5 |= HE_PREP(DATA5_DATA_BW_RU_ALLOC, |
|---|
| 483 | + status->rate->he_ru_alloc + 4); |
|---|
| 484 | + break; |
|---|
| 485 | + default: |
|---|
| 486 | + WARN_ONCE(1, "Invalid SU BW %d\n", status->rate->bw); |
|---|
| 487 | + } |
|---|
| 488 | + |
|---|
| 489 | + pos += sizeof(struct ieee80211_radiotap_he); |
|---|
| 490 | + } |
|---|
| 491 | + |
|---|
| 492 | + if ((status && status->rate) || info->status.rates[0].idx < 0) |
|---|
| 352 | 493 | return; |
|---|
| 353 | 494 | |
|---|
| 354 | 495 | /* IEEE80211_RADIOTAP_MCS |
|---|
| .. | .. |
|---|
| 487 | 628 | u64 cookie = IEEE80211_SKB_CB(skb)->ack.cookie; |
|---|
| 488 | 629 | struct ieee80211_sub_if_data *sdata; |
|---|
| 489 | 630 | struct ieee80211_hdr *hdr = (void *)skb->data; |
|---|
| 631 | + __be16 ethertype = 0; |
|---|
| 632 | + |
|---|
| 633 | + if (skb->len >= ETH_HLEN && skb->protocol == cpu_to_be16(ETH_P_802_3)) |
|---|
| 634 | + skb_copy_bits(skb, 2 * ETH_ALEN, ðertype, ETH_TLEN); |
|---|
| 490 | 635 | |
|---|
| 491 | 636 | rcu_read_lock(); |
|---|
| 492 | 637 | sdata = ieee80211_sdata_from_skb(local, skb); |
|---|
| 493 | 638 | if (sdata) { |
|---|
| 494 | | - if (ieee80211_is_any_nullfunc(hdr->frame_control)) |
|---|
| 639 | + if (ethertype == sdata->control_port_protocol || |
|---|
| 640 | + ethertype == cpu_to_be16(ETH_P_PREAUTH)) |
|---|
| 641 | + cfg80211_control_port_tx_status(&sdata->wdev, |
|---|
| 642 | + cookie, |
|---|
| 643 | + skb->data, |
|---|
| 644 | + skb->len, |
|---|
| 645 | + acked, |
|---|
| 646 | + GFP_ATOMIC); |
|---|
| 647 | + else if (ieee80211_is_any_nullfunc(hdr->frame_control)) |
|---|
| 495 | 648 | cfg80211_probe_status(sdata->dev, hdr->addr1, |
|---|
| 496 | 649 | cookie, acked, |
|---|
| 497 | 650 | info->status.ack_signal, |
|---|
| 498 | 651 | info->status.is_valid_ack_signal, |
|---|
| 499 | 652 | GFP_ATOMIC); |
|---|
| 500 | | - else |
|---|
| 653 | + else if (ieee80211_is_mgmt(hdr->frame_control)) |
|---|
| 501 | 654 | cfg80211_mgmt_tx_status(&sdata->wdev, cookie, |
|---|
| 502 | 655 | skb->data, skb->len, |
|---|
| 503 | 656 | acked, GFP_ATOMIC); |
|---|
| 657 | + else |
|---|
| 658 | + pr_warn("Unknown status report in ack skb\n"); |
|---|
| 659 | + |
|---|
| 504 | 660 | } |
|---|
| 505 | 661 | rcu_read_unlock(); |
|---|
| 506 | 662 | |
|---|
| .. | .. |
|---|
| 517 | 673 | struct sk_buff *skb, bool dropped) |
|---|
| 518 | 674 | { |
|---|
| 519 | 675 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
|---|
| 676 | + u16 tx_time_est = ieee80211_info_get_tx_time_est(info); |
|---|
| 520 | 677 | struct ieee80211_hdr *hdr = (void *)skb->data; |
|---|
| 521 | 678 | bool acked = info->flags & IEEE80211_TX_STAT_ACK; |
|---|
| 522 | 679 | |
|---|
| 523 | 680 | if (dropped) |
|---|
| 524 | 681 | acked = false; |
|---|
| 682 | + |
|---|
| 683 | + if (tx_time_est) { |
|---|
| 684 | + struct sta_info *sta; |
|---|
| 685 | + |
|---|
| 686 | + rcu_read_lock(); |
|---|
| 687 | + |
|---|
| 688 | + sta = sta_info_get_by_addrs(local, hdr->addr1, hdr->addr2); |
|---|
| 689 | + ieee80211_sta_update_pending_airtime(local, sta, |
|---|
| 690 | + skb_get_queue_mapping(skb), |
|---|
| 691 | + tx_time_est, |
|---|
| 692 | + true); |
|---|
| 693 | + rcu_read_unlock(); |
|---|
| 694 | + } |
|---|
| 525 | 695 | |
|---|
| 526 | 696 | if (info->flags & IEEE80211_TX_INTFL_MLME_CONN_TX) { |
|---|
| 527 | 697 | struct ieee80211_sub_if_data *sdata; |
|---|
| .. | .. |
|---|
| 574 | 744 | * - current throughput (higher value for higher tpt)? |
|---|
| 575 | 745 | */ |
|---|
| 576 | 746 | #define STA_LOST_PKT_THRESHOLD 50 |
|---|
| 747 | +#define STA_LOST_PKT_TIME HZ /* 1 sec since last ACK */ |
|---|
| 577 | 748 | #define STA_LOST_TDLS_PKT_THRESHOLD 10 |
|---|
| 578 | 749 | #define STA_LOST_TDLS_PKT_TIME (10*HZ) /* 10secs since last ACK */ |
|---|
| 579 | 750 | |
|---|
| 580 | 751 | static void ieee80211_lost_packet(struct sta_info *sta, |
|---|
| 581 | 752 | struct ieee80211_tx_info *info) |
|---|
| 582 | 753 | { |
|---|
| 754 | + unsigned long pkt_time = STA_LOST_PKT_TIME; |
|---|
| 755 | + unsigned int pkt_thr = STA_LOST_PKT_THRESHOLD; |
|---|
| 756 | + |
|---|
| 583 | 757 | /* If driver relies on its own algorithm for station kickout, skip |
|---|
| 584 | 758 | * mac80211 packet loss mechanism. |
|---|
| 585 | 759 | */ |
|---|
| .. | .. |
|---|
| 592 | 766 | return; |
|---|
| 593 | 767 | |
|---|
| 594 | 768 | sta->status_stats.lost_packets++; |
|---|
| 595 | | - if (!sta->sta.tdls && |
|---|
| 596 | | - sta->status_stats.lost_packets < STA_LOST_PKT_THRESHOLD) |
|---|
| 597 | | - return; |
|---|
| 769 | + if (sta->sta.tdls) { |
|---|
| 770 | + pkt_time = STA_LOST_TDLS_PKT_TIME; |
|---|
| 771 | + pkt_thr = STA_LOST_PKT_THRESHOLD; |
|---|
| 772 | + } |
|---|
| 598 | 773 | |
|---|
| 599 | 774 | /* |
|---|
| 600 | 775 | * If we're in TDLS mode, make sure that all STA_LOST_TDLS_PKT_THRESHOLD |
|---|
| 601 | 776 | * of the last packets were lost, and that no ACK was received in the |
|---|
| 602 | 777 | * last STA_LOST_TDLS_PKT_TIME ms, before triggering the CQM packet-loss |
|---|
| 603 | 778 | * mechanism. |
|---|
| 779 | + * For non-TDLS, use STA_LOST_PKT_THRESHOLD and STA_LOST_PKT_TIME |
|---|
| 604 | 780 | */ |
|---|
| 605 | | - if (sta->sta.tdls && |
|---|
| 606 | | - (sta->status_stats.lost_packets < STA_LOST_TDLS_PKT_THRESHOLD || |
|---|
| 607 | | - time_before(jiffies, |
|---|
| 608 | | - sta->status_stats.last_tdls_pkt_time + |
|---|
| 609 | | - STA_LOST_TDLS_PKT_TIME))) |
|---|
| 781 | + if (sta->status_stats.lost_packets < pkt_thr || |
|---|
| 782 | + !time_after(jiffies, sta->status_stats.last_pkt_time + pkt_time)) |
|---|
| 610 | 783 | return; |
|---|
| 611 | 784 | |
|---|
| 612 | 785 | cfg80211_cqm_pktloss_notify(sta->sdata->dev, sta->sta.addr, |
|---|
| .. | .. |
|---|
| 618 | 791 | struct ieee80211_tx_info *info, |
|---|
| 619 | 792 | int *retry_count) |
|---|
| 620 | 793 | { |
|---|
| 621 | | - int rates_idx = -1; |
|---|
| 622 | 794 | int count = -1; |
|---|
| 623 | 795 | int i; |
|---|
| 624 | 796 | |
|---|
| .. | .. |
|---|
| 640 | 812 | |
|---|
| 641 | 813 | count += info->status.rates[i].count; |
|---|
| 642 | 814 | } |
|---|
| 643 | | - rates_idx = i - 1; |
|---|
| 644 | 815 | |
|---|
| 645 | 816 | if (count < 0) |
|---|
| 646 | 817 | count = 0; |
|---|
| 647 | 818 | |
|---|
| 648 | 819 | *retry_count = count; |
|---|
| 649 | | - return rates_idx; |
|---|
| 820 | + return i - 1; |
|---|
| 650 | 821 | } |
|---|
| 651 | 822 | |
|---|
| 652 | 823 | void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb, |
|---|
| 653 | 824 | struct ieee80211_supported_band *sband, |
|---|
| 654 | | - int retry_count, int shift, bool send_to_cooked) |
|---|
| 825 | + int retry_count, int shift, bool send_to_cooked, |
|---|
| 826 | + struct ieee80211_tx_status *status) |
|---|
| 655 | 827 | { |
|---|
| 656 | 828 | struct sk_buff *skb2; |
|---|
| 657 | 829 | struct ieee80211_tx_info *info = IEEE80211_SKB_CB(skb); |
|---|
| .. | .. |
|---|
| 660 | 832 | int rtap_len; |
|---|
| 661 | 833 | |
|---|
| 662 | 834 | /* send frame to monitor interfaces now */ |
|---|
| 663 | | - rtap_len = ieee80211_tx_radiotap_len(info); |
|---|
| 835 | + rtap_len = ieee80211_tx_radiotap_len(info, status); |
|---|
| 664 | 836 | if (WARN_ON_ONCE(skb_headroom(skb) < rtap_len)) { |
|---|
| 665 | 837 | pr_err("ieee80211_tx_status: headroom too small\n"); |
|---|
| 666 | 838 | dev_kfree_skb(skb); |
|---|
| 667 | 839 | return; |
|---|
| 668 | 840 | } |
|---|
| 669 | 841 | ieee80211_add_tx_radiotap_header(local, sband, skb, retry_count, |
|---|
| 670 | | - rtap_len, shift); |
|---|
| 842 | + rtap_len, shift, status); |
|---|
| 671 | 843 | |
|---|
| 672 | 844 | /* XXX: is this sufficient for BPF? */ |
|---|
| 673 | 845 | skb_reset_mac_header(skb); |
|---|
| .. | .. |
|---|
| 707 | 879 | } |
|---|
| 708 | 880 | |
|---|
| 709 | 881 | static void __ieee80211_tx_status(struct ieee80211_hw *hw, |
|---|
| 710 | | - struct ieee80211_tx_status *status) |
|---|
| 882 | + struct ieee80211_tx_status *status, |
|---|
| 883 | + int rates_idx, int retry_count) |
|---|
| 711 | 884 | { |
|---|
| 712 | 885 | struct sk_buff *skb = status->skb; |
|---|
| 713 | 886 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
|---|
| .. | .. |
|---|
| 716 | 889 | struct sta_info *sta; |
|---|
| 717 | 890 | __le16 fc; |
|---|
| 718 | 891 | struct ieee80211_supported_band *sband; |
|---|
| 719 | | - int retry_count; |
|---|
| 720 | | - int rates_idx; |
|---|
| 721 | 892 | bool send_to_cooked; |
|---|
| 722 | 893 | bool acked; |
|---|
| 894 | + bool noack_success; |
|---|
| 723 | 895 | struct ieee80211_bar *bar; |
|---|
| 724 | 896 | int shift = 0; |
|---|
| 725 | 897 | int tid = IEEE80211_NUM_TIDS; |
|---|
| 726 | | - |
|---|
| 727 | | - rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); |
|---|
| 728 | 898 | |
|---|
| 729 | 899 | sband = local->hw.wiphy->bands[info->band]; |
|---|
| 730 | 900 | fc = hdr->frame_control; |
|---|
| .. | .. |
|---|
| 737 | 907 | clear_sta_flag(sta, WLAN_STA_SP); |
|---|
| 738 | 908 | |
|---|
| 739 | 909 | acked = !!(info->flags & IEEE80211_TX_STAT_ACK); |
|---|
| 910 | + noack_success = !!(info->flags & |
|---|
| 911 | + IEEE80211_TX_STAT_NOACK_TRANSMITTED); |
|---|
| 740 | 912 | |
|---|
| 741 | 913 | /* mesh Peer Service Period support */ |
|---|
| 742 | 914 | if (ieee80211_vif_is_mesh(&sta->sdata->vif) && |
|---|
| 743 | 915 | ieee80211_is_data_qos(fc)) |
|---|
| 744 | 916 | ieee80211_mpsp_trigger_process( |
|---|
| 745 | 917 | ieee80211_get_qos_ctl(hdr), sta, true, acked); |
|---|
| 746 | | - |
|---|
| 747 | | - if (!acked && test_sta_flag(sta, WLAN_STA_PS_STA)) { |
|---|
| 748 | | - /* |
|---|
| 749 | | - * The STA is in power save mode, so assume |
|---|
| 750 | | - * that this TX packet failed because of that. |
|---|
| 751 | | - */ |
|---|
| 752 | | - ieee80211_handle_filtered_frame(local, sta, skb); |
|---|
| 753 | | - return; |
|---|
| 754 | | - } |
|---|
| 755 | 918 | |
|---|
| 756 | 919 | if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL) && |
|---|
| 757 | 920 | (ieee80211_is_data(hdr->frame_control)) && |
|---|
| .. | .. |
|---|
| 800 | 963 | if (info->flags & IEEE80211_TX_STAT_TX_FILTERED) { |
|---|
| 801 | 964 | ieee80211_handle_filtered_frame(local, sta, skb); |
|---|
| 802 | 965 | return; |
|---|
| 803 | | - } else { |
|---|
| 804 | | - if (!acked) |
|---|
| 805 | | - sta->status_stats.retry_failed++; |
|---|
| 806 | | - sta->status_stats.retry_count += retry_count; |
|---|
| 966 | + } else if (ieee80211_is_data_present(fc)) { |
|---|
| 967 | + if (!acked && !noack_success) |
|---|
| 968 | + sta->status_stats.msdu_failed[tid]++; |
|---|
| 807 | 969 | |
|---|
| 808 | | - if (ieee80211_is_data_present(fc)) { |
|---|
| 809 | | - if (!acked) |
|---|
| 810 | | - sta->status_stats.msdu_failed[tid]++; |
|---|
| 811 | | - |
|---|
| 812 | | - sta->status_stats.msdu_retries[tid] += |
|---|
| 813 | | - retry_count; |
|---|
| 814 | | - } |
|---|
| 970 | + sta->status_stats.msdu_retries[tid] += |
|---|
| 971 | + retry_count; |
|---|
| 815 | 972 | } |
|---|
| 816 | | - |
|---|
| 817 | | - rate_control_tx_status(local, sband, status); |
|---|
| 818 | | - if (ieee80211_vif_is_mesh(&sta->sdata->vif)) |
|---|
| 819 | | - ieee80211s_update_metric(local, sta, status); |
|---|
| 820 | 973 | |
|---|
| 821 | 974 | if (!(info->flags & IEEE80211_TX_CTL_INJECTED) && acked) |
|---|
| 822 | 975 | ieee80211_frame_acked(sta, skb); |
|---|
| 823 | 976 | |
|---|
| 824 | | - if ((sta->sdata->vif.type == NL80211_IFTYPE_STATION) && |
|---|
| 825 | | - ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) |
|---|
| 826 | | - ieee80211_sta_tx_notify(sta->sdata, (void *) skb->data, |
|---|
| 827 | | - acked, info->status.tx_time); |
|---|
| 828 | | - |
|---|
| 829 | | - if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { |
|---|
| 830 | | - if (info->flags & IEEE80211_TX_STAT_ACK) { |
|---|
| 831 | | - if (sta->status_stats.lost_packets) |
|---|
| 832 | | - sta->status_stats.lost_packets = 0; |
|---|
| 833 | | - |
|---|
| 834 | | - /* Track when last TDLS packet was ACKed */ |
|---|
| 835 | | - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) |
|---|
| 836 | | - sta->status_stats.last_tdls_pkt_time = |
|---|
| 837 | | - jiffies; |
|---|
| 838 | | - } else { |
|---|
| 839 | | - ieee80211_lost_packet(sta, info); |
|---|
| 840 | | - } |
|---|
| 841 | | - } |
|---|
| 842 | 977 | } |
|---|
| 843 | 978 | |
|---|
| 844 | 979 | /* SNMP counters |
|---|
| .. | .. |
|---|
| 897 | 1032 | * with this test... |
|---|
| 898 | 1033 | */ |
|---|
| 899 | 1034 | if (!local->monitors && (!send_to_cooked || !local->cooked_mntrs)) { |
|---|
| 900 | | - dev_kfree_skb(skb); |
|---|
| 1035 | + if (status->free_list) |
|---|
| 1036 | + list_add_tail(&skb->list, status->free_list); |
|---|
| 1037 | + else |
|---|
| 1038 | + dev_kfree_skb(skb); |
|---|
| 901 | 1039 | return; |
|---|
| 902 | 1040 | } |
|---|
| 903 | 1041 | |
|---|
| 904 | 1042 | /* send to monitor interfaces */ |
|---|
| 905 | | - ieee80211_tx_monitor(local, skb, sband, retry_count, shift, send_to_cooked); |
|---|
| 1043 | + ieee80211_tx_monitor(local, skb, sband, retry_count, shift, |
|---|
| 1044 | + send_to_cooked, status); |
|---|
| 906 | 1045 | } |
|---|
| 907 | 1046 | |
|---|
| 908 | 1047 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb) |
|---|
| .. | .. |
|---|
| 913 | 1052 | .skb = skb, |
|---|
| 914 | 1053 | .info = IEEE80211_SKB_CB(skb), |
|---|
| 915 | 1054 | }; |
|---|
| 916 | | - struct rhlist_head *tmp; |
|---|
| 917 | 1055 | struct sta_info *sta; |
|---|
| 918 | 1056 | |
|---|
| 919 | 1057 | rcu_read_lock(); |
|---|
| 920 | 1058 | |
|---|
| 921 | | - for_each_sta_info(local, hdr->addr1, sta, tmp) { |
|---|
| 922 | | - /* skip wrong virtual interface */ |
|---|
| 923 | | - if (!ether_addr_equal(hdr->addr2, sta->sdata->vif.addr)) |
|---|
| 924 | | - continue; |
|---|
| 925 | | - |
|---|
| 1059 | + sta = sta_info_get_by_addrs(local, hdr->addr1, hdr->addr2); |
|---|
| 1060 | + if (sta) |
|---|
| 926 | 1061 | status.sta = &sta->sta; |
|---|
| 927 | | - break; |
|---|
| 928 | | - } |
|---|
| 929 | 1062 | |
|---|
| 930 | | - __ieee80211_tx_status(hw, &status); |
|---|
| 1063 | + ieee80211_tx_status_ext(hw, &status); |
|---|
| 931 | 1064 | rcu_read_unlock(); |
|---|
| 932 | 1065 | } |
|---|
| 933 | 1066 | EXPORT_SYMBOL(ieee80211_tx_status); |
|---|
| .. | .. |
|---|
| 938 | 1071 | struct ieee80211_local *local = hw_to_local(hw); |
|---|
| 939 | 1072 | struct ieee80211_tx_info *info = status->info; |
|---|
| 940 | 1073 | struct ieee80211_sta *pubsta = status->sta; |
|---|
| 1074 | + struct sk_buff *skb = status->skb; |
|---|
| 941 | 1075 | struct ieee80211_supported_band *sband; |
|---|
| 942 | | - int retry_count; |
|---|
| 1076 | + struct sta_info *sta = NULL; |
|---|
| 1077 | + int rates_idx, retry_count; |
|---|
| 943 | 1078 | bool acked, noack_success; |
|---|
| 1079 | + u16 tx_time_est; |
|---|
| 944 | 1080 | |
|---|
| 945 | | - if (status->skb) |
|---|
| 946 | | - return __ieee80211_tx_status(hw, status); |
|---|
| 1081 | + if (pubsta) { |
|---|
| 1082 | + sta = container_of(pubsta, struct sta_info, sta); |
|---|
| 947 | 1083 | |
|---|
| 948 | | - if (!status->sta) |
|---|
| 949 | | - return; |
|---|
| 1084 | + if (status->rate) |
|---|
| 1085 | + sta->tx_stats.last_rate_info = *status->rate; |
|---|
| 1086 | + } |
|---|
| 950 | 1087 | |
|---|
| 951 | | - ieee80211_tx_get_rates(hw, info, &retry_count); |
|---|
| 1088 | + if (skb && (tx_time_est = |
|---|
| 1089 | + ieee80211_info_get_tx_time_est(IEEE80211_SKB_CB(skb))) > 0) { |
|---|
| 1090 | + /* Do this here to avoid the expensive lookup of the sta |
|---|
| 1091 | + * in ieee80211_report_used_skb(). |
|---|
| 1092 | + */ |
|---|
| 1093 | + ieee80211_sta_update_pending_airtime(local, sta, |
|---|
| 1094 | + skb_get_queue_mapping(skb), |
|---|
| 1095 | + tx_time_est, |
|---|
| 1096 | + true); |
|---|
| 1097 | + ieee80211_info_set_tx_time_est(IEEE80211_SKB_CB(skb), 0); |
|---|
| 1098 | + } |
|---|
| 1099 | + |
|---|
| 1100 | + if (!status->info) |
|---|
| 1101 | + goto free; |
|---|
| 1102 | + |
|---|
| 1103 | + rates_idx = ieee80211_tx_get_rates(hw, info, &retry_count); |
|---|
| 952 | 1104 | |
|---|
| 953 | 1105 | sband = hw->wiphy->bands[info->band]; |
|---|
| 954 | 1106 | |
|---|
| .. | .. |
|---|
| 956 | 1108 | noack_success = !!(info->flags & IEEE80211_TX_STAT_NOACK_TRANSMITTED); |
|---|
| 957 | 1109 | |
|---|
| 958 | 1110 | if (pubsta) { |
|---|
| 959 | | - struct sta_info *sta; |
|---|
| 1111 | + struct ieee80211_sub_if_data *sdata = sta->sdata; |
|---|
| 960 | 1112 | |
|---|
| 961 | | - sta = container_of(pubsta, struct sta_info, sta); |
|---|
| 962 | | - |
|---|
| 963 | | - if (!acked) |
|---|
| 1113 | + if (!acked && !noack_success) |
|---|
| 964 | 1114 | sta->status_stats.retry_failed++; |
|---|
| 965 | 1115 | sta->status_stats.retry_count += retry_count; |
|---|
| 966 | 1116 | |
|---|
| 967 | | - if (acked) { |
|---|
| 968 | | - sta->status_stats.last_ack = jiffies; |
|---|
| 1117 | + if (ieee80211_hw_check(&local->hw, REPORTS_TX_ACK_STATUS)) { |
|---|
| 1118 | + if (sdata->vif.type == NL80211_IFTYPE_STATION && |
|---|
| 1119 | + skb && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) |
|---|
| 1120 | + ieee80211_sta_tx_notify(sdata, (void *) skb->data, |
|---|
| 1121 | + acked, info->status.tx_time); |
|---|
| 969 | 1122 | |
|---|
| 970 | | - if (sta->status_stats.lost_packets) |
|---|
| 971 | | - sta->status_stats.lost_packets = 0; |
|---|
| 1123 | + if (acked) { |
|---|
| 1124 | + sta->status_stats.last_ack = jiffies; |
|---|
| 972 | 1125 | |
|---|
| 973 | | - /* Track when last TDLS packet was ACKed */ |
|---|
| 974 | | - if (test_sta_flag(sta, WLAN_STA_TDLS_PEER_AUTH)) |
|---|
| 975 | | - sta->status_stats.last_tdls_pkt_time = jiffies; |
|---|
| 976 | | - } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { |
|---|
| 977 | | - return; |
|---|
| 978 | | - } else { |
|---|
| 979 | | - ieee80211_lost_packet(sta, info); |
|---|
| 1126 | + if (sta->status_stats.lost_packets) |
|---|
| 1127 | + sta->status_stats.lost_packets = 0; |
|---|
| 1128 | + |
|---|
| 1129 | + /* Track when last packet was ACKed */ |
|---|
| 1130 | + sta->status_stats.last_pkt_time = jiffies; |
|---|
| 1131 | + |
|---|
| 1132 | + /* Reset connection monitor */ |
|---|
| 1133 | + if (sdata->vif.type == NL80211_IFTYPE_STATION && |
|---|
| 1134 | + unlikely(sdata->u.mgd.probe_send_count > 0)) |
|---|
| 1135 | + sdata->u.mgd.probe_send_count = 0; |
|---|
| 1136 | + |
|---|
| 1137 | + if (info->status.is_valid_ack_signal) { |
|---|
| 1138 | + sta->status_stats.last_ack_signal = |
|---|
| 1139 | + (s8)info->status.ack_signal; |
|---|
| 1140 | + sta->status_stats.ack_signal_filled = true; |
|---|
| 1141 | + ewma_avg_signal_add(&sta->status_stats.avg_ack_signal, |
|---|
| 1142 | + -info->status.ack_signal); |
|---|
| 1143 | + } |
|---|
| 1144 | + } else if (test_sta_flag(sta, WLAN_STA_PS_STA)) { |
|---|
| 1145 | + /* |
|---|
| 1146 | + * The STA is in power save mode, so assume |
|---|
| 1147 | + * that this TX packet failed because of that. |
|---|
| 1148 | + */ |
|---|
| 1149 | + if (skb) |
|---|
| 1150 | + ieee80211_handle_filtered_frame(local, sta, skb); |
|---|
| 1151 | + return; |
|---|
| 1152 | + } else if (noack_success) { |
|---|
| 1153 | + /* nothing to do here, do not account as lost */ |
|---|
| 1154 | + } else { |
|---|
| 1155 | + ieee80211_lost_packet(sta, info); |
|---|
| 1156 | + } |
|---|
| 980 | 1157 | } |
|---|
| 981 | 1158 | |
|---|
| 982 | 1159 | rate_control_tx_status(local, sband, status); |
|---|
| 983 | 1160 | if (ieee80211_vif_is_mesh(&sta->sdata->vif)) |
|---|
| 984 | 1161 | ieee80211s_update_metric(local, sta, status); |
|---|
| 985 | 1162 | } |
|---|
| 1163 | + |
|---|
| 1164 | + if (skb && !(info->flags & IEEE80211_TX_CTL_HW_80211_ENCAP)) |
|---|
| 1165 | + return __ieee80211_tx_status(hw, status, rates_idx, |
|---|
| 1166 | + retry_count); |
|---|
| 986 | 1167 | |
|---|
| 987 | 1168 | if (acked || noack_success) { |
|---|
| 988 | 1169 | I802_DEBUG_INC(local->dot11TransmittedFrameCount); |
|---|
| .. | .. |
|---|
| 995 | 1176 | } else { |
|---|
| 996 | 1177 | I802_DEBUG_INC(local->dot11FailedCount); |
|---|
| 997 | 1178 | } |
|---|
| 1179 | + |
|---|
| 1180 | +free: |
|---|
| 1181 | + if (!skb) |
|---|
| 1182 | + return; |
|---|
| 1183 | + |
|---|
| 1184 | + ieee80211_report_used_skb(local, skb, false); |
|---|
| 1185 | + if (status->free_list) |
|---|
| 1186 | + list_add_tail(&skb->list, status->free_list); |
|---|
| 1187 | + else |
|---|
| 1188 | + dev_kfree_skb(skb); |
|---|
| 998 | 1189 | } |
|---|
| 999 | 1190 | EXPORT_SYMBOL(ieee80211_tx_status_ext); |
|---|
| 1000 | 1191 | |
|---|
| 1192 | +void ieee80211_tx_rate_update(struct ieee80211_hw *hw, |
|---|
| 1193 | + struct ieee80211_sta *pubsta, |
|---|
| 1194 | + struct ieee80211_tx_info *info) |
|---|
| 1195 | +{ |
|---|
| 1196 | + struct ieee80211_local *local = hw_to_local(hw); |
|---|
| 1197 | + struct ieee80211_supported_band *sband = hw->wiphy->bands[info->band]; |
|---|
| 1198 | + struct sta_info *sta = container_of(pubsta, struct sta_info, sta); |
|---|
| 1199 | + struct ieee80211_tx_status status = { |
|---|
| 1200 | + .info = info, |
|---|
| 1201 | + .sta = pubsta, |
|---|
| 1202 | + }; |
|---|
| 1203 | + |
|---|
| 1204 | + rate_control_tx_status(local, sband, &status); |
|---|
| 1205 | + |
|---|
| 1206 | + if (ieee80211_hw_check(&local->hw, HAS_RATE_CONTROL)) |
|---|
| 1207 | + sta->tx_stats.last_rate = info->status.rates[0]; |
|---|
| 1208 | +} |
|---|
| 1209 | +EXPORT_SYMBOL(ieee80211_tx_rate_update); |
|---|
| 1210 | + |
|---|
| 1211 | +void ieee80211_tx_status_8023(struct ieee80211_hw *hw, |
|---|
| 1212 | + struct ieee80211_vif *vif, |
|---|
| 1213 | + struct sk_buff *skb) |
|---|
| 1214 | +{ |
|---|
| 1215 | + struct ieee80211_sub_if_data *sdata; |
|---|
| 1216 | + struct ieee80211_tx_status status = { |
|---|
| 1217 | + .skb = skb, |
|---|
| 1218 | + .info = IEEE80211_SKB_CB(skb), |
|---|
| 1219 | + }; |
|---|
| 1220 | + struct sta_info *sta; |
|---|
| 1221 | + |
|---|
| 1222 | + sdata = vif_to_sdata(vif); |
|---|
| 1223 | + |
|---|
| 1224 | + rcu_read_lock(); |
|---|
| 1225 | + |
|---|
| 1226 | + if (!ieee80211_lookup_ra_sta(sdata, skb, &sta) && !IS_ERR(sta)) |
|---|
| 1227 | + status.sta = &sta->sta; |
|---|
| 1228 | + |
|---|
| 1229 | + ieee80211_tx_status_ext(hw, &status); |
|---|
| 1230 | + |
|---|
| 1231 | + rcu_read_unlock(); |
|---|
| 1232 | +} |
|---|
| 1233 | +EXPORT_SYMBOL(ieee80211_tx_status_8023); |
|---|
| 1234 | + |
|---|
| 1001 | 1235 | void ieee80211_report_low_ack(struct ieee80211_sta *pubsta, u32 num_packets) |
|---|
| 1002 | 1236 | { |
|---|
| 1003 | 1237 | struct sta_info *sta = container_of(pubsta, struct sta_info, sta); |
|---|