vmm/devices/virtio/generated/
virtio_net.rs

1// Copyright 2025 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4// automatically generated by tools/bindgen.sh
5
6#![allow(
7    non_camel_case_types,
8    non_upper_case_globals,
9    dead_code,
10    non_snake_case,
11    clippy::ptr_as_ptr,
12    clippy::undocumented_unsafe_blocks,
13    missing_debug_implementations,
14    clippy::tests_outside_test_module,
15    unsafe_op_in_unsafe_fn,
16    clippy::redundant_static_lifetimes
17)]
18
19pub const VIRTIO_NET_F_CSUM: u32 = 0;
20pub const VIRTIO_NET_F_GUEST_CSUM: u32 = 1;
21pub const VIRTIO_NET_F_CTRL_GUEST_OFFLOADS: u32 = 2;
22pub const VIRTIO_NET_F_MTU: u32 = 3;
23pub const VIRTIO_NET_F_MAC: u32 = 5;
24pub const VIRTIO_NET_F_GUEST_TSO4: u32 = 7;
25pub const VIRTIO_NET_F_GUEST_TSO6: u32 = 8;
26pub const VIRTIO_NET_F_GUEST_ECN: u32 = 9;
27pub const VIRTIO_NET_F_GUEST_UFO: u32 = 10;
28pub const VIRTIO_NET_F_HOST_TSO4: u32 = 11;
29pub const VIRTIO_NET_F_HOST_TSO6: u32 = 12;
30pub const VIRTIO_NET_F_HOST_ECN: u32 = 13;
31pub const VIRTIO_NET_F_HOST_UFO: u32 = 14;
32pub const VIRTIO_NET_F_MRG_RXBUF: u32 = 15;
33pub const VIRTIO_NET_F_STATUS: u32 = 16;
34pub const VIRTIO_NET_F_CTRL_VQ: u32 = 17;
35pub const VIRTIO_NET_F_CTRL_RX: u32 = 18;
36pub const VIRTIO_NET_F_CTRL_VLAN: u32 = 19;
37pub const VIRTIO_NET_F_CTRL_RX_EXTRA: u32 = 20;
38pub const VIRTIO_NET_F_GUEST_ANNOUNCE: u32 = 21;
39pub const VIRTIO_NET_F_MQ: u32 = 22;
40pub const VIRTIO_NET_F_CTRL_MAC_ADDR: u32 = 23;
41pub const VIRTIO_NET_F_DEVICE_STATS: u32 = 50;
42pub const VIRTIO_NET_F_VQ_NOTF_COAL: u32 = 52;
43pub const VIRTIO_NET_F_NOTF_COAL: u32 = 53;
44pub const VIRTIO_NET_F_GUEST_USO4: u32 = 54;
45pub const VIRTIO_NET_F_GUEST_USO6: u32 = 55;
46pub const VIRTIO_NET_F_HOST_USO: u32 = 56;
47pub const VIRTIO_NET_F_HASH_REPORT: u32 = 57;
48pub const VIRTIO_NET_F_GUEST_HDRLEN: u32 = 59;
49pub const VIRTIO_NET_F_RSS: u32 = 60;
50pub const VIRTIO_NET_F_RSC_EXT: u32 = 61;
51pub const VIRTIO_NET_F_STANDBY: u32 = 62;
52pub const VIRTIO_NET_F_SPEED_DUPLEX: u32 = 63;
53pub const VIRTIO_NET_F_GSO: u32 = 6;
54pub type __u8 = ::std::os::raw::c_uchar;
55pub type __u16 = ::std::os::raw::c_ushort;
56pub type __le16 = __u16;
57pub type __virtio16 = __u16;
58#[repr(C)]
59#[derive(Copy, Clone)]
60pub struct virtio_net_hdr_v1 {
61    pub flags: __u8,
62    pub gso_type: __u8,
63    pub hdr_len: __virtio16,
64    pub gso_size: __virtio16,
65    pub __bindgen_anon_1: virtio_net_hdr_v1__bindgen_ty_1,
66    pub num_buffers: __virtio16,
67}
68#[repr(C)]
69#[derive(Copy, Clone)]
70pub union virtio_net_hdr_v1__bindgen_ty_1 {
71    pub __bindgen_anon_1: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1,
72    pub csum: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2,
73    pub rsc: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3,
74}
75#[repr(C)]
76#[derive(Debug, Default, Copy, Clone, PartialEq)]
77pub struct virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1 {
78    pub csum_start: __virtio16,
79    pub csum_offset: __virtio16,
80}
81#[allow(clippy::unnecessary_operation, clippy::identity_op)]
82const _: () = {
83    ["Size of virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1"]
84        [::std::mem::size_of::<virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1>() - 4usize];
85    ["Alignment of virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1"]
86        [::std::mem::align_of::<virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1>() - 2usize];
87    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1::csum_start"][::std::mem::offset_of!(
88        virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1,
89        csum_start
90    ) - 0usize];
91    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1::csum_offset"][::std::mem::offset_of!(
92        virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_1,
93        csum_offset
94    ) - 2usize];
95};
96#[repr(C)]
97#[derive(Debug, Default, Copy, Clone, PartialEq)]
98pub struct virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2 {
99    pub start: __virtio16,
100    pub offset: __virtio16,
101}
102#[allow(clippy::unnecessary_operation, clippy::identity_op)]
103const _: () = {
104    ["Size of virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2"]
105        [::std::mem::size_of::<virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2>() - 4usize];
106    ["Alignment of virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2"]
107        [::std::mem::align_of::<virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2>() - 2usize];
108    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2::start"]
109        [::std::mem::offset_of!(virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2, start) - 0usize];
110    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2::offset"]
111        [::std::mem::offset_of!(virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_2, offset) - 2usize];
112};
113#[repr(C)]
114#[derive(Debug, Default, Copy, Clone, PartialEq)]
115pub struct virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3 {
116    pub segments: __le16,
117    pub dup_acks: __le16,
118}
119#[allow(clippy::unnecessary_operation, clippy::identity_op)]
120const _: () = {
121    ["Size of virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3"]
122        [::std::mem::size_of::<virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3>() - 4usize];
123    ["Alignment of virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3"]
124        [::std::mem::align_of::<virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3>() - 2usize];
125    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3::segments"]
126        [::std::mem::offset_of!(virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3, segments) - 0usize];
127    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3::dup_acks"]
128        [::std::mem::offset_of!(virtio_net_hdr_v1__bindgen_ty_1__bindgen_ty_3, dup_acks) - 2usize];
129};
130#[allow(clippy::unnecessary_operation, clippy::identity_op)]
131const _: () = {
132    ["Size of virtio_net_hdr_v1__bindgen_ty_1"]
133        [::std::mem::size_of::<virtio_net_hdr_v1__bindgen_ty_1>() - 4usize];
134    ["Alignment of virtio_net_hdr_v1__bindgen_ty_1"]
135        [::std::mem::align_of::<virtio_net_hdr_v1__bindgen_ty_1>() - 2usize];
136    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1::csum"]
137        [::std::mem::offset_of!(virtio_net_hdr_v1__bindgen_ty_1, csum) - 0usize];
138    ["Offset of field: virtio_net_hdr_v1__bindgen_ty_1::rsc"]
139        [::std::mem::offset_of!(virtio_net_hdr_v1__bindgen_ty_1, rsc) - 0usize];
140};
141impl Default for virtio_net_hdr_v1__bindgen_ty_1 {
142    fn default() -> Self {
143        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
144        unsafe {
145            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
146            s.assume_init()
147        }
148    }
149}
150#[allow(clippy::unnecessary_operation, clippy::identity_op)]
151const _: () = {
152    ["Size of virtio_net_hdr_v1"][::std::mem::size_of::<virtio_net_hdr_v1>() - 12usize];
153    ["Alignment of virtio_net_hdr_v1"][::std::mem::align_of::<virtio_net_hdr_v1>() - 2usize];
154    ["Offset of field: virtio_net_hdr_v1::flags"]
155        [::std::mem::offset_of!(virtio_net_hdr_v1, flags) - 0usize];
156    ["Offset of field: virtio_net_hdr_v1::gso_type"]
157        [::std::mem::offset_of!(virtio_net_hdr_v1, gso_type) - 1usize];
158    ["Offset of field: virtio_net_hdr_v1::hdr_len"]
159        [::std::mem::offset_of!(virtio_net_hdr_v1, hdr_len) - 2usize];
160    ["Offset of field: virtio_net_hdr_v1::gso_size"]
161        [::std::mem::offset_of!(virtio_net_hdr_v1, gso_size) - 4usize];
162    ["Offset of field: virtio_net_hdr_v1::num_buffers"]
163        [::std::mem::offset_of!(virtio_net_hdr_v1, num_buffers) - 10usize];
164};
165impl Default for virtio_net_hdr_v1 {
166    fn default() -> Self {
167        let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
168        unsafe {
169            ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
170            s.assume_init()
171        }
172    }
173}