wl12xx: add system_hlid

system_hlid is a const hlid (always 0), used by the fw and driver
for packets which are not bound to specific role (e.g. dynamic
memory packets).
indicate it as always allocated.

Signed-off-by: Eliad Peller <eliad@wizery.com>
Signed-off-by: Luciano Coelho <coelho@ti.com>
This commit is contained in:
Eliad Peller 2011-08-14 13:17:15 +03:00 committed by Luciano Coelho
parent fa6ad9f0f3
commit f4df1bd525
4 changed files with 36 additions and 17 deletions

View file

@ -1491,7 +1491,7 @@ static void wl1271_op_tx(struct ieee80211_hw *hw, struct sk_buff *skb)
q = wl1271_tx_get_queue(mapping); q = wl1271_tx_get_queue(mapping);
if (wl->bss_type == BSS_TYPE_AP_BSS) if (wl->bss_type == BSS_TYPE_AP_BSS)
hlid = wl1271_tx_get_hlid(skb); hlid = wl12xx_tx_get_hlid_ap(wl, skb);
spin_lock_irqsave(&wl->wl_lock, flags); spin_lock_irqsave(&wl->wl_lock, flags);
@ -2069,6 +2069,9 @@ deinit:
memset(wl->roles_map, 0, sizeof(wl->roles_map)); memset(wl->roles_map, 0, sizeof(wl->roles_map));
memset(wl->links_map, 0, sizeof(wl->links_map)); memset(wl->links_map, 0, sizeof(wl->links_map));
/* The system link is always allocated */
__set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
/* /*
* this is performed after the cancel_work calls and the associated * this is performed after the cancel_work calls and the associated
* mutex_lock, so that wl1271_op_add_interface does not accidentally * mutex_lock, so that wl1271_op_add_interface does not accidentally
@ -4407,6 +4410,7 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->tx_security_seq = 0; wl->tx_security_seq = 0;
wl->tx_security_last_seq_lsb = 0; wl->tx_security_last_seq_lsb = 0;
wl->role_id = WL12XX_INVALID_ROLE_ID; wl->role_id = WL12XX_INVALID_ROLE_ID;
wl->system_hlid = WL12XX_SYSTEM_HLID;
wl->sta_hlid = WL12XX_INVALID_LINK_ID; wl->sta_hlid = WL12XX_INVALID_LINK_ID;
wl->dev_role_id = WL12XX_INVALID_ROLE_ID; wl->dev_role_id = WL12XX_INVALID_ROLE_ID;
wl->dev_hlid = WL12XX_INVALID_LINK_ID; wl->dev_hlid = WL12XX_INVALID_LINK_ID;
@ -4415,6 +4419,9 @@ struct ieee80211_hw *wl1271_alloc_hw(void)
wl->fwlog_size = 0; wl->fwlog_size = 0;
init_waitqueue_head(&wl->fwlog_waitq); init_waitqueue_head(&wl->fwlog_waitq);
/* The system link is always allocated */
__set_bit(WL12XX_SYSTEM_HLID, wl->links_map);
memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map)); memset(wl->tx_frames_map, 0, sizeof(wl->tx_frames_map));
for (i = 0; i < ACX_TX_DESCRIPTORS; i++) for (i = 0; i < ACX_TX_DESCRIPTORS; i++)
wl->tx_frames[i] = NULL; wl->tx_frames[i] = NULL;

View file

@ -132,7 +132,12 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, u8 hlid)
} }
#endif #endif
u8 wl1271_tx_get_hlid(struct sk_buff *skb) static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
{
return wl->dummy_packet == skb;
}
u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb)
{ {
struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb); struct ieee80211_tx_info *control = IEEE80211_SKB_CB(skb);
@ -145,6 +150,9 @@ u8 wl1271_tx_get_hlid(struct sk_buff *skb)
} else { } else {
struct ieee80211_hdr *hdr; struct ieee80211_hdr *hdr;
if (!test_bit(WL1271_FLAG_AP_STARTED, &wl->flags))
return wl->system_hlid;
hdr = (struct ieee80211_hdr *)skb->data; hdr = (struct ieee80211_hdr *)skb->data;
if (ieee80211_is_mgmt(hdr->frame_control)) if (ieee80211_is_mgmt(hdr->frame_control))
return WL1271_AP_GLOBAL_HLID; return WL1271_AP_GLOBAL_HLID;
@ -153,6 +161,20 @@ u8 wl1271_tx_get_hlid(struct sk_buff *skb)
} }
} }
static u8 wl1271_tx_get_hlid(struct wl1271 *wl, struct sk_buff *skb)
{
if (wl12xx_is_dummy_packet(wl, skb))
return wl->system_hlid;
if (wl->bss_type == BSS_TYPE_AP_BSS)
return wl12xx_tx_get_hlid_ap(wl, skb);
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
return wl->sta_hlid;
else
return wl->dev_hlid;
}
static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl, static unsigned int wl12xx_calc_packet_alignment(struct wl1271 *wl,
unsigned int packet_length) unsigned int packet_length)
{ {
@ -221,11 +243,6 @@ static int wl1271_tx_allocate(struct wl1271 *wl, struct sk_buff *skb, u32 extra,
return ret; return ret;
} }
static bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
{
return wl->dummy_packet == skb;
}
static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb, static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct sk_buff *skb,
u32 extra, struct ieee80211_tx_info *control, u32 extra, struct ieee80211_tx_info *control,
u8 hlid) u8 hlid)
@ -371,14 +388,7 @@ static int wl1271_prepare_tx_frame(struct wl1271 *wl, struct sk_buff *skb,
} }
} }
if (wl->bss_type == BSS_TYPE_AP_BSS) hlid = wl1271_tx_get_hlid(wl, skb);
hlid = wl1271_tx_get_hlid(skb);
else
if (test_bit(WL1271_FLAG_STA_ASSOCIATED, &wl->flags))
hlid = wl->sta_hlid;
else
hlid = wl->dev_hlid;
if (hlid == WL12XX_INVALID_LINK_ID) { if (hlid == WL12XX_INVALID_LINK_ID) {
wl1271_error("invalid hlid. dropping skb 0x%p", skb); wl1271_error("invalid hlid. dropping skb 0x%p", skb);
return -EINVAL; return -EINVAL;
@ -564,7 +574,7 @@ static void wl1271_skb_queue_head(struct wl1271 *wl, struct sk_buff *skb)
if (wl12xx_is_dummy_packet(wl, skb)) { if (wl12xx_is_dummy_packet(wl, skb)) {
set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags); set_bit(WL1271_FLAG_DUMMY_PACKET_PENDING, &wl->flags);
} else if (wl->bss_type == BSS_TYPE_AP_BSS) { } else if (wl->bss_type == BSS_TYPE_AP_BSS) {
u8 hlid = wl1271_tx_get_hlid(skb); u8 hlid = wl1271_tx_get_hlid(wl, skb);
skb_queue_head(&wl->links[hlid].tx_queue[q], skb); skb_queue_head(&wl->links[hlid].tx_queue[q], skb);
/* make sure we dequeue the same packet next time */ /* make sure we dequeue the same packet next time */

View file

@ -210,7 +210,7 @@ void wl1271_tx_flush(struct wl1271 *wl);
u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band); u8 wl1271_rate_to_idx(int rate, enum ieee80211_band band);
u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set); u32 wl1271_tx_enabled_rates_get(struct wl1271 *wl, u32 rate_set);
u32 wl1271_tx_min_rate_get(struct wl1271 *wl); u32 wl1271_tx_min_rate_get(struct wl1271 *wl);
u8 wl1271_tx_get_hlid(struct sk_buff *skb); u8 wl12xx_tx_get_hlid_ap(struct wl1271 *wl, struct sk_buff *skb);
void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid); void wl1271_tx_reset_link_queues(struct wl1271 *wl, u8 hlid);
void wl1271_handle_tx_low_watermark(struct wl1271 *wl); void wl1271_handle_tx_low_watermark(struct wl1271 *wl);

View file

@ -141,6 +141,7 @@ extern u32 wl12xx_debug_level;
#define WL12XX_MAX_LINKS 8 #define WL12XX_MAX_LINKS 8
#define WL12XX_INVALID_ROLE_ID 0xff #define WL12XX_INVALID_ROLE_ID 0xff
#define WL12XX_INVALID_LINK_ID 0xff #define WL12XX_INVALID_LINK_ID 0xff
#define WL12XX_SYSTEM_HLID 0
#define WL1271_AP_GLOBAL_HLID 0 #define WL1271_AP_GLOBAL_HLID 0
#define WL1271_AP_BROADCAST_HLID 1 #define WL1271_AP_BROADCAST_HLID 1
#define WL1271_AP_STA_HLID_START 2 #define WL1271_AP_STA_HLID_START 2
@ -395,6 +396,7 @@ struct wl1271 {
int channel; int channel;
u8 role_id; u8 role_id;
u8 dev_role_id; u8 dev_role_id;
u8 system_hlid;
u8 sta_hlid; u8 sta_hlid;
u8 dev_hlid; u8 dev_hlid;