Message ID | 1574281556-30859-1-git-send-email-u9012063@gmail.com |
---|---|
State | Accepted |
Headers | show |
Series | [ovs-dev] netdev-afxdp: Enable libbpf logging to OVS. | expand |
On 20 Nov 2019, at 21:25, William Tu wrote: > 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> Looks good to me… Acked-by: Eelco Chaudron <echaudro@redhat.com>
On Thu, Nov 21, 2019 at 11:37:48AM +0100, Eelco Chaudron wrote: > > On 20 Nov 2019, at 21:25, William Tu wrote: > > > 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> > > Looks good to me… > > Acked-by: Eelco Chaudron <echaudro@redhat.com> > Thanks, applied to master
diff --git a/lib/netdev-afxdp.c b/lib/netdev-afxdp.c index e1cd88351ca0..ca2dfd005b9f 100644 --- a/lib/netdev-afxdp.c +++ b/lib/netdev-afxdp.c @@ -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) { diff --git a/lib/netdev-afxdp.h b/lib/netdev-afxdp.h index 54079c80c010..8188bc669526 100644 --- a/lib/netdev-afxdp.h +++ b/lib/netdev-afxdp.h @@ -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); diff --git a/lib/netdev-linux.c b/lib/netdev-linux.c index 0a32cf9bcae1..f8e59bacfb13 100644 --- a/lib/netdev-linux.c +++ b/lib/netdev-linux.c @@ -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,
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> --- lib/netdev-afxdp.c | 20 ++++++++++++++++++++ lib/netdev-afxdp.h | 1 + lib/netdev-linux.c | 1 + 3 files changed, 22 insertions(+)