virNetDevMacVLanTapSetup: Drop @multiqueue argument

Firstly, there's a bug (or typo) in the only place where we call
this function: @multiqueue is set whenever @tapfdSize is greater
than zero, while in fact the condition should have been 'greater
than one'.
Then, secondly, since the condition depends on just one
variable, that we are even passing down to the function, we can
move the condition into the function and drop useless argument.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
This commit is contained in:
Michal Privoznik 2015-12-13 07:54:46 +01:00
parent 686eb7a24f
commit 65e3451ea9

View File

@ -289,12 +289,11 @@ virNetDevMacVLanTapOpen(const char *ifname,
* @tapfd: array of file descriptors of the macvtap tap * @tapfd: array of file descriptors of the macvtap tap
* @tapfdSize: number of file descriptors in @tapfd * @tapfdSize: number of file descriptors in @tapfd
* @vnet_hdr: whether to enable or disable IFF_VNET_HDR * @vnet_hdr: whether to enable or disable IFF_VNET_HDR
* @multiqueue: whether to enable or disable IFF_MULTI_QUEUE
* *
* Turn on the IFF_VNET_HDR flag if requested and available, but make sure it's * Turn on the IFF_VNET_HDR flag if requested and available, but make sure
* off otherwise. Similarly, turn on IFF_MULTI_QUEUE if requested, but if it * it's off otherwise. Similarly, turn on IFF_MULTI_QUEUE if @tapfdSize is
* can't be set, consider it a fatal error (rather than ignoring as with * greater than one, but if it can't be set, consider it a fatal error
* @vnet_hdr). * (rather than ignoring as with @vnet_hdr).
* *
* A fatal error is defined as the VNET_HDR flag being set but it cannot * A fatal error is defined as the VNET_HDR flag being set but it cannot
* be turned off for some reason. This is reported with -1. Other fatal * be turned off for some reason. This is reported with -1. Other fatal
@ -304,7 +303,7 @@ virNetDevMacVLanTapOpen(const char *ifname,
* Returns 0 on success, -1 in case of fatal error. * Returns 0 on success, -1 in case of fatal error.
*/ */
static int static int
virNetDevMacVLanTapSetup(int *tapfd, size_t tapfdSize, bool vnet_hdr, bool multiqueue) virNetDevMacVLanTapSetup(int *tapfd, size_t tapfdSize, bool vnet_hdr)
{ {
unsigned int features; unsigned int features;
struct ifreq ifreq; struct ifreq ifreq;
@ -335,12 +334,12 @@ virNetDevMacVLanTapSetup(int *tapfd, size_t tapfdSize, bool vnet_hdr, bool multi
} }
# ifdef IFF_MULTI_QUEUE # ifdef IFF_MULTI_QUEUE
if (multiqueue) if (tapfdSize > 1)
new_flags |= IFF_MULTI_QUEUE; new_flags |= IFF_MULTI_QUEUE;
else else
new_flags &= ~IFF_MULTI_QUEUE; new_flags &= ~IFF_MULTI_QUEUE;
# else # else
if (multiqueue) { if (tapfdSize > 1) {
virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s", virReportError(VIR_ERR_CONFIG_UNSUPPORTED, "%s",
_("Multiqueue devices are not supported on this system")); _("Multiqueue devices are not supported on this system"));
return -1; return -1;
@ -870,7 +869,7 @@ int virNetDevMacVLanCreateWithVPortProfile(const char *tgifname,
if (virNetDevMacVLanTapOpen(cr_ifname, tapfd, tapfdSize, 10) < 0) if (virNetDevMacVLanTapOpen(cr_ifname, tapfd, tapfdSize, 10) < 0)
goto disassociate_exit; goto disassociate_exit;
if (virNetDevMacVLanTapSetup(tapfd, tapfdSize, vnet_hdr, tapfdSize > 0) < 0) { if (virNetDevMacVLanTapSetup(tapfd, tapfdSize, vnet_hdr) < 0) {
VIR_FORCE_CLOSE(rc); /* sets rc to -1 */ VIR_FORCE_CLOSE(rc); /* sets rc to -1 */
goto disassociate_exit; goto disassociate_exit;
} }