Skip to content

Commit

Permalink
add sampling check to align with all other ebpf hooks
Browse files Browse the repository at this point in the history
Signed-off-by: Mohamed Mahmoud <[email protected]>
  • Loading branch information
msherif1234 committed Jul 16, 2024
1 parent a593b2a commit 563cd09
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions bpf/ovs_monitoring.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ struct psample_metadata {
u16 out_tc;
u64 out_tc_occ; /* bytes */
u64 latency; /* nanoseconds */
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, unused : 5;
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, rate_as_probability : 1,
unused : 4;
const u8 *user_cookie;
u32 user_cookie_len;
};
Expand Down Expand Up @@ -112,7 +113,7 @@ static inline int trace_ovs_dp(struct sk_buff *skb, struct psample_metadata *md)
SEC("kprobe/psample_sample_packet")
int BPF_KPROBE(ovs_dp_monitor, void *group, struct sk_buff *skb, u32 sample_rate,
struct psample_metadata *md) {
if (enable_ovs_monitoring == 0) {
if (enable_ovs_monitoring == 0 || do_sampling == 0) {
return 0;
}
if (skb == NULL || md == NULL) {
Expand Down
Binary file modified pkg/ebpf/bpf_arm64_bpfel.o
Binary file not shown.
Binary file modified pkg/ebpf/bpf_powerpc_bpfel.o
Binary file not shown.
Binary file modified pkg/ebpf/bpf_s390_bpfeb.o
Binary file not shown.
Binary file modified pkg/ebpf/bpf_x86_bpfel.o
Binary file not shown.

0 comments on commit 563cd09

Please sign in to comment.