On 5/7/26 19:03, Wesley Hershberger via Devel wrote:
> When virNetDevBandwidthSet is called for a macvtap device in
> qemu_command and qemu_hotplug, qemuDomainInterfaceSetDefaultQDisc has
> been called already, setting the iface qdisc to 'noqueue'. If the
> interface has an inbound-only bandwidth limit, the outgoing qdisc
> on the device will be reset to the system default.
> 
> <interface type="direct">
>   ...
>   <bandwidth>
>     <inbound average='3125000' peak='3125000'/>
>   </bandwidth>
> </interface>
> 
> This only clears the qdisc on an interface before a bandwidth limit is
> actually set.
> 
> Closes: https://gitlab.com/libvirt/libvirt/-/work_items/875
> Signed-off-by: Wesley Hershberger <[email protected]>
> ---
>  src/util/virnetdevbandwidth.c | 18 ++++++++++++------
>  1 file changed, 12 insertions(+), 6 deletions(-)
> 
> diff --git a/src/util/virnetdevbandwidth.c b/src/util/virnetdevbandwidth.c
> index 8de0b57943..9c14d84807 100644
> --- a/src/util/virnetdevbandwidth.c
> +++ b/src/util/virnetdevbandwidth.c
> @@ -253,13 +253,13 @@ virNetDevBandwidthSet(const char *ifname,
>          tx = bandwidth->out;
>      }
>  
> -    /* Only if the caller requests, clear everything including root
> -     * qdisc and all filters before adding everything.
> -     */
> -    if (flags & VIR_NETDEV_BANDWIDTH_SET_CLEAR_ALL)
> -        virNetDevBandwidthClear(ifname);
> -
>      if (tx && tx->average) {
> +        /* Only if the caller requests, clear the root qdisc and all filters
> +         * before adding everything.
> +         */
> +        if (flags & VIR_NETDEV_BANDWIDTH_SET_CLEAR_ALL)
> +            virNetDevBandwidthClearRoot(ifname);
> +
>          average = g_strdup_printf("%llukbps", tx->average);
>          if (tx->peak)
>              peak = g_strdup_printf("%llukbps", tx->peak);
> @@ -383,6 +383,12 @@ virNetDevBandwidthSet(const char *ifname,
>      }
>  
>      if (rx) {
> +        /* Only if the caller requests, clear the ingress qdisc and all
> +         * filters before adding everything.
> +         */
> +        if (flags & VIR_NETDEV_BANDWIDTH_SET_CLEAR_ALL)
> +            virNetDevBandwidthClearIngress(ifname);
> +
>          average = g_strdup_printf("%llukbps", rx->average);
>  
>          if (rx->burst) {
> 

After this, virnetdevbandwidthtest.c must be updated to reflect that:

a) in some cases root/ingress qdisc is not deleted,
b) ingress qdisc is now removed later in the process.

This is actually a good thing - it proves the patch works as expected.

Michal

Reply via email to