1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0-dev
5 // source: /usr/share/vpp/api/core/virtio.api.json
7 // Package virtio contains generated bindings for API file virtio.api.
18 api "git.fd.io/govpp.git/api"
19 ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
20 interface_types "git.fd.io/govpp.git/binapi/interface_types"
21 pci_types "git.fd.io/govpp.git/binapi/pci_types"
22 codec "git.fd.io/govpp.git/codec"
25 // This is a compile-time assertion to ensure that this generated file
26 // is compatible with the GoVPP api package it is being compiled against.
27 // A compilation error at this line likely means your copy of the
28 // GoVPP api package needs to be updated.
29 const _ = api.GoVppAPIPackageIsVersion2
34 VersionCrc = 0xa507d784
37 // VirtioFlags defines enum 'virtio_flags'.
38 type VirtioFlags uint32
41 VIRTIO_API_FLAG_GSO VirtioFlags = 1
42 VIRTIO_API_FLAG_CSUM_OFFLOAD VirtioFlags = 2
43 VIRTIO_API_FLAG_GRO_COALESCE VirtioFlags = 4
44 VIRTIO_API_FLAG_PACKED VirtioFlags = 8
45 VIRTIO_API_FLAG_IN_ORDER VirtioFlags = 16
46 VIRTIO_API_FLAG_BUFFERING VirtioFlags = 32
50 VirtioFlags_name = map[uint32]string{
51 1: "VIRTIO_API_FLAG_GSO",
52 2: "VIRTIO_API_FLAG_CSUM_OFFLOAD",
53 4: "VIRTIO_API_FLAG_GRO_COALESCE",
54 8: "VIRTIO_API_FLAG_PACKED",
55 16: "VIRTIO_API_FLAG_IN_ORDER",
56 32: "VIRTIO_API_FLAG_BUFFERING",
58 VirtioFlags_value = map[string]uint32{
59 "VIRTIO_API_FLAG_GSO": 1,
60 "VIRTIO_API_FLAG_CSUM_OFFLOAD": 2,
61 "VIRTIO_API_FLAG_GRO_COALESCE": 4,
62 "VIRTIO_API_FLAG_PACKED": 8,
63 "VIRTIO_API_FLAG_IN_ORDER": 16,
64 "VIRTIO_API_FLAG_BUFFERING": 32,
68 func (x VirtioFlags) String() string {
69 s, ok := VirtioFlags_name[uint32(x)]
73 str := func(n uint32) string {
74 s, ok := VirtioFlags_name[uint32(n)]
78 return "VirtioFlags(" + strconv.Itoa(int(n)) + ")"
80 for i := uint32(0); i <= 32; i++ {
95 // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'.
96 type SwInterfaceVirtioPciDetails struct {
97 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
98 PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
99 MacAddr ethernet_types.MacAddress `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"`
100 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"`
101 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"`
102 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
105 func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} }
106 func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" }
107 func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "6ca9c167" }
108 func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
109 return api.ReplyMessage
112 func (m *SwInterfaceVirtioPciDetails) Size() (size int) {
116 size += 4 // m.SwIfIndex
117 size += 2 // m.PciAddr.Domain
118 size += 1 // m.PciAddr.Bus
119 size += 1 // m.PciAddr.Slot
120 size += 1 // m.PciAddr.Function
121 size += 1 * 6 // m.MacAddr
122 size += 2 // m.TxRingSz
123 size += 2 // m.RxRingSz
124 size += 8 // m.Features
127 func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) {
129 b = make([]byte, m.Size())
131 buf := codec.NewBuffer(b)
132 buf.EncodeUint32(uint32(m.SwIfIndex))
133 buf.EncodeUint16(m.PciAddr.Domain)
134 buf.EncodeUint8(m.PciAddr.Bus)
135 buf.EncodeUint8(m.PciAddr.Slot)
136 buf.EncodeUint8(m.PciAddr.Function)
137 buf.EncodeBytes(m.MacAddr[:], 6)
138 buf.EncodeUint16(m.TxRingSz)
139 buf.EncodeUint16(m.RxRingSz)
140 buf.EncodeUint64(m.Features)
141 return buf.Bytes(), nil
143 func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error {
144 buf := codec.NewBuffer(b)
145 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
146 m.PciAddr.Domain = buf.DecodeUint16()
147 m.PciAddr.Bus = buf.DecodeUint8()
148 m.PciAddr.Slot = buf.DecodeUint8()
149 m.PciAddr.Function = buf.DecodeUint8()
150 copy(m.MacAddr[:], buf.DecodeBytes(6))
151 m.TxRingSz = buf.DecodeUint16()
152 m.RxRingSz = buf.DecodeUint16()
153 m.Features = buf.DecodeUint64()
157 // SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'.
158 type SwInterfaceVirtioPciDump struct{}
160 func (m *SwInterfaceVirtioPciDump) Reset() { *m = SwInterfaceVirtioPciDump{} }
161 func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" }
162 func (*SwInterfaceVirtioPciDump) GetCrcString() string { return "51077d14" }
163 func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType {
164 return api.RequestMessage
167 func (m *SwInterfaceVirtioPciDump) Size() (size int) {
173 func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) {
175 b = make([]byte, m.Size())
177 buf := codec.NewBuffer(b)
178 return buf.Bytes(), nil
180 func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
184 // VirtioPciCreate defines message 'virtio_pci_create'.
185 // Deprecated: the message will be removed in the future versions
186 type VirtioPciCreate struct {
187 PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
188 UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
189 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
190 GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"`
191 ChecksumOffloadEnabled bool `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"`
192 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
195 func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} }
196 func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" }
197 func (*VirtioPciCreate) GetCrcString() string { return "1944f8db" }
198 func (*VirtioPciCreate) GetMessageType() api.MessageType {
199 return api.RequestMessage
202 func (m *VirtioPciCreate) Size() (size int) {
206 size += 2 // m.PciAddr.Domain
207 size += 1 // m.PciAddr.Bus
208 size += 1 // m.PciAddr.Slot
209 size += 1 // m.PciAddr.Function
210 size += 1 // m.UseRandomMac
211 size += 1 * 6 // m.MacAddress
212 size += 1 // m.GsoEnabled
213 size += 1 // m.ChecksumOffloadEnabled
214 size += 8 // m.Features
217 func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) {
219 b = make([]byte, m.Size())
221 buf := codec.NewBuffer(b)
222 buf.EncodeUint16(m.PciAddr.Domain)
223 buf.EncodeUint8(m.PciAddr.Bus)
224 buf.EncodeUint8(m.PciAddr.Slot)
225 buf.EncodeUint8(m.PciAddr.Function)
226 buf.EncodeBool(m.UseRandomMac)
227 buf.EncodeBytes(m.MacAddress[:], 6)
228 buf.EncodeBool(m.GsoEnabled)
229 buf.EncodeBool(m.ChecksumOffloadEnabled)
230 buf.EncodeUint64(m.Features)
231 return buf.Bytes(), nil
233 func (m *VirtioPciCreate) Unmarshal(b []byte) error {
234 buf := codec.NewBuffer(b)
235 m.PciAddr.Domain = buf.DecodeUint16()
236 m.PciAddr.Bus = buf.DecodeUint8()
237 m.PciAddr.Slot = buf.DecodeUint8()
238 m.PciAddr.Function = buf.DecodeUint8()
239 m.UseRandomMac = buf.DecodeBool()
240 copy(m.MacAddress[:], buf.DecodeBytes(6))
241 m.GsoEnabled = buf.DecodeBool()
242 m.ChecksumOffloadEnabled = buf.DecodeBool()
243 m.Features = buf.DecodeUint64()
247 // VirtioPciCreateReply defines message 'virtio_pci_create_reply'.
248 // Deprecated: the message will be removed in the future versions
249 type VirtioPciCreateReply struct {
250 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
251 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
254 func (m *VirtioPciCreateReply) Reset() { *m = VirtioPciCreateReply{} }
255 func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" }
256 func (*VirtioPciCreateReply) GetCrcString() string { return "5383d31f" }
257 func (*VirtioPciCreateReply) GetMessageType() api.MessageType {
258 return api.ReplyMessage
261 func (m *VirtioPciCreateReply) Size() (size int) {
265 size += 4 // m.Retval
266 size += 4 // m.SwIfIndex
269 func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) {
271 b = make([]byte, m.Size())
273 buf := codec.NewBuffer(b)
274 buf.EncodeInt32(m.Retval)
275 buf.EncodeUint32(uint32(m.SwIfIndex))
276 return buf.Bytes(), nil
278 func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
279 buf := codec.NewBuffer(b)
280 m.Retval = buf.DecodeInt32()
281 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
285 // VirtioPciCreateV2 defines message 'virtio_pci_create_v2'.
286 type VirtioPciCreateV2 struct {
287 PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
288 UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
289 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
290 VirtioFlags VirtioFlags `binapi:"virtio_flags,name=virtio_flags" json:"virtio_flags,omitempty"`
291 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
294 func (m *VirtioPciCreateV2) Reset() { *m = VirtioPciCreateV2{} }
295 func (*VirtioPciCreateV2) GetMessageName() string { return "virtio_pci_create_v2" }
296 func (*VirtioPciCreateV2) GetCrcString() string { return "5d096e1a" }
297 func (*VirtioPciCreateV2) GetMessageType() api.MessageType {
298 return api.RequestMessage
301 func (m *VirtioPciCreateV2) Size() (size int) {
305 size += 2 // m.PciAddr.Domain
306 size += 1 // m.PciAddr.Bus
307 size += 1 // m.PciAddr.Slot
308 size += 1 // m.PciAddr.Function
309 size += 1 // m.UseRandomMac
310 size += 1 * 6 // m.MacAddress
311 size += 4 // m.VirtioFlags
312 size += 8 // m.Features
315 func (m *VirtioPciCreateV2) Marshal(b []byte) ([]byte, error) {
317 b = make([]byte, m.Size())
319 buf := codec.NewBuffer(b)
320 buf.EncodeUint16(m.PciAddr.Domain)
321 buf.EncodeUint8(m.PciAddr.Bus)
322 buf.EncodeUint8(m.PciAddr.Slot)
323 buf.EncodeUint8(m.PciAddr.Function)
324 buf.EncodeBool(m.UseRandomMac)
325 buf.EncodeBytes(m.MacAddress[:], 6)
326 buf.EncodeUint32(uint32(m.VirtioFlags))
327 buf.EncodeUint64(m.Features)
328 return buf.Bytes(), nil
330 func (m *VirtioPciCreateV2) Unmarshal(b []byte) error {
331 buf := codec.NewBuffer(b)
332 m.PciAddr.Domain = buf.DecodeUint16()
333 m.PciAddr.Bus = buf.DecodeUint8()
334 m.PciAddr.Slot = buf.DecodeUint8()
335 m.PciAddr.Function = buf.DecodeUint8()
336 m.UseRandomMac = buf.DecodeBool()
337 copy(m.MacAddress[:], buf.DecodeBytes(6))
338 m.VirtioFlags = VirtioFlags(buf.DecodeUint32())
339 m.Features = buf.DecodeUint64()
343 // VirtioPciCreateV2Reply defines message 'virtio_pci_create_v2_reply'.
344 type VirtioPciCreateV2Reply struct {
345 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
346 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
349 func (m *VirtioPciCreateV2Reply) Reset() { *m = VirtioPciCreateV2Reply{} }
350 func (*VirtioPciCreateV2Reply) GetMessageName() string { return "virtio_pci_create_v2_reply" }
351 func (*VirtioPciCreateV2Reply) GetCrcString() string { return "5383d31f" }
352 func (*VirtioPciCreateV2Reply) GetMessageType() api.MessageType {
353 return api.ReplyMessage
356 func (m *VirtioPciCreateV2Reply) Size() (size int) {
360 size += 4 // m.Retval
361 size += 4 // m.SwIfIndex
364 func (m *VirtioPciCreateV2Reply) Marshal(b []byte) ([]byte, error) {
366 b = make([]byte, m.Size())
368 buf := codec.NewBuffer(b)
369 buf.EncodeInt32(m.Retval)
370 buf.EncodeUint32(uint32(m.SwIfIndex))
371 return buf.Bytes(), nil
373 func (m *VirtioPciCreateV2Reply) Unmarshal(b []byte) error {
374 buf := codec.NewBuffer(b)
375 m.Retval = buf.DecodeInt32()
376 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
380 // VirtioPciDelete defines message 'virtio_pci_delete'.
381 type VirtioPciDelete struct {
382 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
385 func (m *VirtioPciDelete) Reset() { *m = VirtioPciDelete{} }
386 func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" }
387 func (*VirtioPciDelete) GetCrcString() string { return "f9e6675e" }
388 func (*VirtioPciDelete) GetMessageType() api.MessageType {
389 return api.RequestMessage
392 func (m *VirtioPciDelete) Size() (size int) {
396 size += 4 // m.SwIfIndex
399 func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) {
401 b = make([]byte, m.Size())
403 buf := codec.NewBuffer(b)
404 buf.EncodeUint32(uint32(m.SwIfIndex))
405 return buf.Bytes(), nil
407 func (m *VirtioPciDelete) Unmarshal(b []byte) error {
408 buf := codec.NewBuffer(b)
409 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
413 // VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'.
414 type VirtioPciDeleteReply struct {
415 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
418 func (m *VirtioPciDeleteReply) Reset() { *m = VirtioPciDeleteReply{} }
419 func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" }
420 func (*VirtioPciDeleteReply) GetCrcString() string { return "e8d4e804" }
421 func (*VirtioPciDeleteReply) GetMessageType() api.MessageType {
422 return api.ReplyMessage
425 func (m *VirtioPciDeleteReply) Size() (size int) {
429 size += 4 // m.Retval
432 func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) {
434 b = make([]byte, m.Size())
436 buf := codec.NewBuffer(b)
437 buf.EncodeInt32(m.Retval)
438 return buf.Bytes(), nil
440 func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
441 buf := codec.NewBuffer(b)
442 m.Retval = buf.DecodeInt32()
446 func init() { file_virtio_binapi_init() }
447 func file_virtio_binapi_init() {
448 api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_6ca9c167")
449 api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14")
450 api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_1944f8db")
451 api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f")
452 api.RegisterMessage((*VirtioPciCreateV2)(nil), "virtio_pci_create_v2_5d096e1a")
453 api.RegisterMessage((*VirtioPciCreateV2Reply)(nil), "virtio_pci_create_v2_reply_5383d31f")
454 api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e")
455 api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804")
458 // Messages returns list of all messages in this module.
459 func AllMessages() []api.Message {
460 return []api.Message{
461 (*SwInterfaceVirtioPciDetails)(nil),
462 (*SwInterfaceVirtioPciDump)(nil),
463 (*VirtioPciCreate)(nil),
464 (*VirtioPciCreateReply)(nil),
465 (*VirtioPciCreateV2)(nil),
466 (*VirtioPciCreateV2Reply)(nil),
467 (*VirtioPciDelete)(nil),
468 (*VirtioPciDeleteReply)(nil),