From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-3.cisco.com (alln-iport-3.cisco.com [173.37.142.90]) by dpdk.org (Postfix) with ESMTP id 1E3F8374C for ; Wed, 27 Apr 2016 04:51:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=1759; q=dns/txt; s=iport; t=1461725519; x=1462935119; h=from:to:cc:subject:date:message-id; bh=8e41hWo0uWfob/AVU5ZtCuY/SvWN1B1NFGLq9LhrENg=; b=MdYisyqVIWCcGnHfFAijnvA+mCE4i/yv1L1Ck/1pP6V7WmoPLtWzJjYa E0ODd1vgRZe6i4O0gtxFlQob1xmNJhYMlTDe4tQQlq2XgXShmmjwSGl+H mqfeV011QoE7Qna+xDAQkiAcXg3zmerS1pgUiI0P4+IDb1gDSVcPcS345 w=; X-IronPort-AV: E=Sophos;i="5.24,539,1454976000"; d="scan'208";a="265844969" Received: from alln-core-5.cisco.com ([173.36.13.138]) by alln-iport-3.cisco.com with ESMTP/TLS/DHE-RSA-AES256-SHA; 27 Apr 2016 02:51:58 +0000 Received: from cisco.com (savbu-usnic-a.cisco.com [10.193.184.48]) by alln-core-5.cisco.com (8.14.5/8.14.5) with ESMTP id u3R2pwpk023959; Wed, 27 Apr 2016 02:51:58 GMT Received: by cisco.com (Postfix, from userid 392789) id 242413FAAE12; Tue, 26 Apr 2016 19:51:58 -0700 (PDT) From: John Daley To: dev@dpdk.org Cc: John Daley Date: Tue, 26 Apr 2016 19:51:56 -0700 Message-Id: <1461725516-7166-1-git-send-email-johndale@cisco.com> X-Mailer: git-send-email 2.7.0 Subject: [dpdk-dev] [PATCH] enic: fix misalignment of Rx mbuf data 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: Wed, 27 Apr 2016 02:51:59 -0000 Data DMA used m->data_off of uninitialized mbufs instead of RTE_PKTMBUF_HEADROOM, potentially causing Rx data to be placed at the wrong alignment in the mbuf. Fixes: 947d860c821f ("enic: improve Rx performance") Signed-off-by: John Daley --- drivers/net/enic/enic_main.c | 5 +++-- drivers/net/enic/enic_rx.c | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/net/enic/enic_main.c b/drivers/net/enic/enic_main.c index be4e9e5..646d87f 100644 --- a/drivers/net/enic/enic_main.c +++ b/drivers/net/enic/enic_main.c @@ -354,10 +354,11 @@ enic_alloc_rx_queue_mbufs(struct enic *enic, struct vnic_rq *rq) return -ENOMEM; } - dma_addr = (dma_addr_t)(mb->buf_physaddr + mb->data_off); + dma_addr = (dma_addr_t)(mb->buf_physaddr + + RTE_PKTMBUF_HEADROOM); rq_enet_desc_enc(rqd, dma_addr, RQ_ENET_TYPE_ONLY_SOP, - mb->buf_len); + mb->buf_len - RTE_PKTMBUF_HEADROOM); rq->mbuf_ring[i] = mb; } diff --git a/drivers/net/enic/enic_rx.c b/drivers/net/enic/enic_rx.c index 232987a..39bb55c 100644 --- a/drivers/net/enic/enic_rx.c +++ b/drivers/net/enic/enic_rx.c @@ -314,9 +314,11 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, + rx_id); /* Push descriptor for newly allocated mbuf */ - dma_addr = (dma_addr_t)(nmb->buf_physaddr + nmb->data_off); + dma_addr = (dma_addr_t)(nmb->buf_physaddr + + RTE_PKTMBUF_HEADROOM); rqd_ptr->address = rte_cpu_to_le_64(dma_addr); - rqd_ptr->length_type = cpu_to_le16(nmb->buf_len); + rqd_ptr->length_type = cpu_to_le16(nmb->buf_len + - RTE_PKTMBUF_HEADROOM); /* Fill in the rest of the mbuf */ rxmb->data_off = RTE_PKTMBUF_HEADROOM; -- 2.7.0