xref: /qemu/ebpf/ebpf_rss.h (revision 0524ea05)
146627f41SAndrew Melnychenko /*
246627f41SAndrew Melnychenko  * eBPF RSS header
346627f41SAndrew Melnychenko  *
446627f41SAndrew Melnychenko  * Developed by Daynix Computing LTD (http://www.daynix.com)
546627f41SAndrew Melnychenko  *
646627f41SAndrew Melnychenko  * Authors:
746627f41SAndrew Melnychenko  *  Andrew Melnychenko <andrew@daynix.com>
846627f41SAndrew Melnychenko  *  Yuri Benditovich <yuri.benditovich@daynix.com>
946627f41SAndrew Melnychenko  *
1046627f41SAndrew Melnychenko  * This work is licensed under the terms of the GNU GPL, version 2.  See
1146627f41SAndrew Melnychenko  * the COPYING file in the top-level directory.
1246627f41SAndrew Melnychenko  */
1346627f41SAndrew Melnychenko 
1446627f41SAndrew Melnychenko #ifndef QEMU_EBPF_RSS_H
1546627f41SAndrew Melnychenko #define QEMU_EBPF_RSS_H
1646627f41SAndrew Melnychenko 
170524ea05SAndrew Melnychenko #define EBPF_RSS_MAX_FDS 4
180524ea05SAndrew Melnychenko 
1946627f41SAndrew Melnychenko struct EBPFRSSContext {
2046627f41SAndrew Melnychenko     void *obj;
2146627f41SAndrew Melnychenko     int program_fd;
2246627f41SAndrew Melnychenko     int map_configuration;
2346627f41SAndrew Melnychenko     int map_toeplitz_key;
2446627f41SAndrew Melnychenko     int map_indirections_table;
25333b3e5fSAndrew Melnychenko 
26333b3e5fSAndrew Melnychenko     /* mapped eBPF maps for direct access to omit bpf_map_update_elem() */
27333b3e5fSAndrew Melnychenko     void *mmap_configuration;
28333b3e5fSAndrew Melnychenko     void *mmap_toeplitz_key;
29333b3e5fSAndrew Melnychenko     void *mmap_indirections_table;
3046627f41SAndrew Melnychenko };
3146627f41SAndrew Melnychenko 
3246627f41SAndrew Melnychenko struct EBPFRSSConfig {
3346627f41SAndrew Melnychenko     uint8_t redirect;
3446627f41SAndrew Melnychenko     uint8_t populate_hash;
3546627f41SAndrew Melnychenko     uint32_t hash_types;
3646627f41SAndrew Melnychenko     uint16_t indirections_len;
3746627f41SAndrew Melnychenko     uint16_t default_queue;
3846627f41SAndrew Melnychenko } __attribute__((packed));
3946627f41SAndrew Melnychenko 
4046627f41SAndrew Melnychenko void ebpf_rss_init(struct EBPFRSSContext *ctx);
4146627f41SAndrew Melnychenko 
4246627f41SAndrew Melnychenko bool ebpf_rss_is_loaded(struct EBPFRSSContext *ctx);
4346627f41SAndrew Melnychenko 
4446627f41SAndrew Melnychenko bool ebpf_rss_load(struct EBPFRSSContext *ctx);
4546627f41SAndrew Melnychenko 
460524ea05SAndrew Melnychenko bool ebpf_rss_load_fds(struct EBPFRSSContext *ctx, int program_fd,
470524ea05SAndrew Melnychenko                        int config_fd, int toeplitz_fd, int table_fd);
480524ea05SAndrew Melnychenko 
4946627f41SAndrew Melnychenko bool ebpf_rss_set_all(struct EBPFRSSContext *ctx, struct EBPFRSSConfig *config,
5046627f41SAndrew Melnychenko                       uint16_t *indirections_table, uint8_t *toeplitz_key);
5146627f41SAndrew Melnychenko 
5246627f41SAndrew Melnychenko void ebpf_rss_unload(struct EBPFRSSContext *ctx);
5346627f41SAndrew Melnychenko 
5446627f41SAndrew Melnychenko #endif /* QEMU_EBPF_RSS_H */
55