github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/virtio/virtio.ba.go (about) 1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT. 2 // versions: 3 // binapi-generator: v0.10.0-dev 4 // VPP: 23.10-rc0~170-g6f1548434 5 // source: core/virtio.api.json 6 7 // Package virtio contains generated bindings for API file virtio.api. 8 // 9 // Contents: 10 // - 1 enum 11 // - 8 messages 12 package virtio 13 14 import ( 15 "strconv" 16 17 ethernet_types "github.com/networkservicemesh/govpp/binapi/ethernet_types" 18 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 19 pci_types "github.com/networkservicemesh/govpp/binapi/pci_types" 20 api "go.fd.io/govpp/api" 21 codec "go.fd.io/govpp/codec" 22 ) 23 24 // This is a compile-time assertion to ensure that this generated file 25 // is compatible with the GoVPP api package it is being compiled against. 26 // A compilation error at this line likely means your copy of the 27 // GoVPP api package needs to be updated. 28 const _ = api.GoVppAPIPackageIsVersion2 29 30 const ( 31 APIFile = "virtio" 32 APIVersion = "3.0.0" 33 VersionCrc = 0xa507d784 34 ) 35 36 // VirtioFlags defines enum 'virtio_flags'. 37 type VirtioFlags uint32 38 39 const ( 40 VIRTIO_API_FLAG_GSO VirtioFlags = 1 41 VIRTIO_API_FLAG_CSUM_OFFLOAD VirtioFlags = 2 42 VIRTIO_API_FLAG_GRO_COALESCE VirtioFlags = 4 43 VIRTIO_API_FLAG_PACKED VirtioFlags = 8 44 VIRTIO_API_FLAG_IN_ORDER VirtioFlags = 16 45 VIRTIO_API_FLAG_BUFFERING VirtioFlags = 32 46 ) 47 48 var ( 49 VirtioFlags_name = map[uint32]string{ 50 1: "VIRTIO_API_FLAG_GSO", 51 2: "VIRTIO_API_FLAG_CSUM_OFFLOAD", 52 4: "VIRTIO_API_FLAG_GRO_COALESCE", 53 8: "VIRTIO_API_FLAG_PACKED", 54 16: "VIRTIO_API_FLAG_IN_ORDER", 55 32: "VIRTIO_API_FLAG_BUFFERING", 56 } 57 VirtioFlags_value = map[string]uint32{ 58 "VIRTIO_API_FLAG_GSO": 1, 59 "VIRTIO_API_FLAG_CSUM_OFFLOAD": 2, 60 "VIRTIO_API_FLAG_GRO_COALESCE": 4, 61 "VIRTIO_API_FLAG_PACKED": 8, 62 "VIRTIO_API_FLAG_IN_ORDER": 16, 63 "VIRTIO_API_FLAG_BUFFERING": 32, 64 } 65 ) 66 67 func (x VirtioFlags) String() string { 68 s, ok := VirtioFlags_name[uint32(x)] 69 if ok { 70 return s 71 } 72 str := func(n uint32) string { 73 s, ok := VirtioFlags_name[uint32(n)] 74 if ok { 75 return s 76 } 77 return "VirtioFlags(" + strconv.Itoa(int(n)) + ")" 78 } 79 for i := uint32(0); i <= 32; i++ { 80 val := uint32(x) 81 if val&(1<<i) != 0 { 82 if s != "" { 83 s += "|" 84 } 85 s += str(1 << i) 86 } 87 } 88 if s == "" { 89 return str(uint32(x)) 90 } 91 return s 92 } 93 94 // Reply for virtio pci interface dump request 95 // - sw_if_index - software index of virtio pci interface 96 // - pci_addr - pci address 97 // - mac_addr - native virtio device mac address 98 // - tx_ring_sz - the number of entries of TX ring 99 // - rx_ring_sz - the number of entries of RX ring 100 // - features - the virtio features which driver have negotiated with device 101 // 102 // SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'. 103 type SwInterfaceVirtioPciDetails struct { 104 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 105 PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` 106 MacAddr ethernet_types.MacAddress `binapi:"mac_address,name=mac_addr" json:"mac_addr,omitempty"` 107 TxRingSz uint16 `binapi:"u16,name=tx_ring_sz" json:"tx_ring_sz,omitempty"` 108 RxRingSz uint16 `binapi:"u16,name=rx_ring_sz" json:"rx_ring_sz,omitempty"` 109 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"` 110 } 111 112 func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} } 113 func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" } 114 func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "6ca9c167" } 115 func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType { 116 return api.ReplyMessage 117 } 118 119 func (m *SwInterfaceVirtioPciDetails) Size() (size int) { 120 if m == nil { 121 return 0 122 } 123 size += 4 // m.SwIfIndex 124 size += 2 // m.PciAddr.Domain 125 size += 1 // m.PciAddr.Bus 126 size += 1 // m.PciAddr.Slot 127 size += 1 // m.PciAddr.Function 128 size += 1 * 6 // m.MacAddr 129 size += 2 // m.TxRingSz 130 size += 2 // m.RxRingSz 131 size += 8 // m.Features 132 return size 133 } 134 func (m *SwInterfaceVirtioPciDetails) Marshal(b []byte) ([]byte, error) { 135 if b == nil { 136 b = make([]byte, m.Size()) 137 } 138 buf := codec.NewBuffer(b) 139 buf.EncodeUint32(uint32(m.SwIfIndex)) 140 buf.EncodeUint16(m.PciAddr.Domain) 141 buf.EncodeUint8(m.PciAddr.Bus) 142 buf.EncodeUint8(m.PciAddr.Slot) 143 buf.EncodeUint8(m.PciAddr.Function) 144 buf.EncodeBytes(m.MacAddr[:], 6) 145 buf.EncodeUint16(m.TxRingSz) 146 buf.EncodeUint16(m.RxRingSz) 147 buf.EncodeUint64(m.Features) 148 return buf.Bytes(), nil 149 } 150 func (m *SwInterfaceVirtioPciDetails) Unmarshal(b []byte) error { 151 buf := codec.NewBuffer(b) 152 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 153 m.PciAddr.Domain = buf.DecodeUint16() 154 m.PciAddr.Bus = buf.DecodeUint8() 155 m.PciAddr.Slot = buf.DecodeUint8() 156 m.PciAddr.Function = buf.DecodeUint8() 157 copy(m.MacAddr[:], buf.DecodeBytes(6)) 158 m.TxRingSz = buf.DecodeUint16() 159 m.RxRingSz = buf.DecodeUint16() 160 m.Features = buf.DecodeUint64() 161 return nil 162 } 163 164 // Dump virtio pci interfaces request 165 // SwInterfaceVirtioPciDump defines message 'sw_interface_virtio_pci_dump'. 166 type SwInterfaceVirtioPciDump struct{} 167 168 func (m *SwInterfaceVirtioPciDump) Reset() { *m = SwInterfaceVirtioPciDump{} } 169 func (*SwInterfaceVirtioPciDump) GetMessageName() string { return "sw_interface_virtio_pci_dump" } 170 func (*SwInterfaceVirtioPciDump) GetCrcString() string { return "51077d14" } 171 func (*SwInterfaceVirtioPciDump) GetMessageType() api.MessageType { 172 return api.RequestMessage 173 } 174 175 func (m *SwInterfaceVirtioPciDump) Size() (size int) { 176 if m == nil { 177 return 0 178 } 179 return size 180 } 181 func (m *SwInterfaceVirtioPciDump) Marshal(b []byte) ([]byte, error) { 182 if b == nil { 183 b = make([]byte, m.Size()) 184 } 185 buf := codec.NewBuffer(b) 186 return buf.Bytes(), nil 187 } 188 func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error { 189 return nil 190 } 191 192 // Initialize a new virtio pci interface with the given parameters 193 // - pci_addr - pci address 194 // - use_random_mac - let the system generate a unique mac address 195 // - mac_address - mac addr to assign to the interface if use_random not set 196 // - gso_enabled - enable gso feature if available, 1 to enable 197 // - checksum_offload_enabled - enable checksum feature if available, 1 to enable 198 // - features - the virtio features which driver should negotiate with device 199 // 200 // VirtioPciCreate defines message 'virtio_pci_create'. 201 // Deprecated: the message will be removed in the future versions 202 type VirtioPciCreate struct { 203 PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` 204 UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"` 205 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 206 GsoEnabled bool `binapi:"bool,name=gso_enabled" json:"gso_enabled,omitempty"` 207 ChecksumOffloadEnabled bool `binapi:"bool,name=checksum_offload_enabled" json:"checksum_offload_enabled,omitempty"` 208 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"` 209 } 210 211 func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} } 212 func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" } 213 func (*VirtioPciCreate) GetCrcString() string { return "1944f8db" } 214 func (*VirtioPciCreate) GetMessageType() api.MessageType { 215 return api.RequestMessage 216 } 217 218 func (m *VirtioPciCreate) Size() (size int) { 219 if m == nil { 220 return 0 221 } 222 size += 2 // m.PciAddr.Domain 223 size += 1 // m.PciAddr.Bus 224 size += 1 // m.PciAddr.Slot 225 size += 1 // m.PciAddr.Function 226 size += 1 // m.UseRandomMac 227 size += 1 * 6 // m.MacAddress 228 size += 1 // m.GsoEnabled 229 size += 1 // m.ChecksumOffloadEnabled 230 size += 8 // m.Features 231 return size 232 } 233 func (m *VirtioPciCreate) Marshal(b []byte) ([]byte, error) { 234 if b == nil { 235 b = make([]byte, m.Size()) 236 } 237 buf := codec.NewBuffer(b) 238 buf.EncodeUint16(m.PciAddr.Domain) 239 buf.EncodeUint8(m.PciAddr.Bus) 240 buf.EncodeUint8(m.PciAddr.Slot) 241 buf.EncodeUint8(m.PciAddr.Function) 242 buf.EncodeBool(m.UseRandomMac) 243 buf.EncodeBytes(m.MacAddress[:], 6) 244 buf.EncodeBool(m.GsoEnabled) 245 buf.EncodeBool(m.ChecksumOffloadEnabled) 246 buf.EncodeUint64(m.Features) 247 return buf.Bytes(), nil 248 } 249 func (m *VirtioPciCreate) Unmarshal(b []byte) error { 250 buf := codec.NewBuffer(b) 251 m.PciAddr.Domain = buf.DecodeUint16() 252 m.PciAddr.Bus = buf.DecodeUint8() 253 m.PciAddr.Slot = buf.DecodeUint8() 254 m.PciAddr.Function = buf.DecodeUint8() 255 m.UseRandomMac = buf.DecodeBool() 256 copy(m.MacAddress[:], buf.DecodeBytes(6)) 257 m.GsoEnabled = buf.DecodeBool() 258 m.ChecksumOffloadEnabled = buf.DecodeBool() 259 m.Features = buf.DecodeUint64() 260 return nil 261 } 262 263 // Reply for virtio pci create reply 264 // - retval - return code 265 // - sw_if_index - software index allocated for the new virtio pci interface 266 // 267 // VirtioPciCreateReply defines message 'virtio_pci_create_reply'. 268 // Deprecated: the message will be removed in the future versions 269 type VirtioPciCreateReply struct { 270 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 271 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 272 } 273 274 func (m *VirtioPciCreateReply) Reset() { *m = VirtioPciCreateReply{} } 275 func (*VirtioPciCreateReply) GetMessageName() string { return "virtio_pci_create_reply" } 276 func (*VirtioPciCreateReply) GetCrcString() string { return "5383d31f" } 277 func (*VirtioPciCreateReply) GetMessageType() api.MessageType { 278 return api.ReplyMessage 279 } 280 281 func (m *VirtioPciCreateReply) Size() (size int) { 282 if m == nil { 283 return 0 284 } 285 size += 4 // m.Retval 286 size += 4 // m.SwIfIndex 287 return size 288 } 289 func (m *VirtioPciCreateReply) Marshal(b []byte) ([]byte, error) { 290 if b == nil { 291 b = make([]byte, m.Size()) 292 } 293 buf := codec.NewBuffer(b) 294 buf.EncodeInt32(m.Retval) 295 buf.EncodeUint32(uint32(m.SwIfIndex)) 296 return buf.Bytes(), nil 297 } 298 func (m *VirtioPciCreateReply) Unmarshal(b []byte) error { 299 buf := codec.NewBuffer(b) 300 m.Retval = buf.DecodeInt32() 301 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 302 return nil 303 } 304 305 // Initialize a new virtio pci interface with the given parameters 306 // - pci_addr - pci address 307 // - use_random_mac - let the system generate a unique mac address 308 // - mac_address - mac addr to assign to the interface if use_random not set 309 // - virtio_flags - feature flags to enable 310 // - features - the virtio features which driver should negotiate with device 311 // 312 // VirtioPciCreateV2 defines message 'virtio_pci_create_v2'. 313 type VirtioPciCreateV2 struct { 314 PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"` 315 UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"` 316 MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"` 317 VirtioFlags VirtioFlags `binapi:"virtio_flags,name=virtio_flags" json:"virtio_flags,omitempty"` 318 Features uint64 `binapi:"u64,name=features" json:"features,omitempty"` 319 } 320 321 func (m *VirtioPciCreateV2) Reset() { *m = VirtioPciCreateV2{} } 322 func (*VirtioPciCreateV2) GetMessageName() string { return "virtio_pci_create_v2" } 323 func (*VirtioPciCreateV2) GetCrcString() string { return "5d096e1a" } 324 func (*VirtioPciCreateV2) GetMessageType() api.MessageType { 325 return api.RequestMessage 326 } 327 328 func (m *VirtioPciCreateV2) Size() (size int) { 329 if m == nil { 330 return 0 331 } 332 size += 2 // m.PciAddr.Domain 333 size += 1 // m.PciAddr.Bus 334 size += 1 // m.PciAddr.Slot 335 size += 1 // m.PciAddr.Function 336 size += 1 // m.UseRandomMac 337 size += 1 * 6 // m.MacAddress 338 size += 4 // m.VirtioFlags 339 size += 8 // m.Features 340 return size 341 } 342 func (m *VirtioPciCreateV2) Marshal(b []byte) ([]byte, error) { 343 if b == nil { 344 b = make([]byte, m.Size()) 345 } 346 buf := codec.NewBuffer(b) 347 buf.EncodeUint16(m.PciAddr.Domain) 348 buf.EncodeUint8(m.PciAddr.Bus) 349 buf.EncodeUint8(m.PciAddr.Slot) 350 buf.EncodeUint8(m.PciAddr.Function) 351 buf.EncodeBool(m.UseRandomMac) 352 buf.EncodeBytes(m.MacAddress[:], 6) 353 buf.EncodeUint32(uint32(m.VirtioFlags)) 354 buf.EncodeUint64(m.Features) 355 return buf.Bytes(), nil 356 } 357 func (m *VirtioPciCreateV2) Unmarshal(b []byte) error { 358 buf := codec.NewBuffer(b) 359 m.PciAddr.Domain = buf.DecodeUint16() 360 m.PciAddr.Bus = buf.DecodeUint8() 361 m.PciAddr.Slot = buf.DecodeUint8() 362 m.PciAddr.Function = buf.DecodeUint8() 363 m.UseRandomMac = buf.DecodeBool() 364 copy(m.MacAddress[:], buf.DecodeBytes(6)) 365 m.VirtioFlags = VirtioFlags(buf.DecodeUint32()) 366 m.Features = buf.DecodeUint64() 367 return nil 368 } 369 370 // Reply for virtio pci create reply 371 // - retval - return code 372 // - sw_if_index - software index allocated for the new virtio pci interface 373 // 374 // VirtioPciCreateV2Reply defines message 'virtio_pci_create_v2_reply'. 375 type VirtioPciCreateV2Reply struct { 376 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 377 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 378 } 379 380 func (m *VirtioPciCreateV2Reply) Reset() { *m = VirtioPciCreateV2Reply{} } 381 func (*VirtioPciCreateV2Reply) GetMessageName() string { return "virtio_pci_create_v2_reply" } 382 func (*VirtioPciCreateV2Reply) GetCrcString() string { return "5383d31f" } 383 func (*VirtioPciCreateV2Reply) GetMessageType() api.MessageType { 384 return api.ReplyMessage 385 } 386 387 func (m *VirtioPciCreateV2Reply) Size() (size int) { 388 if m == nil { 389 return 0 390 } 391 size += 4 // m.Retval 392 size += 4 // m.SwIfIndex 393 return size 394 } 395 func (m *VirtioPciCreateV2Reply) Marshal(b []byte) ([]byte, error) { 396 if b == nil { 397 b = make([]byte, m.Size()) 398 } 399 buf := codec.NewBuffer(b) 400 buf.EncodeInt32(m.Retval) 401 buf.EncodeUint32(uint32(m.SwIfIndex)) 402 return buf.Bytes(), nil 403 } 404 func (m *VirtioPciCreateV2Reply) Unmarshal(b []byte) error { 405 buf := codec.NewBuffer(b) 406 m.Retval = buf.DecodeInt32() 407 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 408 return nil 409 } 410 411 // Delete virtio pci interface 412 // - sw_if_index - interface index of existing virtio pci interface 413 // 414 // VirtioPciDelete defines message 'virtio_pci_delete'. 415 type VirtioPciDelete struct { 416 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 417 } 418 419 func (m *VirtioPciDelete) Reset() { *m = VirtioPciDelete{} } 420 func (*VirtioPciDelete) GetMessageName() string { return "virtio_pci_delete" } 421 func (*VirtioPciDelete) GetCrcString() string { return "f9e6675e" } 422 func (*VirtioPciDelete) GetMessageType() api.MessageType { 423 return api.RequestMessage 424 } 425 426 func (m *VirtioPciDelete) Size() (size int) { 427 if m == nil { 428 return 0 429 } 430 size += 4 // m.SwIfIndex 431 return size 432 } 433 func (m *VirtioPciDelete) Marshal(b []byte) ([]byte, error) { 434 if b == nil { 435 b = make([]byte, m.Size()) 436 } 437 buf := codec.NewBuffer(b) 438 buf.EncodeUint32(uint32(m.SwIfIndex)) 439 return buf.Bytes(), nil 440 } 441 func (m *VirtioPciDelete) Unmarshal(b []byte) error { 442 buf := codec.NewBuffer(b) 443 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 444 return nil 445 } 446 447 // VirtioPciDeleteReply defines message 'virtio_pci_delete_reply'. 448 type VirtioPciDeleteReply struct { 449 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 450 } 451 452 func (m *VirtioPciDeleteReply) Reset() { *m = VirtioPciDeleteReply{} } 453 func (*VirtioPciDeleteReply) GetMessageName() string { return "virtio_pci_delete_reply" } 454 func (*VirtioPciDeleteReply) GetCrcString() string { return "e8d4e804" } 455 func (*VirtioPciDeleteReply) GetMessageType() api.MessageType { 456 return api.ReplyMessage 457 } 458 459 func (m *VirtioPciDeleteReply) Size() (size int) { 460 if m == nil { 461 return 0 462 } 463 size += 4 // m.Retval 464 return size 465 } 466 func (m *VirtioPciDeleteReply) Marshal(b []byte) ([]byte, error) { 467 if b == nil { 468 b = make([]byte, m.Size()) 469 } 470 buf := codec.NewBuffer(b) 471 buf.EncodeInt32(m.Retval) 472 return buf.Bytes(), nil 473 } 474 func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error { 475 buf := codec.NewBuffer(b) 476 m.Retval = buf.DecodeInt32() 477 return nil 478 } 479 480 func init() { file_virtio_binapi_init() } 481 func file_virtio_binapi_init() { 482 api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_6ca9c167") 483 api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14") 484 api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_1944f8db") 485 api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f") 486 api.RegisterMessage((*VirtioPciCreateV2)(nil), "virtio_pci_create_v2_5d096e1a") 487 api.RegisterMessage((*VirtioPciCreateV2Reply)(nil), "virtio_pci_create_v2_reply_5383d31f") 488 api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e") 489 api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804") 490 } 491 492 // Messages returns list of all messages in this module. 493 func AllMessages() []api.Message { 494 return []api.Message{ 495 (*SwInterfaceVirtioPciDetails)(nil), 496 (*SwInterfaceVirtioPciDump)(nil), 497 (*VirtioPciCreate)(nil), 498 (*VirtioPciCreateReply)(nil), 499 (*VirtioPciCreateV2)(nil), 500 (*VirtioPciCreateV2Reply)(nil), 501 (*VirtioPciDelete)(nil), 502 (*VirtioPciDeleteReply)(nil), 503 } 504 }