Re: [PATCH] Add support for 'passthru' mode for direct network interfaces

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On May 11, 2011, at 12:21 AM, Eric Blake wrote:

Missing corresponding documentation in docs/formatdomain.html.in to
describe the new mode.

What happens if you try to use this mode but you have an older kernel?
Do we need to add any sanity checking to give a saner error message than just blindly trying the string and reporting back whatever message gets
returned about an unknown argument?

The rest of this patch looks okay to me (with my disclaimer that I've
never used an SRIOV card), but I'd rather wait for a v2 than push this
without documentation.

--
Eric Blake   eblake@xxxxxxxxxx    +1-801-349-2682
Libvirt virtualization library http://libvirt.org


This patch includes the documentation part.

The error returned by libvirt when a using an older kernel
is imho sufficient to point to the macvtap setup. Apart from that
I doubt that someone will use this feature by chance. But still - I
believe the error returned is detailed enough for now.

Signed-off-by: Dirk Herrendoerfer <d.herrendoerfer at herrendoerfer.name>

diff --git a/docs/formatdomain.html.in b/docs/formatdomain.html.in
index 989dcf6..3f6bec8 100644
--- a/docs/formatdomain.html.in
+++ b/docs/formatdomain.html.in
@@ -1429,6 +1429,12 @@
      external router or gateway and that device sends them back to the
host. This procedure is followed if either the source or destination
      device is in <code>private</code> mode.</dd>
+      <dt><code>passthru</code></dt>
+ <dd>This feature allows to attach a virtual function of a SRIOV capable
+      NIC directly to a VM without loosing the migration capability.
+ All packets are sent to the VF/IF of the configured network device. + Depending on the capabilities of the device additional prerequisites or + limitations may apply. <span class="since">(Since Linux 2.6.38.)</span></dd>
    </dl>

<pre>
diff --git a/docs/schemas/domain.rng b/docs/schemas/domain.rng
index 7163c6e..e2a66ae 100644
--- a/docs/schemas/domain.rng
+++ b/docs/schemas/domain.rng
@@ -2351,7 +2351,7 @@
  </define>
  <define name="bridgeMode">
    <data type="string">
-      <param name="pattern">(vepa|bridge|private)</param>
+      <param name="pattern">(vepa|bridge|private|passthru)</param>
    </data>
  </define>
  <define name="addrMAC">
diff --git a/src/conf/domain_conf.c b/src/conf/domain_conf.c
index d3efec6..4c4bfad 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -383,7 +383,8 @@ VIR_ENUM_IMPL(virDomainSeclabel, VIR_DOMAIN_SECLABEL_LAST, VIR_ENUM_IMPL(virDomainNetdevMacvtap, VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST,
              "vepa",
              "private",
-              "bridge")
+              "bridge",
+              "passthru" )

VIR_ENUM_IMPL(virVirtualPort, VIR_VIRTUALPORT_TYPE_LAST,
              "none",
diff --git a/src/conf/domain_conf.h b/src/conf/domain_conf.h
index a0f820c..70943f9 100644
--- a/src/conf/domain_conf.h
+++ b/src/conf/domain_conf.h
@@ -335,6 +335,7 @@ enum virDomainNetdevMacvtapType {
    VIR_DOMAIN_NETDEV_MACVTAP_MODE_VEPA,
    VIR_DOMAIN_NETDEV_MACVTAP_MODE_PRIVATE,
    VIR_DOMAIN_NETDEV_MACVTAP_MODE_BRIDGE,
+    VIR_DOMAIN_NETDEV_MACVTAP_MODE_PASSTHRU,

    VIR_DOMAIN_NETDEV_MACVTAP_MODE_LAST,
};
diff --git a/src/util/macvtap.c b/src/util/macvtap.c
index a7af0cb..1b274cc 100644
--- a/src/util/macvtap.c
+++ b/src/util/macvtap.c
@@ -473,6 +473,9 @@ macvtapModeFromInt(enum virDomainNetdevMacvtapType mode)
    case VIR_DOMAIN_NETDEV_MACVTAP_MODE_BRIDGE:
        return MACVLAN_MODE_BRIDGE;

+    case VIR_DOMAIN_NETDEV_MACVTAP_MODE_PASSTHRU:
+        return MACVLAN_MODE_PASSTHRU;
+
    case VIR_DOMAIN_NETDEV_MACVTAP_MODE_VEPA:
    default:
        return MACVLAN_MODE_VEPA;
@@ -546,7 +549,7 @@ configMacvtapTap(int tapfd, int vnet_hdr)
 *    be NULL if this function is supposed to choose a name
 * @macaddress: The MAC address for the macvtap device
* @linkdev: The interface name of the NIC to connect to the external bridge
- * @mode: int describing the mode for 'bridge', 'vepa' or 'private'.
+ * @mode: int describing the mode for 'bridge', 'vepa', 'private' or 'passthru'.
 * @vnet_hdr: 1 to enable IFF_VNET_HDR, 0 to disable it
 * @vmuuid: The UUID of the VM the macvtap belongs to
* @virtPortProfile: pointer to object holding the virtual port profile data
diff --git a/src/util/macvtap.h b/src/util/macvtap.h
index 54205c7..c45dd13 100644
--- a/src/util/macvtap.h
+++ b/src/util/macvtap.h
@@ -92,6 +92,7 @@ void delMacvtap(const char *ifname,
#  define MACVTAP_MODE_PRIVATE_STR  "private"
#  define MACVTAP_MODE_VEPA_STR     "vepa"
#  define MACVTAP_MODE_BRIDGE_STR   "bridge"
+#  define MACVTAP_MODE_PASSTHRU_STR "passthru"

int vpAssociatePortProfileId(const char *macvtap_ifname,
                             const unsigned char *macvtap_macaddr,

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list


[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]