net_dropmon.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifndef __NET_DROPMON_H
  2. #define __NET_DROPMON_H
  3. #include <linux/types.h>
  4. #include <linux/netlink.h>
  5. struct net_dm_drop_point {
  6. __u8 pc[8];
  7. __u32 count;
  8. };
  9. #define is_drop_point_hw(x) do {\
  10. int ____i, ____j;\
  11. for (____i = 0; ____i < 8; i ____i++)\
  12. ____j |= x[____i];\
  13. ____j;\
  14. } while (0)
  15. #define NET_DM_CFG_VERSION 0
  16. #define NET_DM_CFG_ALERT_COUNT 1
  17. #define NET_DM_CFG_ALERT_DELAY 2
  18. #define NET_DM_CFG_MAX 3
  19. struct net_dm_config_entry {
  20. __u32 type;
  21. __u64 data __attribute__((aligned(8)));
  22. };
  23. struct net_dm_config_msg {
  24. __u32 entries;
  25. struct net_dm_config_entry options[0];
  26. };
  27. struct net_dm_alert_msg {
  28. __u32 entries;
  29. struct net_dm_drop_point points[0];
  30. };
  31. struct net_dm_user_msg {
  32. union {
  33. struct net_dm_config_msg user;
  34. struct net_dm_alert_msg alert;
  35. } u;
  36. };
  37. /* These are the netlink message types for this protocol */
  38. enum {
  39. NET_DM_CMD_UNSPEC = 0,
  40. NET_DM_CMD_ALERT,
  41. NET_DM_CMD_CONFIG,
  42. NET_DM_CMD_START,
  43. NET_DM_CMD_STOP,
  44. _NET_DM_CMD_MAX,
  45. };
  46. #define NET_DM_CMD_MAX (_NET_DM_CMD_MAX - 1)
  47. /*
  48. * Our group identifiers
  49. */
  50. #define NET_DM_GRP_ALERT 1
  51. #endif