e07f539ae0
This is in preparation for scatter-gather IO on the UDP receive path: save a getsockname() syscall by setting a flag if we get the numbering of all bound sockets in a strict sequence (expected, in practice) and repurpose the tap buffer to be also a socket receive buffer, passing it down to protocol handlers. Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
27 lines
789 B
C
27 lines
789 B
C
#ifndef UDP_H
|
|
#define UDP_H
|
|
|
|
#define UDP_TIMER_INTERVAL 1000 /* ms */
|
|
|
|
void udp_sock_handler(struct ctx *c, int s, uint32_t events, char *pkt_buf,
|
|
struct timespec *now);
|
|
int udp_tap_handler(struct ctx *c, int af, void *addr,
|
|
struct tap_msg *msg, int count, struct timespec *now);
|
|
int udp_sock_init(struct ctx *c);
|
|
void udp_timer(struct ctx *c, struct timespec *ts);
|
|
|
|
/**
|
|
* struct udp_ctx - Execution context for UDP
|
|
* @fd_min: Lowest file descriptor number for UDP ever used
|
|
* @fd_max: Highest file descriptor number for UDP ever used
|
|
* @fd_in_seq: 1 if all socket numbers are in sequence, 0 otherwise
|
|
* @timer_run: Timestamp of most recent timer run
|
|
*/
|
|
struct udp_ctx {
|
|
int fd_min;
|
|
int fd_max;
|
|
int fd_in_seq;
|
|
struct timespec timer_run;
|
|
};
|
|
|
|
#endif /* UDP_H */
|