build: fix build for Debian 9 and Debian 10 99/28799/2
authorBenoît Ganne <bganne@cisco.com>
Wed, 9 Sep 2020 10:50:07 +0000 (12:50 +0200)
committerAndrew Yourtchenko <ayourtch@gmail.com>
Tue, 15 Sep 2020 08:40:06 +0000 (08:40 +0000)
Type: fix

Change-Id: Ic07d0ae313b32e420ba93693cb75960a86f752a9
Signed-off-by: Benoît Ganne <bganne@cisco.com>
(cherry picked from commit 3f0ae664faf33578515ffa1fd5287ad692f16c6f)

Makefile
src/tools/vppapigen/vppapigen.py
src/vnet/devices/virtio/virtio.h
src/vnet/devices/virtio/virtio_pci_modern.c

index 29c4c96..cac1ed7 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -91,6 +91,8 @@ else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-9)
        DEB_DEPENDS += libssl1.0-dev
        DEB_DEPENDS += python-all python-pip
        DEB_DEPENDS += python-dev python-all python-pip python-virtualenv
+else ifeq ($(OS_ID)-$(OS_VERSION_ID),debian-10)
+       DEB_DEPENDS += libelf-dev # for libbpf (af_xdp)
 else
        DEB_DEPENDS += libssl-dev
 endif
index 9d74a5b..bfc77ca 100755 (executable)
@@ -11,7 +11,7 @@ import os
 import sys
 from subprocess import Popen, PIPE
 
-assert sys.version_info >= (3, 6), \
+assert sys.version_info >= (3, 5), \
     "Not supported Python version: {}".format(sys.version)
 log = logging.getLogger('vppapigen')
 
@@ -780,12 +780,13 @@ class VPPAPI(object):
 
     def parse_filename(self, filename, debug=0):
         if self.revision:
-            git_show = f'git show  {self.revision}:{filename}'
+            git_show = 'git show {}:{}'.format(self.revision, filename)
             proc = Popen(git_show.split(), stdout=PIPE, encoding='utf-8')
             try:
                 data, errs = proc.communicate()
                 if proc.returncode != 0:
-                    print(f'File not found: {self.revision}:{filename}', file=sys.stderr)
+                    print('File not found: {}:{}'.format(self.revision,
+                      filename), file=sys.stderr)
                     sys.exit(2)
                 return self.parse_string(data, debug=debug)
             except Exception as e:
@@ -795,7 +796,7 @@ class VPPAPI(object):
                 with open(filename, encoding='utf-8') as fd:
                     return self.parse_fd(fd, None)
             except FileNotFoundError:
-                print(f'File not found: {filename}', file=sys.stderr)
+                print('File not found: {}'.format(filename), file=sys.stderr)
                 sys.exit(2)
 
     def autoreply_block(self, name, parent):
index f1eaa07..b00e1ec 100644 (file)
@@ -129,7 +129,15 @@ typedef struct
 
   /* error */
   clib_error_t *error;
-  u8 mac_addr[6];
+  union
+  {
+    struct
+    {
+      u32 mac_addr32;
+      u16 mac_addr16;
+    };
+    u8 mac_addr[6];
+  };
   union
   {
     struct                     /* tun/tap interface */
index 0d86ff2..4eb0ff1 100644 (file)
@@ -311,19 +311,17 @@ virtio_pci_modern_del_queue (vlib_main_t * vm, virtio_if_t * vif,
 static void
 virtio_pci_modern_get_device_mac (vlib_main_t * vm, virtio_if_t * vif)
 {
-  *((u32 *) vif->mac_addr) =
-    virtio_pci_reg_read_u32 (vif, VIRTIO_MAC_OFFSET (vif));
-  *((u16 *) (vif->mac_addr + 4)) =
+  vif->mac_addr32 = virtio_pci_reg_read_u32 (vif, VIRTIO_MAC_OFFSET (vif));
+  vif->mac_addr16 =
     virtio_pci_reg_read_u16 (vif, VIRTIO_MAC_OFFSET (vif) + 4);
 }
 
 static void
 virtio_pci_modern_set_device_mac (vlib_main_t * vm, virtio_if_t * vif)
 {
-  virtio_pci_reg_write_u32 (vif, VIRTIO_MAC_OFFSET (vif),
-                           *((u32 *) vif->mac_addr));
+  virtio_pci_reg_write_u32 (vif, VIRTIO_MAC_OFFSET (vif), vif->mac_addr32);
   virtio_pci_reg_write_u16 (vif, VIRTIO_MAC_OFFSET (vif) + 4,
-                           *((u16 *) (vif->mac_addr + 4)));
+                           vif->mac_addr16);
 }
 
 static u16