Skip to content
  1. Mar 30, 2021
    • Andre Guedes's avatar
      igc: Add support for XDP_TX action · 73f1071c
      Andre Guedes authored
      
      
      Add support for XDP_TX action which enables XDP programs to transmit
      back receiving frames.
      
      I225 controller has only 4 Tx hardware queues. Since XDP programs may
      not even issue an XDP_TX action, this patch doesn't reserve dedicated
      queues just for XDP like other Intel drivers do. Instead, the queues
      are shared between the network stack and XDP. The netdev queue lock is
      used to ensure mutual exclusion.
      
      Since frames can now be transmitted via XDP_TX, the igc_tx_buffer
      structure is modified so we are able to save a reference to the xdp
      frame for later clean up once the packet is transmitted. The tx_buffer
      is mapped to either a skb or a xdpf so we use a union to save the skb
      or xdpf pointer and have a bit in tx_flags to indicate which field to
      use.
      
      This patch has been tested with the sample app "xdp2" located in
      samples/bpf/ dir.
      
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Signed-off-by: default avatarVedang Patel <vedang.patel@intel.com>
      Signed-off-by: default avatarJithu Joseph <jithu.joseph@intel.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      73f1071c
    • Andre Guedes's avatar
      igc: Add initial XDP support · 26575105
      Andre Guedes authored
      Add the initial XDP support to the igc driver. For now, only XDP_PASS,
      XDP_DROP, XDP_ABORTED actions are supported. Upcoming patches will add
      support for the remaining XDP actions.
      
      XDP configuration helpers are defined in a new file, igc_xdp.c. These
      helpers are utilized in igc_main.c to implement the ndo_bpf callback.
      XDP-related code that belongs to the driver's hot path is landed in
      igc_main.c.
      
      By default, the driver uses Rx buffers with 2 KB size. When XDP is
      enabled, it uses larger buffers so we have enough space to accommodate
      the headroom and tailroom required by XDP infrastructure. Also, the
      driver doesn't support XDP functionality with frames that span over
      multiple buffers so jumbo frames are not allowed for now.
      
      The approach implemented follows the approach implemented in other Intel
      drivers as much as possible for the sake of consistency across the
      drivers.
      
      Quick comment regarding igc_build_skb(): this patch doesn't touch it
      because the function is never called. It seems its support is
      incomplete/in progress. The function was added by commit 0507ef8a
      
      
      ("igc: Add transmit and receive fastpath and interrupt handlers") but
      ring_uses_build_skb() always return False since the IGC_RING_FLAG_RX_
      BUILD_SKB_ENABLED isn't set anywhere in the driver code.
      
      This patch has been tested with the sample app "xdp1" located in
      samples/bpf/ dir.
      
      Signed-off-by: default avatarAndre Guedes <andre.guedes@intel.com>
      Signed-off-by: default avatarVedang Patel <vedang.patel@intel.com>
      Signed-off-by: default avatarJithu Joseph <jithu.joseph@intel.com>
      Reviewed-by: default avatarMaciej Fijalkowski <maciej.fijalkowski@intel.com>
      Tested-by: default avatarDvora Fuxbrumer <dvorax.fuxbrumer@linux.intel.com>
      Signed-off-by: default avatarTony Nguyen <anthony.l.nguyen@intel.com>
      26575105
  2. Mar 29, 2021