Skip to content

Commit

Permalink
wl12xx: AP mode - changes in TX path
Browse files Browse the repository at this point in the history
When in AP mode set appropriate HLID and rate policy for each skb.
Respond to supported-rates related changes in op_tx only when acting
as STA.

Signed-off-by: Arik Nemtsov <arik@wizery.com>
Reviewed-by: Luciano Coelho <coelho@ti.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
  • Loading branch information
Arik Nemtsov authored and Luciano Coelho committed Jan 24, 2011
1 parent f84f7d7 commit c6c8a65
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 10 deletions.
3 changes: 2 additions & 1 deletion drivers/net/wireless/wl12xx/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -943,7 +943,8 @@ static int wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
spin_lock_irqsave(&wl->wl_lock, flags);
if (sta &&
(sta->supp_rates[conf->channel->band] !=
(wl->sta_rate_set & HW_BG_RATES_MASK))) {
(wl->sta_rate_set & HW_BG_RATES_MASK)) &&
wl->bss_type != BSS_TYPE_AP_BSS) {
wl->sta_rate_set = sta->supp_rates[conf->channel->band];
set_bit(WL1271_FLAG_STA_RATES_CHANGED, &wl->flags);
}
Expand Down
55 changes: 46 additions & 9 deletions drivers/net/wireless/wl12xx/tx.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/etherdevice.h>

#include "wl12xx.h"
#include "io.h"
Expand Down Expand Up @@ -99,7 +100,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
{
struct timespec ts;
struct wl1271_tx_hw_descr *desc;
int pad, ac;
int pad, ac, rate_idx;
s64 hosttime;
u16 tx_attr;

Expand All @@ -117,15 +118,53 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
getnstimeofday(&ts);
hosttime = (timespec_to_ns(&ts) >> 10);
desc->start_time = cpu_to_le32(hosttime - wl->time_offset);
desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU);

if (wl->bss_type != BSS_TYPE_AP_BSS)
desc->life_time = cpu_to_le16(TX_HW_MGMT_PKT_LIFETIME_TU);
else
desc->life_time = cpu_to_le16(TX_HW_AP_MODE_PKT_LIFETIME_TU);

/* configure the tx attributes */
tx_attr = wl->session_counter << TX_HW_ATTR_OFST_SESSION_COUNTER;

/* queue (we use same identifiers for tid's and ac's */
ac = wl1271_tx_get_queue(skb_get_queue_mapping(skb));
desc->tid = ac;
desc->aid = TX_HW_DEFAULT_AID;

if (wl->bss_type != BSS_TYPE_AP_BSS) {
desc->aid = TX_HW_DEFAULT_AID;

/* if the packets are destined for AP (have a STA entry)
send them with AP rate policies, otherwise use default
basic rates */
if (control->control.sta)
rate_idx = ACX_TX_AP_FULL_RATE;
else
rate_idx = ACX_TX_BASIC_RATE;
} else {
if (control->control.sta) {
struct wl1271_station *wl_sta;

wl_sta = (struct wl1271_station *)
control->control.sta->drv_priv;
desc->hlid = wl_sta->hlid;
rate_idx = ac;
} else {
struct ieee80211_hdr *hdr;

hdr = (struct ieee80211_hdr *)
(skb->data + sizeof(*desc));
if (ieee80211_is_mgmt(hdr->frame_control)) {
desc->hlid = WL1271_AP_GLOBAL_HLID;
rate_idx = ACX_TX_AP_MODE_MGMT_RATE;
} else {
desc->hlid = WL1271_AP_BROADCAST_HLID;
rate_idx = ACX_TX_AP_MODE_BCST_RATE;
}
}
}

tx_attr |= rate_idx << TX_HW_ATTR_OFST_RATE_POLICY;
desc->reserved = 0;

/* align the length (and store in terms of words) */
Expand All @@ -136,14 +175,12 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
pad = pad - skb->len;
tx_attr |= pad << TX_HW_ATTR_OFST_LAST_WORD_PAD;

/* if the packets are destined for AP (have a STA entry) send them
with AP rate policies, otherwise use default basic rates */
if (control->control.sta)
tx_attr |= ACX_TX_AP_FULL_RATE << TX_HW_ATTR_OFST_RATE_POLICY;

desc->tx_attr = cpu_to_le16(tx_attr);

wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d", pad);
wl1271_debug(DEBUG_TX, "tx_fill_hdr: pad: %d hlid: %d "
"tx_attr: 0x%x len: %d life: %d mem: %d", pad, (int)desc->hlid,
(int)desc->tx_attr, (int)desc->length, (int)desc->life_time,
(int)desc->total_mem_blocks);
}

/* caller must hold wl->mutex */
Expand Down

0 comments on commit c6c8a65

Please sign in to comment.