While I was looking into the source code of linux, I came across the following definition about IPv6 header format and got confused with the order of "priority" and "version" field according to enndianness. I think both fields are 4 bits(nibble) and they are not related to endianness. I don't understand why linux kernel defined ipv6 header like this.
And there is another question about this structure. Accordinig to https://en.wikipedia.org/wiki/IPv6_packet, traffic class is 8 bits and flow lable field is 20 bit but this structure defined them with 4 bits and 24 bits repectively.
struct ipv6hdr {
#if defined(__LITTLE_ENDIAN_BITFIELD)
    __u8            priority:4,
                version:4;
#elif defined(__BIG_ENDIAN_BITFIELD)
    __u8            version:4,
                priority:4;
#else
#error  "Please fix <asm/byteorder.h>"
#endif
    __u8            flow_lbl[3];
    __be16          payload_len;
    __u8            nexthdr;
    __u8            hop_limit;
    struct  in6_addr    saddr;
    struct  in6_addr    daddr;
};
 
     
    