From patchwork Fri Nov 9 16:21:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stanislav Fomichev X-Patchwork-Id: 995645 Return-Path: X-Original-To: patchwork-incoming-netdev@ozlabs.org Delivered-To: patchwork-incoming-netdev@ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=vger.kernel.org (client-ip=209.132.180.67; helo=vger.kernel.org; envelope-from=netdev-owner@vger.kernel.org; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="Lc6IxC90"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 42s55F5KB1z9sC7 for ; Sat, 10 Nov 2018 03:21:53 +1100 (AEDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728473AbeKJCDG (ORCPT ); Fri, 9 Nov 2018 21:03:06 -0500 Received: from mail-pg1-f202.google.com ([209.85.215.202]:37016 "EHLO mail-pg1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727845AbeKJCDG (ORCPT ); Fri, 9 Nov 2018 21:03:06 -0500 Received: by mail-pg1-f202.google.com with SMTP id 18-v6so1485891pgn.4 for ; Fri, 09 Nov 2018 08:21:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=ec6dIVBQUm52wLCQCTaPztoe5eHzKxEgWjVxr3Ntayk=; b=Lc6IxC90KTtkEPDBILkKB3tL6+QMi1l+WdZzDAtaZdD3RSoQtVkv2y35pMhawO20G+ wGJYOH4dBVi/1uXwjR/R+upw48wBJAxJ0Hoei+pV5vwMC5fFqvCnQ0cvCj1MAujoEs7w p2j4i8fXKW2DVeMSIIjYxp2FRK7H9L+3ncCp246AJuHzHeTdnq9a4kGIsbECD3GzBk7n PmMgMyoWqn4sPq0SSHhBXSy+AUZAUiV7yzodzLuwYGYf3kWxlKhma0YReC5NNf31pQmG ZgctbopJVboiIkFrEZqY+JTJvVPA1j3cWDE499xSA87WlGjuqiBqcPdjhHHwGIvKO6uH Dfeg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=ec6dIVBQUm52wLCQCTaPztoe5eHzKxEgWjVxr3Ntayk=; b=BuzDEm9cnU1VmKmTcaXHI8KcPvf9ydLA4zELm8U4ChN1qH5pWW7iDL+aWYxFWN5OvU vbwV1ZcPEupK1Ov757WtjlmAzsUmG8nhNGvWrxMAjRkYtCD+pIQH/8ZTU7PVm879pKPx mrosgwGc4khbz+DQA0VpQKt5xuts6cZzfdeXlc9Ka1lVa27cmI4PqY4cLx1gOnfAul1f OBJLkytSEkg82FTAnLhLoEwwB9lXGnq+R6chZ7zIQlttdW/RxWKxsitRMkClcQ/j59Qq gb5a+ayPYd6DA3JHd75AJ76K0RqgU6SeSGN8iK27366dDpHvoIai1J+4VCP+CRP7m5L/ iCgA== X-Gm-Message-State: AGRZ1gLeq0sQ9OMx9ng3qtjSGkaPm/fWXdcuONCPEwfEGZpxb/M9Um0v rHWdaT4jF4kqcD4tmu4J43DMuJIMegwljAt8k27MIAYFhUJHm3vOvKKGpdCI9bWlvw3l/wtvBjC 9YjvHuO9Rapczm3xsg34VgXFEFOTUy6IgnqT3KTjOvPBA3tLo5ICUoA== X-Google-Smtp-Source: AJdET5eGeE6duu+4nuWBtRhhH9FPglznkl1w8Om/xvWHljZAWtHZQAow4hFCTvpiOAQ++RGI2CNvApg= X-Received: by 2002:a17:902:8695:: with SMTP id g21-v6mr121129plo.38.1541780510451; Fri, 09 Nov 2018 08:21:50 -0800 (PST) Date: Fri, 9 Nov 2018 08:21:39 -0800 Message-Id: <20181109162146.78019-1-sdf@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.1.930.g4563a0d9d0-goog Subject: [PATCH v5 bpf-next 0/7] bpftool: support loading flow dissector From: Stanislav Fomichev To: netdev@vger.kernel.org, linux-kselftest@vger.kernel.org, ast@kernel.org, daniel@iogearbox.net, shuah@kernel.org, jakub.kicinski@netronome.com, quentin.monnet@netronome.com Cc: guro@fb.com, jiong.wang@netronome.com, sdf@google.com, bhole_prashant_q7@lab.ntt.co.jp, john.fastabend@gmail.com, jbenc@redhat.com, treeze.taeung@gmail.com, yhs@fb.com, osk@fb.com, sandipan@linux.vnet.ibm.com Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org v5 changes: * FILE -> PATH for load/loadall (can be either file or directory now) * simpler implementation for __bpf_program__pin_name * removed p_err for REQ_ARGS checks * parse_atach_detach_args -> parse_attach_detach_args * for -> while in bpf_object__pin_{programs,maps} recovery v4 changes: * addressed another round of comments/style issues from Jakub Kicinski & Quentin Monnet (thanks!) * implemented bpf_object__pin_maps and bpf_object__pin_programs helpers and used them in bpf_program__pin * added new pin_name to bpf_program so bpf_program__pin works with sections that contain '/' * moved *loadall* command implementation into a separate patch * added patch that implements *pinmaps* to pin maps when doing load/loadall v3 changes: * (maybe) better cleanup for partial failure in bpf_object__pin * added special case in bpf_program__pin for programs with single instances v2 changes: * addressed comments/style issues from Jakub Kicinski & Quentin Monnet * removed logic that populates jump table * added cleanup for partial failure in bpf_object__pin This patch series adds support for loading and attaching flow dissector programs from the bpftool: * first patch fixes flow dissector section name in the selftests (so libbpf auto-detection works) * second patch adds proper cleanup to bpf_object__pin, parts of which are now being used to attach all flow dissector progs/maps * third patch adds special case in bpf_program__pin for programs with single instances (we don't create /0 pin anymore, just ) * forth patch adds pin_name to the bpf_program struct which is now used as a pin name in bpf_program__pin et al * fifth patch adds *loadall* command that pins all programs, not just the first one * sixth patch adds *pinmaps* argument to load/loadall to let users pin all maps of the obj file * seventh patch adds actual flow_dissector support to the bpftool and an example Stanislav Fomichev (7): selftests/bpf: rename flow dissector section to flow_dissector libbpf: cleanup after partial failure in bpf_object__pin libbpf: bpf_program__pin: add special case for instances.nr == 1 libbpf: add internal pin_name bpftool: add loadall command bpftool: add pinmaps argument to the load/loadall bpftool: support loading flow dissector .../bpftool/Documentation/bpftool-prog.rst | 42 +- tools/bpf/bpftool/bash-completion/bpftool | 21 +- tools/bpf/bpftool/common.c | 31 +- tools/bpf/bpftool/main.h | 1 + tools/bpf/bpftool/prog.c | 183 ++++++--- tools/lib/bpf/libbpf.c | 359 ++++++++++++++++-- tools/lib/bpf/libbpf.h | 18 + tools/testing/selftests/bpf/bpf_flow.c | 2 +- .../selftests/bpf/test_flow_dissector.sh | 2 +- 9 files changed, 537 insertions(+), 122 deletions(-) Acked-by: Quentin Monnet