1. 06 8月, 2019 3 次提交
  2. 27 6月, 2019 1 次提交
    • G
      i40e/i40e_virtchnl_pf: Use struct_size() in kzalloc() · fae6cad1
      Gustavo A. R. Silva 提交于
      One of the more common cases of allocation size calculations is finding
      the size of a structure that has a zero-sized array at the end, along
      with memory for some number of elements for that array. For example:
      
      struct virtchnl_iwarp_qvlist_info {
      	...
              struct virtchnl_iwarp_qv_info qv_info[1];
      };
      
      size = sizeof(struct virtchnl_iwarp_qvlist_info) + (sizeof(struct virtchnl_iwarp_qv_info) * count;
      instance = kzalloc(size, GFP_KERNEL);
      
      and
      
      struct virtchnl_vf_resource {
      	...
              struct virtchnl_vsi_resource vsi_res[1];
      };
      
      size = sizeof(struct virtchnl_vf_resource) + sizeof(struct virtchnl_vsi_resource) * count;
      instance = kzalloc(size, GFP_KERNEL);
      
      Instead of leaving these open-coded and prone to type mistakes, we can
      now use the new struct_size() helper:
      
      instance = kzalloc(struct_size(instance, qv_info, count), GFP_KERNEL);
      
      and
      
      instance = kzalloc(struct_size(instance, vsi_res, count), GFP_KERNEL);
      
      Notice that, in the first case above, variable size is not necessary, hence it
      is removed.
      
      This code was detected with the help of Coccinelle.
      Signed-off-by: N"Gustavo A. R. Silva" <gustavo@embeddedor.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      fae6cad1
  3. 15 6月, 2019 3 次提交
  4. 06 6月, 2019 2 次提交
  5. 05 5月, 2019 6 次提交
  6. 04 5月, 2019 3 次提交
  7. 17 4月, 2019 1 次提交
  8. 23 1月, 2019 1 次提交
  9. 22 1月, 2019 1 次提交
  10. 15 11月, 2018 2 次提交
  11. 01 11月, 2018 1 次提交
  12. 04 10月, 2018 1 次提交
  13. 26 9月, 2018 3 次提交
  14. 31 8月, 2018 2 次提交
  15. 01 5月, 2018 2 次提交
  16. 28 4月, 2018 1 次提交
  17. 24 3月, 2018 1 次提交
  18. 15 3月, 2018 2 次提交
    • F
      i40e: Fix permission check for VF MAC filters · 03ce7b1d
      Filip Sadowski 提交于
      When VF requests adding of MAC filters the checking is done against number
      of already present MAC filters not adding them at the same time. It makes
      it possible to add a bunch of filters at once possibly exceeding
      acceptable limit of I40E_VC_MAX_MAC_ADDR_PER_VF filters.
      
      This happens because when checking vf->num_mac, we do not check how many
      filters are being requested at once. Modify the check function to ensure
      that it knows how many filters are being requested. This allows the
      check to ensure that the total number of filters in a single request
      does not cause us to go over the limit.
      
      Additionally, move the check to within the lock to ensure that the
      vf->num_mac is checked while holding the lock to maintain consistency.
      We could have simply moved the call to i40e_vf_check_permission to
      within the loop, but this could cause a request to be non-atomic, and
      add some but not all the addresses, while reporting an error code. We
      want to avoid this behavior so that users are not confused about which
      filters have or have not been added.
      Signed-off-by: NFilip Sadowski <filip.sadowski@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      03ce7b1d
    • P
      i40e: Fix attach VF to VM issue · 028daf80
      Paweł Jabłoński 提交于
      Fix for "Resource temporarily unavailable" problem when virsh is
      trying to attach a device to VM. When the VF driver is loaded on
      host and virsh is trying to attach it to the VM and set a MAC
      address, it ends with a race condition between i40e_reset_vf and
      i40e_ndo_set_vf_mac functions. The bug is fixed by adding polling
      in i40e_ndo_set_vf_mac function For when the VF is in Reset mode.
      Signed-off-by: NPaweł Jabłoński <pawel.jablonski@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      028daf80
  19. 27 2月, 2018 2 次提交
  20. 15 2月, 2018 2 次提交
    • A
      i40e: Add and delete cloud filter · e284fc28
      Avinash Dayanand 提交于
      This patch provides support to add or delete cloud filter for queue
      channels created for ADq on VF.
      We are using the HW's cloud filter feature and programming it to act
      as a TC filter applied to a group of queues.
      
      There are two possible modes for a VF when applying a cloud filter
      1. Basic Mode:	Intended to apply filters that don't need a VF to be
      		Trusted. This would include the following
      		  Dest MAC + L4 port
      		  Dest MAC + VLAN + L4 port
      2. Advanced Mode: This mode is only for filters with combination that
      		  requires VF to be Trusted.
      		  Dest IP + L4 port
      
      When cloud filters are applied on a trusted VF and for some reason
      the same VF is later made as untrusted then all cloud filters
      will be deleted. All cloud filters has to be re-applied in
      such a case.
      Cloud filters are also deleted when queue channel is deleted.
      
      Testing-Hints:
      =============
      1. Adding Basic Mode filter should be possible on a VF in
         Non-Trusted mode.
      2. In Advanced mode all filters should be able to be created.
      
      Steps:
      ======
      1. Enable ADq and create TCs using TC mqprio command
      2. Apply cloud filter.
      3. Turn-off the spoof check.
      4. Pass traffic.
      
      Example:
      ========
      1. tc qdisc add dev enp4s2 root mqprio num_tc 4 map 0 0 0 0 1 2 2 3\
      	queues 2@0 2@2 1@4 1@5 hw 1 mode channel
      2. tc qdisc add dev enp4s2 ingress
      3. ethtool -K enp4s2 hw-tc-offload on
      4. ip link set ens261f0 vf 0 spoofchk off
      5. tc filter add dev enp4s2 protocol ip parent ffff: prio 1 flower\
      	dst_ip 192.168.3.5/32 ip_proto udp dst_port 25 skip_sw hw_tc 2
      Signed-off-by: NAvinash Dayanand <avinash.dayanand@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      e284fc28
    • A
      i40e: Service request to configure bandwidth for ADq on a VF · 0c483bd4
      Avinash Dayanand 提交于
      This patch handles the request from ADq enabled VF to allocate
      bandwidth to each traffic class which means for each VSI.
      Signed-off-by: NAvinash Dayanand <avinash.dayanand@intel.com>
      Tested-by: NAndrew Bowers <andrewx.bowers@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      0c483bd4