mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 14:25:26 +00:00
ofproto: Avoid buffer copy in OFPT_PACKET_IN path.
When a dpif passes an odp_msg down to ofproto, and ofproto transforms it into an ofp_packet_in to send to the controller, until now this always involved a full copy of the packet inside ofproto. This commit eliminates this copy by ensuring that there is always enough headroom in the ofpbuf that holds the odp_msg to replace it by an ofp_packet_in in-place. From Jean Tourrilhes <jt@hpl.hp.com>, with some revisions.
This commit is contained in:
@@ -460,7 +460,8 @@ dpif_linux_recv(struct dpif *dpif_, struct ofpbuf **bufp)
|
||||
int retval;
|
||||
int error;
|
||||
|
||||
buf = ofpbuf_new(65536);
|
||||
buf = ofpbuf_new(65536 + DPIF_RECV_MSG_PADDING);
|
||||
ofpbuf_reserve(buf, DPIF_RECV_MSG_PADDING);
|
||||
retval = read(dpif->fd, ofpbuf_tail(buf), ofpbuf_tailroom(buf));
|
||||
if (retval < 0) {
|
||||
error = errno;
|
||||
|
Reference in New Issue
Block a user