Skip to content
  1. Mar 09, 2020
  2. Mar 07, 2020
  3. Mar 06, 2020
    • David S. Miller's avatar
      Merge branch 'tun-debug' · 425c075d
      David S. Miller authored
      
      
      Michal Kubecek says:
      
      ====================
      tun: debug messages cleanup
      
      While testing ethtool output for "strange" devices, I noticed confusing and
      obviously incorrect message level information for a tun device and sent
      a quick fix. The result of the upstream discussion was that tun driver
      would rather deserve a more complex cleanup of the way it handles debug
      messages.
      
      The main problem is that all debugging statements and setting of message
      level are controlled by TUN_DEBUG macro which is only defined if one edits
      the source and rebuilds the module, otherwise all DBG1() and tun_debug()
      statements do nothing.
      
      This series drops the TUN_DEBUG switch and replaces custom tun_debug()
      macro with standard netif_info() so that message level (mask) set and
      displayed using ethtool works as expected. Some debugging messages are
      dropped as they only notify about entering a function which can be done
      easily using ftrace or kprobe.
      
      Patch 1 is a trivial fix for compilation warning with W=1.
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      425c075d
    • Michal Kubecek's avatar
      tun: drop TUN_DEBUG and tun_debug() · 5af09071
      Michal Kubecek authored
      
      
      TUN_DEBUG and tun_debug() are no longer used anywhere, drop them.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5af09071
    • Michal Kubecek's avatar
      tun: replace tun_debug() by netif_info() · 3424170f
      Michal Kubecek authored
      
      
      The tun driver uses custom macro tun_debug() which is only available if
      TUN_DEBUG is set. Replace it by standard netif_ifinfo(). For that purpose,
      rename tun_struct::debug to msg_enable and make it u32 and always present.
      Finally, make tun_get_msglevel(), tun_set_msglevel() and TUNSETDEBUG ioctl
      independent of TUN_DEBUG.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      3424170f
    • Michal Kubecek's avatar
      tun: drop useless debugging statements · 18209434
      Michal Kubecek authored
      
      
      Some of the tun_debug() statements only inform us about entering
      a function which can be easily achieved with ftrace or kprobe. As
      tun_debug() is no-op unless TUN_DEBUG is set which requires editing the
      source and recompiling, setting up ftrace or kprobe is easier. Drop these
      debug statements.
      
      Also drop the tun_debug() statement informing about SIOCSIFHWADDR ioctl.
      We can monitor these through rtnetlink and it makes little sense to log
      address changes through ioctl but not changes through rtnetlink. Moreover,
      this tun_debug() is called even if the actual address change fails which
      makes it even less useful.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18209434
    • Michal Kubecek's avatar
      tun: get rid of DBG1() macro · 7522416d
      Michal Kubecek authored
      
      
      This macro is no-op unless TUN_DEBUG is defined (which requires editing and
      recompiling the source) and only does something if variable debug is 2 but
      that variable is zero initialized and never set to anything else. Moreover,
      the only use of the macro informs about entering function tun_chr_open()
      which can be easily achieved using ftrace or kprobe.
      
      Drop DBG1() macro, its only use and global variable debug.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      7522416d
    • Michal Kubecek's avatar
      tun: fix misleading comment format · 516c512b
      Michal Kubecek authored
      
      
      The comment above tun_flow_save_rps_rxhash() starts with "/**" which
      makes it look like kerneldoc comment and results in warnings when
      building with W=1. Fix the format to make it look like a normal comment.
      
      Signed-off-by: default avatarMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      516c512b
    • Roman Mashak's avatar
    • Roman Mashak's avatar
    • David S. Miller's avatar
      Merge branch 'PCI-Implement-function-to-read-Device-Serial-Number' · 5e0db7e4
      David S. Miller authored
      
      
      Jacob Keller says:
      
      ====================
      PCI: Implement function to read Device Serial Number
      
      Several drivers read the Device Serial Number from the PCIe extended
      configuration space. Each of these drivers implements a similar approach to
      finding the position and then extracting the 8 bytes of data.
      
      Implement a new helper function, pci_get_dsn, which can be used to extract
      this data into an 8 byte array.
      
      Modify the bnxt_en, qedf, ice, ixgbe and nfp drivers to use this new
      function.
      
      The intent for this is to reduce duplicate code across the various drivers,
      and make it easier to write future code that wants to read the DSN. In
      particular the ice driver will be using the DSN as its serial number when
      implementing the DEVLINK_CMD_INFO_GET.
      
      The new implementation in v2 significantly simplifies some of the callers
      which just want to print the value out in MSB order. By returning things as
      a u64 in CPU Endian order, the "%016llX" printf format specifier can be used
      to correctly format the value.
      
      Per patch changes since v1
        PCI: Introduce pci_get_dsn
        * Update commit message based on feedback from Bjorn Helgaas
        * Modify the function to return a u64 (zero on no capability)
        * This new implementation ensures that the first dword is the lower 32
          bits and the second dword is the upper 32 bits.
      
        bnxt_en: Use pci_get_dsn()
        * Use the u64 return value from pci_get_dsn()
        * Copy it into the dsn[] array by using put_unaligned_le64
        * Fix a pre-existing typo in the netdev_info error message
      
        scsi: qedf: Use pci_get_dsn()
        * Use the u64 return value from pci_get_dsn()
        * simplify the snprintf to use "%016llX"
        * remove the unused 'i' variable
      
        ice: Use pci_get_dsn()
        * Use the u64 return value from pci_get_dsn()
        * simplify the snprintf to use "%016llX"
      
        ixgbe: Use pci_get_dsn()
        * Use the u64 return value from pci_get_dsn()
        * simplify the snprintf to use "%016llX"
      
        nfp: Use pci_get_dsn()
        * Added in v2
      ====================
      
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5e0db7e4
    • Jacob Keller's avatar
      nfp: Use pci_get_dsn() · 61600112
      Jacob Keller authored
      
      
      Use the newly added pci_get_dsn() function for obtaining the 64-bit
      Device Serial Number in the nfp6000_read_serial and
      nfp_6000_get_interface functions.
      
      pci_get_dsn() reports the Device Serial number as a u64 value created by
      combining two pci_read_config_dword functions. The lower 16 bits
      represent the device interface value, and the next 48 bits represent the
      serial value. Use put_unaligned_be32 and put_unaligned_be16 to convert
      the serial value portion into a Big Endian formatted serial u8 array.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Reviewed-by: default avatarJakub Kicinski <kuba@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      61600112
    • Jacob Keller's avatar
      ixgbe: Use pci_get_dsn() · f998958d
      Jacob Keller authored
      
      
      Replace the open-coded implementation for reading the PCIe DSN with
      pci_get_dsn().
      
      The original code used a simple for-loop to read the bytes in order into
      a buffer one byte at a time.
      
      The pci_get_dsn() function returns the DSN as a u64, correctly ordering
      the upper and lower 32 bit dwords. Simplify the display code by using
      %016llX to display the u64 DSN.
      
      This should have equivalent behavior on both Little and Big Endian
      systems. The bus will have correctly ordered the dwords in the CPU
      endian format, while pci_get_dsn() will correctly order the lower and
      higher dwords into a u64.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f998958d
    • Jacob Keller's avatar
      ice: Use pci_get_dsn() · ceb2f007
      Jacob Keller authored
      
      
      Replace the open-coded implementation for reading the PCIe DSN with
      pci_get_dsn().
      
      The pci_get_dsn() function will perform two pci_read_config_dword calls
      to read the lower and upper config dwords. It bitwise ORs them into
      a u64 value. Instead of using put_unaligned_le32 to convert the value to
      LE32 format, just use the %016llX printf specifier. This will print the
      u64 correct, putting the most significant byte of the value first. Since
      pci_get_dsn() correctly orders the two dwords into a u64, this should
      produce equivalent results in less code.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      ceb2f007
    • Jacob Keller's avatar
      scsi: qedf: Use pci_get_dsn() · dbce64cb
      Jacob Keller authored
      
      
      Replace the open-coded implementation for reading the PCIe DSN with
      pci_get_dsn().
      
      The original code used a for-loop that looped over each of the 8 bytes
      and copied them into a temporary buffer. pci_get_dsn() uses two calls to
      pci_read_config_dword, and correctly bitwise ORs them into a u64. Thus,
      we can simplify the snprintf significantly using %016llX on a u64 value.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      dbce64cb
    • Jacob Keller's avatar
      bnxt_en: Use pci_get_dsn() · 8d85b75b
      Jacob Keller authored
      
      
      Replace the open-coded implementation for reading the PCIe DSN with
      pci_get_dsn().
      
      Use of put_unaligned_le64 should be correct. pci_get_dsn() will perform
      two pci_read_config_dword calls. The first dword will be placed in the
      first 32 bits of the u64, while the second dword will be placed in the
      upper 32 bits of the u64.
      
      On Little Endian systems, the least significant byte comes first, which
      will be the least significant byte of the first dword, followed by the
      least significant byte of the second dword. Since the _le32 variations
      do not perform byte swapping, we will correctly copy the dwords into the
      dsn[] array in the same order as before.
      
      On Big Endian systems, the most significant byte of the second dword
      will come first. put_unaligned_le64 will perform a CPU_TO_LE64, which
      will swap things correctly before copying. This should also end up with
      the correct bytes in the dsn[] array.
      
      While at it, fix a small typo in the netdev_info error message when the
      DSN cannot be read.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Michael Chan <michael.chan@broadcom.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      8d85b75b
    • Jacob Keller's avatar
      PCI: Introduce pci_get_dsn · 70c0923b
      Jacob Keller authored
      
      
      Several device drivers read their Device Serial Number from the PCIe
      extended config space.
      
      Introduce a new helper function, pci_get_dsn(). This function reads the
      eight bytes of the DSN and returns them as a u64. If the capability does not
      exist for the device, the function returns 0.
      
      Signed-off-by: default avatarJacob Keller <jacob.e.keller@intel.com>
      Cc: Bjorn Helgaas <bhelgaas@google.com>
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Cc: Michael Chan <michael.chan@broadcom.com>
      Acked-by: default avatarBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      70c0923b
    • Matthew Wilcox (Oracle)'s avatar
      ibmveth: Remove unused page_offset macro · 367ab29e
      Matthew Wilcox (Oracle) authored
      
      
      We already have a function called page_offset(), and this macro
      is unused, so just delete it.
      
      Signed-off-by: default avatarMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      367ab29e