Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 266529
b: refs/heads/master
c: 37fbd90
h: refs/heads/master
i:
  266527: d0c626c
v: v3
  • Loading branch information
Johannes Berg authored and John W. Linville committed Sep 30, 2011
1 parent 5bfd268 commit 24d33d0
Show file tree
Hide file tree
Showing 6 changed files with 89 additions and 3 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 40b96408831f038b1a6b45e8b22cd050f82a3896
refs/heads/master: 37fbd9080088f5f98ab81a6f2ad456857971a089
24 changes: 22 additions & 2 deletions trunk/include/net/mac80211.h
Original file line number Diff line number Diff line change
Expand Up @@ -1971,7 +1971,8 @@ enum ieee80211_frame_release_type {
* at least one, however). In this case it is also responsible for
* setting the EOSP flag in the QoS header of the frames. Also, when the
* service period ends, the driver must set %IEEE80211_TX_STATUS_EOSP
* on the last frame in the SP.
* on the last frame in the SP. Alternatively, it may call the function
* ieee80211_sta_eosp_irqsafe() to inform mac80211 of the end of the SP.
* This callback must be atomic.
* @allow_buffered_frames: Prepare device to allow the given number of frames
* to go out to the given station. The frames will be sent by mac80211
Expand All @@ -1981,7 +1982,8 @@ enum ieee80211_frame_release_type {
* frames from multiple TIDs are released and the driver might reorder
* them between the TIDs, it must set the %IEEE80211_TX_STATUS_EOSP flag
* on the last frame and clear it on all others and also handle the EOSP
* bit in the QoS header correctly.
* bit in the QoS header correctly. Alternatively, it can also call the
* ieee80211_sta_eosp_irqsafe() function.
* The @tids parameter is a bitmap and tells the driver which TIDs the
* frames will be on; it will at most have two bits set.
* This callback must be atomic.
Expand Down Expand Up @@ -3112,6 +3114,24 @@ struct ieee80211_sta *ieee80211_find_sta_by_ifaddr(struct ieee80211_hw *hw,
void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
struct ieee80211_sta *pubsta, bool block);

/**
* ieee80211_sta_eosp - notify mac80211 about end of SP
* @pubsta: the station
*
* When a device transmits frames in a way that it can't tell
* mac80211 in the TX status about the EOSP, it must clear the
* %IEEE80211_TX_STATUS_EOSP bit and call this function instead.
* This applies for PS-Poll as well as uAPSD.
*
* Note that there is no non-_irqsafe version right now as
* it wasn't needed, but just like _tx_status() and _rx()
* must not be mixed in irqsafe/non-irqsafe versions, this
* function must not be mixed with those either. Use the
* all irqsafe, or all non-irqsafe, don't mix! If you need
* the non-irqsafe version of this, you need to add it.
*/
void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta);

/**
* ieee80211_iter_keys - iterate keys programmed into the device
* @hw: pointer obtained from ieee80211_alloc_hw()
Expand Down
22 changes: 22 additions & 0 deletions trunk/net/mac80211/driver-trace.h
Original file line number Diff line number Diff line change
Expand Up @@ -1498,6 +1498,28 @@ TRACE_EVENT(api_enable_rssi_reports,
)
);

TRACE_EVENT(api_eosp,
TP_PROTO(struct ieee80211_local *local,
struct ieee80211_sta *sta),

TP_ARGS(local, sta),

TP_STRUCT__entry(
LOCAL_ENTRY
STA_ENTRY
),

TP_fast_assign(
LOCAL_ASSIGN;
STA_ASSIGN;
),

TP_printk(
LOCAL_PR_FMT STA_PR_FMT,
LOCAL_PR_ARG, STA_PR_FMT
)
);

/*
* Tracing for internal functions
* (which may also be called in response to driver calls)
Expand Down
5 changes: 5 additions & 0 deletions trunk/net/mac80211/ieee80211_i.h
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,11 @@ enum sdata_queue_type {
enum {
IEEE80211_RX_MSG = 1,
IEEE80211_TX_STATUS_MSG = 2,
IEEE80211_EOSP_MSG = 3,
};

struct skb_eosp_msg_data {
u8 sta[ETH_ALEN], iface[ETH_ALEN];
};

enum queue_stop_reason {
Expand Down
14 changes: 14 additions & 0 deletions trunk/net/mac80211/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -325,6 +325,8 @@ u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
static void ieee80211_tasklet_handler(unsigned long data)
{
struct ieee80211_local *local = (struct ieee80211_local *) data;
struct sta_info *sta, *tmp;
struct skb_eosp_msg_data *eosp_data;
struct sk_buff *skb;

while ((skb = skb_dequeue(&local->skb_queue)) ||
Expand All @@ -340,6 +342,18 @@ static void ieee80211_tasklet_handler(unsigned long data)
skb->pkt_type = 0;
ieee80211_tx_status(local_to_hw(local), skb);
break;
case IEEE80211_EOSP_MSG:
eosp_data = (void *)skb->cb;
for_each_sta_info(local, eosp_data->sta, sta, tmp) {
/* skip wrong virtual interface */
if (memcmp(eosp_data->iface,
sta->sdata->vif.addr, ETH_ALEN))
continue;
clear_sta_flag(sta, WLAN_STA_SP);
break;
}
dev_kfree_skb(skb);
break;
default:
WARN(1, "mac80211: Packet is of unknown type %d\n",
skb->pkt_type);
Expand Down
25 changes: 25 additions & 0 deletions trunk/net/mac80211/sta_info.c
Original file line number Diff line number Diff line change
Expand Up @@ -1478,6 +1478,31 @@ void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
}
EXPORT_SYMBOL(ieee80211_sta_block_awake);

void ieee80211_sta_eosp_irqsafe(struct ieee80211_sta *pubsta)
{
struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
struct ieee80211_local *local = sta->local;
struct sk_buff *skb;
struct skb_eosp_msg_data *data;

trace_api_eosp(local, pubsta);

skb = alloc_skb(0, GFP_ATOMIC);
if (!skb) {
/* too bad ... but race is better than loss */
clear_sta_flag(sta, WLAN_STA_SP);
return;
}

data = (void *)skb->cb;
memcpy(data->sta, pubsta->addr, ETH_ALEN);
memcpy(data->iface, sta->sdata->vif.addr, ETH_ALEN);
skb->pkt_type = IEEE80211_EOSP_MSG;
skb_queue_tail(&local->skb_queue, skb);
tasklet_schedule(&local->tasklet);
}
EXPORT_SYMBOL(ieee80211_sta_eosp_irqsafe);

void ieee80211_sta_set_buffered(struct ieee80211_sta *pubsta,
u8 tid, bool buffered)
{
Expand Down

0 comments on commit 24d33d0

Please sign in to comment.