Deleted Added
full compact
altq_classq.h (281642) altq_classq.h (287009)
1/*-
2 * Copyright (c) 1991-1997 Regents of the University of California.
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

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $
1/*-
2 * Copyright (c) 1991-1997 Regents of the University of California.
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

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

26 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31 * SUCH DAMAGE.
32 *
33 * $KAME: altq_classq.h,v 1.6 2003/01/07 07:33:38 kjc Exp $
34 * $FreeBSD: head/sys/net/altq/altq_classq.h 281642 2015-04-17 06:38:31Z glebius $
34 * $FreeBSD: head/sys/net/altq/altq_classq.h 287009 2015-08-21 22:02:22Z loos $
35 */
36/*
37 * class queue definitions extracted from rm_class.h.
38 */
39#ifndef _ALTQ_ALTQ_CLASSQ_H_
40#define _ALTQ_ALTQ_CLASSQ_H_
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 * Packet Queue types: RED or DROPHEAD.
48 */
49#define Q_DROPHEAD 0x00
50#define Q_RED 0x01
51#define Q_RIO 0x02
52#define Q_DROPTAIL 0x03
35 */
36/*
37 * class queue definitions extracted from rm_class.h.
38 */
39#ifndef _ALTQ_ALTQ_CLASSQ_H_
40#define _ALTQ_ALTQ_CLASSQ_H_
41
42#ifdef __cplusplus
43extern "C" {
44#endif
45
46/*
47 * Packet Queue types: RED or DROPHEAD.
48 */
49#define Q_DROPHEAD 0x00
50#define Q_RED 0x01
51#define Q_RIO 0x02
52#define Q_DROPTAIL 0x03
53#define Q_CODEL 0x04
53
54#ifdef _KERNEL
55
56/*
57 * Packet Queue structures and macros to manipulate them.
58 */
59struct _class_queue_ {
60 struct mbuf *tail_; /* Tail of packet queue */
61 int qlen_; /* Queue length (in number of packets) */
62 int qlim_; /* Queue limit (in number of packets*) */
54
55#ifdef _KERNEL
56
57/*
58 * Packet Queue structures and macros to manipulate them.
59 */
60struct _class_queue_ {
61 struct mbuf *tail_; /* Tail of packet queue */
62 int qlen_; /* Queue length (in number of packets) */
63 int qlim_; /* Queue limit (in number of packets*) */
64 int qsize_; /* Queue size (in number of bytes*) */
63 int qtype_; /* Queue type */
64};
65
66typedef struct _class_queue_ class_queue_t;
67
68#define qtype(q) (q)->qtype_ /* Get queue type */
69#define qlimit(q) (q)->qlim_ /* Max packets to be queued */
70#define qlen(q) (q)->qlen_ /* Current queue length. */
65 int qtype_; /* Queue type */
66};
67
68typedef struct _class_queue_ class_queue_t;
69
70#define qtype(q) (q)->qtype_ /* Get queue type */
71#define qlimit(q) (q)->qlim_ /* Max packets to be queued */
72#define qlen(q) (q)->qlen_ /* Current queue length. */
73#define qsize(q) (q)->qsize_ /* Current queue size. */
71#define qtail(q) (q)->tail_ /* Tail of the queue */
72#define qhead(q) ((q)->tail_ ? (q)->tail_->m_nextpkt : NULL)
73
74#define qempty(q) ((q)->qlen_ == 0) /* Is the queue empty?? */
74#define qtail(q) (q)->tail_ /* Tail of the queue */
75#define qhead(q) ((q)->tail_ ? (q)->tail_->m_nextpkt : NULL)
76
77#define qempty(q) ((q)->qlen_ == 0) /* Is the queue empty?? */
78#define q_is_codel(q) ((q)->qtype_ == Q_CODEL) /* Is the queue a codel queue */
75#define q_is_red(q) ((q)->qtype_ == Q_RED) /* Is the queue a red queue */
76#define q_is_rio(q) ((q)->qtype_ == Q_RIO) /* Is the queue a rio queue */
77#define q_is_red_or_rio(q) ((q)->qtype_ == Q_RED || (q)->qtype_ == Q_RIO)
78
79#if !defined(__GNUC__) || defined(ALTQ_DEBUG)
80
81extern void _addq(class_queue_t *, struct mbuf *);
82extern struct mbuf *_getq(class_queue_t *);

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

96
97 if ((m0 = qtail(q)) != NULL)
98 m->m_nextpkt = m0->m_nextpkt;
99 else
100 m0 = m;
101 m0->m_nextpkt = m;
102 qtail(q) = m;
103 qlen(q)++;
79#define q_is_red(q) ((q)->qtype_ == Q_RED) /* Is the queue a red queue */
80#define q_is_rio(q) ((q)->qtype_ == Q_RIO) /* Is the queue a rio queue */
81#define q_is_red_or_rio(q) ((q)->qtype_ == Q_RED || (q)->qtype_ == Q_RIO)
82
83#if !defined(__GNUC__) || defined(ALTQ_DEBUG)
84
85extern void _addq(class_queue_t *, struct mbuf *);
86extern struct mbuf *_getq(class_queue_t *);

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

100
101 if ((m0 = qtail(q)) != NULL)
102 m->m_nextpkt = m0->m_nextpkt;
103 else
104 m0 = m;
105 m0->m_nextpkt = m;
106 qtail(q) = m;
107 qlen(q)++;
108 qsize(q) += m_pktlen(m);
104}
105
106static __inline struct mbuf *
107_getq(class_queue_t *q)
108{
109 struct mbuf *m, *m0;
110
111 if ((m = qtail(q)) == NULL)
112 return (NULL);
113 if ((m0 = m->m_nextpkt) != m)
114 m->m_nextpkt = m0->m_nextpkt;
115 else
116 qtail(q) = NULL;
117 qlen(q)--;
109}
110
111static __inline struct mbuf *
112_getq(class_queue_t *q)
113{
114 struct mbuf *m, *m0;
115
116 if ((m = qtail(q)) == NULL)
117 return (NULL);
118 if ((m0 = m->m_nextpkt) != m)
119 m->m_nextpkt = m0->m_nextpkt;
120 else
121 qtail(q) = NULL;
122 qlen(q)--;
123 qsize(q) -= m_pktlen(m0);
118 m0->m_nextpkt = NULL;
119 return (m0);
120}
121
122/* drop a packet at the tail of the queue */
123static __inline struct mbuf *
124_getq_tail(class_queue_t *q)
125{

--- 82 unchanged lines hidden ---
124 m0->m_nextpkt = NULL;
125 return (m0);
126}
127
128/* drop a packet at the tail of the queue */
129static __inline struct mbuf *
130_getq_tail(class_queue_t *q)
131{

--- 82 unchanged lines hidden ---