mirror of
				https://github.com/kata-containers/kata-containers.git
				synced 2025-10-31 09:26:52 +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:
		
							
								
								
									
										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. | 	// FDs represents the list of already existing file descriptors to be used. | ||||||
| 	// This is mostly useful for mq support. | 	// 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 enables virtio device emulation from the host kernel instead of from qemu. | ||||||
| 	VHost bool | 	VHost bool | ||||||
| @@ -511,8 +512,17 @@ func (netdev NetDevice) QemuNetdevParams(config *Config) []string { | |||||||
|  |  | ||||||
| 	netdevParams = append(netdevParams, netdev.Type.QemuNetdevParam()) | 	netdevParams = append(netdevParams, netdev.Type.QemuNetdevParam()) | ||||||
| 	netdevParams = append(netdevParams, fmt.Sprintf(",id=%s", netdev.ID)) | 	netdevParams = append(netdevParams, fmt.Sprintf(",id=%s", netdev.ID)) | ||||||
|  |  | ||||||
| 	if netdev.VHost == true { | 	if netdev.VHost == true { | ||||||
| 		netdevParams = append(netdevParams, ",vhost=on") | 		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 { | 	if len(netdev.FDs) > 0 { | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user