1. 23 4月, 2021 2 次提交
  2. 23 3月, 2021 2 次提交
    • Q
      ice: Enable FDIR Configure for AVF · 1f7ea1cd
      Qi Zhang 提交于
      The virtual channel is going to be extended to support FDIR and
      RSS configure from AVF. New data structures and OP codes will be
      added, the patch enable the FDIR part.
      
      To support above advanced AVF feature, we need to figure out
      what kind of data structure should be passed from VF to PF to describe
      an FDIR rule or RSS config rule. The common part of the requirement is
      we need a data structure to represent the input set selection of a rule's
      hash key.
      
      An input set selection is a group of fields be selected from one or more
      network protocol layers that could be identified as a specific flow.
      For example, select dst IP address from an IPv4 header combined with
      dst port from the TCP header as the input set for an IPv4/TCP flow.
      
      The patch adds a new data structure virtchnl_proto_hdrs to abstract
      a network protocol headers group which is composed of layers of network
      protocol header(virtchnl_proto_hdr).
      
      A protocol header contains a 32 bits mask (field_selector) to describe
      which fields are selected as input sets, as well as a header type
      (enum virtchnl_proto_hdr_type). Each bit is mapped to a field in
      enum virtchnl_proto_hdr_field guided by its header type.
      
      +------------+-----------+------------------------------+
      |            | Proto Hdr | Header Type A                |
      |            |           +------------------------------+
      |            |           | BIT 31 | ... | BIT 1 | BIT 0 |
      |            |-----------+------------------------------+
      |Proto Hdrs  | Proto Hdr | Header Type B                |
      |            |           +------------------------------+
      |            |           | BIT 31 | ... | BIT 1 | BIT 0 |
      |            |-----------+------------------------------+
      |            | Proto Hdr | Header Type C                |
      |            |           +------------------------------+
      |            |           | BIT 31 | ... | BIT 1 | BIT 0 |
      |            |-----------+------------------------------+
      |            |    ....                                  |
      +-------------------------------------------------------+
      
      All fields in enum virtchnl_proto_hdr_fields are grouped with header type
      and the value of the first field of a header type is always 32 aligned.
      
      enum proto_hdr_type {
              header_type_A = 0;
              header_type_B = 1;
              ....
      }
      
      enum proto_hdr_field {
              /* header type A */
              header_A_field_0 = 0,
              header_A_field_1 = 1,
              header_A_field_2 = 2,
              header_A_field_3 = 3,
      
              /* header type B */
              header_B_field_0 = 32, // = header_type_B << 5
              header_B_field_0 = 33,
              header_B_field_0 = 34
              header_B_field_0 = 35,
              ....
      };
      
      So we have:
      proto_hdr_type = proto_hdr_field / 32
      bit offset = proto_hdr_field % 32
      
      To simply the protocol header's operations, couple help macros are added.
      For example, to select src IP and dst port as input set for an IPv4/UDP
      flow.
      
      we have:
      struct virtchnl_proto_hdr hdr[2];
      
      VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[0], IPV4)
      VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[0], IPV4, SRC)
      
      VIRTCHNL_SET_PROTO_HDR_TYPE(&hdr[1], UDP)
      VIRTCHNL_ADD_PROTO_HDR_FIELD(&hdr[1], UDP, DST)
      
      The byte array is used to store the protocol header of a training package.
      The byte array must be network order.
      
      The patch added virtual channel support for iAVF FDIR add/validate/delete
      filter. iAVF FDIR is Flow Director for Intel Adaptive Virtual Function
      which can direct Ethernet packets to the queues of the Network Interface
      Card. Add/delete command is adding or deleting one rule for each virtual
      channel message, while validate command is just verifying if this rule
      is valid without any other operations.
      
      To add or delete one rule, driver needs to config TCAM and Profile,
      build training packets which contains the input set value, and send
      the training packets through FDIR Tx queue. In addition, driver needs to
      manage the software context to avoid adding duplicated rules, deleting
      non-existent rule, input set conflicts and other invalid cases.
      
      NOTE:
      Supported pattern/actions and their parse functions are not be included in
      this patch, they will be added in a separate one.
      Signed-off-by: NJeff Guo <jia.guo@intel.com>
      Signed-off-by: NYahui Cao <yahui.cao@intel.com>
      Signed-off-by: NSimei Su <simei.su@intel.com>
      Signed-off-by: NBeilei Xing <beilei.xing@intel.com>
      Signed-off-by: NQi Zhang <qi.z.zhang@intel.com>
      Tested-by: NChen Bo <BoX.C.Chen@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      1f7ea1cd
    • Q
      ice: Add support for per VF ctrl VSI enabling · da62c5ff
      Qi Zhang 提交于
      We are going to enable FDIR configure for AVF through virtual channel.
      The first step is to add helper functions to support control VSI setup.
      A control VSI will be allocated for a VF when AVF creates its
      first FDIR rule through ice_vf_ctrl_vsi_setup().
      The patch will also allocate FDIR rule space for VF's control VSI.
      If a VF asks for flow director rules, then those should come entirely
      from the best effort pool and not from the guaranteed pool. The patch
      allow a VF VSI to have only space in the best effort rules.
      Signed-off-by: NXiaoyun Li <xiaoyun.li@intel.com>
      Signed-off-by: NYahui Cao <yahui.cao@intel.com>
      Signed-off-by: NQi Zhang <qi.z.zhang@intel.com>
      Tested-by: NChen Bo <BoX.C.Chen@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      da62c5ff
  3. 01 8月, 2020 1 次提交
    • B
      ice: Allow 2 queue pairs per VF on SR-IOV initialization · f34f5555
      Brett Creeley 提交于
      Currently VFs are only allowed to get 16, 4, and 1 queue pair by
      default, which require 17, 5, and 2 MSI-X vectors respectively. This
      is because each VF needs a MSI-X per data queue and a MSI-X for its
      other interrupt. The calculation is based on the number of VFs created,
      MSI-X available, and queue pairs available at the time of VF creation.
      
      Unfortunately the values above exclude 2 queue pairs when only 3 MSI-X
      are available to each VF based on resource constraints. The current
      calculation would default to 2 MSI-X and 1 queue pair. This is a waste
      of resources, so fix this by allowing 2 queue pairs per VF when there
      are between 2 and 5 MSI-X available per VF.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      f34f5555
  4. 29 7月, 2020 1 次提交
  5. 31 5月, 2020 1 次提交
  6. 23 5月, 2020 1 次提交
  7. 22 5月, 2020 2 次提交
  8. 11 3月, 2020 1 次提交
  9. 20 2月, 2020 2 次提交
    • P
      ice: update malicious driver detection event handling · 9d5c5a52
      Paul Greenwalt 提交于
      Update the PF VFs MDD event message to rate limit once per second and
      report the total number Rx|Tx event count. Add support to print pending
      MDD events that occur during the rate limit. The use of net_ratelimit did
      not allow for per VF Rx|Tx granularity.
      
      Additional PF MDD log messages are guarded by netif_msg_[rx|tx]_err().
      
      Since VF RX MDD events disable the queue, add ethtool private flag
      mdd-auto-reset-vf to configure VF reset to re-enable the queue.
      
      Disable anti-spoof detection interrupt to prevent spurious events
      during a function reset.
      
      To avoid race condition do not make PF MDD register reads conditional
      on global MDD result.
      Signed-off-by: NPaul Greenwalt <paul.greenwalt@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      9d5c5a52
    • B
      ice: Wait for VF to be reset/ready before configuration · c54d209c
      Brett Creeley 提交于
      The configuration/command below is failing when the VF in the xml
      file is already bound to the host iavf driver.
      
      pci_0000_af_0_0.xml:
      
      <interface type='hostdev' managed='yes'>
      <source>
      <address type='pci' domain='0x0000' bus='0xaf' slot='0x0' function='0x0'/>
      </source>
      <mac address='00:de:ad:00:11:01'/>
      </interface>
      
      > virsh attach-device domain_name pci_0000_af_0_0.xml
      error: Failed to attach device from pci_0000_af_0_0.xml
      error: Cannot set interface MAC/vlanid to 00:de:ad:00:11:01/0 for
      	ifname ens1f1 vf 0: Device or resource busy
      
      This is failing because the VF has not been completely removed/reset
      after being unbound (via the virsh command above) from the host iavf
      driver and ice_set_vf_mac() checks if the VF is disabled before waiting
      for the reset to finish.
      
      Fix this by waiting for the VF remove/reset process to happen before
      checking if the VF is disabled. Also, since many functions for VF
      administration on the PF were more or less calling the same 3 functions
      (ice_wait_on_vf_reset(), ice_is_vf_disabled(), and ice_check_vf_init())
      move these into the helper function ice_check_vf_ready_for_cfg(). Then
      call this function in any flow that attempts to configure/query a VF
      from the PF.
      
      Lastly, increase the maximum wait time in ice_wait_on_vf_reset() to
      800ms, and modify/add the #define(s) that determine the wait time.
      This was done for robustness because in rare/stress cases VF removal can
      take a max of ~800ms and previously the wait was a max of ~300ms.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      c54d209c
  10. 16 2月, 2020 4 次提交
    • B
      ice: Fix and refactor Rx queue disable for VFs · e1fe6926
      Brett Creeley 提交于
      Currently when a VF driver sends the PF a request to disable Rx queues
      we will disable them one at a time, even if the VF driver sent us a
      batch of queues to disable. This is causing issues where the Rx queue
      disable times out with LFC enabled. This can be improved by detecting
      when the VF is trying to disable all of its queues.
      
      Also remove the variable num_qs_ena from the ice_vf structure as it was
      only used to see if there were no Rx and no Tx queues active. Instead
      add a function that checks if both the vf->rxq_ena and vf->txq_ena
      bitmaps are empty.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e1fe6926
    • B
      ice: Handle LAN overflow event for VF queues · 2309ae38
      Brett Creeley 提交于
      Currently we are not handling LAN overflow events. There can be cases
      where LAN overflow events occur on VF queues, especially with Link Flow
      Control (LFC) enabled on the controlling PF. In order to recover from
      the LAN overflow event caused by a VF we need to determine if the queue
      belongs to a VF and reset that VF accordingly.
      
      The struct ice_aqc_event_lan_overflow returns a copy of the GLDCB_RTCTQ
      register, which tells us what the queue index is in the global/device
      space. The global queue index needs to first be converted to a PF space
      queue index and then it can be used to find if a VF owns it.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      2309ae38
    • B
      ice: Fix Port VLAN priority bits · 61c9ce86
      Brett Creeley 提交于
      Currently when configuring a port VLAN for a VF we are only shifting the
      QoS bits by 12. This is incorrect. Fix this by getting rid of the ICE
      specific VLAN defines and use the kernel VLAN defines instead.
      
      Also, don't assign a value to vlanprio until the VLAN ID and QoS
      parameters have been validated.
      
      Also, there are many places we do (le16_to_cpu(vsi->info.pvid) &
      VLAN_VID_MASK). Instead do (vf->port_vlan_info & VLAN_VID_MASK) because
      we always save what's stored in vsi->info.pvid to vf->port_vlan_info in
      the CPU's endianness.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      61c9ce86
    • B
      ice: Refactor port vlan configuration for the VF · b093841f
      Brett Creeley 提交于
      Currently ice_vsi_manage_pvid() calls
      ice_vsi_[set|kill]_pvid_fill_ctxt() when enabling/disabling a port VLAN
      on a VSI respectively. These two functions have some duplication so just
      move their unique pieces inline in ice_vsi_manage_pvid() and then the
      duplicate code can be reused for both the enabling/disabling paths.
      
      Before this patch the info.pvid field was not being written
      correctly via ice_vsi_kill_pvid_fill_ctxt() so it was being hard coded
      to 0 in ice_set_vf_port_vlan(). Fix this by setting the info.pvid field
      to 0 before calling ice_vsi_update() in ice_vsi_manage_pvid().
      
      We currently use vf->port_vlan_id to keep track of the port VLAN
      ID and QoS, which is a bit misleading. Fix this by renaming it to
      vf->port_vlan_info. Also change the name of the argument for
      ice_vsi_manage_pvid() from vid to pvid_info.
      
      In ice_vsi_manage_pvid() only save the fields that were modified
      in the VSI properties structure on success instead of the entire thing.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b093841f
  11. 04 1月, 2020 2 次提交
    • B
      ice: Add ice_for_each_vf() macro · 005881bc
      Brett Creeley 提交于
      Currently we do "for (i = 0; i < pf->num_alloc_vfs; i++)" all over the
      place. Many other places use macros to contain this repeated for loop,
      So create the macro ice_for_each_vf(pf, i) that does the same thing.
      
      There were a couple places we were using one loop variable and a VF
      iterator, which were changed to using a local variable within the
      ice_for_each_vf() macro.
      
      Also in ice_alloc_vfs() we were setting pf->num_alloc_vfs after doing
      "for (i = 0; i < num_alloc_vfs; i++)". Instead assign pf->num_alloc_vfs
      right after allocating memory for the pf->vf array.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      005881bc
    • B
      ice: Fix VF spoofchk · cd6d6b83
      Brett Creeley 提交于
      There are many things wrong with the function
      ice_set_vf_spoofchk().
      
      1. The VSI being modified is the PF VSI, not the VF VSI.
      2. We are enabling Rx VLAN pruning instead of Tx VLAN anti-spoof.
      3. The spoofchk setting for each VF is not initialized correctly
         or re-initialized correctly on reset.
      
      To fix [1] we need to make sure we are modifying the VF VSI.
      This is done by using the vf->lan_vsi_idx to index into the PF's
      VSI array.
      
      To fix [2] replace setting Rx VLAN pruning in ice_set_vf_spoofchk()
      with setting Tx VLAN anti-spoof.
      
      To Fix [3] we need to make sure the initial VSI settings match what
      is done in ice_set_vf_spoofchk() for spoofchk=on. Also make sure
      this also works for VF reset. This was done by modifying ice_vsi_init()
      to account for the current spoofchk state of the VF VSI.
      
      Because of these changes, Tx VLAN anti-spoof needs to be removed
      from ice_cfg_vlan_pruning(). This is okay for the VF because this
      is now controlled from the admin enabling/disabling spoofchk. For the
      PF, Tx VLAN anti-spoof should not be set. This change requires us to
      call ice_set_vf_spoofchk() when configuring promiscuous mode for
      the VF which requires ice_set_vf_spoofchk() to move in order to prevent
      a forward declaration prototype.
      
      Also, add VLAN 0 by default when allocating a VF since the PF is unaware
      if the guest OS is running the 8021q module. Without this, MDD events will
      trigger on untagged traffic because spoofcheck is enabled by default. Due
      to this change, ignore add/delete messages for VLAN 0 from VIRTCHNL since
      this is added/deleted during VF initialization/teardown respectively and
      should not be modified.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: NTony Nguyen <anthony.l.nguyen@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      cd6d6b83
  12. 23 11月, 2019 1 次提交
  13. 09 11月, 2019 1 次提交
  14. 27 8月, 2019 2 次提交
  15. 21 8月, 2019 3 次提交
  16. 01 8月, 2019 1 次提交
  17. 29 5月, 2019 1 次提交
    • B
      ice: Refactor interrupt tracking · cbe66bfe
      Brett Creeley 提交于
      Currently we have two MSI-x (IRQ) trackers, one for OS requested MSI-x
      entries (sw_irq_tracker) and one for hardware MSI-x vectors
      (hw_irq_tracker). Generally the sw_irq_tracker has less entries than the
      hw_irq_tracker because the hw_irq_tracker has entries equal to the max
      allowed MSI-x per PF and the sw_irq_tracker is mainly the minimum (non
      SR-IOV portion of the vectors, kernel granted IRQs). All of the non
      SR-IOV portions of the driver (i.e. LAN queues, RDMA queues, OICR, etc.)
      take at least one of each type of tracker resource. SR-IOV only grabs
      entries from the hw_irq_tracker. There are a few issues with this approach
      that can be seen when doing any kind of device reconfiguration (i.e.
      ethtool -L, SR-IOV, etc.). One of them being, any time the driver creates
      an ice_q_vector and associates it to a LAN queue pair it will grab and
      use one entry from the hw_irq_tracker and one from the sw_irq_tracker.
      If the indices on these does not match it will cause a Tx timeout, which
      will cause a reset and then the indices will match up again and traffic
      will resume. The mismatched indices come from the trackers not being the
      same size and/or the search_hint in the two trackers not being equal.
      Another reason for the refactor is the co-existence of features with
      SR-IOV. If SR-IOV is enabled and the interrupts are taken from the end
      of the sw_irq_tracker then other features can no longer use this space
      because the hardware has now given the remaining interrupts to SR-IOV.
      
      This patch reworks how we track MSI-x vectors by removing the
      hw_irq_tracker completely and instead MSI-x resources needed for SR-IOV
      are determined all at once instead of per VF. This can be done because
      when creating VFs we know how many are wanted and how many MSI-x vectors
      each VF needs. This also allows us to start using MSI-x resources from
      the end of the PF's allowed MSI-x vectors so we are less likely to use
      entries needed for other features (i.e. RDMA, L2 Offload, etc).
      
      This patch also reworks the ice_res_tracker structure by removing the
      search_hint and adding a new member - "end". Instead of having a
      search_hint we will always search from 0. The new member, "end", will be
      used to manipulate the end of the ice_res_tracker (specifically
      sw_irq_tracker) during runtime based on MSI-x vectors needed by SR-IOV.
      In the normal case, the end of ice_res_tracker will be equal to the
      ice_res_tracker's num_entries.
      
      The sriov_base_vector member was added to the PF structure. It is used
      to represent the starting MSI-x index of all the needed MSI-x vectors
      for all SR-IOV VFs. Depending on how many MSI-x are needed, SR-IOV may
      have to take resources from the sw_irq_tracker. This is done by setting
      the sw_irq_tracker->end equal to the pf->sriov_base_vector. When all
      SR-IOV VFs are removed then the sw_irq_tracker->end is reset back to
      sw_irq_tracker->num_entries. The sriov_base_vector, along with the VF's
      number of MSI-x (pf->num_vf_msix), vf_id, and the base MSI-x index on
      the PF (pf->hw.func_caps.common_cap.msix_vector_first_id), is used to
      calculate the first HW absolute MSI-x index for each VF, which is used
      to write to the VPINT_ALLOC[_PCI] and GLINT_VECT2FUNC registers to
      program the VFs MSI-x PCI configuration bits. Also, the sriov_base_vector
      is used along with VF's num_vf_msix, vf_id, and q_vector->v_idx to
      determine the MSI-x register index (used for writing to GLINT_DYN_CTL)
      within the PF's space.
      
      Interrupt changes removed any references to hw_base_vector, hw_oicr_idx,
      and hw_irq_tracker. Only sw_base_vector, sw_oicr_idx, and sw_irq_tracker
      variables remain. Change all of these by removing the "sw_" prefix to
      help avoid confusion with these variables and their use.
      Signed-off-by: NBrett Creeley <brett.creeley@intel.com>
      Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      cbe66bfe
  18. 24 5月, 2019 2 次提交
  19. 18 4月, 2019 1 次提交
  20. 22 3月, 2019 3 次提交
  21. 21 11月, 2018 1 次提交
  22. 03 10月, 2018 5 次提交