1. 07 3月, 2020 9 次提交
  2. 06 3月, 2020 31 次提交
    • D
      Merge branch 'tun-debug' · 425c075d
      David S. Miller 提交于
      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: NDavid S. Miller <davem@davemloft.net>
      425c075d
    • M
      tun: drop TUN_DEBUG and tun_debug() · 5af09071
      Michal Kubecek 提交于
      TUN_DEBUG and tun_debug() are no longer used anywhere, drop them.
      Signed-off-by: NMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5af09071
    • M
      tun: replace tun_debug() by netif_info() · 3424170f
      Michal Kubecek 提交于
      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: NMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      3424170f
    • M
      tun: drop useless debugging statements · 18209434
      Michal Kubecek 提交于
      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: NMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      18209434
    • M
      tun: get rid of DBG1() macro · 7522416d
      Michal Kubecek 提交于
      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: NMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7522416d
    • M
      tun: fix misleading comment format · 516c512b
      Michal Kubecek 提交于
      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: NMichal Kubecek <mkubecek@suse.cz>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      516c512b
    • R
    • R
    • D
      Merge branch 'PCI-Implement-function-to-read-Device-Serial-Number' · 5e0db7e4
      David S. Miller 提交于
      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: NDavid S. Miller <davem@davemloft.net>
      5e0db7e4
    • J
      nfp: Use pci_get_dsn() · 61600112
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Cc: Jakub Kicinski <kuba@kernel.org>
      Reviewed-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      61600112
    • J
      ixgbe: Use pci_get_dsn() · f998958d
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f998958d
    • J
      ice: Use pci_get_dsn() · ceb2f007
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Cc: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ceb2f007
    • J
      scsi: qedf: Use pci_get_dsn() · dbce64cb
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dbce64cb
    • J
      bnxt_en: Use pci_get_dsn() · 8d85b75b
      Jacob Keller 提交于
      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: NJacob Keller <jacob.e.keller@intel.com>
      Cc: Michael Chan <michael.chan@broadcom.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      8d85b75b
    • J
      PCI: Introduce pci_get_dsn · 70c0923b
      Jacob Keller 提交于
      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: NJacob 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: NBjorn Helgaas <bhelgaas@google.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      70c0923b
    • M
      ibmveth: Remove unused page_offset macro · 367ab29e
      Matthew Wilcox (Oracle) 提交于
      We already have a function called page_offset(), and this macro
      is unused, so just delete it.
      Signed-off-by: NMatthew Wilcox (Oracle) <willy@infradead.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      367ab29e
    • V
      ptp: add VMware virtual PTP clock driver · 7d10001e
      Vivek Thampi 提交于
      Add a PTP clock driver called ptp_vmw, for guests running on VMware ESXi
      hypervisor. The driver attaches to a VMware virtual device called
      "precision clock" that provides a mechanism for querying host system time.
      Similar to existing virtual PTP clock drivers (e.g. ptp_kvm), ptp_vmw
      utilizes the kernel's PTP hardware clock API to implement a clock device
      that can be used as a reference in Chrony for synchronizing guest time with
      host.
      
      The driver is only applicable to x86 guests running in VMware virtual
      machines with precision clock virtual device present. It uses a VMware
      specific hypercall mechanism to read time from the device.
      Reviewed-by: NThomas Hellstrom <thellstrom@vmware.com>
      Signed-off-by: NVivek Thampi <vithampi@vmware.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7d10001e
    • D
      Merge tag 'wireless-drivers-next-2020-03-05' of... · a368e860
      David S. Miller 提交于
      Merge tag 'wireless-drivers-next-2020-03-05' of git://git.kernel.org/pub/scm/linux/kernel/git/kvalo/wireless-drivers-next
      
      Kalle Valo says:
      
      ====================
      wireless-drivers-next patches for v5.7
      
      First set of patches for v5.7. Lots of mt76 patches as they missed the
      v5.6 deadline and hence they were postponed to the next version.
      Otherwise nothing special standing out.
      
      mt76
      
      Major changes:
      
      * dual-band concurrent support for MT7615
      
      * fixes for rx path race conditions
      
      * coverage class support for MT7615
      
      * beacon fixes for USB devices
      
      * MT7615 LED support
      
      * set_antenna support for MT7615
      
      * tracing improvements
      
      * preparation for supporting new USB devices
      
      * tx power fixes
      
      brcmfmac
      
      * support BRCM 4364 found in MacBook Pro 15,2
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a368e860
    • T
      bcm63xx_enet: remove redundant variable definitions · 442a46ad
      tangbin 提交于
      in this function,‘ret’ is always assigned,so this's definition
      'ret = 0' make no sense.
      Signed-off-by: Ntangbin <tangbin@cmss.chinamobile.com>
      Acked-by: NFlorian Fainelli <f.fainelli@gmail.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      442a46ad
    • G
      net: tulip: Replace zero-length array with flexible-array member · 5de3a238
      Gustavo A. R. Silva 提交于
      The current codebase makes use of the zero-length array language
      extension to the C90 standard, but the preferred mechanism to declare
      variable-length types such as these ones is a flexible array member[1][2],
      introduced in C99:
      
      struct foo {
              int stuff;
              struct boo array[];
      };
      
      By making use of the mechanism above, we will get a compiler warning
      in case the flexible array does not occur last in the structure, which
      will help us prevent some kind of undefined behavior bugs from being
      inadvertently introduced[3] to the codebase from now on.
      
      Also, notice that, dynamic memory allocations won't be affected by
      this change:
      
      "Flexible array members have incomplete type, and so the sizeof operator
      may not be applied. As a quirk of the original implementation of
      zero-length arrays, sizeof evaluates to zero."[1]
      
      This issue was found with the help of Coccinelle.
      
      [1] https://gcc.gnu.org/onlinedocs/gcc/Zero-Length.html
      [2] https://github.com/KSPP/linux/issues/21
      [3] commit 76497732 ("cxgb3/l2t: Fix undefined behaviour")
      Signed-off-by: NGustavo A. R. Silva <gustavo@embeddedor.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      5de3a238
    • D
      Merge branch 'mlxsw-Offload-FIFO' · 63490217
      David S. Miller 提交于
      Ido Schimmel says:
      
      ====================
      mlxsw: Offload FIFO
      
      Petr says:
      
      If an ETS or PRIO band contains an offloaded qdisc, it is possible to
      obtain offloaded counters for that band. However, some of the bands will
      likely simply contain the default invisible FIFO qdisc, which does not
      present the counters.
      
      To remedy this situation, make FIFO offloadable, and offload it by mlxsw
      when below PRIO and ETS for the sole purpose of providing counters for the
      bands that do not include other qdiscs.
      
      - In patch #1, FIFO is extended to support offloading.
      - Patches #2 and #3 restructure bits of mlxsw to facilitate
        the offload logic.
      - Patch #4 then implements the offload itself.
      - Patch #5 changes the ETS selftest to use the new counters.
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      63490217
    • P
      selftests: forwarding: ETS: Use Qdisc counters · b9b72999
      Petr Machata 提交于
      Currently the SW-datapath ETS selftests use "ip link" stats to obtain the
      number of packets that went through a given band. mlxsw then uses ethtool
      per-priority counters.
      
      Instead, change both to use qdiscs. In SW datapath this is the obvious
      choice, and now that mlxsw offloads FIFO, this should work on the offloaded
      datapath as well. This has the effect of verifying that the FIFO offload
      works.
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b9b72999
    • P
      mlxsw: spectrum_qdisc: Support offloading of FIFO Qdisc · 7bec1a45
      Petr Machata 提交于
      There are two peculiarities about offloading FIFO:
      
      - sometimes the qdisc has an unspecified handle (it is "invisible")
      - it may be created before the qdisc that it will be a child of
      
      These features make the offload a bit more tricky. The approach chosen in
      this patch is to make note of all the FIFOs that needed to be rejected
      because their parents were not known. Later when the parent is created,
      they are offloaded
      
      FIFO is only offloaded for its counters, queue length is ignored.
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7bec1a45
    • P
      mlxsw: spectrum_qdisc: Add handle parameter to ..._ops.replace · c4e372e2
      Petr Machata 提交于
      PRIO and ETS will need to check the value of qdisc handle in their
      handlers. Add it to the callback and propagate through.
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      c4e372e2
    • P
      mlxsw: spectrum_qdisc: Introduce struct mlxsw_sp_qdisc_state · ee88450d
      Petr Machata 提交于
      In order to have a tidy structure where to put information related to Qdisc
      offloads, introduce a new structure. Move there the two existing pieces of
      data: root_qdisc and tclass_qdiscs. Embed them directly, because there's no
      reason to go through pointer anymore. Convert users, update init/fini
      functions.
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      ee88450d
    • P
      net: sched: Make FIFO Qdisc offloadable · aaca9408
      Petr Machata 提交于
      Invoke ndo_setup_tc() as appropriate to signal init / replacement,
      destroying and dumping of pFIFO / bFIFO Qdisc.
      
      A lot of the FIFO logic is used for pFIFO_head_drop as well, but that's a
      semantically very different Qdisc that isn't really in the same boat as
      pFIFO / bFIFO. Split some of the functions to keep the Qdisc intact.
      Signed-off-by: NPetr Machata <petrm@mellanox.com>
      Signed-off-by: NIdo Schimmel <idosch@mellanox.com>
      Acked-by: NJiri Pirko <jiri@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      aaca9408
    • D
      Merge branch 'ethtool-consolidate-parameter-checking-for-irq-coalescing' · f3588909
      David S. Miller 提交于
      Jakub Kicinski says:
      
      ====================
      ethtool: consolidate parameter checking for irq coalescing
      
      This set aims to simplify and unify the unsupported irq
      coalescing parameter handling.
      
      First patch adds a bitmask which drivers should fill in
      in their ethtool_ops structs to declare which parameters
      they support. Core will then ensure that driver callback
      won't see any parameter outside of that set.
      
      This allows us to save some LoC and make sure all drivers
      respond the same to unsupported parameters.
      
      If any parameter driver does not support is set to a value
      other than 0 core will return -EINVAL. In the future we can
      reject any present but unsupported netlink attribute, without
      assuming 0 means unset. We can also add some prints or extack,
      perhaps a'la Intel's current code.
      
      I started converting the drivers alphabetically but then
      realized that for the first set it's probably best to
      address a representative mix of actively developed drivers.
      
      According to my unreliable math there are roughly 69 drivers
      in the tree which support some form of interrupt coalescing
      settings via ethtool. Of these roughly 17 reject parameters
      they don't support.
      
      I hope drivers which ignore the parameters don't care, and
      won't care about the slight change in behavior. Once all
      drivers are converted we can make the checking mandatory.
      
      I've only tested the e1000e and virtio patches, the rest builds.
      
      v2: fix up ice and virtio conversions
      v3: (patch 1)
          - move the (temporary) check if driver defines types
            earlier (Michal)
          - rename used_types -> nonzero_params, and
            coalesce_types -> supported_coalesce_params (Alex)
          - use EOPNOTSUPP instead of EINVAL (Andrew, Michal)
      ====================
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f3588909
    • J
      virtio_net: reject unsupported coalescing params · a51e5206
      Jakub Kicinski 提交于
      Set ethtool_ops->supported_coalesce_params to let
      the core reject unsupported coalescing parameters.
      
      This driver correctly rejects all unsupported parameters.
      As a side effect of these changes the error code for
      unsupported params changes from EINVAL to EOPNOTSUPP.
      
      v2: correctly handle rx-frames (and adjust the commit msg)
      v3: adjust commit message for new error code and member name
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a51e5206
    • J
      e1000e: reject unsupported coalescing params · f9f12f57
      Jakub Kicinski 提交于
      Set ethtool_ops->supported_coalesce_params to let
      the core reject unsupported coalescing parameters.
      
      This driver did not previously reject unsupported parameters.
      
      v3: adjust commit message for new member name
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Acked-by: NJeff Kirsher <jeffrey.t.kirsher@intel.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f9f12f57
    • J
      mlx5: reject unsupported coalescing params · 55808762
      Jakub Kicinski 提交于
      Set ethtool_ops->supported_coalesce_params to let
      the core reject unsupported coalescing parameters.
      
      This driver did not previously reject unsupported parameters.
      
      v3: adjust commit message for new member name
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Acked-by: NSaeed Mahameed <saeedm@mellanox.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      55808762
    • J
      bnxt: reject unsupported coalescing params · f704d243
      Jakub Kicinski 提交于
      Set ethtool_ops->supported_coalesce_params to let
      the core reject unsupported coalescing parameters.
      
      This driver did not previously reject unsupported parameters.
      
      v3: adjust commit message for new member name
      Signed-off-by: NJakub Kicinski <kuba@kernel.org>
      Reviewed-by: NMichael Chan <michael.chan@broadcom.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      f704d243