Skip to content
  1. Mar 27, 2018
    • 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