|
@@ -302,11 +302,11 @@ void perf_event_batch_output(void *ctx, struct l7_event *e) {
|
|
|
|
|
|
|
|
__u32 e_length = offsetof(typeof(struct l7_event), payload) + (e->payload_size);
|
|
__u32 e_length = offsetof(typeof(struct l7_event), payload) + (e->payload_size);
|
|
|
bpf_printk("IK...perf_event_batch_output...e->payload_size=%d, e_length=%d", e->payload_size, e_length);
|
|
bpf_printk("IK...perf_event_batch_output...e->payload_size=%d, e_length=%d", e->payload_size, e_length);
|
|
|
- unsigned char *src = (unsigned char *)e;
|
|
|
|
|
- unsigned char *dst = e_buff->data + e_buff->len;
|
|
|
|
|
- for (int i = 0; i < e_length; i++) { //IK:ERROR: IK: BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
|
|
|
|
|
- *dst++ = *src++;
|
|
|
|
|
- }
|
|
|
|
|
|
|
+// unsigned char *src = (unsigned char *)e;
|
|
|
|
|
+// unsigned char *dst = e_buff->data + e_buff->len;
|
|
|
|
|
+// for (int i = 0; i < e_length; i++) { //IK:ERROR: IK: BPF stack limit of 512 bytes is exceeded. Please move large on stack variables into BPF per-cpu array map.
|
|
|
|
|
+// *dst++ = *src++;
|
|
|
|
|
+// }
|
|
|
|
|
|
|
|
// IK: 更新e_buff.
|
|
// IK: 更新e_buff.
|
|
|
// __u32 e_length = sizeof(*e);
|
|
// __u32 e_length = sizeof(*e);
|
|
@@ -334,9 +334,10 @@ void perf_event_batch_output(void *ctx, struct l7_event *e) {
|
|
|
// IK: (v_buff->len + offsetof(typeof(struct __socket_data_buffer), data)) 是e_buff的实际长度
|
|
// IK: (v_buff->len + offsetof(typeof(struct __socket_data_buffer), data)) 是e_buff的实际长度
|
|
|
// IK:TODO: 和(sizeof(*e_buff) - 1)做&计算什么意思呢? 计算一个缓冲区的大小,以确保其大小是sizeof(*v_buff)的整数倍? NO
|
|
// IK:TODO: 和(sizeof(*e_buff) - 1)做&计算什么意思呢? 计算一个缓冲区的大小,以确保其大小是sizeof(*v_buff)的整数倍? NO
|
|
|
// 32700=0*8 0*8 01111111 10011100 & (0*8 0*8 10000000 00000000 - 1 = 0*8 0*8 01111111 11111111) = 0*8 0*8 0*8 01100011 = 32700
|
|
// 32700=0*8 0*8 01111111 10011100 & (0*8 0*8 10000000 00000000 - 1 = 0*8 0*8 01111111 11111111) = 0*8 0*8 0*8 01100011 = 32700
|
|
|
- // __u32 t1 = (e_buff->len + offsetof(typeof(struct __socket_data_buffer), data));
|
|
|
|
|
- // __u32 t2 = (sizeof(*e_buff) - 1);
|
|
|
|
|
- // bpf_printk("IK...perf_event_batch_output...%d, %d",t1, t2); // 18424, 32767
|
|
|
|
|
|
|
+ __u32 t1 = (e_buff->len + offsetof(typeof(struct __socket_data_buffer), data));
|
|
|
|
|
+ __u32 t2 = (sizeof(*e_buff) - 1);
|
|
|
|
|
+ __u32 t3 = e_buff->events_num
|
|
|
|
|
+ bpf_printk("IK...perf_event_batch_output...%d, %d, %d",t1, t2, t3); // 18424, 32767
|
|
|
//__u32 buf_size = (e_buff->len + offsetof(typeof(struct __socket_data_buffer), data)) & (sizeof(*e_buff) - 1);
|
|
//__u32 buf_size = (e_buff->len + offsetof(typeof(struct __socket_data_buffer), data)) & (sizeof(*e_buff) - 1);
|
|
|
// bpf_printk("IK...perf_event_batch_output...%d", buf_size); // 18424
|
|
// bpf_printk("IK...perf_event_batch_output...%d", buf_size); // 18424
|
|
|
|
|
|