From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mail.toke.dk (Postfix) with ESMTPS id D7914A174F7 for ; Thu, 6 Jul 2023 11:57:11 +0200 (CEST) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key; unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256 header.s=mimecast20190719 header.b=K9IkYRBf DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1688637430; 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=4Zsb1SP89ZGc9tRZJIomQD8nqsVc6zy47mftdUlg5sk=; b=K9IkYRBfyOtyWjPhzy2YD2gs53peIiPtEo7LqsiaL6vpMNTSkC/ytVryBnINlic9/fJb1a ikx+RFRbhkKYcYka8gQYlY0Oz3ks1PyMaRZxLs7KQuSQePyXZf8brxaswIlZuUCvBtGCiG a8317DkaZ6k3JhNh3/TO6DBIUmsrv3o= Received: from mail-lj1-f198.google.com (mail-lj1-f198.google.com [209.85.208.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-424-4NbP4VkPN-GZgAaAeT3jeQ-1; Thu, 06 Jul 2023 05:57:09 -0400 X-MC-Unique: 4NbP4VkPN-GZgAaAeT3jeQ-1 Received: by mail-lj1-f198.google.com with SMTP id 38308e7fff4ca-2b70347bf04so4866261fa.3 for ; Thu, 06 Jul 2023 02:57:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688637428; x=1691229428; h=content-transfer-encoding:in-reply-to:references:to :content-language:subject:cc:user-agent:mime-version:date:message-id :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=4Zsb1SP89ZGc9tRZJIomQD8nqsVc6zy47mftdUlg5sk=; b=Q2X3XpQxPYqzsIaKuCIvIe604/J5yy0bdMkZn5LyEuTZqExx9syxhbCGE/lxpdoGlH X4ruaxWXTv1a7hpfGPiynxBG29KbvCu1kV71ntRHnQlcyGAxtP3p9djpGmIW45PrPZx/ 3PkrXc4J3mjv+uwj5s4l5hepoXheZu7mZZnuDRarw4dilZJgu1rIfMIz/o+YbHfxDB8F ov4aznrnvMtFcJFtgbhlGmwpiMPcMXbBGDspG8ZYc91RzD0jRGIkbbFJQ12jZNsJwJHR NpO16eZjmtwlR3QfxsDxIOP7goKDzR2flswyy7mqwUJ7hGFe/Ad7NON2MDvha7maKlQb iElw== X-Gm-Message-State: ABy/qLbSX2WFH+Pl/gIYvgIS+oUc/L8TO5hhTZhip821drbAzL5fWNdy NP2+SShb9lVYN2AcLM4LLRS38H6v6b5reZIYAVwxlrK4vp1dGH1747IA1Kn84pC+YYCO1J+27eJ z3ptjynD/BYZ6MsraA24f X-Received: by 2002:a2e:b04d:0:b0:2b6:a6e7:5afa with SMTP id d13-20020a2eb04d000000b002b6a6e75afamr1076074ljl.12.1688637428266; Thu, 06 Jul 2023 02:57:08 -0700 (PDT) X-Google-Smtp-Source: APBJJlFgougTcsRRbzaKfup7nQpf8GbXN1NXXCsc8c7jqbLKRFju0/oFjZjKYnDenXAULCC5eq2cRw== X-Received: by 2002:a2e:b04d:0:b0:2b6:a6e7:5afa with SMTP id d13-20020a2eb04d000000b002b6a6e75afamr1076050ljl.12.1688637427940; Thu, 06 Jul 2023 02:57:07 -0700 (PDT) Received: from [192.168.42.100] (194-45-78-10.static.kviknet.net. [194.45.78.10]) by smtp.gmail.com with ESMTPSA id y17-20020aa7d511000000b0051bf57aa0c6sm561571edq.87.2023.07.06.02.57.06 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 06 Jul 2023 02:57:07 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <72f31e46-55f7-1e09-bf69-9ebde6f9e732@redhat.com> Date: Thu, 6 Jul 2023 11:57:06 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.10.0 To: Stanislav Fomichev , Larysa Zaremba References: <20230703181226.19380-1-larysa.zaremba@intel.com> <20230703181226.19380-18-larysa.zaremba@intel.com> In-Reply-To: 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 Message-ID-Hash: FFYYKGQR2RSKBB6S6IP7VNHX6U3HQEEP X-Message-ID-Hash: FFYYKGQR2RSKBB6S6IP7VNHX6U3HQEEP X-MailFrom: jbrouer@redhat.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: brouer@redhat.com, bpf@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, andrii@kernel.org, martin.lau@linux.dev, song@kernel.org, yhs@fb.com, john.fastabend@gmail.com, kpsingh@kernel.org, haoluo@google.com, jolsa@kernel.org, David Ahern , Jakub Kicinski , Willem de Bruijn , Anatoly Burakov , Alexander Lobakin , Magnus Karlsson , Maryam Tahhan , xdp-hints@xdp-project.net, netdev@vger.kernel.org X-Mailman-Version: 3.3.8 Precedence: list Subject: [xdp-hints] Re: [PATCH bpf-next v2 17/20] veth: Implement VLAN tag and checksum level XDP hint List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 05/07/2023 19.25, Stanislav Fomichev wrote: > On 07/03, Larysa Zaremba wrote: >> In order to test VLAN tag and checksum level XDP hints in >> hardware-independent selfttests, implement newly added XDP hints in veth >> driver. >> >> Signed-off-by: Larysa Zaremba >> --- >> drivers/net/veth.c | 40 ++++++++++++++++++++++++++++++++++++++++ >> 1 file changed, 40 insertions(+) >> >> diff --git a/drivers/net/veth.c b/drivers/net/veth.c >> index 614f3e3efab0..a7f2b679551d 100644 >> --- a/drivers/net/veth.c >> +++ b/drivers/net/veth.c >> @@ -1732,6 +1732,44 @@ static int veth_xdp_rx_hash(const struct xdp_md *ctx, u32 *hash, >> return 0; >> } >> >> +static int veth_xdp_rx_vlan_tag(const struct xdp_md *ctx, u16 *vlan_tag, >> + __be16 *vlan_proto) >> +{ >> + struct veth_xdp_buff *_ctx = (void *)ctx; >> + struct sk_buff *skb = _ctx->skb; >> + int err; >> + >> + if (!skb) >> + return -ENODATA; >> + > > [..] > >> + err = __vlan_hwaccel_get_tag(skb, vlan_tag); > > We probably need to open code __vlan_hwaccel_get_tag here. Because it > returns -EINVAL on !skb_vlan_tag_present where the expectation, for us, > I'm assuming is -ENODATA? > Looking at in-tree users of __vlan_hwaccel_get_tag(), they don't use the err value for anything. Thus, we can just change __vlan_hwaccel_get_tag() to return -ENODATA instead of -EINVAL. (And also remember __vlan_get_tag() adjustmment). $ git diff diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 6ba71957851e..fb35d7dd77a2 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -540,7 +540,7 @@ static inline int __vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci) struct vlan_ethhdr *veth = skb_vlan_eth_hdr(skb); if (!eth_type_vlan(veth->h_vlan_proto)) - return -EINVAL; + return -ENODATA; *vlan_tci = ntohs(veth->h_vlan_TCI); return 0; @@ -561,7 +561,7 @@ static inline int __vlan_hwaccel_get_tag(const struct sk_buff *skb, return 0; } else { *vlan_tci = 0; - return -EINVAL; + return -ENODATA; } } >> + if (err) >> + return err; >> + >> + *vlan_proto = skb->vlan_proto; >> + return err; >> +} >> + >> +static int veth_xdp_rx_csum_lvl(const struct xdp_md *ctx, u8 *csum_level) >> +{ >> + struct veth_xdp_buff *_ctx = (void *)ctx; >> + struct sk_buff *skb = _ctx->skb; >> + >> + if (!skb) >> + return -ENODATA; >> + >> + if (skb->ip_summed == CHECKSUM_UNNECESSARY) >> + *csum_level = skb->csum_level; >> + else if (skb->ip_summed == CHECKSUM_PARTIAL && >> + skb_checksum_start_offset(skb) == skb_transport_offset(skb) || >> + skb->csum_valid) >> + *csum_level = 0; >> + else >> + return -ENODATA; >> + >> + return 0; >> +} >> + [...]