dpif-netdev: Upcall: Remove an extra memcpy of packet data.
authorRyan Wilson <wryan@nicira.com>
Wed, 4 Jun 2014 20:49:06 +0000 (13:49 -0700)
committerPravin B Shelar <pshelar@nicira.com>
Wed, 4 Jun 2014 22:48:30 +0000 (15:48 -0700)
commit143859ec63d45e5184356984dbf10c142e0ded39
tree37cf718ff2bf432328c62dade82b880e8f869692
parentd221ffa1e128736aa2d22209476818c86fdfd6b3
dpif-netdev: Upcall: Remove an extra memcpy of packet data.

When a bridge of datatype type netdev receives a packet, it
copies the packet from the NIC to a buffer in userspace.
Currently, when making an upcall, the packet is again copied
to the upcall's buffer. However, this extra copy is not
necessary when the datapath exists in userspace as the upcall
can directly access the packet data.

This patch eliminates this extra copy of the packet data in
most cases. In cases where the packet may still be used later
by callers of dp_netdev_execute_actions, making a copy of the
packet data is still necessary.

This patch also adds a dpdk_buf field to 'struct ofpbuf' when
using DPDK. This field holds a pointer to the allocated DPDK
buffer in the rte_mempool. Thus, an upcall packet ofpbuf
allocated on the stack can now share data and free memory of
a rte_mempool allocated ofpbuf.

Signed-off-by: Ryan Wilson <wryan@nicira.com>
Acked-by: Jarno Rajahalme <jrajahalme@nicira.com>
Acked-by: Pravin B Shelar <pshelar@nicira.com>
lib/dpif-netdev.c
lib/netdev-dpdk.c
lib/ofpbuf.c
lib/ofpbuf.h