Hi all,
starting with kernel 2.6.38 macvtap supports a 'passthru' mode for
attaching virtual functions
of a SRIOV capable network card directly to a VM.
This patch adds the capability to configure such a device.
Signed-off-by: Dirk Herrendoerfer <d.herrendoerfer at
herrendoerfer.name>
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 6b733d4..104d50d 100644
--- a/src/conf/domain_conf.c
+++ b/src/conf/domain_conf.c
@@ -376,7 +376,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 6ea30b9..5833d72 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