From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from proxy.6wind.com (host.76.145.23.62.rev.coltfrance.com [62.23.145.76]) by dpdk.org (Postfix) with ESMTP id 8570758CF for ; Fri, 7 Oct 2016 18:05:38 +0200 (CEST) Received: from glumotte.dev.6wind.com (unknown [10.16.0.195]) by proxy.6wind.com (Postfix) with ESMTP id 63CD4293C9; Fri, 7 Oct 2016 18:05:38 +0200 (CEST) From: Olivier Matz To: dev@dpdk.org, pablo.de.lara.guarch@intel.com Date: Fri, 7 Oct 2016 18:05:17 +0200 Message-Id: <1475856318-24616-8-git-send-email-olivier.matz@6wind.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1475856318-24616-1-git-send-email-olivier.matz@6wind.com> References: <1473407734-11253-1-git-send-email-olivier.matz@6wind.com> <1475856318-24616-1-git-send-email-olivier.matz@6wind.com> Subject: [dpdk-dev] [PATCH v5 7/8] app/testpmd: don't use tso if packet is too small 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: Fri, 07 Oct 2016 16:05:38 -0000 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 --- 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 19c8099..2057633 100644 --- a/app/test-pmd/csumonly.c +++ b/app/test-pmd/csumonly.c @@ -101,6 +101,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 */ @@ -328,13 +329,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) @@ -366,7 +374,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); @@ -666,6 +674,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