mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2025-02-22 19:32:19 +00:00
virNetDevMacVLanCreateWithVPortProfile: Turn vnet_hdr into flag
So yet again one of integer arguments that we use as a boolean. Since the argument count of the function is unbearably long enough, lets turn those booleans into flags. Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
parent
1ce929603b
commit
56e2171c6f
@ -344,7 +344,7 @@ char *virLXCProcessSetupInterfaceDirect(virConnectPtr conn,
|
|||||||
net->ifname, &net->mac,
|
net->ifname, &net->mac,
|
||||||
linkdev,
|
linkdev,
|
||||||
virDomainNetGetActualDirectMode(net),
|
virDomainNetGetActualDirectMode(net),
|
||||||
false, def->uuid,
|
def->uuid,
|
||||||
prof,
|
prof,
|
||||||
&res_ifname,
|
&res_ifname,
|
||||||
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
|
VIR_NETDEV_VPORT_PROFILE_OP_CREATE,
|
||||||
|
@ -224,18 +224,17 @@ qemuPhysIfaceConnect(virDomainDefPtr def,
|
|||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
char *res_ifname = NULL;
|
char *res_ifname = NULL;
|
||||||
int vnet_hdr = 0;
|
|
||||||
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
virQEMUDriverConfigPtr cfg = virQEMUDriverGetConfig(driver);
|
||||||
unsigned int macvlan_create_flags = VIR_NETDEV_MACVLAN_CREATE_WITH_TAP;
|
unsigned int macvlan_create_flags = VIR_NETDEV_MACVLAN_CREATE_WITH_TAP;
|
||||||
|
|
||||||
if (net->model && STREQ(net->model, "virtio"))
|
if (net->model && STREQ(net->model, "virtio"))
|
||||||
vnet_hdr = 1;
|
macvlan_create_flags |= VIR_NETDEV_MACVLAN_VNET_HDR;
|
||||||
|
|
||||||
rc = virNetDevMacVLanCreateWithVPortProfile(
|
rc = virNetDevMacVLanCreateWithVPortProfile(
|
||||||
net->ifname, &net->mac,
|
net->ifname, &net->mac,
|
||||||
virDomainNetGetActualDirectDev(net),
|
virDomainNetGetActualDirectDev(net),
|
||||||
virDomainNetGetActualDirectMode(net),
|
virDomainNetGetActualDirectMode(net),
|
||||||
vnet_hdr, def->uuid,
|
def->uuid,
|
||||||
virDomainNetGetActualVirtPortProfile(net),
|
virDomainNetGetActualVirtPortProfile(net),
|
||||||
&res_ifname,
|
&res_ifname,
|
||||||
vmop, cfg->stateDir,
|
vmop, cfg->stateDir,
|
||||||
|
@ -727,7 +727,6 @@ virNetDevMacVLanVPortProfileRegisterCallback(const char *ifname,
|
|||||||
* @macaddress: The MAC address for the macvtap device
|
* @macaddress: The MAC address for the macvtap device
|
||||||
* @linkdev: The interface name of the NIC to connect to the external bridge
|
* @linkdev: The interface name of the NIC to connect to the external bridge
|
||||||
* @mode: int describing the mode for 'bridge', 'vepa', 'private' or 'passthru'.
|
* @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
|
* @vmuuid: The UUID of the VM the macvtap belongs to
|
||||||
* @virtPortProfile: pointer to object holding the virtual port profile data
|
* @virtPortProfile: pointer to object holding the virtual port profile data
|
||||||
* @res_ifname: Pointer to a string pointer where the actual name of the
|
* @res_ifname: Pointer to a string pointer where the actual name of the
|
||||||
@ -743,7 +742,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
|
|||||||
const virMacAddr *macaddress,
|
const virMacAddr *macaddress,
|
||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
virNetDevMacVLanMode mode,
|
virNetDevMacVLanMode mode,
|
||||||
int vnet_hdr,
|
|
||||||
const unsigned char *vmuuid,
|
const unsigned char *vmuuid,
|
||||||
virNetDevVPortProfilePtr virtPortProfile,
|
virNetDevVPortProfilePtr virtPortProfile,
|
||||||
char **res_ifname,
|
char **res_ifname,
|
||||||
@ -764,6 +762,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
|
|||||||
const char *cr_ifname = NULL;
|
const char *cr_ifname = NULL;
|
||||||
int ret;
|
int ret;
|
||||||
int vf = -1;
|
int vf = -1;
|
||||||
|
bool vnet_hdr = flags & VIR_NETDEV_MACVLAN_VNET_HDR;
|
||||||
|
|
||||||
macvtapMode = modeMap[mode];
|
macvtapMode = modeMap[mode];
|
||||||
|
|
||||||
@ -1017,7 +1016,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname ATTRIBUTE_UNUSED,
|
|||||||
const virMacAddr *macaddress ATTRIBUTE_UNUSED,
|
const virMacAddr *macaddress ATTRIBUTE_UNUSED,
|
||||||
const char *linkdev ATTRIBUTE_UNUSED,
|
const char *linkdev ATTRIBUTE_UNUSED,
|
||||||
virNetDevMacVLanMode mode ATTRIBUTE_UNUSED,
|
virNetDevMacVLanMode mode ATTRIBUTE_UNUSED,
|
||||||
int vnet_hdr ATTRIBUTE_UNUSED,
|
|
||||||
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
const unsigned char *vmuuid ATTRIBUTE_UNUSED,
|
||||||
virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
|
virNetDevVPortProfilePtr virtPortProfile ATTRIBUTE_UNUSED,
|
||||||
char **res_ifname ATTRIBUTE_UNUSED,
|
char **res_ifname ATTRIBUTE_UNUSED,
|
||||||
|
@ -46,6 +46,8 @@ typedef enum {
|
|||||||
VIR_NETDEV_MACVLAN_CREATE_WITH_TAP = 1 << 0,
|
VIR_NETDEV_MACVLAN_CREATE_WITH_TAP = 1 << 0,
|
||||||
/* Bring the interface up */
|
/* Bring the interface up */
|
||||||
VIR_NETDEV_MACVLAN_CREATE_IFUP = 1 << 1,
|
VIR_NETDEV_MACVLAN_CREATE_IFUP = 1 << 1,
|
||||||
|
/* Enable VNET_HDR */
|
||||||
|
VIR_NETDEV_MACVLAN_VNET_HDR = 1 << 2,
|
||||||
} virNetDevMacVLanCreateFlags;
|
} virNetDevMacVLanCreateFlags;
|
||||||
|
|
||||||
int virNetDevMacVLanCreate(const char *ifname,
|
int virNetDevMacVLanCreate(const char *ifname,
|
||||||
@ -64,7 +66,6 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *ifname,
|
|||||||
const virMacAddr *macaddress,
|
const virMacAddr *macaddress,
|
||||||
const char *linkdev,
|
const char *linkdev,
|
||||||
virNetDevMacVLanMode mode,
|
virNetDevMacVLanMode mode,
|
||||||
int vnet_hdr,
|
|
||||||
const unsigned char *vmuuid,
|
const unsigned char *vmuuid,
|
||||||
virNetDevVPortProfilePtr virtPortProfile,
|
virNetDevVPortProfilePtr virtPortProfile,
|
||||||
char **res_ifname,
|
char **res_ifname,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user