mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-04-28 03:42:09 +00:00
Networking: Add vhost fd support
Add vhost fd support. This is needed in the case of multi queue. Signed-off-by: Manohar Castelino <manohar.r.castelino@intel.com>
This commit is contained in:
parent
14316ce0b1
commit
7e5614b8a7
12
qemu.go
12
qemu.go
@ -425,7 +425,8 @@ type NetDevice struct {
|
||||
|
||||
// FDs represents the list of already existing file descriptors to be used.
|
||||
// This is mostly useful for mq support.
|
||||
FDs []*os.File
|
||||
FDs []*os.File
|
||||
VhostFDs []*os.File
|
||||
|
||||
// VHost enables virtio device emulation from the host kernel instead of from qemu.
|
||||
VHost bool
|
||||
@ -511,8 +512,17 @@ func (netdev NetDevice) QemuNetdevParams(config *Config) []string {
|
||||
|
||||
netdevParams = append(netdevParams, netdev.Type.QemuNetdevParam())
|
||||
netdevParams = append(netdevParams, fmt.Sprintf(",id=%s", netdev.ID))
|
||||
|
||||
if netdev.VHost == true {
|
||||
netdevParams = append(netdevParams, ",vhost=on")
|
||||
if len(netdev.VhostFDs) > 0 {
|
||||
var fdParams []string
|
||||
qemuFDs := config.appendFDs(netdev.VhostFDs)
|
||||
for _, fd := range qemuFDs {
|
||||
fdParams = append(fdParams, fmt.Sprintf("%d", fd))
|
||||
}
|
||||
netdevParams = append(netdevParams, fmt.Sprintf(",vhostfds=%s", strings.Join(fdParams, ":")))
|
||||
}
|
||||
}
|
||||
|
||||
if len(netdev.FDs) > 0 {
|
||||
|
Loading…
Reference in New Issue
Block a user