mirror of
https://github.com/AuxXxilium/linux_dsm_epyc7002.git
synced 2024-12-01 17:26:39 +07:00
tun: add tun_is_little_endian() helper
Signed-off-by: Greg Kurz <gkurz@linux.vnet.ibm.com> Signed-off-by: Michael S. Tsirkin <mst@redhat.com> Acked-by: Cornelia Huck <cornelia.huck@de.ibm.com> Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
cf561f0d2e
commit
25bd55bbab
@ -206,14 +206,19 @@ struct tun_struct {
|
|||||||
u32 flow_count;
|
u32 flow_count;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static inline bool tun_is_little_endian(struct tun_struct *tun)
|
||||||
|
{
|
||||||
|
return tun->flags & TUN_VNET_LE;
|
||||||
|
}
|
||||||
|
|
||||||
static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val)
|
static inline u16 tun16_to_cpu(struct tun_struct *tun, __virtio16 val)
|
||||||
{
|
{
|
||||||
return __virtio16_to_cpu(tun->flags & TUN_VNET_LE, val);
|
return __virtio16_to_cpu(tun_is_little_endian(tun), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val)
|
static inline __virtio16 cpu_to_tun16(struct tun_struct *tun, u16 val)
|
||||||
{
|
{
|
||||||
return __cpu_to_virtio16(tun->flags & TUN_VNET_LE, val);
|
return __cpu_to_virtio16(tun_is_little_endian(tun), val);
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline u32 tun_hashfn(u32 rxhash)
|
static inline u32 tun_hashfn(u32 rxhash)
|
||||||
|
Loading…
Reference in New Issue
Block a user