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 3A7538E7738 for ; Wed, 17 Nov 2021 18:22:47 +0100 (CET) Authentication-Results: mail.toke.dk; dkim=pass (1024-bit key) header.d=redhat.com header.i=@redhat.com header.b=TJyf8yp/ DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1637169766; 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; bh=61ugkgfqVhlZttmLeQqoAU37XJvjZD2bT5AFN2rI2U4=; b=TJyf8yp/E8X83rJqjazigS2v7f+9L2Za/d5JLJpPU5dlwP4yB01U/fBb6hHM1rsGa+CDrW OFJbiNJrAVlfEn4h+Rlqs0Y6bn651163/2a+JwXeB/WUvosbIHPsaWF5CsQRpjddt1GwGj a6u4H+gA2X/hK04LRrTxDNR+IzsfTUk= Received: from mail-ed1-f72.google.com (mail-ed1-f72.google.com [209.85.208.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-453-renXcIxdNA65iGBrwMso0A-1; Wed, 17 Nov 2021 12:22:42 -0500 X-MC-Unique: renXcIxdNA65iGBrwMso0A-1 Received: by mail-ed1-f72.google.com with SMTP id w4-20020aa7cb44000000b003e7c0f7cfffso2790346edt.2 for ; Wed, 17 Nov 2021 09:22:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:message-id:date:mime-version:user-agent:cc :content-language:to:subject:content-transfer-encoding; bh=61ugkgfqVhlZttmLeQqoAU37XJvjZD2bT5AFN2rI2U4=; b=YHk2ZxpoDrNm1TsVjWh1dZNkAI/o5A6C9dpqvRN4YJbT2iPDJ4cFD1ZhzNsUf0F572 nqpiM3J3D91q3csvvInY/0EliBKFb8E01rMHvEGmvPyvnZR1h0lRnZQ2FtNGQPxNo4PW mdeOMUck615DJNgOiWcw8lw0rb9cZ3hREhfhctBX7i8lKrr3jFHBfEzKTR8+A9Y3vA/j u91kQmdOuHmD7tcF6ILc2EzQECdCW4c3WvarPqt3Y+glLdOrcN0TuC/LCM29XrM2rivS 8Kp1H0Y/PkgAQ2nNwAMH7hBV5U/YBi/qhfKBGykXZv5qWrRXZApNDxueTH3SdVprUuPw EiKw== X-Gm-Message-State: AOAM530zyV5sRF2K2dke096HQdd+oSMU7LDr6ilW+1N6kWmy0C+hYv4l 0gQUck/cKjNMYRIavCCSKnZ7un2bmJmKRQyH1DgwiDlAjYCIOzXbO1Y3mIIkFpsaciecYbgrYUW R6Pz+kYTrWwHZodyt8eRt X-Received: by 2002:a05:6402:2756:: with SMTP id z22mr477713edd.200.1637169761026; Wed, 17 Nov 2021 09:22:41 -0800 (PST) X-Google-Smtp-Source: ABdhPJzT42pL8rKid4zEHsLz3DLKMMY3okyupn07tmI7C5sX8Mrqi/trDIYD0ZHNt339tvvvhQST/Q== X-Received: by 2002:a05:6402:2756:: with SMTP id z22mr477674edd.200.1637169760789; Wed, 17 Nov 2021 09:22:40 -0800 (PST) Received: from [192.168.2.13] (3-14-107-185.static.kviknet.dk. [185.107.14.3]) by smtp.gmail.com with ESMTPSA id b11sm305682edz.50.2021.11.17.09.22.39 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 17 Nov 2021 09:22:40 -0800 (PST) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: Date: Wed, 17 Nov 2021 18:22:38 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 To: "Desouza, Ederson" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=jbrouer@redhat.com 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: DQQ7FLO6A4C7UQB7AKCGRMRLRGMR3WWY X-Message-ID-Hash: DQQ7FLO6A4C7UQB7AKCGRMRLRGMR3WWY 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, "xdp-hints@xdp-project.net" , Eelco Chaudron , Andrii Nakryiko X-Mailman-Version: 3.3.4 Precedence: list Subject: [xdp-hints] XDP-hints via local BTF info List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Ederson and others, I've coded up an XDP + AF_XDP application[1] that creates and shares XDP-hints via BTF from XDP-prog to AF_XDP. As explained in README[2] file, API for decoding the BTF data-structures in userspace have been placed into separate files lib_xsk_extend.c and lib_xsk_extend.h. The API is based on what Ederson proposed[3], but I have heavily modified the API while using it in the AF_XDP app. I've kept the hashmap optimization for now, but ended-up not using it... so I will propose removing it(?). My hope is we can discuss and mature the API together, before proposing the API to be included in either libbpf or libxdp. Notice no kernel changes required. Everything works today with what BTF info are provided in the BPF ELF-object file. Later, we want to extend the NIC drivers with the same kind of BTF info that describe the metadata area (our XDP-hints). For now, AF_XDP userspace will instead get the BTF-info from decoding the ELF-object file. Thus, for now the XDP BPF-prog will be the creator/provider of the XDP-hints layout. The requirement for being a valid XDP-hints data-struct is that the last member in the struct is named "btf_id" and have size 4 bytes (32-bit). With BTF the struct "string" names and member names becomes important, and is something that userspace will be "searching" for, to establish if a driver/BPF-prog provide a specific XDP-hints data structure. There is no restriction on what the XDP-hints struct should be named, but we might want some conversions when added this to the kernel drivers. Open to feedback, -Jesper [1] https://github.com/xdp-project/bpf-examples/tree/master/AF_XDP-interaction [2] https://github.com/xdp-project/bpf-examples/blob/master/AF_XDP-interaction/README.org#xdp-hints-via-local-btf-info [3] https://lore.kernel.org/bpf/20210803010331.39453-15-ederson.desouza@intel.com/