aboutsummaryrefslogtreecommitdiffstats
path: root/binapi/virtio
diff options
context:
space:
mode:
Diffstat (limited to 'binapi/virtio')
-rw-r--r--binapi/virtio/virtio.ba.go190
-rw-r--r--binapi/virtio/virtio_rest.ba.go60
-rw-r--r--binapi/virtio/virtio_rpc.ba.go29
3 files changed, 198 insertions, 81 deletions
diff --git a/binapi/virtio/virtio.ba.go b/binapi/virtio/virtio.ba.go
index b29b52f..7cb371b 100644
--- a/binapi/virtio/virtio.ba.go
+++ b/binapi/virtio/virtio.ba.go
@@ -1,22 +1,25 @@
// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
// versions:
-// binapi-generator: v0.4.0-dev
-// VPP: 20.05-release
+// binapi-generator: v0.6.0-dev
+// VPP: 22.02-release
// source: /usr/share/vpp/api/core/virtio.api.json
// Package virtio contains generated bindings for API file virtio.api.
//
// Contents:
-// 6 messages
+// 1 enum
+// 8 messages
//
package virtio
import (
- api "git.fd.io/govpp.git/api"
- ethernet_types "git.fd.io/govpp.git/binapi/ethernet_types"
- interface_types "git.fd.io/govpp.git/binapi/interface_types"
- pci_types "git.fd.io/govpp.git/binapi/pci_types"
- codec "git.fd.io/govpp.git/codec"
+ "strconv"
+
+ api "go.fd.io/govpp/api"
+ ethernet_types "go.fd.io/govpp/binapi/ethernet_types"
+ interface_types "go.fd.io/govpp/binapi/interface_types"
+ pci_types "go.fd.io/govpp/binapi/pci_types"
+ codec "go.fd.io/govpp/codec"
)
// This is a compile-time assertion to ensure that this generated file
@@ -27,10 +30,68 @@ const _ = api.GoVppAPIPackageIsVersion2
const (
APIFile = "virtio"
- APIVersion = "2.0.0"
- VersionCrc = 0x601b1fdc
+ APIVersion = "3.0.0"
+ VersionCrc = 0xa507d784
+)
+
+// VirtioFlags defines enum 'virtio_flags'.
+type VirtioFlags uint32
+
+const (
+ VIRTIO_API_FLAG_GSO VirtioFlags = 1
+ VIRTIO_API_FLAG_CSUM_OFFLOAD VirtioFlags = 2
+ VIRTIO_API_FLAG_GRO_COALESCE VirtioFlags = 4
+ VIRTIO_API_FLAG_PACKED VirtioFlags = 8
+ VIRTIO_API_FLAG_IN_ORDER VirtioFlags = 16
+ VIRTIO_API_FLAG_BUFFERING VirtioFlags = 32
)
+var (
+ VirtioFlags_name = map[uint32]string{
+ 1: "VIRTIO_API_FLAG_GSO",
+ 2: "VIRTIO_API_FLAG_CSUM_OFFLOAD",
+ 4: "VIRTIO_API_FLAG_GRO_COALESCE",
+ 8: "VIRTIO_API_FLAG_PACKED",
+ 16: "VIRTIO_API_FLAG_IN_ORDER",
+ 32: "VIRTIO_API_FLAG_BUFFERING",
+ }
+ VirtioFlags_value = map[string]uint32{
+ "VIRTIO_API_FLAG_GSO": 1,
+ "VIRTIO_API_FLAG_CSUM_OFFLOAD": 2,
+ "VIRTIO_API_FLAG_GRO_COALESCE": 4,
+ "VIRTIO_API_FLAG_PACKED": 8,
+ "VIRTIO_API_FLAG_IN_ORDER": 16,
+ "VIRTIO_API_FLAG_BUFFERING": 32,
+ }
+)
+
+func (x VirtioFlags) String() string {
+ s, ok := VirtioFlags_name[uint32(x)]
+ if ok {
+ return s
+ }
+ str := func(n uint32) string {
+ s, ok := VirtioFlags_name[uint32(n)]
+ if ok {
+ return s
+ }
+ return "VirtioFlags(" + strconv.Itoa(int(n)) + ")"
+ }
+ for i := uint32(0); i <= 32; i++ {
+ val := uint32(x)
+ if val&(1<<i) != 0 {
+ if s != "" {
+ s += "|"
+ }
+ s += str(1 << i)
+ }
+ }
+ if s == "" {
+ return str(uint32(x))
+ }
+ return s
+}
+
// SwInterfaceVirtioPciDetails defines message 'sw_interface_virtio_pci_details'.
type SwInterfaceVirtioPciDetails struct {
SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
@@ -43,7 +104,7 @@ type SwInterfaceVirtioPciDetails struct {
func (m *SwInterfaceVirtioPciDetails) Reset() { *m = SwInterfaceVirtioPciDetails{} }
func (*SwInterfaceVirtioPciDetails) GetMessageName() string { return "sw_interface_virtio_pci_details" }
-func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "16187f3a" }
+func (*SwInterfaceVirtioPciDetails) GetCrcString() string { return "6ca9c167" }
func (*SwInterfaceVirtioPciDetails) GetMessageType() api.MessageType {
return api.ReplyMessage
}
@@ -121,6 +182,7 @@ func (m *SwInterfaceVirtioPciDump) Unmarshal(b []byte) error {
}
// VirtioPciCreate defines message 'virtio_pci_create'.
+// Deprecated: the message will be removed in the future versions
type VirtioPciCreate struct {
PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
@@ -132,7 +194,7 @@ type VirtioPciCreate struct {
func (m *VirtioPciCreate) Reset() { *m = VirtioPciCreate{} }
func (*VirtioPciCreate) GetMessageName() string { return "virtio_pci_create" }
-func (*VirtioPciCreate) GetCrcString() string { return "a9f1370c" }
+func (*VirtioPciCreate) GetCrcString() string { return "1944f8db" }
func (*VirtioPciCreate) GetMessageType() api.MessageType {
return api.RequestMessage
}
@@ -183,6 +245,7 @@ func (m *VirtioPciCreate) Unmarshal(b []byte) error {
}
// VirtioPciCreateReply defines message 'virtio_pci_create_reply'.
+// Deprecated: the message will be removed in the future versions
type VirtioPciCreateReply 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"`
@@ -219,6 +282,101 @@ func (m *VirtioPciCreateReply) Unmarshal(b []byte) error {
return nil
}
+// VirtioPciCreateV2 defines message 'virtio_pci_create_v2'.
+type VirtioPciCreateV2 struct {
+ PciAddr pci_types.PciAddress `binapi:"pci_address,name=pci_addr" json:"pci_addr,omitempty"`
+ UseRandomMac bool `binapi:"bool,name=use_random_mac" json:"use_random_mac,omitempty"`
+ MacAddress ethernet_types.MacAddress `binapi:"mac_address,name=mac_address" json:"mac_address,omitempty"`
+ VirtioFlags VirtioFlags `binapi:"virtio_flags,name=virtio_flags" json:"virtio_flags,omitempty"`
+ Features uint64 `binapi:"u64,name=features" json:"features,omitempty"`
+}
+
+func (m *VirtioPciCreateV2) Reset() { *m = VirtioPciCreateV2{} }
+func (*VirtioPciCreateV2) GetMessageName() string { return "virtio_pci_create_v2" }
+func (*VirtioPciCreateV2) GetCrcString() string { return "5d096e1a" }
+func (*VirtioPciCreateV2) GetMessageType() api.MessageType {
+ return api.RequestMessage
+}
+
+func (m *VirtioPciCreateV2) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 2 // m.PciAddr.Domain
+ size += 1 // m.PciAddr.Bus
+ size += 1 // m.PciAddr.Slot
+ size += 1 // m.PciAddr.Function
+ size += 1 // m.UseRandomMac
+ size += 1 * 6 // m.MacAddress
+ size += 4 // m.VirtioFlags
+ size += 8 // m.Features
+ return size
+}
+func (m *VirtioPciCreateV2) Marshal(b []byte) ([]byte, error) {
+ if b == nil {
+ b = make([]byte, m.Size())
+ }
+ buf := codec.NewBuffer(b)
+ buf.EncodeUint16(m.PciAddr.Domain)
+ buf.EncodeUint8(m.PciAddr.Bus)
+ buf.EncodeUint8(m.PciAddr.Slot)
+ buf.EncodeUint8(m.PciAddr.Function)
+ buf.EncodeBool(m.UseRandomMac)
+ buf.EncodeBytes(m.MacAddress[:], 6)
+ buf.EncodeUint32(uint32(m.VirtioFlags))
+ buf.EncodeUint64(m.Features)
+ return buf.Bytes(), nil
+}
+func (m *VirtioPciCreateV2) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.PciAddr.Domain = buf.DecodeUint16()
+ m.PciAddr.Bus = buf.DecodeUint8()
+ m.PciAddr.Slot = buf.DecodeUint8()
+ m.PciAddr.Function = buf.DecodeUint8()
+ m.UseRandomMac = buf.DecodeBool()
+ copy(m.MacAddress[:], buf.DecodeBytes(6))
+ m.VirtioFlags = VirtioFlags(buf.DecodeUint32())
+ m.Features = buf.DecodeUint64()
+ return nil
+}
+
+// VirtioPciCreateV2Reply defines message 'virtio_pci_create_v2_reply'.
+type VirtioPciCreateV2Reply 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 *VirtioPciCreateV2Reply) Reset() { *m = VirtioPciCreateV2Reply{} }
+func (*VirtioPciCreateV2Reply) GetMessageName() string { return "virtio_pci_create_v2_reply" }
+func (*VirtioPciCreateV2Reply) GetCrcString() string { return "5383d31f" }
+func (*VirtioPciCreateV2Reply) GetMessageType() api.MessageType {
+ return api.ReplyMessage
+}
+
+func (m *VirtioPciCreateV2Reply) Size() (size int) {
+ if m == nil {
+ return 0
+ }
+ size += 4 // m.Retval
+ size += 4 // m.SwIfIndex
+ return size
+}
+func (m *VirtioPciCreateV2Reply) 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 *VirtioPciCreateV2Reply) Unmarshal(b []byte) error {
+ buf := codec.NewBuffer(b)
+ m.Retval = buf.DecodeInt32()
+ m.SwIfIndex = interface_types.InterfaceIndex(buf.DecodeUint32())
+ return nil
+}
+
// VirtioPciDelete defines message 'virtio_pci_delete'.
type VirtioPciDelete struct {
SwIfIndex interface_types.InterfaceIndex `binapi:"interface_index,name=sw_if_index" json:"sw_if_index,omitempty"`
@@ -287,10 +445,12 @@ func (m *VirtioPciDeleteReply) Unmarshal(b []byte) error {
func init() { file_virtio_binapi_init() }
func file_virtio_binapi_init() {
- api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_16187f3a")
+ api.RegisterMessage((*SwInterfaceVirtioPciDetails)(nil), "sw_interface_virtio_pci_details_6ca9c167")
api.RegisterMessage((*SwInterfaceVirtioPciDump)(nil), "sw_interface_virtio_pci_dump_51077d14")
- api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_a9f1370c")
+ api.RegisterMessage((*VirtioPciCreate)(nil), "virtio_pci_create_1944f8db")
api.RegisterMessage((*VirtioPciCreateReply)(nil), "virtio_pci_create_reply_5383d31f")
+ api.RegisterMessage((*VirtioPciCreateV2)(nil), "virtio_pci_create_v2_5d096e1a")
+ api.RegisterMessage((*VirtioPciCreateV2Reply)(nil), "virtio_pci_create_v2_reply_5383d31f")
api.RegisterMessage((*VirtioPciDelete)(nil), "virtio_pci_delete_f9e6675e")
api.RegisterMessage((*VirtioPciDeleteReply)(nil), "virtio_pci_delete_reply_e8d4e804")
}
@@ -302,6 +462,8 @@ func AllMessages() []api.Message {
(*SwInterfaceVirtioPciDump)(nil),
(*VirtioPciCreate)(nil),
(*VirtioPciCreateReply)(nil),
+ (*VirtioPciCreateV2)(nil),
+ (*VirtioPciCreateV2Reply)(nil),
(*VirtioPciDelete)(nil),
(*VirtioPciDeleteReply)(nil),
}
diff --git a/binapi/virtio/virtio_rest.ba.go b/binapi/virtio/virtio_rest.ba.go
deleted file mode 100644
index bd97059..0000000
--- a/binapi/virtio/virtio_rest.ba.go
+++ /dev/null
@@ -1,60 +0,0 @@
-// Code generated by GoVPP's binapi-generator. DO NOT EDIT.
-
-package virtio
-
-import (
- "encoding/json"
- "io/ioutil"
- "net/http"
-)
-
-func RESTHandler(rpc RPCService) http.Handler {
- mux := http.NewServeMux()
- mux.HandleFunc("/virtio_pci_create", func(w http.ResponseWriter, req *http.Request) {
- var request = new(VirtioPciCreate)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.VirtioPciCreate(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- mux.HandleFunc("/virtio_pci_delete", func(w http.ResponseWriter, req *http.Request) {
- var request = new(VirtioPciDelete)
- b, err := ioutil.ReadAll(req.Body)
- if err != nil {
- http.Error(w, "read body failed", http.StatusBadRequest)
- return
- }
- if err := json.Unmarshal(b, request); err != nil {
- http.Error(w, "unmarshal data failed", http.StatusBadRequest)
- return
- }
- reply, err := rpc.VirtioPciDelete(req.Context(), request)
- if err != nil {
- http.Error(w, "request failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- rep, err := json.MarshalIndent(reply, "", " ")
- if err != nil {
- http.Error(w, "marshal failed: "+err.Error(), http.StatusInternalServerError)
- return
- }
- w.Write(rep)
- })
- return http.HandlerFunc(mux.ServeHTTP)
-}
diff --git a/binapi/virtio/virtio_rpc.ba.go b/binapi/virtio/virtio_rpc.ba.go
index 785a460..cba32e3 100644
--- a/binapi/virtio/virtio_rpc.ba.go
+++ b/binapi/virtio/virtio_rpc.ba.go
@@ -5,15 +5,17 @@ package virtio
import (
"context"
"fmt"
- api "git.fd.io/govpp.git/api"
- vpe "git.fd.io/govpp.git/binapi/vpe"
"io"
+
+ api "go.fd.io/govpp/api"
+ memclnt "go.fd.io/govpp/binapi/memclnt"
)
-// RPCService defines RPC service virtio.
+// RPCService defines RPC service virtio.
type RPCService interface {
SwInterfaceVirtioPciDump(ctx context.Context, in *SwInterfaceVirtioPciDump) (RPCService_SwInterfaceVirtioPciDumpClient, error)
VirtioPciCreate(ctx context.Context, in *VirtioPciCreate) (*VirtioPciCreateReply, error)
+ VirtioPciCreateV2(ctx context.Context, in *VirtioPciCreateV2) (*VirtioPciCreateV2Reply, error)
VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error)
}
@@ -34,7 +36,7 @@ func (c *serviceClient) SwInterfaceVirtioPciDump(ctx context.Context, in *SwInte
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
@@ -57,7 +59,11 @@ func (c *serviceClient_SwInterfaceVirtioPciDumpClient) Recv() (*SwInterfaceVirti
switch m := msg.(type) {
case *SwInterfaceVirtioPciDetails:
return m, nil
- case *vpe.ControlPingReply:
+ case *memclnt.ControlPingReply:
+ err = c.Stream.Close()
+ if err != nil {
+ return nil, err
+ }
return nil, io.EOF
default:
return nil, fmt.Errorf("unexpected message: %T %v", m, m)
@@ -70,7 +76,16 @@ func (c *serviceClient) VirtioPciCreate(ctx context.Context, in *VirtioPciCreate
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
+}
+
+func (c *serviceClient) VirtioPciCreateV2(ctx context.Context, in *VirtioPciCreateV2) (*VirtioPciCreateV2Reply, error) {
+ out := new(VirtioPciCreateV2Reply)
+ err := c.conn.Invoke(ctx, in, out)
+ if err != nil {
+ return nil, err
+ }
+ return out, api.RetvalToVPPApiError(out.Retval)
}
func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete) (*VirtioPciDeleteReply, error) {
@@ -79,5 +94,5 @@ func (c *serviceClient) VirtioPciDelete(ctx context.Context, in *VirtioPciDelete
if err != nil {
return nil, err
}
- return out, nil
+ return out, api.RetvalToVPPApiError(out.Retval)
}