mirror of
https://github.com/openvswitch/ovs
synced 2025-08-30 22:05:19 +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:
@@ -1280,7 +1280,8 @@ dp_netdev_output_control(struct dp_netdev *dp, const struct ofpbuf *packet,
|
||||
}
|
||||
|
||||
msg_size = sizeof *header + packet->size;
|
||||
msg = ofpbuf_new(msg_size);
|
||||
msg = ofpbuf_new(msg_size + DPIF_RECV_MSG_PADDING);
|
||||
ofpbuf_reserve(msg, DPIF_RECV_MSG_PADDING);
|
||||
header = ofpbuf_put_uninit(msg, sizeof *header);
|
||||
header->type = queue_no;
|
||||
header->length = msg_size;
|
||||
|
Reference in New Issue
Block a user