Deleted Added
full compact
ieee80211_node.c (148302) ieee80211_node.c (148304)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

26 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
30 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 */
32
33#include <sys/cdefs.h>
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_node.c 148302 2005-07-22 17:36:12Z sam $");
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_node.c 148304 2005-07-22 17:45:48Z sam $");
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/mbuf.h>
39#include <sys/malloc.h>
40#include <sys/kernel.h>
41
42#include <sys/socket.h>

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

67static void ieee80211_setup_node(struct ieee80211_node_table *,
68 struct ieee80211_node *, const u_int8_t *);
69static void _ieee80211_free_node(struct ieee80211_node *);
70static void ieee80211_free_allnodes(struct ieee80211_node_table *);
71
72static void ieee80211_timeout_scan_candidates(struct ieee80211_node_table *);
73static void ieee80211_timeout_stations(struct ieee80211_node_table *);
74
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/mbuf.h>
39#include <sys/malloc.h>
40#include <sys/kernel.h>
41
42#include <sys/socket.h>

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

67static void ieee80211_setup_node(struct ieee80211_node_table *,
68 struct ieee80211_node *, const u_int8_t *);
69static void _ieee80211_free_node(struct ieee80211_node *);
70static void ieee80211_free_allnodes(struct ieee80211_node_table *);
71
72static void ieee80211_timeout_scan_candidates(struct ieee80211_node_table *);
73static void ieee80211_timeout_stations(struct ieee80211_node_table *);
74
75static void ieee80211_set_tim(struct ieee80211com *,
76 struct ieee80211_node *, int set);
75static void ieee80211_set_tim(struct ieee80211_node *, int set);
77
78static void ieee80211_node_table_init(struct ieee80211com *ic,
79 struct ieee80211_node_table *nt, const char *name, int inact,
80 void (*timeout)(struct ieee80211_node_table *));
81static void ieee80211_node_table_cleanup(struct ieee80211_node_table *nt);
82
83MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state");
84

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

859 */
860 ni->ni_flags &= ~IEEE80211_NODE_AREF;
861
862 /*
863 * Drain power save queue and, if needed, clear TIM.
864 */
865 IEEE80211_NODE_SAVEQ_DRAIN(ni, qlen);
866 if (qlen != 0 && ic->ic_set_tim != NULL)
76
77static void ieee80211_node_table_init(struct ieee80211com *ic,
78 struct ieee80211_node_table *nt, const char *name, int inact,
79 void (*timeout)(struct ieee80211_node_table *));
80static void ieee80211_node_table_cleanup(struct ieee80211_node_table *nt);
81
82MALLOC_DEFINE(M_80211_NODE, "80211node", "802.11 node state");
83

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

858 */
859 ni->ni_flags &= ~IEEE80211_NODE_AREF;
860
861 /*
862 * Drain power save queue and, if needed, clear TIM.
863 */
864 IEEE80211_NODE_SAVEQ_DRAIN(ni, qlen);
865 if (qlen != 0 && ic->ic_set_tim != NULL)
867 ic->ic_set_tim(ic, ni, 0);
866 ic->ic_set_tim(ni, 0);
868
869 ni->ni_associd = 0;
870 if (ni->ni_challenge != NULL) {
871 FREE(ni->ni_challenge, M_DEVBUF);
872 ni->ni_challenge = NULL;
873 }
874 /*
875 * Preserve SSID, WPA, and WME ie's so the bss node is

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

1459 IEEE80211_DPRINTF(ic,
1460 IEEE80211_MSG_POWER,
1461 "[%s] discard %u frames for age\n",
1462 ether_sprintf(ni->ni_macaddr),
1463 discard);
1464 IEEE80211_NODE_STAT_ADD(ni,
1465 ps_discard, discard);
1466 if (IEEE80211_NODE_SAVEQ_QLEN(ni) == 0)
867
868 ni->ni_associd = 0;
869 if (ni->ni_challenge != NULL) {
870 FREE(ni->ni_challenge, M_DEVBUF);
871 ni->ni_challenge = NULL;
872 }
873 /*
874 * Preserve SSID, WPA, and WME ie's so the bss node is

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

1458 IEEE80211_DPRINTF(ic,
1459 IEEE80211_MSG_POWER,
1460 "[%s] discard %u frames for age\n",
1461 ether_sprintf(ni->ni_macaddr),
1462 discard);
1463 IEEE80211_NODE_STAT_ADD(ni,
1464 ps_discard, discard);
1465 if (IEEE80211_NODE_SAVEQ_QLEN(ni) == 0)
1467 ic->ic_set_tim(ic, ni, 0);
1466 ic->ic_set_tim(ni, 0);
1468 }
1469 }
1470 /*
1471 * Probe the station before time it out. We
1472 * send a null data frame which may not be
1473 * universally supported by drivers (need it
1474 * for ps-poll support so it should be...).
1475 */

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

1855 return rssi_total / NZ(rssi_samples);
1856#undef NZ
1857}
1858
1859/*
1860 * Indicate whether there are frames queued for a station in power-save mode.
1861 */
1862static void
1467 }
1468 }
1469 /*
1470 * Probe the station before time it out. We
1471 * send a null data frame which may not be
1472 * universally supported by drivers (need it
1473 * for ps-poll support so it should be...).
1474 */

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

1854 return rssi_total / NZ(rssi_samples);
1855#undef NZ
1856}
1857
1858/*
1859 * Indicate whether there are frames queued for a station in power-save mode.
1860 */
1861static void
1863ieee80211_set_tim(struct ieee80211com *ic, struct ieee80211_node *ni, int set)
1862ieee80211_set_tim(struct ieee80211_node *ni, int set)
1864{
1863{
1864 struct ieee80211com *ic = ni->ni_ic;
1865 u_int16_t aid;
1866
1867 KASSERT(ic->ic_opmode == IEEE80211_M_HOSTAP ||
1868 ic->ic_opmode == IEEE80211_M_IBSS,
1869 ("operating mode %u", ic->ic_opmode));
1870
1871 aid = IEEE80211_AID(ni->ni_associd);
1872 KASSERT(aid < ic->ic_max_aid,

--- 65 unchanged lines hidden ---
1865 u_int16_t aid;
1866
1867 KASSERT(ic->ic_opmode == IEEE80211_M_HOSTAP ||
1868 ic->ic_opmode == IEEE80211_M_IBSS,
1869 ("operating mode %u", ic->ic_opmode));
1870
1871 aid = IEEE80211_AID(ni->ni_associd);
1872 KASSERT(aid < ic->ic_max_aid,

--- 65 unchanged lines hidden ---