Neil Horman | 9a8afc8 | 2009-03-11 09:51:26 +0000 | [diff] [blame] | 1 | #ifndef __NET_DROPMON_H |
| 2 | #define __NET_DROPMON_H |
| 3 | |
Jaswinder Singh Rajput | d280cc9 | 2009-06-01 06:23:25 +0000 | [diff] [blame] | 4 | #include <linux/types.h> |
Neil Horman | 9a8afc8 | 2009-03-11 09:51:26 +0000 | [diff] [blame] | 5 | #include <linux/netlink.h> |
| 6 | |
| 7 | struct net_dm_drop_point { |
| 8 | __u8 pc[8]; |
| 9 | __u32 count; |
| 10 | }; |
| 11 | |
Neil Horman | 4ea7e38 | 2009-05-21 07:36:08 +0000 | [diff] [blame] | 12 | #define is_drop_point_hw(x) do {\ |
| 13 | int ____i, ____j;\ |
| 14 | for (____i = 0; ____i < 8; i ____i++)\ |
| 15 | ____j |= x[____i];\ |
| 16 | ____j;\ |
| 17 | } while (0) |
| 18 | |
Neil Horman | 9a8afc8 | 2009-03-11 09:51:26 +0000 | [diff] [blame] | 19 | #define NET_DM_CFG_VERSION 0 |
| 20 | #define NET_DM_CFG_ALERT_COUNT 1 |
| 21 | #define NET_DM_CFG_ALERT_DELAY 2 |
| 22 | #define NET_DM_CFG_MAX 3 |
| 23 | |
| 24 | struct net_dm_config_entry { |
| 25 | __u32 type; |
| 26 | __u64 data __attribute__((aligned(8))); |
| 27 | }; |
| 28 | |
| 29 | struct net_dm_config_msg { |
| 30 | __u32 entries; |
| 31 | struct net_dm_config_entry options[0]; |
| 32 | }; |
| 33 | |
| 34 | struct net_dm_alert_msg { |
| 35 | __u32 entries; |
| 36 | struct net_dm_drop_point points[0]; |
| 37 | }; |
| 38 | |
| 39 | struct net_dm_user_msg { |
| 40 | union { |
| 41 | struct net_dm_config_msg user; |
| 42 | struct net_dm_alert_msg alert; |
| 43 | } u; |
| 44 | }; |
| 45 | |
| 46 | |
| 47 | /* These are the netlink message types for this protocol */ |
| 48 | |
| 49 | enum { |
| 50 | NET_DM_CMD_UNSPEC = 0, |
| 51 | NET_DM_CMD_ALERT, |
| 52 | NET_DM_CMD_CONFIG, |
| 53 | NET_DM_CMD_START, |
| 54 | NET_DM_CMD_STOP, |
| 55 | _NET_DM_CMD_MAX, |
| 56 | }; |
| 57 | |
| 58 | #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1) |
| 59 | |
| 60 | /* |
| 61 | * Our group identifiers |
| 62 | */ |
| 63 | #define NET_DM_GRP_ALERT 1 |
| 64 | #endif |