1. 30 9月, 2017 6 次提交
  2. 27 9月, 2017 1 次提交
    • D
      bpf: add meta pointer for direct access · de8f3a83
      Daniel Borkmann 提交于
      This work enables generic transfer of metadata from XDP into skb. The
      basic idea is that we can make use of the fact that the resulting skb
      must be linear and already comes with a larger headroom for supporting
      bpf_xdp_adjust_head(), which mangles xdp->data. Here, we base our work
      on a similar principle and introduce a small helper bpf_xdp_adjust_meta()
      for adjusting a new pointer called xdp->data_meta. Thus, the packet has
      a flexible and programmable room for meta data, followed by the actual
      packet data. struct xdp_buff is therefore laid out that we first point
      to data_hard_start, then data_meta directly prepended to data followed
      by data_end marking the end of packet. bpf_xdp_adjust_head() takes into
      account whether we have meta data already prepended and if so, memmove()s
      this along with the given offset provided there's enough room.
      
      xdp->data_meta is optional and programs are not required to use it. The
      rationale is that when we process the packet in XDP (e.g. as DoS filter),
      we can push further meta data along with it for the XDP_PASS case, and
      give the guarantee that a clsact ingress BPF program on the same device
      can pick this up for further post-processing. Since we work with skb
      there, we can also set skb->mark, skb->priority or other skb meta data
      out of BPF, thus having this scratch space generic and programmable
      allows for more flexibility than defining a direct 1:1 transfer of
      potentially new XDP members into skb (it's also more efficient as we
      don't need to initialize/handle each of such new members). The facility
      also works together with GRO aggregation. The scratch space at the head
      of the packet can be multiple of 4 byte up to 32 byte large. Drivers not
      yet supporting xdp->data_meta can simply be set up with xdp->data_meta
      as xdp->data + 1 as bpf_xdp_adjust_meta() will detect this and bail out,
      such that the subsequent match against xdp->data for later access is
      guaranteed to fail.
      
      The verifier treats xdp->data_meta/xdp->data the same way as we treat
      xdp->data/xdp->data_end pointer comparisons. The requirement for doing
      the compare against xdp->data is that it hasn't been modified from it's
      original address we got from ctx access. It may have a range marking
      already from prior successful xdp->data/xdp->data_end pointer comparisons
      though.
      Signed-off-by: NDaniel Borkmann <daniel@iogearbox.net>
      Acked-by: NAlexei Starovoitov <ast@kernel.org>
      Acked-by: NJohn Fastabend <john.fastabend@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      de8f3a83
  3. 06 9月, 2017 2 次提交
    • J
      i40e: point wb_desc at the nvm_wb_desc during i40e_read_nvm_aq · 3c8f3e96
      Jacob Keller 提交于
      When introducing the functions to read the NVM through the AdminQ, we
      did not correctly mark the wb_desc.
      
      Fixes: 7073f46e ("i40e: Add AQ commands for NVM Update for X722", 2015-06-05)
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3c8f3e96
    • A
      i40e: avoid NVM acquire deadlock during NVM update · 09f79fd4
      Anjali Singhai Jain 提交于
      X722 devices use the AdminQ to access the NVM, and this requires taking
      the AdminQ lock. Because of this, we lock the AdminQ during
      i40e_read_nvm(), which is also called in places where the lock is
      already held, such as the firmware update path which wants to lock once
      and then unlock when finished after performing several tasks.
      
      Although this should have only affected X722 devices, commit
      96a39aed ("i40e: Acquire NVM lock before reads on all devices",
      2016-12-02) added locking for all NVM reads, regardless of device
      family.
      
      This resulted in us accidentally causing NVM acquire timeouts on all
      devices, causing failed firmware updates which left the eeprom in
      a corrupt state.
      
      Create unsafe non-locked variants of i40e_read_nvm_word and
      i40e_read_nvm_buffer, __i40e_read_nvm_word and __i40e_read_nvm_buffer
      respectively. These variants will not take the NVM lock and are expected
      to only be called in places where the NVM lock is already held if
      needed.
      
      Since the only caller of i40e_read_nvm_buffer() was in such a path,
      remove it entirely in favor of the unsafe version. If necessary we can
      always add it back in the future.
      
      Additionally, we now need to hold the NVM lock in i40e_validate_checksum
      because the call to i40e_calc_nvm_checksum now assumes that the NVM lock
      is held. We can further move the call to read I40E_SR_SW_CHECKSUM_WORD
      up a bit so that we do not need to acquire the NVM lock twice.
      
      This should resolve firmware updates and also fix potential raise that
      could have caused the driver to report an invalid NVM checksum upon
      driver load.
      Reported-by: NStefan Assmann <sassmann@kpanic.de>
      Fixes: 96a39aed ("i40e: Acquire NVM lock before reads on all devices", 2016-12-02)
      Signed-off-by: NAnjali Singhai Jain <anjali.singhai@intel.com>
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      09f79fd4
  4. 28 8月, 2017 14 次提交
  5. 26 8月, 2017 11 次提交
  6. 08 8月, 2017 4 次提交
  7. 02 8月, 2017 1 次提交
  8. 26 7月, 2017 1 次提交