]>
git.saurik.com Git - apple/xnu.git/blob - bsd/net/pktsched/pktsched_fairq.h
2 * Copyright (c) 2011-2016 Apple Inc. All rights reserved.
4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. The rights granted to you under the License
10 * may not be used to create, or enable the creation or redistribution of,
11 * unlawful or unlicensed copies of an Apple operating system, or to
12 * circumvent, violate, or enable the circumvention or violation of, any
13 * terms of an Apple operating system software license agreement.
15 * Please obtain a copy of the License at
16 * http://www.opensource.apple.com/apsl/ and read it before using this file.
18 * The Original Code and all software distributed under the License are
19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
23 * Please see the License for the specific language governing rights and
24 * limitations under the License.
26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@
30 * Copyright (c) 2008 The DragonFly Project. All rights reserved.
32 * This code is derived from software contributed to The DragonFly Project
33 * by Matthew Dillon <dillon@backplane.com>
35 * Redistribution and use in source and binary forms, with or without
36 * modification, are permitted provided that the following conditions
39 * 1. Redistributions of source code must retain the above copyright
40 * notice, this list of conditions and the following disclaimer.
41 * 2. Redistributions in binary form must reproduce the above copyright
42 * notice, this list of conditions and the following disclaimer in
43 * the documentation and/or other materials provided with the
45 * 3. Neither the name of The DragonFly Project nor the names of its
46 * contributors may be used to endorse or promote products derived
47 * from this software without specific, prior written permission.
49 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
50 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
51 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
52 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
53 * COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
54 * INCIDENTAL, SPECIAL, EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING,
55 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
56 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
57 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
58 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
59 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
62 * $DragonFly: src/sys/net/altq/altq_fairq.h,v 1.1 2008/04/06 18:58:15 dillon Exp $
65 #ifndef _NET_PKTSCHED_PKTSCHED_FAIRQ_H_
66 #define _NET_PKTSCHED_PKTSCHED_FAIRQ_H_
69 #include <net/pktsched/pktsched.h>
70 #include <net/pktsched/pktsched_rmclass.h>
71 #include <net/classq/classq.h>
72 #include <net/classq/classq_red.h>
73 #include <net/classq/classq_rio.h>
74 #include <net/classq/classq_blue.h>
75 #include <net/classq/classq_sfb.h>
81 #define FAIRQ_MAX_BUCKETS 2048 /* maximum number of sorting buckets */
82 #define FAIRQ_MAXPRI RM_MAXPRIO
83 #define FAIRQ_BITMAP_WIDTH (sizeof (fairq_bitmap_t) * 8)
84 #define FAIRQ_BITMAP_MASK (FAIRQ_BITMAP_WIDTH - 1)
86 /* fairq class flags */
87 #define FARF_RED 0x0001 /* use RED */
88 #define FARF_ECN 0x0002 /* use ECN with RED/BLUE/SFB */
89 #define FARF_RIO 0x0004 /* use RIO */
90 #define FARF_CLEARDSCP 0x0010 /* clear diffserv codepoint */
91 #define FARF_BLUE 0x0100 /* use BLUE */
92 #define FARF_SFB 0x0200 /* use SFB */
93 #define FARF_FLOWCTL 0x0400 /* enable flow control advisories */
94 #define FARF_DEFAULTCLASS 0x1000 /* default class */
95 #ifdef BSD_KERNEL_PRIVATE
96 #define FARF_HAS_PACKETS 0x2000 /* might have queued packets */
97 #define FARF_LAZY 0x10000000 /* on-demand resource allocation */
98 #endif /* BSD_KERNEL_PRIVATE */
100 #define FARF_USERFLAGS \
101 (FARF_RED | FARF_ECN | FARF_RIO | FARF_CLEARDSCP | \
102 FARF_BLUE | FARF_SFB | FARF_FLOWCTL | FARF_DEFAULTCLASS)
104 #ifdef BSD_KERNEL_PRIVATE
106 "\020\1RED\2ECN\3RIO\5CLEARDSCP\11BLUE\12SFB\13FLOWCTL\15DEFAULT" \
110 "\020\1RED\2ECN\3RIO\5CLEARDSCP\11BLUE\12SFB\13FLOWCTL\15DEFAULT" \
112 #endif /* !BSD_KERNEL_PRIVATE */
114 typedef u_int32_t fairq_bitmap_t
;
116 struct fairq_classstats
{
117 u_int32_t class_handle
;
122 struct pktcntr xmit_cnt
; /* transmitted packet counter */
123 struct pktcntr drop_cnt
; /* dropped packet counter */
125 /* RED, RIO, BLUE, SFB related info */
128 /* RIO has 3 red stats */
129 struct red_stats red
[RIO_NDROPPREC
];
130 struct blue_stats blue
;
131 struct sfb_stats sfb
;
133 classq_state_t qstate
;
140 #endif /* _NET_PKTSCHED_PKTSCHED_FAIRQ_H_ */