From patchwork Sat Apr 20 19:06:18 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lucas Siba X-Patchwork-Id: 1088424 X-Patchwork-Delegate: dsahern@gmail.com 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=none dis=none) header.from=gmail.com Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="YbYaqSER"; dkim-atps=neutral Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id 44mj4Z4cmCz9s71 for ; Sun, 21 Apr 2019 05:06:38 +1000 (AEST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726537AbfDTTGc (ORCPT ); Sat, 20 Apr 2019 15:06:32 -0400 Received: from mail-qk1-f195.google.com ([209.85.222.195]:41902 "EHLO mail-qk1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726075AbfDTTGc (ORCPT ); Sat, 20 Apr 2019 15:06:32 -0400 Received: by mail-qk1-f195.google.com with SMTP id p185so4397314qkb.8 for ; Sat, 20 Apr 2019 12:06:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=ambqSv2FN028C+OuSw0YxEm8SzFbD+oiPRTYB0zEmp8=; b=YbYaqSER2nSxUa1V48GzMIi05o6HlILAQsHfeGHUjJklXZYJAC8zM1Q4yNMo9cgPCg yOJJapsR/F85ZCfQF461MS1DDllGt+buwfmdkfbKKZ8yUlQAgLK+mDB3Td9etAn/1S9l II8j1n3lZ28uhBzVBvDNry+D9QKxePCq/ZXl6NB68nNUtF0Pv0wdXVop2NlveQeMLg8S b0pKkhgkLRsDlH92B3warTXzQqAS8yd/7BzCeaBhRhosfSKzmSdgpqPX9vxydaElHnuY WAK5EFxMbIcJwX109Ns8teTcVpgNZDqbeu/Pt3vleoie+cp9exgPoMlAorWklotR/JCt xvJw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=ambqSv2FN028C+OuSw0YxEm8SzFbD+oiPRTYB0zEmp8=; b=eXT2Wgf45a41YyL/ZsJtPfA/m3USNvP1ysg0aZLsGKRR2rH6ACoJFFb4zpwQd6GelU 1BqQZxtgjKXx7OBrmu4uQtZ21N2WyEg15vAMHoffJ/8GlbhN5yhvTzrQoVewkrqXmFc4 3koczZ2INJZGmurRzyNgvt83RML9cOSbR2n6nb3qrTn8blUy1yTDXKyXJ2IpHlVLj4EO TI7hDxk+5FdzUAuWEkjnl2dKFR+9iQXjV86yQm+R1cWhmXLXvGw5Mhpbb/719FcZozd2 NubBdA9ycnE2HNnsdrcFPHUNGNUuGZhSPtOkCTnIbY506t4H6f8ko/uN1xCvWqtD3MCm +NSQ== X-Gm-Message-State: APjAAAVEaOcJRI/YcY8s03/SB11wScVWpW+TfwhvSu1Bwnge0pz/sl0u uDvOKQ6z/x+upZ2PDKPx5gTLYh65GIzY601/kSpU4FpsI9w= X-Google-Smtp-Source: APXvYqx5Eo/Skpef7iwdXFU96GEDg5M7AHNueorjTWwcgZt3eedOjYVULMUUVlU7TAqcLGDS5x6sCjJuxVgY7s7X0XY= X-Received: by 2002:a05:620a:13a2:: with SMTP id m2mr7961601qki.239.1555787191072; Sat, 20 Apr 2019 12:06:31 -0700 (PDT) MIME-Version: 1.0 From: Lucas Siba Date: Sat, 20 Apr 2019 12:06:18 -0700 Message-ID: Subject: [PATCH iproute2-next] Update tc-bpf.8 man page examples To: netdev@vger.kernel.org Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: Lucas Siba @ 2019-04-20 11:40 UTC To: netdev This patch updates the tc-bpf.8 example application for changes to the struct bpf_elf_map definition. In it's current form, things compile, but the resulting object file is rejected by the verifier when attempting to load it through tc. Signed-off-by: Lucas Siba --- man/man8/tc-bpf.8 | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) -- In a future patch, it might be worth changing the man page to refer to "bpf_elf.h" and "uapi/linux/bpf.h" for the definition of structures and constants, as they may be changed again without the man page being updated. diff --git a/man/man8/tc-bpf.8 b/man/man8/tc-bpf.8 index b2f9344f..b6cfeab9 100644 --- a/man/man8/tc-bpf.8 +++ b/man/man8/tc-bpf.8 @@ -597,6 +597,8 @@ struct bpf_elf_map __section("maps") map_stats = { .size_key = sizeof(uint32_t), .size_value = sizeof(struct tuple), .max_elem = BPF_MAX_MARK, + .pinning = PIN_GLOBAL_NS, + .flags = 0, }; static inline void cls_update_stats(const struct __sk_buff *skb, @@ -709,13 +711,22 @@ in both examples was: #define likely(x) __builtin_expect(!!(x), 1) #define unlikely(x) __builtin_expect(!!(x), 0) -/* Used map structure */ +/* Object pinning settings */ +#define PIN_NONE 0 +#define PIN_OBJECT_NS 1 +#define PIN_GLOBAL_NS 2 + +/* ELF map definition */ struct bpf_elf_map { __u32 type; __u32 size_key; __u32 size_value; __u32 max_elem; + __u32 flags; __u32 id; + __u32 pinning; + __u32 inner_id; + __u32 inner_idx; }; /* Some used BPF function calls. */