[ovs-dev] [PATCH 1/5] lib/dp-packet: init the mbuf to zero when build with DPDK
Ben Pfaff
blp at ovn.org
Thu May 4 21:19:31 UTC 2017
On Tue, May 02, 2017 at 02:10:41PM +0800, Michael Qiu wrote:
> From: Michael Qiu <qiudayu at chinac.com>
>
> When building with DPDK, and using xmalloc() to get a new packet,
> field mbuf of the packet will not be initialized, but it's very important for
> DPDK port when copying the data to DPDK mbuf, because if ol_flags
> and other info are random values, DPDK driver may hang.
>
> Signed-off-by: Michael Qiu <qiudayu at chinac.com>
> ---
> lib/dp-packet.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/lib/dp-packet.c b/lib/dp-packet.c
> index 793b54f..109947c 100644
> --- a/lib/dp-packet.c
> +++ b/lib/dp-packet.c
> @@ -132,6 +132,9 @@ struct dp_packet *
> dp_packet_new(size_t size)
> {
> struct dp_packet *b = xmalloc(sizeof *b);
> +#ifdef DPDK_NETDEV
> + memset(&(b->mbuf), 0, sizeof(struct rte_mbuf));
> +#endif
> dp_packet_init(b, size);
> return b;
> }
Thanks for working to improve DPDK support in OVS. This seems correct
as far as it goes, but shouldn't it happen in dp_packet_init__() so that
it applies to all dp_packet initialization paths, instead of just the
packets allocated this way?
More information about the dev
mailing list