net_util: Don't always set the tap offload

Setting the tap offload should only be done based on the features that
are acked by the guest. Therefore it is incorrect to set these upon
opening the tap.

Signed-off-by: Rob Bradford <robert.bradford@intel.com>
This commit is contained in:
Rob Bradford 2021-04-26 16:30:44 +01:00 committed by Sebastien Boeuf
parent 70e926372a
commit b945a341b3
2 changed files with 0 additions and 6 deletions

View File

@ -70,7 +70,6 @@ pub fn open_tap(
let mut taps: Vec<Tap> = Vec::new();
let mut ifname: String = String::new();
let vnet_hdr_size = vnet_hdr_len() as i32;
let flag = net_gen::TUN_F_CSUM | net_gen::TUN_F_UFO | net_gen::TUN_F_TSO4 | net_gen::TUN_F_TSO6;
// In case the tap interface already exists, check if the number of
// queues is appropriate. The tap might not support multiqueue while
@ -98,7 +97,6 @@ pub fn open_tap(
*host_mac = Some(tap.get_mac_addr().map_err(Error::TapGetMac)?)
}
tap.enable().map_err(Error::TapEnable)?;
tap.set_offload(flag).map_err(Error::TapSetOffload)?;
tap.set_vnet_hdr_size(vnet_hdr_size)
.map_err(Error::TapSetVnetHdrSize)?;
@ -106,7 +104,6 @@ pub fn open_tap(
ifname = String::from_utf8(tap.get_if_name()).unwrap();
} else {
tap = Tap::open_named(ifname.as_str(), num_rx_q, flags).map_err(Error::TapOpen)?;
tap.set_offload(flag).map_err(Error::TapSetOffload)?;
tap.set_vnet_hdr_size(vnet_hdr_size)
.map_err(Error::TapSetVnetHdrSize)?;

View File

@ -191,10 +191,7 @@ impl Tap {
}
let tap = Tap { tap_file, if_name };
let offload_flags =
net_gen::TUN_F_CSUM | net_gen::TUN_F_UFO | net_gen::TUN_F_TSO4 | net_gen::TUN_F_TSO6;
let vnet_hdr_size = vnet_hdr_len() as i32;
tap.set_offload(offload_flags)?;
tap.set_vnet_hdr_size(vnet_hdr_size)?;
Ok(tap)