net: nbuf: Add helper function to copy buf user_data
The function copies the net_buf user data (struct net_nbuf). Change-Id: I2ea42823d58aea77ea7b710f6ce5fd5d1e3641b4 Signed-off-by: Jukka Rissanen <jukka.rissanen@linux.intel.com>
This commit is contained in:
parent
4bcc2a47d0
commit
eb35c8dcae
@ -298,6 +298,14 @@ static inline void net_nbuf_ll_swap(struct net_buf *buf)
|
||||
net_nbuf_ll_dst(buf)->addr = addr;
|
||||
}
|
||||
|
||||
static inline void net_nbuf_copy_user_data(struct net_buf *new,
|
||||
struct net_buf *orig)
|
||||
{
|
||||
memcpy((struct net_nbuf *)net_buf_user_data(new),
|
||||
(struct net_nbuf *)net_buf_user_data(orig),
|
||||
sizeof(struct net_nbuf));
|
||||
}
|
||||
|
||||
#define NET_IPV6_BUF(buf) ((struct net_ipv6_hdr *)net_nbuf_ip_data(buf))
|
||||
#define NET_IPV4_BUF(buf) ((struct net_ipv4_hdr *)net_nbuf_ip_data(buf))
|
||||
#define NET_ICMP_BUF(buf) ((struct net_icmp_hdr *)net_nbuf_icmp_data(buf))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user