Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from smtp1.osuosl.org (smtp1.osuosl.org [140.211.166.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 7BA30C54EE9 for ; Wed, 7 Sep 2022 12:51:45 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp1.osuosl.org (Postfix) with ESMTP id 26018813F2; Wed, 7 Sep 2022 12:51:45 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org 26018813F2 Authentication-Results: smtp1.osuosl.org; dkim=fail reason="signature verification failed" (2048-bit key) header.d=daynix-com.20210112.gappssmtp.com header.i=@daynix-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=5UQNPtqd X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp1.osuosl.org ([127.0.0.1]) by localhost (smtp1.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id LTUxda6Rp6yH; Wed, 7 Sep 2022 12:51:44 +0000 (UTC) Received: from lists.linuxfoundation.org (lf-lists.osuosl.org [IPv6:2605:bc80:3010:104::8cd3:938]) by smtp1.osuosl.org (Postfix) with ESMTPS id A17C3813E4; Wed, 7 Sep 2022 12:51:43 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp1.osuosl.org A17C3813E4 Received: from lf-lists.osuosl.org (localhost [127.0.0.1]) by lists.linuxfoundation.org (Postfix) with ESMTP id 79A90C0033; Wed, 7 Sep 2022 12:51:43 +0000 (UTC) Received: from smtp3.osuosl.org (smtp3.osuosl.org [140.211.166.136]) by lists.linuxfoundation.org (Postfix) with ESMTP id AA002C002D for ; Wed, 7 Sep 2022 12:51:42 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by smtp3.osuosl.org (Postfix) with ESMTP id 8505E60AFC for ; Wed, 7 Sep 2022 12:51:42 +0000 (UTC) DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org 8505E60AFC Authentication-Results: smtp3.osuosl.org; dkim=pass (2048-bit key) header.d=daynix-com.20210112.gappssmtp.com header.i=@daynix-com.20210112.gappssmtp.com header.a=rsa-sha256 header.s=20210112 header.b=5UQNPtqd X-Virus-Scanned: amavisd-new at osuosl.org Received: from smtp3.osuosl.org ([127.0.0.1]) by localhost (smtp3.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Gbf3vnxT77LC for ; Wed, 7 Sep 2022 12:51:42 +0000 (UTC) X-Greylist: whitelisted by SQLgrey-1.8.0 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp3.osuosl.org B161460AFB Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by smtp3.osuosl.org (Postfix) with ESMTPS id B161460AFB for ; Wed, 7 Sep 2022 12:51:41 +0000 (UTC) Received: by mail-wr1-x433.google.com with SMTP id b5so20241653wrr.5 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=Lio5jwuRC7IQA4O2MYH9ZkSJh/PurcU49pbk42mFmL76UcPbDwZ10b3oMqy/GnrHqa ZbjleILd3Cup1DSsH8eZP4NI9dDFe3If2efk89X27LpKcVZ62ifuz+BdyE1pEELnc5DB tYRmIy6zrF38w8Prp2Ntw/tRCVXg2gDeGFeOItM2r2TdAemzjW4PrYBXswzOExqF9AdO GT21SJ/YQ7LOJTpwL7eXn5LxChQJLuzVB+JLLuqTYiHk5dzoGcHpNLwR+Y1FV3kwJr+V SacXctRVqzMhoI90fJbd+GXwJ3jBqTF/QxTwvjvjoX9SvwEMeTqKPeYnjlJXL+IGwA+f A1+Q== X-Gm-Message-State: ACgBeo1uRGu0o+4Mi16vZ9xrXPs9/G5AcHiuq8HKc5FaTGEkfnZpEX1z cssu0QuD78D7ZB+WTifCj1s1og== X-Google-Smtp-Source: AA6agR7E7ieAZs6ZSxlc170nzW3ZuxPMzwS5U8xxx/8UBWzcJrILidBN+RNwFSraQHtxHJDkCS7XLA== 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 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 Cc: yan@daynix.com, yuri.benditovich@daynix.com X-BeenThere: virtualization@lists.linux-foundation.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: Linux virtualization List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: virtualization-bounces@lists.linux-foundation.org Sender: "Virtualization" 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 _______________________________________________ Virtualization mailing list Virtualization@lists.linux-foundation.org https://lists.linuxfoundation.org/mailman/listinfo/virtualization