Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1003929iob; Thu, 12 May 2022 09:05:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxOf29/SagnhSbwgikeRIvlwFeFfqNSMQXjscNZMlM8j1cvfBpeSHlZ3y+Y2LqsIf3LW3tM X-Received: by 2002:a17:907:9605:b0:6f5:c66:7c13 with SMTP id gb5-20020a170907960500b006f50c667c13mr570043ejc.66.1652371529235; Thu, 12 May 2022 09:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652371529; cv=none; d=google.com; s=arc-20160816; b=xqSWUODZDrDON5aB4bSg+Gr6tD3xDMADGmo0IFFSZGakK7g3i/eMqGSe5KYhyfFXV0 fTj2i2F5OisFiN6rS1s/iXlBogiOw24WQmoFbAxplEpfqb7zmG4jf17gITHIL9A6bPr+ adEoHnC/UK2RlSCHA02rPcmDPggW+Ntw3dx4ha/0xOIlxygWlIXHZo7gjt6t6wiJZubi uKJprQuPvsQLoqDXTAAB3f9wS672JccsK4NpEyrN9INqrB8vM2GovZB1YnGPWjYg7x8k lELtFhtWlPnhyGY+TpDlNVZIJ5kuTPGHelPJQ60tMGxbGPj23AAsQlzazyBXHvLBbojM SjnA== 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=uEd6sKxlslOXYob+aYfGwuvE08ax3brjjZ3tUvtT5nY=; b=WvJzZnUlWwT7HOF/XxH4Ch52uTPwGftr+AGgtpmUsNqazf+kO9nYgwqCYgf5jK8IWi EwA/RlTSjoI1w/pSLGTVumToflI5q4CTmcHxJnmQbWrofrlilf3Lh5IVyXfwe/3NLWZn ird54oLAf1TVoTYMuItpgzM4PqtWm/NEba+WYBMYHEtm02pu8eZCLPBnhMO7yct7lSI5 VZf4AfhPNhLuwdUVo0GABxCWs29vTCEME6ZlHAHf3FBI4zjJViSBTMu87GPPC/JW3JNA dIwZ3gaICpaftlA7AYPWdjuic5ss3TI3joNevLZUz9i6/1igUMZrM3QxHVXpnHn2BCqD hBhw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@daynix-com.20210112.gappssmtp.com header.s=20210112 header.b=mCHGtsjt; 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 n29-20020a5099dd000000b00427e10fe80dsi6288707edb.547.2022.05.12.09.05.00; Thu, 12 May 2022 09:05:29 -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=mCHGtsjt; 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 S1353328AbiELLdq (ORCPT + 99 others); Thu, 12 May 2022 07:33:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1353220AbiELLd0 (ORCPT ); Thu, 12 May 2022 07:33:26 -0400 Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 97F851CD266 for ; Thu, 12 May 2022 04:33:24 -0700 (PDT) Received: by mail-lf1-x135.google.com with SMTP id bu29so8597329lfb.0 for ; Thu, 12 May 2022 04:33:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=daynix-com.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uEd6sKxlslOXYob+aYfGwuvE08ax3brjjZ3tUvtT5nY=; b=mCHGtsjtThp07FRQVWEOYHDAwe2bBM2SDMWFzwOclYH/rUTFzeOEkDMmdNLQf39AT2 O2mNEgmOZg/cHw7jlv0Osi3mhNGYG0l8Xz49E+1YMT0zwPkbiMC1s3QXwWiOOzm0dn4X 2Tt81II75xQVgnFqgQ4NbIPn1AZm3tiuyTeEaqNvgHmAKCVh0lGRJrDT4/tSsVjAaDDv qsFOHs+FzmaSvfyupxUNCNbI/vncTof4xDFmBCYbWV3Z3eudplwDwY4YBoYZgzUj00Ow igGvTMUVJu/KWjf1Sm5CwmrI00a5XCneA5bhaUdYVtKeqDokXwPGjxLL6ljRGAZjKuv8 FF7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=uEd6sKxlslOXYob+aYfGwuvE08ax3brjjZ3tUvtT5nY=; b=0Hoix+cqEi9UIpdVqjtlMjcCZLnCIa32MjC1mxQkyLUJR83X6z9FxzF41iHWlOdUeQ ShF2iaMpZtGCgwJWXUUagREoG5j3IUR+J0FUsCmVM2EiE4oOhBklihCuJPEA7e+ateGM q1CRvrOn2LRlQFcENRTRLVExteR7Dkb1SD1fE3IwFui9yFLi7bOWQti+i8nmKSDS+1Ph 289GLK+eEPUODdR0nD8j3dc4W+jqAkII3uWl4RRfmywey9KrFUDR6gD3zRtZdJ0VS5iB yLg+2q10ihAPFIkAchjNh/Hv0OWeFiUWSsJUbwC0qB0ZtwJQ47MrZ4ljZxs3gNEamT8m 6/pg== X-Gm-Message-State: AOAM530H8UL6h3Dv3zLarm8jhruu4LHirX2Ok6SOlmKhB9j42L3Iekt7 XKY4Ye/nGploAUduAQRkrGIirw== X-Received: by 2002:a05:6512:4009:b0:46d:31b:e05a with SMTP id br9-20020a056512400900b0046d031be05amr24343108lfb.528.1652355203000; Thu, 12 May 2022 04:33:23 -0700 (PDT) Received: from localhost.localdomain (host-188-190-49-235.la.net.ua. [188.190.49.235]) by smtp.gmail.com with ESMTPSA id r29-20020ac25a5d000000b0047255d211a6sm741758lfn.213.2022.05.12.04.33.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 12 May 2022 04:33:22 -0700 (PDT) From: Andrew Melnychenko To: davem@davemloft.net, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, mst@redhat.com, jasowang@redhat.com, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, virtualization@lists.linux-foundation.org Cc: yan@daynix.com, yuri.benditovich@daynix.com Subject: [RFC PATCH v2 4/5] linux/virtio_net.h: Support USO offload in vnet header. Date: Thu, 12 May 2022 14:23:46 +0300 Message-Id: <20220512112347.18717-5-andrew@daynix.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220512112347.18717-1-andrew@daynix.com> References: <20220512112347.18717-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=ham 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.35.1