aboutsummaryrefslogtreecommitdiff
path: root/include/net/ieee8021q.h
blob: 8bfe903dd3d00fb432b32e3150d77f3a43d00f0c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* SPDX-License-Identifier: GPL-2.0 */
/* Copyright (c) 2024 Pengutronix, Oleksij Rempel <kernel@pengutronix.de> */

#ifndef _NET_IEEE8021Q_H
#define _NET_IEEE8021Q_H

#include <linux/errno.h>

/**
 * enum ieee8021q_traffic_type - 802.1Q traffic type priority values (802.1Q-2022)
 *
 * @IEEE8021Q_TT_BK: Background
 * @IEEE8021Q_TT_BE: Best Effort (default). According to 802.1Q-2022, BE is 0
 * but has higher priority than BK which is 1.
 * @IEEE8021Q_TT_EE: Excellent Effort
 * @IEEE8021Q_TT_CA: Critical Applications
 * @IEEE8021Q_TT_VI: Video, < 100 ms latency and jitter
 * @IEEE8021Q_TT_VO: Voice, < 10 ms latency and jitter
 * @IEEE8021Q_TT_IC: Internetwork Control
 * @IEEE8021Q_TT_NC: Network Control
 */
enum ieee8021q_traffic_type {
	IEEE8021Q_TT_BK = 0,
	IEEE8021Q_TT_BE = 1,
	IEEE8021Q_TT_EE = 2,
	IEEE8021Q_TT_CA = 3,
	IEEE8021Q_TT_VI = 4,
	IEEE8021Q_TT_VO = 5,
	IEEE8021Q_TT_IC = 6,
	IEEE8021Q_TT_NC = 7,

	/* private: */
	IEEE8021Q_TT_MAX,
};

#define SIMPLE_IETF_DSCP_TO_IEEE8021Q_TT(dscp)		((dscp >> 3) & 0x7)

#if IS_ENABLED(CONFIG_NET_IEEE8021Q_HELPERS)

int ietf_dscp_to_ieee8021q_tt(u8 dscp);
int ieee8021q_tt_to_tc(enum ieee8021q_traffic_type tt, unsigned int num_queues);

#else

static inline int ietf_dscp_to_ieee8021q_tt(u8 dscp)
{
	return -EOPNOTSUPP;
}

static inline int ieee8021q_tt_to_tc(enum ieee8021q_traffic_type tt,
				     unsigned int num_queues)
{
	return -EOPNOTSUPP;
}

#endif
#endif /* _NET_IEEE8021Q_H */