Skip to content

Commit 2a16ad6

Browse files
committed
OCP4.19 uses rhel9.6 which doesn't have rh_psample_sample_packet anymore
Signed-off-by: Mohamed Mahmoud <[email protected]>
1 parent 15d1300 commit 2a16ad6

16 files changed

+238
-239
lines changed

.mk/bc.mk

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ define PROGRAMS
1717
"tcp_rcv_fentry":"fentry",
1818
"tcp_rcv_kprobe":"kprobe",
1919
"kfree_skb":"tracepoint",
20-
"rh_network_events_monitoring":"kprobe",
20+
"network_events_monitoring":"kprobe",
2121
"track_nat_manip_pkt":"kprobe"
2222
}
2323
endef

bpf/headers/vmlinux_amd64.h

+13
Original file line numberDiff line numberDiff line change
@@ -79761,6 +79761,19 @@ struct psample_group {
7976179761
struct callback_head rcu;
7976279762
};
7976379763

79764+
struct psample_metadata {
79765+
u32 trunc_size;
79766+
int in_ifindex;
79767+
int out_ifindex;
79768+
u16 out_tc;
79769+
u64 out_tc_occ; /* bytes */
79770+
u64 latency; /* nanoseconds */
79771+
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, rate_as_probability : 1,
79772+
unused : 4;
79773+
const u8 *user_cookie;
79774+
u32 user_cookie_len;
79775+
};
79776+
7976479777
struct action_gate_entry {
7976579778
u8 gate_state;
7976679779
u32 interval;

bpf/headers/vmlinux_arm64.h

+13
Original file line numberDiff line numberDiff line change
@@ -89448,6 +89448,19 @@ struct psample_group {
8944889448
struct callback_head rcu;
8944989449
};
8945089450

89451+
struct psample_metadata {
89452+
u32 trunc_size;
89453+
int in_ifindex;
89454+
int out_ifindex;
89455+
u16 out_tc;
89456+
u64 out_tc_occ; /* bytes */
89457+
u64 latency; /* nanoseconds */
89458+
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, rate_as_probability : 1,
89459+
unused : 4;
89460+
const u8 *user_cookie;
89461+
u32 user_cookie_len;
89462+
};
89463+
8945189464
struct action_gate_entry {
8945289465
u8 gate_state;
8945389466
u32 interval;

bpf/headers/vmlinux_ppc64le.h

+13
Original file line numberDiff line numberDiff line change
@@ -139483,6 +139483,19 @@ struct psample_group {
139483139483
struct callback_head rcu;
139484139484
};
139485139485

139486+
struct psample_metadata {
139487+
u32 trunc_size;
139488+
int in_ifindex;
139489+
int out_ifindex;
139490+
u16 out_tc;
139491+
u64 out_tc_occ; /* bytes */
139492+
u64 latency; /* nanoseconds */
139493+
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, rate_as_probability : 1,
139494+
unused : 4;
139495+
const u8 *user_cookie;
139496+
u32 user_cookie_len;
139497+
};
139498+
139486139499
struct action_gate_entry {
139487139500
u8 gate_state;
139488139501
u32 interval;

bpf/headers/vmlinux_s390.h

+13
Original file line numberDiff line numberDiff line change
@@ -64738,6 +64738,19 @@ struct psample_group {
6473864738
struct callback_head rcu;
6473964739
};
6474064740

64741+
struct psample_metadata {
64742+
u32 trunc_size;
64743+
int in_ifindex;
64744+
int out_ifindex;
64745+
u16 out_tc;
64746+
u64 out_tc_occ; /* bytes */
64747+
u64 latency; /* nanoseconds */
64748+
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, rate_as_probability : 1,
64749+
unused : 4;
64750+
const u8 *user_cookie;
64751+
u32 user_cookie_len;
64752+
};
64753+
6474164754
struct action_gate_entry {
6474264755
u8 gate_state;
6474364756
u32 interval;

bpf/network_events_monitoring.h

+4-44
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,6 @@
77

88
#include "utils.h"
99

10-
struct rh_psample_metadata {
11-
u32 trunc_size;
12-
int in_ifindex;
13-
int out_ifindex;
14-
u16 out_tc;
15-
u64 out_tc_occ; /* bytes */
16-
u64 latency; /* nanoseconds */
17-
u8 out_tc_valid : 1, out_tc_occ_valid : 1, latency_valid : 1, rate_as_probability : 1,
18-
unused : 4;
19-
const u8 *user_cookie;
20-
u32 user_cookie_len;
21-
};
22-
2310
static inline bool md_already_exists(u8 network_events[MAX_NETWORK_EVENTS][MAX_EVENT_MD], u8 *md) {
2411
for (u8 i = 0; i < MAX_NETWORK_EVENTS; i++) {
2512
if (__builtin_memcmp(network_events[i], md, MAX_EVENT_MD) == 0) {
@@ -51,7 +38,7 @@ static inline int lookup_and_update_existing_flow_network_events(flow_id *id, u8
5138
return -1;
5239
}
5340

54-
static inline int trace_network_events(struct sk_buff *skb, struct rh_psample_metadata *md) {
41+
static inline int trace_network_events(struct sk_buff *skb, struct psample_metadata *md) {
5542
u8 dscp = 0, protocol = 0, md_len = 0;
5643
u16 family = 0, flags = 0, eth_protocol = 0;
5744
u8 *user_cookie = NULL;
@@ -129,35 +116,9 @@ static inline int trace_network_events(struct sk_buff *skb, struct rh_psample_me
129116
return ret;
130117
}
131118

132-
// for older kernel will use `rh_psample_sample_packet` to avoid kapis issues
133-
SEC("kprobe/rh_psample_sample_packet")
134-
int BPF_KPROBE(rh_network_events_monitoring, struct psample_group *group, struct sk_buff *skb,
135-
u32 sample_rate, struct rh_psample_metadata *md) {
136-
if (enable_network_events_monitoring == 0 || do_sampling == 0) {
137-
return 0;
138-
}
139-
if (skb == NULL || md == NULL || group == NULL) {
140-
increase_counter(NETWORK_EVENTS_ERR);
141-
return 0;
142-
}
143-
// filter out none matching samples with different groupid
144-
int group_id = BPF_CORE_READ(group, group_num);
145-
if (group_id != network_events_monitoring_groupid) {
146-
increase_counter(NETWORK_EVENTS_ERR_GROUPID_MISMATCH);
147-
return 0;
148-
}
149-
long ret = 0;
150-
if ((ret = trace_network_events(skb, md)) != 0) {
151-
increase_counter(NETWORK_EVENTS_ERR_UPDATE_MAP_FLOWS);
152-
return 0;
153-
}
154-
increase_counter(NETWORK_EVENTS_GOOD);
155-
return 0;
156-
}
157-
/*
158119
SEC("kprobe/psample_sample_packet")
159-
int BPF_KPROBE(network_events_monitoring, struct psample_group *group, struct sk_buff *skb, u32 sample_rate,
160-
struct psample_metadata *md) {
120+
int BPF_KPROBE(network_events_monitoring, struct psample_group *group, struct sk_buff *skb,
121+
u32 sample_rate, struct psample_metadata *md) {
161122
if (enable_network_events_monitoring == 0 || do_sampling == 0) {
162123
return 0;
163124
}
@@ -171,7 +132,6 @@ int BPF_KPROBE(network_events_monitoring, struct psample_group *group, struct sk
171132
increase_counter(NETWORK_EVENTS_ERR_GROUPID_MISMATCH);
172133
return 0;
173134
}
174-
175135
long ret = 0;
176136
if ((ret = trace_network_events(skb, md)) != 0) {
177137
increase_counter(NETWORK_EVENTS_ERR_UPDATE_MAP_FLOWS);
@@ -180,5 +140,5 @@ int BPF_KPROBE(network_events_monitoring, struct psample_group *group, struct sk
180140
increase_counter(NETWORK_EVENTS_GOOD);
181141
return 0;
182142
}
183-
*/
143+
184144
#endif /* __NETWORK_EVENTS_MONITORING_H__ */

pkg/ebpf/bpf_arm64_bpfel.go

+27-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ebpf/bpf_arm64_bpfel.o

-32 Bytes
Binary file not shown.

pkg/ebpf/bpf_powerpc_bpfel.go

+27-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ebpf/bpf_powerpc_bpfel.o

-32 Bytes
Binary file not shown.

pkg/ebpf/bpf_s390_bpfeb.go

+27-27
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/ebpf/bpf_s390_bpfeb.o

-32 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)