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 9C371A04FF; Wed, 23 Mar 2022 05:28:15 +0100 (CET) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 428B541140; Wed, 23 Mar 2022 05:28:15 +0100 (CET) Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by mails.dpdk.org (Postfix) with ESMTP id 062B241104 for ; Wed, 23 Mar 2022 05:28:14 +0100 (CET) Received: by linux.microsoft.com (Postfix, from userid 1004) id 47BC420DE4A1; Tue, 22 Mar 2022 21:28:13 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 47BC420DE4A1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxonhyperv.com; s=default; t=1648009693; bh=k60OMFTz42BUYRoZFGx5ZdQJSEWEyraaYUtC1jiGpq0=; h=From:To:Cc:Subject:Date:From; b=CQtfj2R8f5W1+gBSSNmdP6Vy31fnF9GtG/J3915nT/f59AJptafZWHHY0GL8Vo3DU 2aLLFDLmcluiczNqVUt0nEnGIr27h+6LUjPSwxmV0BgGqJjvlDbkBb5FafIObciv9e usH5sKYBsInntTH+6JWPXe7GjPQ9ogweS34I+Bvs= From: longli@linuxonhyperv.com To: dev@dpdk.org, Stephen Hemminger Cc: Long Li Subject: [PATCH] net/netvsc: fix the calculation of checksums based on mbuf flag Date: Tue, 22 Mar 2022 21:28:07 -0700 Message-Id: <1648009687-19957-1-git-send-email-longli@linuxonhyperv.com> X-Mailer: git-send-email 1.8.3.1 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 From: Long Li The netvsc should use RTE_MBUF_F_TX_L4_MASK and check the value to decide the correct way to calculate checksums. Signed-off-by: Long Li --- drivers/net/netvsc/hn_rxtx.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/net/netvsc/hn_rxtx.c b/drivers/net/netvsc/hn_rxtx.c index 028f176c7e..34f40be5b8 100644 --- a/drivers/net/netvsc/hn_rxtx.c +++ b/drivers/net/netvsc/hn_rxtx.c @@ -1348,8 +1348,11 @@ static void hn_encap(struct rndis_packet_msg *pkt, *pi_data = NDIS_LSO2_INFO_MAKEIPV4(hlen, m->tso_segsz); } - } else if (m->ol_flags & - (RTE_MBUF_F_TX_TCP_CKSUM | RTE_MBUF_F_TX_UDP_CKSUM | RTE_MBUF_F_TX_IP_CKSUM)) { + } else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_TCP_CKSUM || + (m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_UDP_CKSUM || + (m->ol_flags & RTE_MBUF_F_TX_IP_CKSUM)) { pi_data = hn_rndis_pktinfo_append(pkt, NDIS_TXCSUM_INFO_SIZE, NDIS_PKTINFO_TYPE_CSUM); *pi_data = 0; @@ -1363,9 +1366,11 @@ static void hn_encap(struct rndis_packet_msg *pkt, *pi_data |= NDIS_TXCSUM_INFO_IPCS; } - if (m->ol_flags & RTE_MBUF_F_TX_TCP_CKSUM) + if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_TCP_CKSUM) *pi_data |= NDIS_TXCSUM_INFO_MKTCPCS(hlen); - else if (m->ol_flags & RTE_MBUF_F_TX_UDP_CKSUM) + else if ((m->ol_flags & RTE_MBUF_F_TX_L4_MASK) == + RTE_MBUF_F_TX_UDP_CKSUM) *pi_data |= NDIS_TXCSUM_INFO_MKUDPCS(hlen); } -- 2.32.0