From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from rcdn-iport-6.cisco.com (rcdn-iport-6.cisco.com [173.37.86.77]) by dpdk.org (Postfix) with ESMTP id 759A02C01 for ; Wed, 20 Jul 2016 00:42:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1605; q=dns/txt; s=iport; t=1468968170; x=1470177770; h=from:to:cc:subject:date:message-id; bh=Xr+vlutZqFZG2RTu8yU7crzHAYdS7RlQfZwhNRfi9Io=; b=Ub1yM8vX6HWmgSN5F7f22dqafXGGBrikIOoG7dkJmBDK/ZNqYqw5QJXj F+hBm19Wg0BMdPIGmc0gvuCVTyEg+ezhOI4igetsrNMjjjvwdV2jJHa7w ml3rdkc+/dwFc6OswC9b4UrtPNIZZu61FVTmutaWWGEZJTUxuYoRXMx5o k=; X-IronPort-AV: E=Sophos;i="5.28,391,1464652800"; d="scan'208";a="127712763" Received: from rcdn-core-3.cisco.com ([173.37.93.154]) by rcdn-iport-6.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jul 2016 22:42:49 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by rcdn-core-3.cisco.com (8.14.5/8.14.5) with ESMTP id u6JMgntw008113; Tue, 19 Jul 2016 22:42:49 GMT Received: by cisco.com (Postfix, from userid 392789) id 2D6873FAAE12; Tue, 19 Jul 2016 15:42:49 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: bruce.richardson@intel.com, John Daley Date: Tue, 19 Jul 2016 15:42:43 -0700 Message-Id: <1468968163-31556-1-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] net/enic: fix possible Rx corruption X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 19 Jul 2016 22:42:50 -0000 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 Signed-off-by: John Daley --- 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