0001
0002 #ifndef __NETCNT_COMMON_H
0003 #define __NETCNT_COMMON_H
0004
0005 #include <linux/types.h>
0006
0007 #define MAX_PERCPU_PACKETS 32
0008
0009
0010
0011
0012
0013
0014
0015 #define SIZEOF_BPF_LOCAL_STORAGE_ELEM 256
0016
0017
0018 #define BPF_LOCAL_STORAGE_MAX_VALUE_SIZE (0xFFFF - \
0019 SIZEOF_BPF_LOCAL_STORAGE_ELEM)
0020
0021 #define PCPU_MIN_UNIT_SIZE 32768
0022
0023 union percpu_net_cnt {
0024 struct {
0025 __u64 packets;
0026 __u64 bytes;
0027
0028 __u64 prev_ts;
0029
0030 __u64 prev_packets;
0031 __u64 prev_bytes;
0032 };
0033 __u8 data[PCPU_MIN_UNIT_SIZE];
0034 };
0035
0036 union net_cnt {
0037 struct {
0038 __u64 packets;
0039 __u64 bytes;
0040 };
0041 __u8 data[BPF_LOCAL_STORAGE_MAX_VALUE_SIZE];
0042 };
0043
0044 #endif