Previously, DPDK buffers were freed using 'struct ofpbuf' pointers passed to free_dpdk_buf(). However, if a new ofpbuf allocated on the stack shares data with the old ofpbuf and the new ofpbuf is to be freed with free_dpdk_buf(), this will cause an error.
This patch gets the beginning of the allocated buffer from 'struct rte_mbuf'. This allows ofpbufs to share packet data when using DPDK. Signed-off-by: Ryan Wilson <wr...@nicira.com> --- lib/netdev-dpdk.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/netdev-dpdk.c b/lib/netdev-dpdk.c index ba41d2e..155cbf0 100644 --- a/lib/netdev-dpdk.c +++ b/lib/netdev-dpdk.c @@ -206,8 +206,9 @@ void free_dpdk_buf(struct ofpbuf *b) { struct rte_mbuf *pkt = (struct rte_mbuf *) b; + struct rte_mbuf *buf = (char *) pkt->buf_addr - sizeof(struct ofpbuf); - rte_mempool_put(pkt->pool, pkt); + rte_mempool_put(pkt->pool, buf); } static void -- 1.7.9.5 _______________________________________________ dev mailing list dev@openvswitch.org http://openvswitch.org/mailman/listinfo/dev