1 // Code generated by GoVPP's binapi-generator. DO NOT EDIT.
3 // binapi-generator: v0.4.0-dev
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 = 0x31450826
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 // InProgress: the message form may change in the future versions
110 type AfXdpCreate struct {
111 HostIf string `binapi:"string[64],name=host_if" json:"host_if,omitempty"`
112 Name string `binapi:"string[64],name=name" json:"name,omitempty"`
113 RxqNum uint16 `binapi:"u16,name=rxq_num,default=1" json:"rxq_num,omitempty"`
114 RxqSize uint16 `binapi:"u16,name=rxq_size,default=0" json:"rxq_size,omitempty"`
115 TxqSize uint16 `binapi:"u16,name=txq_size,default=0" json:"txq_size,omitempty"`
116 Mode AfXdpMode `binapi:"af_xdp_mode,name=mode,default=0" json:"mode,omitempty"`
117 Flags AfXdpFlag `binapi:"af_xdp_flag,name=flags,default=0" json:"flags,omitempty"`
118 Prog string `binapi:"string[256],name=prog" json:"prog,omitempty"`
121 func (m *AfXdpCreate) Reset() { *m = AfXdpCreate{} }
122 func (*AfXdpCreate) GetMessageName() string { return "af_xdp_create" }
123 func (*AfXdpCreate) GetCrcString() string { return "21226c99" }
124 func (*AfXdpCreate) GetMessageType() api.MessageType {
125 return api.RequestMessage
128 func (m *AfXdpCreate) Size() (size int) {
132 size += 64 // m.HostIf
134 size += 2 // m.RxqNum
135 size += 2 // m.RxqSize
136 size += 2 // m.TxqSize
139 size += 256 // m.Prog
142 func (m *AfXdpCreate) Marshal(b []byte) ([]byte, error) {
144 b = make([]byte, m.Size())
146 buf := codec.NewBuffer(b)
147 buf.EncodeString(m.HostIf, 64)
148 buf.EncodeString(m.Name, 64)
149 buf.EncodeUint16(m.RxqNum)
150 buf.EncodeUint16(m.RxqSize)
151 buf.EncodeUint16(m.TxqSize)
152 buf.EncodeUint32(uint32(m.Mode))
153 buf.EncodeUint8(uint8(m.Flags))
154 buf.EncodeString(m.Prog, 256)
155 return buf.Bytes(), nil
157 func (m *AfXdpCreate) Unmarshal(b []byte) error {
158 buf := codec.NewBuffer(b)
159 m.HostIf = buf.DecodeString(64)
160 m.Name = buf.DecodeString(64)
161 m.RxqNum = buf.DecodeUint16()
162 m.RxqSize = buf.DecodeUint16()
163 m.TxqSize = buf.DecodeUint16()
164 m.Mode = AfXdpMode(buf.DecodeUint32())
165 m.Flags = AfXdpFlag(buf.DecodeUint8())
166 m.Prog = buf.DecodeString(256)
170 // AfXdpCreateReply defines message 'af_xdp_create_reply'.
171 // InProgress: the message form may change in the future versions
172 type AfXdpCreateReply struct {
173 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
174 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
177 func (m *AfXdpCreateReply) Reset() { *m = AfXdpCreateReply{} }
178 func (*AfXdpCreateReply) GetMessageName() string { return "af_xdp_create_reply" }
179 func (*AfXdpCreateReply) GetCrcString() string { return "5383d31f" }
180 func (*AfXdpCreateReply) GetMessageType() api.MessageType {
181 return api.ReplyMessage
184 func (m *AfXdpCreateReply) Size() (size int) {
188 size += 4 // m.Retval
189 size += 4 // m.SwIfIndex
192 func (m *AfXdpCreateReply) Marshal(b []byte) ([]byte, error) {
194 b = make([]byte, m.Size())
196 buf := codec.NewBuffer(b)
197 buf.EncodeInt32(m.Retval)
198 buf.EncodeUint32(uint32(m.SwIfIndex))
199 return buf.Bytes(), nil
201 func (m *AfXdpCreateReply) Unmarshal(b []byte) error {
202 buf := codec.NewBuffer(b)
203 m.Retval = buf.DecodeInt32()
204 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
208 // AfXdpDelete defines message 'af_xdp_delete'.
209 // InProgress: the message form may change in the future versions
210 type AfXdpDelete struct {
211 SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
214 func (m *AfXdpDelete) Reset() { *m = AfXdpDelete{} }
215 func (*AfXdpDelete) GetMessageName() string { return "af_xdp_delete" }
216 func (*AfXdpDelete) GetCrcString() string { return "f9e6675e" }
217 func (*AfXdpDelete) GetMessageType() api.MessageType {
218 return api.RequestMessage
221 func (m *AfXdpDelete) Size() (size int) {
225 size += 4 // m.SwIfIndex
228 func (m *AfXdpDelete) Marshal(b []byte) ([]byte, error) {
230 b = make([]byte, m.Size())
232 buf := codec.NewBuffer(b)
233 buf.EncodeUint32(uint32(m.SwIfIndex))
234 return buf.Bytes(), nil
236 func (m *AfXdpDelete) Unmarshal(b []byte) error {
237 buf := codec.NewBuffer(b)
238 m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
242 // AfXdpDeleteReply defines message 'af_xdp_delete_reply'.
243 // InProgress: the message form may change in the future versions
244 type AfXdpDeleteReply struct {
245 Retval int32 `binapi:"i32,name=retval" json:"retval,omitempty"`
248 func (m *AfXdpDeleteReply) Reset() { *m = AfXdpDeleteReply{} }
249 func (*AfXdpDeleteReply) GetMessageName() string { return "af_xdp_delete_reply" }
250 func (*AfXdpDeleteReply) GetCrcString() string { return "e8d4e804" }
251 func (*AfXdpDeleteReply) GetMessageType() api.MessageType {
252 return api.ReplyMessage
255 func (m *AfXdpDeleteReply) Size() (size int) {
259 size += 4 // m.Retval
262 func (m *AfXdpDeleteReply) Marshal(b []byte) ([]byte, error) {
264 b = make([]byte, m.Size())
266 buf := codec.NewBuffer(b)
267 buf.EncodeInt32(m.Retval)
268 return buf.Bytes(), nil
270 func (m *AfXdpDeleteReply) Unmarshal(b []byte) error {
271 buf := codec.NewBuffer(b)
272 m.Retval = buf.DecodeInt32()
276 func init() { file_af_xdp_binapi_init() }
277 func file_af_xdp_binapi_init() {
278 api.RegisterMessage((*AfXdpCreate)(nil), "af_xdp_create_21226c99")
279 api.RegisterMessage((*AfXdpCreateReply)(nil), "af_xdp_create_reply_5383d31f")
280 api.RegisterMessage((*AfXdpDelete)(nil), "af_xdp_delete_f9e6675e")
281 api.RegisterMessage((*AfXdpDeleteReply)(nil), "af_xdp_delete_reply_e8d4e804")
284 // Messages returns list of all messages in this module.
285 func AllMessages() []api.Message {
286 return []api.Message{
288 (*AfXdpCreateReply)(nil),
290 (*AfXdpDeleteReply)(nil),