1 From f40a455d01f80c6638be382d75cb1c4e7748d8af Mon Sep 17 00:00:00 2001
2 From: Simon Horman <horms@kernel.org>
3 Date: Tue, 13 Aug 2024 14:33:47 +0100
4 Subject: [PATCH] ipv6: Add ipv6_addr_{cpu_to_be32,be32_to_cpu} helpers
6 Add helpers to convert an ipv6 addr, expressed as an array
7 of words, from CPU to big-endian byte order, and vice versa.
9 No functional change intended.
12 Suggested-by: Andrew Lunn <andrew@lunn.ch>
13 Link: https://lore.kernel.org/netdev/c7684349-535c-45a4-9a74-d47479a50020@lunn.ch/
14 Reviewed-by: Andrew Lunn <andrew@lunn.ch>
15 Signed-off-by: Simon Horman <horms@kernel.org>
16 Link: https://patch.msgid.link/20240813-ipv6_addr-helpers-v2-1-5c974f8cca3e@kernel.org
17 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
19 include/net/ipv6.h | 12 ++++++++++++
20 1 file changed, 12 insertions(+)
22 --- a/include/net/ipv6.h
23 +++ b/include/net/ipv6.h
24 @@ -1382,4 +1382,16 @@ static inline void ip6_sock_set_recvpkti
28 +#define IPV6_ADDR_WORDS 4
30 +static inline void ipv6_addr_cpu_to_be32(__be32 *dst, const u32 *src)
32 + cpu_to_be32_array(dst, src, IPV6_ADDR_WORDS);
35 +static inline void ipv6_addr_be32_to_cpu(u32 *dst, const __be32 *src)
37 + be32_to_cpu_array(dst, src, IPV6_ADDR_WORDS);
40 #endif /* _NET_IPV6_H */