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