From patchwork Tue Oct 4 12:05:24 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Coquelin X-Patchwork-Id: 16365 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id E9C386CA8; Tue, 4 Oct 2016 14:05:34 +0200 (CEST) Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by dpdk.org (Postfix) with ESMTP id 103B02C56 for ; Tue, 4 Oct 2016 14:05:33 +0200 (CEST) Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 7C29050F57; Tue, 4 Oct 2016 12:05:32 +0000 (UTC) Received: from max-t460s.redhat.com (vpn1-5-203.ams2.redhat.com [10.36.5.203]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u94C5Spm002533; Tue, 4 Oct 2016 08:05:30 -0400 From: Maxime Coquelin To: olivier.matz@6wind.com, dev@dpdk.org Cc: stephen@networkplumber.org, mst@redhat.com, yuanhan.liu@linux.intel.com, Maxime Coquelin Date: Tue, 4 Oct 2016 14:05:24 +0200 Message-Id: <1475582724-5202-2-git-send-email-maxime.coquelin@redhat.com> In-Reply-To: <1475582724-5202-1-git-send-email-maxime.coquelin@redhat.com> References: <1475582724-5202-1-git-send-email-maxime.coquelin@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 04 Oct 2016 12:05:32 +0000 (UTC) Subject: [dpdk-dev] [PATCH v2 2/2] app/testpmd/txonly: Reset headroom after raw packet allocation 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: , 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)