Skip to content
  1. Mar 27, 2018
    • Anirudh Venkataramanan's avatar
      ice: Implement filter sync, NDO operations and bump version · e94d4478
      Anirudh Venkataramanan authored
      
      
      This patch implements multiple pieces of functionality:
      
      1. Added ice_vsi_sync_filters, which is called through the service task
         to push filter updates to the hardware.
      
      2. Add support to enable/disable promiscuous mode on an interface.
         Enabling/disabling promiscuous mode on an interface results in
         addition/removal of a promisc filter rule through ice_vsi_sync_filters.
      
      3. Implement handlers for ndo_set_mac_address, ndo_change_mtu,
         ndo_poll_controller and ndo_set_rx_mode.
      
      This patch also marks the end of the driver addition by bumping up the
      driver version.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e94d4478
    • Anirudh Venkataramanan's avatar
      ice: Support link events, reset and rebuild · 0b28b702
      Anirudh Venkataramanan authored
      
      
      Link events are posted to a PF's admin receive queue (ARQ). This patch
      adds the ability to detect and process link events.
      
      This patch also adds the ability to process resets.
      
      The driver can process the following resets:
          1) EMP Reset (EMPR)
          2) Global Reset (GLOBR)
          3) Core Reset (CORER)
          4) Physical Function Reset (PFR)
      
      EMPR is the largest level of reset that the driver can handle. An EMPR
      resets the manageability block and also the data path, including PHY and
      link for all the PFs. The affected PFs are notified of this event through
      a miscellaneous interrupt.
      
      GLOBR is a subset of EMPR. It does everything EMPR does except that it
      doesn't reset the manageability block.
      
      CORER is a subset of GLOBR. It does everything GLOBR does but doesn't
      reset PHY and link.
      
      PFR is a subset of CORER and affects only the given physical function.
      In other words, PFR can be thought of as a CORER for a single PF. Since
      only the issuing PF is affected, a PFR doesn't result in the miscellaneous
      interrupt being triggered.
      
      All the resets have the following in common:
      1) Tx/Rx is halted and all queues are stopped.
      2) All the VSIs and filters programmed for the PF are lost and have to be
         reprogrammed.
      3) Control queue interfaces are reset and have to be reprogrammed.
      
      In the rebuild flow, control queues are reinitialized, VSIs are reallocated
      and filters are restored.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0b28b702
    • Anirudh Venkataramanan's avatar
      ice: Update Tx scheduler tree for VSI multi-Tx queue support · 5513b920
      Anirudh Venkataramanan authored
      
      
      This patch adds the ability for a VSI to use multiple Tx queues. More
      specifically, the patch
          1) Provides the ability to update the Tx scheduler tree in the
             firmware. The driver can configure the Tx scheduler tree by
             adding/removing multiple Tx queues per TC per VSI.
      
          2) Allows a VSI to reconfigure its Tx queues during runtime.
      
          3) Synchronizes the Tx scheduler update operations using locks.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      5513b920
    • Anirudh Venkataramanan's avatar
      ice: Add stats and ethtool support · fcea6f3d
      Anirudh Venkataramanan authored
      
      
      This patch implements a watchdog task to get packet statistics from
      the device.
      
      This patch also adds support for the following ethtool operations:
      
      ethtool devname
      ethtool -s devname [msglvl N] [msglevel type on|off]
      ethtool -g|--show-ring devname
      ethtool -G|--set-ring devname [rx N] [tx N]
      ethtool -i|--driver devname
      ethtool -d|--register-dump devname [raw on|off] [hex on|off] [file name]
      ethtool -k|--show-features|--show-offload devname
      ethtool -K|--features|--offload devname feature on|off
      ethtool -P|--show-permaddr devname
      ethtool -S|--statistics devname
      ethtool -a|--show-pause devname
      ethtool -A|--pause devname [autoneg on|off] [rx on|off] [tx on|off]
      ethtool -r|--negotiate devname
      
      CC: Andrew Lunn <andrew@lunn.ch>
      CC: Jakub Kicinski <kubakici@wp.pl>
      CC: Stephen Hemminger <stephen@networkplumber.org>
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Acked-by: default avatarStephen Hemminger <stephen@networkplumber.org>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      fcea6f3d
    • Anirudh Venkataramanan's avatar
      ice: Add support for VLANs and offloads · d76a60ba
      Anirudh Venkataramanan authored
      
      
      This patch adds support for VLANs. When a VLAN is created a switch filter
      is added to direct the VLAN traffic to the corresponding VSI. When a VLAN
      is deleted, the filter is deleted as well.
      
      This patch also adds support for the following hardware offloads.
          1) VLAN tag insertion/stripping
          2) Receive Side Scaling (RSS)
          3) Tx checksum and TCP segmentation
          4) Rx checksum
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      d76a60ba
    • Anirudh Venkataramanan's avatar
      ice: Implement transmit and NAPI support · 2b245cb2
      Anirudh Venkataramanan authored
      
      
      This patch implements ice_start_xmit (the handler for ndo_start_xmit) and
      related functions. ice_start_xmit ultimately calls ice_tx_map, where the
      Tx descriptor is built and posted to the hardware by bumping the ring tail.
      
      This patch also implements ice_napi_poll, which is invoked when there's an
      interrupt on the VSI's queues. The interrupt can be due to either a
      completed Tx or an Rx event. In case of a completed Tx/Rx event, resources
      are reclaimed. Additionally, in case of an Rx event, the skb is fetched
      and passed up to the network stack.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      2b245cb2
    • Anirudh Venkataramanan's avatar
      ice: Configure VSIs for Tx/Rx · cdedef59
      Anirudh Venkataramanan authored
      
      
      This patch configures the VSIs to be able to send and receive
      packets by doing the following:
      
      1) Initialize flexible parser to extract and include certain
         fields in the Rx descriptor.
      
      2) Add Tx queues by programming the Tx queue context (implemented in
         ice_vsi_cfg_txqs). Note that adding the queues also enables (starts)
         the queues.
      
      3) Add Rx queues by programming Rx queue context (implemented in
         ice_vsi_cfg_rxqs). Note that this only adds queues but doesn't start
         them. The rings will be started by calling ice_vsi_start_rx_rings on
         interface up.
      
      4) Configure interrupts for VSI queues.
      
      5) Implement ice_open and ice_stop.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      cdedef59
    • Anirudh Venkataramanan's avatar
      ice: Add support for switch filter programming · 9daf8208
      Anirudh Venkataramanan authored
      
      
      A VSI needs traffic directed towards it. This is done by programming
      filter rules on the switch (embedded vSwitch) element in the hardware,
      which connects the VSI to the ingress/egress port.
      
      This patch introduces data structures and functions necessary to add
      remove or update switch rules on the switch element. This is a pretty low
      level function that is generic enough to add a whole range of filters.
      
      This patch also introduces two top level functions ice_add_mac and
      ice_remove mac which through a series of intermediate helper functions
      eventually call ice_aq_sw_rules to add/delete simple MAC based filters.
      It's worth noting that one invocation of ice_add_mac/ice_remove_mac
      is capable of adding/deleting multiple MAC filters.
      
      Also worth noting is the fact that the driver maintains a list of currently
      active filters, so every filter addition/removal causes an update to this
      list. This is done for a couple of reasons:
      
      1) If two VSIs try to add the same filters, we need to detect it and do
         things a little differently (i.e. use VSI lists, described below) as
         the same filter can't be added more than once.
      
      2) In the event of a hardware reset we can simply walk through this list
         and restore the filters.
      
      VSI Lists:
      In a multi-VSI situation, it's possible that multiple VSIs want to add the
      same filter rule. For example, two VSIs that want to receive broadcast
      traffic would both add a filter for destination MAC ff:ff:ff:ff:ff:ff.
      This can become cumbersome to maintain and so this is handled using a
      VSI list.
      
      A VSI list is resource that can be allocated in the hardware using the
      ice_aq_alloc_free_res admin queue command. Simply put, a VSI list can
      be thought of as a subscription list containing a set of VSIs to which
      the packet should be forwarded, should the filter match.
      
      For example, if VSI-0 has already added a broadcast filter, and VSI-1
      wants to do the same thing, the filter creation flow will detect this,
      allocate a VSI list and update the switch rule so that broadcast traffic
      will now be forwarded to the VSI list which contains VSI-0 and VSI-1.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9daf8208
    • Anirudh Venkataramanan's avatar
      ice: Add support for VSI allocation and deallocation · 3a858ba3
      Anirudh Venkataramanan authored
      
      
      This patch introduces data structures and functions to alloc/free
      VSIs. The driver represents a VSI using the ice_vsi structure.
      
      Some noteworthy points about VSI allocation:
      
      1) A VSI is allocated in the firmware using the "add VSI" admin queue
         command (implemented as ice_aq_add_vsi). The firmware returns an
         identifier for the allocated VSI. The VSI context is used to program
         certain aspects (loopback, queue map, etc.) of the VSI's configuration.
      
      2) A VSI is deleted using the "free VSI" admin queue command (implemented
         as ice_aq_free_vsi).
      
      3) The driver represents a VSI using struct ice_vsi. This is allocated
         and initialized as part of the ice_vsi_alloc flow, and deallocated
         as part of the ice_vsi_delete flow.
      
      4) Once the VSI is created, a netdev is allocated and associated with it.
         The VSI's ring and vector related data structures are also allocated
         and initialized.
      
      5) A VSI's queues can either be contiguous or scattered. To do this, the
         driver maintains a bitmap (vsi->avail_txqs) which is kept in sync with
         the firmware's VSI queue allocation imap. If the VSI can't get a
         contiguous queue allocation, it will fallback to scatter. This is
         implemented in ice_vsi_get_qs which is called as part of the VSI setup
         flow. In the release flow, the VSI's queues are released and the bitmap
         is updated to reflect this by ice_vsi_put_qs.
      
      CC: Shannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Acked-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      3a858ba3
    • Anirudh Venkataramanan's avatar
      ice: Initialize PF and setup miscellaneous interrupt · 940b61af
      Anirudh Venkataramanan authored
      
      
      This patch continues the initialization flow as follows:
      
      1) Allocate and initialize necessary fields (like vsi, num_alloc_vsi,
         irq_tracker, etc) in the ice_pf instance.
      
      2) Setup the miscellaneous interrupt handler. This also known as the
         "other interrupt causes" (OIC) handler and is used to handle non
         hotpath interrupts (like control queue events, link events,
         exceptions, etc.
      
      3) Implement a background task to process admin queue receive (ARQ)
         events received by the driver.
      
      CC: Shannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Acked-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      940b61af
    • Anirudh Venkataramanan's avatar
      ice: Get MAC/PHY/link info and scheduler topology · dc49c772
      Anirudh Venkataramanan authored
      
      
      This patch adds code to continue the initialization flow as follows:
      
      1) Get PHY/link information and store it
      2) Get default scheduler tree topology and store it
      3) Get the MAC address associated with the port and store it
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      dc49c772
    • Anirudh Venkataramanan's avatar
      ice: Get switch config, scheduler config and device capabilities · 9c20346b
      Anirudh Venkataramanan authored
      
      
      This patch adds to the initialization flow by getting switch
      configuration, scheduler configuration and device capabilities.
      
      Switch configuration:
      On boot, an L2 switch element is created in the firmware per physical
      function. Each physical function is also mapped to a port, to which its
      switch element is connected. In other words, this switch can be visualized
      as an embedded vSwitch that can connect a physical function's virtual
      station interfaces (VSIs) to the egress/ingress port. Egress/ingress
      filters will be eventually created and applied on this switch element.
      As part of the initialization flow, the driver gets configuration data
      from this switch element and stores it.
      
      Scheduler configuration:
      The Tx scheduler is a subsystem responsible for setting and enforcing QoS.
      As part of the initialization flow, the driver queries and stores the
      default scheduler configuration for the given physical function.
      
      Device capabilities:
      As part of initialization, the driver has to determine what the device is
      capable of (ex. max queues, VSIs, etc). This information is obtained from
      the firmware and stored by the driver.
      
      CC: Shannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Acked-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9c20346b
    • Anirudh Venkataramanan's avatar
      ice: Start hardware initialization · f31e4b6f
      Anirudh Venkataramanan authored
      
      
      This patch implements multiple pieces of the initialization flow
      as follows:
      
      1) A reset is issued to ensure a clean device state, followed
         by initialization of admin queue interface.
      
      2) Once the admin queue interface is up, clear the PF config
         and transition the device to non-PXE mode.
      
      3) Get the NVM configuration stored in the device's non-volatile
         memory (NVM) using ice_init_nvm.
      
      CC: Shannon Nelson <shannon.nelson@oracle.com>
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Acked-by: default avatarShannon Nelson <shannon.nelson@oracle.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      f31e4b6f
    • Anirudh Venkataramanan's avatar
      ice: Add support for control queues · 7ec59eea
      Anirudh Venkataramanan authored
      
      
      A control queue is a hardware interface which is used by the driver
      to interact with other subsystems (like firmware, PHY, etc.). It is
      implemented as a producer-consumer ring. More specifically, an
      "admin queue" is a type of control queue used to interact with the
      firmware.
      
      This patch introduces data structures and functions to initialize
      and teardown control/admin queues. Once the admin queue is initialized,
      the driver uses it to get the firmware version.
      
      Signed-off-by: default avatarAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: default avatarTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: default avatarJeff Kirsher <jeffrey.t.kirsher@intel.com>
      7ec59eea
  2. Mar 26, 2018