Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp2767861pxf; Sun, 28 Mar 2021 01:21:56 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+jfSjAFsj3AJmii3v4kSZnbxiSY4xSwgUtcgmiGM7G9urKCT8XC3/TFaF356mu7aYD2nk X-Received: by 2002:a17:906:ca50:: with SMTP id jx16mr23614751ejb.72.1616919716309; Sun, 28 Mar 2021 01:21:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616919716; cv=none; d=google.com; s=arc-20160816; b=qNGFq7OYQ/KY66fc1qS/gUhskV9Ugh7V9sxRApEisQb288X+WIcQUDbDnEmCtcvCuy LCE8aZFOb4SFP4Ij8DQ/6evZ3rVu2Onv8qM/bGASrJfhKwe90XCo/rn/aYGnXcHqqSko 7xQllfKQ/lGk+sYQig27Tk3VPDCLR+RfzibNQevsvmHXjYL+IJQR7m+gr/aHGf5M0ALy RDP3gJyIGh58Ett8Hx861m1t4nfKWH/UdQLjkKFsT61P7LpOj4EkS6ZIzpjAZ1LJ9hO1 4DIPaFySBaCqNBoQRzIUqRVQbTab7eBWn8dIpv6pVPXQkIbAoQ2q6JLOEbRPy1ERq+78 qSjA== 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=1XdXQKnDghpTP9/KuIBNLvBqdWivOptTKhhbKCDsWIs=; b=GkKBjKGB2x6B2ff8ynQlOUMX1tkbo4FSCf/QmtWTZm/6hAJOsl4gcwBCQ5sW+c1G4l eoErJ4IBHVGCRem7A7q8uO5GbQW5M4p6EuELN6iy81T3MxK10m4E6sLf0y6t1qYzWzjk 19NEMb5mbWQtP4oom/Bw9rB/NURHbiAXXXI/aA3lRFhRCvlahAlNoi8aZ9iLJQi9Kytp PuQS3rmutdotVCIZXx4HYmDx9h06ELPbSbU5CgsvG2gVCH/xVDETra6WWtbIe0tZCxap g0dRNHjDuevINu+wR7oq7YF6v+FVg41C4AP1hiWvktcaJwJlg7pI3x7PmPL982xcEld+ itOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BH8FWnR0; 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 do7si10937106ejc.307.2021.03.28.01.21.33; Sun, 28 Mar 2021 01:21:56 -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=BH8FWnR0; 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 S231267AbhC1ILh (ORCPT + 99 others); Sun, 28 Mar 2021 04:11:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230202AbhC1ILF (ORCPT ); Sun, 28 Mar 2021 04:11:05 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6CB83C061762; Sun, 28 Mar 2021 01:11:05 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id c204so7843990pfc.4; Sun, 28 Mar 2021 01:11:05 -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=1XdXQKnDghpTP9/KuIBNLvBqdWivOptTKhhbKCDsWIs=; b=BH8FWnR0B3WVQoG8ayN2b+US8Fy2kGqGo/VjmZHcZfM4zwCMsDebfNl6zPlfpDP7aU IXdDaYA3y3cFKVRk9TRy+GkRWHtSMnwYpHgKUkhYemneQJZW0TkjMwRVggxatkAw3rSg 3ZILefa4/GcdSdMQ7mQJ4Ae5s5i8f7Xb2HBw8+PAIFQjsYEjF8+O73m/0L389dj4zHtb TfE/1KAFOi+YPMOv2F75Nrgq/h/HWgp7BPTzhvrD7fUmhLE0lcJ8r+zEi6/5jxQEjf4k Cj8dsw+4TlLvNVGw2IdXQvEhwxRLNXVqfLpLDzxgP35Kise2WSTuOLRKspB9chz6VTja eKdw== 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=1XdXQKnDghpTP9/KuIBNLvBqdWivOptTKhhbKCDsWIs=; b=cFqEHhjDJsnjQXuF6aLYQSJ2WUa30gPKuw2OImG6BnwTSkycwa44WwtPKB9t2elZt1 IlJTiUHn2GpsiAyKty2GXXyu4cjjXHfANcHP1VFiB0vU39ZmVtWynuEhz/2ULdD6fAJl w31Ne0j7dPDFFbsJMojXr3uAsB0qpkl928EhO95iNt9AGfpj6pAIxDhOivl+2t3NnWli yjsTzCXLzEsg6FQPAFVCmHgU5i3b8eP78U+EN8gWnjnar7yYz710tg5k67UPsUM/jGnW 53eX7MUifUcsKfU3ONAsSffQ4D9ctq4cEPvSPKQvSYpsokJfaYGXE1utLFcYNzXJNSxm wtIg== X-Gm-Message-State: AOAM532MDcjeCoidk/SqOrRe8GAI/lNva/jM1hikccC/YwOsdN7+aGNc TRru37u2TSjgxxQwy0RZnCc= X-Received: by 2002:a63:3189:: with SMTP id x131mr19282394pgx.430.1616919064473; Sun, 28 Mar 2021 01:11:04 -0700 (PDT) Received: from localhost ([112.79.247.28]) by smtp.gmail.com with ESMTPSA id f20sm13850191pfa.10.2021.03.28.01.11.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Mar 2021 01:11:03 -0700 (PDT) Date: Sun, 28 Mar 2021 13:41:00 +0530 From: Kumar Kartikeya Dwivedi To: Andrii Nakryiko Cc: bpf , Jesper Dangaard Brouer , Toke =?utf-8?Q?H=C3=B8iland-J=C3=B8rgensen?= , 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 , open list , Networking , "open list:KERNEL SELFTEST FRAMEWORK" Subject: Re: [PATCH bpf-next 3/5] libbpf: add low level TC-BPF API Message-ID: <20210328080648.oorx2no2j6zslejk@apollo> References: <20210325120020.236504-1-memxor@gmail.com> <20210325120020.236504-4-memxor@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Mar 28, 2021 at 10:12:40AM IST, Andrii Nakryiko wrote: > Is there some succinct but complete enough documentation/tutorial/etc > that I can reasonably read to understand kernel APIs provided by TC > (w.r.t. BPF, of course). I'm trying to wrap my head around this and > whether API makes sense or not. Please share links, if you have some. > Hi Andrii, Unfortunately for the kernel API part, I couldn't find any when I was working on this. So I had to read the iproute2 tc code (tc_filter.c, f_bpf.c, m_action.c, m_bpf.c) and the kernel side bits (cls_api.c, cls_bpf.c, act_api.c, act_bpf.c) to grok anything I didn't understand. There's also similar code in libnl (lib/route/{act,cls}.c). Other than that, these resources were useful (perhaps you already went through some/all of them): https://docs.cilium.io/en/latest/bpf/#tc-traffic-control https://qmonnet.github.io/whirl-offload/2020/04/11/tc-bpf-direct-action/ tc(8), and tc-bpf(8) man pages I hope this is helpful! -- Kartikeya