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=-1.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=no 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 06E14C43332 for ; Fri, 20 Mar 2020 18:35:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C896F20775 for ; Fri, 20 Mar 2020 18:35:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584729309; bh=ySAj4bmpuBVHJ1GMPLpIdVHIf+brmJDxVjGagal1xuc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=kQsjmzpYcPN5D8o9ZESudDAHo/ayy/A2DpIFFNikFOghmllVeceEKTi2wO/BX8klL JDielXQtY7T/Jok59K9WLFWsgoHIPG/wh2L2apeii9Rnt5L0hzOh+GFFJQo2qddcr9 aUPe+JBXi9btxqQC9RdlifnxXSwfojAm/V5Adr7Y= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727351AbgCTSfJ (ORCPT ); Fri, 20 Mar 2020 14:35:09 -0400 Received: from mail.kernel.org ([198.145.29.99]:39186 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727178AbgCTSfJ (ORCPT ); Fri, 20 Mar 2020 14:35:09 -0400 Received: from kicinski-fedora-PC1C0HJN (unknown [163.114.132.4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id CD64320739; Fri, 20 Mar 2020 18:35:07 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1584729308; bh=ySAj4bmpuBVHJ1GMPLpIdVHIf+brmJDxVjGagal1xuc=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=0bDgyUNC5y2ZU21NKBLt/DHsBsM8ZzFv9G3U+mGwTWkTrF3jHj3lO1hvPUkF+zxGk qxg+nYcrZ7d19+DeTow01TPz180IBwS8ovy0QM/HJvuiKniE73tbG1ZbiDcTdfWF5f R/gkHzLCi4i/Ehah9fxeK/f89uQAdQnmlXKRYFrc= Date: Fri, 20 Mar 2020 11:35:05 -0700 From: Jakub Kicinski To: Toke =?UTF-8?B?SMO4aWxhbmQtSsO4cmdlbnNlbg==?= Cc: Alexei Starovoitov , Daniel Borkmann , Martin KaFai Lau , Song Liu , Yonghong Song , Andrii Nakryiko , "David S. Miller" , Jesper Dangaard Brouer , John Fastabend , Lorenz Bauer , Andrey Ignatov , netdev@vger.kernel.org, bpf@vger.kernel.org Subject: Re: [PATCH bpf-next 1/4] xdp: Support specifying expected existing program when attaching XDP Message-ID: <20200320113505.62595593@kicinski-fedora-PC1C0HJN> In-Reply-To: <87imiy6gc5.fsf@toke.dk> References: <158462359206.164779.15902346296781033076.stgit@toke.dk> <158462359315.164779.13931660750493121404.stgit@toke.dk> <20200319155236.3d8537c5@kicinski-fedora-PC1C0HJN> <875zez76ph.fsf@toke.dk> <20200320103530.2853c573@kicinski-fedora-PC1C0HJN> <87imiy6gc5.fsf@toke.dk> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Sender: bpf-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: bpf@vger.kernel.org On Fri, 20 Mar 2020 19:17:46 +0100 Toke H=C3=B8iland-J=C3=B8rgensen wrote: > Jakub Kicinski writes: >=20 > >> > If we do please run this thru checkpatch, set .strict_start_type, = =20 > >>=20 > >> Will do. > >> =20 > >> > and make the expected fd unsigned. A negative expected fd makes no > >> > sense. =20 > >>=20 > >> A negative expected_fd corresponds to setting the UPDATE_IF_NOEXIST > >> flag. I guess you could argue that since we have that flag, setting a > >> negative expected_fd is not strictly needed. However, I thought it was > >> weird to have a "this is what I expect" API that did not support > >> expressing "I expect no program to be attached". =20 > > > > I see it now, not entirely unreasonable. > > > > Why did you choose to use the FD rather than passing prog id directly? > > Is the application unlikely to have program ID? =20 >=20 > For consistency with other APIs. Seems the pattern is generally that > userspace supplies program FDs, and the kernel returns IDs, no? This API just predates the IDs. "From kernel" API was added when=20 IDs already existed. I'd think for cmpxchg it may be easier if user space provides ID directly, since it's what it get returned.