DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] net/enic: fix possible Rx corruption
@ 2016-07-19 22:42 John Daley
  2016-07-21 22:46 ` Thomas Monjalon
  0 siblings, 1 reply; 2+ messages in thread
From: John Daley @ 2016-07-19 22:42 UTC (permalink / raw)
  To: dev; +Cc: bruce.richardson, John Daley

Initialize the mbuf data offset to RTE_PKTMBUF_HEADROOM as the
enic takes ownership of them. If allocated mbufs had some offset
other than RTE_PKTMBUF_HEADROOM, the application would read mbuf
data starting at the wrong place and misinterpret the packet.

Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")

Reviewed-by: Nelson Escobar <neescoba@cisco.com>
Signed-off-by: John Daley <johndale@cisco.com>
---

Please include this patch in 16.07 since the bug found in late testing
can cause data corruption.

 drivers/net/enic/enic_main.c | 1 +
 drivers/net/enic/enic_rxtx.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c
index 542f095..b4ca371 100644
--- a/drivers/net/enic/enic_main.c
+++ b/drivers/net/enic/enic_main.c
@@ -317,6 +317,7 @@ enic_alloc_rx_queue_mbufs(struct enic *enic, struct vnic_rq *rq)
 			return -ENOMEM;
 		}
 
+		mb->data_off = RTE_PKTMBUF_HEADROOM;
 		dma_addr = (dma_addr_t)(mb->buf_physaddr
 			   + RTE_PKTMBUF_HEADROOM);
 		rq_enet_desc_enc(rqd, dma_addr,
diff --git a/drivers/net/enic/enic_rxtx.c b/drivers/net/enic/enic_rxtx.c
index 845a8e6..50f0b28 100644
--- a/drivers/net/enic/enic_rxtx.c
+++ b/drivers/net/enic/enic_rxtx.c
@@ -300,6 +300,7 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,
 			(struct cq_enet_rq_desc *)&cqd);
 
 		/* Push descriptor for newly allocated mbuf */
+		nmb->data_off = RTE_PKTMBUF_HEADROOM;
 		dma_addr = (dma_addr_t)(nmb->buf_physaddr +
 					RTE_PKTMBUF_HEADROOM);
 		rq_enet_desc_enc(rqd_ptr, dma_addr,
-- 
2.7.0

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [dpdk-dev] [PATCH] net/enic: fix possible Rx corruption
  2016-07-19 22:42 [dpdk-dev] [PATCH] net/enic: fix possible Rx corruption John Daley
@ 2016-07-21 22:46 ` Thomas Monjalon
  0 siblings, 0 replies; 2+ messages in thread
From: Thomas Monjalon @ 2016-07-21 22:46 UTC (permalink / raw)
  To: John Daley; +Cc: dev, bruce.richardson

2016-07-19 15:42, John Daley:
> Initialize the mbuf data offset to RTE_PKTMBUF_HEADROOM as the
> enic takes ownership of them. If allocated mbufs had some offset
> other than RTE_PKTMBUF_HEADROOM, the application would read mbuf
> data starting at the wrong place and misinterpret the packet.
> 
> Fixes: 856d7ba7ed22 ("net/enic: support scattered Rx")
> 
> Reviewed-by: Nelson Escobar <neescoba@cisco.com>
> Signed-off-by: John Daley <johndale@cisco.com>

Applied, thanks

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2016-07-21 22:46 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-19 22:42 [dpdk-dev] [PATCH] net/enic: fix possible Rx corruption John Daley
2016-07-21 22:46 ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).