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 0F34A430EC; Thu, 24 Aug 2023 09:18:32 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id D773041148; Thu, 24 Aug 2023 09:18:31 +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 E593641148 for ; Thu, 24 Aug 2023 09:18:30 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1692861510; 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=GsZ5wYmN/N7qUwp7+/SA9quw0Wbx/4/jVZEKUZm9xxQ=; b=K9hizu206DeR1Np461fbp2+qHctj2kUtjg+L2FuuACdmldIFhetTPTtsX5kAE2xbqC+RZb IYtzYaczWgW5B+y4G+lzn4f6vcfTVx6bInZqKaOnqGYSuRjD5LZFpnouSHzZGvAn2ImNKc 8b361pdTNVHSNlafdn0BQ7GmXjWI55g= 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-144-XCTYEALYNs6ibI8tMjljZQ-1; Thu, 24 Aug 2023 03:18:28 -0400 X-MC-Unique: XCTYEALYNs6ibI8tMjljZQ-1 Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.rdu2.redhat.com [10.11.54.2]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 676A885D060; Thu, 24 Aug 2023 07:18:28 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.225.147]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD74F40C6F4C; Thu, 24 Aug 2023 07:18:27 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: olivier.matz@6wind.com Subject: [PATCH v3 2/3] net/tap: fix IPv4 checksum offloading Date: Thu, 24 Aug 2023 09:18:21 +0200 Message-ID: <20230824071822.337670-2-david.marchand@redhat.com> In-Reply-To: <20230824071822.337670-1-david.marchand@redhat.com> References: <20230822073244.3751885-1-david.marchand@redhat.com> <20230824071822.337670-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.1 on 10.11.54.2 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 Checking that one of RTE_MBUF_F_TX_IPV4 or RTE_MBUF_F_TX_IP_CKSUM is present is not compliant with the offloading API which specifies that IP checksum requires RTE_MBUF_F_TX_IP_CKSUM. On the other hand, RTE_MBUF_F_TX_IP_CKSUM is invalid for IPv6 packets, so we can simply check for RTE_MBUF_F_TX_IP_CKSUM and assume this is an IPv4 packet. Signed-off-by: David Marchand --- drivers/net/tap/rte_eth_tap.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c index 0ab214847a..30b45ddc67 100644 --- a/drivers/net/tap/rte_eth_tap.c +++ b/drivers/net/tap/rte_eth_tap.c @@ -559,7 +559,7 @@ tap_tx_l3_cksum(char *packet, uint64_t ol_flags, unsigned int l2_len, { void *l3_hdr = packet + l2_len; - if (ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4)) { + if (ol_flags & RTE_MBUF_F_TX_IP_CKSUM) { struct rte_ipv4_hdr *iph = l3_hdr; uint16_t cksum; @@ -642,7 +642,7 @@ tap_write_mbufs(struct tx_queue *txq, uint16_t num_mbufs, nb_segs = mbuf->nb_segs; if (txq->csum && - ((mbuf->ol_flags & (RTE_MBUF_F_TX_IP_CKSUM | RTE_MBUF_F_TX_IPV4) || + ((mbuf->ol_flags & RTE_MBUF_F_TX_IP_CKSUM || (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; -- 2.41.0