diff options
author | Johannes Berg <johannes.berg@intel.com> | 2011-09-29 10:04:39 -0400 |
---|---|---|
committer | John W. Linville <linville@tuxdriver.com> | 2011-09-30 15:57:23 -0400 |
commit | 37fbd9080088f5f98ab81a6f2ad456857971a089 (patch) | |
tree | ea0d90d7d05056abd662e69b096d1d0628126115 | |
parent | 40b96408831f038b1a6b45e8b22cd050f82a3896 (diff) |
mac80211: allow out-of-band EOSP notification
iwlwifi has a separate EOSP notification from
the device, and to make use of that properly
it needs to be passed to mac80211. To be able
to mix with tx_status_irqsafe and rx_irqsafe
it also needs to be an "_irqsafe" version in
the sense that it goes through the tasklet,
the actual flag clearing would be IRQ-safe
but doing it directly would cause reordering
issues.
This is needed in the case of a P2P GO going
into an absence period without transmitting
any frames that should be driver-released as
in this case there's no other way to inform
mac80211 that the service period ended. Note
that for drivers that don't use the _irqsafe
functions another version of this function
will be required.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: John W. Linville <linville@tuxdriver.com>
-rw-r--r-- | include/net/mac80211.h | 24 | ||||
-rw-r--r-- | net/mac80211/driver-trace.h | 22 | ||||
-rw-r--r-- | net/mac80211/ieee80211_i.h | 5 | ||||
-rw-r--r-- | net/mac80211/main.c | 14 | ||||
-rw-r--r-- | net/mac80211/sta_info.c | 25 |
5 files changed, 88 insertions, 2 deletions
diff --git a/include/net/mac80211.h b/include/net/mac80211.h index 778572d38bd3..3df32a04402c 100644 --- a/include/net/mac80211.h +++ b/include/net/mac80211.h | |||
@@ -1971,7 +1971,8 @@ enum ieee80211_frame_release_type { | |||
1971 | * at least one, however). In this case it is also responsible for | 1971 | * at least one, however). In this case it is also responsible for |
1972 | * setting the EOSP flag in the QoS header of the frames. Also, when the | 1972 | * setting the EOSP flag in the QoS header of the frames. Also, when the |
1973 | * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP | 1973 | * service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP |
1974 | * on the last frame in the SP. | 1974 | * on the last frame in the SP. Alternatively, it may call the function |
1975 | * ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP. | ||
1975 | * This callback must be atomic. | 1976 | * This callback must be atomic. |
1976 | * @allow_buffered_frames: Prepare device to allow the given number of frames | 1977 | * @allow_buffered_frames: Prepare device to allow the given number of frames |
1977 | * to go out to the given station. The frames will be sent by mac80211 | 1978 | * to go out to the given station. The frames will be sent by mac80211 |
@@ -1981,7 +1982,8 @@ enum ieee80211_frame_release_type { | |||
1981 | * frames from multiple TIDs are released and the driver might reorder | 1982 | * frames from multiple TIDs are released and the driver might reorder |
1982 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag | 1983 | * them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag |
1983 | * on the last frame and clear it on all others and also handle the EOSP | 1984 | * on the last frame and clear it on all others and also handle the EOSP |
1984 | * bit in the QoS header correctly. | 1985 | * bit in the QoS header correctly. Alternatively, it can also call the |
1986 | * ieee80211_sta_eosp_irqsafe() function. | ||
1985 | * The @tids parameter is a bitmap and tells the driver which TIDs the | 1987 | * The @tids parameter is a bitmap and tells the driver which TIDs the |
1986 | * frames will be on; it will at most have two bits set. | 1988 | * frames will be on; it will at most have two bits set. |
1987 | * This callback must be atomic. | 1989 | * This callback must be atomic. |
@@ -3113,6 +3115,24 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
3113 | struct ieee80211_sta *pubsta, bool block); | 3115 | struct ieee80211_sta *pubsta, bool block); |
3114 | 3116 | ||
3115 | /** | 3117 | /** |
3118 | * ieee80211_sta_eosp - notify mac80211 about end of SP | ||
3119 | * @pubsta: the station | ||
3120 | * | ||
3121 | * When a device transmits frames in a way that it can't tell | ||
3122 | * mac80211 in the TX status about the EOSP, it must clear the | ||
3123 | * %IEEE80211_TX_STATUS_EOSP bit and call this function instead. | ||
3124 | * This applies for PS-Poll as well as uAPSD. | ||
3125 | * | ||
3126 | * Note that there is no non-_irqsafe version right now as | ||
3127 | * it wasn't needed, but just like _tx_status() and _rx() | ||
3128 | * must not be mixed in irqsafe/non-irqsafe versions, this | ||
3129 | * function must not be mixed with those either. Use the | ||
3130 | * all irqsafe, or all non-irqsafe, don't mix! If you need | ||
3131 | * the non-irqsafe version of this, you need to add it. | ||
3132 | */ | ||
3133 | void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta); | ||
3134 | |||
3135 | /** | ||
3116 | * ieee80211_iter_keys - iterate keys programmed into the device | 3136 | * ieee80211_iter_keys - iterate keys programmed into the device |
3117 | * @hw: pointer obtained from ieee80211_alloc_hw() | 3137 | * @hw: pointer obtained from ieee80211_alloc_hw() |
3118 | * @vif: virtual interface to iterate, may be %NULL for all | 3138 | * @vif: virtual interface to iterate, may be %NULL for all |
diff --git a/net/mac80211/driver-trace.h b/net/mac80211/driver-trace.h index aef08969e353..2af4fca55337 100644 --- a/net/mac80211/driver-trace.h +++ b/net/mac80211/driver-trace.h | |||
@@ -1498,6 +1498,28 @@ TRACE_EVENT(api_enable_rssi_reports, | |||
1498 | ) | 1498 | ) |
1499 | ); | 1499 | ); |
1500 | 1500 | ||
1501 | TRACE_EVENT(api_eosp, | ||
1502 | TP_PROTO(struct ieee80211_local *local, | ||
1503 | struct ieee80211_sta *sta), | ||
1504 | |||
1505 | TP_ARGS(local, sta), | ||
1506 | |||
1507 | TP_STRUCT__entry( | ||
1508 | LOCAL_ENTRY | ||
1509 | STA_ENTRY | ||
1510 | ), | ||
1511 | |||
1512 | TP_fast_assign( | ||
1513 | LOCAL_ASSIGN; | ||
1514 | STA_ASSIGN; | ||
1515 | ), | ||
1516 | |||
1517 | TP_printk( | ||
1518 | LOCAL_PR_FMT STA_PR_FMT, | ||
1519 | LOCAL_PR_ARG, STA_PR_FMT | ||
1520 | ) | ||
1521 | ); | ||
1522 | |||
1501 | /* | 1523 | /* |
1502 | * Tracing for internal functions | 1524 | * Tracing for internal functions |
1503 | * (which may also be called in response to driver calls) | 1525 | * (which may also be called in response to driver calls) |
diff --git a/net/mac80211/ieee80211_i.h b/net/mac80211/ieee80211_i.h index da3206450192..9fa5f8a674bc 100644 --- a/net/mac80211/ieee80211_i.h +++ b/net/mac80211/ieee80211_i.h | |||
@@ -664,6 +664,11 @@ enum sdata_queue_type { | |||
664 | enum { | 664 | enum { |
665 | IEEE80211_RX_MSG = 1, | 665 | IEEE80211_RX_MSG = 1, |
666 | IEEE80211_TX_STATUS_MSG = 2, | 666 | IEEE80211_TX_STATUS_MSG = 2, |
667 | IEEE80211_EOSP_MSG = 3, | ||
668 | }; | ||
669 | |||
670 | struct skb_eosp_msg_data { | ||
671 | u8 sta[ETH_ALEN], iface[ETH_ALEN]; | ||
667 | }; | 672 | }; |
668 | 673 | ||
669 | enum queue_stop_reason { | 674 | enum queue_stop_reason { |
diff --git a/net/mac80211/main.c b/net/mac80211/main.c index 336ceb9d2462..17b038aeac9b 100644 --- a/net/mac80211/main.c +++ b/net/mac80211/main.c | |||
@@ -325,6 +325,8 @@ u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata) | |||
325 | static void ieee80211_tasklet_handler(unsigned long data) | 325 | static void ieee80211_tasklet_handler(unsigned long data) |
326 | { | 326 | { |
327 | struct ieee80211_local *local = (struct ieee80211_local *) data; | 327 | struct ieee80211_local *local = (struct ieee80211_local *) data; |
328 | struct sta_info *sta, *tmp; | ||
329 | struct skb_eosp_msg_data *eosp_data; | ||
328 | struct sk_buff *skb; | 330 | struct sk_buff *skb; |
329 | 331 | ||
330 | while ((skb = skb_dequeue(&local->skb_queue)) || | 332 | while ((skb = skb_dequeue(&local->skb_queue)) || |
@@ -340,6 +342,18 @@ static void ieee80211_tasklet_handler(unsigned long data) | |||
340 | skb->pkt_type = 0; | 342 | skb->pkt_type = 0; |
341 | ieee80211_tx_status(local_to_hw(local), skb); | 343 | ieee80211_tx_status(local_to_hw(local), skb); |
342 | break; | 344 | break; |
345 | case IEEE80211_EOSP_MSG: | ||
346 | eosp_data = (void *)skb->cb; | ||
347 | for_each_sta_info(local, eosp_data->sta, sta, tmp) { | ||
348 | /* skip wrong virtual interface */ | ||
349 | if (memcmp(eosp_data->iface, | ||
350 | sta->sdata->vif.addr, ETH_ALEN)) | ||
351 | continue; | ||
352 | clear_sta_flag(sta, WLAN_STA_SP); | ||
353 | break; | ||
354 | } | ||
355 | dev_kfree_skb(skb); | ||
356 | break; | ||
343 | default: | 357 | default: |
344 | WARN(1, "mac80211: Packet is of unknown type %d\n", | 358 | WARN(1, "mac80211: Packet is of unknown type %d\n", |
345 | skb->pkt_type); | 359 | skb->pkt_type); |
diff --git a/net/mac80211/sta_info.c b/net/mac80211/sta_info.c index 907b42081f3c..076593bffbcf 100644 --- a/net/mac80211/sta_info.c +++ b/net/mac80211/sta_info.c | |||
@@ -1478,6 +1478,31 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw, | |||
1478 | } | 1478 | } |
1479 | EXPORT_SYMBOL(ieee80211_sta_block_awake); | 1479 | EXPORT_SYMBOL(ieee80211_sta_block_awake); |
1480 | 1480 | ||
1481 | void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta) | ||
1482 | { | ||
1483 | struct sta_info *sta = container_of(pubsta, struct sta_info, sta); | ||
1484 | struct ieee80211_local *local = sta->local; | ||
1485 | struct sk_buff *skb; | ||
1486 | struct skb_eosp_msg_data *data; | ||
1487 | |||
1488 | trace_api_eosp(local, pubsta); | ||
1489 | |||
1490 | skb = alloc_skb(0, GFP_ATOMIC); | ||
1491 | if (!skb) { | ||
1492 | /* too bad ... but race is better than loss */ | ||
1493 | clear_sta_flag(sta, WLAN_STA_SP); | ||
1494 | return; | ||
1495 | } | ||
1496 | |||
1497 | data = (void *)skb->cb; | ||
1498 | memcpy(data->sta, pubsta->addr, ETH_ALEN); | ||
1499 | memcpy(data->iface, sta->sdata->vif.addr, ETH_ALEN); | ||
1500 | skb->pkt_type = IEEE80211_EOSP_MSG; | ||
1501 | skb_queue_tail(&local->skb_queue, skb); | ||
1502 | tasklet_schedule(&local->tasklet); | ||
1503 | } | ||
1504 | EXPORT_SYMBOL(ieee80211_sta_eosp_irqsafe); | ||
1505 | |||
1481 | void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta, | 1506 | void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta, |
1482 | u8 tid, bool buffered) | 1507 | u8 tid, bool buffered) |
1483 | { | 1508 | { |