ipv6: Introduce ip6_flow_hdr() to fill version, tclass and flowlabel.
This is not only for readability but also for optimization. What we do here is to build the 32bit word at the beginning of the ipv6 header (the "ip6_flow" virtual member of struct ip6_hdr in RFC3542) and we do not need to read the tclass portion of the target buffer. Signed-off-by: YOSHIFUJI Hideaki <yoshfuji@linux-ipv6.org> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
00494be454
commit
3e4e4c1f2d
@@ -546,6 +546,15 @@ static inline int ipv6_addr_diff(const struct in6_addr *a1, const struct in6_add
|
||||
|
||||
extern void ipv6_select_ident(struct frag_hdr *fhdr, struct rt6_info *rt);
|
||||
|
||||
/*
|
||||
* Header manipulation
|
||||
*/
|
||||
static inline void ip6_flow_hdr(struct ipv6hdr *hdr, unsigned int tclass,
|
||||
__be32 flowlabel)
|
||||
{
|
||||
*(__be32 *)hdr = ntohl(0x60000000 | (tclass << 20)) | flowlabel;
|
||||
}
|
||||
|
||||
/*
|
||||
* Prototypes exported by ipv6
|
||||
*/
|
||||
|
Reference in New Issue
Block a user