github.com/networkservicemesh/govpp@v0.0.0-20240328101142-8a444680fbba/binapi/af_xdp/af_xdp.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: plugins/af_xdp.api.json 6 7 // Package af_xdp contains generated bindings for API file af_xdp.api. 8 // 9 // Contents: 10 // - 2 enums 11 // - 8 messages 12 package af_xdp 13 14 import ( 15 "strconv" 16 17 interface_types "github.com/networkservicemesh/govpp/binapi/interface_types" 18 api "go.fd.io/govpp/api" 19 codec "go.fd.io/govpp/codec" 20 ) 21 22 // This is a compile-time assertion to ensure that this generated file 23 // is compatible with the GoVPP api package it is being compiled against. 24 // A compilation error at this line likely means your copy of the 25 // GoVPP api package needs to be updated. 26 const _ = api.GoVppAPIPackageIsVersion2 27 28 const ( 29 APIFile = "af_xdp" 30 APIVersion = "1.0.0" 31 VersionCrc = 0xd2949266 32 ) 33 34 // AfXdpMode defines enum 'af_xdp_mode'. 35 type AfXdpMode uint32 36 37 const ( 38 AF_XDP_API_MODE_AUTO AfXdpMode = 0 39 AF_XDP_API_MODE_COPY AfXdpMode = 1 40 AF_XDP_API_MODE_ZERO_COPY AfXdpMode = 2 41 ) 42 43 var ( 44 AfXdpMode_name = map[uint32]string{ 45 0: "AF_XDP_API_MODE_AUTO", 46 1: "AF_XDP_API_MODE_COPY", 47 2: "AF_XDP_API_MODE_ZERO_COPY", 48 } 49 AfXdpMode_value = map[string]uint32{ 50 "AF_XDP_API_MODE_AUTO": 0, 51 "AF_XDP_API_MODE_COPY": 1, 52 "AF_XDP_API_MODE_ZERO_COPY": 2, 53 } 54 ) 55 56 func (x AfXdpMode) String() string { 57 s, ok := AfXdpMode_name[uint32(x)] 58 if ok { 59 return s 60 } 61 return "AfXdpMode(" + strconv.Itoa(int(x)) + ")" 62 } 63 64 // AfXdpFlag defines enum 'af_xdp_flag'. 65 type AfXdpFlag uint8 66 67 const ( 68 AF_XDP_API_FLAGS_NO_SYSCALL_LOCK AfXdpFlag = 1 69 ) 70 71 var ( 72 AfXdpFlag_name = map[uint8]string{ 73 1: "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK", 74 } 75 AfXdpFlag_value = map[string]uint8{ 76 "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK": 1, 77 } 78 ) 79 80 func (x AfXdpFlag) String() string { 81 s, ok := AfXdpFlag_name[uint8(x)] 82 if ok { 83 return s 84 } 85 str := func(n uint8) string { 86 s, ok := AfXdpFlag_name[uint8(n)] 87 if ok { 88 return s 89 } 90 return "AfXdpFlag(" + strconv.Itoa(int(n)) + ")" 91 } 92 for i := uint8(0); i <= 8; i++ { 93 val := uint8(x) 94 if val&(1<<i) != 0 { 95 if s != "" { 96 s += "|" 97 } 98 s += str(1 << i) 99 } 100 } 101 if s == "" { 102 return str(uint8(x)) 103 } 104 return s 105 } 106 107 // - client_index - opaque cookie to identify the sender 108 // - host_if - Linux netdev interface name 109 // - name - new af_xdp interface name (optional) 110 // - rxq_num - number of receive queues. 65535 can be used as special value to request all available queues (optional) 111 // - rxq_size - receive queue size (optional) 112 // - txq_size - transmit queue size (optional) 113 // - mode - operation mode (optional) 114 // - flags - flags (optional) 115 // - prog - eBPF program path (optional) 116 // 117 // AfXdpCreate defines message 'af_xdp_create'. 118 // Deprecated: the message will be removed in the future versions 119 type AfXdpCreate struct { 120 HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` 121 Name string `binapi:"string[64],name=name" json:"name,omitempty"` 122 RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` 123 RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"` 124 TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"` 125 Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"` 126 Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"` 127 Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"` 128 } 129 130 func (m *AfXdpCreate) Reset() { *m = AfXdpCreate{} } 131 func (*AfXdpCreate) GetMessageName() string { return "af_xdp_create" } 132 func (*AfXdpCreate) GetCrcString() string { return "21226c99" } 133 func (*AfXdpCreate) GetMessageType() api.MessageType { 134 return api.RequestMessage 135 } 136 137 func (m *AfXdpCreate) Size() (size int) { 138 if m == nil { 139 return 0 140 } 141 size += 64 // m.HostIf 142 size += 64 // m.Name 143 size += 2 // m.RxqNum 144 size += 2 // m.RxqSize 145 size += 2 // m.TxqSize 146 size += 4 // m.Mode 147 size += 1 // m.Flags 148 size += 256 // m.Prog 149 return size 150 } 151 func (m *AfXdpCreate) Marshal(b []byte) ([]byte, error) { 152 if b == nil { 153 b = make([]byte, m.Size()) 154 } 155 buf := codec.NewBuffer(b) 156 buf.EncodeString(m.HostIf, 64) 157 buf.EncodeString(m.Name, 64) 158 buf.EncodeUint16(m.RxqNum) 159 buf.EncodeUint16(m.RxqSize) 160 buf.EncodeUint16(m.TxqSize) 161 buf.EncodeUint32(uint32(m.Mode)) 162 buf.EncodeUint8(uint8(m.Flags)) 163 buf.EncodeString(m.Prog, 256) 164 return buf.Bytes(), nil 165 } 166 func (m *AfXdpCreate) Unmarshal(b []byte) error { 167 buf := codec.NewBuffer(b) 168 m.HostIf = buf.DecodeString(64) 169 m.Name = buf.DecodeString(64) 170 m.RxqNum = buf.DecodeUint16() 171 m.RxqSize = buf.DecodeUint16() 172 m.TxqSize = buf.DecodeUint16() 173 m.Mode = AfXdpMode(buf.DecodeUint32()) 174 m.Flags = AfXdpFlag(buf.DecodeUint8()) 175 m.Prog = buf.DecodeString(256) 176 return nil 177 } 178 179 // - context - sender context, to match reply w/ request 180 // - retval - return value for request 181 // - sw_if_index - software index for the new af_xdp interface 182 // 183 // AfXdpCreateReply defines message 'af_xdp_create_reply'. 184 // Deprecated: the message will be removed in the future versions 185 type AfXdpCreateReply struct { 186 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 187 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 188 } 189 190 func (m *AfXdpCreateReply) Reset() { *m = AfXdpCreateReply{} } 191 func (*AfXdpCreateReply) GetMessageName() string { return "af_xdp_create_reply" } 192 func (*AfXdpCreateReply) GetCrcString() string { return "5383d31f" } 193 func (*AfXdpCreateReply) GetMessageType() api.MessageType { 194 return api.ReplyMessage 195 } 196 197 func (m *AfXdpCreateReply) Size() (size int) { 198 if m == nil { 199 return 0 200 } 201 size += 4 // m.Retval 202 size += 4 // m.SwIfIndex 203 return size 204 } 205 func (m *AfXdpCreateReply) Marshal(b []byte) ([]byte, error) { 206 if b == nil { 207 b = make([]byte, m.Size()) 208 } 209 buf := codec.NewBuffer(b) 210 buf.EncodeInt32(m.Retval) 211 buf.EncodeUint32(uint32(m.SwIfIndex)) 212 return buf.Bytes(), nil 213 } 214 func (m *AfXdpCreateReply) Unmarshal(b []byte) error { 215 buf := codec.NewBuffer(b) 216 m.Retval = buf.DecodeInt32() 217 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 218 return nil 219 } 220 221 // - client_index - opaque cookie to identify the sender 222 // - host_if - Linux netdev interface name 223 // - name - new af_xdp interface name (optional) 224 // - rxq_num - number of receive queues. 65535 can be used as special value to request all available queues (optional) 225 // - rxq_size - receive queue size (optional) 226 // - txq_size - transmit queue size (optional) 227 // - mode - operation mode (optional) 228 // - flags - flags (optional) 229 // - prog - eBPF program path (optional) 230 // - namespace - netns of nic (optional) 231 // 232 // AfXdpCreateV2 defines message 'af_xdp_create_v2'. 233 // Deprecated: the message will be removed in the future versions 234 type AfXdpCreateV2 struct { 235 HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` 236 Name string `binapi:"string[64],name=name" json:"name,omitempty"` 237 RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` 238 RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"` 239 TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"` 240 Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"` 241 Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"` 242 Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"` 243 Namespace string `binapi:"string[64],name=namespace" json:"namespace,omitempty"` 244 } 245 246 func (m *AfXdpCreateV2) Reset() { *m = AfXdpCreateV2{} } 247 func (*AfXdpCreateV2) GetMessageName() string { return "af_xdp_create_v2" } 248 func (*AfXdpCreateV2) GetCrcString() string { return "e17ec2eb" } 249 func (*AfXdpCreateV2) GetMessageType() api.MessageType { 250 return api.RequestMessage 251 } 252 253 func (m *AfXdpCreateV2) Size() (size int) { 254 if m == nil { 255 return 0 256 } 257 size += 64 // m.HostIf 258 size += 64 // m.Name 259 size += 2 // m.RxqNum 260 size += 2 // m.RxqSize 261 size += 2 // m.TxqSize 262 size += 4 // m.Mode 263 size += 1 // m.Flags 264 size += 256 // m.Prog 265 size += 64 // m.Namespace 266 return size 267 } 268 func (m *AfXdpCreateV2) Marshal(b []byte) ([]byte, error) { 269 if b == nil { 270 b = make([]byte, m.Size()) 271 } 272 buf := codec.NewBuffer(b) 273 buf.EncodeString(m.HostIf, 64) 274 buf.EncodeString(m.Name, 64) 275 buf.EncodeUint16(m.RxqNum) 276 buf.EncodeUint16(m.RxqSize) 277 buf.EncodeUint16(m.TxqSize) 278 buf.EncodeUint32(uint32(m.Mode)) 279 buf.EncodeUint8(uint8(m.Flags)) 280 buf.EncodeString(m.Prog, 256) 281 buf.EncodeString(m.Namespace, 64) 282 return buf.Bytes(), nil 283 } 284 func (m *AfXdpCreateV2) Unmarshal(b []byte) error { 285 buf := codec.NewBuffer(b) 286 m.HostIf = buf.DecodeString(64) 287 m.Name = buf.DecodeString(64) 288 m.RxqNum = buf.DecodeUint16() 289 m.RxqSize = buf.DecodeUint16() 290 m.TxqSize = buf.DecodeUint16() 291 m.Mode = AfXdpMode(buf.DecodeUint32()) 292 m.Flags = AfXdpFlag(buf.DecodeUint8()) 293 m.Prog = buf.DecodeString(256) 294 m.Namespace = buf.DecodeString(64) 295 return nil 296 } 297 298 // - context - sender context, to match reply w/ request 299 // - retval - return value for request 300 // - sw_if_index - software index for the new af_xdp interface 301 // 302 // AfXdpCreateV2Reply defines message 'af_xdp_create_v2_reply'. 303 // Deprecated: the message will be removed in the future versions 304 type AfXdpCreateV2Reply struct { 305 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 306 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 307 } 308 309 func (m *AfXdpCreateV2Reply) Reset() { *m = AfXdpCreateV2Reply{} } 310 func (*AfXdpCreateV2Reply) GetMessageName() string { return "af_xdp_create_v2_reply" } 311 func (*AfXdpCreateV2Reply) GetCrcString() string { return "5383d31f" } 312 func (*AfXdpCreateV2Reply) GetMessageType() api.MessageType { 313 return api.ReplyMessage 314 } 315 316 func (m *AfXdpCreateV2Reply) Size() (size int) { 317 if m == nil { 318 return 0 319 } 320 size += 4 // m.Retval 321 size += 4 // m.SwIfIndex 322 return size 323 } 324 func (m *AfXdpCreateV2Reply) Marshal(b []byte) ([]byte, error) { 325 if b == nil { 326 b = make([]byte, m.Size()) 327 } 328 buf := codec.NewBuffer(b) 329 buf.EncodeInt32(m.Retval) 330 buf.EncodeUint32(uint32(m.SwIfIndex)) 331 return buf.Bytes(), nil 332 } 333 func (m *AfXdpCreateV2Reply) Unmarshal(b []byte) error { 334 buf := codec.NewBuffer(b) 335 m.Retval = buf.DecodeInt32() 336 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 337 return nil 338 } 339 340 // - client_index - opaque cookie to identify the sender 341 // - host_if - Linux netdev interface name 342 // - name - new af_xdp interface name (optional) 343 // - rxq_num - number of receive queues. 65535 can be used as special value to request all available queues (optional) 344 // - rxq_size - receive queue size (optional) 345 // - txq_size - transmit queue size (optional) 346 // - mode - operation mode (optional) 347 // - flags - flags (optional) 348 // - prog - eBPF program path (optional) 349 // - netns - netns of nic (optional) 350 // 351 // AfXdpCreateV3 defines message 'af_xdp_create_v3'. 352 type AfXdpCreateV3 struct { 353 HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"` 354 Name string `binapi:"string[64],name=name" json:"name,omitempty"` 355 RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"` 356 RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"` 357 TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"` 358 Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"` 359 Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"` 360 Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"` 361 Netns string `binapi:"string[64],name=netns" json:"netns,omitempty"` 362 } 363 364 func (m *AfXdpCreateV3) Reset() { *m = AfXdpCreateV3{} } 365 func (*AfXdpCreateV3) GetMessageName() string { return "af_xdp_create_v3" } 366 func (*AfXdpCreateV3) GetCrcString() string { return "cf4b1827" } 367 func (*AfXdpCreateV3) GetMessageType() api.MessageType { 368 return api.RequestMessage 369 } 370 371 func (m *AfXdpCreateV3) Size() (size int) { 372 if m == nil { 373 return 0 374 } 375 size += 64 // m.HostIf 376 size += 64 // m.Name 377 size += 2 // m.RxqNum 378 size += 2 // m.RxqSize 379 size += 2 // m.TxqSize 380 size += 4 // m.Mode 381 size += 1 // m.Flags 382 size += 256 // m.Prog 383 size += 64 // m.Netns 384 return size 385 } 386 func (m *AfXdpCreateV3) Marshal(b []byte) ([]byte, error) { 387 if b == nil { 388 b = make([]byte, m.Size()) 389 } 390 buf := codec.NewBuffer(b) 391 buf.EncodeString(m.HostIf, 64) 392 buf.EncodeString(m.Name, 64) 393 buf.EncodeUint16(m.RxqNum) 394 buf.EncodeUint16(m.RxqSize) 395 buf.EncodeUint16(m.TxqSize) 396 buf.EncodeUint32(uint32(m.Mode)) 397 buf.EncodeUint8(uint8(m.Flags)) 398 buf.EncodeString(m.Prog, 256) 399 buf.EncodeString(m.Netns, 64) 400 return buf.Bytes(), nil 401 } 402 func (m *AfXdpCreateV3) Unmarshal(b []byte) error { 403 buf := codec.NewBuffer(b) 404 m.HostIf = buf.DecodeString(64) 405 m.Name = buf.DecodeString(64) 406 m.RxqNum = buf.DecodeUint16() 407 m.RxqSize = buf.DecodeUint16() 408 m.TxqSize = buf.DecodeUint16() 409 m.Mode = AfXdpMode(buf.DecodeUint32()) 410 m.Flags = AfXdpFlag(buf.DecodeUint8()) 411 m.Prog = buf.DecodeString(256) 412 m.Netns = buf.DecodeString(64) 413 return nil 414 } 415 416 // - context - sender context, to match reply w/ request 417 // - retval - return value for request 418 // - sw_if_index - software index for the new af_xdp interface 419 // 420 // AfXdpCreateV3Reply defines message 'af_xdp_create_v3_reply'. 421 type AfXdpCreateV3Reply struct { 422 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 423 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 424 } 425 426 func (m *AfXdpCreateV3Reply) Reset() { *m = AfXdpCreateV3Reply{} } 427 func (*AfXdpCreateV3Reply) GetMessageName() string { return "af_xdp_create_v3_reply" } 428 func (*AfXdpCreateV3Reply) GetCrcString() string { return "5383d31f" } 429 func (*AfXdpCreateV3Reply) GetMessageType() api.MessageType { 430 return api.ReplyMessage 431 } 432 433 func (m *AfXdpCreateV3Reply) Size() (size int) { 434 if m == nil { 435 return 0 436 } 437 size += 4 // m.Retval 438 size += 4 // m.SwIfIndex 439 return size 440 } 441 func (m *AfXdpCreateV3Reply) Marshal(b []byte) ([]byte, error) { 442 if b == nil { 443 b = make([]byte, m.Size()) 444 } 445 buf := codec.NewBuffer(b) 446 buf.EncodeInt32(m.Retval) 447 buf.EncodeUint32(uint32(m.SwIfIndex)) 448 return buf.Bytes(), nil 449 } 450 func (m *AfXdpCreateV3Reply) Unmarshal(b []byte) error { 451 buf := codec.NewBuffer(b) 452 m.Retval = buf.DecodeInt32() 453 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 454 return nil 455 } 456 457 // AfXdpDelete defines message 'af_xdp_delete'. 458 type AfXdpDelete struct { 459 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"` 460 } 461 462 func (m *AfXdpDelete) Reset() { *m = AfXdpDelete{} } 463 func (*AfXdpDelete) GetMessageName() string { return "af_xdp_delete" } 464 func (*AfXdpDelete) GetCrcString() string { return "f9e6675e" } 465 func (*AfXdpDelete) GetMessageType() api.MessageType { 466 return api.RequestMessage 467 } 468 469 func (m *AfXdpDelete) Size() (size int) { 470 if m == nil { 471 return 0 472 } 473 size += 4 // m.SwIfIndex 474 return size 475 } 476 func (m *AfXdpDelete) Marshal(b []byte) ([]byte, error) { 477 if b == nil { 478 b = make([]byte, m.Size()) 479 } 480 buf := codec.NewBuffer(b) 481 buf.EncodeUint32(uint32(m.SwIfIndex)) 482 return buf.Bytes(), nil 483 } 484 func (m *AfXdpDelete) Unmarshal(b []byte) error { 485 buf := codec.NewBuffer(b) 486 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) 487 return nil 488 } 489 490 // AfXdpDeleteReply defines message 'af_xdp_delete_reply'. 491 type AfXdpDeleteReply struct { 492 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"` 493 } 494 495 func (m *AfXdpDeleteReply) Reset() { *m = AfXdpDeleteReply{} } 496 func (*AfXdpDeleteReply) GetMessageName() string { return "af_xdp_delete_reply" } 497 func (*AfXdpDeleteReply) GetCrcString() string { return "e8d4e804" } 498 func (*AfXdpDeleteReply) GetMessageType() api.MessageType { 499 return api.ReplyMessage 500 } 501 502 func (m *AfXdpDeleteReply) Size() (size int) { 503 if m == nil { 504 return 0 505 } 506 size += 4 // m.Retval 507 return size 508 } 509 func (m *AfXdpDeleteReply) Marshal(b []byte) ([]byte, error) { 510 if b == nil { 511 b = make([]byte, m.Size()) 512 } 513 buf := codec.NewBuffer(b) 514 buf.EncodeInt32(m.Retval) 515 return buf.Bytes(), nil 516 } 517 func (m *AfXdpDeleteReply) Unmarshal(b []byte) error { 518 buf := codec.NewBuffer(b) 519 m.Retval = buf.DecodeInt32() 520 return nil 521 } 522 523 func init() { file_af_xdp_binapi_init() } 524 func file_af_xdp_binapi_init() { 525 api.RegisterMessage((*AfXdpCreate)(nil), "af_xdp_create_21226c99") 526 api.RegisterMessage((*AfXdpCreateReply)(nil), "af_xdp_create_reply_5383d31f") 527 api.RegisterMessage((*AfXdpCreateV2)(nil), "af_xdp_create_v2_e17ec2eb") 528 api.RegisterMessage((*AfXdpCreateV2Reply)(nil), "af_xdp_create_v2_reply_5383d31f") 529 api.RegisterMessage((*AfXdpCreateV3)(nil), "af_xdp_create_v3_cf4b1827") 530 api.RegisterMessage((*AfXdpCreateV3Reply)(nil), "af_xdp_create_v3_reply_5383d31f") 531 api.RegisterMessage((*AfXdpDelete)(nil), "af_xdp_delete_f9e6675e") 532 api.RegisterMessage((*AfXdpDeleteReply)(nil), "af_xdp_delete_reply_e8d4e804") 533 } 534 535 // Messages returns list of all messages in this module. 536 func AllMessages() []api.Message { 537 return []api.Message{ 538 (*AfXdpCreate)(nil), 539 (*AfXdpCreateReply)(nil), 540 (*AfXdpCreateV2)(nil), 541 (*AfXdpCreateV2Reply)(nil), 542 (*AfXdpCreateV3)(nil), 543 (*AfXdpCreateV3Reply)(nil), 544 (*AfXdpDelete)(nil), 545 (*AfXdpDeleteReply)(nil), 546 } 547 }