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 CD97241DE5 for ; Mon, 6 Mar 2023 11:58:02 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8E07040E50; Mon, 6 Mar 2023 11:58:02 +0100 (CET) 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 3524540A8A for ; Mon, 6 Mar 2023 11:58:01 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1678100280; 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=dU2US0kBkpymvOfbYH5vm2PcpEyNYb0IhMuxqixn9s4=; b=gTVzmwD6Aaw6GWZQIumTd+0QM7z9idYjR39R4YwOlcEpJEskyUWrLajrlLqmMrR6MdzyoG wiM8sL8p/0+DiKkS+822y4dN4YfXeeiD473Imbvd/XdvfUO6ebsElG09SKdQJ9tkHz9mzW +rdK7QKwmuwfz8KnirnNTCwpNgNOMQU= 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-324-rKRnD4q0M1irAP0R-50llg-1; Mon, 06 Mar 2023 05:57:59 -0500 X-MC-Unique: rKRnD4q0M1irAP0R-50llg-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id A6169101A55E; Mon, 6 Mar 2023 10:57:58 +0000 (UTC) Received: from [10.39.208.18] (unknown [10.39.208.18]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 27EA4492C14; Mon, 6 Mar 2023 10:57:56 +0000 (UTC) Message-ID: <3b9af1e7-e0b9-603a-bc7e-4963e9957073@redhat.com> Date: Mon, 6 Mar 2023 11:57:55 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.8.0 Subject: Re: [PATCH v2] net/virtio: deduce IP length for Virtio TSO checksum To: "Xia, Chenbo" , Andrew Rybchenko , Boleslav Stankevich , "dev@dpdk.org" Cc: "stable@dpdk.org" References: <20230216123554.2628837-2-boleslav.stankevich@oktetlabs.ru> <20230303111929.1833904-1-boleslav.stankevich@oktetlabs.ru> From: Maxime Coquelin In-Reply-To: X-Scanned-By: MIMEDefang 3.1 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On 3/6/23 07:17, Xia, Chenbo wrote: > Hi Boleslav, > > The change seems good, but patchwork is complaining about lack of .mailmap change. > > http://mails.dpdk.org/archives/test-report/2023-March/363061.html > > Guess this is your first patch? So you need to add name and email in mailmap file. Thanks for the heads-up, I will update the mailmap when applying. No need to submit a new revision. Thanks, Maxime > Thanks, > Chenbo > >> -----Original Message----- >> From: Andrew Rybchenko >> Sent: Friday, March 3, 2023 11:14 PM >> To: Boleslav Stankevich ; dev@dpdk.org >> Cc: stable@dpdk.org; Maxime Coquelin ; Xia, >> Chenbo >> Subject: Re: [PATCH v2] net/virtio: deduce IP length for Virtio TSO >> checksum >> >> Cc Maxime and Chenbo >> >> On 3/3/23 14:19, Boleslav Stankevich wrote: >>> The length of TSO payload could not fit into 16 bits provided by the >>> IPv4 total length and IPv6 payload length fields. Thus, deduce it >>> from the length of the packet. >>> >>> Fixes: 696573046e9 ("net/virtio: support TSO") >>> Cc: stable@dpdk.org >>> >>> Signed-off-by: Boleslav Stankevich >>> Reviewed-by: Andrew Rybchenko >>> --- >>> drivers/net/virtio/virtio_rxtx.c | 25 ++++++++++++++++--------- >>> 1 file changed, 16 insertions(+), 9 deletions(-) >>> >>> diff --git a/drivers/net/virtio/virtio_rxtx.c >> b/drivers/net/virtio/virtio_rxtx.c >>> index 2d0afd3302..e48ff3cca7 100644 >>> --- a/drivers/net/virtio/virtio_rxtx.c >>> +++ b/drivers/net/virtio/virtio_rxtx.c >>> @@ -404,29 +404,36 @@ virtio_tso_fix_cksum(struct rte_mbuf *m) >>> if (likely(rte_pktmbuf_data_len(m) >= m->l2_len + m->l3_len + >>> m->l4_len)) { >>> struct rte_ipv4_hdr *iph; >>> - struct rte_ipv6_hdr *ip6h; >>> struct rte_tcp_hdr *th; >>> - uint16_t prev_cksum, new_cksum, ip_len, ip_paylen; >>> + uint16_t prev_cksum, new_cksum; >>> + uint32_t ip_paylen; >>> uint32_t tmp; >>> >>> iph = rte_pktmbuf_mtod_offset(m, >>> struct rte_ipv4_hdr *, m->l2_len); >>> th = RTE_PTR_ADD(iph, m->l3_len); >>> + >>> + /* >>> + * Calculate IPv4 header checksum with current total length >> value >>> + * (whatever it is) to have correct checksum after update on >> edits >>> + * done by TSO. >>> + */ >>> if ((iph->version_ihl >> 4) == 4) { >>> iph->hdr_checksum = 0; >>> iph->hdr_checksum = rte_ipv4_cksum(iph); >>> - ip_len = iph->total_length; >>> - ip_paylen = rte_cpu_to_be_16(rte_be_to_cpu_16(ip_len) - >>> - m->l3_len); >>> - } else { >>> - ip6h = (struct rte_ipv6_hdr *)iph; >>> - ip_paylen = ip6h->payload_len; >>> } >>> >>> + /* >>> + * Do not use IPv4 total length and IPv6 payload length fields >> to get >>> + * TSO payload length since it could not fit into 16 bits. >>> + */ >>> + ip_paylen = rte_cpu_to_be_32(rte_pktmbuf_pkt_len(m) - m- >>> l2_len - >>> + m->l3_len); >>> + >>> /* calculate the new phdr checksum not including ip_paylen */ >>> prev_cksum = th->cksum; >>> tmp = prev_cksum; >>> - tmp += ip_paylen; >>> + tmp += (ip_paylen & 0xffff) + (ip_paylen >> 16); >>> tmp = (tmp & 0xffff) + (tmp >> 16); >>> new_cksum = tmp; >>> >