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.129.124]) by mail.toke.dk (Postfix) with ESMTPS id C78119A7EC6 for ; Wed, 5 Oct 2022 16:19:37 +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=gaVOxGwL DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1664979576; 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=Vkdopemxb6Z46dw820Cf0moMwpkc0fcV+gICJjjuVD8=; b=gaVOxGwLX0YdlhppqAh5dw+Apwv0b+egrlZxPFeuXpOM0+4nDLduwU3mMnfMysKuw2hGYY F1qTA5sYTss/qT0PqP9jQneDO5ciDydgOq635VRmJo9HTakunvlNIgVWeB/7PiZv125Qph DRK2xuZTcNv0D+ISPFkjR2/JfLfQjFw= Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-657-WGOLFpoUM22mRdwEYOqTBA-1; Wed, 05 Oct 2022 10:19:34 -0400 X-MC-Unique: WGOLFpoUM22mRdwEYOqTBA-1 Received: by mail-ej1-f71.google.com with SMTP id gn33-20020a1709070d2100b00787e6fbcb72so6093201ejc.3 for ; Wed, 05 Oct 2022 07:19:34 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=Vkdopemxb6Z46dw820Cf0moMwpkc0fcV+gICJjjuVD8=; b=lg0Gqbg1hw3qMdOpIyZa7WTEOFiTY2F0t9muihh27n638kjmC9bREjuP8DyhvlaezA 7kIjME+ohq/4/GbzDWuVwSA0HdHuTXyUFxajUuPjIUr7o+DG8poK7SZEu1ScsNwNxJv/ q6m2fSfRlcoCzHgI6/5sNhcX6fn9zefTUwxAzY1QRuXEfH/eaiWXM3yktG4eq1oOF5Sp keWL/jNdcTL5hFpRTOXr2ZejI7dd52pGVNs6SC5wXSK4Ab5rVmQkWdvnCAgI7hKC57PP CJLnMpRmTXf3XFYXuwEfWZSYmKLDmf32E7KjseLN2qasSMPpOoQUAGB1B3v6Gy/4VBFX dbow== X-Gm-Message-State: ACrzQf2xuB995N96oZDgvJPhuQmKw6UJvkJggtrv7Je09UewCTqLt2Uv 2Wp4is+DlaakKBZ+dz7AYyIZrigIvk89HirykqkUZaqhiBXFdZ5WkoqguilKYBO6/qWh4UyfsWQ JcYrKzgcXE089uOC/1H3y X-Received: by 2002:a17:906:fe49:b0:73d:70c5:1a52 with SMTP id wz9-20020a170906fe4900b0073d70c51a52mr24303877ejb.469.1664979573441; Wed, 05 Oct 2022 07:19:33 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4vPuLz3Q3Ub9HPZp1hFZaBzSZ/qlVOyIBmW79DZsmIc167/r7nCD1F3sRsGclYwUSk6MdJOg== X-Received: by 2002:a17:906:fe49:b0:73d:70c5:1a52 with SMTP id wz9-20020a170906fe4900b0073d70c51a52mr24303854ejb.469.1664979573233; Wed, 05 Oct 2022 07:19:33 -0700 (PDT) Received: from [192.168.41.81] (83-90-141-187-cable.dk.customer.tdc.net. [83.90.141.187]) by smtp.gmail.com with ESMTPSA id 17-20020a170906211100b0077d37a5d401sm8772888ejt.33.2022.10.05.07.19.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 05 Oct 2022 07:19:32 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <55542209-03d7-590f-9ab1-bbbf924d033c@redhat.com> Date: Wed, 5 Oct 2022 16:19:30 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.3.0 To: Stanislav Fomichev , Jakub Kicinski References: <166256538687.1434226.15760041133601409770.stgit@firesoul> <35fcfb25-583a-e923-6eee-e8bbcc19db17@redhat.com> <5ccff6fa-0d50-c436-b891-ab797fe7e3c4@linux.dev> <20221004175952.6e4aade7@kernel.org> 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: Q6DHDPFQS5MDG2LI2QR6QAZ3WOARHDKQ X-Message-ID-Hash: Q6DHDPFQS5MDG2LI2QR6QAZ3WOARHDKQ 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, Martin KaFai Lau , Jesper Dangaard Brouer , bpf@vger.kernel.org, netdev@vger.kernel.org, xdp-hints@xdp-project.net, larysa.zaremba@intel.com, memxor@gmail.com, Lorenzo Bianconi , mtahhan@redhat.com, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , dave@dtucker.co.uk, Magnus Karlsson , bjorn@kernel.org X-Mailman-Version: 3.3.5 Precedence: list Subject: [xdp-hints] Re: [PATCH RFCv2 bpf-next 00/18] XDP-hints: XDP gaining access to HW offload hints via BTF List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 05/10/2022 03.02, Stanislav Fomichev wrote: > On Tue, Oct 4, 2022 at 5:59 PM Jakub Kicinski wrote: >> >> On Tue, 4 Oct 2022 17:25:51 -0700 Martin KaFai Lau wrote: >>> A intentionally wild question, what does it take for the driver to return the >>> hints. Is the rx_desc and rx_queue enough? When the xdp prog is calling a >>> kfunc/bpf-helper, like 'hwtstamp = bpf_xdp_get_hwtstamp()', can the driver >>> replace it with some inline bpf code (like how the inline code is generated for >>> the map_lookup helper). The xdp prog can then store the hwstamp in the meta >>> area in any layout it wants. >> >> Since you mentioned it... FWIW that was always my preference rather than >> the BTF magic :) The jited image would have to be per-driver like we >> do for BPF offload but that's easy to do from the technical >> perspective (I doubt many deployments bind the same prog to multiple >> HW devices).. On the technical side we do have the ifindex that can be passed along which is currently used for getting XDP hardware offloading to work. But last time I tried this, I failed due to BPF tail call maps. (It's not going to fly for other reasons, see redirect below). > > +1, sounds like a good alternative (got your reply while typing) > I'm not too versed in the rx_desc/rx_queue area, but seems like worst > case that bpf_xdp_get_hwtstamp can probably receive a xdp_md ctx and > parse it out from the pre-populated metadata? > > Btw, do we also need to think about the redirect case? What happens > when I redirect one frame from a device A with one metadata format to > a device B with another? Exactly the problem. With XDP redirect the "remote" target device also need to interpret this metadata layout. For RX-side we have the immediate case with redirecting into a veth device. For future TX-side this is likely the same kind of issue, but I hope if we can solve this for veth redirect use-case, this will keep us future proof. For veth use-case I hope that we can use same trick as bpf_core_field_exists() to do dead-code elimination based on if a device driver is loaded on the system like this pseudo code: if (bpf_core_type_id_kernel(struct xdp_hints_i40e_timestamp)) { /* check id + extract timestamp */ } if (bpf_core_type_id_kernel(struct xdp_hints_ixgbe_timestamp)) { /* check id + extract timestamp */ } If the given device drives doesn't exist on the system, I assume bpf_core_type_id_kernel() will return 0 at libbpf relocation/load-time, and thus this should cause dead-code elimination. Should work today AFAIK? --Jesper