Deleted Added
full compact
ieee80211_input.c (148302) ieee80211_input.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_input.c 148302 2005-07-22 17:36:12Z sam $");
34__FBSDID("$FreeBSD: head/sys/net80211/ieee80211_input.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/endian.h>
41#include <sys/kernel.h>
42

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

2627 ether_sprintf(ni->ni_macaddr), ic->ic_ps_sta);
2628 /* XXX if no stations in ps mode, flush mc frames */
2629
2630 /*
2631 * Flush queued unicast frames.
2632 */
2633 if (IEEE80211_NODE_SAVEQ_QLEN(ni) == 0) {
2634 if (ic->ic_set_tim != NULL)
35
36#include <sys/param.h>
37#include <sys/systm.h>
38#include <sys/mbuf.h>
39#include <sys/malloc.h>
40#include <sys/endian.h>
41#include <sys/kernel.h>
42

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

2627 ether_sprintf(ni->ni_macaddr), ic->ic_ps_sta);
2628 /* XXX if no stations in ps mode, flush mc frames */
2629
2630 /*
2631 * Flush queued unicast frames.
2632 */
2633 if (IEEE80211_NODE_SAVEQ_QLEN(ni) == 0) {
2634 if (ic->ic_set_tim != NULL)
2635 ic->ic_set_tim(ic, ni, 0); /* just in case */
2635 ic->ic_set_tim(ni, 0); /* just in case */
2636 return;
2637 }
2638 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2639 "[%s] flush ps queue, %u packets queued\n",
2640 ether_sprintf(ni->ni_macaddr), IEEE80211_NODE_SAVEQ_QLEN(ni));
2641 for (;;) {
2642 int qlen;
2643

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

2652 */
2653 if (qlen != 0)
2654 m->m_flags |= M_MORE_DATA;
2655 /* XXX need different driver interface */
2656 /* XXX bypasses q max */
2657 IF_ENQUEUE(&ic->ic_ifp->if_snd, m);
2658 }
2659 if (ic->ic_set_tim != NULL)
2636 return;
2637 }
2638 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2639 "[%s] flush ps queue, %u packets queued\n",
2640 ether_sprintf(ni->ni_macaddr), IEEE80211_NODE_SAVEQ_QLEN(ni));
2641 for (;;) {
2642 int qlen;
2643

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

2652 */
2653 if (qlen != 0)
2654 m->m_flags |= M_MORE_DATA;
2655 /* XXX need different driver interface */
2656 /* XXX bypasses q max */
2657 IF_ENQUEUE(&ic->ic_ifp->if_snd, m);
2658 }
2659 if (ic->ic_set_tim != NULL)
2660 ic->ic_set_tim(ic, ni, 0);
2660 ic->ic_set_tim(ni, 0);
2661}
2662
2663/*
2664 * Process a received ps-poll frame.
2665 */
2666static void
2667ieee80211_recv_pspoll(struct ieee80211com *ic,
2668 struct ieee80211_node *ni, struct mbuf *m0)

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

2699 IEEE80211_NODE_SAVEQ_DEQUEUE(ni, m, qlen);
2700 if (m == NULL) {
2701 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2702 "[%s] recv ps-poll, but queue empty\n",
2703 ether_sprintf(wh->i_addr2));
2704 ieee80211_send_nulldata(ni);
2705 ic->ic_stats.is_ps_qempty++; /* XXX node stat */
2706 if (ic->ic_set_tim != NULL)
2661}
2662
2663/*
2664 * Process a received ps-poll frame.
2665 */
2666static void
2667ieee80211_recv_pspoll(struct ieee80211com *ic,
2668 struct ieee80211_node *ni, struct mbuf *m0)

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

2699 IEEE80211_NODE_SAVEQ_DEQUEUE(ni, m, qlen);
2700 if (m == NULL) {
2701 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2702 "[%s] recv ps-poll, but queue empty\n",
2703 ether_sprintf(wh->i_addr2));
2704 ieee80211_send_nulldata(ni);
2705 ic->ic_stats.is_ps_qempty++; /* XXX node stat */
2706 if (ic->ic_set_tim != NULL)
2707 ic->ic_set_tim(ic, ni, 0); /* just in case */
2707 ic->ic_set_tim(ni, 0); /* just in case */
2708 return;
2709 }
2710 /*
2711 * If there are more packets, set the more packets bit
2712 * in the packet dispatched to the station; otherwise
2713 * turn off the TIM bit.
2714 */
2715 if (qlen != 0) {
2716 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2717 "[%s] recv ps-poll, send packet, %u still queued\n",
2718 ether_sprintf(ni->ni_macaddr), qlen);
2719 m->m_flags |= M_MORE_DATA;
2720 } else {
2721 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2722 "[%s] recv ps-poll, send packet, queue empty\n",
2723 ether_sprintf(ni->ni_macaddr));
2724 if (ic->ic_set_tim != NULL)
2708 return;
2709 }
2710 /*
2711 * If there are more packets, set the more packets bit
2712 * in the packet dispatched to the station; otherwise
2713 * turn off the TIM bit.
2714 */
2715 if (qlen != 0) {
2716 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2717 "[%s] recv ps-poll, send packet, %u still queued\n",
2718 ether_sprintf(ni->ni_macaddr), qlen);
2719 m->m_flags |= M_MORE_DATA;
2720 } else {
2721 IEEE80211_DPRINTF(ic, IEEE80211_MSG_POWER,
2722 "[%s] recv ps-poll, send packet, queue empty\n",
2723 ether_sprintf(ni->ni_macaddr));
2724 if (ic->ic_set_tim != NULL)
2725 ic->ic_set_tim(ic, ni, 0);
2725 ic->ic_set_tim(ni, 0);
2726 }
2727 m->m_flags |= M_PWR_SAV; /* bypass PS handling */
2728 IF_ENQUEUE(&ic->ic_ifp->if_snd, m);
2729}
2730
2731#ifdef IEEE80211_DEBUG
2732/*
2733 * Debugging support.

--- 115 unchanged lines hidden ---
2726 }
2727 m->m_flags |= M_PWR_SAV; /* bypass PS handling */
2728 IF_ENQUEUE(&ic->ic_ifp->if_snd, m);
2729}
2730
2731#ifdef IEEE80211_DEBUG
2732/*
2733 * Debugging support.

--- 115 unchanged lines hidden ---