2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
4 * Copyright (c) 2019 Lutz Donnerhacke <lutz@donnerhacke.de>
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
15 * THIS SOFTWARE IS PROVIDED BY AUTHOR AND CONTRIBUTORS ``AS IS'' AND
16 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
18 * ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
21 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
23 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
24 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
30 #ifndef _NETGRAPH_QOS_H_
31 #define _NETGRAPH_QOS_H_
36 #define M_QOS_COOKIE 1571268051
37 #define MTAG_SIZE(X) ( sizeof(struct X) - sizeof(struct m_tag) )
40 * Definition of types within this ABI:
41 * - Choose a type (16bit) by i.e. "echo $((1000+$(date +%s)%64536))"
42 * - Retry if the type is already in use
43 * - Define the structure for the type according to mbuf_tags(9)
49 * struct m_qos_foo *p = (void *)m_tag_locate(m,
50 * M_QOS_COOKIE, M_QOS_FOO, ...);
52 * p = (void *)m_tag_alloc(
53 * M_QOS_COOKIE, M_QOS_FOO, MTAG_SIZE(foo), ...);
54 m_tag_prepend(m, &p->tag);
57 /* Color marking type */
58 #define M_QOS_COLOR 23568
59 /* Keep colors ordered semantically in order to allow use of "<=" or ">=" */
73 * Processing per priority requires an overhead, which should
74 * be static (i.e. for alloctating queues) and small (for memory)
75 * So keep your chosen range limited.
77 #define M_QOS_PRIORITY 28858
78 struct m_qos_priority {
80 uint8_t priority; /* 0 - lowest */
83 #endif /* _NETGRAPH_QOS_H_ */