Received: by 2002:a05:6358:bb9e:b0:b9:5105:a5b4 with SMTP id df30csp5630247rwb; Wed, 7 Sep 2022 05:57:44 -0700 (PDT) X-Google-Smtp-Source: AA6agR5JN3J+s7Cay5HpXtK0UjiJOVyFJcQQW9b57EXohx8ZXdT9nYhz/5XytGYb64drG5oX/DO7 X-Received: by 2002:a17:906:fe0b:b0:730:3646:d177 with SMTP id wy11-20020a170906fe0b00b007303646d177mr2214109ejb.688.1662555464338; Wed, 07 Sep 2022 05:57:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662555464; cv=none; d=google.com; s=arc-20160816; b=crFhul43DyYMUBeTzPfJz+Ek2MYamAN0iMUd//IGJ2dhj5PRv/2PLJkO6M/j3Bwovx M9kbTlR8iejU6/4o8d41OEKBgSkLBTYcjpJjiFJYsl8U/ySdQ4R4flMf8WazJd2ZVh3U ZKv/NvBOSNIquTFvf1R5X/JhfWZqbmgbVaSsWEsCtCuiWfuTcI5Xho4LtJRftbTDekWc QaNl6hMHoDn3dyPAhYVNt3jThc0oplgCVEfS41rGc18gUDphEzbUbGAvjXnp5AjG/2bO 8Ym49mMo0/sn6PfyA+IPk/ET3IiRVspI/OwHzWITLBEHVMnPDJRm0sJ6xTQx56HdeAow oz/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=1lVpjtDlaF+5VhIEURmZCQn6FL6I+O+1d6YHDApNOVo=; b=O1ZCWx00G65E08bND1JHds0clKs0I8dWLmtz5WAVg4od6DYjHZlYGnL6gPZWRdpl2Z 1mycx2xpuCLPoOcNt5KIn6fduA7QagZCRwOGS0XTEGF2yFb7rcd5YxZOSiISJ2MkNB/I /9sBg7jwHG/HpEjk/3Y667qRUBajEuog6OnYSHIV2P+qyQxPrHnrlNVP/kJZtw8rVeuf y45F04Z20HYjZan9s/HGXSyi4DLhjxJd4XuILibt6QlTTmrGBJ1ZicLqchW567EEvCcb wNyhAmDSIgFDWcJh1CHlPFcHulEbK9tqUPY8pV396OB1XorzNMsz4b0KrHeCdIpWt4cB lcBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=5UQNPtqd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id f11-20020a056402354b00b00448763c66d3si11923105edd.46.2022.09.07.05.57.19; Wed, 07 Sep 2022 05:57:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=5UQNPtqd; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229936AbiIGMw2 (ORCPT + 99 others); Wed, 7 Sep 2022 08:52:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229733AbiIGMvy (ORCPT ); Wed, 7 Sep 2022 08:51:54 -0400 Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BFD7BAD9D for ; Wed, 7 Sep 2022 05:51:41 -0700 (PDT) Received: by mail-wr1-x42f.google.com with SMTP id t14so12953249wrx.8 for ; Wed, 07 Sep 2022 05:51:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date; bh=1lVpjtDlaF+5VhIEURmZCQn6FL6I+O+1d6YHDApNOVo=; b=5UQNPtqdkHpPWN0N9/VEPYYyYNwtNnwe+9/3G7MdlNAfG8WjcMeWVFb/Wr9BBND3Ti FL5Ek2A+ZXash4w/mb7J1X863Ol65gpFzJYJ3QOfWJZlFFbxYHbDOgTCvOpvj4r3zfjz q7wJzkYmJo1kyBvDKsJkO70q+OCp1qgJYhJTeaceKscLPyvkGgbjZsvZY+uzXF6IKRrB DWPpbNWp4dg+fikIcudCObxMyfECnE+fYdf4+EoYudL7scDufpWTpMSDQdiWADquaNfy DoaqqzahRz+M50gl0MmrgCEz4OMswO469LBZKsc4MEJMIo/6mMUjPeqemPnFdlMpDGOU 2eLA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date; bh=1lVpjtDlaF+5VhIEURmZCQn6FL6I+O+1d6YHDApNOVo=; b=iEoqwb9ITJqnVj36vdypTIZ2HZB4D0F0xPlhSUFCmu+pbMnYGSdylH3SCl2orc4H1p 4qCmgApGKHjG7Is9A5mjPWqBb1jVW0SCYbJZ+W20GXm/ufIJqqVfS+q14H+8BlUF9zrC vXD6Og1z8VPQ8t/+L61HBB3UXzRsz71t8bZq5Q2m+A/9kGrw+jnXu5iyTy83YzKH7w9o jJgAYMQdFkSHcuaMDrMTfXKkExkseVAKqi7rgN8l/EwaX1gTqz/R9CvEYigTdNVM8tEh mGIckmKsZ3FOyWogNDAxavGctwJn3xCRTbL14Az4FqESKFTe+DerRE0kGT7EjjYRdN/q mRog== X-Gm-Message-State: ACgBeo3y0GXHggwqlGhgK03PlKwQ4sHkC4l0F7KfBvb9cKTalWdg7CwU 0QxXJbZED5rM8b0Ji3TDXNldJQ== X-Received: by 2002:a5d:588b:0:b0:227:1c28:f470 with SMTP id n11-20020a5d588b000000b002271c28f470mr2106538wrf.331.1662555099965; Wed, 07 Sep 2022 05:51:39 -0700 (PDT) Received: from navi.cosmonova.net.ua ([95.67.24.131]) by smtp.gmail.com with ESMTPSA id e27-20020adf9bdb000000b0021f0ff1bc6csm11480001wrc.41.2022.09.07.05.51.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 07 Sep 2022 05:51:39 -0700 (PDT) From: Andrew Melnychenko To: edumazet@google.com, netdev@vger.kernel.org, virtualization@lists.linux-foundation.org, linux-kernel@vger.kernel.org, davem@davemloft.net, kuba@kernel.org, jasowang@redhat.com, mst@redhat.com, pabeni@redhat.com, yoshfuji@linux-ipv6.org, dsahern@kernel.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [PATCH v3 5/6] linux/virtio_net.h: Support USO offload in vnet header. Date: Wed, 7 Sep 2022 15:50:47 +0300 Message-Id: <20220907125048.396126-6-andrew@daynix.com> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220907125048.396126-1-andrew@daynix.com> References: <20220907125048.396126-1-andrew@daynix.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_NONE, T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Now, it's possible to convert USO vnet packets from/to skb. Added support for GSO_UDP_L4 offload. Signed-off-by: Andrew Melnychenko --- include/linux/virtio_net.h | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/include/linux/virtio_net.h b/include/linux/virtio_net.h index a960de68ac69..bdf8de2cdd93 100644 --- a/include/linux/virtio_net.h +++ b/include/linux/virtio_net.h @@ -15,6 +15,7 @@ static inline bool virtio_net_hdr_match_proto(__be16 protocol, __u8 gso_type) case VIRTIO_NET_HDR_GSO_TCPV6: return protocol == cpu_to_be16(ETH_P_IPV6); case VIRTIO_NET_HDR_GSO_UDP: + case VIRTIO_NET_HDR_GSO_UDP_L4: return protocol == cpu_to_be16(ETH_P_IP) || protocol == cpu_to_be16(ETH_P_IPV6); default: @@ -31,6 +32,7 @@ static inline int virtio_net_hdr_set_proto(struct sk_buff *skb, switch (hdr->gso_type & ~VIRTIO_NET_HDR_GSO_ECN) { case VIRTIO_NET_HDR_GSO_TCPV4: case VIRTIO_NET_HDR_GSO_UDP: + case VIRTIO_NET_HDR_GSO_UDP_L4: skb->protocol = cpu_to_be16(ETH_P_IP); break; case VIRTIO_NET_HDR_GSO_TCPV6: @@ -69,6 +71,11 @@ static inline int virtio_net_hdr_to_skb(struct sk_buff *skb, ip_proto = IPPROTO_UDP; thlen = sizeof(struct udphdr); break; + case VIRTIO_NET_HDR_GSO_UDP_L4: + gso_type = SKB_GSO_UDP_L4; + ip_proto = IPPROTO_UDP; + thlen = sizeof(struct udphdr); + break; default: return -EINVAL; } @@ -182,6 +189,8 @@ static inline int virtio_net_hdr_from_skb(const struct sk_buff *skb, hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV4; else if (sinfo->gso_type & SKB_GSO_TCPV6) hdr->gso_type = VIRTIO_NET_HDR_GSO_TCPV6; + else if (sinfo->gso_type & SKB_GSO_UDP_L4) + hdr->gso_type = VIRTIO_NET_HDR_GSO_UDP_L4; else return -EINVAL; if (sinfo->gso_type & SKB_GSO_TCP_ECN) -- 2.37.2