qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [RFC PATCH v2 06/10] net: Add macros for ETH address tracin


From: Leonid Bloch
Subject: [Qemu-devel] [RFC PATCH v2 06/10] net: Add macros for ETH address tracing
Date: Mon, 18 Jan 2016 19:35:46 +0200

From: Dmitry Fleytman <address@hidden>

This patch introduces a handful macros
for tracing of Ethernet addresses.

There are 2 reasons for those macros to be added:

  1. They will be used by future commits
     introducing e1000e device emulation;
  2. They fix vmxnet3 build with debug tracing enabled:

     When vmxnet3 configuration tracing enabled by uncommenting
     VMXNET_DEBUG_CONFIG definition in vmxnet_debug.h, following
     compilation error is observed:

     hw/net/vmxnet3.c: In function ‘vmxnet3_net_init’:
     hw/net/vmxnet3.c:1974:52: error: expected ‘)’ before ‘MAC_FMT’
          VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(s->perm_mac.a));
                                                    ^
     hw/net/vmxnet3.c:1974:17: error: format ‘%s’ expects a matching ‘char *’ 
argument [-Werror=format=]
          VMW_CFPRN("Permanent MAC: " MAC_FMT, MAC_ARG(s->perm_mac.a));
                      ^
     hw/net/vmxnet3.c:1974:17: error: format ‘%s’ expects a matching ‘char *’ 
argument [-Werror=format=]
     cc1: all warnings being treated as errors

Signed-off-by: Dmitry Fleytman <address@hidden>
Signed-off-by: Leonid Bloch <address@hidden>
---
 include/net/net.h | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/include/net/net.h b/include/net/net.h
index 50ffcb9..fa561ea 100644
--- a/include/net/net.h
+++ b/include/net/net.h
@@ -9,6 +9,11 @@
 #include "migration/vmstate.h"
 #include "qapi-types.h"
 
+#define MAC_FMT "%02x:%02x:%02x:%02x:%02x:%02x"
+#define MAC_ARG(x) ((uint8_t *)(x))[0], ((uint8_t *)(x))[1], \
+                   ((uint8_t *)(x))[2], ((uint8_t *)(x))[3], \
+                   ((uint8_t *)(x))[4], ((uint8_t *)(x))[5]
+
 #define MAX_QUEUE_NUM 1024
 
 /* Maximum GSO packet size (64k) plus plenty of room for
-- 
2.4.3




reply via email to

[Prev in Thread] Current Thread [Next in Thread]