Commit 978cd3a0 authored by Eliad Peller's avatar Eliad Peller Committed by Luciano Coelho

wlcore: save session_id per-link

A new session_id is generated on link allocation.
it is saved in a global array and used later, on tx.

The new fw api adds new bcast/global_session_id
fields to start_role(ap) command, and a new session_id
field to add_peer command. align the driver with it.
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent d50529c0
...@@ -266,6 +266,16 @@ int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id) ...@@ -266,6 +266,16 @@ int wl12xx_cmd_role_disable(struct wl1271 *wl, u8 *role_id)
return ret; return ret;
} }
static int wlcore_get_new_session_id(struct wl1271 *wl, u8 hlid)
{
if (wl->session_ids[hlid] >= SESSION_COUNTER_MAX)
wl->session_ids[hlid] = 0;
wl->session_ids[hlid]++;
return wl->session_ids[hlid];
}
int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
{ {
unsigned long flags; unsigned long flags;
...@@ -273,6 +283,8 @@ int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) ...@@ -273,6 +283,8 @@ int wl12xx_allocate_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
if (link >= WL12XX_MAX_LINKS) if (link >= WL12XX_MAX_LINKS)
return -EBUSY; return -EBUSY;
wl->session_ids[link] = wlcore_get_new_session_id(wl, link);
/* these bits are used by op_tx */ /* these bits are used by op_tx */
spin_lock_irqsave(&wl->wl_lock, flags); spin_lock_irqsave(&wl->wl_lock, flags);
__set_bit(link, wl->links_map); __set_bit(link, wl->links_map);
...@@ -304,17 +316,6 @@ void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid) ...@@ -304,17 +316,6 @@ void wl12xx_free_link(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 *hlid)
*hlid = WL12XX_INVALID_LINK_ID; *hlid = WL12XX_INVALID_LINK_ID;
} }
static int wl12xx_get_new_session_id(struct wl1271 *wl,
struct wl12xx_vif *wlvif)
{
if (wlvif->session_counter >= SESSION_COUNTER_MAX)
wlvif->session_counter = 0;
wlvif->session_counter++;
return wlvif->session_counter;
}
static u8 wlcore_get_native_channel_type(u8 nl_channel_type) static u8 wlcore_get_native_channel_type(u8 nl_channel_type)
{ {
switch (nl_channel_type) { switch (nl_channel_type) {
...@@ -359,7 +360,7 @@ static int wl12xx_cmd_role_start_dev(struct wl1271 *wl, ...@@ -359,7 +360,7 @@ static int wl12xx_cmd_role_start_dev(struct wl1271 *wl,
goto out_free; goto out_free;
} }
cmd->device.hlid = wlvif->dev_hlid; cmd->device.hlid = wlvif->dev_hlid;
cmd->device.session = wl12xx_get_new_session_id(wl, wlvif); cmd->device.session = wl->session_ids[wlvif->dev_hlid];
wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d", wl1271_debug(DEBUG_CMD, "role start: roleid=%d, hlid=%d, session=%d",
cmd->role_id, cmd->device.hlid, cmd->device.session); cmd->role_id, cmd->device.hlid, cmd->device.session);
...@@ -460,7 +461,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -460,7 +461,7 @@ int wl12xx_cmd_role_start_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
goto out_free; goto out_free;
} }
cmd->sta.hlid = wlvif->sta.hlid; cmd->sta.hlid = wlvif->sta.hlid;
cmd->sta.session = wl12xx_get_new_session_id(wl, wlvif); cmd->sta.session = wl->session_ids[wlvif->sta.hlid];
/* /*
* We don't have the correct remote rates in this stage, and there * We don't have the correct remote rates in this stage, and there
* is no way to update them later, so use our supported rates instead. * is no way to update them later, so use our supported rates instead.
...@@ -564,6 +565,8 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -564,6 +565,8 @@ int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
cmd->ap.bss_index = WL1271_AP_BSS_INDEX; cmd->ap.bss_index = WL1271_AP_BSS_INDEX;
cmd->ap.global_hlid = wlvif->ap.global_hlid; cmd->ap.global_hlid = wlvif->ap.global_hlid;
cmd->ap.broadcast_hlid = wlvif->ap.bcast_hlid; cmd->ap.broadcast_hlid = wlvif->ap.bcast_hlid;
cmd->ap.global_session_id = wl->session_ids[wlvif->ap.global_hlid];
cmd->ap.bcast_session_id = wl->session_ids[wlvif->ap.bcast_hlid];
cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set); cmd->ap.basic_rate_set = cpu_to_le32(wlvif->basic_rate_set);
cmd->ap.beacon_interval = cpu_to_le16(wlvif->beacon_int); cmd->ap.beacon_interval = cpu_to_le16(wlvif->beacon_int);
cmd->ap.dtim_interval = bss_conf->dtim_period; cmd->ap.dtim_interval = bss_conf->dtim_period;
...@@ -1419,6 +1422,7 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -1419,6 +1422,7 @@ int wl12xx_cmd_add_peer(struct wl1271 *wl, struct wl12xx_vif *wlvif,
cmd->hlid = hlid; cmd->hlid = hlid;
cmd->sp_len = sta->max_sp; cmd->sp_len = sta->max_sp;
cmd->wmm = sta->wme ? 1 : 0; cmd->wmm = sta->wme ? 1 : 0;
cmd->session_id = wl->session_ids[hlid];
for (i = 0; i < NUM_ACCESS_CATEGORIES_COPY; i++) for (i = 0; i < NUM_ACCESS_CATEGORIES_COPY; i++)
if (sta->wme && (sta->uapsd_queues & BIT(i))) if (sta->wme && (sta->uapsd_queues & BIT(i)))
......
...@@ -362,7 +362,9 @@ struct wl12xx_cmd_role_start { ...@@ -362,7 +362,9 @@ struct wl12xx_cmd_role_start {
*/ */
u8 wmm; u8 wmm;
u8 padding_1[3]; u8 bcast_session_id;
u8 global_session_id;
u8 padding_1[1];
} __packed ap; } __packed ap;
}; };
} __packed; } __packed;
...@@ -582,7 +584,7 @@ struct wl12xx_cmd_add_peer { ...@@ -582,7 +584,7 @@ struct wl12xx_cmd_add_peer {
u8 bss_index; u8 bss_index;
u8 sp_len; u8 sp_len;
u8 wmm; u8 wmm;
u8 padding1; u8 session_id;
} __packed; } __packed;
struct wl12xx_cmd_remove_peer { struct wl12xx_cmd_remove_peer {
......
...@@ -589,7 +589,6 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf, ...@@ -589,7 +589,6 @@ static ssize_t vifs_state_read(struct file *file, char __user *user_buf,
VIF_STATE_PRINT_INT(beacon_int); VIF_STATE_PRINT_INT(beacon_int);
VIF_STATE_PRINT_INT(default_key); VIF_STATE_PRINT_INT(default_key);
VIF_STATE_PRINT_INT(aid); VIF_STATE_PRINT_INT(aid);
VIF_STATE_PRINT_INT(session_counter);
VIF_STATE_PRINT_INT(psm_entry_retry); VIF_STATE_PRINT_INT(psm_entry_retry);
VIF_STATE_PRINT_INT(power_level); VIF_STATE_PRINT_INT(power_level);
VIF_STATE_PRINT_INT(rssi_thold); VIF_STATE_PRINT_INT(rssi_thold);
......
...@@ -1871,6 +1871,7 @@ static void wlcore_op_stop_locked(struct wl1271 *wl) ...@@ -1871,6 +1871,7 @@ static void wlcore_op_stop_locked(struct wl1271 *wl)
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));
memset(wl->roc_map, 0, sizeof(wl->roc_map)); memset(wl->roc_map, 0, sizeof(wl->roc_map));
memset(wl->session_ids, 0, sizeof(wl->session_ids));
wl->active_sta_count = 0; wl->active_sta_count = 0;
/* The system link is always allocated */ /* The system link is always allocated */
......
...@@ -294,7 +294,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -294,7 +294,7 @@ static void wl1271_tx_fill_hdr(struct wl1271 *wl, struct wl12xx_vif *wlvif,
tx_attr |= TX_HW_ATTR_TX_DUMMY_REQ; tx_attr |= TX_HW_ATTR_TX_DUMMY_REQ;
} else if (wlvif) { } else if (wlvif) {
/* configure the tx attributes */ /* configure the tx attributes */
tx_attr = wlvif->session_counter << tx_attr = wl->session_ids[hlid] <<
TX_HW_ATTR_OFST_SESSION_COUNTER; TX_HW_ATTR_OFST_SESSION_COUNTER;
} }
......
...@@ -215,6 +215,8 @@ struct wl1271 { ...@@ -215,6 +215,8 @@ struct wl1271 {
unsigned long klv_templates_map[ unsigned long klv_templates_map[
BITS_TO_LONGS(WLCORE_MAX_KLV_TEMPLATES)]; BITS_TO_LONGS(WLCORE_MAX_KLV_TEMPLATES)];
u8 session_ids[WL12XX_MAX_LINKS];
struct list_head wlvif_list; struct list_head wlvif_list;
u8 sta_count; u8 sta_count;
......
...@@ -396,9 +396,6 @@ struct wl12xx_vif { ...@@ -396,9 +396,6 @@ struct wl12xx_vif {
/* Our association ID */ /* Our association ID */
u16 aid; u16 aid;
/* Session counter for the chipset */
int session_counter;
/* retry counter for PSM entries */ /* retry counter for PSM entries */
u8 psm_entry_retry; u8 psm_entry_retry;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment