Deleted Added
full compact
if_var.h (203052) if_var.h (203834)
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. 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

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

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * From: @(#)if.h 8.1 (Berkeley) 6/10/93
1/*-
2 * Copyright (c) 1982, 1986, 1989, 1993
3 * The Regents of the University of California. 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

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

22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 *
29 * From: @(#)if.h 8.1 (Berkeley) 6/10/93
30 * $FreeBSD: head/sys/net/if_var.h 203052 2010-01-27 00:30:07Z delphij $
30 * $FreeBSD: head/sys/net/if_var.h 203834 2010-02-13 16:04:58Z mlaier $
31 */
32
33#ifndef _NET_IF_VAR_H_
34#define _NET_IF_VAR_H_
35
36/*
37 * Structures defining a network interface, providing a packet
38 * transport mechanism (ala level 0 of the PUP protocols).

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

598}
599
600static __inline void
601drbr_flush(struct ifnet *ifp, struct buf_ring *br)
602{
603 struct mbuf *m;
604
605#ifdef ALTQ
31 */
32
33#ifndef _NET_IF_VAR_H_
34#define _NET_IF_VAR_H_
35
36/*
37 * Structures defining a network interface, providing a packet
38 * transport mechanism (ala level 0 of the PUP protocols).

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

598}
599
600static __inline void
601drbr_flush(struct ifnet *ifp, struct buf_ring *br)
602{
603 struct mbuf *m;
604
605#ifdef ALTQ
606 if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd)) {
607 while (!IFQ_IS_EMPTY(&ifp->if_snd)) {
608 IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
609 m_freem(m);
610 }
611 }
606 if (ifp != NULL && ALTQ_IS_ENABLED(&ifp->if_snd))
607 IFQ_PURGE(&ifp->if_snd);
612#endif
613 while ((m = buf_ring_dequeue_sc(br)) != NULL)
614 m_freem(m);
615}
616
617static __inline void
618drbr_free(struct buf_ring *br, struct malloc_type *type)
619{

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

624
625static __inline struct mbuf *
626drbr_dequeue(struct ifnet *ifp, struct buf_ring *br)
627{
628#ifdef ALTQ
629 struct mbuf *m;
630
631 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
608#endif
609 while ((m = buf_ring_dequeue_sc(br)) != NULL)
610 m_freem(m);
611}
612
613static __inline void
614drbr_free(struct buf_ring *br, struct malloc_type *type)
615{

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

620
621static __inline struct mbuf *
622drbr_dequeue(struct ifnet *ifp, struct buf_ring *br)
623{
624#ifdef ALTQ
625 struct mbuf *m;
626
627 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
632 IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
628 IFQ_DEQUEUE(&ifp->if_snd, m);
633 return (m);
634 }
635#endif
636 return (buf_ring_dequeue_sc(br));
637}
638
639static __inline struct mbuf *
640drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br,
641 int (*func) (struct mbuf *, void *), void *arg)
642{
643 struct mbuf *m;
644#ifdef ALTQ
629 return (m);
630 }
631#endif
632 return (buf_ring_dequeue_sc(br));
633}
634
635static __inline struct mbuf *
636drbr_dequeue_cond(struct ifnet *ifp, struct buf_ring *br,
637 int (*func) (struct mbuf *, void *), void *arg)
638{
639 struct mbuf *m;
640#ifdef ALTQ
645 /*
646 * XXX need to evaluate / requeue
647 */
648 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
649 IFQ_DRV_DEQUEUE(&ifp->if_snd, m);
641 if (ALTQ_IS_ENABLED(&ifp->if_snd)) {
642 IFQ_LOCK(&ifp->if_snd);
643 IFQ_POLL_NOLOCK(&ifp->if_snd, m);
644 if (m != NULL && func(m, arg) == 0) {
645 IFQ_UNLOCK(&ifp->if_snd);
646 return (NULL);
647 }
648 IFQ_DEQUEUE(&ifp->if_snd, m);
649 IFQ_UNLOCK(&ifp->if_snd);
650 return (m);
651 }
652#endif
653 m = buf_ring_peek(br);
654 if (m == NULL || func(m, arg) == 0)
655 return (NULL);
656
657 return (buf_ring_dequeue_sc(br));
658}
659
660static __inline int
661drbr_empty(struct ifnet *ifp, struct buf_ring *br)
662{
663#ifdef ALTQ
664 if (ALTQ_IS_ENABLED(&ifp->if_snd))
650 return (m);
651 }
652#endif
653 m = buf_ring_peek(br);
654 if (m == NULL || func(m, arg) == 0)
655 return (NULL);
656
657 return (buf_ring_dequeue_sc(br));
658}
659
660static __inline int
661drbr_empty(struct ifnet *ifp, struct buf_ring *br)
662{
663#ifdef ALTQ
664 if (ALTQ_IS_ENABLED(&ifp->if_snd))
665 return (IFQ_DRV_IS_EMPTY(&ifp->if_snd));
665 return (IFQ_IS_EMPTY(&ifp->if_snd));
666#endif
667 return (buf_ring_empty(br));
668}
669
670static __inline int
666#endif
667 return (buf_ring_empty(br));
668}
669
670static __inline int
671drbr_needs_enqueue(struct ifnet *ifp, struct buf_ring *br)
672{
673#ifdef ALTQ
674 if (ALTQ_IS_ENABLED(&ifp->if_snd))
675 return (1);
676#endif
677 return (!buf_ring_empty(br));
678}
679
680static __inline int
671drbr_inuse(struct ifnet *ifp, struct buf_ring *br)
672{
673#ifdef ALTQ
674 if (ALTQ_IS_ENABLED(&ifp->if_snd))
675 return (ifp->if_snd.ifq_len);
676#endif
677 return (buf_ring_count(br));
678}

--- 214 unchanged lines hidden ---
681drbr_inuse(struct ifnet *ifp, struct buf_ring *br)
682{
683#ifdef ALTQ
684 if (ALTQ_IS_ENABLED(&ifp->if_snd))
685 return (ifp->if_snd.ifq_len);
686#endif
687 return (buf_ring_count(br));
688}

--- 214 unchanged lines hidden ---