OASIS Mailing List ArchivesView the OASIS mailing list archive below
or browse/search using MarkMail.


Help: OASIS Mailing Lists Help | MarkMail Help

virtio-dev message

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]

Subject: [PATCH v6] virtio-net: add mtu configuration field

Sometimes it is essential for libvirt to be able to configure MTU
on guest's NICs to a value different from 1500.

The change adds a new field to configuration area of network
devices. It will be used to pass initial MTU from the device to
the driver, and to pass modified MTU from driver to the device
when a new MTU is assigned by the guest OS.

In addition, in order to support backward and forward
compatibility, we introduce a new feature bit called

Signed-off-by: Aaron Conole <aconole@redhat.com>
Cc: Victor Kaplansky <victork@redhat.com>
This is an attempt at continuing the work done by Victor Kaplansky on
mtu negiotiation for virtio-net devices. It attempts to pick up from
and is just a minor blurb from the first patch along with the 2nd patch
from the series, and some of the feedback integrated.

Rephrase and provide a mechanism for guest->host and host->guest
communication through a driver read-only and driver write-only field.

Converted to just support initial MTU. Guest->host and Host->guest MTU
changes are outside the scope of this change.

Removed references to 'initial', since that condition cannot be tested.
Simply state that if the driver will use the mtu field, it must
negotiate the feature bit, and if not, it must not.

After feedback from Michael S. Tsirkin

Bit has to change to bit 25 due to an undocumented bit 24 being taken.

 content.tex | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/content.tex b/content.tex
index d989d98..10944ec 100644
--- a/content.tex
+++ b/content.tex
@@ -3078,6 +3078,14 @@ features.
 \item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
+\item[VIRTIO_NET_F_MTU(25)] Negotiated MTU is supported. If
+    offered by the device, device advises driver about the value of
+    MTU to be used. If negotiated, the driver uses \field{mtu} as
+    the MTU value supplied to the operating system.
+    Note: many operating systems override the MTU value provided by the
+    driver.
 \subsubsection{Feature bit requirements}\label{sec:Device Types / Network Device / Feature bits / Feature bit requirements}
@@ -3132,11 +3140,16 @@ of each of transmit and receive virtqueues (receiveq1\ldots receiveqN
 and transmitq1\ldots transmitqN respectively) that can be configured once VIRTIO_NET_F_MQ
 is negotiated.
+The following driver-read-only field, \field{mtu} only exists if
+VIRTIO_NET_F_MTU is set. This field specifies the MTU for the driver to
 struct virtio_net_config {
         u8 mac[6];
         le16 status;
         le16 max_virtqueue_pairs;
+        le16 mtu;
@@ -3145,6 +3158,11 @@ struct virtio_net_config {
 The device MUST set \field{max_virtqueue_pairs} to between 1 and 0x8000 inclusive,
 if it offers VIRTIO_NET_F_MQ.
+\devicenormative{\subsubsection}{Device configuration layout}{Device Types / Network Device / Device configuration layout}
+The device MUST set \field{mtu} to between 68 and 65535 inclusive,
+if it offers VIRTIO_NET_F_MTU.
 \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.
@@ -3157,6 +3175,10 @@ If the driver does not negotiate the VIRTIO_NET_F_STATUS feature, it SHOULD
 assume the link is active, otherwise it SHOULD read the link status from
 the bottom bit of \field{status}.
+A driver SHOULD negotiate VIRTIO_NET_F_MTU if the device offers it.  A driver
+MUST use \field{mtu} if it negotiates VIRTIO_NET_F_MTU.  A driver MUST NOT
+negotiate VIRTIO_NET_F_MTU if it does not use \field{mtu}.
 \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

[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]