Skip to content

feat(virtio): get speed and duplex#509

Merged
veqcc merged 1 commit intomainfrom
feat/virtio_speed_duplex
Jun 17, 2025
Merged

feat(virtio): get speed and duplex#509
veqcc merged 1 commit intomainfrom
feat/virtio_speed_duplex

Conversation

@veqcc
Copy link
Copy Markdown
Contributor

@veqcc veqcc commented Jun 17, 2025

Description

Added speed=1000,duplex=full in QEMU_X86_NET_ARGS so that virtio-net driver can get speed and duplex infomation from net-config space.
Changed link_speed() and link_speed() to get the actual values from configuration spaces.

Related links

ViotIO Specification 5.1.4 Device configuration layout
https://docs.oasis-open.org/virtio/virtio/v1.3/csd01/virtio-v1.3-csd01.html#x1-1220001:~:text=The%20following%20two%20fields,for%20unknown%20duplex%20state.

OpenBSD does not have similar functionality.
FreeBSD have one, but not completely the same: https://github.com/freebsd/freebsd-src/blob/6039cd1b45eb847ef5bbe6c58341b8b92fff8a74/sys/dev/virtio/network/if_vtnet.c#L3934

How was this PR tested?

Tested in #465

> (ifconfig)
[1] virtio-net:
    IPv4 address: 10.0.2.64/24
    IPv4 gateway: None
    MAC address: 12:34:56:11:22:34
    Link status: Up (Full Duplex), Link speed: 1000 Mbps
    Capabilities: 
    IRQs: [65, 66, 67]
    Poll mode: false

Notes for reviewers

I am not sure what to return when speed/duplex could not obtained.

Signed-off-by: Ryuta Kambe <ryuta.kambe@tier4.jp>
@veqcc veqcc self-assigned this Jun 17, 2025
@veqcc veqcc requested review from Koichi98 and ytakano June 17, 2025 05:20
@veqcc veqcc merged commit 18fd97b into main Jun 17, 2025
1 check passed
@veqcc veqcc deleted the feat/virtio_speed_duplex branch June 17, 2025 06:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants