2
0

qosify-bpf.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. // SPDX-License-Identifier: GPL-2.0+
  2. /*
  3. * Copyright (C) 2021 Felix Fietkau <nbd@nbd.name>
  4. */
  5. #ifndef __BPF_QOSIFY_H
  6. #define __BPF_QOSIFY_H
  7. #define QOSIFY_MAX_CLASS_ENTRIES 16
  8. #define QOSIFY_DEFAULT_CLASS_ENTRIES 2
  9. #ifndef QOSIFY_FLOW_BUCKET_SHIFT
  10. #define QOSIFY_FLOW_BUCKET_SHIFT 13
  11. #endif
  12. #define QOSIFY_FLOW_BUCKETS (1 << QOSIFY_FLOW_BUCKET_SHIFT)
  13. /* rodata per-instance flags */
  14. #define QOSIFY_INGRESS (1 << 0)
  15. #define QOSIFY_IP_ONLY (1 << 1)
  16. #define QOSIFY_DSCP_VALUE_MASK ((1 << 6) - 1)
  17. #define QOSIFY_DSCP_FALLBACK_FLAG (1 << 6)
  18. #define QOSIFY_DSCP_CLASS_FLAG (1 << 7)
  19. #define QOSIFY_CLASS_FLAG_PRESENT (1 << 0)
  20. struct qosify_dscp_val {
  21. uint8_t ingress;
  22. uint8_t egress;
  23. };
  24. /* global config data */
  25. struct qosify_flow_config {
  26. uint8_t dscp_prio;
  27. uint8_t dscp_bulk;
  28. uint8_t bulk_trigger_timeout;
  29. uint16_t bulk_trigger_pps;
  30. uint16_t prio_max_avg_pkt_len;
  31. };
  32. struct qosify_config {
  33. uint8_t dscp_icmp;
  34. };
  35. struct qosify_ip_map_val {
  36. uint8_t dscp; /* must be first */
  37. uint8_t seen;
  38. };
  39. struct qosify_class {
  40. struct qosify_flow_config config;
  41. struct qosify_dscp_val val;
  42. uint8_t flags;
  43. uint64_t packets;
  44. };
  45. #endif