From mboxrd@z Thu Jan 1 00:00:00 1970 From: Maxime Coquelin Subject: [PATCH 2/2] app/testpmd/txonly: Reset headroom after raw packet allocation Date: Thu, 29 Sep 2016 14:20:33 +0200 Message-ID: <1475151633-6785-2-git-send-email-maxime.coquelin@redhat.com> References: <1475151633-6785-1-git-send-email-maxime.coquelin@redhat.com> Cc: stephen@networkplumber.org, mst@redhat.com, yuanhan.liu@linux.intel.com, Maxime Coquelin To: olivier.matz@6wind.com, dev@dpdk.org Return-path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 529E75686 for ; Thu, 29 Sep 2016 14:20:39 +0200 (CEST) In-Reply-To: <1475151633-6785-1-git-send-email-maxime.coquelin@redhat.com> List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" This patch fixes txonly raw packets allocations by resetting the available headroom. Indeed, some PMDs such as Virtio might prepend some data to the packet, resulting in mbuf's data_off field to be decremented each time the mbuf gets re-allocated. For Virtio PMD, it means that we use only single descriptors for the first times mbufs get allocated, as at some point there is not enough headroom to store the header. Other alternative would be use standard API to allocate the packets, which does reset the headroom, but the impact on performance is too big to consider this an option. Signed-off-by: Maxime Coquelin --- app/test-pmd/txonly.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/test-pmd/txonly.c b/app/test-pmd/txonly.c index d2736b7..8513a06 100644 --- a/app/test-pmd/txonly.c +++ b/app/test-pmd/txonly.c @@ -222,6 +222,14 @@ pkt_burst_transmit(struct fwd_stream *fs) return; break; } + + /* + * Using raw alloc is good to improve performance, + * but some consumers may use the headroom and so + * decrement data_off. We need to make sure it is + * reset to default value. + */ + rte_pktmbuf_reset_headroom(pkt); pkt->data_len = tx_pkt_seg_lengths[0]; pkt_seg = pkt; if (tx_pkt_split == TX_PKT_SPLIT_RND) -- 2.7.4