sta_info.c (abe60632f311d515b082b450504ee24006023951) sta_info.c (47846c9b0c10808d9337d2e7d09361f3e0a0a71a)
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */

--- 358 unchanged lines hidden (view full) ---

367 * something inserts a STA (on one CPU) without holding the RTNL
368 * and another CPU turns off the net device.
369 */
370 if (unlikely(!netif_running(sdata->dev))) {
371 err = -ENETDOWN;
372 goto out_free;
373 }
374
1/*
2 * Copyright 2002-2005, Instant802 Networks, Inc.
3 * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
8 */

--- 358 unchanged lines hidden (view full) ---

367 * something inserts a STA (on one CPU) without holding the RTNL
368 * and another CPU turns off the net device.
369 */
370 if (unlikely(!netif_running(sdata->dev))) {
371 err = -ENETDOWN;
372 goto out_free;
373 }
374
375 if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->dev->dev_addr) == 0 ||
375 if (WARN_ON(compare_ether_addr(sta->sta.addr, sdata->vif.addr) == 0 ||
376 is_multicast_ether_addr(sta->sta.addr))) {
377 err = -EINVAL;
378 goto out_free;
379 }
380
381 spin_lock_irqsave(&local->sta_lock, flags);
382 /* check if STA exists already */
383 if (sta_info_get(sdata, sta->sta.addr)) {

--- 442 unchanged lines hidden (view full) ---

826 LIST_HEAD(tmp_list);
827 unsigned long flags;
828
829 spin_lock_irqsave(&local->sta_lock, flags);
830 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
831 if (time_after(jiffies, sta->last_rx + exp_time)) {
832#ifdef CONFIG_MAC80211_IBSS_DEBUG
833 printk(KERN_DEBUG "%s: expiring inactive STA %pM\n",
376 is_multicast_ether_addr(sta->sta.addr))) {
377 err = -EINVAL;
378 goto out_free;
379 }
380
381 spin_lock_irqsave(&local->sta_lock, flags);
382 /* check if STA exists already */
383 if (sta_info_get(sdata, sta->sta.addr)) {

--- 442 unchanged lines hidden (view full) ---

826 LIST_HEAD(tmp_list);
827 unsigned long flags;
828
829 spin_lock_irqsave(&local->sta_lock, flags);
830 list_for_each_entry_safe(sta, tmp, &local->sta_list, list)
831 if (time_after(jiffies, sta->last_rx + exp_time)) {
832#ifdef CONFIG_MAC80211_IBSS_DEBUG
833 printk(KERN_DEBUG "%s: expiring inactive STA %pM\n",
834 sdata->dev->name, sta->sta.addr);
834 sdata->name, sta->sta.addr);
835#endif
836 __sta_info_unlink(&sta);
837 if (sta)
838 list_add(&sta->list, &tmp_list);
839 }
840 spin_unlock_irqrestore(&local->sta_lock, flags);
841
842 list_for_each_entry_safe(sta, tmp, &tmp_list, list)

--- 41 unchanged lines hidden (view full) ---

884 /* Send all buffered frames to the station */
885 sent = ieee80211_add_pending_skbs(local, &sta->tx_filtered);
886 buffered = ieee80211_add_pending_skbs(local, &sta->ps_tx_buf);
887 sent += buffered;
888 local->total_ps_buffered -= buffered;
889
890#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
891 printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames "
835#endif
836 __sta_info_unlink(&sta);
837 if (sta)
838 list_add(&sta->list, &tmp_list);
839 }
840 spin_unlock_irqrestore(&local->sta_lock, flags);
841
842 list_for_each_entry_safe(sta, tmp, &tmp_list, list)

--- 41 unchanged lines hidden (view full) ---

884 /* Send all buffered frames to the station */
885 sent = ieee80211_add_pending_skbs(local, &sta->tx_filtered);
886 buffered = ieee80211_add_pending_skbs(local, &sta->ps_tx_buf);
887 sent += buffered;
888 local->total_ps_buffered -= buffered;
889
890#ifdef CONFIG_MAC80211_VERBOSE_PS_DEBUG
891 printk(KERN_DEBUG "%s: STA %pM aid %d sending %d filtered/%d PS frames "
892 "since STA not sleeping anymore\n", sdata->dev->name,
892 "since STA not sleeping anymore\n", sdata->name,
893 sta->sta.addr, sta->sta.aid, sent - buffered, buffered);
894#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
895}
896
897void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta)
898{
899 struct ieee80211_sub_if_data *sdata = sta->sdata;
900 struct ieee80211_local *local = sdata->local;

--- 42 unchanged lines hidden (view full) ---

943 /*
944 * FIXME: This can be the result of a race condition between
945 * us expiring a frame and the station polling for it.
946 * Should we send it a null-func frame indicating we
947 * have nothing buffered for it?
948 */
949 printk(KERN_DEBUG "%s: STA %pM sent PS Poll even "
950 "though there are no buffered frames for it\n",
893 sta->sta.addr, sta->sta.aid, sent - buffered, buffered);
894#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
895}
896
897void ieee80211_sta_ps_deliver_poll_response(struct sta_info *sta)
898{
899 struct ieee80211_sub_if_data *sdata = sta->sdata;
900 struct ieee80211_local *local = sdata->local;

--- 42 unchanged lines hidden (view full) ---

943 /*
944 * FIXME: This can be the result of a race condition between
945 * us expiring a frame and the station polling for it.
946 * Should we send it a null-func frame indicating we
947 * have nothing buffered for it?
948 */
949 printk(KERN_DEBUG "%s: STA %pM sent PS Poll even "
950 "though there are no buffered frames for it\n",
951 sdata->dev->name, sta->sta.addr);
951 sdata->name, sta->sta.addr);
952#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
953 }
954}
955
956void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
957 struct ieee80211_sta *pubsta, bool block)
958{
959 struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
960
961 if (block)
962 set_sta_flags(sta, WLAN_STA_PS_DRIVER);
963 else
964 ieee80211_queue_work(hw, &sta->drv_unblock_wk);
965}
966EXPORT_SYMBOL(ieee80211_sta_block_awake);
952#endif /* CONFIG_MAC80211_VERBOSE_PS_DEBUG */
953 }
954}
955
956void ieee80211_sta_block_awake(struct ieee80211_hw *hw,
957 struct ieee80211_sta *pubsta, bool block)
958{
959 struct sta_info *sta = container_of(pubsta, struct sta_info, sta);
960
961 if (block)
962 set_sta_flags(sta, WLAN_STA_PS_DRIVER);
963 else
964 ieee80211_queue_work(hw, &sta->drv_unblock_wk);
965}
966EXPORT_SYMBOL(ieee80211_sta_block_awake);