2
0
mirror of https://github.com/openvswitch/ovs synced 2025-08-31 22:35:15 +00:00

dpif: Make caller of dpif_recv() provide buffer space.

This improves performance under heavy flow setup loads.

Signed-off-by: Ben Pfaff <blp@nicira.com>
This commit is contained in:
Ben Pfaff
2012-04-06 16:23:28 -07:00
parent 26cd7e348b
commit 90a7c55e56
6 changed files with 39 additions and 35 deletions

View File

@@ -1089,7 +1089,8 @@ parse_odp_packet(struct ofpbuf *buf, struct dpif_upcall *upcall,
}
static int
dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall)
dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall,
struct ofpbuf *buf)
{
struct dpif_linux *dpif = dpif_linux_cast(dpif_);
int read_tries = 0;
@@ -1123,7 +1124,6 @@ dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall)
dpif->ready_mask &= ~(1u << indx);
for (;;) {
struct ofpbuf *buf;
int dp_ifindex;
int error;
@@ -1131,10 +1131,8 @@ dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall)
return EAGAIN;
}
buf = ofpbuf_new(2048);
error = nl_sock_recv(upcall_sock, buf, false);
if (error) {
ofpbuf_delete(buf);
if (error == EAGAIN) {
break;
}
@@ -1145,8 +1143,6 @@ dpif_linux_recv(struct dpif *dpif_, struct dpif_upcall *upcall)
if (!error && dp_ifindex == dpif->dp_ifindex) {
return 0;
}
ofpbuf_delete(buf);
if (error) {
return error;
}