From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_SANE_1 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72517ECE58C for ; Tue, 8 Oct 2019 21:49:43 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 4C4CE20679 for ; Tue, 8 Oct 2019 21:49:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726007AbfJHVtm (ORCPT ); Tue, 8 Oct 2019 17:49:42 -0400 Received: from www62.your-server.de ([213.133.104.62]:52294 "EHLO www62.your-server.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725989AbfJHVtl (ORCPT ); Tue, 8 Oct 2019 17:49:41 -0400 Received: from 55.249.197.178.dynamic.dsl-lte-bonding.lssmb00p-msn.res.cust.swisscom.ch ([178.197.249.55] helo=localhost) by www62.your-server.de with esmtpsa (TLSv1.2:DHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1iHxMP-0002zs-J0; Tue, 08 Oct 2019 23:49:37 +0200 Date: Tue, 8 Oct 2019 23:49:37 +0200 From: Daniel Borkmann To: Andrii Nakryiko Cc: Andrii Nakryiko , bpf , Networking , Alexei Starovoitov , Quentin Monnet , Kernel Team Subject: Re: [PATCH v4 bpf-next 1/3] uapi/bpf: fix helper docs Message-ID: <20191008214937.GH27307@pc-66.home> References: <20191007030738.2627420-1-andriin@fb.com> <20191007030738.2627420-2-andriin@fb.com> <20191007094346.GC27307@pc-66.home> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) X-Authenticated-Sender: daniel@iogearbox.net X-Virus-Scanned: Clear (ClamAV 0.101.4/25596/Tue Oct 8 10:33:54 2019) Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Mon, Oct 07, 2019 at 10:47:19AM -0700, Andrii Nakryiko wrote: > On Mon, Oct 7, 2019 at 2:43 AM Daniel Borkmann wrote: > > On Sun, Oct 06, 2019 at 08:07:36PM -0700, Andrii Nakryiko wrote: > > > Various small fixes to BPF helper documentation comments, enabling > > > automatic header generation with a list of BPF helpers. > > > > > > Signed-off-by: Andrii Nakryiko [...] > > I'm wondering whether it would simply be much better to always just use 'void *ctx' > > for everything that is BPF context as it may be just confusing to people why different > > types are chosen sometimes leading to buggy drive-by attempts to 'fix' them back into > > struct sk_buff * et al. > > I'm impartial on this issue. In some cases it might be helpful to > specify what is the expected type of the context, if it's only ever > one type, but there are lots of helpers that accept various contexts, > so for consistency its better to just have "void *context". I would favor consistency here to always have "void *context". One additional issue I could see happening otherwise on top of the 'fix' attempts is that if existing helpers get enabled for multiple program types and these have different BPF context, then it might be quite easy to forget converting struct __sk_buff * and whatnot to void * in the helper API doc, so the auto-generated BPF helpers will continue to have only the old type. Thanks, Daniel