1. 13 2月, 2022 2 次提交
  2. 10 1月, 2022 1 次提交
  3. 25 11月, 2021 1 次提交
  4. 28 10月, 2021 1 次提交
  5. 24 10月, 2021 2 次提交
  6. 02 10月, 2021 1 次提交
  7. 28 7月, 2021 1 次提交
    • A
      dev_ioctl: split out ndo_eth_ioctl · a7605370
      Arnd Bergmann 提交于
      Most users of ndo_do_ioctl are ethernet drivers that implement
      the MII commands SIOCGMIIPHY/SIOCGMIIREG/SIOCSMIIREG, or hardware
      timestamping with SIOCSHWTSTAMP/SIOCGHWTSTAMP.
      
      Separate these from the few drivers that use ndo_do_ioctl to
      implement SIOCBOND, SIOCBR and SIOCWANDEV commands.
      
      This is a purely cosmetic change intended to help readers find
      their way through the implementation.
      
      Cc: Doug Ledford <dledford@redhat.com>
      Cc: Jason Gunthorpe <jgg@ziepe.ca>
      Cc: Jay Vosburgh <j.vosburgh@gmail.com>
      Cc: Veaceslav Falico <vfalico@gmail.com>
      Cc: Andy Gospodarek <andy@greyhouse.net>
      Cc: Andrew Lunn <andrew@lunn.ch>
      Cc: Vivien Didelot <vivien.didelot@gmail.com>
      Cc: Florian Fainelli <f.fainelli@gmail.com>
      Cc: Vladimir Oltean <olteanv@gmail.com>
      Cc: Leon Romanovsky <leon@kernel.org>
      Cc: linux-rdma@vger.kernel.org
      Signed-off-by: NArnd Bergmann <arnd@arndb.de>
      Acked-by: NJason Gunthorpe <jgg@nvidia.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a7605370
  8. 14 4月, 2021 1 次提交
    • M
      of: net: pass the dst buffer to of_get_mac_address() · 83216e39
      Michael Walle 提交于
      of_get_mac_address() returns a "const void*" pointer to a MAC address.
      Lately, support to fetch the MAC address by an NVMEM provider was added.
      But this will only work with platform devices. It will not work with
      PCI devices (e.g. of an integrated root complex) and esp. not with DSA
      ports.
      
      There is an of_* variant of the nvmem binding which works without
      devices. The returned data of a nvmem_cell_read() has to be freed after
      use. On the other hand the return of_get_mac_address() points to some
      static data without a lifetime. The trick for now, was to allocate a
      device resource managed buffer which is then returned. This will only
      work if we have an actual device.
      
      Change it, so that the caller of of_get_mac_address() has to supply a
      buffer where the MAC address is written to. Unfortunately, this will
      touch all drivers which use the of_get_mac_address().
      
      Usually the code looks like:
      
        const char *addr;
        addr = of_get_mac_address(np);
        if (!IS_ERR(addr))
          ether_addr_copy(ndev->dev_addr, addr);
      
      This can then be simply rewritten as:
      
        of_get_mac_address(np, ndev->dev_addr);
      
      Sometimes is_valid_ether_addr() is used to test the MAC address.
      of_get_mac_address() already makes sure, it just returns a valid MAC
      address. Thus we can just test its return code. But we have to be
      careful if there are still other sources for the MAC address before the
      of_get_mac_address(). In this case we have to keep the
      is_valid_ether_addr() call.
      
      The following coccinelle patch was used to convert common cases to the
      new style. Afterwards, I've manually gone over the drivers and fixed the
      return code variable: either used a new one or if one was already
      available use that. Mansour Moufid, thanks for that coccinelle patch!
      
      <spml>
      @a@
      identifier x;
      expression y, z;
      @@
      - x = of_get_mac_address(y);
      + x = of_get_mac_address(y, z);
        <...
      - ether_addr_copy(z, x);
        ...>
      
      @@
      identifier a.x;
      @@
      - if (<+... x ...+>) {}
      
      @@
      identifier a.x;
      @@
        if (<+... x ...+>) {
            ...
        }
      - else {}
      
      @@
      identifier a.x;
      expression e;
      @@
      - if (<+... x ...+>@e)
      -     {}
      - else
      + if (!(e))
            {...}
      
      @@
      expression x, y, z;
      @@
      - x = of_get_mac_address(y, z);
      + of_get_mac_address(y, z);
        ... when != x
      </spml>
      
      All drivers, except drivers/net/ethernet/aeroflex/greth.c, were
      compile-time tested.
      Suggested-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NMichael Walle <michael@walle.cc>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      83216e39
  9. 10 4月, 2021 1 次提交
  10. 02 4月, 2021 1 次提交
  11. 06 3月, 2021 1 次提交
  12. 17 2月, 2021 2 次提交
    • S
      lan743x: sync only the received area of an rx ring buffer · 966df6de
      Sven Van Asbroeck 提交于
      On cpu architectures w/o dma cache snooping, dma_unmap() is a
      is a very expensive operation, because its resulting sync
      needs to invalidate cpu caches.
      
      Increase efficiency/performance by syncing only those sections
      of the lan743x's rx ring buffers that are actually in use.
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Reviewed-by: NBryan Whitehead <Bryan.Whitehead@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      966df6de
    • S
      lan743x: boost performance on cpu archs w/o dma cache snooping · a8db76d4
      Sven Van Asbroeck 提交于
      The buffers in the lan743x driver's receive ring are always 9K,
      even when the largest packet that can be received (the mtu) is
      much smaller. This performs particularly badly on cpu archs
      without dma cache snooping (such as ARM): each received packet
      results in a 9K dma_{map|unmap} operation, which is very expensive
      because cpu caches need to be invalidated.
      
      Careful measurement of the driver rx path on armv7 reveals that
      the cpu spends the majority of its time waiting for cache
      invalidation.
      
      Optimize by keeping the rx ring buffer size as close as possible
      to the mtu. This limits the amount of cache that requires
      invalidation.
      
      This optimization would normally force us to re-allocate all
      ring buffers when the mtu is changed - a disruptive event,
      because it can only happen when the network interface is down.
      
      Remove the need to re-allocate all ring buffers by adding support
      for multi-buffer frames. Now any combination of mtu and ring
      buffer size will work. When the mtu changes from mtu1 to mtu2,
      consumed buffers of size mtu1 are lazily replaced by newly
      allocated buffers of size mtu2.
      
      These optimizations double the rx performance on armv7.
      Third parties report 3x rx speedup on armv8.
      
      Tested with iperf3 on a freescale imx6qp + lan7430, both sides
      set to mtu 1500 bytes, measure rx performance:
      
      Before:
      [ ID] Interval           Transfer     Bandwidth       Retr
      [  4]   0.00-20.00  sec   550 MBytes   231 Mbits/sec    0
      After:
      [ ID] Interval           Transfer     Bandwidth       Retr
      [  4]   0.00-20.00  sec  1.33 GBytes   570 Mbits/sec    0
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Reviewed-by: NBryan Whitehead <Bryan.Whitehead@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a8db76d4
  13. 29 1月, 2021 1 次提交
  14. 17 12月, 2020 1 次提交
    • S
      lan743x: fix rx_napi_poll/interrupt ping-pong · 57030a0b
      Sven Van Asbroeck 提交于
      Even if there is more rx data waiting on the chip, the rx napi poll fn
      will never run more than once - it will always read a few buffers, then
      bail out and re-arm interrupts. Which results in ping-pong between napi
      and interrupt.
      
      This defeats the purpose of napi, and is bad for performance.
      
      Fix by making the rx napi poll behave identically to other ethernet
      drivers:
      1. initialize rx napi polling with an arbitrary budget (64).
      2. in the polling fn, return full weight if rx queue is not depleted,
         this tells the napi core to "keep polling".
      3. update the rx tail ("ring the doorbell") once for every 8 processed
         rx ring buffers.
      
      Thanks to Jakub Kicinski, Eric Dumazet and Andrew Lunn for their expert
      opinions and suggestions.
      
      Tested with 20 seconds of full bandwidth receive (iperf3):
              rx irqs      softirqs(NET_RX)
              -----------------------------
      before  23827        33620
      after   129          4081
      
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201215161954.5950-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      57030a0b
  15. 25 11月, 2020 2 次提交
  16. 18 11月, 2020 1 次提交
    • S
      lan743x: replace devicetree phy parse code with library function · 7c3e2b77
      Sven Van Asbroeck 提交于
      The code in this driver which parses the devicetree to determine
      the phy/fixed link setup, can be replaced by a single library
      function: of_phy_get_and_connect().
      
      Behaviour is identical, except that the library function will
      complain when 'phy-connection-type' is omitted, instead of
      blindly using PHY_INTERFACE_MODE_NA, which would result in an
      invalid phy configuration.
      
      The library function no longer brings out the exact phy_mode,
      but the driver doesn't need this, because phy_interface_is_rgmii()
      queries the phydev directly. Remove 'phy_mode' from the private
      adapter struct.
      
      While we're here, log info about the attached phy on connect,
      this is useful because the phy type and connection method is now
      fully configurable via the devicetree.
      
      Tested on a lan7430 chip with built-in phy. Verified that adding
      fixed-link/phy-connection-type in the devicetree results in a
      fixed-link setup. Used ethtool to verify that the devicetree
      settings are used.
      
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Link: https://lore.kernel.org/r/20201116170155.26967-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      7c3e2b77
  17. 15 11月, 2020 2 次提交
    • S
      lan743x: prevent entire kernel HANG on open, for some platforms · 796a2665
      Sven Van Asbroeck 提交于
      On arm imx6, when opening the chip's netdev, the whole Linux
      kernel intermittently hangs/freezes.
      
      This is caused by a bug in the driver code which tests if pcie
      interrupts are working correctly, using the software interrupt:
      
      1. open: enable the software interrupt
      2. open: tell the chip to assert the software interrupt
      3. open: wait for flag
      4. ISR: acknowledge s/w interrupt, set flag
      5. open: notice flag, disable the s/w interrupt, continue
      
      Unfortunately the ISR only acknowledges the s/w interrupt, but
      does not disable it. This will re-trigger the ISR in a tight
      loop.
      
      On some (lucky) platforms, open proceeds to disable the s/w
      interrupt even while the ISR is 'spinning'. On arm imx6,
      the spinning ISR does not allow open to proceed, resulting
      in a hung Linux kernel.
      
      Fix minimally by disabling the s/w interrupt in the ISR, which
      will prevent it from spinning. This won't break anything because
      the s/w interrupt is used as a one-shot interrupt.
      
      Note that this is a minimal fix, overlooking many possible
      cleanups, e.g.:
      - lan743x_intr_software_isr() is completely redundant and reads
        INT_STS twice for no apparent reason
      - disabling the s/w interrupt in lan743x_intr_test_isr() is now
        redundant, but harmless
      - waiting on software_isr_flag can be converted from a sleeping
        poll loop to wait_event_timeout()
      
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # arm imx6 lan7430
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201112204741.12375-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      796a2665
    • S
      lan743x: fix issue causing intermittent kernel log warnings · e35df62e
      Sven Van Asbroeck 提交于
      When running this chip on arm imx6, we intermittently observe
      the following kernel warning in the log, especially when the
      system is under high load:
      
      [   50.119484] ------------[ cut here ]------------
      [   50.124377] WARNING: CPU: 0 PID: 303 at kernel/softirq.c:169 __local_bh_enable_ip+0x100/0x184
      [   50.132925] IRQs not enabled as expected
      [   50.159250] CPU: 0 PID: 303 Comm: rngd Not tainted 5.7.8 #1
      [   50.164837] Hardware name: Freescale i.MX6 Quad/DualLite (Device Tree)
      [   50.171395] [<c0111a38>] (unwind_backtrace) from [<c010be28>] (show_stack+0x10/0x14)
      [   50.179162] [<c010be28>] (show_stack) from [<c05b9dec>] (dump_stack+0xac/0xd8)
      [   50.186408] [<c05b9dec>] (dump_stack) from [<c0122e40>] (__warn+0xd0/0x10c)
      [   50.193391] [<c0122e40>] (__warn) from [<c0123238>] (warn_slowpath_fmt+0x98/0xc4)
      [   50.200892] [<c0123238>] (warn_slowpath_fmt) from [<c012b010>] (__local_bh_enable_ip+0x100/0x184)
      [   50.209860] [<c012b010>] (__local_bh_enable_ip) from [<bf09ecbc>] (destroy_conntrack+0x48/0xd8 [nf_conntrack])
      [   50.220038] [<bf09ecbc>] (destroy_conntrack [nf_conntrack]) from [<c0ac9b58>] (nf_conntrack_destroy+0x94/0x168)
      [   50.230160] [<c0ac9b58>] (nf_conntrack_destroy) from [<c0a4aaa0>] (skb_release_head_state+0xa0/0xd0)
      [   50.239314] [<c0a4aaa0>] (skb_release_head_state) from [<c0a4aadc>] (skb_release_all+0xc/0x24)
      [   50.247946] [<c0a4aadc>] (skb_release_all) from [<c0a4b4cc>] (consume_skb+0x74/0x17c)
      [   50.255796] [<c0a4b4cc>] (consume_skb) from [<c081a2dc>] (lan743x_tx_release_desc+0x120/0x124)
      [   50.264428] [<c081a2dc>] (lan743x_tx_release_desc) from [<c081a98c>] (lan743x_tx_napi_poll+0x5c/0x18c)
      [   50.273755] [<c081a98c>] (lan743x_tx_napi_poll) from [<c0a6b050>] (net_rx_action+0x118/0x4a4)
      [   50.282306] [<c0a6b050>] (net_rx_action) from [<c0101364>] (__do_softirq+0x13c/0x53c)
      [   50.290157] [<c0101364>] (__do_softirq) from [<c012b29c>] (irq_exit+0x150/0x17c)
      [   50.297575] [<c012b29c>] (irq_exit) from [<c0196a08>] (__handle_domain_irq+0x60/0xb0)
      [   50.305423] [<c0196a08>] (__handle_domain_irq) from [<c05d44fc>] (gic_handle_irq+0x4c/0x90)
      [   50.313790] [<c05d44fc>] (gic_handle_irq) from [<c0100ed4>] (__irq_usr+0x54/0x80)
      [   50.321287] Exception stack(0xecd99fb0 to 0xecd99ff8)
      [   50.326355] 9fa0:                                     1cf1aa74 00000001 00000001 00000000
      [   50.334547] 9fc0: 00000001 00000000 00000000 00000000 00000000 00000000 00004097 b6d17d14
      [   50.342738] 9fe0: 00000001 b6d17c60 00000000 b6e71f94 800b0010 ffffffff
      [   50.349364] irq event stamp: 2525027
      [   50.352955] hardirqs last  enabled at (2525026): [<c0a6afec>] net_rx_action+0xb4/0x4a4
      [   50.360892] hardirqs last disabled at (2525027): [<c0d6d2fc>] _raw_spin_lock_irqsave+0x1c/0x50
      [   50.369517] softirqs last  enabled at (2524660): [<c01015b4>] __do_softirq+0x38c/0x53c
      [   50.377446] softirqs last disabled at (2524693): [<c012b29c>] irq_exit+0x150/0x17c
      [   50.385027] ---[ end trace c0b571db4bc8087d ]---
      
      The driver is calling dev_kfree_skb() from code inside a spinlock,
      where h/w interrupts are disabled. This is forbidden, as documented
      in include/linux/netdevice.h. The correct function to use
      dev_kfree_skb_irq(), or dev_kfree_skb_any().
      
      Fix by using the correct dev_kfree_skb_xxx() functions:
      
      in lan743x_tx_release_desc():
        called by lan743x_tx_release_completed_descriptors()
          called by in lan743x_tx_napi_poll()
          which holds a spinlock
        called by lan743x_tx_release_all_descriptors()
          called by lan743x_tx_close()
          which can-sleep
      conclusion: use dev_kfree_skb_any()
      
      in lan743x_tx_xmit_frame():
        which holds a spinlock
      conclusion: use dev_kfree_skb_irq()
      
      in lan743x_tx_close():
        which can-sleep
      conclusion: use dev_kfree_skb()
      
      in lan743x_rx_release_ring_element():
        called by lan743x_rx_close()
          which can-sleep
        called by lan743x_rx_open()
          which can-sleep
      conclusion: use dev_kfree_skb()
      
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201112185949.11315-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      e35df62e
  18. 13 11月, 2020 1 次提交
  19. 11 11月, 2020 2 次提交
    • S
      lan743x: fix "BUG: invalid wait context" when setting rx mode · 2b52a4b6
      Sven Van Asbroeck 提交于
      In the net core, the struct net_device_ops -> ndo_set_rx_mode()
      callback is called with the dev->addr_list_lock spinlock held.
      
      However, this driver's ndo_set_rx_mode callback eventually calls
      lan743x_dp_write(), which acquires a mutex. Mutex acquisition
      may sleep, and this is not allowed when holding a spinlock.
      
      Fix by removing the dp_lock mutex entirely. Its purpose is to
      prevent concurrent accesses to the data port. No concurrent
      accesses are possible, because the dev->addr_list_lock
      spinlock in the core only lets through one thread at a time.
      
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201109203828.5115-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      2b52a4b6
    • S
      lan743x: correctly handle chips with internal PHY · 902a66e0
      Sven Van Asbroeck 提交于
      Commit 6f197fb6 ("lan743x: Added fixed link and RGMII support")
      assumes that chips with an internal PHY will never have a devicetree
      entry. This is incorrect: even for these chips, a devicetree entry
      can be useful e.g. to pass the mac address from bootloader to chip:
      
          &pcie {
                  status = "okay";
      
                  host@0 {
                          reg = <0 0 0 0 0>;
      
                          #address-cells = <3>;
                          #size-cells = <2>;
      
                          lan7430: ethernet@0 {
                                  /* LAN7430 with internal PHY */
                                  compatible = "microchip,lan743x";
                                  status = "okay";
                                  reg = <0 0 0 0 0>;
                                  /* filled in by bootloader */
                                  local-mac-address = [00 00 00 00 00 00];
                          };
                  };
          };
      
      If a devicetree entry is present, the driver will not attach the chip
      to its internal phy, and the chip will be non-operational.
      
      Fix by tweaking the phy connection algorithm:
      - first try to connect to a phy specified in the devicetree
        (could be 'real' phy, or just a 'fixed-link')
      - if that doesn't succeed, try to connect to an internal phy, even
        if the chip has a devnode
      
      Tested on a LAN7430 with internal PHY. I cannot test a device using
      fixed-link, as I do not have access to one.
      
      Fixes: 6f197fb6 ("lan743x: Added fixed link and RGMII support")
      Tested-by: Sven Van Asbroeck <thesven73@gmail.com> # lan7430
      Reviewed-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NSven Van Asbroeck <thesven73@gmail.com>
      Link: https://lore.kernel.org/r/20201108171224.23829-1-TheSven73@gmail.comSigned-off-by: NJakub Kicinski <kuba@kernel.org>
      902a66e0
  20. 28 10月, 2020 1 次提交
  21. 26 9月, 2020 1 次提交
    • J
      drivers/net/ethernet: clean up unused assignments · 7c8c0291
      Jesse Brandeburg 提交于
      As part of the W=1 compliation series, these lines all created
      warnings about unused variables that were assigned a value. Most
      of them are from register reads, but some are just picking up
      a return value from a function and never doing anything with it.
      
      Fixed warnings:
      .../ethernet/brocade/bna/bnad.c:3280:6: warning: variable ‘rx_count’ set but not used [-Wunused-but-set-variable]
      .../ethernet/brocade/bna/bnad.c:3280:6: warning: variable ‘rx_count’ set but not used [-Wunused-but-set-variable]
      .../ethernet/cortina/gemini.c:512:6: warning: variable ‘val’ set but not used [-Wunused-but-set-variable]
      .../ethernet/cortina/gemini.c:2110:21: warning: variable ‘config0’ set but not used [-Wunused-but-set-variable]
      .../ethernet/cavium/liquidio/octeon_device.c:1327:6: warning: variable ‘val32’ set but not used [-Wunused-but-set-variable]
      .../ethernet/cavium/liquidio/octeon_device.c:1358:6: warning: variable ‘val32’ set but not used [-Wunused-but-set-variable]
      .../ethernet/dec/tulip/media.c:322:8: warning: variable ‘setup’ set but not used [-Wunused-but-set-variable]
      .../ethernet/dec/tulip/de4x5.c:4928:13: warning: variable ‘r3’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:1652:7: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:1652:7: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:1652:7: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:1652:7: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:4981:6: warning: variable ‘rx_status’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:6510:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
      .../ethernet/micrel/ksz884x.c:6087: warning: cannot understand function prototype: 'struct hw_regs '
      .../ethernet/microchip/lan743x_main.c:161:6: warning: variable ‘int_en’ set but not used [-Wunused-but-set-variable]
      .../ethernet/microchip/lan743x_main.c:1702:6: warning: variable ‘int_sts’ set but not used [-Wunused-but-set-variable]
      .../ethernet/microchip/lan743x_main.c:3041:6: warning: variable ‘ret’ set but not used [-Wunused-but-set-variable]
      .../ethernet/natsemi/ns83820.c:603:6: warning: variable ‘tbisr’ set but not used [-Wunused-but-set-variable]
      .../ethernet/natsemi/ns83820.c:1207:11: warning: variable ‘tanar’ set but not used [-Wunused-but-set-variable]
      .../ethernet/marvell/mvneta.c:754:6: warning: variable ‘dummy’ set but not used [-Wunused-but-set-variable]
      .../ethernet/neterion/vxge/vxge-traffic.c:33:6: warning: variable ‘val64’ set but not used [-Wunused-but-set-variable]
      .../ethernet/neterion/vxge/vxge-traffic.c:160:6: warning: variable ‘val64’ set but not used [-Wunused-but-set-variable]
      .../ethernet/neterion/vxge/vxge-traffic.c:490:6: warning: variable ‘val32’ set but not used [-Wunused-but-set-variable]
      .../ethernet/neterion/vxge/vxge-traffic.c:2378:6: warning: variable ‘val64’ set but not used [-Wunused-but-set-variable]
      .../ethernet/packetengines/yellowfin.c:1063:18: warning: variable ‘yf_size’ set but not used [-Wunused-but-set-variable]
      .../ethernet/realtek/8139cp.c:1242:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
      .../ethernet/mellanox/mlx4/en_tx.c:858:6: warning: variable ‘ring_cons’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sis/sis900.c:792:6: warning: variable ‘status’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sfc/falcon/farch.c:878:11: warning: variable ‘rx_ev_pkt_type’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sfc/falcon/farch.c:877:23: warning: variable ‘rx_ev_mcast_pkt’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sfc/falcon/farch.c:877:7: warning: variable ‘rx_ev_hdr_type’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sfc/falcon/farch.c:876:7: warning: variable ‘rx_ev_other_err’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sfc/falcon/farch.c:1646:21: warning: variable ‘buftbl_min’ set but not used [-Wunused-but-set-variable]
      .../ethernet/sfc/falcon/farch.c:2535:32: warning: variable ‘spec’ set but not used [-Wunused-but-set-variable]
      .../ethernet/via/via-velocity.c:880:6: warning: variable ‘curr_status’ set but not used [-Wunused-but-set-variable]
      .../ethernet/ti/tlan.c:656:6: warning: variable ‘rc’ set but not used [-Wunused-but-set-variable]
      .../ethernet/ti/davinci_emac.c:1230:6: warning: variable ‘num_tx_pkts’ set but not used [-Wunused-but-set-variable]
      .../ethernet/synopsys/dwc-xlgmac-common.c:516:8: warning: variable ‘str’ set but not used [-Wunused-but-set-variable]
      .../ethernet/ti/cpsw_new.c:1662:22: warning: variable ‘priv’ set but not used [-Wunused-but-set-variable]
      
      The register reads should be OK, because the current
      implementation of readl and friends will always execute even
      without an lvalue.
      
      When it makes sense, just remove the lvalue assignment and the
      local. Other times, just remove the offending code, and
      occasionally, just mark the variable as maybe unused since it
      could be used in an ifdef or debug scenario.
      
      Only compile tested with W=1.
      Signed-off-by: NJesse Brandeburg <jesse.brandeburg@intel.com>
      Acked-by: NEdward Cree <ecree@solarflare.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      7c8c0291
  22. 24 9月, 2020 1 次提交
  23. 23 7月, 2020 1 次提交
  24. 15 7月, 2020 1 次提交
    • C
      lan743x: switch from 'pci_' to 'dma_' API · a3b7b493
      Christophe JAILLET 提交于
      The wrappers in include/linux/pci-dma-compat.h should go away.
      
      The patch has been generated with the coccinelle script below and has been
      hand modified to replace GPF_ with a correct flag.
      It has been compile tested.
      
      When memory is allocated in 'lan743x_tx_ring_cleanup()' and
      'lan743x_rx_ring_init()', GFP_KERNEL can be used because this flag is
      already used to allocate some memory in these functions.
      
      While at it, remove a useless (void *) casting in the first hunk in so that
      the code is more consistent.
      
      @@
      @@
      -    PCI_DMA_BIDIRECTIONAL
      +    DMA_BIDIRECTIONAL
      
      @@
      @@
      -    PCI_DMA_TODEVICE
      +    DMA_TO_DEVICE
      
      @@
      @@
      -    PCI_DMA_FROMDEVICE
      +    DMA_FROM_DEVICE
      
      @@
      @@
      -    PCI_DMA_NONE
      +    DMA_NONE
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_alloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3;
      @@
      -    pci_zalloc_consistent(e1, e2, e3)
      +    dma_alloc_coherent(&e1->dev, e2, e3, GFP_)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_free_consistent(e1, e2, e3, e4)
      +    dma_free_coherent(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_single(e1, e2, e3, e4)
      +    dma_map_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_single(e1, e2, e3, e4)
      +    dma_unmap_single(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4, e5;
      @@
      -    pci_map_page(e1, e2, e3, e4, e5)
      +    dma_map_page(&e1->dev, e2, e3, e4, e5)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_page(e1, e2, e3, e4)
      +    dma_unmap_page(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_map_sg(e1, e2, e3, e4)
      +    dma_map_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_unmap_sg(e1, e2, e3, e4)
      +    dma_unmap_sg(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_cpu(e1, e2, e3, e4)
      +    dma_sync_single_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_single_for_device(e1, e2, e3, e4)
      +    dma_sync_single_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_cpu(e1, e2, e3, e4)
      +    dma_sync_sg_for_cpu(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2, e3, e4;
      @@
      -    pci_dma_sync_sg_for_device(e1, e2, e3, e4)
      +    dma_sync_sg_for_device(&e1->dev, e2, e3, e4)
      
      @@
      expression e1, e2;
      @@
      -    pci_dma_mapping_error(e1, e2)
      +    dma_mapping_error(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_dma_mask(e1, e2)
      +    dma_set_mask(&e1->dev, e2)
      
      @@
      expression e1, e2;
      @@
      -    pci_set_consistent_dma_mask(e1, e2)
      +    dma_set_coherent_mask(&e1->dev, e2)
      Signed-off-by: NChristophe JAILLET <christophe.jaillet@wanadoo.fr>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      a3b7b493
  25. 25 6月, 2020 1 次提交
  26. 19 6月, 2020 1 次提交
  27. 17 6月, 2020 1 次提交
  28. 05 6月, 2020 1 次提交
  29. 02 6月, 2020 1 次提交
    • R
      lan743x: Added fixed link and RGMII support · 6f197fb6
      Roelof Berg 提交于
      Microchip lan7431 is frequently connected to a phy. However, it
      can also be directly connected to a MII remote peer without
      any phy in between. For supporting such a phyless hardware setup
      in Linux we utilized phylib, which supports a fixed-link
      configuration via the device tree. And we added support for
      defining the connection type R/GMII in the device tree.
      
      New behavior:
      -------------
      . The automatic speed and duplex detection of the lan743x silicon
        between mac and phy is disabled. Instead phylib is used like in
        other typical Linux drivers. The usage of phylib allows to
        specify fixed-link parameters in the device tree.
      
      . The device tree entry phy-connection-type is supported now with
        the modes RGMII or (G)MII (default).
      
      Development state:
      ------------------
      . Tested with fixed-phy configurations. Not yet tested in normal
        configurations with phy. Microchip kindly offered testing
        as soon as the Corona measures allow this.
      
      . All review findings of Andrew Lunn are included
      
      Example:
      --------
      &pcie {
      	status = "okay";
      
      	host@0 {
      		reg = <0 0 0 0 0>;
      
      		#address-cells = <3>;
      		#size-cells = <2>;
      
      		ethernet@0 {
      			compatible = "weyland-yutani,noscom1", "microchip,lan743x";
      			status = "okay";
      			reg = <0 0 0 0 0>;
      			phy-connection-type = "rgmii";
      
      			fixed-link {
      				speed = <100>;
      				full-duplex;
      			};
      		};
      	};
      };
      Signed-off-by: NRoelof Berg <rberg@berg-solutions.de>
      Signed-off-by: NAndrew Lunn <andrew@lunn.ch>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      6f197fb6
  30. 06 9月, 2019 1 次提交
  31. 23 7月, 2019 1 次提交
  32. 14 3月, 2019 1 次提交
    • B
      lan743x: Fix TX Stall Issue · deb6bfab
      Bryan Whitehead 提交于
      It has been observed that tx queue may stall while downloading
      from certain web sites (example www.speedtest.net)
      
      The cause has been tracked down to a corner case where
      the tx interrupt vector was disabled automatically, but
      was not re enabled later.
      
      The lan743x has two mechanisms to enable/disable individual
      interrupts. Interrupts can be enabled/disabled by individual
      source, and they can also be enabled/disabled by individual
      vector which has been mapped to the source. Both must be
      enabled for interrupts to work properly.
      
      The TX code path, primarily uses the interrupt enable/disable of
      the TX source bit, while leaving the vector enabled all the time.
      
      However, while investigating this issue it was noticed that
      the driver requested the use of the vector auto clear feature.
      
      The test above revealed a case where the vector enable was
      cleared unintentionally.
      
      This patch fixes the issue by deleting the lines that request
      the vector auto clear feature to be used.
      
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Signed-off-by: NBryan Whitehead <Bryan.Whitehead@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      deb6bfab
  33. 12 3月, 2019 1 次提交
    • B
      lan743x: Fix RX Kernel Panic · dd9d9f59
      Bryan Whitehead 提交于
      It has been noticed that running the speed test at
      www.speedtest.net occasionally causes a kernel panic.
      
      Investigation revealed that under this test RX buffer allocation
      sometimes fails and returns NULL. But the lan743x driver did
      not handle this case.
      
      This patch fixes this issue by attempting to allocate a buffer
      before sending the new rx packet to the OS. If the allocation
      fails then the new rx packet is dropped and the existing buffer
      is reused in the DMA ring.
      
      Updates for v2:
          Additional 2 locations where allocation was not checked,
              has been changed to reuse existing buffer.
      
      Fixes: 23f0703c ("lan743x: Add main source files for new lan743x driver")
      Signed-off-by: NBryan Whitehead <Bryan.Whitehead@microchip.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      dd9d9f59
  34. 02 3月, 2019 1 次提交