[libvirt PATCH] util: virnetdevtap: stats: fix txdrop on FreeBSD

Ján Tomko posted 1 patch 3 years, 7 months ago
Test syntax-check failed
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/libvirt tags/patchew/d86642e4a171b94f16472a7253e6389d15f02cdd.1598994731.git.jtomko@redhat.com
src/util/virnetdevtap.c | 8 --------
1 file changed, 8 deletions(-)
[libvirt PATCH] util: virnetdevtap: stats: fix txdrop on FreeBSD
Posted by Ján Tomko 3 years, 7 months ago
For older FreeBSD, we needed an ifdef guard to use
if_data.ifi_oqdrops, which was introduced by:

commit 61bbdbb94ce3e2f5e969c9bddb443427db07bf61
    Implement interface stats for BSD

But when we dropped the check because we deprecated
building on FreeBSD-10 in:

commit 83131d9714db7ee77ab220186b6b0d8b6c22b09e
    configure: drop check for unsupported FreeBSD

We started building the wrong side of the ifdef.

Signed-off-by: Ján Tomko <jtomko@redhat.com>
Fixes: 83131d9714db7ee77ab220186b6b0d8b6c22b09e
---
 src/util/virnetdevtap.c | 8 --------
 1 file changed, 8 deletions(-)

diff --git a/src/util/virnetdevtap.c b/src/util/virnetdevtap.c
index 9f5e535180..cab5ef0ced 100644
--- a/src/util/virnetdevtap.c
+++ b/src/util/virnetdevtap.c
@@ -974,20 +974,12 @@ virNetDevTapInterfaceStats(const char *ifname,
                 stats->rx_bytes = ifd->ifi_obytes;
                 stats->rx_packets = ifd->ifi_opackets;
                 stats->rx_errs = ifd->ifi_oerrors;
-# ifdef HAVE_STRUCT_IF_DATA_IFI_OQDROPS
                 stats->rx_drop = ifd->ifi_oqdrops;
-# else
-                stats->rx_drop = 0;
-# endif
             } else {
                 stats->tx_bytes = ifd->ifi_obytes;
                 stats->tx_packets = ifd->ifi_opackets;
                 stats->tx_errs = ifd->ifi_oerrors;
-# ifdef HAVE_STRUCT_IF_DATA_IFI_OQDROPS
                 stats->tx_drop = ifd->ifi_oqdrops;
-# else
-                stats->tx_drop = 0;
-# endif
                 stats->rx_bytes = ifd->ifi_ibytes;
                 stats->rx_packets = ifd->ifi_ipackets;
                 stats->rx_errs = ifd->ifi_ierrors;
-- 
2.26.2

Re: [libvirt PATCH] util: virnetdevtap: stats: fix txdrop on FreeBSD
Posted by Roman Bogorodskiy 3 years, 7 months ago
  Ján Tomko wrote:

> For older FreeBSD, we needed an ifdef guard to use
> if_data.ifi_oqdrops, which was introduced by:
> 
> commit 61bbdbb94ce3e2f5e969c9bddb443427db07bf61
>     Implement interface stats for BSD
> 
> But when we dropped the check because we deprecated
> building on FreeBSD-10 in:
> 
> commit 83131d9714db7ee77ab220186b6b0d8b6c22b09e
>     configure: drop check for unsupported FreeBSD
> 
> We started building the wrong side of the ifdef.
> 
> Signed-off-by: Ján Tomko <jtomko@redhat.com>
> Fixes: 83131d9714db7ee77ab220186b6b0d8b6c22b09e

Reviewed-by: Roman Bogorodskiy <bogorodskiy@gmail.com>

Roman Bogorodskiy