1
2 #ifndef __NET_DROPMON_H
3 #define __NET_DROPMON_H
4
5 #include <linux/types.h>
6 #include <linux/netlink.h>
7
8 struct net_dm_drop_point {
9 __u8 pc[8];
10 __u32 count;
11 };
12
13 #define is_drop_point_hw(x) do {\
14 int ____i, ____j;\
15 for (____i = 0; ____i < 8; i ____i++)\
16 ____j |= x[____i];\
17 ____j;\
18 } while (0)
19
20 #define NET_DM_CFG_VERSION 0
21 #define NET_DM_CFG_ALERT_COUNT 1
22 #define NET_DM_CFG_ALERT_DELAY 2
23 #define NET_DM_CFG_MAX 3
24
25 struct net_dm_config_entry {
26 __u32 type;
27 __u64 data __attribute__((aligned(8)));
28 };
29
30 struct net_dm_config_msg {
31 __u32 entries;
32 struct net_dm_config_entry options[0];
33 };
34
35 struct net_dm_alert_msg {
36 __u32 entries;
37 struct net_dm_drop_point points[0];
38 };
39
40 struct net_dm_user_msg {
41 union {
42 struct net_dm_config_msg user;
43 struct net_dm_alert_msg alert;
44 } u;
45 };
46
47
48
49
50 enum {
51 NET_DM_CMD_UNSPEC = 0,
52 NET_DM_CMD_ALERT,
53 NET_DM_CMD_CONFIG,
54 NET_DM_CMD_START,
55 NET_DM_CMD_STOP,
56 NET_DM_CMD_PACKET_ALERT,
57 NET_DM_CMD_CONFIG_GET,
58 NET_DM_CMD_CONFIG_NEW,
59 NET_DM_CMD_STATS_GET,
60 NET_DM_CMD_STATS_NEW,
61 _NET_DM_CMD_MAX,
62 };
63
64 #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1)
65
66
67
68
69 #define NET_DM_GRP_ALERT 1
70
71 enum net_dm_attr {
72 NET_DM_ATTR_UNSPEC,
73
74 NET_DM_ATTR_ALERT_MODE,
75 NET_DM_ATTR_PC,
76 NET_DM_ATTR_SYMBOL,
77 NET_DM_ATTR_IN_PORT,
78 NET_DM_ATTR_TIMESTAMP,
79 NET_DM_ATTR_PROTO,
80 NET_DM_ATTR_PAYLOAD,
81 NET_DM_ATTR_PAD,
82 NET_DM_ATTR_TRUNC_LEN,
83 NET_DM_ATTR_ORIG_LEN,
84 NET_DM_ATTR_QUEUE_LEN,
85 NET_DM_ATTR_STATS,
86 NET_DM_ATTR_HW_STATS,
87 NET_DM_ATTR_ORIGIN,
88 NET_DM_ATTR_HW_TRAP_GROUP_NAME,
89 NET_DM_ATTR_HW_TRAP_NAME,
90 NET_DM_ATTR_HW_ENTRIES,
91 NET_DM_ATTR_HW_ENTRY,
92 NET_DM_ATTR_HW_TRAP_COUNT,
93 NET_DM_ATTR_SW_DROPS,
94 NET_DM_ATTR_HW_DROPS,
95
96 __NET_DM_ATTR_MAX,
97 NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1
98 };
99
100
101
102
103
104
105
106 enum net_dm_alert_mode {
107 NET_DM_ALERT_MODE_SUMMARY,
108 NET_DM_ALERT_MODE_PACKET,
109 };
110
111 enum {
112 NET_DM_ATTR_PORT_NETDEV_IFINDEX,
113 NET_DM_ATTR_PORT_NETDEV_NAME,
114
115 __NET_DM_ATTR_PORT_MAX,
116 NET_DM_ATTR_PORT_MAX = __NET_DM_ATTR_PORT_MAX - 1
117 };
118
119 enum {
120 NET_DM_ATTR_STATS_DROPPED,
121
122 __NET_DM_ATTR_STATS_MAX,
123 NET_DM_ATTR_STATS_MAX = __NET_DM_ATTR_STATS_MAX - 1
124 };
125
126 enum net_dm_origin {
127 NET_DM_ORIGIN_SW,
128 NET_DM_ORIGIN_HW,
129 };
130
131 #endif