1919#include "netstacklat.h"
2020#include "bits.bpf.h"
2121
22+ #define READ_ONCE (x ) (*(volatile typeof(x) *)&(x))
23+
2224char LICENSE [] SEC ("license" ) = "GPL" ;
2325
2426/* The ebpf_exporter variant of netstacklat is not runtime configurable at
@@ -28,7 +30,7 @@ char LICENSE[] SEC("license") = "GPL";
2830const __s64 TAI_OFFSET = (37LL * NS_PER_S );
2931const struct netstacklat_bpf_config user_config = {
3032 .network_ns = 0 ,
31- .filter_min_queue_len = 0 , /* zero means filter is inactive */
33+ .filter_min_sockqueue_len = 0 , /* zero means filter is inactive */
3234 .filter_nth_packet = 0 , /* reduce recorded event to every nth packet, use power-of-2 */
3335 .filter_pid = false,
3436 .filter_ifindex = true,
@@ -122,7 +124,7 @@ struct {
122124#else
123125struct {
124126 __uint (type , BPF_MAP_TYPE_HASH ); /* type: hash */
125- __uint (max_entries , MAX_TRACKED_CGROUPS );
127+ __uint (max_entries , MAX_PARSED_CGROUPS );
126128 __type (key , u64 );
127129 __type (value , u64 );
128130} netstack_cgroupfilter SEC (".maps" );
@@ -305,9 +307,7 @@ static bool filter_network_ns(struct sk_buff *skb, struct sock *sk)
305307 if (user_config .network_ns == 0 )
306308 return true;
307309
308- u32 ns = get_network_ns (skb , sk );
309-
310- return ns == user_config .network_ns ;
310+ return get_network_ns (skb , sk ) == user_config .network_ns ;
311311}
312312
313313#if (CONFIG_HOOKS_EARLY_RCV || CONFIG_HOOKS_ENQUEUE )
@@ -372,7 +372,6 @@ static bool filter_pid(u32 pid)
372372 return false;
373373
374374 return * pid_ok > 0 ;
375-
376375}
377376#endif /* CONFIG_PID_FILTER_MAP */
378377
@@ -425,8 +424,6 @@ static bool filter_current_task()
425424 return ok ;
426425}
427426
428- #define READ_ONCE (x ) (*(volatile typeof(x) *)&(x))
429-
430427/**
431428 * skb_queue_empty - check if a queue is empty
432429 * @list: queue head
@@ -469,9 +466,9 @@ static inline __u32 sk_queue_len(const struct sk_buff_head *list_)
469466 return READ_ONCE (list_ -> qlen );
470467}
471468
472- static bool filter_min_queue_len (struct sock * sk )
469+ static bool filter_min_sockqueue_len (struct sock * sk )
473470{
474- const u32 min_qlen = user_config .filter_min_queue_len ;
471+ const u32 min_qlen = user_config .filter_min_sockqueue_len ;
475472
476473 if (min_qlen == 0 )
477474 return true;
@@ -496,7 +493,7 @@ static __always_inline bool filter_socket(struct sock *sk, struct sk_buff *skb,
496493 if (!filter_nonempty_sockqueue (sk ))
497494 return false;
498495
499- if (!filter_min_queue_len (sk ))
496+ if (!filter_min_sockqueue_len (sk ))
500497 return false;
501498
502499 if (!filter_cgroup (cgroup_id ))
0 commit comments