1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.5.0
5 // source: /usr/share/vpp/api/plugins/af_xdp.api.json
7 // Package af_xdp contains generated bindings for API file af_xdp.api.
18 api "git.fd.io/govpp.git/api"
19 interface_types "git.fd.io/govpp.git/binapi/interface_types"
20 codec "git.fd.io/govpp.git/codec"
23 // This is a compile-time assertion to ensure that this generated file
24 // is compatible with the GoVPP api package it is being compiled against.
25 // A compilation error at this line likely means your copy of the
26 // GoVPP api package needs to be updated.
27 const _ = api.GoVppAPIPackageIsVersion2
32 VersionCrc = 0x346626ce
35 // AfXdpMode defines enum 'af_xdp_mode'.
39 AF_XDP_API_MODE_AUTO AfXdpMode = 0
40 AF_XDP_API_MODE_COPY AfXdpMode = 1
41 AF_XDP_API_MODE_ZERO_COPY AfXdpMode = 2
45 AfXdpMode_name = map[uint32]string{
46 0: "AF_XDP_API_MODE_AUTO",
47 1: "AF_XDP_API_MODE_COPY",
48 2: "AF_XDP_API_MODE_ZERO_COPY",
50 AfXdpMode_value = map[string]uint32{
51 "AF_XDP_API_MODE_AUTO": 0,
52 "AF_XDP_API_MODE_COPY": 1,
53 "AF_XDP_API_MODE_ZERO_COPY": 2,
57 func (x AfXdpMode) String() string {
58 s, ok := AfXdpMode_name[uint32(x)]
62 return "AfXdpMode(" + strconv.Itoa(int(x)) + ")"
65 // AfXdpFlag defines enum 'af_xdp_flag'.
69 AF_XDP_API_FLAGS_NO_SYSCALL_LOCK AfXdpFlag = 1
73 AfXdpFlag_name = map[uint8]string{
74 1: "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK",
76 AfXdpFlag_value = map[string]uint8{
77 "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK": 1,
81 func (x AfXdpFlag) String() string {
82 s, ok := AfXdpFlag_name[uint8(x)]
86 str := func(n uint8) string {
87 s, ok := AfXdpFlag_name[uint8(n)]
91 return "AfXdpFlag(" + strconv.Itoa(int(n)) + ")"
93 for i := uint8(0); i <= 8; i++ {
108 // AfXdpCreate defines message 'af_xdp_create'.
109 type AfXdpCreate struct {
110 HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
111 Name string `binapi:"string[64],name=name" json:"name,omitempty"`
112 RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
113 RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
114 TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
115 Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
116 Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
117 Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"`
120 func (m *AfXdpCreate) Reset() { *m = AfXdpCreate{} }
121 func (*AfXdpCreate) GetMessageName() string { return "af_xdp_create" }
122 func (*AfXdpCreate) GetCrcString() string { return "21226c99" }
123 func (*AfXdpCreate) GetMessageType() api.MessageType {
124 return api.RequestMessage
127 func (m *AfXdpCreate) Size() (size int) {
131 size += 64 // m.HostIf
133 size += 2 // m.RxqNum
134 size += 2 // m.RxqSize
135 size += 2 // m.TxqSize
138 size += 256 // m.Prog
141 func (m *AfXdpCreate) Marshal(b []byte) ([]byte, error) {
143 b = make([]byte, m.Size())
145 buf := codec.NewBuffer(b)
146 buf.EncodeString(m.HostIf, 64)
147 buf.EncodeString(m.Name, 64)
148 buf.EncodeUint16(m.RxqNum)
149 buf.EncodeUint16(m.RxqSize)
150 buf.EncodeUint16(m.TxqSize)
151 buf.EncodeUint32(uint32(m.Mode))
152 buf.EncodeUint8(uint8(m.Flags))
153 buf.EncodeString(m.Prog, 256)
154 return buf.Bytes(), nil
156 func (m *AfXdpCreate) Unmarshal(b []byte) error {
157 buf := codec.NewBuffer(b)
158 m.HostIf = buf.DecodeString(64)
159 m.Name = buf.DecodeString(64)
160 m.RxqNum = buf.DecodeUint16()
161 m.RxqSize = buf.DecodeUint16()
162 m.TxqSize = buf.DecodeUint16()
163 m.Mode = AfXdpMode(buf.DecodeUint32())
164 m.Flags = AfXdpFlag(buf.DecodeUint8())
165 m.Prog = buf.DecodeString(256)
169 // AfXdpCreateReply defines message 'af_xdp_create_reply'.
170 type AfXdpCreateReply struct {
171 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
172 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
175 func (m *AfXdpCreateReply) Reset() { *m = AfXdpCreateReply{} }
176 func (*AfXdpCreateReply) GetMessageName() string { return "af_xdp_create_reply" }
177 func (*AfXdpCreateReply) GetCrcString() string { return "5383d31f" }
178 func (*AfXdpCreateReply) GetMessageType() api.MessageType {
179 return api.ReplyMessage
182 func (m *AfXdpCreateReply) Size() (size int) {
186 size += 4 // m.Retval
187 size += 4 // m.SwIfIndex
190 func (m *AfXdpCreateReply) Marshal(b []byte) ([]byte, error) {
192 b = make([]byte, m.Size())
194 buf := codec.NewBuffer(b)
195 buf.EncodeInt32(m.Retval)
196 buf.EncodeUint32(uint32(m.SwIfIndex))
197 return buf.Bytes(), nil
199 func (m *AfXdpCreateReply) Unmarshal(b []byte) error {
200 buf := codec.NewBuffer(b)
201 m.Retval = buf.DecodeInt32()
202 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
206 // AfXdpCreateV2 defines message 'af_xdp_create_v2'.
207 type AfXdpCreateV2 struct {
208 HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
209 Name string `binapi:"string[64],name=name" json:"name,omitempty"`
210 RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
211 RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
212 TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
213 Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
214 Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
215 Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"`
216 Namespace string `binapi:"string[64],name=namespace" json:"namespace,omitempty"`
219 func (m *AfXdpCreateV2) Reset() { *m = AfXdpCreateV2{} }
220 func (*AfXdpCreateV2) GetMessageName() string { return "af_xdp_create_v2" }
221 func (*AfXdpCreateV2) GetCrcString() string { return "e17ec2eb" }
222 func (*AfXdpCreateV2) GetMessageType() api.MessageType {
223 return api.RequestMessage
226 func (m *AfXdpCreateV2) Size() (size int) {
230 size += 64 // m.HostIf
232 size += 2 // m.RxqNum
233 size += 2 // m.RxqSize
234 size += 2 // m.TxqSize
237 size += 256 // m.Prog
238 size += 64 // m.Namespace
241 func (m *AfXdpCreateV2) Marshal(b []byte) ([]byte, error) {
243 b = make([]byte, m.Size())
245 buf := codec.NewBuffer(b)
246 buf.EncodeString(m.HostIf, 64)
247 buf.EncodeString(m.Name, 64)
248 buf.EncodeUint16(m.RxqNum)
249 buf.EncodeUint16(m.RxqSize)
250 buf.EncodeUint16(m.TxqSize)
251 buf.EncodeUint32(uint32(m.Mode))
252 buf.EncodeUint8(uint8(m.Flags))
253 buf.EncodeString(m.Prog, 256)
254 buf.EncodeString(m.Namespace, 64)
255 return buf.Bytes(), nil
257 func (m *AfXdpCreateV2) Unmarshal(b []byte) error {
258 buf := codec.NewBuffer(b)
259 m.HostIf = buf.DecodeString(64)
260 m.Name = buf.DecodeString(64)
261 m.RxqNum = buf.DecodeUint16()
262 m.RxqSize = buf.DecodeUint16()
263 m.TxqSize = buf.DecodeUint16()
264 m.Mode = AfXdpMode(buf.DecodeUint32())
265 m.Flags = AfXdpFlag(buf.DecodeUint8())
266 m.Prog = buf.DecodeString(256)
267 m.Namespace = buf.DecodeString(64)
271 // AfXdpCreateV2Reply defines message 'af_xdp_create_v2_reply'.
272 type AfXdpCreateV2Reply struct {
273 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
274 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
277 func (m *AfXdpCreateV2Reply) Reset() { *m = AfXdpCreateV2Reply{} }
278 func (*AfXdpCreateV2Reply) GetMessageName() string { return "af_xdp_create_v2_reply" }
279 func (*AfXdpCreateV2Reply) GetCrcString() string { return "5383d31f" }
280 func (*AfXdpCreateV2Reply) GetMessageType() api.MessageType {
281 return api.ReplyMessage
284 func (m *AfXdpCreateV2Reply) Size() (size int) {
288 size += 4 // m.Retval
289 size += 4 // m.SwIfIndex
292 func (m *AfXdpCreateV2Reply) Marshal(b []byte) ([]byte, error) {
294 b = make([]byte, m.Size())
296 buf := codec.NewBuffer(b)
297 buf.EncodeInt32(m.Retval)
298 buf.EncodeUint32(uint32(m.SwIfIndex))
299 return buf.Bytes(), nil
301 func (m *AfXdpCreateV2Reply) Unmarshal(b []byte) error {
302 buf := codec.NewBuffer(b)
303 m.Retval = buf.DecodeInt32()
304 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
308 // AfXdpDelete defines message 'af_xdp_delete'.
309 type AfXdpDelete struct {
310 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
313 func (m *AfXdpDelete) Reset() { *m = AfXdpDelete{} }
314 func (*AfXdpDelete) GetMessageName() string { return "af_xdp_delete" }
315 func (*AfXdpDelete) GetCrcString() string { return "f9e6675e" }
316 func (*AfXdpDelete) GetMessageType() api.MessageType {
317 return api.RequestMessage
320 func (m *AfXdpDelete) Size() (size int) {
324 size += 4 // m.SwIfIndex
327 func (m *AfXdpDelete) Marshal(b []byte) ([]byte, error) {
329 b = make([]byte, m.Size())
331 buf := codec.NewBuffer(b)
332 buf.EncodeUint32(uint32(m.SwIfIndex))
333 return buf.Bytes(), nil
335 func (m *AfXdpDelete) Unmarshal(b []byte) error {
336 buf := codec.NewBuffer(b)
337 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
341 // AfXdpDeleteReply defines message 'af_xdp_delete_reply'.
342 type AfXdpDeleteReply struct {
343 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
346 func (m *AfXdpDeleteReply) Reset() { *m = AfXdpDeleteReply{} }
347 func (*AfXdpDeleteReply) GetMessageName() string { return "af_xdp_delete_reply" }
348 func (*AfXdpDeleteReply) GetCrcString() string { return "e8d4e804" }
349 func (*AfXdpDeleteReply) GetMessageType() api.MessageType {
350 return api.ReplyMessage
353 func (m *AfXdpDeleteReply) Size() (size int) {
357 size += 4 // m.Retval
360 func (m *AfXdpDeleteReply) Marshal(b []byte) ([]byte, error) {
362 b = make([]byte, m.Size())
364 buf := codec.NewBuffer(b)
365 buf.EncodeInt32(m.Retval)
366 return buf.Bytes(), nil
368 func (m *AfXdpDeleteReply) Unmarshal(b []byte) error {
369 buf := codec.NewBuffer(b)
370 m.Retval = buf.DecodeInt32()
374 func init() { file_af_xdp_binapi_init() }
375 func file_af_xdp_binapi_init() {
376 api.RegisterMessage((*AfXdpCreate)(nil), "af_xdp_create_21226c99")
377 api.RegisterMessage((*AfXdpCreateReply)(nil), "af_xdp_create_reply_5383d31f")
378 api.RegisterMessage((*AfXdpCreateV2)(nil), "af_xdp_create_v2_e17ec2eb")
379 api.RegisterMessage((*AfXdpCreateV2Reply)(nil), "af_xdp_create_v2_reply_5383d31f")
380 api.RegisterMessage((*AfXdpDelete)(nil), "af_xdp_delete_f9e6675e")
381 api.RegisterMessage((*AfXdpDeleteReply)(nil), "af_xdp_delete_reply_e8d4e804")
384 // Messages returns list of all messages in this module.
385 func AllMessages() []api.Message {
386 return []api.Message{
388 (*AfXdpCreateReply)(nil),
389 (*AfXdpCreateV2)(nil),
390 (*AfXdpCreateV2Reply)(nil),
392 (*AfXdpDeleteReply)(nil),