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 0314CA0C45; Mon, 13 Sep 2021 22:06:26 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 75B3540151; Mon, 13 Sep 2021 22:06:26 +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 BF78F4014F for ; Mon, 13 Sep 2021 22:06:24 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1631563584; 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=/zLY860NYDJm7Qr37Vj2RPGwVqI/1LVsUw54vju7oIw=; b=HQppZuW2Q4mYLryDPAovKNlC24N6Ykxggyo3MUXpR1eej3vKTl4NGEGRRu+EZ+Uy5SJ2Fg JZJ6Pm2n5XDseyznH1edPe00NUkp6wZ8jjrrMtzNEYOrbMXRVM7E8tMP8M5fbx1ibN3dnN G8m0wndziZaiLL1ChKaFZKJUQvxIyNk= 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-436-w4eEYUdjPS272uKk4gKelQ-1; Mon, 13 Sep 2021 16:06:23 -0400 X-MC-Unique: w4eEYUdjPS272uKk4gKelQ-1 Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 144201006AA1; Mon, 13 Sep 2021 20:06:22 +0000 (UTC) Received: from [10.39.208.12] (unknown [10.39.208.12]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 1592F7A5C5; Mon, 13 Sep 2021 20:06:20 +0000 (UTC) To: Ivan Malov , dev@dpdk.org Cc: Andrew Rybchenko , Chenbo Xia References: <20210830142655.18373-1-ivan.malov@oktetlabs.ru> From: Maxime Coquelin Message-ID: Date: Mon, 13 Sep 2021 22:06:19 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210830142655.18373-1-ivan.malov@oktetlabs.ru> X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=maxime.coquelin@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-dev] [PATCH] net/virtio: handle Tx checksums correctly for tunnel packets 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" On 8/30/21 4:26 PM, Ivan Malov wrote: > Tx prepare method calls rte_net_intel_cksum_prepare(), which > handles tunnel packets correctly, but Tx burst path does not > take tunnel presence into account when computing the offsets. > > Signed-off-by: Ivan Malov > Reviewed-by: Andrew Rybchenko > --- > drivers/net/virtio/virtqueue.h | 9 ++++++--- > 1 file changed, 6 insertions(+), 3 deletions(-) > > diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h > index 03957b2bd0..b83ff32efb 100644 > --- a/drivers/net/virtio/virtqueue.h > +++ b/drivers/net/virtio/virtqueue.h > @@ -620,19 +620,21 @@ static inline void > virtqueue_xmit_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *cookie) > { > uint64_t csum_l4 = cookie->ol_flags & PKT_TX_L4_MASK; > + uint16_t o_l23_len = (cookie->ol_flags & PKT_TX_TUNNEL_MASK) ? > + cookie->outer_l2_len + cookie->outer_l3_len : 0; > > if (cookie->ol_flags & PKT_TX_TCP_SEG) > csum_l4 |= PKT_TX_TCP_CKSUM; > > switch (csum_l4) { > case PKT_TX_UDP_CKSUM: > - hdr->csum_start = cookie->l2_len + cookie->l3_len; > + hdr->csum_start = o_l23_len + cookie->l2_len + cookie->l3_len; > hdr->csum_offset = offsetof(struct rte_udp_hdr, dgram_cksum); > hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; > break; > > case PKT_TX_TCP_CKSUM: > - hdr->csum_start = cookie->l2_len + cookie->l3_len; > + hdr->csum_start = o_l23_len + cookie->l2_len + cookie->l3_len; > hdr->csum_offset = offsetof(struct rte_tcp_hdr, cksum); > hdr->flags = VIRTIO_NET_HDR_F_NEEDS_CSUM; > break; > @@ -650,7 +652,8 @@ virtqueue_xmit_offload(struct virtio_net_hdr *hdr, struct rte_mbuf *cookie) > VIRTIO_NET_HDR_GSO_TCPV6 : > VIRTIO_NET_HDR_GSO_TCPV4; > hdr->gso_size = cookie->tso_segsz; > - hdr->hdr_len = cookie->l2_len + cookie->l3_len + cookie->l4_len; > + hdr->hdr_len = o_l23_len + cookie->l2_len + cookie->l3_len + > + cookie->l4_len; > } else { > ASSIGN_UNLESS_EQUAL(hdr->gso_type, 0); > ASSIGN_UNLESS_EQUAL(hdr->gso_size, 0); > It looks good to me, only thing missing the the fixes line so that it is backported. Thanks, Maxime