1. 10 Jan, 2018 1 commit
    • Lukas Wunner's avatar
      Bluetooth: hci_bcm: Mandate presence of shutdown and device wake GPIO · 3e81a4ca
      Lukas Wunner authored
      Commit 0395ffc1 ("Bluetooth: hci_bcm: Add PM for BCM devices")
      amended this driver to request a shutdown and device wake GPIO on probe,
      but mandated that only one of them need to be present:
      
      	/* Make sure at-least one of the GPIO is defined and that
      	 * a name is specified for this instance
      	 */
      	if ((!dev->device_wakeup && !dev->shutdown) || !dev->name) {
      		dev_err(&pdev->dev, "invalid platform data\n");
      		return -EINVAL;
      	}
      
      However the same commit added a call to bcm_gpio_set_power() to the
      ->probe hook, which unconditionally accesses *both* GPIOs.  Luckily,
      the resulting NULL pointer deref was never reported, suggesting there's
      no machine where either GPIO is missing.
      
      Commit 8a920568 ("Bluetooth: hci_bcm: Add (runtime)pm support to the
      serdev driver") removed the check whether at least one of the GPIOs is
      present without specifying a reason.
      
      Because commit 62aaefa7 ("Bluetooth: hci_bcm: improve use of gpios
      API") refactored the driver to use devm_gpiod_get_optional() instead of
      devm_gpiod_get(), one is now tempted to believe that the driver doesn't
      require *any* of the two GPIOs.
      
      Which is wrong, the driver still requires both GPIOs to avoid a NULL
      pointer deref.  To this end, establish the status quo ante and request
      the GPIOs with devm_gpiod_get() again.  Bail out of ->probe if either
      of them is missing.
      
      Oddly enough, whereas bcm_gpio_set_power() accesses the device wake pin
      unconditionally, bcm_suspend_device() and bcm_resume_device() do check
      for its presence before accessing it.  Those checks are superfluous,
      so remove them.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Cc: Loic Poulain <loic.poulain@linaro.org>
      Cc: Hans de Goede <hdegoede@redhat.com>
      Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
      Cc: Linus Walleij <linus.walleij@linaro.org>
      Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      3e81a4ca
  2. 08 Jan, 2018 6 commits
    • Hans de Goede's avatar
      Bluetooth: btusb: Restore QCA Rome suspend/resume fix with a "rewritten" version · 61f5acea
      Hans de Goede authored
      Commit 7d06d589 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"")
      removed the setting of the BTUSB_RESET_RESUME quirk for QCA Rome devices,
      instead favoring adding USB_QUIRK_RESET_RESUME quirks in usb/core/quirks.c.
      
      This was done because the DIY BTUSB_RESET_RESUME reset-resume handling
      has several issues (see the original commit message). An added advantage
      of moving over to the USB-core reset-resume handling is that it also
      disables autosuspend for these devices, which is similarly broken on these.
      
      But there are 2 issues with this approach:
      1) It leaves the broken DIY BTUSB_RESET_RESUME code in place for Realtek
         devices.
      2) Sofar only 2 of the 10 QCA devices known to the btusb code have been
         added to usb/core/quirks.c and if we fix the Realtek case the same way
         we need to add an additional 14 entries. So in essence we need to
         duplicate a large part of the usb_device_id table in btusb.c in
         usb/core/quirks.c and manually keep them in sync.
      
      This commit instead restores setting a reset-resume quirk for QCA devices
      in the btusb.c code, avoiding the duplicate usb_device_id table problem.
      
      This commit avoids the problems with the original DIY BTUSB_RESET_RESUME
      code by simply setting the USB_QUIRK_RESET_RESUME quirk directly on the
      usb_device.
      
      This commit also moves the BTUSB_REALTEK case over to directly setting the
      USB_QUIRK_RESET_RESUME on the usb_device and removes the now unused
      BTUSB_RESET_RESUME code.
      
      BugLink: https://bugzilla.redhat.com/show_bug.cgi?id=1514836
      Fixes: 7d06d589 ("Revert "Bluetooth: btusb: fix QCA...suspend/resume"")
      Cc: stable@vger.kernel.org
      Cc: Leif Liddy <leif.linux@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Brian Norris <briannorris@chromium.org>
      Cc: Daniel Drake <drake@endlessm.com>
      Cc: Kai-Heng Feng <kai.heng.feng@canonical.com>
      Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      61f5acea
    • Colin Ian King's avatar
      Bluetooth: btintel: make array 'param' static, shrinks object size · 948c7ca0
      Colin Ian King authored
      Don't populate the const read-only array 'param' on the stack but instead
      make it static. Makes the object code smaller by nearly 20 bytes:
      
      Before:
         text	   data	    bss	    dec	    hex	filename
        11605	   2629	     64	  14298	   37da	linux/drivers/bluetooth/btintel.o
      
      After:
         text	   data	    bss	    dec	    hex	filename
        11531	   2685	     64	  14280	   37c8	linux/drivers/bluetooth/btintel.o
      
      (gcc version 7.2.0 x86_64)
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      948c7ca0
    • Colin Ian King's avatar
      Bluetooth: bpa10x: make array 'req' static, shrinks object size · cca32837
      Colin Ian King authored
      Don't populate the const read-only array 'req' on the stack but instead
      make it static. Makes the object code smaller by over 40 bytes:
      
      Before:
         text	   data	    bss	    dec	    hex	filename
         8497	   3408	    128	  12033	   2f01	linux/drivers/bluetooth/bpa10x.o
      
      After:
         text	   data	    bss	    dec	    hex	filename
         8366	   3496	    128	  11990	   2ed6	linux/drivers/bluetooth/bpa10x.o
      
      (gcc version 7.2.0 x86_64)
      Signed-off-by: default avatarColin Ian King <colin.king@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      cca32837
    • Lukas Wunner's avatar
      Bluetooth: Depend on rather than select GPIOLIB · a3a446c7
      Lukas Wunner authored
      Commit 27378f4c ("Bluetooth: Avoid WARN splat due to missing
      GPIOLIB") amended Kconfig to select GPIOLIB if BT_HCIUART_NOKIA,
      BT_HCIUART_INTEL or BT_HCIUART_BCM is enabled since all three drivers
      require it to function.
      
      The diagnosis was correct but the treatment was not.  As stated in
      Documentation/gpio/consumer.txt:
      
          Guidelines for GPIOs consumers
          ==============================
      
          Drivers that can't work without standard GPIO calls should have
          Kconfig entries that depend on GPIOLIB.
                               ^^^^^^^^^
      Fix it.
      Reported-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      a3a446c7
    • Arnd Bergmann's avatar
      Bluetooth: hciuart: add nvmem dependency · b71b25fe
      Arnd Bergmann authored
      When the hci support is built-in, but mvmem is a loadable module, we
      get a link failure:
      
      drivers/bluetooth/hci_ll.o: In function `hci_ti_probe':
      hci_ll.c:(.text+0x226): undefined reference to `nvmem_cell_get'
      hci_ll.c:(.text+0x238): undefined reference to `nvmem_cell_read'
      hci_ll.c:(.text+0x244): undefined reference to `nvmem_cell_put'
      
      This adds another Kconfig dependency to enforce valid configurations.
      
      Fixes: 0e58d0cd ("Bluetooth: hci_ll: Add optional nvmem BD address source")
      Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      b71b25fe
    • AceLan Kao's avatar
      Bluetooth: btusb: Add support for 0cf3:e010 · e5a49ee9
      AceLan Kao authored
      Device 0cf3:e010 is one of the QCA ROME family.
      
      T:  Bus=01 Lev=01 Prnt=01 Port=13 Cnt=03 Dev#=  4 Spd=12  MxCh= 0
      D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
      P:  Vendor=0cf3 ProdID=e010 Rev=00.01
      C:  #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
      I:  If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      I:  If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
      Signed-off-by: default avatarAceLan Kao <acelan.kao@canonical.com>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      e5a49ee9
  3. 26 Dec, 2017 8 commits
    • Kai-Heng Feng's avatar
      Revert "Bluetooth: btusb: fix QCA Rome suspend/resume" · 7d06d589
      Kai-Heng Feng authored
      This reverts commit fd865802.
      
      This commit causes a regression on some QCA ROME chips. The USB device
      reset happens in btusb_open(), hence firmware loading gets interrupted.
      
      Furthermore, this commit stops working after commit
      ("a0085f25 Bluetooth: btusb: driver to
      enable the usb-wakeup feature"). Reset-resume quirk only gets enabled in
      btusb_suspend() when it's not a wakeup source.
      
      If we really want to reset the USB device, we need to do it before
      btusb_open(). Let's handle it in drivers/usb/core/quirks.c.
      
      Cc: stable@vger.kernel.org
      Cc: Leif Liddy <leif.linux@gmail.com>
      Cc: Matthias Kaehlcke <mka@chromium.org>
      Cc: Brian Norris <briannorris@chromium.org>
      Cc: Daniel Drake <drake@endlessm.com>
      Signed-off-by: default avatarKai-Heng Feng <kai.heng.feng@canonical.com>
      Reviewed-by: default avatarBrian Norris <briannorris@chromium.org>
      Tested-by: default avatarBrian Norris <briannorris@chromium.org>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      7d06d589
    • Lukas Wunner's avatar
      Bluetooth: hci_bcm: Streamline runtime PM code · 43fff768
      Lukas Wunner authored
      This driver seeks to force the Bluetooth device on for the duration of
      5 seconds when the Bluetooth device has woken the host and after a
      complete packet has been received.  It does that by calling:
      
          pm_runtime_get();
          pm_runtime_mark_last_busy();
          pm_runtime_put_autosuspend();
      
      The same can be achieved more succinctly with:
      
          pm_request_resume();
      
      That's because after runtime resuming the device, rpm_resume() invokes
      pm_runtime_mark_last_busy() followed by rpm_idle(), which will cause
      the device to be suspended after expiration of the autosuspend_delay.
      
      No functional change intended.
      
      Cc: Frédéric Danis <frederic.danis.oss@gmail.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      43fff768
    • Lukas Wunner's avatar
      Bluetooth: Avoid WARN splat due to missing GPIOLIB · 27378f4c
      Lukas Wunner authored
      Loading hci_bcm with CONFIG_GPIOLIB=n results in the following splat
      when calling gpiod_to_irq() from bcm_get_resources():
      
          WARNING: CPU: 0 PID: 1006 at ./include/linux/gpio/consumer.h:450 bcm_get_resources+0x50/0x80
          CPU: 0 PID: 1006 Comm: kworker/u8:4 Tainted: G       A         4.15.0-rc4custom+ #4
          Hardware name: Apple Inc. MacBook8,1/Mac-BE0E8AC46FE800CC, BIOS MB81.88Z.0168.B00.1708080033 08/08/2017
          Call Trace:
          bcm_serdev_probe+0x8b/0xc0
          driver_probe_device+0x202/0x310
          __driver_attach+0x85/0x90
          ? driver_probe_device+0x310/0x310
          bus_for_each_dev+0x57/0x80
          async_run_entry_fn+0x2c/0xd0
          process_one_work+0x1d2/0x3d0
          worker_thread+0x26/0x3c0
          ? process_one_work+0x3d0/0x3d0
          kthread+0x10c/0x130
          ? kthread_create_on_node+0x40/0x40
          ret_from_fork+0x1f/0x30
      
      We could call gpiod_to_irq() only if IS_ENABLED(CONFIG_GPIOLIB) but
      without GPIOLIB, the driver's power saving features can't be used,
      so selecting GPIOLIB seems more appropriate.
      
      The same issue is present in hci_intel.c and hci_nokia.c, fix those up
      as well.
      Reported-by: default avatarMax Shavrick <mxms@me.com>
      Signed-off-by: default avatarLukas Wunner <lukas@wunner.de>
      Signed-off-by: default avatarMarcel Holtmann <marcel@holtmann.org>
      27378f4c
    • Ioan Moldovan's avatar
      Bluetooth: Add a new 04ca:3015 QCA_ROME device · 0a03f98b
      Ioan Moldovan authored
      This patch adds the 04ca:3015 (from a QCA9377 board) Bluetooth device
      to the btusb blacklist and makes the kernel use the btqca module
      instead of btusb. The patch is necessary because, without it the
      04ca:3015 device defaults to using the btusb driver, which makes the
      WIFI side of the QCA9377 board unusable (obtains 0 MBps in speedtest,
      when the 04ca:3015 bluetooth is used with an audio headset).
      
      /sys/kernel/debug/usb/devices:
      
          T:  Bus=01 Lev=01 Prnt=01 Port=04 Cnt=01 Dev#=  2 Spd=12   MxCh= 0
          D:  Ver= 2.01 Cls=e0(wlcon) Sub=01 Prot=01 MxPS=64 #Cfgs=  1
          P:  Vendor=04ca ProdID=3015 Rev= 0.01
          C:* #Ifs= 2 Cfg#= 1 Atr=e0 MxPwr=100mA
          I:* If#= 0 Alt= 0 #EPs= 3 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=81(I) Atr=03(Int.) MxPS=  16 Ivl=1ms
          E:  Ad=82(I) Atr=02(Bulk) MxPS=  64 Ivl=0ms
          E:  Ad=02(O) Atr=02(Bulk) MxPS=  64 Ivl=0ms
          I:* If#= 1 Alt= 0 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=83(I) Atr=01(Isoc) MxPS=   0 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=   0 Ivl=1ms
          I:  If#= 1 Alt= 1 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=83(I) Atr=01(Isoc) MxPS=   9 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=   9 Ivl=1ms
          I:  If#= 1 Alt= 2 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=83(I) Atr=01(Isoc) MxPS=  17 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=  17 Ivl=1ms
          I:  If#= 1 Alt= 3 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=83(I) Atr=01(Isoc) MxPS=  25 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=  25 Ivl=1ms
          I:  If#= 1 Alt= 4 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=83(I) Atr=01(Isoc) MxPS=  33 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=  33 Ivl=1ms
          I:  If#= 1 Alt= 5 #EPs= 2 Cls=e0(wlcon) Sub=01 Prot=01 Driver=btusb
          E:  Ad=83(I) Atr=01(Isoc) MxPS=  49 Ivl=1ms
          E:  Ad=03(O) Atr=01(Isoc) MxPS=  49 Ivl=1ms
      Signed-off-by: default avatarIoan Moldovan <ioan.moldovan1999@gmail.com>
      Signed-off-by: default avatarJohan Hedberg <johan.hedberg@intel.com>
      0a03f98b
    • Govindarajulu Varadarajan's avatar
      enic: add wq clean up budget · 18feb871
      Govindarajulu Varadarajan authored
      In case of tx clean up, we set '-1' as budget. This means clean up until
      wq is empty or till (1 << 32) pkts are cleaned. Under heavy load this
      will run for long time and cause
      "watchdog: BUG: soft lockup - CPU#25 stuck for 21s!" warning.
      
      This patch sets wq clean up budget to 256.
      Signed-off-by: default avatarGovindarajulu Varadarajan <gvaradar@cisco.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      18feb871
    • Leon Romanovsky's avatar
      rtnetlink: Replace implementation of ASSERT_RTNL() macro with WARN_ONCE() · 66364bdf
      Leon Romanovsky authored
      ASSERT_RTNL() macro is actual open-coded variant of WARN_ONCE() with
      two exceptions. First, it prints stack for multiple hits and not only
      once as WARN_ONCE() does. Second, the user can disable prints of
      WARN_ONCE by setting CONFIG_BUG to N.
      
      The multiple prints of dump stack are actually not needed, because calls
      without rtnl lock are programming errors and user can't do anything
      about them except to complain to the mailing list after first occurrence
      of such failure.
      
      The user who disabled BUG/WARN prints did it explicitly because by default
      in upstream kernel and distributions this option is enabled. It means
      that user doesn't want to see prints about missing locks too.
      
      This patch replaces open-coded variant in favor of already existing
      macro and change error prints to be once only.
      Reviewed-by: default avatarMark Bloch <markb@mellanox.com>
      Signed-off-by: default avatarLeon Romanovsky <leonro@mellanox.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      66364bdf
    • Sean Wang's avatar
      net: mediatek: remove superfluous pin setup for MT7622 SoC · 243dc5fb
      Sean Wang authored
      Remove superfluous pin setup to get out of accessing invalid I/O pin
      registers because the way for pin configuring tends to be different from
      various SoCs and thus it should be better being managed and controlled by
      the pinctrl driver which MT7622 already can support.
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      243dc5fb
    • Sean Wang's avatar
      dt-bindings: net: mediatek: add condition to property mediatek, pctl · 0ca30e87
      Sean Wang authored
      The property "mediatek,pctl" is only required for SoCs such as MT2701 and
      MT7623, so adding a few words for stating the condition.
      Signed-off-by: default avatarSean Wang <sean.wang@mediatek.com>
      Reviewed-by: default avatarRob Herring <robh@kernel.org>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0ca30e87
  4. 22 Dec, 2017 1 commit
  5. 21 Dec, 2017 24 commits
    • Linus Torvalds's avatar
      Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net · ead68f21
      Linus Torvalds authored
      Pull networking fixes from David Miller"
       "What's a holiday weekend without some networking bug fixes? [1]
      
         1) Fix some eBPF JIT bugs wrt. SKB pointers across helper function
            calls, from Daniel Borkmann.
      
         2) Fix regression from errata limiting change to marvell PHY driver,
            from Zhao Qiang.
      
         3) Fix u16 overflow in SCTP, from Xin Long.
      
         4) Fix potential memory leak during bridge newlink, from Nikolay
            Aleksandrov.
      
         5) Fix BPF selftest build on s390, from Hendrik Brueckner.
      
         6) Don't append to cfg80211 automatically generated certs file,
            always write new ones from scratch. From Thierry Reding.
      
         7) Fix sleep in atomic in mac80211 hwsim, from Jia-Ju Bai.
      
         8) Fix hang on tg3 MTU change with certain chips, from Brian King.
      
         9) Add stall detection to arc emac driver and reset chip when this
            happens, from Alexander Kochetkov.
      
        10) Fix MTU limitng in GRE tunnel drivers, from Xin Long.
      
        11) Fix stmmac timestamping bug due to mis-shifting of field. From
            Fredrik Hallenberg.
      
        12) Fix metrics match when deleting an ipv4 route. The kernel sets
            some internal metrics bits which the user isn't going to set when
            it makes the delete request. From Phil Sutter.
      
        13) mvneta driver loop over RX queues limits on "txq_number" :-) Fix
            from Yelena Krivosheev.
      
        14) Fix double free and memory corruption in get_net_ns_by_id, from
            Eric W. Biederman.
      
        15) Flush ipv4 FIB tables in the reverse order. Some tables can share
            their actual backing data, in particular this happens for the MAIN
            and LOCAL tables. We have to kill the LOCAL table first, because
            it uses MAIN's backing memory. Fix from Ido Schimmel.
      
        16) Several eBPF verifier value tracking fixes, from Edward Cree, Jann
            Horn, and Alexei Starovoitov.
      
        17) Make changes to ipv6 autoflowlabel sysctl really propagate to
            sockets, unless the socket has set the per-socket value
            explicitly. From Shaohua Li.
      
        18) Fix leaks and double callback invocations of zerocopy SKBs, from
            Willem de Bruijn"
      
      [1] Is this a trick question? "Relaxing"? "Quiet"? "Fine"? - Linus.
      
      * git://git.kernel.org/pub/scm/linux/kernel/git/davem/net: (77 commits)
        skbuff: skb_copy_ubufs must release uarg even without user frags
        skbuff: orphan frags before zerocopy clone
        net: reevalulate autoflowlabel setting after sysctl setting
        openvswitch: Fix pop_vlan action for double tagged frames
        ipv6: Honor specified parameters in fibmatch lookup
        bpf: do not allow root to mangle valid pointers
        selftests/bpf: add tests for recent bugfixes
        bpf: fix integer overflows
        bpf: don't prune branches when a scalar is replaced with a pointer
        bpf: force strict alignment checks for stack pointers
        bpf: fix missing error return in check_stack_boundary()
        bpf: fix 32-bit ALU op verification
        bpf: fix incorrect tracking of register size truncation
        bpf: fix incorrect sign extension in check_alu_op()
        bpf/verifier: fix bounds calculation on BPF_RSH
        ipv4: Fix use-after-free when flushing FIB tables
        s390/qeth: fix error handling in checksum cmd callback
        tipc: remove joining group member from congested list
        selftests: net: Adding config fragment CONFIG_NUMA=y
        nfp: bpf: keep track of the offloaded program
        ...
      ead68f21
    • David S. Miller's avatar
      Merge branch 'flow_dissector-Provide-basic-batman-adv-unicast-handling' · 0a80f0c2
      David S. Miller authored
      Sven Eckelmann says:
      
      ====================
      flow_dissector: Provide basic batman-adv unicast handling
      
      we are currently starting to use batman-adv as mesh protocol on multicore
      embedded devices. These usually don't have a lot of CPU power per core but
      are reasonable fast when using multiple cores.
      
      It was noticed that sending was working very well but receiving was
      basically only using on CPU core per neighbor. The reason for that is
      format of the (normal) incoming packet:
      
        +--------------------+
        | ip(v6)hdr          |
        +--------------------+
        | inner ethhdr       |
        +--------------------+
        | batadv unicast hdr |
        +--------------------+
        | outer ethhdr       |
        +--------------------+
      
      The flow dissector will therefore stop after parsing the outer ethernet
      header and will not parse the actual ipv(4|6)/... header of the packet. Our
      assumption was now that it would help us to add minimal support to the flow
      dissector to jump over the batman-adv unicast and inner ethernet header
      (like in gre ETH_P_TEB). The patch was implemented in a slightly hacky
      way [1] and the results looked quite promising.
      
      I didn't get any feedback how the files should actually be named. So I am
      now just using the names from RFC v3
      
      The discussion of the RFC v3 can be found in the related patches of
      https://patchwork.ozlabs.org/cover/849345/
      
      The discussion of the RFC v2 can be found in the related patches of
      https://patchwork.ozlabs.org/cover/844783/
      
      Changes in v4:
      ==============
      
      * added  patch to change the u8/u16 to __u8/__u16 in
        include/uapi/linux/batadv_packet.h
        - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
      
      Changes in v3:
      ==============
      
      * removed change of uapi/linux/batman_adv.h to uapi/linux/batadv_genl.h
        - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
      * removed naming fixes for enums/defines in uapi/linux/batadv_genl.h
        - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
      * renamed uapi/linux/batadv.h to uapi/linux/batadv_packet.h
      * moved batadv dissector functionality in own function
        - requested by Tom Herbert <tom@herbertland.com>
      * added support for flags FLOW_DISSECTOR_F_STOP_AT_ENCAP and
        FLOW_DIS_ENCAPSULATION
        - requested by Willem de Bruijn <willemdebruijn.kernel@gmail.com>
      
      Changes in v2:
      ==============
      
      * removed the batman-adv unicast packet header definition from flow_dissector.c
      * moved the batman-adv packet.h/uapi headers around to provide the correct
        definitions to flow_dissector.c
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      0a80f0c2
    • Sven Eckelmann's avatar
      flow_dissector: Parse batman-adv unicast headers · 5b0890a9
      Sven Eckelmann authored
      The batman-adv unicast packets contain a full layer 2 frame in encapsulated
      form. The flow dissector must therefore be able to parse the batman-adv
      unicast header to reach the layer 2+3 information.
      
        +--------------------+
        | ip(v6)hdr          |
        +--------------------+
        | inner ethhdr       |
        +--------------------+
        | batadv unicast hdr |
        +--------------------+
        | outer ethhdr       |
        +--------------------+
      
      The obtained information from the upper layer can then be used by RPS to
      schedule the processing on separate cores. This allows better distribution
      of multiple flows from the same neighbor to different cores.
      Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@openmesh.com>
      Reviewed-by: default avatarJiri Pirko <jiri@mellanox.com>
      Acked-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      5b0890a9
    • Sven Eckelmann's avatar
      batman-adv: Convert packet.h to uapi header · fec149f5
      Sven Eckelmann authored
      The header file is used by different userspace programs to inject packets
      or to decode sniffed packets. It should therefore be available to them as
      userspace header.
      
      Also other components in the kernel (like the flow dissector) require
      access to the packet definitions to be able to decode ETH_P_BATMAN ethernet
      packets.
      Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@openmesh.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fec149f5
    • Sven Eckelmann's avatar
      batman-adv: Remove kernel fixed width types in packet.h · adbf9b73
      Sven Eckelmann authored
      The uapi headers use the __u8/__u16/... version of the fixed width types
      instead of u8/u16/... The use of the latter must be avoided before
      packet.h is copied to include/uapi/linux/.
      Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@openmesh.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      adbf9b73
    • Sven Eckelmann's avatar
      batman-adv: Remove usage of BIT(x) in packet.h · a6cb82b5
      Sven Eckelmann authored
      The BIT(x) macro is no longer available for uapi headers because it is
      defined outside of it (linux/bitops.h). The use of it must therefore be
      avoided and replaced by an appropriate other representation.
      Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@openmesh.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a6cb82b5
    • Sven Eckelmann's avatar
      batman-adv: Let packet.h include its headers directly · 4e58452b
      Sven Eckelmann authored
      The headers used by packet.h should also be included by it directly. main.h
      is currently dealing with it in batman-adv, but this will no longer work
      when this header is moved to include/uapi/linux/.
      Signed-off-by: default avatarSven Eckelmann <sven.eckelmann@openmesh.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      4e58452b
    • David S. Miller's avatar
      Merge branch 'sfc-Medford2' · a0e2e75a
      David S. Miller authored
      Bert Kenward says:
      
      ====================
      sfc: support extra stats on Medford2
      
      X2000-series NICs add port stats for two new features: FEC (Forward Error
       Correction, used on 25G links) and CTPIO (cut-through programmed I/O).
      This patch series adds support for reporting both of these sets of stats
      
      v2: add additional Signed-off-by
      ====================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      a0e2e75a
    • Bert Kenward's avatar
      sfc: expose CTPIO stats on NICs that support them · 2c0b6ee8
      Bert Kenward authored
      While the Linux driver doesn't use CTPIO ('cut-through programmed I/O'),
       other drivers on the same port might, so if we're responsible for
       reporting per-port stats we need to include the CTPIO stats.
      Signed-off-by: default avatarBert Kenward <bkenward@solarflare.com>
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      2c0b6ee8
    • Edward Cree's avatar
      sfc: expose FEC stats on Medford2 · f411b54d
      Edward Cree authored
      There's no explicit capability bit, so we just condition them on having
       efx->num_mac_stats >= MC_CMD_MAC_NSTATS_V2.
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarBert Kenward <bkenward@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      f411b54d
    • Edward Cree's avatar
      sfc: support variable number of MAC stats · c1be4821
      Edward Cree authored
      Medford2 NICs support more than MC_CMD_MAC_NSTATS stats, and report the new
       count in a field of MC_CMD_GET_CAPABILITIES_V4.  This also means that the
       end generation count moves (it is, as before, the last 64 bits of the DMA
       buffer, but that is no longer MC_CMD_MAC_GENERATION_END).
      So read num_mac_stats from the GET_CAPABILITIES response, if present;
       otherwise assume MC_CMD_MAC_NSTATS; and always use num_mac_stats - 1 rather
       than MC_CMD_MAC_GENERATION_END.
      Signed-off-by: default avatarEdward Cree <ecree@solarflare.com>
      Signed-off-by: default avatarBert Kenward <bkenward@solarflare.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c1be4821
    • Edward Cree's avatar
      d31a5966
    • Ganesh Goudar's avatar
      cxgb4: add new T5 and T6 device id's · 6baa13df
      Ganesh Goudar authored
      Add device id's 0x50ac, 0x6087 for T5 and T6 cards
      respectively.
      Signed-off-by: default avatarGanesh Goudar <ganeshgr@chelsio.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      6baa13df
    • Jie Deng's avatar
      net: dwc-xlgmac: Get rid of custom hex_dump_to_buffer() · 42afa0f8
      Jie Deng authored
      Get rid of custom hex_dump_to_buffer().
      
      The output is slightly changed, i.e. each byte followed by white space.
      
      Note, we don't use print_hex_dump() here since the original code uses
      nedev_dbg().
      Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
      Signed-off-by: default avatarJie Deng <jiedeng@synopsys.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      42afa0f8
    • Russell King's avatar
      phylink: avoid attaching more than one PHY · fe1c3ef2
      Russell King authored
      Attaching more than one PHY to phylink is bad news, as we store a
      pointer to the PHY in a single location. Error out if more than one
      PHY is attempted to be attached.
      Signed-off-by: default avatarRussell King <rmk+kernel@armlinux.org.uk>
      Reviewed-by: default avatarAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      fe1c3ef2
    • David S. Miller's avatar
      Merge branch 'net-zerocopy-fixes' · c50b7c47
      David S. Miller authored
      Saeed Mahameed says:
      
      ===================
      Mellanox, mlx5 fixes 2017-12-19
      
      The follwoing series includes some fixes for mlx5 core and etherent
      driver.
      
      Please pull and let me know if there is any problem.
      
      This series doesn't introduce any conflict with the ongoing mlx5 for-next
      submission.
      
      For -stable:
      
      kernels >= v4.7.y
          ("net/mlx5e: Fix possible deadlock of VXLAN lock")
          ("net/mlx5e: Add refcount to VXLAN structure")
          ("net/mlx5e: Prevent possible races in VXLAN control flow")
          ("net/mlx5e: Fix features check of IPv6 traffic")
      
      kernels >= v4.9.y
          ("net/mlx5: Fix error flow in CREATE_QP command")
          ("net/mlx5: Fix rate limit packet pacing naming and struct")
      
      kernels >= v4.13.y
          ("net/mlx5: FPGA, return -EINVAL if size is zero")
      
      kernels >= v4.14.y
          ("Revert "mlx5: move affinity hints assignments to generic code")
      
      All above patches apply and compile with no issues on corresponding -stable.
      ===================
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      c50b7c47
    • Willem de Bruijn's avatar
      skbuff: skb_copy_ubufs must release uarg even without user frags · b90ddd56
      Willem de Bruijn authored
      skb_copy_ubufs creates a private copy of frags[] to release its hold
      on user frags, then calls uarg->callback to notify the owner.
      
      Call uarg->callback even when no frags exist. This edge case can
      happen when zerocopy_sg_from_iter finds enough room in skb_headlen
      to copy all the data.
      
      Fixes: 3ece7826 ("sock: skb_copy_ubufs support for compound pages")
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      b90ddd56
    • Willem de Bruijn's avatar
      skbuff: orphan frags before zerocopy clone · 268b7906
      Willem de Bruijn authored
      Call skb_zerocopy_clone after skb_orphan_frags, to avoid duplicate
      calls to skb_uarg(skb)->callback for the same data.
      
      skb_zerocopy_clone associates skb_shinfo(skb)->uarg from frag_skb
      with each segment. This is only safe for uargs that do refcounting,
      which is those that pass skb_orphan_frags without dropping their
      shared frags. For others, skb_orphan_frags drops the user frags and
      sets the uarg to NULL, after which sock_zerocopy_clone has no effect.
      
      Qemu hangs were reported due to duplicate vhost_net_zerocopy_callback
      calls for the same data causing the vhost_net_ubuf_ref_>refcount to
      drop below zero.
      
      Link: http://lkml.kernel.org/r/<CAF=yD-LWyCD4Y0aJ9O0e_CHLR+3JOeKicRRTEVCPxgw4XOcqGQ@mail.gmail.com>
      Fixes: 1f8b977a ("sock: enable MSG_ZEROCOPY")
      Reported-by: default avatarAndreas Hartmann <andihartmann@01019freenet.de>
      Reported-by: default avatarDavid Hill <dhill@redhat.com>
      Signed-off-by: default avatarWillem de Bruijn <willemb@google.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      268b7906
    • Linus Torvalds's avatar
      Merge branch 'for-linus' of git://git.kernel.dk/linux-block · 9035a896
      Linus Torvalds authored
      Pull block fixes from Jens Axboe:
       "It's been a few weeks, so here's a small collection of fixes that
        should go into the current series.
      
        This contains:
      
         - NVMe pull request from Christoph, with a few important fixes.
      
         - kyber hang fix from Omar.
      
         - A blk-throttl fix from Shaohua, fixing a case where we double
           charge a bio.
      
         - Two call_single_data alignment fixes from me, fixing up some
           unfortunate changes that went into 4.14 without being properly
           reviewed on the block side (since nobody was CC'ed on the
           patch...).
      
         - A bounce buffer fix in two parts, one from me and one from Ming.
      
         - Revert bdi debug error handling patch. It's causing boot issues for
           some folks, and a week down the line, we're still no closer to a
           fix. Revert this patch for now until it's figured out, then we can
           retry for 4.16"
      
      * 'for-linus' of git://git.kernel.dk/linux-block:
        Revert "bdi: add error handle for bdi_debug_register"
        null_blk: unalign call_single_data
        block: unalign call_single_data in struct request
        block-throttle: avoid double charge
        block: fix blk_rq_append_bio
        block: don't let passthrough IO go into .make_request_fn()
        nvme: setup streams after initializing namespace head
        nvme: check hw sectors before setting chunk sectors
        nvme: call blk_integrity_unregister after queue is cleaned up
        nvme-fc: remove double put reference if admin connect fails
        nvme: set discard_alignment to zero
        kyber: fix another domain token wait queue hang
      9035a896
    • Linus Torvalds's avatar
      Merge tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm · 409232a4
      Linus Torvalds authored
      Pull KVM fixes from Paolo Bonzini:
       "ARM fixes:
         - A bug in handling of SPE state for non-vhe systems
         - A fix for a crash on system shutdown
         - Three timer fixes, introduced by the timer optimizations for v4.15
      
        x86 fixes:
         - fix for a WARN that was introduced in 4.15
         - fix for SMM when guest uses PCID
         - fixes for several bugs found by syzkaller
      
        ... and a dozen papercut fixes for the kvm_stat tool"
      
      * tag 'for-linus' of git://git.kernel.org/pub/scm/virt/kvm/kvm: (22 commits)
        tools/kvm_stat: sort '-f help' output
        kvm: x86: fix RSM when PCID is non-zero
        KVM: Fix stack-out-of-bounds read in write_mmio
        KVM: arm/arm64: Fix timer enable flow
        KVM: arm/arm64: Properly handle arch-timer IRQs after vtimer_save_state
        KVM: arm/arm64: timer: Don't set irq as forwarded if no usable GIC
        KVM: arm/arm64: Fix HYP unmapping going off limits
        arm64: kvm: Prevent restoring stale PMSCR_EL1 for vcpu
        KVM/x86: Check input paging mode when cs.l is set
        tools/kvm_stat: add line for totals
        tools/kvm_stat: stop ignoring unhandled arguments
        tools/kvm_stat: suppress usage information on command line errors
        tools/kvm_stat: handle invalid regular expressions
        tools/kvm_stat: add hint on '-f help' to man page
        tools/kvm_stat: fix child trace events accounting
        tools/kvm_stat: fix extra handling of 'help' with fields filter
        tools/kvm_stat: fix missing field update after filter change
        tools/kvm_stat: fix drilldown in events-by-guests mode
        tools/kvm_stat: fix command line option '-g'
        kvm: x86: fix WARN due to uninitialized guest FPU state
        ...
      409232a4
    • Christian Lamparter's avatar
      net: ibm: emac: support RGMII-[RX|TX]ID phymode · 29635762
      Christian Lamparter authored
      The RGMII spec allows compliance for devices that implement an internal
      delay on TXC and/or RXC inside the transmitter. This patch adds the
      necessary RGMII_[RX|TX]ID mode code to handle such PHYs with the
      emac driver.
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      29635762
    • Christian Lamparter's avatar
      net: ibm: emac: replace custom PHY_MODE_* macros · 78b69921
      Christian Lamparter authored
      The ibm_emac driver predates the PHY_INTERFACE_MODE_*
      enums by a few years.
      
      And while the driver has been retrofitted to use the PHYLIB,
      the old definitions have stuck around to this day.
      
      This patch replaces all occurences of PHY_MODE_* with
      the respective equivalent PHY_INTERFACE_MODE_* enum.
      And finally, it purges the old macros for good.
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      78b69921
    • Christian Lamparter's avatar
      net: ibm: emac: replace custom rgmii_mode_name with phy_modes · 49dd19bf
      Christian Lamparter authored
      phy_modes() in the common phy.h already defines the same phy mode
      names in lower case. The deleted rgmii_mode_name() is used only
      in one place and for a "notice-level" printk. Hence, it will not
      be missed.
      Signed-off-by: default avatarChristian Lamparter <chunkeey@gmail.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      49dd19bf
    • Shaohua Li's avatar
      net: reevalulate autoflowlabel setting after sysctl setting · 513674b5
      Shaohua Li authored
      sysctl.ip6.auto_flowlabels is default 1. In our hosts, we set it to 2.
      If sockopt doesn't set autoflowlabel, outcome packets from the hosts are
      supposed to not include flowlabel. This is true for normal packet, but
      not for reset packet.
      
      The reason is ipv6_pinfo.autoflowlabel is set in sock creation. Later if
      we change sysctl.ip6.auto_flowlabels, the ipv6_pinfo.autoflowlabel isn't
      changed, so the sock will keep the old behavior in terms of auto
      flowlabel. Reset packet is suffering from this problem, because reset
      packet is sent from a special control socket, which is created at boot
      time. Since sysctl.ipv6.auto_flowlabels is 1 by default, the control
      socket will always have its ipv6_pinfo.autoflowlabel set, even after
      user set sysctl.ipv6.auto_flowlabels to 1, so reset packset will always
      have flowlabel. Normal sock created before sysctl setting suffers from
      the same issue. We can't even turn off autoflowlabel unless we kill all
      socks in the hosts.
      
      To fix this, if IPV6_AUTOFLOWLABEL sockopt is used, we use the
      autoflowlabel setting from user, otherwise we always call
      ip6_default_np_autolabel() which has the new settings of sysctl.
      
      Note, this changes behavior a little bit. Before commit 42240901
      (ipv6: Implement different admin modes for automatic flow labels), the
      autoflowlabel behavior of a sock isn't sticky, eg, if sysctl changes,
      existing connection will change autoflowlabel behavior. After that
      commit, autoflowlabel behavior is sticky in the whole life of the sock.
      With this patch, the behavior isn't sticky again.
      
      Cc: Martin KaFai Lau <kafai@fb.com>
      Cc: Eric Dumazet <eric.dumazet@gmail.com>
      Cc: Tom Herbert <tom@quantonium.net>
      Signed-off-by: default avatarShaohua Li <shli@fb.com>
      Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
      513674b5