From df64d9b9f898adaa687f1c9d9e7d7dbfa835fb3c Mon Sep 17 00:00:00 2001
From: mstsirkin <mstsirkin@0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652>
Date: Sun, 8 Dec 2013 22:10:48 +0000
Subject: net: document VIRTIO_NET_F_MAC_ADDR

VIRTIO-50

commit f058954d131e3dc73058778ad23b241a235ae8e1
    virtio-spec: set mac address by a new vq command

Approved Dec 3, 2013

Reported-by: Francesco Fusco <ffusco@redhat.com>
Signed-off-by: Amos Kong <akong@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

git-svn-id: https://tools.oasis-open.org/version-control/svn/virtio@167 0c8fb4dd-22a2-4bb5-bc14-6c75a5f43652
---
 content.tex | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

(limited to 'content.tex')

diff --git a/content.tex b/content.tex
index 356a1d5..3b39602 100644
--- a/content.tex
+++ b/content.tex
@@ -2343,6 +2343,8 @@ features.
 \item[VIRTIO_NET_F_MQ(22)] Device supports multiqueue with automatic
     receive steering.
 
+\item[VIRTIO_NET_F_CTRL_MAC_ADDR(23)] Set MAC address through control
+    channel.
 \end{description}
 
 \subsubsection{Legacy Interface: Feature bits}\label{sec:Device Types / Network Device / Feature bits / Legacy Interface: Feature bits}
@@ -2681,6 +2683,7 @@ off. The command-specific-data is one byte containing 0 (off) or
 
 	#define VIRTIO_NET_CTRL_MAC    1
 	 #define VIRTIO_NET_CTRL_MAC_TABLE_SET        0
+	 #define VIRTIO_NET_CTRL_MAC_ADDR_SET         1
 \end{lstlisting}
 
 The device can filter incoming packets by any number of destination
@@ -2693,10 +2696,40 @@ command-specific-data is two variable length tables of 6-byte MAC
 addresses. The first table contains unicast addresses, and the second
 contains multicast addresses.
 
+When VIRTIO_NET_F_MAC_ADDR is not negotiated, the mac field in
+config space is writeable and is used to set the default MAC
+address which rx filtering accepts.
+When VIRTIO_NET_F_MAC_ADDR is negotiated, the mac field in
+config space becomes read-only.
+The VIRTIO_NET_CTRL_MAC_ADDR_SET command is used to set the
+default MAC address which rx filtering
+accepts
+
+Depending on whether VIRTIO_NET_F_MAC_ADDR has been negotiated,
+the mac field in config space or the VIRTIO_NET_CTRL_MAC_ADDR_SET
+is used to set the default MAC address which rx filtering
+accepts.
+The command-specific-data for VIRTIO_NET_CTRL_MAC_ADDR_SET is
+the 6-byte MAC address.
+
+The
+VIRTIO_NET_CTRL_MAC_ADDR_SET command is atomic whereas the
+mac field in config space is not, therefore drivers
+MUST negotiate VIRTIO_NET_F_MAC_ADDR if they change
+mac address when device is accepting incoming packets.
+
 \subparagraph{Legacy Interface: Setting MAC Address Filtering}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / Setting MAC Address Filtering / Legacy Interface: Setting MAC Address Filtering}
 For legacy devices, the entries field in struct virtio_net_ctrl_mac is the
 native endian of the guest rather than (necessarily) little-endian.
 
+Legacy drivers that didn't negotiate VIRTIO_NET_F_MAC_ADDR
+changed the mac field in config space when NIC is accepting
+incoming packets. These drivers always wrote the mac value from
+first to last byte, therefore after detecting such drivers,
+a transitional device CAN defer MAC update, or CAN defer
+processing incoming packets until driver writes the last byte
+of the mac field in config space.
+
 \paragraph{VLAN Filtering}\label{sec:Device Types / Network Device / Device Operation / Control Virtqueue / VLAN Filtering}
 
 If the driver negotiates the VIRTION_NET_F_CTRL_VLAN feature, it
-- 
cgit v1.2.3

