1. 11 11月, 2018 1 次提交
    • Q
      bpf: pass a struct with offload callbacks to bpf_offload_dev_create() · 1385d755
      Quentin Monnet 提交于
      For passing device functions for offloaded eBPF programs, there used to
      be no place where to store the pointer without making the non-offloaded
      programs pay a memory price.
      
      As a consequence, three functions were called with ndo_bpf() through
      specific commands. Now that we have struct bpf_offload_dev, and since
      none of those operations rely on RTNL, we can turn these three commands
      into hooks inside the struct bpf_prog_offload_ops, and pass them as part
      of bpf_offload_dev_create().
      
      This commit effectively passes a pointer to the struct to
      bpf_offload_dev_create(). We temporarily have two struct
      bpf_prog_offload_ops instances, one under offdev->ops and one under
      offload->dev_ops. The next patches will make the transition towards the
      former, so that offload->dev_ops can be removed, and callbacks relying
      on ndo_bpf() added to offdev->ops as well.
      
      While at it, rename "nfp_bpf_analyzer_ops" as "nfp_bpf_dev_ops" (and
      similarly for netdevsim).
      Suggested-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Reviewed-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Signed-off-by: NAlexei Starovoitov <ast@kernel.org>
      1385d755
  2. 12 10月, 2018 1 次提交
  3. 11 10月, 2018 1 次提交
  4. 02 10月, 2018 2 次提交
  5. 05 8月, 2018 1 次提交
    • J
      nfp: bpf: xdp_adjust_tail support · 0c261593
      Jakub Kicinski 提交于
      Add support for adjust_tail.  There are no FW changes needed but add
      a FW capability just in case there would be any issue with previously
      released FW, or we will have to change the ABI in the future.
      
      The helper is trivial and shouldn't be used too often so just inline
      the body of the function.  We add the delta to locally maintained
      packet length register and check for overflow, since add of negative
      value must overflow if result is positive.  Note that if delta of 0
      would be allowed in the kernel this trick stops working and we need
      one more instruction to compare lengths before and after the change.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      0c261593
  6. 27 7月, 2018 2 次提交
  7. 23 7月, 2018 1 次提交
  8. 18 7月, 2018 2 次提交
  9. 14 7月, 2018 1 次提交
  10. 27 6月, 2018 1 次提交
    • J
      nfp: reject binding to shared blocks · 951a8ee6
      John Hurley 提交于
      TC shared blocks allow multiple qdiscs to be grouped together and filters
      shared between them. Currently the chains of filters attached to a block
      are only flushed when the block is removed. If a qdisc is removed from a
      block but the block still exists, flow del messages are not passed to the
      callback registered for that qdisc. For the NFP, this presents the
      possibility of rules still existing in hw when they should be removed.
      
      Prevent binding to shared blocks until the kernel can send per qdisc del
      messages when block unbinds occur.
      
      tcf_block_shared() was not used outside of the core until now, so also
      add an empty implementation for builds with CONFIG_NET_CLS=n.
      
      Fixes: 48617387 ("net: sched: introduce shared filter blocks infrastructure")
      Signed-off-by: NJohn Hurley <john.hurley@netronome.com>
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NSimon Horman <simon.horman@netronome.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      951a8ee6
  11. 26 6月, 2018 1 次提交
  12. 25 6月, 2018 1 次提交
    • J
      nfp: bpf: don't stop offload if replace failed · 68d676a0
      Jakub Kicinski 提交于
      Stopping offload completely if replace of program failed dates
      back to days of transparent offload.  Back then we wanted to
      silently fall back to the in-driver processing.  Today we mark
      programs for offload when they are loaded into the kernel, so
      the transparent offload is no longer a reality.
      
      Flags check in the driver will only allow replace of a driver
      program with another driver program or an offload program with
      another offload program.
      
      When driver program is replaced stopping offload is a no-op,
      because driver program isn't offloaded.  When replacing
      offloaded program if the offload fails the entire operation
      will fail all the way back to user space and we should continue
      using the old program.  IOW when replacing a driver program
      stopping offload is unnecessary and when replacing offloaded
      program - it's a bug, old program should continue to run.
      
      In practice this bug would mean that if offload operation was to
      fail (either due to FW communication error, kernel OOM or new
      program being offloaded but for a different netdev) driver
      would continue reporting that previous XDP program is offloaded
      but in fact no program will be loaded in hardware.  The failure
      is fairly unlikely (found by inspection, when working on the code)
      but it's unpleasant.
      
      Backport note: even though the bug was introduced in commit
      cafa92ac ("nfp: bpf: add support for XDP_FLAGS_HW_MODE"),
      this fix depends on commit 441a3303 ("net: xdp: don't allow
      device-bound programs in driver mode"), so this fix is sufficient
      only in v4.15 or newer.  Kernels v4.13.x and v4.14.x do need to
      stop offload if it was transparent/opportunistic, i.e. if
      XDP_FLAGS_HW_MODE was not set on running program.
      
      Fixes: cafa92ac ("nfp: bpf: add support for XDP_FLAGS_HW_MODE")
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Acked-by: NSong Liu <songliubraving@fb.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      68d676a0
  13. 10 5月, 2018 2 次提交
    • J
      nfp: bpf: allow zero-length capabilities · 26aeb9da
      Jakub Kicinski 提交于
      Some BPF capabilities carry no value, they simply indicate feature
      is present.  Our capability parsing loop will exit early if last
      capability is zero-length because it's looking for more than 8 bytes
      of data (8B is our TLV header length).  Allow the last capability to
      be zero-length.
      
      This bug would lead to driver failing to probe with the following error
      if the last capability FW advertises is zero-length:
      
          nfp: BPF capabilities left after parsing, parsed:92 total length:100
          nfp: invalid BPF capabilities at offset:92
      
      Note the "parsed" and "length" values are 8 apart.
      
      No shipping FW runs into this issue, but we can't guarantee that will
      remain the case.
      
      Fixes: 77a844ee ("nfp: bpf: prepare for parsing BPF FW capabilities")
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      26aeb9da
    • J
      nfp: bpf: support setting the RX queue index · d985888f
      Jakub Kicinski 提交于
      BPF has access to all internal FW datapath structures.  Including
      the structure containing RX queue selection.  With little coordination
      with the datapath we can let the offloaded BPF select the RX queue.
      We just need a way to tell the datapath that queue selection has already
      been done and it shouldn't overwrite it.  Define a bit to tell datapath
      BPF already selected a queue (QSEL_SET), if the selected queue is not
      enabled (>= number of enabled queues) datapath will perform normal RSS.
      
      BPF queue selection on the NIC can be used to replace standard
      datapath RSS with fully programmable BPF/XDP RSS.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      d985888f
  14. 05 5月, 2018 2 次提交
    • J
      nfp: bpf: perf event output helpers support · 9816dd35
      Jakub Kicinski 提交于
      Add support for the perf_event_output family of helpers.
      
      The implementation on the NFP will not match the host code exactly.
      The state of the host map and rings is unknown to the device, hence
      device can't return errors when rings are not installed.  The device
      simply packs the data into a firmware notification message and sends
      it over to the host, returning success to the program.
      
      There is no notion of a host CPU on the device when packets are being
      processed.  Device will only offload programs which set BPF_F_CURRENT_CPU.
      Still, if map index doesn't match CPU no error will be returned (see
      above).
      
      Dropped/lost firmware notification messages will not cause "lost
      events" event on the perf ring, they are only visible via device
      error counters.
      
      Firmware notification messages may also get reordered in respect
      to the packets which caused their generation.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      9816dd35
    • J
      nfp: bpf: record offload neutral maps in the driver · 630a4d38
      Jakub Kicinski 提交于
      For asynchronous events originating from the device, like perf event
      output, we need to be able to make sure that objects being referred
      to by the FW message are valid on the host.  FW events can get queued
      and reordered.  Even if we had a FW message "barrier" we should still
      protect ourselves from bogus FW output.
      
      Add a reverse-mapping hash table and record in it all raw map pointers
      FW may refer to.  Only record neutral maps, i.e. perf event arrays.
      These are currently the only objects FW can refer to.  Use RCU protection
      on the read side, update side is under RTNL.
      
      Since program vs map destruction order is slightly painful for offload
      simply take an extra reference on all the recorded maps to make sure
      they don't disappear.
      Signed-off-by: NJakub Kicinski <jakub.kicinski@netronome.com>
      Reviewed-by: NQuentin Monnet <quentin.monnet@netronome.com>
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      630a4d38
  15. 30 3月, 2018 1 次提交
  16. 29 3月, 2018 3 次提交
  17. 08 2月, 2018 2 次提交
  18. 26 1月, 2018 1 次提交
  19. 23 1月, 2018 2 次提交
  20. 20 1月, 2018 2 次提交
  21. 15 1月, 2018 4 次提交
  22. 10 1月, 2018 4 次提交
  23. 28 12月, 2017 1 次提交
  24. 21 12月, 2017 1 次提交