DPDK patches and discussions
 help / color / mirror / Atom feed
From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org, pablo.de.lara.guarch@intel.com
Subject: [dpdk-dev] [PATCH 7/8] app/testpmd: don't use tso if packet is too small
Date: Mon, 11 Jul 2016 20:39:44 +0200	[thread overview]
Message-ID: <1468262385-32038-8-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1468262385-32038-1-git-send-email-olivier.matz@6wind.com>

Asking for TSO (TCP Segmentation Offload) on packets that are already
smaller than (headers + MSS) does not work, for instance on ixgbe.

Fix the csumonly engine to only set the TSO flag when a segmentation
offload is really required, i.e. when packet is large enough.

Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
 app/test-pmd/csumonly.c | 13 +++++++++++--
 1 file changed, 11 insertions(+), 2 deletions(-)

diff --git a/app/test-pmd/csumonly.c b/app/test-pmd/csumonly.c
index 35edf1d..9938150 100644
--- a/app/test-pmd/csumonly.c
+++ b/app/test-pmd/csumonly.c
@@ -102,6 +102,7 @@ struct testpmd_offload_info {
 	uint16_t outer_l3_len;
 	uint8_t outer_l4_proto;
 	uint16_t tso_segsz;
+	uint32_t pkt_len;
 };
 
 /* simplified GRE header */
@@ -329,13 +330,20 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 	struct tcp_hdr *tcp_hdr;
 	struct sctp_hdr *sctp_hdr;
 	uint64_t ol_flags = 0;
+	uint32_t max_pkt_len, tso_segsz = 0;
+
+	/* ensure packet is large enough to require tso */
+	max_pkt_len = info->l2_len + info->l3_len + info->l4_len +
+		info->tso_segsz;
+	if (info->tso_segsz != 0 && info->pkt_len > max_pkt_len)
+		tso_segsz = info->tso_segsz;
 
 	if (info->ethertype == _htons(ETHER_TYPE_IPv4)) {
 		ipv4_hdr = l3_hdr;
 		ipv4_hdr->hdr_checksum = 0;
 
 		ol_flags |= PKT_TX_IPV4;
-		if (info->tso_segsz != 0 && info->l4_proto == IPPROTO_TCP) {
+		if (tso_segsz != 0 && info->l4_proto == IPPROTO_TCP) {
 			ol_flags |= PKT_TX_IP_CKSUM;
 		} else {
 			if (testpmd_ol_flags & TESTPMD_TX_OFFLOAD_IP_CKSUM)
@@ -367,7 +375,7 @@ process_inner_cksums(void *l3_hdr, const struct testpmd_offload_info *info,
 	} else if (info->l4_proto == IPPROTO_TCP) {
 		tcp_hdr = (struct tcp_hdr *)((char *)l3_hdr + info->l3_len);
 		tcp_hdr->cksum = 0;
-		if (info->tso_segsz != 0) {
+		if (tso_segsz != 0) {
 			ol_flags |= PKT_TX_TCP_SEG;
 			tcp_hdr->cksum = get_psd_sum(l3_hdr, info->ethertype,
 				ol_flags);
@@ -667,6 +675,7 @@ pkt_burst_checksum_forward(struct fwd_stream *fs)
 
 		m = pkts_burst[i];
 		info.is_tunnel = 0;
+		info.pkt_len = rte_pktmbuf_pkt_len(m);
 		tx_ol_flags = 0;
 		rx_ol_flags = m->ol_flags;
 
-- 
2.8.1

  parent reply	other threads:[~2016-07-11 18:39 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-11 18:39 [dpdk-dev] [PATCH 0/8] Misc enhancements in testpmd Olivier Matz
2016-07-11 18:39 ` [dpdk-dev] [PATCH 1/8] mbuf: add function to dump ol flag list Olivier Matz
2016-07-11 18:39 ` [dpdk-dev] [PATCH 2/8] app/testpmd: use new function to dump offload flags Olivier Matz
2016-07-11 18:39 ` [dpdk-dev] [PATCH 3/8] app/testpmd: dump rx flags in csum engine Olivier Matz
2016-07-11 18:39 ` [dpdk-dev] [PATCH 4/8] app/testpmd: add option to enable lro Olivier Matz
2016-07-11 18:39 ` [dpdk-dev] [PATCH 5/8] app/testpmd: do not change ip addrs in csum engine Olivier Matz
2016-07-11 18:39 ` [dpdk-dev] [PATCH 6/8] app/testpmd: display rx port " Olivier Matz
2016-07-11 18:39 ` Olivier Matz [this message]
2016-07-11 18:39 ` [dpdk-dev] [PATCH 8/8] app/testpmd: hide segsize when unrelevant " 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=1468262385-32038-8-git-send-email-olivier.matz@6wind.com \
    --to=olivier.matz@6wind.com \
    --cc=dev@dpdk.org \
    --cc=pablo.de.lara.guarch@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).