1. 18 Jan, 2018 4 commits
    • Daniel Borkmann's avatar
      Merge branch 'bpf-dump-and-disasm-nfp-jit' · cda18e97
      Daniel Borkmann authored
      Jakub Kicinski says:
      
      ====================
      Jiong says:
      
      Currently bpftool could disassemble host jited image, for example x86_64,
      using libbfd. However it couldn't disassemble offload jited image.
      
      There are two reasons:
      
        1. bpf_obj_get_info_by_fd/struct bpf_prog_info couldn't get the address
           of jited image and image's length.
      
        2. Even after issue 1 resolved, bpftool couldn't figure out what is the
           offload arch from bpf_prog_info, therefore can't drive libbfd
           disassembler correctly.
      
        This patch set resolve issue 1 by introducing two new fields "jited_len"
      and "jited_image" in bpf_dev_offload. These two fields serve as the generic
      interface to communicate the jited image address and length for all offload
      targets to higher level caller. For example, bpf_obj_get_info_by_fd could
      use them to fill the userspace visible fields jited_prog_len and
      jited_prog_insns.
      
        This patch set resolve issue 2 by getting bfd backend name through
      "ifindex", i.e network interface index.
      
      v1:
       - Deduct bfd arch name through ifindex, i.e network interface index.
         First, map ifindex to devname through ifindex_to_name_ns, then get
         pci id through /sys/class/dev/DEVNAME/device/vendor. (Daniel, Alexei)
      ====================
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      cda18e97
    • Jiong Wang's avatar
      tools: bpftool: improve architecture detection by using ifindex · e6593596
      Jiong Wang authored
      The current architecture detection method in bpftool is designed for host
      case.
      
      For offload case, we can't use the architecture of "bpftool" itself.
      Instead, we could call the existing "ifindex_to_name_ns" to get DEVNAME,
      then read pci id from /sys/class/dev/DEVNAME/device/vendor, finally we map
      vendor id to bfd arch name which will finally be used to select bfd backend
      for the disassembler.
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      e6593596
    • Jiong Wang's avatar
      nfp: bpf: set new jit info fields · eb1d7db9
      Jiong Wang authored
      This patch set those new jit info fields introduced in this patch set.
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      eb1d7db9
    • Jiong Wang's avatar
      bpf: add new jited info fields in bpf_dev_offload and bpf_prog_info · fcfb126d
      Jiong Wang authored
      For host JIT, there are "jited_len"/"bpf_func" fields in struct bpf_prog
      used by all host JIT targets to get jited image and it's length. While for
      offload, targets are likely to have different offload mechanisms that these
      info are kept in device private data fields.
      
      Therefore, BPF_OBJ_GET_INFO_BY_FD syscall needs an unified way to get JIT
      length and contents info for offload targets.
      
      One way is to introduce new callback to parse device private data then fill
      those fields in bpf_prog_info. This might be a little heavy, the other way
      is to add generic fields which will be initialized by all offload targets.
      
      This patch follow the second approach to introduce two new fields in
      struct bpf_dev_offload and teach bpf_prog_get_info_by_fd about them to fill
      correct jited_prog_len and jited_prog_insns in bpf_prog_info.
      Reviewed-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarJiong Wang <jiong.wang@netronome.com>
      Acked-by: default avatarAlexei Starovoitov <ast@kernel.org>
      Signed-off-by: default avatarDaniel Borkmann <daniel@iogearbox.net>
      fcfb126d
  2. 17 Jan, 2018 36 commits