Debian Codegraph @

src/net_dropmon.h

raw symbols SCIP
1 /*
2 * SPDX-License-Identifier: GPL-2.0-or-later
3 */
4 #ifndef __NET_DROPMON_H
5 #define __NET_DROPMON_H
6
7 #include <linux/netlink.h>
8
9 #ifndef SOL_NETLINK
10 #define SOL_NETLINK 270
11 #endif
12
13 struct net_dm_drop_point {
14 __u8 pc[8];
15 __u32 count;
16 };
17
18 #define NET_DM_CFG_VERSION 0
19 #define NET_DM_CFG_ALERT_COUNT 1
20 #define NET_DM_CFG_ALERT_DELAY 2
21 #define NET_DM_CFG_MAX 3
22
23 struct net_dm_config_entry {
24 __u32 type;
25 __u64 data __attribute__((aligned(8)));
26 };
27
28 struct net_dm_config_msg {
29 __u32 entries;
30 struct net_dm_config_entry options[0];
31 };
32
33 struct net_dm_alert_msg {
34 __u32 entries;
35 struct net_dm_drop_point points[0];
36 };
37
38 struct net_dm_user_msg {
39 union {
40 struct net_dm_config_msg user;
41 struct net_dm_alert_msg alert;
42 } u;
43 };
44
45
46 /* These are the netlink message types for this protocol */
47
48 enum {
49 NET_DM_CMD_UNSPEC = 0,
50 NET_DM_CMD_ALERT,
51 NET_DM_CMD_CONFIG,
52 NET_DM_CMD_START,
53 NET_DM_CMD_STOP,
54 NET_DM_CMD_PACKET_ALERT,
55 NET_DM_CMD_CONFIG_GET,
56 NET_DM_CMD_CONFIG_NEW,
57 NET_DM_CMD_STATS_GET,
58 NET_DM_CMD_STATS_NEW,
59 _NET_DM_CMD_MAX,
60 };
61
62 #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1)
63
64 /*
65 * Our group identifiers
66 */
67 #define NET_DM_GRP_ALERT 1
68
69 enum net_dm_attr {
70 NET_DM_ATTR_UNSPEC,
71
72 NET_DM_ATTR_ALERT_MODE, /* u8 */
73 NET_DM_ATTR_PC, /* u64 */
74 NET_DM_ATTR_SYMBOL, /* string */
75 NET_DM_ATTR_IN_PORT, /* nested */
76 NET_DM_ATTR_TIMESTAMP, /* u64 */
77 NET_DM_ATTR_PROTO, /* u16 */
78 NET_DM_ATTR_PAYLOAD, /* binary */
79 NET_DM_ATTR_PAD,
80 NET_DM_ATTR_TRUNC_LEN, /* u32 */
81 NET_DM_ATTR_ORIG_LEN, /* u32 */
82 NET_DM_ATTR_QUEUE_LEN, /* u32 */
83 NET_DM_ATTR_STATS, /* nested */
84 NET_DM_ATTR_HW_STATS, /* nested */
85 NET_DM_ATTR_ORIGIN, /* u16 */
86 NET_DM_ATTR_HW_TRAP_GROUP_NAME, /* string */
87 NET_DM_ATTR_HW_TRAP_NAME, /* string */
88 NET_DM_ATTR_HW_ENTRIES, /* nested */
89 NET_DM_ATTR_HW_ENTRY, /* nested */
90 NET_DM_ATTR_HW_TRAP_COUNT, /* u32 */
91 NET_DM_ATTR_SW_DROPS, /* flag */
92 NET_DM_ATTR_HW_DROPS, /* flag */
93 NET_DM_ATTR_FLOW_ACTION_COOKIE, /* binary */
94 NET_DM_ATTR_REASON, /* string */
95
96 __NET_DM_ATTR_MAX,
97 NET_DM_ATTR_MAX = __NET_DM_ATTR_MAX - 1
98 };
99
100 /**
101 * enum net_dm_alert_mode - Alert mode.
102 * @NET_DM_ALERT_MODE_SUMMARY: A summary of recent drops is sent to user space.
103 * @NET_DM_ALERT_MODE_PACKET: Each dropped packet is sent to user space along
104 * with metadata.
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, /* u32 */
113 NET_DM_ATTR_PORT_NETDEV_NAME, /* string */
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, /* u64 */
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