mirror of
https://github.com/openvswitch/ovs
synced 2025-08-31 06:15:47 +00:00
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>
This commit is contained in:
committed by
Pravin B Shelar
parent
d221ffa1e1
commit
143859ec63
@@ -205,7 +205,7 @@ dpdk_rte_mzalloc(size_t sz)
|
||||
void
|
||||
free_dpdk_buf(struct ofpbuf *b)
|
||||
{
|
||||
struct rte_mbuf *pkt = (struct rte_mbuf *) b;
|
||||
struct rte_mbuf *pkt = (struct rte_mbuf *) b->dpdk_buf;
|
||||
|
||||
rte_mempool_put(pkt->pool, pkt);
|
||||
}
|
||||
|
Reference in New Issue
Block a user