Message ID | 1477548924-26376-2-git-send-email-qiudayu@chinac.com |
---|---|
State | Changes Requested |
Delegated to: | Daniele Di Proietto |
Headers | show |
> >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@chinac.com> >Signed-off-by: Jijiang Liu <liujijiang@chinac.com> Thanks for the patch Michael; one minor nit, but otherwise looks good to me. >--- > lib/dp-packet.c | 3 +++ > 1 file changed, 3 insertions(+) > >diff --git a/lib/dp-packet.c b/lib/dp-packet.c >index 8e7defc..bf8522e 100644 >--- a/lib/dp-packet.c >+++ b/lib/dp-packet.c >@@ -131,6 +131,9 @@ struct dp_packet * > dp_packet_new(size_t size) > { > struct dp_packet *b = xmalloc(sizeof *b); >+ #ifdef DPDK_NETDEV Compiler guards should be aligned all the way to the left >+ memset(&(b->mbuf), 0, sizeof(struct rte_mbuf)); >+ #endif > dp_packet_init(b, size); > return b; > } >-- >1.8.3.1
2016/10/28 17:25, Kavanagh, Mark B : >> 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@chinac.com> >> Signed-off-by: Jijiang Liu <liujijiang@chinac.com> > Thanks for the patch Michael; one minor nit, but otherwise looks good to me. > >> --- >> lib/dp-packet.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/lib/dp-packet.c b/lib/dp-packet.c >> index 8e7defc..bf8522e 100644 >> --- a/lib/dp-packet.c >> +++ b/lib/dp-packet.c >> @@ -131,6 +131,9 @@ struct dp_packet * >> dp_packet_new(size_t size) >> { >> struct dp_packet *b = xmalloc(sizeof *b); >> + #ifdef DPDK_NETDEV > Compiler guards should be aligned all the way to the left Hi, Mark This should be the display issue, these three lines are all aligned with 4 whitespaces. Thanks, Michael > >> + memset(&(b->mbuf), 0, sizeof(struct rte_mbuf)); >> + #endif >> dp_packet_init(b, size); >> return b; >> } >> -- >> 1.8.3.1 >
2016/10/28 17:25, Kavanagh, Mark B: >> 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@chinac.com> >> Signed-off-by: Jijiang Liu <liujijiang@chinac.com> > Thanks for the patch Michael; one minor nit, but otherwise looks good to me. > >> --- >> lib/dp-packet.c | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/lib/dp-packet.c b/lib/dp-packet.c >> index 8e7defc..bf8522e 100644 >> --- a/lib/dp-packet.c >> +++ b/lib/dp-packet.c >> @@ -131,6 +131,9 @@ struct dp_packet * >> dp_packet_new(size_t size) >> { >> struct dp_packet *b = xmalloc(sizeof *b); >> + #ifdef DPDK_NETDEV > Compiler guards should be aligned all the way to the left I've got your point, and please *ignor* pervious replied mail. Will fix it later. >> + memset(&(b->mbuf), 0, sizeof(struct rte_mbuf)); >> + #endif >> dp_packet_init(b, size); >> return b; >> } >> -- >> 1.8.3.1 > _______________________________________________ > dev mailing list > dev@openvswitch.org > http://openvswitch.org/mailman/listinfo/dev
diff --git a/lib/dp-packet.c b/lib/dp-packet.c index 8e7defc..bf8522e 100644 --- a/lib/dp-packet.c +++ b/lib/dp-packet.c @@ -131,6 +131,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; }