diff options
author | 2022-04-27 18:39:03 +0200 | |
---|---|---|
committer | 2022-05-30 18:49:13 +0200 | |
commit | 4102c72bce694babd94a481b1201d33895a6f9c5 (patch) | |
tree | 1b11238ca4706008c88712f26942dd74ab9c14a6 /binapi/af_packet | |
parent | a4112fac7b86fe09650d2bb57969fe46404edd7d (diff) |
Update generated binapi to v22.02 & makefile changes
This patch does some small updates to the Makefile.
* `make gen-binapi-from-code` is removed, and moves to
`gen-binapi-local`
* `make build` is patched to build cmd & examples
* `make binapi-generator` to build the api-generator
without other binaries, as they typically require its
output to build.
* `make gen-binapi-local` runs the locally built binapi-generator
to update the local bindings. It expects ${VPP_DIR} to be set and
to point to a local vpp repository checked out with the right version
* `make gen-binapi-internal` runs the locally built binapi-generator
to update the bindings in `internal/testbinapi/binapi2001`
Regarding VPP, notable changes when moving to v22.02 are :
- ControlPing moved from vpe to memclnt
- CliInband went from vpe to vlib
Signed-off-by: Nathan Skrzypczak <nathan.skrzypczak@gmail.com>
Change-Id: Ie5cd2d5ded7ecaffd9abc3ca675df40be272b1fa
Diffstat (limited to 'binapi/af_packet')
-rw-r--r-- | binapi/af_packet/af_packet.ba.go | 112 | ||||
-rw-r--r-- | binapi/af_packet/af_packet_rpc.ba.go | 16 |
2 files changed, 122 insertions, 6 deletions
diff --git a/binapi/af_packet/af_packet.ba.go b/binapi/af_packet/af_packet.ba.go index 311a1c2..b2a4590 100644 --- a/binapi/af_packet/af_packet.ba.go +++ b/binapi/af_packet/af_packet.ba.go @@ -1,13 +1,13 @@ // Code generated by GoVPP's binapi-generator. DO NOT EDIT. // versions: // binapi-generator: v0.5.0-dev -// VPP: 21.06-release +// VPP: 22.02-release // source: /usr/share/vpp/api/core/af_packet.api.json // Package af_packet contains generated bindings for API file af_packet.api. // // Contents: -// 8 messages +// 10 messages // package af_packet @@ -27,7 +27,7 @@ const _ = api.GoVppAPIPackageIsVersion2 const ( APIFile = "af_packet" APIVersion = "2.0.0" - VersionCrc = 0x4191e8ae + VersionCrc = 0x589bd50e ) // AfPacketCreate defines message 'af_packet_create'. @@ -108,6 +108,108 @@ func (m *AfPacketCreateReply) Unmarshal(b []byte) error { return nil } +// AfPacketCreateV2 defines message 'af_packet_create_v2'. +type AfPacketCreateV2 struct { + HwAddr ethernet_types.MacAddress `binapi:"mac_address,name=hw_addr" json:"hw_addr,omitempty"` + UseRandomHwAddr bool `binapi:"bool,name=use_random_hw_addr" json:"use_random_hw_addr,omitempty"` + HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` + RxFrameSize uint32 `binapi:"u32,name=rx_frame_size" json:"rx_frame_size,omitempty"` + TxFrameSize uint32 `binapi:"u32,name=tx_frame_size" json:"tx_frame_size,omitempty"` + RxFramesPerBlock uint32 `binapi:"u32,name=rx_frames_per_block" json:"rx_frames_per_block,omitempty"` + TxFramesPerBlock uint32 `binapi:"u32,name=tx_frames_per_block" json:"tx_frames_per_block,omitempty"` + Flags uint32 `binapi:"u32,name=flags" json:"flags,omitempty"` + NumRxQueues uint16 `binapi:"u16,name=num_rx_queues,default=1" json:"num_rx_queues,omitempty"` +} + +func (m *AfPacketCreateV2) Reset() { *m = AfPacketCreateV2{} } +func (*AfPacketCreateV2) GetMessageName() string { return "af_packet_create_v2" } +func (*AfPacketCreateV2) GetCrcString() string { return "4aff0436" } +func (*AfPacketCreateV2) GetMessageType() api.MessageType { + return api.RequestMessage +} + +func (m *AfPacketCreateV2) Size() (size int) { + if m == nil { + return 0 + } + size += 1 * 6 // m.HwAddr + size += 1 // m.UseRandomHwAddr + size += 64 // m.HostIfName + size += 4 // m.RxFrameSize + size += 4 // m.TxFrameSize + size += 4 // m.RxFramesPerBlock + size += 4 // m.TxFramesPerBlock + size += 4 // m.Flags + size += 2 // m.NumRxQueues + return size +} +func (m *AfPacketCreateV2) Marshal(b []byte) ([]byte, error) { + if b == nil { + b = make([]byte, m.Size()) + } + buf := codec.NewBuffer(b) + buf.EncodeBytes(m.HwAddr[:], 6) + buf.EncodeBool(m.UseRandomHwAddr) + buf.EncodeString(m.HostIfName, 64) + buf.EncodeUint32(m.RxFrameSize) + buf.EncodeUint32(m.TxFrameSize) + buf.EncodeUint32(m.RxFramesPerBlock) + buf.EncodeUint32(m.TxFramesPerBlock) + buf.EncodeUint32(m.Flags) + buf.EncodeUint16(m.NumRxQueues) + return buf.Bytes(), nil +} +func (m *AfPacketCreateV2) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + copy(m.HwAddr[:], buf.DecodeBytes(6)) + m.UseRandomHwAddr = buf.DecodeBool() + m.HostIfName = buf.DecodeString(64) + m.RxFrameSize = buf.DecodeUint32() + m.TxFrameSize = buf.DecodeUint32() + m.RxFramesPerBlock = buf.DecodeUint32() + m.TxFramesPerBlock = buf.DecodeUint32() + m.Flags = buf.DecodeUint32() + m.NumRxQueues = buf.DecodeUint16() + return nil +} + +// AfPacketCreateV2Reply defines message 'af_packet_create_v2_reply'. +type AfPacketCreateV2Reply 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 *AfPacketCreateV2Reply) Reset() { *m = AfPacketCreateV2Reply{} } +func (*AfPacketCreateV2Reply) GetMessageName() string { return "af_packet_create_v2_reply" } +func (*AfPacketCreateV2Reply) GetCrcString() string { return "5383d31f" } +func (*AfPacketCreateV2Reply) GetMessageType() api.MessageType { + return api.ReplyMessage +} + +func (m *AfPacketCreateV2Reply) Size() (size int) { + if m == nil { + return 0 + } + size += 4 // m.Retval + size += 4 // m.SwIfIndex + return size +} +func (m *AfPacketCreateV2Reply) 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 *AfPacketCreateV2Reply) Unmarshal(b []byte) error { + buf := codec.NewBuffer(b) + m.Retval = buf.DecodeInt32() + m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32()) + return nil +} + // AfPacketDelete defines message 'af_packet_delete'. type AfPacketDelete struct { HostIfName string `binapi:"string[64],name=host_if_name" json:"host_if_name,omitempty"` @@ -314,6 +416,8 @@ func init() { file_af_packet_binapi_init() } func file_af_packet_binapi_init() { api.RegisterMessage((*AfPacketCreate)(nil), "af_packet_create_a190415f") api.RegisterMessage((*AfPacketCreateReply)(nil), "af_packet_create_reply_5383d31f") + api.RegisterMessage((*AfPacketCreateV2)(nil), "af_packet_create_v2_4aff0436") + api.RegisterMessage((*AfPacketCreateV2Reply)(nil), "af_packet_create_v2_reply_5383d31f") api.RegisterMessage((*AfPacketDelete)(nil), "af_packet_delete_863fa648") api.RegisterMessage((*AfPacketDeleteReply)(nil), "af_packet_delete_reply_e8d4e804") api.RegisterMessage((*AfPacketDetails)(nil), "af_packet_details_58c7c042") @@ -327,6 +431,8 @@ func AllMessages() []api.Message { return []api.Message{ (*AfPacketCreate)(nil), (*AfPacketCreateReply)(nil), + (*AfPacketCreateV2)(nil), + (*AfPacketCreateV2Reply)(nil), (*AfPacketDelete)(nil), (*AfPacketDeleteReply)(nil), (*AfPacketDetails)(nil), diff --git a/binapi/af_packet/af_packet_rpc.ba.go b/binapi/af_packet/af_packet_rpc.ba.go index 27e22fc..3facbca 100644 --- a/binapi/af_packet/af_packet_rpc.ba.go +++ b/binapi/af_packet/af_packet_rpc.ba.go @@ -8,12 +8,13 @@ import ( "io" api "git.fd.io/govpp.git/api" - vpe "git.fd.io/govpp.git/binapi/vpe" + memclnt "git.fd.io/govpp.git/binapi/memclnt" ) // RPCService defines RPC service af_packet. type RPCService interface { AfPacketCreate(ctx context.Context, in *AfPacketCreate) (*AfPacketCreateReply, error) + AfPacketCreateV2(ctx context.Context, in *AfPacketCreateV2) (*AfPacketCreateV2Reply, error) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPCService_AfPacketDumpClient, error) AfPacketSetL4CksumOffload(ctx context.Context, in *AfPacketSetL4CksumOffload) (*AfPacketSetL4CksumOffloadReply, error) @@ -36,6 +37,15 @@ func (c *serviceClient) AfPacketCreate(ctx context.Context, in *AfPacketCreate) return out, api.RetvalToVPPApiError(out.Retval) } +func (c *serviceClient) AfPacketCreateV2(ctx context.Context, in *AfPacketCreateV2) (*AfPacketCreateV2Reply, error) { + out := new(AfPacketCreateV2Reply) + err := c.conn.Invoke(ctx, in, out) + if err != nil { + return nil, err + } + return out, api.RetvalToVPPApiError(out.Retval) +} + func (c *serviceClient) AfPacketDelete(ctx context.Context, in *AfPacketDelete) (*AfPacketDeleteReply, error) { out := new(AfPacketDeleteReply) err := c.conn.Invoke(ctx, in, out) @@ -54,7 +64,7 @@ func (c *serviceClient) AfPacketDump(ctx context.Context, in *AfPacketDump) (RPC if err := x.Stream.SendMsg(in); err != nil { return nil, err } - if err = x.Stream.SendMsg(&vpe.ControlPing{}); err != nil { + if err = x.Stream.SendMsg(&memclnt.ControlPing{}); err != nil { return nil, err } return x, nil @@ -77,7 +87,7 @@ func (c *serviceClient_AfPacketDumpClient) Recv() (*AfPacketDetails, error) { switch m := msg.(type) { case *AfPacketDetails: return m, nil - case *vpe.ControlPingReply: + case *memclnt.ControlPingReply: err = c.Stream.Close() if err != nil { return nil, err |