Deleted Added
full compact
ieee80211.c (194760) ieee80211.c (195379)
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2009 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:

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2001 Atsushi Onoe
3 * Copyright (c) 2002-2009 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:

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

20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#include <sys/cdefs.h>
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 194760 2009-06-23 20:19:09Z rwatson $");
28__FBSDID("$FreeBSD: head/sys/net80211/ieee80211.c 195379 2009-07-05 18:17:37Z sam $");
29
30/*
31 * IEEE 802.11 generic handler
32 */
33#include "opt_wlan.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

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

263 * available channels as active, and pick a default
264 * channel if not already specified.
265 */
266 ieee80211_media_init(ic);
267
268 ic->ic_update_mcast = null_update_mcast;
269 ic->ic_update_promisc = null_update_promisc;
270
29
30/*
31 * IEEE 802.11 generic handler
32 */
33#include "opt_wlan.h"
34
35#include <sys/param.h>
36#include <sys/systm.h>

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

263 * available channels as active, and pick a default
264 * channel if not already specified.
265 */
266 ieee80211_media_init(ic);
267
268 ic->ic_update_mcast = null_update_mcast;
269 ic->ic_update_promisc = null_update_promisc;
270
271 ic->ic_hash_key = arc4random();
271 ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT;
272 ic->ic_lintval = ic->ic_bintval;
273 ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
274
275 ieee80211_crypto_attach(ic);
276 ieee80211_node_attach(ic);
277 ieee80211_power_attach(ic);
278 ieee80211_proto_attach(ic);

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

1563 9, /* IFM_IEEE80211_OFDM4 */
1564 54, /* IFM_IEEE80211_OFDM27 */
1565 -1, /* IFM_IEEE80211_MCS */
1566 };
1567 return IFM_SUBTYPE(mword) < N(ieeerates) ?
1568 ieeerates[IFM_SUBTYPE(mword)] : 0;
1569#undef N
1570}
272 ic->ic_bintval = IEEE80211_BINTVAL_DEFAULT;
273 ic->ic_lintval = ic->ic_bintval;
274 ic->ic_txpowlimit = IEEE80211_TXPOWER_MAX;
275
276 ieee80211_crypto_attach(ic);
277 ieee80211_node_attach(ic);
278 ieee80211_power_attach(ic);
279 ieee80211_proto_attach(ic);

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

1564 9, /* IFM_IEEE80211_OFDM4 */
1565 54, /* IFM_IEEE80211_OFDM27 */
1566 -1, /* IFM_IEEE80211_MCS */
1567 };
1568 return IFM_SUBTYPE(mword) < N(ieeerates) ?
1569 ieeerates[IFM_SUBTYPE(mword)] : 0;
1570#undef N
1571}
1572
1573/*
1574 * The following hash function is adapted from "Hash Functions" by Bob Jenkins
1575 * ("Algorithm Alley", Dr. Dobbs Journal, September 1997).
1576 */
1577#define mix(a, b, c) \
1578do { \
1579 a -= b; a -= c; a ^= (c >> 13); \
1580 b -= c; b -= a; b ^= (a << 8); \
1581 c -= a; c -= b; c ^= (b >> 13); \
1582 a -= b; a -= c; a ^= (c >> 12); \
1583 b -= c; b -= a; b ^= (a << 16); \
1584 c -= a; c -= b; c ^= (b >> 5); \
1585 a -= b; a -= c; a ^= (c >> 3); \
1586 b -= c; b -= a; b ^= (a << 10); \
1587 c -= a; c -= b; c ^= (b >> 15); \
1588} while (/*CONSTCOND*/0)
1589
1590uint32_t
1591ieee80211_mac_hash(const struct ieee80211com *ic,
1592 const uint8_t addr[IEEE80211_ADDR_LEN])
1593{
1594 uint32_t a = 0x9e3779b9, b = 0x9e3779b9, c = ic->ic_hash_key;
1595
1596 b += addr[5] << 8;
1597 b += addr[4];
1598 a += addr[3] << 24;
1599 a += addr[2] << 16;
1600 a += addr[1] << 8;
1601 a += addr[0];
1602
1603 mix(a, b, c);
1604
1605 return c;
1606}
1607#undef mix