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 640C6430E4; Wed, 23 Aug 2023 18:01:52 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 44C95410F1; Wed, 23 Aug 2023 18:01:52 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id D208A40223 for ; Wed, 23 Aug 2023 18:01:50 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692806510; 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=OdNVvjyCE+i5Hx9NZqIMx0Yh+JvmeqaMY8f5SK/1Xno=; b=Y+vl21RNnxeaWag7pQzw3hOsXawAr0H8maTfGmRJUDll53x5HNVOFAgTR8qgl8OSyWBzou NH0NBlSGZhScBew5YmgIJqCF8UqYZXwdqGqHkFFVz9EAdlF79IFtFYSNlwUA0LSvJ4Rcq/ 8+j0SxpIDORxF1DAp33mbgq7gJOzP0E= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-684-Ma6rQsqAMt61XGn621FuXA-1; Wed, 23 Aug 2023 12:01:46 -0400 X-MC-Unique: Ma6rQsqAMt61XGn621FuXA-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 49E3D833949; Wed, 23 Aug 2023 16:01:45 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89660C15BAE; Wed, 23 Aug 2023 16:01:43 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: olivier.matz@6wind.com, stable@dpdk.org, Ales Musil , Thomas Monjalon , Ophir Munk , Keith Wiles , Raslan Darawsheh Subject: [PATCH v2 1/3] net/tap: fix L4 checksum offloading Date: Wed, 23 Aug 2023 18:01:36 +0200 Message-ID: <20230823160138.291980-1-david.marchand@redhat.com> In-Reply-To: <20230822073244.3751885-1-david.marchand@redhat.com> References: <20230822073244.3751885-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true 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 The L4 checksum offloading API does not require l4_len to be set. Make the driver discover the L4 headers size by itself. Fixes: 6546e76056e3 ("net/tap: calculate checksums of multi segs packets") Cc: stable@dpdk.org Signed-off-by: David Marchand Tested-by: Ales Musil --- .mailmap | 1 + drivers/net/tap/rte_eth_tap.c | 13 +++++++++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/.mailmap b/.mailmap index 864d33ee46..b6a21b35cb 100644 --- a/.mailmap +++ b/.mailmap @@ -40,6 +40,7 @@ Aleksandr Loktionov Aleksandr Miloshenko Aleksey Baulin Aleksey Katargin +Ales Musil Alexander Bechikov Alexander Belyakov Alexander Chernavin diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index bf98f75559..0ab214847a 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -645,13 +645,22 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, ((mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4) || (mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_UDP_CKSUM || (mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == RTE_MBUF_F_TX_TCP_CKSUM))) { + unsigned int l4_len = 0; + is_cksum = 1; + if ((mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_UDP_CKSUM) + l4_len = sizeof(struct rte_udp_hdr); + else if ((mbuf->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_TCP_CKSUM) + l4_len = sizeof(struct rte_tcp_hdr); + /* Support only packets with at least layer 4 * header included in the first segment */ seg_len = rte_pktmbuf_data_len(mbuf); - l234_hlen = mbuf->l2_len + mbuf->l3_len + mbuf->l4_len; + l234_hlen = mbuf->l2_len + mbuf->l3_len + l4_len; if (seg_len < l234_hlen) return -1; @@ -661,7 +670,7 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, rte_memcpy(m_copy, rte_pktmbuf_mtod(mbuf, void *), l234_hlen); tap_tx_l3_cksum(m_copy, mbuf->ol_flags, - mbuf->l2_len, mbuf->l3_len, mbuf->l4_len, + mbuf->l2_len, mbuf->l3_len, l4_len, &l4_cksum, &l4_phdr_cksum, &l4_raw_cksum); iovecs[k].iov_base = m_copy; -- 2.41.0