From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5C667A0548; Thu, 1 Apr 2021 11:55:19 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 9C53D140E9E; Thu, 1 Apr 2021 11:53:21 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id A13B7140F2C for ; Thu, 1 Apr 2021 11:53:19 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1617270798; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=HULDJ4R4Qcp7FJwbw8OAjIIQz7zuMbe5eZ/JVgNV1s4=; b=I4hV5m/9aqn1cukZKnFdGx379pN4sK50cFaIpW9S7EXS5+ox4UxOsoFjumMPHw7PEDxZoA yCTKLg8xezEQesFIyw5F3OqYBFbCLRvwI3xktzb4t9zWX6ty/fJh1FB7sRxYhZfo3mQyPk hrxZss4atXFXV8RXSqSFafh5MRmGJzQ= Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-219-7bKH25StPguV8q9Z7LEODw-1; Thu, 01 Apr 2021 05:53:15 -0400 X-MC-Unique: 7bKH25StPguV8q9Z7LEODw-1 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id DDEB387A82A; Thu, 1 Apr 2021 09:53:13 +0000 (UTC) Received: from dmarchan.remote.csb (unknown [10.40.193.239]) by smtp.corp.redhat.com (Postfix) with ESMTP id 67FDF5D9CA; Thu, 1 Apr 2021 09:53:11 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: maxime.coquelin@redhat.com, olivier.matz@6wind.com, fbl@sysclose.org, i.maximets@ovn.org, Keith Wiles Date: Thu, 1 Apr 2021 11:52:40 +0200 Message-Id: <20210401095243.18211-3-david.marchand@redhat.com> In-Reply-To: <20210401095243.18211-1-david.marchand@redhat.com> References: <20210401095243.18211-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=david.marchand@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII" Subject: [dpdk-dev] [PATCH 2/5] net/tap: do not touch Tx offload flags X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Tx offload flags are of the application responsibility. Leave the mbuf alone and check for TSO where needed. Signed-off-by: David Marchand --- drivers/net/tap/rte_eth_tap.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index c36d4bf76e..285fe395c5 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -562,6 +562,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, uint16_t *l4_phdr_cksum, uint32_t *l4_raw_cksum) { void *l3_hdr = packet + l2_len; + uint64_t csum_l4; if (ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4)) { struct rte_ipv4_hdr *iph = l3_hdr; @@ -571,13 +572,17 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, cksum = rte_raw_cksum(iph, l3_len); iph->hdr_checksum = (cksum == 0xffff) ? cksum : ~cksum; } - if (ol_flags & PKT_TX_L4_MASK) { + + csum_l4 = ol_flags & PKT_TX_L4_MASK; + if (ol_flags & PKT_TX_TCP_SEG) + csum_l4 |= PKT_TX_TCP_CKSUM; + if (csum_l4) { void *l4_hdr; l4_hdr = packet + l2_len + l3_len; - if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM) + if (csum_l4 == PKT_TX_UDP_CKSUM) *l4_cksum = &((struct rte_udp_hdr *)l4_hdr)->dgram_cksum; - else if ((ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) + else if (csum_l4 == PKT_TX_TCP_CKSUM) *l4_cksum = &((struct rte_tcp_hdr *)l4_hdr)->cksum; else return; @@ -648,7 +653,8 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, if (txq->csum && ((mbuf->ol_flags & (PKT_TX_IP_CKSUM | PKT_TX_IPV4) || (mbuf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_UDP_CKSUM || - (mbuf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM))) { + (mbuf->ol_flags & PKT_TX_L4_MASK) == PKT_TX_TCP_CKSUM) || + (mbuf->ol_flags & PKT_TX_TCP_SEG))) { is_cksum = 1; /* Support only packets with at least layer 4 @@ -742,9 +748,6 @@ pmd_tx_burst(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) if (tso) { struct rte_gso_ctx *gso_ctx = &txq->gso_ctx; - /* TCP segmentation implies TCP checksum offload */ - mbuf_in->ol_flags |= PKT_TX_TCP_CKSUM; - /* gso size is calculated without RTE_ETHER_CRC_LEN */ hdrs_len = mbuf_in->l2_len + mbuf_in->l3_len + mbuf_in->l4_len; -- 2.23.0