Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp115434imm; Thu, 21 Jun 2018 15:01:12 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKtHdFGO5bXZ0+FOXmhr36Dhd/AiMfHEhuNqEco8dLOC4dASiOmWQ+qErKU9JUvx3eUPmw+ X-Received: by 2002:a17:902:6945:: with SMTP id k5-v6mr26370865plt.175.1529618472745; Thu, 21 Jun 2018 15:01:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529618472; cv=none; d=google.com; s=arc-20160816; b=h8SIu+751YJUcFB7ykFulF76mPn8Wlh4wke5zzqBIjG4PlQPycnpUbtzZgW/k8Ii0m 2Ok1WiI366kl0B+GYl232lhnmoxpOl23Mr2iB7IzTzLRbUMSOl3RmwmlzYoGWGvlhRtb Yrb0W8i3Xfdy38tut9SjntT3ulyJlIsK5+Mi3h0c/+skNRgvRyGn+C4UZbCnm0MEK7Gf rqx+uZKeP/3sjT+lDmUXVXhWpwOqzvygdBfAoMvYDmn+Wdy9Kaw9Nmvbd4TeoMAqhYWd NEqlnTmP9lkXpFMzMkb/O5HFBVF5buJEIzkbZ5GYJMMPt/bOK77S99OgLAjTyIzC+V4r Xz+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :organization:references:in-reply-to:message-id:subject:cc:to:from :date:dkim-signature:arc-authentication-results; bh=PrBHSaMFy3OjbtxlU0zAUwkcvyUVYjmEHVqAi7rr9+U=; b=FgSNsJ4dn7ixteopVLgGya0ibtqAGkVAQYpW+TMuLxw6bFiIwrrl5CPIS8+iNWRIg4 9tLUO3edQ7zLibmXuJqcnrsCF+KDxGmjD7cuMLuYCbiEE0lItrY7/VEfMLw3YxMZKAtx BN9RO2kfTaJIWG37lN4WZjVTwolJYVNE5fC5yIty/JAq94EZCaVWS33PkJZEF+pSRRrr 5rSAZbTXrtkQYMe1IGq+mlxYlMO/laRmW6ueILpF9Ydt//NxsRGBsZYoDMxHjcAZ+ITd JlyrTsVMKZm4pUtxTGtVT68TGwq1iL88nFLeD6eK0T2K7GnBxkcIIWo6l4EXps7iYAZa P27w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=bzLlziw0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id i86-v6si5846857pfk.146.2018.06.21.15.00.44; Thu, 21 Jun 2018 15:01:12 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@netronome-com.20150623.gappssmtp.com header.s=20150623 header.b=bzLlziw0; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933686AbeFUV7m (ORCPT + 99 others); Thu, 21 Jun 2018 17:59:42 -0400 Received: from mail-qt0-f172.google.com ([209.85.216.172]:42518 "EHLO mail-qt0-f172.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933485AbeFUV7k (ORCPT ); Thu, 21 Jun 2018 17:59:40 -0400 Received: by mail-qt0-f172.google.com with SMTP id y31-v6so4305278qty.9 for ; Thu, 21 Jun 2018 14:59:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netronome-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:in-reply-to:references :organization:mime-version:content-transfer-encoding; bh=PrBHSaMFy3OjbtxlU0zAUwkcvyUVYjmEHVqAi7rr9+U=; b=bzLlziw0XA4fQAaMZLDMNl26RBu4lKXfwy0ZMaPv8rx41jApVg5JR0+J4YDuKekLqr hUEXulPEhSpZXfP+GKQrijBhm3K/5RrlZSTuzkhZA64ZCDWG0XGpLDN7ScpmK6CnQWYs 4yjGpAFVXazkek1ivGBQQxm6uK3YA8pKcQJNg2THQC01+V5Rh4YKvIr/UUgxEogoBqFN nmfKbaERxVXPnJCUfKLC4ueeCAW6ywXpY8aPfwnQUnfMpVYlzIPBY6Z9DgyVGw1evea7 +V1mCMsBt8J/wlUFAQv28MowtMu9u7/3nglno9b2a5RYTx39H4RySDLxmM0Fur+QuRG5 ZTyA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:organization:mime-version:content-transfer-encoding; bh=PrBHSaMFy3OjbtxlU0zAUwkcvyUVYjmEHVqAi7rr9+U=; b=r5GFPSD3xBN2cGXs49VNi03lSjlLiftN+qMnZaEcDrLJlrX3QOOzHrjHjHGav4RHl1 UlPh1rdFfmE7amX9ldcC6y+zoS3JJesuWY91mnww6vkp5iGk0QdRilBbPE4gjV+G0bYM GW+P5H7QuLJ9RMqiPLSGkv0fe5bl1wg0fGoG6RKhZSyVfdrH2Dh0GXiGZbq3rukt3PUq fbpRMvNj50bPrIycwbAPePTq8CAHPZ72VMc0GzYuPt6TV9NeGvj7XtfYG5VLy07YNTiQ y1PAokfwVLl81HGJKiG7xMrja7a5y+M8d0s0Dkxi45EhN/vg2WiICtA96iuo9o0mRWvM BDyQ== X-Gm-Message-State: APt69E2qdS4RGb1bjLbCW3maLwokRZk4EQe52YScF6TZI4Bvnds6Q4vA 7NtsM+yTVRYq/E11ttEAZVyu2g== X-Received: by 2002:a0c:8601:: with SMTP id p1-v6mr24266433qva.184.1529618379718; Thu, 21 Jun 2018 14:59:39 -0700 (PDT) Received: from cakuba.netronome.com ([75.53.12.129]) by smtp.gmail.com with ESMTPSA id y128-v6sm4057265qkc.1.2018.06.21.14.59.38 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 21 Jun 2018 14:59:39 -0700 (PDT) Date: Thu, 21 Jun 2018 14:59:35 -0700 From: Jakub Kicinski To: Okash Khawaja Cc: Daniel Borkmann , Martin KaFai Lau , Alexei Starovoitov , Yonghong Song , Quentin Monnet , "David S. Miller" , , , Subject: Re: [PATCH bpf-next 2/3] bpf: btf: add btf json print functionality Message-ID: <20180621145935.41ff8974@cakuba.netronome.com> In-Reply-To: <20180620203703.101156292@fb.com> References: <20180620203051.223156973@fb.com> <20180620203703.101156292@fb.com> Organization: Netronome Systems, Ltd. MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 20 Jun 2018 13:30:53 -0700, Okash Khawaja wrote: > $ sudo bpftool map dump -p id 14 > [{ > "key": 0 > },{ > "value": { > "m": 1, > "n": 2, > "o": "c", > "p": [15,16,17,18,15,16,17,18 > ], > "q": [[25,26,27,28,25,26,27,28 > ],[35,36,37,38,35,36,37,38 > ],[45,46,47,48,45,46,47,48 > ],[55,56,57,58,55,56,57,58 > ] > ], > "r": 1, > "s": 0x7ffff6f70568, > "t": { > "x": 5, > "y": 10 > }, > "u": 100, > "v": 20, > "w1": 0x7, > "w2": 0x3 > } > } > ] I don't think this format is okay, JSON output is an API you shouldn't break. You can change the non-JSON output whatever way you like, but JSON must remain backwards compatible. The dump today has object per entry, e.g.: { "key":["0x00","0x00","0x00","0x00", ], "value": ["0x02","0x00","0x00","0x00","0x00","0x00","0x00","0x00" ] } This format must remain, you may only augment it with new fields. E.g.: { "key":["0x00","0x00","0x00","0x00", ], "key_struct":{ "index":0 }, "value": ["0x02","0x00","0x00","0x00","0x00","0x00","0x00","0x00" ], "value_struct":{ "src_ip":2, "dst_ip:0 } } The name XYZ_struct may not be the best, perhaps you can come up with a better one? Does that make sense? Am I missing what you're doing here? One process note - please make sure you run checkpatch.pl --strict on bpftool patches before posting. Thanks for working on this!