~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/net/inet_dscp.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 /*
  3  * inet_dscp.h: helpers for handling differentiated services codepoints (DSCP)
  4  *
  5  * DSCP is defined in RFC 2474:
  6  *
  7  *        0   1   2   3   4   5   6   7
  8  *      +---+---+---+---+---+---+---+---+
  9  *      |         DSCP          |  CU   |
 10  *      +---+---+---+---+---+---+---+---+
 11  *
 12  *        DSCP: differentiated services codepoint
 13  *        CU:   currently unused
 14  *
 15  * The whole DSCP + CU bits form the DS field.
 16  * The DS field is also commonly called TOS or Traffic Class (for IPv6).
 17  *
 18  * Note: the CU bits are now used for Explicit Congestion Notification
 19  *       (RFC 3168).
 20  */
 21 
 22 #ifndef _INET_DSCP_H
 23 #define _INET_DSCP_H
 24 
 25 #include <linux/types.h>
 26 
 27 /* Special type for storing DSCP values.
 28  *
 29  * A dscp_t variable stores a DS field with the CU (ECN) bits cleared.
 30  * Using dscp_t allows to strictly separate DSCP and ECN bits, thus avoiding
 31  * bugs where ECN bits are erroneously taken into account during FIB lookups
 32  * or policy routing.
 33  *
 34  * Note: to get the real DSCP value contained in a dscp_t variable one would
 35  * have to do a bit shift after calling inet_dscp_to_dsfield(). We could have
 36  * a helper for that, but there's currently no users.
 37  */
 38 typedef u8 __bitwise dscp_t;
 39 
 40 #define INET_DSCP_MASK 0xfc
 41 
 42 static inline dscp_t inet_dsfield_to_dscp(__u8 dsfield)
 43 {
 44         return (__force dscp_t)(dsfield & INET_DSCP_MASK);
 45 }
 46 
 47 static inline __u8 inet_dscp_to_dsfield(dscp_t dscp)
 48 {
 49         return (__force __u8)dscp;
 50 }
 51 
 52 static inline bool inet_validate_dscp(__u8 val)
 53 {
 54         return !(val & ~INET_DSCP_MASK);
 55 }
 56 
 57 #endif /* _INET_DSCP_H */
 58 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php