summaryrefslogtreecommitdiffstats
path: root/binapi/af_xdp/af_xdp.ba.go
blob: a4154c84bb6b68e6b8d6683cbbd746a948a806e2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
//  binapi-generator: v0.5.0-dev
//  VPP:              22.02-release
// source: /usr/share/vpp/api/plugins/af_xdp.api.json

// Package af_xdp contains generated bindings for API file af_xdp.api.
//
// Contents:
//   2 enums
//   6 messages
//
package af_xdp

import (
	"strconv"

	api "git.fd.io/govpp.git/api"
	interface_types "git.fd.io/govpp.git/binapi/interface_types"
	codec "git.fd.io/govpp.git/codec"
)

// This is a compile-time assertion to ensure that this generated file
// is compatible with the GoVPP api package it is being compiled against.
// A compilation error at this line likely means your copy of the
// GoVPP api package needs to be updated.
const _ = api.GoVppAPIPackageIsVersion2

const (
	APIFile    = "af_xdp"
	APIVersion = "1.0.0"
	VersionCrc = 0x346626ce
)

// AfXdpMode defines enum 'af_xdp_mode'.
type AfXdpMode uint32

const (
	AF_XDP_API_MODE_AUTO      AfXdpMode = 0
	AF_XDP_API_MODE_COPY      AfXdpMode = 1
	AF_XDP_API_MODE_ZERO_COPY AfXdpMode = 2
)

var (
	AfXdpMode_name = map[uint32]string{
		0: "AF_XDP_API_MODE_AUTO",
		1: "AF_XDP_API_MODE_COPY",
		2: "AF_XDP_API_MODE_ZERO_COPY",
	}
	AfXdpMode_value = map[string]uint32{
		"AF_XDP_API_MODE_AUTO":      0,
		"AF_XDP_API_MODE_COPY":      1,
		"AF_XDP_API_MODE_ZERO_COPY": 2,
	}
)

func (x AfXdpMode) String() string {
	s, ok := AfXdpMode_name[uint32(x)]
	if ok {
		return s
	}
	return "AfXdpMode(" + strconv.Itoa(int(x)) + ")"
}

// AfXdpFlag defines enum 'af_xdp_flag'.
type AfXdpFlag uint8

const (
	AF_XDP_API_FLAGS_NO_SYSCALL_LOCK AfXdpFlag = 1
)

var (
	AfXdpFlag_name = map[uint8]string{
		1: "AF_XDP_API_FLAGS_NO_SYSCALL_LOCK",
	}
	AfXdpFlag_value = map[string]uint8{
		"AF_XDP_API_FLAGS_NO_SYSCALL_LOCK": 1,
	}
)

func (x AfXdpFlag) String() string {
	s, ok := AfXdpFlag_name[uint8(x)]
	if ok {
		return s
	}
	str := func(n uint8) string {
		s, ok := AfXdpFlag_name[uint8(n)]
		if ok {
			return s
		}
		return "AfXdpFlag(" + strconv.Itoa(int(n)) + ")"
	}
	for i := uint8(0); i <= 8; i++ {
		val := uint8(x)
		if val&(1<<i) != 0 {
			if s != "" {
				s += "|"
			}
			s += str(1 << i)
		}
	}
	if s == "" {
		return str(uint8(x))
	}
	return s
}

// AfXdpCreate defines message 'af_xdp_create'.
type AfXdpCreate struct {
	HostIf  string    `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
	Name    string    `binapi:"string[64],name=name" json:"name,omitempty"`
	RxqNum  uint16    `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
	RxqSize uint16    `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
	TxqSize uint16    `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
	Mode    AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
	Flags   AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
	Prog    string    `binapi:"string[256],name=prog" json:"prog,omitempty"`
}

func (m *AfXdpCreate) Reset()               { *m = AfXdpCreate{} }
func (*AfXdpCreate) GetMessageName() string { return "af_xdp_create" }
func (*AfXdpCreate) GetCrcString() string   { return "21226c99" }
func (*AfXdpCreate) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *AfXdpCreate) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 64  // m.HostIf
	size += 64  // m.Name
	size += 2   // m.RxqNum
	size += 2   // m.RxqSize
	size += 2   // m.TxqSize
	size += 4   // m.Mode
	size += 1   // m.Flags
	size += 256 // m.Prog
	return size
}
func (m *AfXdpCreate) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeString(m.HostIf, 64)
	buf.EncodeString(m.Name, 64)
	buf.EncodeUint16(m.RxqNum)
	buf.EncodeUint16(m.RxqSize)
	buf.EncodeUint16(m.TxqSize)
	buf.EncodeUint32(uint32(m.Mode))
	buf.EncodeUint8(uint8(m.Flags))
	buf.EncodeString(m.Prog, 256)
	return buf.Bytes(), nil
}
func (m *AfXdpCreate) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.HostIf = buf.DecodeString(64)
	m.Name = buf.DecodeString(64)
	m.RxqNum = buf.DecodeUint16()
	m.RxqSize = buf.DecodeUint16()
	m.TxqSize = buf.DecodeUint16()
	m.Mode = AfXdpMode(buf.DecodeUint32())
	m.Flags = AfXdpFlag(buf.DecodeUint8())
	m.Prog = buf.DecodeString(256)
	return nil
}

// AfXdpCreateReply defines message 'af_xdp_create_reply'.
type AfXdpCreateReply struct {
	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *AfXdpCreateReply) Reset()               { *m = AfXdpCreateReply{} }
func (*AfXdpCreateReply) GetMessageName() string { return "af_xdp_create_reply" }
func (*AfXdpCreateReply) GetCrcString() string   { return "5383d31f" }
func (*AfXdpCreateReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *AfXdpCreateReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	size += 4 // m.SwIfIndex
	return size
}
func (m *AfXdpCreateReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *AfXdpCreateReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

// AfXdpCreateV2 defines message 'af_xdp_create_v2'.
type AfXdpCreateV2 struct {
	HostIf    string    `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
	Name      string    `binapi:"string[64],name=name" json:"name,omitempty"`
	RxqNum    uint16    `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
	RxqSize   uint16    `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
	TxqSize   uint16    `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
	Mode      AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
	Flags     AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
	Prog      string    `binapi:"string[256],name=prog" json:"prog,omitempty"`
	Namespace string    `binapi:"string[64],name=namespace" json:"namespace,omitempty"`
}

func (m *AfXdpCreateV2) Reset()               { *m = AfXdpCreateV2{} }
func (*AfXdpCreateV2) GetMessageName() string { return "af_xdp_create_v2" }
func (*AfXdpCreateV2) GetCrcString() string   { return "e17ec2eb" }
func (*AfXdpCreateV2) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *AfXdpCreateV2) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 64  // m.HostIf
	size += 64  // m.Name
	size += 2   // m.RxqNum
	size += 2   // m.RxqSize
	size += 2   // m.TxqSize
	size += 4   // m.Mode
	size += 1   // m.Flags
	size += 256 // m.Prog
	size += 64  // m.Namespace
	return size
}
func (m *AfXdpCreateV2) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeString(m.HostIf, 64)
	buf.EncodeString(m.Name, 64)
	buf.EncodeUint16(m.RxqNum)
	buf.EncodeUint16(m.RxqSize)
	buf.EncodeUint16(m.TxqSize)
	buf.EncodeUint32(uint32(m.Mode))
	buf.EncodeUint8(uint8(m.Flags))
	buf.EncodeString(m.Prog, 256)
	buf.EncodeString(m.Namespace, 64)
	return buf.Bytes(), nil
}
func (m *AfXdpCreateV2) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.HostIf = buf.DecodeString(64)
	m.Name = buf.DecodeString(64)
	m.RxqNum = buf.DecodeUint16()
	m.RxqSize = buf.DecodeUint16()
	m.TxqSize = buf.DecodeUint16()
	m.Mode = AfXdpMode(buf.DecodeUint32())
	m.Flags = AfXdpFlag(buf.DecodeUint8())
	m.Prog = buf.DecodeString(256)
	m.Namespace = buf.DecodeString(64)
	return nil
}

// AfXdpCreateV2Reply defines message 'af_xdp_create_v2_reply'.
type AfXdpCreateV2Reply struct {
	Retval    int32                          `binapi:"i32,name=retval" json:"retval,omitempty"`
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *AfXdpCreateV2Reply) Reset()               { *m = AfXdpCreateV2Reply{} }
func (*AfXdpCreateV2Reply) GetMessageName() string { return "af_xdp_create_v2_reply" }
func (*AfXdpCreateV2Reply) GetCrcString() string   { return "5383d31f" }
func (*AfXdpCreateV2Reply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *AfXdpCreateV2Reply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	size += 4 // m.SwIfIndex
	return size
}
func (m *AfXdpCreateV2Reply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *AfXdpCreateV2Reply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

// AfXdpDelete defines message 'af_xdp_delete'.
type AfXdpDelete struct {
	SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
}

func (m *AfXdpDelete) Reset()               { *m = AfXdpDelete{} }
func (*AfXdpDelete) GetMessageName() string { return "af_xdp_delete" }
func (*AfXdpDelete) GetCrcString() string   { return "f9e6675e" }
func (*AfXdpDelete) GetMessageType() api.MessageType {
	return api.RequestMessage
}

func (m *AfXdpDelete) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.SwIfIndex
	return size
}
func (m *AfXdpDelete) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeUint32(uint32(m.SwIfIndex))
	return buf.Bytes(), nil
}
func (m *AfXdpDelete) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
	return nil
}

// AfXdpDeleteReply defines message 'af_xdp_delete_reply'.
type AfXdpDeleteReply struct {
	Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
}

func (m *AfXdpDeleteReply) Reset()               { *m = AfXdpDeleteReply{} }
func (*AfXdpDeleteReply) GetMessageName() string { return "af_xdp_delete_reply" }
func (*AfXdpDeleteReply) GetCrcString() string   { return "e8d4e804" }
func (*AfXdpDeleteReply) GetMessageType() api.MessageType {
	return api.ReplyMessage
}

func (m *AfXdpDeleteReply) Size() (size int) {
	if m == nil {
		return 0
	}
	size += 4 // m.Retval
	return size
}
func (m *AfXdpDeleteReply) Marshal(b []byte) ([]byte, error) {
	if b == nil {
		b = make([]byte, m.Size())
	}
	buf := codec.NewBuffer(b)
	buf.EncodeInt32(m.Retval)
	return buf.Bytes(), nil
}
func (m *AfXdpDeleteReply) Unmarshal(b []byte) error {
	buf := codec.NewBuffer(b)
	m.Retval = buf.DecodeInt32()
	return nil
}

func init() { file_af_xdp_binapi_init() }
func file_af_xdp_binapi_init() {
	api.RegisterMessage((*AfXdpCreate)(nil), "af_xdp_create_21226c99")
	api.RegisterMessage((*AfXdpCreateReply)(nil), "af_xdp_create_reply_5383d31f")
	api.RegisterMessage((*AfXdpCreateV2)(nil), "af_xdp_create_v2_e17ec2eb")
	api.RegisterMessage((*AfXdpCreateV2Reply)(nil), "af_xdp_create_v2_reply_5383d31f")
	api.RegisterMessage((*AfXdpDelete)(nil), "af_xdp_delete_f9e6675e")
	api.RegisterMessage((*AfXdpDeleteReply)(nil), "af_xdp_delete_reply_e8d4e804")
}

// Messages returns list of all messages in this module.
func AllMessages() []api.Message {
	return []api.Message{
		(*AfXdpCreate)(nil),
		(*AfXdpCreateReply)(nil),
		(*AfXdpCreateV2)(nil),
		(*AfXdpCreateV2Reply)(nil),
		(*AfXdpDelete)(nil),
		(*AfXdpDeleteReply)(nil),
	}
}