]> git.proxmox.com Git - ovs.git/commitdiff
netdev-afxdp: Enable libbpf logging to OVS.
authorWilliam Tu <u9012063@gmail.com>
Wed, 20 Nov 2019 20:25:56 +0000 (12:25 -0800)
committerWilliam Tu <u9012063@gmail.com>
Thu, 21 Nov 2019 17:20:10 +0000 (09:20 -0800)
libbpf has pr_warn, pr_info, and pr_debug. The patch registers
these print functions, integrating the libbpf logs to OVS log.

Signed-off-by: William Tu <u9012063@gmail.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
lib/netdev-afxdp.c
lib/netdev-afxdp.h
lib/netdev-linux.c

index e1cd88351ca06996db9d74c8395db9691421db86..ca2dfd005b9f285f0ff2da24c1420e6eb59ba3de 100644 (file)
@@ -1099,6 +1099,26 @@ netdev_afxdp_rxq_destruct(struct netdev_rxq *rxq_ OVS_UNUSED)
     /* Nothing. */
 }
 
+static int
+libbpf_print(enum libbpf_print_level level,
+             const char *format, va_list args)
+{
+    if (level == LIBBPF_WARN) {
+        vlog_valist(&this_module, VLL_WARN, format, args);
+    } else if (level == LIBBPF_INFO) {
+        vlog_valist(&this_module, VLL_INFO, format, args);
+    } else {
+        vlog_valist(&this_module, VLL_DBG, format, args);
+    }
+    return 0;
+}
+
+int netdev_afxdp_init(void)
+{
+    libbpf_set_print(libbpf_print);
+    return 0;
+}
+
 int
 netdev_afxdp_construct(struct netdev *netdev)
 {
index 54079c80c010966de486cd618a8c295b2d352050..8188bc6695268309b8eb213349f71ef84479c8d3 100644 (file)
@@ -46,6 +46,7 @@ struct netdev_custom_stats;
 
 int netdev_afxdp_rxq_construct(struct netdev_rxq *rxq_);
 void netdev_afxdp_rxq_destruct(struct netdev_rxq *rxq_);
+int netdev_afxdp_init(void);
 int netdev_afxdp_construct(struct netdev *netdev_);
 void netdev_afxdp_destruct(struct netdev *netdev_);
 int netdev_afxdp_verify_mtu_size(const struct netdev *netdev, int mtu);
index 0a32cf9bcae1b341441a6fc8edaa60bfd182012e..f8e59bacfb1336c498a16050bb7ddb502cd9443f 100644 (file)
@@ -3299,6 +3299,7 @@ const struct netdev_class netdev_afxdp_class = {
     NETDEV_LINUX_CLASS_COMMON,
     .type = "afxdp",
     .is_pmd = true,
+    .init = netdev_afxdp_init,
     .construct = netdev_afxdp_construct,
     .destruct = netdev_afxdp_destruct,
     .get_stats = netdev_afxdp_get_stats,