Commit 6e8cd331 authored by Eliad Peller's avatar Eliad Peller Committed by Luciano Coelho

wl12xx: replace all remaining wl->vif references

wl->vif is appropriate only when a single vif is being used.
Instead, pass wlvif as parameter or iterate through all
the vifs (e.g. when a global configuration was changed)

Leave wl->vif only to determine whether a vif was already
added (this check will be removed as well after both the
driver and fw will support multiple vifs)
Signed-off-by: default avatarEliad Peller <eliad@wizery.com>
Signed-off-by: default avatarLuciano Coelho <coelho@ti.com>
parent 9f259c4e
...@@ -654,7 +654,8 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -654,7 +654,8 @@ int wl12xx_cmd_role_stop_sta(struct wl1271 *wl, struct wl12xx_vif *wlvif)
int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif) int wl12xx_cmd_role_start_ap(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
struct wl12xx_cmd_role_start *cmd; struct wl12xx_cmd_role_start *cmd;
struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf; struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
int ret; int ret;
wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id); wl1271_debug(DEBUG_CMD, "cmd role start ap %d", wlvif->role_id);
...@@ -773,7 +774,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -773,7 +774,7 @@ int wl12xx_cmd_role_start_ibss(struct wl1271 *wl, struct wl12xx_vif *wlvif)
{ {
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif); struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
struct wl12xx_cmd_role_start *cmd; struct wl12xx_cmd_role_start *cmd;
struct ieee80211_bss_conf *bss_conf = &wl->vif->bss_conf; struct ieee80211_bss_conf *bss_conf = &vif->bss_conf;
int ret; int ret;
cmd = kzalloc(sizeof(*cmd), GFP_KERNEL); cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
...@@ -1096,10 +1097,11 @@ int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl, ...@@ -1096,10 +1097,11 @@ int wl12xx_cmd_build_klv_null_data(struct wl1271 *wl,
int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif, int wl1271_cmd_build_ps_poll(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u16 aid) u16 aid)
{ {
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
struct sk_buff *skb; struct sk_buff *skb;
int ret = 0; int ret = 0;
skb = ieee80211_pspoll_get(wl->hw, wl->vif); skb = ieee80211_pspoll_get(wl->hw, vif);
if (!skb) if (!skb)
goto out; goto out;
...@@ -1176,6 +1178,7 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -1176,6 +1178,7 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
__be32 ip_addr) __be32 ip_addr)
{ {
int ret; int ret;
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
struct wl12xx_arp_rsp_template tmpl; struct wl12xx_arp_rsp_template tmpl;
struct ieee80211_hdr_3addr *hdr; struct ieee80211_hdr_3addr *hdr;
struct arphdr *arp_hdr; struct arphdr *arp_hdr;
...@@ -1187,8 +1190,8 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -1187,8 +1190,8 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA | hdr->frame_control = cpu_to_le16(IEEE80211_FTYPE_DATA |
IEEE80211_STYPE_DATA | IEEE80211_STYPE_DATA |
IEEE80211_FCTL_TODS); IEEE80211_FCTL_TODS);
memcpy(hdr->addr1, wl->vif->bss_conf.bssid, ETH_ALEN); memcpy(hdr->addr1, vif->bss_conf.bssid, ETH_ALEN);
memcpy(hdr->addr2, wl->vif->addr, ETH_ALEN); memcpy(hdr->addr2, vif->addr, ETH_ALEN);
memset(hdr->addr3, 0xff, ETH_ALEN); memset(hdr->addr3, 0xff, ETH_ALEN);
/* llc layer */ /* llc layer */
...@@ -1204,7 +1207,7 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -1204,7 +1207,7 @@ int wl1271_cmd_build_arp_rsp(struct wl1271 *wl, struct wl12xx_vif *wlvif,
arp_hdr->ar_op = cpu_to_be16(ARPOP_REPLY); arp_hdr->ar_op = cpu_to_be16(ARPOP_REPLY);
/* arp payload */ /* arp payload */
memcpy(tmpl.sender_hw, wl->vif->addr, ETH_ALEN); memcpy(tmpl.sender_hw, vif->addr, ETH_ALEN);
tmpl.sender_ip = ip_addr; tmpl.sender_ip = ip_addr;
ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP, ret = wl1271_cmd_template_set(wl, CMD_TEMPL_ARP_RSP,
......
...@@ -615,19 +615,12 @@ static ssize_t beacon_filtering_write(struct file *file, ...@@ -615,19 +615,12 @@ static ssize_t beacon_filtering_write(struct file *file,
size_t count, loff_t *ppos) size_t count, loff_t *ppos)
{ {
struct wl1271 *wl = file->private_data; struct wl1271 *wl = file->private_data;
struct ieee80211_vif *vif;
struct wl12xx_vif *wlvif; struct wl12xx_vif *wlvif;
char buf[10]; char buf[10];
size_t len; size_t len;
unsigned long value; unsigned long value;
int ret; int ret;
if (!wl->vif)
return -EINVAL;
vif = wl->vif;
wlvif = wl12xx_vif_to_data(vif);
len = min(count, sizeof(buf) - 1); len = min(count, sizeof(buf) - 1);
if (copy_from_user(buf, user_buf, len)) if (copy_from_user(buf, user_buf, len))
return -EFAULT; return -EFAULT;
...@@ -645,7 +638,9 @@ static ssize_t beacon_filtering_write(struct file *file, ...@@ -645,7 +638,9 @@ static ssize_t beacon_filtering_write(struct file *file,
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = wl1271_acx_beacon_filter_opt(wl, wlvif, !!value); wl12xx_for_each_wlvif(wl, wlvif) {
ret = wl1271_acx_beacon_filter_opt(wl, wlvif, !!value);
}
wl1271_ps_elp_sleep(wl); wl1271_ps_elp_sleep(wl);
out: out:
......
...@@ -779,7 +779,9 @@ static int wl1271_plt_init(struct wl1271 *wl) ...@@ -779,7 +779,9 @@ static int wl1271_plt_init(struct wl1271 *wl)
return ret; return ret;
} }
static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts) static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl,
struct wl12xx_vif *wlvif,
u8 hlid, u8 tx_pkts)
{ {
bool fw_ps, single_sta; bool fw_ps, single_sta;
...@@ -791,7 +793,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts) ...@@ -791,7 +793,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts)
* packets in FW or if the STA is awake. * packets in FW or if the STA is awake.
*/ */
if (!fw_ps || tx_pkts < WL1271_PS_STA_MAX_PACKETS) if (!fw_ps || tx_pkts < WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_end(wl, hlid); wl12xx_ps_link_end(wl, wlvif, hlid);
/* /*
* Start high-level PS if the STA is asleep with enough blocks in FW. * Start high-level PS if the STA is asleep with enough blocks in FW.
...@@ -799,7 +801,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts) ...@@ -799,7 +801,7 @@ static void wl12xx_irq_ps_regulate_link(struct wl1271 *wl, u8 hlid, u8 tx_pkts)
* case FW-memory congestion is not a problem. * case FW-memory congestion is not a problem.
*/ */
else if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS) else if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_start(wl, hlid, true); wl12xx_ps_link_start(wl, wlvif, hlid, true);
} }
static void wl12xx_irq_update_links_status(struct wl1271 *wl, static void wl12xx_irq_update_links_status(struct wl1271 *wl,
...@@ -829,15 +831,15 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl, ...@@ -829,15 +831,15 @@ static void wl12xx_irq_update_links_status(struct wl1271 *wl,
lnk->prev_freed_pkts = status->tx_lnk_free_pkts[hlid]; lnk->prev_freed_pkts = status->tx_lnk_free_pkts[hlid];
lnk->allocated_pkts -= cnt; lnk->allocated_pkts -= cnt;
wl12xx_irq_ps_regulate_link(wl, hlid, lnk->allocated_pkts); wl12xx_irq_ps_regulate_link(wl, wlvif, hlid,
lnk->allocated_pkts);
} }
} }
static void wl12xx_fw_status(struct wl1271 *wl, static void wl12xx_fw_status(struct wl1271 *wl,
struct wl12xx_fw_status *status) struct wl12xx_fw_status *status)
{ {
struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ struct wl12xx_vif *wlvif;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct timespec ts; struct timespec ts;
u32 old_tx_blk_count = wl->tx_blocks_available; u32 old_tx_blk_count = wl->tx_blocks_available;
int avail, freed_blocks; int avail, freed_blocks;
...@@ -892,8 +894,9 @@ static void wl12xx_fw_status(struct wl1271 *wl, ...@@ -892,8 +894,9 @@ static void wl12xx_fw_status(struct wl1271 *wl,
clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags); clear_bit(WL1271_FLAG_FW_TX_BUSY, &wl->flags);
/* for AP update num of allocated TX blocks per link and ps status */ /* for AP update num of allocated TX blocks per link and ps status */
if (wlvif->bss_type == BSS_TYPE_AP_BSS) wl12xx_for_each_wlvif_ap(wl, wlvif) {
wl12xx_irq_update_links_status(wl, wlvif, status); wl12xx_irq_update_links_status(wl, wlvif, status);
}
/* update the host-chipset time offset */ /* update the host-chipset time offset */
getnstimeofday(&ts); getnstimeofday(&ts);
...@@ -1212,6 +1215,7 @@ static void wl1271_recovery_work(struct work_struct *work) ...@@ -1212,6 +1215,7 @@ static void wl1271_recovery_work(struct work_struct *work)
struct wl1271 *wl = struct wl1271 *wl =
container_of(work, struct wl1271, recovery_work); container_of(work, struct wl1271, recovery_work);
struct wl12xx_vif *wlvif; struct wl12xx_vif *wlvif;
struct ieee80211_vif *vif;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
...@@ -1249,7 +1253,12 @@ static void wl1271_recovery_work(struct work_struct *work) ...@@ -1249,7 +1253,12 @@ static void wl1271_recovery_work(struct work_struct *work)
} }
/* reboot the chipset */ /* reboot the chipset */
__wl1271_op_remove_interface(wl, wl->vif, false); while (!list_empty(&wl->wlvif_list)) {
wlvif = list_first_entry(&wl->wlvif_list,
struct wl12xx_vif, list);
vif = wl12xx_wlvif_to_vif(wlvif);
__wl1271_op_remove_interface(wl, vif, false);
}
clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags); clear_bit(WL1271_FLAG_RECOVERY_IN_PROGRESS, &wl->flags);
...@@ -1721,18 +1730,19 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, ...@@ -1721,18 +1730,19 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
struct cfg80211_wowlan *wow) struct cfg80211_wowlan *wow)
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ struct wl12xx_vif *wlvif;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret; int ret;
wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow); wl1271_debug(DEBUG_MAC80211, "mac80211 suspend wow=%d", !!wow);
WARN_ON(!wow || !wow->any); WARN_ON(!wow || !wow->any);
wl->wow_enabled = true; wl->wow_enabled = true;
ret = wl1271_configure_suspend(wl, wlvif); wl12xx_for_each_wlvif(wl, wlvif) {
if (ret < 0) { ret = wl1271_configure_suspend(wl, wlvif);
wl1271_warning("couldn't prepare device to suspend"); if (ret < 0) {
return ret; wl1271_warning("couldn't prepare device to suspend");
return ret;
}
} }
/* flush any remaining work */ /* flush any remaining work */
wl1271_debug(DEBUG_MAC80211, "flushing remaining works"); wl1271_debug(DEBUG_MAC80211, "flushing remaining works");
...@@ -1751,7 +1761,9 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, ...@@ -1751,7 +1761,9 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
wl1271_enable_interrupts(wl); wl1271_enable_interrupts(wl);
flush_work(&wl->tx_work); flush_work(&wl->tx_work);
flush_delayed_work(&wlvif->pspoll_work); wl12xx_for_each_wlvif(wl, wlvif) {
flush_delayed_work(&wlvif->pspoll_work);
}
flush_delayed_work(&wl->elp_work); flush_delayed_work(&wl->elp_work);
return 0; return 0;
...@@ -1760,8 +1772,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw, ...@@ -1760,8 +1772,7 @@ static int wl1271_op_suspend(struct ieee80211_hw *hw,
static int wl1271_op_resume(struct ieee80211_hw *hw) static int wl1271_op_resume(struct ieee80211_hw *hw)
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ struct wl12xx_vif *wlvif;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
unsigned long flags; unsigned long flags;
bool run_irq_work = false; bool run_irq_work = false;
...@@ -1785,7 +1796,9 @@ static int wl1271_op_resume(struct ieee80211_hw *hw) ...@@ -1785,7 +1796,9 @@ static int wl1271_op_resume(struct ieee80211_hw *hw)
wl1271_irq(0, wl); wl1271_irq(0, wl);
wl1271_enable_interrupts(wl); wl1271_enable_interrupts(wl);
} }
wl1271_configure_resume(wl, wlvif); wl12xx_for_each_wlvif(wl, wlvif) {
wl1271_configure_resume(wl, wlvif);
}
wl->wow_enabled = false; wl->wow_enabled = false;
return 0; return 0;
...@@ -2242,6 +2255,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, ...@@ -2242,6 +2255,7 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif); struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
struct wl12xx_vif *iter;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
...@@ -2253,10 +2267,14 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw, ...@@ -2253,10 +2267,14 @@ static void wl1271_op_remove_interface(struct ieee80211_hw *hw,
* wl->vif can be null here if someone shuts down the interface * wl->vif can be null here if someone shuts down the interface
* just when hardware recovery has been started. * just when hardware recovery has been started.
*/ */
if (wl->vif) { wl12xx_for_each_wlvif(wl, iter) {
WARN_ON(wl->vif != vif); if (iter != wlvif)
continue;
__wl1271_op_remove_interface(wl, vif, true); __wl1271_op_remove_interface(wl, vif, true);
break;
} }
WARN_ON(iter != wlvif);
out: out:
mutex_unlock(&wl->mutex); mutex_unlock(&wl->mutex);
cancel_work_sync(&wl->recovery_work); cancel_work_sync(&wl->recovery_work);
...@@ -2326,8 +2344,10 @@ static int wl1271_unjoin(struct wl1271 *wl, struct wl12xx_vif *wlvif) ...@@ -2326,8 +2344,10 @@ static int wl1271_unjoin(struct wl1271 *wl, struct wl12xx_vif *wlvif)
int ret; int ret;
if (test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) { if (test_and_clear_bit(WLVIF_FLAG_CS_PROGRESS, &wlvif->flags)) {
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
wl12xx_cmd_stop_channel_switch(wl); wl12xx_cmd_stop_channel_switch(wl);
ieee80211_chswitch_done(wl->vif, false); ieee80211_chswitch_done(vif, false);
} }
/* to stop listening to a channel, we disconnect */ /* to stop listening to a channel, we disconnect */
...@@ -2642,8 +2662,7 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw, ...@@ -2642,8 +2662,7 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw,
{ {
struct wl1271_filter_params *fp = (void *)(unsigned long)multicast; struct wl1271_filter_params *fp = (void *)(unsigned long)multicast;
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct ieee80211_vif *vif = wl->vif; /* TODO: get as param */ struct wl12xx_vif *wlvif;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret; int ret;
...@@ -2662,17 +2681,20 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw, ...@@ -2662,17 +2681,20 @@ static void wl1271_op_configure_filter(struct ieee80211_hw *hw,
if (ret < 0) if (ret < 0)
goto out; goto out;
if (wlvif->bss_type != BSS_TYPE_AP_BSS) { wl12xx_for_each_wlvif(wl, wlvif) {
if (*total & FIF_ALLMULTI) if (wlvif->bss_type != BSS_TYPE_AP_BSS) {
ret = wl1271_acx_group_address_tbl(wl, wlvif, false, if (*total & FIF_ALLMULTI)
NULL, 0); ret = wl1271_acx_group_address_tbl(wl, wlvif,
else if (fp) false,
ret = wl1271_acx_group_address_tbl(wl, wlvif, NULL, 0);
fp->enabled, else if (fp)
fp->mc_list, ret = wl1271_acx_group_address_tbl(wl, wlvif,
fp->mc_list_length); fp->enabled,
if (ret < 0) fp->mc_list,
goto out_sleep; fp->mc_list_length);
if (ret < 0)
goto out_sleep;
}
} }
/* /*
...@@ -3162,8 +3184,7 @@ static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value) ...@@ -3162,8 +3184,7 @@ static int wl1271_op_set_frag_threshold(struct ieee80211_hw *hw, u32 value)
static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
{ {
struct wl1271 *wl = hw->priv; struct wl1271 *wl = hw->priv;
struct ieee80211_vif *vif = wl->vif; struct wl12xx_vif *wlvif;
struct wl12xx_vif *wlvif = wl12xx_vif_to_data(vif);
int ret = 0; int ret = 0;
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
...@@ -3177,10 +3198,11 @@ static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value) ...@@ -3177,10 +3198,11 @@ static int wl1271_op_set_rts_threshold(struct ieee80211_hw *hw, u32 value)
if (ret < 0) if (ret < 0)
goto out; goto out;
ret = wl1271_acx_rts_threshold(wl, wlvif, value); wl12xx_for_each_wlvif(wl, wlvif) {
if (ret < 0) ret = wl1271_acx_rts_threshold(wl, wlvif, value);
wl1271_warning("wl1271_op_set_rts_threshold failed: %d", ret); if (ret < 0)
wl1271_warning("set rts threshold failed: %d", ret);
}
wl1271_ps_elp_sleep(wl); wl1271_ps_elp_sleep(wl);
out: out:
...@@ -3669,7 +3691,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl, ...@@ -3669,7 +3691,7 @@ static void wl1271_bss_info_changed_sta(struct wl1271 *wl,
wlvif->probereq = NULL; wlvif->probereq = NULL;
/* re-enable dynamic ps - just in case */ /* re-enable dynamic ps - just in case */
ieee80211_enable_dyn_ps(wl->vif); ieee80211_enable_dyn_ps(vif);
/* revert back to minimum rates for the current band */ /* revert back to minimum rates for the current band */
wl1271_set_band_rate(wl, wlvif); wl1271_set_band_rate(wl, wlvif);
...@@ -4305,9 +4327,11 @@ static void wl12xx_op_channel_switch(struct ieee80211_hw *hw, ...@@ -4305,9 +4327,11 @@ static void wl12xx_op_channel_switch(struct ieee80211_hw *hw,
mutex_lock(&wl->mutex); mutex_lock(&wl->mutex);
if (unlikely(wl->state == WL1271_STATE_OFF)) { if (unlikely(wl->state == WL1271_STATE_OFF)) {
mutex_unlock(&wl->mutex); wl12xx_for_each_wlvif_sta(wl, wlvif) {
ieee80211_chswitch_done(wl->vif, false); struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
return; ieee80211_chswitch_done(vif, false);
}
goto out;
} }
ret = wl1271_ps_elp_wakeup(wl); ret = wl1271_ps_elp_wakeup(wl);
......
...@@ -232,9 +232,11 @@ static void wl1271_ps_filter_frames(struct wl1271 *wl, u8 hlid) ...@@ -232,9 +232,11 @@ static void wl1271_ps_filter_frames(struct wl1271 *wl, u8 hlid)
wl1271_handle_tx_low_watermark(wl); wl1271_handle_tx_low_watermark(wl);
} }
void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues) void wl12xx_ps_link_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
u8 hlid, bool clean_queues)
{ {
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
if (test_bit(hlid, &wl->ap_ps_map)) if (test_bit(hlid, &wl->ap_ps_map))
return; return;
...@@ -244,7 +246,7 @@ void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues) ...@@ -244,7 +246,7 @@ void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues)
clean_queues); clean_queues);
rcu_read_lock(); rcu_read_lock();
sta = ieee80211_find_sta(wl->vif, wl->links[hlid].addr); sta = ieee80211_find_sta(vif, wl->links[hlid].addr);
if (!sta) { if (!sta) {
wl1271_error("could not find sta %pM for starting ps", wl1271_error("could not find sta %pM for starting ps",
wl->links[hlid].addr); wl->links[hlid].addr);
...@@ -262,9 +264,10 @@ void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues) ...@@ -262,9 +264,10 @@ void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues)
__set_bit(hlid, &wl->ap_ps_map); __set_bit(hlid, &wl->ap_ps_map);
} }
void wl1271_ps_link_end(struct wl1271 *wl, u8 hlid) void wl12xx_ps_link_end(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid)
{ {
struct ieee80211_sta *sta; struct ieee80211_sta *sta;
struct ieee80211_vif *vif = wl12xx_wlvif_to_vif(wlvif);
if (!test_bit(hlid, &wl->ap_ps_map)) if (!test_bit(hlid, &wl->ap_ps_map))
return; return;
...@@ -274,7 +277,7 @@ void wl1271_ps_link_end(struct wl1271 *wl, u8 hlid) ...@@ -274,7 +277,7 @@ void wl1271_ps_link_end(struct wl1271 *wl, u8 hlid)
__clear_bit(hlid, &wl->ap_ps_map); __clear_bit(hlid, &wl->ap_ps_map);
rcu_read_lock(); rcu_read_lock();
sta = ieee80211_find_sta(wl->vif, wl->links[hlid].addr); sta = ieee80211_find_sta(vif, wl->links[hlid].addr);
if (!sta) { if (!sta) {
wl1271_error("could not find sta %pM for ending ps", wl1271_error("could not find sta %pM for ending ps",
wl->links[hlid].addr); wl->links[hlid].addr);
......
...@@ -32,8 +32,9 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif, ...@@ -32,8 +32,9 @@ int wl1271_ps_set_mode(struct wl1271 *wl, struct wl12xx_vif *wlvif,
void wl1271_ps_elp_sleep(struct wl1271 *wl); void wl1271_ps_elp_sleep(struct wl1271 *wl);
int wl1271_ps_elp_wakeup(struct wl1271 *wl); int wl1271_ps_elp_wakeup(struct wl1271 *wl);
void wl1271_elp_work(struct work_struct *work); void wl1271_elp_work(struct work_struct *work);
void wl1271_ps_link_start(struct wl1271 *wl, u8 hlid, bool clean_queues); void wl12xx_ps_link_start(struct wl1271 *wl, struct wl12xx_vif *wlvif,
void wl1271_ps_link_end(struct wl1271 *wl, u8 hlid); u8 hlid, bool clean_queues);
void wl12xx_ps_link_end(struct wl1271 *wl, struct wl12xx_vif *wlvif, u8 hlid);
#define WL1271_PS_COMPLETE_TIMEOUT 500 #define WL1271_PS_COMPLETE_TIMEOUT 500
......
...@@ -146,7 +146,7 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl, ...@@ -146,7 +146,7 @@ static void wl1271_tx_regulate_link(struct wl1271 *wl,
* case FW-memory congestion is not a problem. * case FW-memory congestion is not a problem.
*/ */
if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS) if (!single_sta && fw_ps && tx_pkts >= WL1271_PS_STA_MAX_PACKETS)
wl1271_ps_link_start(wl, hlid, true); wl12xx_ps_link_start(wl, wlvif, hlid, true);
} }
bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb) bool wl12xx_is_dummy_packet(struct wl1271 *wl, struct sk_buff *skb)
......
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