1. 22 Sep, 2016 37 commits
  2. 21 Sep, 2016 3 commits
    • David S. Miller's avatar
      Merge branch 'bpf-hw-offload' · c3d9b9f3
      David S. Miller authored
      Jakub Kicinski says:
      
      ====================
      BPF hardware offload (cls_bpf for now)
      
      Rebased and improved.
      
      v7:
       - fix patch 4.
      v6 (patch 8 only):
       - explicitly check for registers >= MAX_BPF_REG;
       - fix leaky error path.
      v5:
       - fix names of guard defines in bpf_verfier.h.
      v4:
       - rename parser -> analyzer;
       - reorganize the analyzer patches a bit;
       - use bitfield.h directly.
      
      --- merge blurb:
      In the last year a lot of progress have been made on offloading
      simpler TC classifiers.  There is also growing interest in using
      BPF for generic high-speed packet processing in the kernel.
      It seems beneficial to tie those two trends together and think
      about hardware offloads of BPF programs.  This patch set presents
      such offload to Netronome smart NICs.  cls_bpf is extended with
      hardware offload capabilities and NFP driver gets a JIT translator
      which in presence of capable firmware can be used to offload
      the BPF program onto the card.
      
      BPF JIT implementation is not 100% complete (e.g. missing instructions)
      but it is functional.  Encouragingly it should be possible to
      offload most (if not all) advanced BPF features onto the NIC -
      including packet modification, maps, tunnel encap/decap etc.
      
      Example of basic tests I used:
        __section_cls_entry
        int cls_entry(struct __sk_buff *skb)
        {
      	if (load_byte(skb, 0) != 0x0)
      		return 0;
      
      	if (load_byte(skb, 4) != 0x1)
      		return 0;
      
      	skb->mark = 0xcafe;
      
      	if (load_byte(skb, 50) != 0xff)
      		return 0;
      
      	return ~0U;
        }
      
      Above code can be compiled with Clang and loaded like this:
      
      	ethtool -K p1p1 hw-tc-offload on
      	tc qdisc add dev p1p1 ingress
      	tc filter add dev p1p1 parent ffff:  bpf obj prog.o action drop
      
      This set implements the basic transparent offload, the skip_{sw,hw}
      flags and reporting statistics for cls_bpf.
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c3d9b9f3
    • Jakub Kicinski's avatar
      nfp: bpf: add offload of TC direct action mode · e3b8baf0
      Jakub Kicinski authored
      Add offload of TC in direct action mode.  We just need
      to provide appropriate checks in the verifier and
      a new outro block to translate the exit codes to what
      data path expects
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      e3b8baf0
    • Jakub Kicinski's avatar
      nfp: bpf: add support for legacy redirect action · 2d18421d
      Jakub Kicinski authored
      Data path has redirect support so expressing redirect
      to the port frame came from is a trivial matter of
      setting the right result code.
      Signed-off-by: default avatarJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2d18421d