DPDK patches and discussions
 help / color / mirror / Atom feed
From: Maxime Coquelin <maxime.coquelin@redhat.com>
To: olivier.matz@6wind.com, dev@dpdk.org
Cc: stephen@networkplumber.org, mst@redhat.com,
	yuanhan.liu@linux.intel.com,
	Maxime Coquelin <maxime.coquelin@redhat.com>
Subject: [dpdk-dev] [PATCH v2 2/2] app/testpmd/txonly: Reset headroom after raw packet allocation
Date: Tue,  4 Oct 2016 14:05:24 +0200	[thread overview]
Message-ID: <1475582724-5202-2-git-send-email-maxime.coquelin@redhat.com> (raw)
In-Reply-To: <1475582724-5202-1-git-send-email-maxime.coquelin@redhat.com>

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 <maxime.coquelin@redhat.com>
---
 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

  reply	other threads:[~2016-10-04 12:05 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-04 12:05 [dpdk-dev] [PATCH v2 1/2] mbuf: add rte_pktmbuff_reset_headroom function Maxime Coquelin
2016-10-04 12:05 ` Maxime Coquelin [this message]
2016-10-05 12:02 ` Olivier Matz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1475582724-5202-2-git-send-email-maxime.coquelin@redhat.com \
    --to=maxime.coquelin@redhat.com \
    --cc=dev@dpdk.org \
    --cc=mst@redhat.com \
    --cc=olivier.matz@6wind.com \
    --cc=stephen@networkplumber.org \
    --cc=yuanhan.liu@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).