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 9FA9A99AF21 for ; Tue, 30 Aug 2022 15:17:35 +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=g3EBiyBD DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1661865454; 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=tLji9PqzACdoD0jhQqAERUm3wAY5ioYdj8s6bxIG4ac=; b=g3EBiyBDbsySJII/VffEff3hPi5BL5A8tuR06SkuNVVZtz0+gwQyIy/q0d2iWf9nsIKJvd WdRtf8BkruDJ8Ec9FeNlU9wATZa1mObikn9psAvURbYQYOzW12/yKdAWtmvtXK7Ma0EV/W rrX4Qn/pw8ih7rlws+XVtuLJqqeOYKs= Received: from mail-ed1-f70.google.com (mail-ed1-f70.google.com [209.85.208.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-198-54jmOwBHOziDhBwzRK9Y2g-1; Tue, 30 Aug 2022 09:17:32 -0400 X-MC-Unique: 54jmOwBHOziDhBwzRK9Y2g-1 Received: by mail-ed1-f70.google.com with SMTP id v1-20020a056402348100b00448acc79177so2228558edc.23 for ; Tue, 30 Aug 2022 06:17:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:subject:to:content-language:cc:user-agent :mime-version:date:message-id:from:x-gm-message-state:from:to:cc; bh=tLji9PqzACdoD0jhQqAERUm3wAY5ioYdj8s6bxIG4ac=; b=ipAvFkQae15wg4wBCz5/efliwRrun7vOnt5E2VBiN8+ielx5ThR+vyhETivNiRJDkL wuEK/yJccNmjXTcmHtvBhNlBedSLs71iOR9Pg6a9GWr7Q6zu65CErdx/81m0PS5PrCZZ Xpm7nbn4aouEf2ykuzLAvLMnztWQyhRLPJzP2eTYPto3Ln3su0XoSj8DcKdQvzhC0DxU wW/0SFwCnAIyw53Qihm0lmW7BfDUPBmltWBO9Mh9MOMNrt66IYx8SqVVMbju4e/zW+WN tCx/g34yxVhsneU/2+jtbnEvLGp1LGiiCa0ph8EbBNGtUF9z3JcY3Rz5PbExUyMqha6Y b41w== X-Gm-Message-State: ACgBeo3kiMUhWrUfru9bpZ9Ufp/3dFTJzLWFALtZbE4MCfTfY8mroJJo Frwiweyyc27K3kvAsCAGrL+onfG/snsDWjmav263yknBOvcQDReVSD1Z/CeOtZctvfCT+L180gJ 2RAvlqTGeK6pzZJcTfzdd X-Received: by 2002:a17:907:1614:b0:73d:7c02:e090 with SMTP id hb20-20020a170907161400b0073d7c02e090mr17228621ejc.166.1661865451552; Tue, 30 Aug 2022 06:17:31 -0700 (PDT) X-Google-Smtp-Source: AA6agR5Kv7/jefJEzid56UIrzGzNQG32b3nmEL9ieXpBa/TWbfIb++L0caNkhGQA9IfW0DiwDNf40w== X-Received: by 2002:a17:907:1614:b0:73d:7c02:e090 with SMTP id hb20-20020a170907161400b0073d7c02e090mr17228600ejc.166.1661865451301; Tue, 30 Aug 2022 06:17:31 -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 lo5-20020a170906fa0500b0073cf8e0355fsm5704754ejb.208.2022.08.30.06.17.30 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 30 Aug 2022 06:17:30 -0700 (PDT) From: Jesper Dangaard Brouer X-Google-Original-From: Jesper Dangaard Brouer Message-ID: <2c7c8f91-a430-719c-5ef7-174cafa6c0be@redhat.com> Date: Tue, 30 Aug 2022 15:17:29 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.12.0 To: Andrii Nakryiko 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: ATSNGNDYKTPFSI4HP7SEYSACYLBPCBYD X-Message-ID-Hash: ATSNGNDYKTPFSI4HP7SEYSACYLBPCBYD 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, Zaremba Larysa , Alexei Starovoitov , bpf , "xdp-hints@xdp-project.net" X-Mailman-Version: 3.3.5 Precedence: list Subject: [xdp-hints] How to extract BTF object ID from kernel module? List-Id: XDP hardware hints design discussion Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Hi Andrii, When opening a modules BTF file (e.g. /sys/kernel/btf/i40e), can I somehow get the kernels BTF object ID value (via that FD)? I think I want the BTF object IDs as displayed by 'btftool btf'. That code walks all IDs via bpf_btf_get_next_id() and then gets the FD via bpf_btf_get_fd_by_id(). I'm looking for a more direct way than having to walk all IDs... (p.s. Cc. Larysa, I also looked at your code, which like bpftool end-up walking all BTF IDs and extends libbpf with internal btf_obj_id to keep track). --Jesper