]> git.proxmox.com Git - mirror_ovs.git/commit
dp-packet: Init specific mbuf fields.
authorMark Kavanagh <mark.b.kavanagh@intel.com>
Fri, 2 Nov 2018 09:06:33 +0000 (09:06 +0000)
committerIan Stokes <ian.stokes@intel.com>
Fri, 2 Nov 2018 16:28:28 +0000 (16:28 +0000)
commit4148de286cdb6b5e1634d3e775dccc731dd046ac
treec39b542cef47bc1a43a2308e79e1831dd73e19af
parentdfaf00e8c3ea576e103bbb9e7f0736630df0e330
dp-packet: Init specific mbuf fields.

dp_packets are created using xmalloc(); in the case of OvS-DPDK, it's
possible the the resultant mbuf portion of the dp_packet contains
random data. For some mbuf fields, specifically those related to
multi-segment mbufs and/or offload features, random values may cause
unexpected behaviour, should the dp_packet's contents be later copied
to a DPDK mbuf. It is critical therefore, that these fields should be
initialized to 0.

This patch ensures that the following mbuf fields are initialized to
appropriate values on creation of a new dp_packet:
   - ol_flags=0
   - nb_segs=1
   - tx_offload=0
   - packet_type=0
   - next=NULL

Adapted from an idea by Michael Qiu <qiudayu@chinac.com>:
https://patchwork.ozlabs.org/patch/777570/

Co-authored-by: Tiago Lam <tiago.lam@intel.com>
Signed-off-by: Mark Kavanagh <mark.b.kavanagh@intel.com>
Signed-off-by: Tiago Lam <tiago.lam@intel.com>
Acked-by: Eelco Chaudron <echaudro@redhat.com>
Acked-by: Flavio Leitner <fbl@sysclose.org>
Signed-off-by: Ian Stokes <ian.stokes@intel.com>
lib/dp-packet.h