aboutgitcodebugslistschat
path: root/udp.h
diff options
context:
space:
mode:
authorStefano Brivio <sbrivio@redhat.com>2021-04-30 14:52:18 +0200
committerStefano Brivio <sbrivio@redhat.com>2021-04-30 14:52:18 +0200
commite07f539ae0aa3ad623c4e8afcaca26906fd1eb17 (patch)
tree869fc954471b65f6659ca87d9068fd9143e87674 /udp.h
parent605af213c5e0fa047f6d8caef5bcef61a0987c8d (diff)
downloadpasst-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.tar
passt-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.tar.gz
passt-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.tar.bz2
passt-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.tar.lz
passt-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.tar.xz
passt-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.tar.zst
passt-e07f539ae0aa3ad623c4e8afcaca26906fd1eb17.zip
udp, passt: Introduce socket packet buffer, avoid getsockname() for UDP
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>
Diffstat (limited to 'udp.h')
-rw-r--r--udp.h4
1 files changed, 3 insertions, 1 deletions
diff --git a/udp.h b/udp.h
index 201714a..a126488 100644
--- a/udp.h
+++ b/udp.h
@@ -3,7 +3,7 @@
#define UDP_TIMER_INTERVAL 1000 /* ms */
-void udp_sock_handler(struct ctx *c, int s, uint32_t events,
+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);
@@ -14,11 +14,13 @@ 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;
};