From mboxrd@z Thu Jan 1 00:00:00 1970 From: Martin KaFai Lau Subject: [PATCH v2 bpf 0/3] Introduce BPF_ANNOTATE_KV_PAIR Date: Sat, 21 Jul 2018 11:20:40 -0700 Message-ID: <20180721182043.1401089-1-kafai@fb.com> Mime-Version: 1.0 Content-Type: text/plain Cc: Alexei Starovoitov , Daniel Borkmann , To: Return-path: Received: from mx0a-00082601.pphosted.com ([67.231.145.42]:33670 "EHLO mx0a-00082601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728180AbeGUTOh (ORCPT ); Sat, 21 Jul 2018 15:14:37 -0400 Received: from pps.filterd (m0044008.ppops.net [127.0.0.1]) by mx0a-00082601.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w6LIJPaJ021411 for ; Sat, 21 Jul 2018 11:20:59 -0700 Received: from mail.thefacebook.com ([199.201.64.23]) by mx0a-00082601.pphosted.com with ESMTP id 2kc5txgb1f-1 (version=TLSv1 cipher=ECDHE-RSA-AES256-SHA bits=256 verify=NOT) for ; Sat, 21 Jul 2018 11:20:59 -0700 Sender: netdev-owner@vger.kernel.org List-ID: The series allows the BPF loader to figure out the btf_key_id and btf_value_id from a map's name by using BPF_ANNOTATE_KV_PAIR. It also removes the old 'typedef' way which requires two separate typedefs (one for the key and one for the value). By doing this, iproute2 and libbpf have one consistent way to figure out the btf_key_type_id and btf_value_type_id for a map. The first two patches are some prep/cleanup works. The last patch introduces BPF_ANNOTATE_KV_PAIR. v2: - Fix the incorrect '&&' check on container_type in bpf_map_find_btf_info(). - Expose the existing static btf_type_by_id() instead of creating a new one. Martin KaFai Lau (3): bpf: btf: Sync uapi btf.h to tools bpf: Replace [u]int32_t and [u]int64_t in libbpf bpf: Introduce BPF_ANNOTATE_KV_PAIR tools/include/uapi/linux/btf.h | 2 +- tools/lib/bpf/btf.c | 33 ++++---- tools/lib/bpf/btf.h | 10 ++- tools/lib/bpf/libbpf.c | 85 +++++++++++--------- tools/lib/bpf/libbpf.h | 4 +- tools/testing/selftests/bpf/bpf_helpers.h | 9 +++ tools/testing/selftests/bpf/test_btf_haskv.c | 7 +- 7 files changed, 80 insertions(+), 70 deletions(-) -- 2.17.1