Deleted Added
full compact
ieee80211_freebsd.c (193541) ieee80211_freebsd.c (195757)
1/*-
2 * Copyright (c) 2003-2009 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) 2003-2009 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_freebsd.c 193541 2009-06-05 23:10:30Z sam $");
27__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_freebsd.c 195757 2009-07-18 20:19:53Z sam $");
28
29/*
30 * IEEE 802.11 support (FreeBSD-specific code)
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/kernel.h>

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

48#include <net/if_dl.h>
49#include <net/if_clone.h>
50#include <net/if_media.h>
51#include <net/if_types.h>
52#include <net/ethernet.h>
53#include <net/route.h>
54
55#include <net80211/ieee80211_var.h>
28
29/*
30 * IEEE 802.11 support (FreeBSD-specific code)
31 */
32#include "opt_wlan.h"
33
34#include <sys/param.h>
35#include <sys/kernel.h>

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

48#include <net/if_dl.h>
49#include <net/if_clone.h>
50#include <net/if_media.h>
51#include <net/if_types.h>
52#include <net/ethernet.h>
53#include <net/route.h>
54
55#include <net80211/ieee80211_var.h>
56#include <net80211/ieee80211_input.h>
56
57SYSCTL_NODE(_net, OID_AUTO, wlan, CTLFLAG_RD, 0, "IEEE 80211 parameters");
58
59#ifdef IEEE80211_DEBUG
60int ieee80211_debug = 0;
61SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, &ieee80211_debug,
62 0, "debugging printfs");
63#endif

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

403 }
404 if (m != NULL) {
405 m->m_data += headroom;
406 *frm = m->m_data;
407 }
408 return m;
409}
410
57
58SYSCTL_NODE(_net, OID_AUTO, wlan, CTLFLAG_RD, 0, "IEEE 80211 parameters");
59
60#ifdef IEEE80211_DEBUG
61int ieee80211_debug = 0;
62SYSCTL_INT(_net_wlan, OID_AUTO, debug, CTLFLAG_RW, &ieee80211_debug,
63 0, "debugging printfs");
64#endif

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

404 }
405 if (m != NULL) {
406 m->m_data += headroom;
407 *frm = m->m_data;
408 }
409 return m;
410}
411
412/*
413 * Re-align the payload in the mbuf. This is mainly used (right now)
414 * to handle IP header alignment requirements on certain architectures.
415 */
416struct mbuf *
417ieee80211_realign(struct ieee80211vap *vap, struct mbuf *m, size_t align)
418{
419 int pktlen, space;
420 struct mbuf *n;
421
422 pktlen = m->m_pkthdr.len;
423 space = pktlen + align;
424 if (space < MINCLSIZE)
425 n = m_gethdr(M_DONTWAIT, MT_DATA);
426 else {
427 n = m_getjcl(M_DONTWAIT, MT_DATA, M_PKTHDR,
428 space <= MCLBYTES ? MCLBYTES :
429#if MJUMPAGESIZE != MCLBYTES
430 space <= MJUMPAGESIZE ? MJUMPAGESIZE :
431#endif
432 space <= MJUM9BYTES ? MJUM9BYTES : MJUM16BYTES);
433 }
434 if (__predict_true(n != NULL)) {
435 m_move_pkthdr(n, m);
436 n->m_data = (caddr_t)(ALIGN(n->m_data + align) - align);
437 m_copydata(m, 0, pktlen, mtod(n, caddr_t));
438 n->m_len = pktlen;
439 } else {
440 IEEE80211_DISCARD(vap, IEEE80211_MSG_ANY,
441 mtod(m, const struct ieee80211_frame *), NULL,
442 "%s", "no mbuf to realign");
443 vap->iv_stats.is_rx_badalign++;
444 }
445 m_freem(m);
446 return n;
447}
448
411int
412ieee80211_add_callback(struct mbuf *m,
413 void (*func)(struct ieee80211_node *, void *, int), void *arg)
414{
415 struct m_tag *mtag;
416 struct ieee80211_cb *cb;
417
418 mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_CALLBACK,

--- 338 unchanged lines hidden ---
449int
450ieee80211_add_callback(struct mbuf *m,
451 void (*func)(struct ieee80211_node *, void *, int), void *arg)
452{
453 struct m_tag *mtag;
454 struct ieee80211_cb *cb;
455
456 mtag = m_tag_alloc(MTAG_ABI_NET80211, NET80211_TAG_CALLBACK,

--- 338 unchanged lines hidden ---