ebpf_rss.h 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. /*
  2. * eBPF RSS header
  3. *
  4. * Developed by Daynix Computing LTD (http://www.daynix.com)
  5. *
  6. * Authors:
  7. * Andrew Melnychenko <andrew@daynix.com>
  8. * Yuri Benditovich <yuri.benditovich@daynix.com>
  9. *
  10. * This work is licensed under the terms of the GNU GPL, version 2. See
  11. * the COPYING file in the top-level directory.
  12. */
  13. #ifndef QEMU_EBPF_RSS_H
  14. #define QEMU_EBPF_RSS_H
  15. #include "qapi/error.h"
  16. #define EBPF_RSS_MAX_FDS 4
  17. struct EBPFRSSContext {
  18. void *obj;
  19. int program_fd;
  20. int map_configuration;
  21. int map_toeplitz_key;
  22. int map_indirections_table;
  23. /* mapped eBPF maps for direct access to omit bpf_map_update_elem() */
  24. void *mmap_configuration;
  25. void *mmap_toeplitz_key;
  26. void *mmap_indirections_table;
  27. };
  28. struct EBPFRSSConfig {
  29. uint8_t redirect;
  30. uint8_t populate_hash;
  31. uint32_t hash_types;
  32. uint16_t indirections_len;
  33. uint16_t default_queue;
  34. } __attribute__((packed));
  35. void ebpf_rss_init(struct EBPFRSSContext *ctx);
  36. bool ebpf_rss_is_loaded(struct EBPFRSSContext *ctx);
  37. bool ebpf_rss_load(struct EBPFRSSContext *ctx, Error **errp);
  38. bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
  39. int config_fd, int toeplitz_fd, int table_fd,
  40. Error **errp);
  41. bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
  42. uint16_t *indirections_table, uint8_t *toeplitz_key,
  43. Error **errp);
  44. void ebpf_rss_unload(struct EBPFRSSContext *ctx);
  45. #endif /* QEMU_EBPF_RSS_H */