1 /* SPDX-License-Identifier: GPL-2.0 */ 2 /* Copyright (c) 2024 Pengutronix, Oleksij Rempel <kernel@pengutronix.de> */ 3 4 #ifndef _NET_IEEE8021Q_H 5 #define _NET_IEEE8021Q_H 6 7 #include <linux/errno.h> 8 9 /** 10 * enum ieee8021q_traffic_type - 802.1Q traffic type priority values (802.1Q-2022) 11 * 12 * @IEEE8021Q_TT_BK: Background 13 * @IEEE8021Q_TT_BE: Best Effort (default). According to 802.1Q-2022, BE is 0 14 * but has higher priority than BK which is 1. 15 * @IEEE8021Q_TT_EE: Excellent Effort 16 * @IEEE8021Q_TT_CA: Critical Applications 17 * @IEEE8021Q_TT_VI: Video, < 100 ms latency and jitter 18 * @IEEE8021Q_TT_VO: Voice, < 10 ms latency and jitter 19 * @IEEE8021Q_TT_IC: Internetwork Control 20 * @IEEE8021Q_TT_NC: Network Control 21 */ 22 enum ieee8021q_traffic_type { 23 IEEE8021Q_TT_BK = 0, 24 IEEE8021Q_TT_BE = 1, 25 IEEE8021Q_TT_EE = 2, 26 IEEE8021Q_TT_CA = 3, 27 IEEE8021Q_TT_VI = 4, 28 IEEE8021Q_TT_VO = 5, 29 IEEE8021Q_TT_IC = 6, 30 IEEE8021Q_TT_NC = 7, 31 32 /* private: */ 33 IEEE8021Q_TT_MAX, 34 }; 35 36 #define SIMPLE_IETF_DSCP_TO_IEEE8021Q_TT(dscp) ((dscp >> 3) & 0x7) 37 38 #if IS_ENABLED(CONFIG_NET_IEEE8021Q_HELPERS) 39 40 int ietf_dscp_to_ieee8021q_tt(u8 dscp); 41 int ieee8021q_tt_to_tc(enum ieee8021q_traffic_type tt, unsigned int num_queues); 42 43 #else 44 45 static inline int ietf_dscp_to_ieee8021q_tt(u8 dscp) 46 { 47 return -EOPNOTSUPP; 48 } 49 50 static inline int ieee8021q_tt_to_tc(enum ieee8021q_traffic_type tt, 51 unsigned int num_queues) 52 { 53 return -EOPNOTSUPP; 54 } 55 56 #endif 57 #endif /* _NET_IEEE8021Q_H */ 58