Deleted Added
full compact
ieee80211_power.c (184288) ieee80211_power.c (186302)
1/*-
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * 1. Redistributions of source code must retain the above copyright

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

19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
20 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
21 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include <sys/cdefs.h>
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_power.c 184288 2008-10-26 01:04:46Z sam $");
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_power.c 186302 2008-12-18 23:00:09Z sam $");
28
29/*
30 * IEEE 802.11 power save support.
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

75ieee80211_power_latevattach(struct ieee80211vap *vap)
76{
77 /*
78 * Allocate these only if needed. Beware that we
79 * know adhoc mode doesn't support ATIM yet...
80 */
81 if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
82 vap->iv_tim_len = howmany(vap->iv_max_aid,8) * sizeof(uint8_t);
28
29/*
30 * IEEE 802.11 power save support.
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/systm.h>

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

75ieee80211_power_latevattach(struct ieee80211vap *vap)
76{
77 /*
78 * Allocate these only if needed. Beware that we
79 * know adhoc mode doesn't support ATIM yet...
80 */
81 if (vap->iv_opmode == IEEE80211_M_HOSTAP) {
82 vap->iv_tim_len = howmany(vap->iv_max_aid,8) * sizeof(uint8_t);
83 MALLOC(vap->iv_tim_bitmap, uint8_t *, vap->iv_tim_len,
83 vap->iv_tim_bitmap = (uint8_t *) malloc(vap->iv_tim_len,
84 M_80211_POWER, M_NOWAIT | M_ZERO);
85 if (vap->iv_tim_bitmap == NULL) {
86 printf("%s: no memory for TIM bitmap!\n", __func__);
87 /* XXX good enough to keep from crashing? */
88 vap->iv_tim_len = 0;
89 }
90 }
91}
92
93void
94ieee80211_power_vdetach(struct ieee80211vap *vap)
95{
96 if (vap->iv_tim_bitmap != NULL) {
84 M_80211_POWER, M_NOWAIT | M_ZERO);
85 if (vap->iv_tim_bitmap == NULL) {
86 printf("%s: no memory for TIM bitmap!\n", __func__);
87 /* XXX good enough to keep from crashing? */
88 vap->iv_tim_len = 0;
89 }
90 }
91}
92
93void
94ieee80211_power_vdetach(struct ieee80211vap *vap)
95{
96 if (vap->iv_tim_bitmap != NULL) {
97 FREE(vap->iv_tim_bitmap, M_80211_POWER);
97 free(vap->iv_tim_bitmap, M_80211_POWER);
98 vap->iv_tim_bitmap = NULL;
99 }
100}
101
102void
103ieee80211_psq_init(struct ieee80211_psq *psq, const char *name)
104{
105 memset(psq, 0, sizeof(psq));

--- 422 unchanged lines hidden ---
98 vap->iv_tim_bitmap = NULL;
99 }
100}
101
102void
103ieee80211_psq_init(struct ieee80211_psq *psq, const char *name)
104{
105 memset(psq, 0, sizeof(psq));

--- 422 unchanged lines hidden ---