Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp3258189pxf; Sun, 28 Mar 2021 18:47:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyTFGlvXCXe2uNdtOSersIs9YYNm8TRWDR/Qbrro/EA8QSdCPQHmzKoy9/9ZEkGXItnsDZ/ X-Received: by 2002:aa7:da04:: with SMTP id r4mr26553791eds.343.1616982447553; Sun, 28 Mar 2021 18:47:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616982447; cv=none; d=google.com; s=arc-20160816; b=kCZDjIJL1d0qIL6unn23UKfgQaGEU7OudEuu/ErBEtx1MtIWzJRpFCGatSfDQ3WayD J9E/lrtjalsm+M//W2goAgGonkUYpeLleexOxK0Inkb1owh0NcXgXADd8R1bbim9ag9K 5/HuMtwS9HbML2UxHU4eL8WlvpNCiYMnz7DgcJrkj5P+trGWtqPMMQh5vm8K3fTWRQL8 4zJTBH5j6wRB0AMqZ3AtyCYeXMgSPegHzvMbc21aVdIHL6H39RY6tm72lrz0LVw38gsm +h9pnRMHZTOPluBBZyqd6IuYDnQGwSkibHtF/LMkrzWR/SJhdVAFAMsKiYpdLHrN8pyR EQlg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=H8D3sGtLUXJOTzb0NqtEbyGHIovhRrWGfN86FA/SzbI=; b=T0gwunde7jJSyIwilCiey93qy4lvTPWB1AJ73EjiEQb8vrpGOMuzZ9T/nZnxDyT37X OLzsON5na7MoSRDvXbUaqMu37F/hvFqxXpz1zhNCTSry+/ANJxaVtmMvPU7ndYE2NUIv BH+YXtNUgeaBXt5CbXmLRY+miSmabNZFxF8MSJrCQO7XANFN8KbY+f6Hl7o7dPaYNPoh AzYHSbWcBjbOESodBvIeO7b3uRDjH1sz51WplDvm1D8xbm8T76uV0MZfe+905HS8LJAF Ji8ve8bEYAs4T/exWa1TRtRVyTXxbpp4B2CMAm7znU7Itzd+fXF3BIGJwN537iLlynra SceQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kmmLAvVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z18si11463030edb.55.2021.03.28.18.47.05; Sun, 28 Mar 2021 18:47:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=kmmLAvVL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230258AbhC2BqJ (ORCPT + 99 others); Sun, 28 Mar 2021 21:46:09 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48174 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229645AbhC2Bp3 (ORCPT ); Sun, 28 Mar 2021 21:45:29 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7EF6AC061574; Sun, 28 Mar 2021 18:45:29 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id f2-20020a17090a4a82b02900c67bf8dc69so6952398pjh.1; Sun, 28 Mar 2021 18:45:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=H8D3sGtLUXJOTzb0NqtEbyGHIovhRrWGfN86FA/SzbI=; b=kmmLAvVLSv+dgFeuvv9Hiqzz+TFTzYgoQQRIedNm3oyaPm4q9RR5udQo42Uie7F31a uuK+mI5ALbVAWk/GlHFWc4TGUMHQTH79RO8Bl66Ci0lrNBba9TeF1gp6SnJc2gpIDgok J1v4WOWQ1Qz+oafm8Nkcs82DtSCeP/8QJw7XN1mXgw0wAouEK43/MfFv3p1hDXlkgNde Lwd4KZkFGai0/4Jqm0yCOEiBzR96Sk0o9psiDHqSWOEsapK9E53McPDYBklcGEezFrpA OwfVvdHR+zDZ6Bye/vhzpAFnQcPsVuRFOl2T8rKCCaoZXhLOF7z4A4iLRqi9jVLkX7uy +Flw== 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:references :mime-version:content-disposition:in-reply-to; bh=H8D3sGtLUXJOTzb0NqtEbyGHIovhRrWGfN86FA/SzbI=; b=TCuYe0FXWATAg4Bh2E2D/DHdP+i8GSsaGPHPD2QXNkD15cmji6dT1SzfDWTkZAQcte K9vWfjaZo0OdH+JUEiH77Ox060aGR7RbhjUz57hXMu9ttRJIKQwpfPBJ756H6eodiZES TfoU3solcJPTbp2wT5u1tNHIrrEcIoeTLHmS+8KERMAUFEsXFK/kVqyE3zwi4KUZNxaU 3RHomfkLUmol2IlyJbUt42652FzYcTVxF8RLVZofqEla/UjLB/V2lGVOl9GiU4HrcnJr AN2ycwxMMZkRhBwbGgBAj/Byt+DRVf7rhtY0QrcU4ZOrCSZmbCrcaOUNg1pnTAWmGdvp GPHg== X-Gm-Message-State: AOAM530OJRkJsPEbBbHyN1Wmv9nTBZieXYZDY3bvKaJN6/6N/1nULC6x 0+1QWoHYtiZXOH3Qo46dg/M= X-Received: by 2002:a17:90a:a88d:: with SMTP id h13mr23502208pjq.61.1616982328799; Sun, 28 Mar 2021 18:45:28 -0700 (PDT) Received: from localhost ([112.79.240.89]) by smtp.gmail.com with ESMTPSA id k11sm13564044pjs.1.2021.03.28.18.45.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 18:45:28 -0700 (PDT) Date: Mon, 29 Mar 2021 07:15:25 +0530 From: Kumar Kartikeya Dwivedi To: Alexei Starovoitov Cc: Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , bpf@vger.kernel.org, brouer@redhat.com, Alexei Starovoitov , Daniel Borkmann , Andrii Nakryiko , Martin KaFai Lau , Song Liu , Yonghong Song , John Fastabend , KP Singh , Shuah Khan , "David S. Miller" , Jakub Kicinski , Jesper Dangaard Brouer , Peter Zijlstra , linux-kernel@vger.kernel.org, netdev@vger.kernel.org, linux-kselftest@vger.kernel.org Subject: Re: [PATCH bpf-next 5/5] libbpf: add selftests for TC-BPF API Message-ID: <20210329014328.srm6y7d6odmgzhri@apollo> References: <20210325120020.236504-1-memxor@gmail.com> <20210325120020.236504-6-memxor@gmail.com> <20210327021534.pjfjctcdczj7facs@ast-mbp> <87h7kwaao3.fsf@toke.dk> <20210329012602.4zzysn2ewbarbn3d@ast-mbp> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210329012602.4zzysn2ewbarbn3d@ast-mbp> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Mar 29, 2021 at 06:56:02AM IST, Alexei Starovoitov wrote: > This is up to you. I'm trying to understand the motivation for *_block() apis. > I'm not taking a stance for/against them. The block APIs simply attach to a different shared filter block, so in that sense they just forward to the bpf_tc_cls_*_dev API internally, where parent_id is substituted as block_index, and ifindex is set to a special value (to indicate operation on a block), but is still a distinct attach point, and both APIs cannot be mixed (i.e. manipulation of filter attached using block API is not possible using dev API). e.g. # tc qdisc add dev ingress block 1 # tc qdisc add dev ingress block 1 Now you can attach a filter to the shared block, e.g. # tc filter add block 1 bpf /home/kkd/foo.o sec cls direct-action and it will attach the identical filter with the bpf prog classifier to both qdiscs in one go, instead of having to duplicate filter creation for each qdisc. You can add arbitrarily many qdiscs to such a filter block, easing filter management, and saving on resources. So for the API, it made sense to separate this into its own function as it is a different attach point, both for the low level API and their higher level wrappers. This does increase the symbol count, but maintenance wise it is zero-cost since it simply forwards to the dev functions. As for the tests, I'll add them for the block API in v2, when I get around to sending it (i.e. after the review is over). > [...] -- Kartikeya