1. 24 8月, 2018 5 次提交
    • P
      ice: Clean control queues only when they are initialized · b29bc220
      Preethi Banala 提交于
      Clean control queues only when they are initialized. One of the ways to
      validate if the basic initialization is done is by checking value of
      cq->sq.head and cq->rq.head variables that specify the register address.
      This patch adds a check to avoid NULL pointer dereference crash when tried
      to shutdown uninitialized control queue.
      Signed-off-by: NPreethi Banala <preethi.banala@intel.com>
      Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      b29bc220
    • J
      ice: Report stats for allocated queues via ethtool stats · f8ba7db8
      Jacob Keller 提交于
      It is not safe to have the string table for statistics change order or
      size over the lifetime of a given netdevice. This is because of the
      nature of the 3-step process for obtaining stats. First, user space
      performs a request for the size of the strings table. Second it performs
      a separate request for the strings themselves, after allocating space
      for the table. Third, it requests the stats themselves, also allocating
      space for the table.
      
      If the size decreased, there is potential to see garbage data or stats
      values. In the worst case, we could potentially see stats values become
      mis-aligned with their strings, so that it looks like a statistic is
      being reported differently than it actually is.
      
      Even worse, if the size increased, there is potential that the strings
      table or stats table was not allocated large enough and the stats code
      could access and write to memory it should not, potentially resulting in
      undefined behavior and system crashes.
      
      It isn't even safe if the size always changes under the RTNL lock. This
      is because the calls take place over multiple user space commands, so it
      is not possible to hold the RTNL lock for the entire duration of
      obtaining strings and stats. Further, not all consumers of the ethtool
      API are the user space ethtool program, and it is possible that one
      assumes the strings will not change (valid under the current contract),
      and thus only requests the stats values when requesting stats in a loop.
      
      Finally, it's not possible in the general case to detect when the size
      changes, because it is quite possible that one value which could impact
      the stat size increased, while another decreased. This would result in
      the same total number of stats, but reordering them so that stats no
      longer line up with the strings they belong to. Since only size changes
      aren't enough, we would need some sort of hash or token to determine
      when the strings no longer match. This would require extending the
      ethtool stats commands, but there is no more space in the relevant
      structures.
      
      The real solution to resolve this would be to add a completely new API
      for stats, probably over netlink.
      
      In the ice driver, the only thing impacting the stats that is not
      constant is the number of queues. Instead of reporting stats for each
      used queue, report stats for each allocated queue. We do not change the
      number of queues allocated for a given netdevice, as we pass this into
      the alloc_etherdev_mq() function to set the num_tx_queues and
      num_rx_queues.
      
      This resolves the potential bugs at the slight cost of displaying many
      queue statistics which will not be activated.
      Signed-off-by: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      f8ba7db8
    • A
      ice: Cleanup magic number · 5ab52244
      Anirudh Venkataramanan 提交于
      Use define for the unit size shift of the Rx LAN context descriptor base
      address instead of the magic number 7.
      Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      5ab52244
    • B
      ice: Remove unnecessary node owner check · 6efa6239
      Bruce Allan 提交于
      There is already a check for owner == ICE_SCHED_NODE_OWNER_LAN at the
      beginning of ice_sched_update_vsi_child_nodes. Remove the additional
      check to address the static analysis tool smatch issue "warn: we tested
      'owner' before and it was 'false'".
      Signed-off-by: NBruce Allan <bruce.w.allan@intel.com>
      Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      6efa6239
    • A
      ice: Fix multiple static analyser warnings · 4381147d
      Anirudh Venkataramanan 提交于
      This patch fixes the following smatch errors:
      
      1) Fix "odd binop '0x0 & 0xc'" when performing the bitwise-and with a
         constant value of zero (ICE_AQC_GSET_RSS_LUT_TABLE_SIZE_128_FLAG).
         Remove a similar bitwise-and with 0 in ice_add_marker_act() and use the
         right mask ICE_LG_ACT_GENERIC_OFFSET_M in the expression.
      
      2) Fix a similar issue "odd binop '0x0 & 0x1800' in ice_req_irq_msix_misc.
      
      3) Fix "odd binop '0x380000 & 0x7fff8'" in ice_add_marker_act(). Also, use
         a new define ICE_LG_ACT_GENERIC_OFF_RX_DESC_PROF_IDX instead of magic
         number '7'.
      
      4) Fix warn: odd binop '0x0 & 0x18' in ice_set_dflt_vsi_ctx() by removing
         unnecessary logic to explicitly unset bits 3 and 4 in port_vlan_bits.
         These bits are unset already by the memset on ctxt->info.
      Reported-by: NDan Carpenter <dan.carpenter@oracle.com>
      Signed-off-by: NAnirudh Venkataramanan <anirudh.venkataramanan@intel.com>
      Tested-by: NTony Brelinski <tonyx.brelinski@intel.com>
      Signed-off-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      4381147d
  2. 23 8月, 2018 20 次提交
  3. 22 8月, 2018 13 次提交
  4. 21 8月, 2018 2 次提交