Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
0002 #ifndef _UAPI_MPLS_H
0003 #define _UAPI_MPLS_H
0004 
0005 #include <linux/types.h>
0006 #include <asm/byteorder.h>
0007 
0008 /* Reference: RFC 5462, RFC 3032
0009  *
0010  *  0                   1                   2                   3
0011  *  0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1
0012  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0013  * |                Label                  | TC  |S|       TTL     |
0014  * +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
0015  *
0016  *  Label:  Label Value, 20 bits
0017  *  TC:     Traffic Class field, 3 bits
0018  *  S:      Bottom of Stack, 1 bit
0019  *  TTL:    Time to Live, 8 bits
0020  */
0021 
0022 struct mpls_label {
0023     __be32 entry;
0024 };
0025 
0026 #define MPLS_LS_LABEL_MASK      0xFFFFF000
0027 #define MPLS_LS_LABEL_SHIFT     12
0028 #define MPLS_LS_TC_MASK         0x00000E00
0029 #define MPLS_LS_TC_SHIFT        9
0030 #define MPLS_LS_S_MASK          0x00000100
0031 #define MPLS_LS_S_SHIFT         8
0032 #define MPLS_LS_TTL_MASK        0x000000FF
0033 #define MPLS_LS_TTL_SHIFT       0
0034 
0035 /* Reserved labels */
0036 #define MPLS_LABEL_IPV4NULL     0 /* RFC3032 */
0037 #define MPLS_LABEL_RTALERT      1 /* RFC3032 */
0038 #define MPLS_LABEL_IPV6NULL     2 /* RFC3032 */
0039 #define MPLS_LABEL_IMPLNULL     3 /* RFC3032 */
0040 #define MPLS_LABEL_ENTROPY      7 /* RFC6790 */
0041 #define MPLS_LABEL_GAL          13 /* RFC5586 */
0042 #define MPLS_LABEL_OAMALERT     14 /* RFC3429 */
0043 #define MPLS_LABEL_EXTENSION        15 /* RFC7274 */
0044 
0045 #define MPLS_LABEL_FIRST_UNRESERVED 16 /* RFC3032 */
0046 
0047 /* These are embedded into IFLA_STATS_AF_SPEC:
0048  * [IFLA_STATS_AF_SPEC]
0049  * -> [AF_MPLS]
0050  *    -> [MPLS_STATS_xxx]
0051  *
0052  * Attributes:
0053  * [MPLS_STATS_LINK] = {
0054  *     struct mpls_link_stats
0055  * }
0056  */
0057 enum {
0058     MPLS_STATS_UNSPEC, /* also used as 64bit pad attribute */
0059     MPLS_STATS_LINK,
0060     __MPLS_STATS_MAX,
0061 };
0062 
0063 #define MPLS_STATS_MAX (__MPLS_STATS_MAX - 1)
0064 
0065 struct mpls_link_stats {
0066     __u64   rx_packets;     /* total packets received   */
0067     __u64   tx_packets;     /* total packets transmitted    */
0068     __u64   rx_bytes;       /* total bytes received     */
0069     __u64   tx_bytes;       /* total bytes transmitted  */
0070     __u64   rx_errors;      /* bad packets received     */
0071     __u64   tx_errors;      /* packet transmit problems */
0072     __u64   rx_dropped;     /* packet dropped on receive    */
0073     __u64   tx_dropped;     /* packet dropped on transmit   */
0074     __u64   rx_noroute;     /* no route for packet dest */
0075 };
0076 
0077 #endif /* _UAPI_MPLS_H */