Skip to content

Commit

Permalink
move MTU check in the hardware independent part
Browse files Browse the repository at this point in the history
  • Loading branch information
stlankes committed Aug 13, 2023
1 parent 7753b5b commit a49762d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/drivers/net/virtio_mmio.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,8 +124,6 @@ impl VirtioNetDriver {

let mtu = if let Some(my_mtu) = hermit_var!("HERMIT_MTU") {
u16::from_str(&my_mtu).unwrap() + 14
} else if dev_cfg.features.is_feature(Features::VIRTIO_NET_F_MTU) {
dev_cfg.raw.get_mtu()
} else {
// fallback to the default MTU
1514
Expand Down
4 changes: 4 additions & 0 deletions src/drivers/net/virtio_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -929,6 +929,10 @@ impl VirtioNetDriver {
// At this point the device is "live"
self.com_cfg.drv_ok();

if self.dev_cfg.features.is_feature(Features::VIRTIO_NET_F_MTU) {
self.mtu = self.dev_cfg.raw.get_mtu();
}

Ok(())
}

Expand Down
2 changes: 0 additions & 2 deletions src/drivers/net/virtio_pci.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,6 @@ impl VirtioNetDriver {

let mtu = if let Some(my_mtu) = hermit_var!("HERMIT_MTU") {
u16::from_str(&my_mtu).unwrap() + 14
} else if dev_cfg.features.is_feature(Features::VIRTIO_NET_F_MTU) {
dev_cfg.raw.get_mtu()
} else {
// fallback to the default MTU
1514
Expand Down

0 comments on commit a49762d

Please sign in to comment.