From da60923ce1645f6afdbcb41dbe765a46780af49d Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Fri, 1 Nov 2019 04:22:47 -0400 Subject: content: document speed, duplex Document as used by Linux. Fixes: https://github.com/oasis-tcs/virtio-spec/issues/59 Signed-off-by: Michael S. Tsirkin Reviewed-by: Cornelia Huck --- content.tex | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/content.tex b/content.tex index 307e66f..b91a132 100644 --- a/content.tex +++ b/content.tex @@ -2907,6 +2907,8 @@ features. \item[VIRTIO_NET_F_STANDBY(62)] Device may act as a standby for a primary device with the same MAC address. + +\item[VIRTIO_NET_F_SPEED_DUPLEX(63)] Device reports speed and duplex. \end{description} \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device / Feature bits / Feature bit requirements} @@ -2967,7 +2969,19 @@ The following driver-read-only field, \field{mtu} only exists if VIRTIO_NET_F_MTU is set. This field specifies the maximum MTU for the driver to use. -Two following fields, \field{speed} and \field{duplex} are reserved. +The following two fields, \field{speed} and \field{duplex}, only +exist if VIRTIO_NET_F_SPEED_DUPLEX is set. + +\field{speed} contains the device speed, in units of 1 MBit per +second, 0 to 0x7ffffffff, or 0xfffffffff for unknown speed. + +\field{duplex} has the values of 0x00 for full duplex, 0x01 for +half duplex and 0xff for unknown duplex state. + +Both \field{speed} and \field{duplex} can change, thus the driver +is expected to re-read these values after receiving a +configuration change notification. + \begin{lstlisting} struct virtio_net_config { u8 mac[6]; @@ -3042,6 +3056,19 @@ VIRTIO_NET_F_RSS. If the driver negotiates the VIRTIO_NET_F_STANDBY feature, the device MAY act as a standby device for a primary device with the same MAC address. +If VIRTIO_NET_F_SPEED_DUPLEX has been negotiated, \field{speed} +MUST contain the device speed, in units of 1 MBit per second, 0 to +0x7ffffffff, or 0xfffffffff for unknown. + +If VIRTIO_NET_F_SPEED_DUPLEX has been negotiated, \field{duplex} +MUST have the values of 0x00 for full duplex, 0x01 for half +duplex, or 0xff for unknown. + +If VIRTIO_NET_F_SPEED_DUPLEX and VIRTIO_NET_F_STATUS have both +been negotiated, the device SHOULD NOT change the \field{speed} and +\field{duplex} fields as long as VIRTIO_NET_S_LINK_UP is set in +the \field{status}. + \drivernormative{\subsubsection}{Device configuration layout}{Device Types / Network Device / Device configuration layout} A driver SHOULD negotiate VIRTIO_NET_F_MAC if the device offers it. @@ -3066,6 +3093,15 @@ with \field{gso_type} NONE or ECN. A driver SHOULD negotiate the VIRTIO_NET_F_STANDBY feature if the device offers it. +If VIRTIO_NET_F_SPEED_DUPLEX has been negotiated, +the driver MUST treat any value of \field{speed} above +0x7fffffff as well as any value of \field{duplex} not +matching 0x00 or 0x01 as an unknown value. + +If VIRTIO_NET_F_SPEED_DUPLEX has been negotiated, the driver +SHOULD re-read \field{speed} and \field{duplex} after a +configuration change notification. + \subsubsection{Legacy Interface: Device configuration layout}\label{sec:Device Types / Network Device / Device configuration layout / Legacy Interface: Device configuration layout} \label{sec:Device Types / Block Device / Feature bits / Device configuration layout / Legacy Interface: Device configuration layout} When using the legacy interface, transitional devices and drivers -- cgit