1. 28 11月, 2018 1 次提交
    • M
      usb: gadget: u_ether: fix unsafe list iteration · c9287fa6
      Marek Szyprowski 提交于
      list_for_each_entry_safe() is not safe for deleting entries from the
      list if the spin lock, which protects it, is released and reacquired during
      the list iteration. Fix this issue by replacing this construction with
      a simple check if list is empty and removing the first entry in each
      iteration. This is almost equivalent to a revert of the commit mentioned in
      the Fixes: tag.
      
      This patch fixes following issue:
      --->8---
      Unable to handle kernel NULL pointer dereference at virtual address 00000104
      pgd = (ptrval)
      [00000104] *pgd=00000000
      Internal error: Oops: 817 [#1] PREEMPT SMP ARM
      Modules linked in:
      CPU: 1 PID: 84 Comm: kworker/1:1 Not tainted 4.20.0-rc2-next-20181114-00009-g8266b35ec404 #1061
      Hardware name: SAMSUNG EXYNOS (Flattened Device Tree)
      Workqueue: events eth_work
      PC is at rx_fill+0x60/0xac
      LR is at _raw_spin_lock_irqsave+0x50/0x5c
      pc : [<c065fee0>]    lr : [<c0a056b8>]    psr: 80000093
      sp : ee7fbee8  ip : 00000100  fp : 00000000
      r10: 006000c0  r9 : c10b0ab0  r8 : ee7eb5c0
      r7 : ee7eb614  r6 : ee7eb5ec  r5 : 000000dc  r4 : ee12ac00
      r3 : ee12ac24  r2 : 00000200  r1 : 60000013  r0 : ee7eb5ec
      Flags: Nzcv  IRQs off  FIQs on  Mode SVC_32  ISA ARM  Segment none
      Control: 10c5387d  Table: 6d5dc04a  DAC: 00000051
      Process kworker/1:1 (pid: 84, stack limit = 0x(ptrval))
      Stack: (0xee7fbee8 to 0xee7fc000)
      ...
      [<c065fee0>] (rx_fill) from [<c0143b7c>] (process_one_work+0x200/0x738)
      [<c0143b7c>] (process_one_work) from [<c0144118>] (worker_thread+0x2c/0x4c8)
      [<c0144118>] (worker_thread) from [<c014a8a4>] (kthread+0x128/0x164)
      [<c014a8a4>] (kthread) from [<c01010b4>] (ret_from_fork+0x14/0x20)
      Exception stack(0xee7fbfb0 to 0xee7fbff8)
      ...
      ---[ end trace 64480bc835eba7d6 ]---
      
      Fixes: fea14e68 ("usb: gadget: u_ether: use better list accessors")
      Signed-off-by: NMarek Szyprowski <m.szyprowski@samsung.com>
      Signed-off-by: NFelipe Balbi <felipe.balbi@linux.intel.com>
      c9287fa6
  2. 15 5月, 2018 1 次提交
  3. 07 11月, 2017 1 次提交
  4. 04 11月, 2017 1 次提交
  5. 18 8月, 2017 1 次提交
  6. 11 4月, 2017 2 次提交
  7. 24 1月, 2017 1 次提交
  8. 03 11月, 2016 2 次提交
  9. 01 11月, 2016 1 次提交
  10. 21 10月, 2016 1 次提交
    • J
      net: use core MTU range checking in misc drivers · b3e3893e
      Jarod Wilson 提交于
      firewire-net:
      - set min/max_mtu
      - remove fwnet_change_mtu
      
      nes:
      - set max_mtu
      - clean up nes_netdev_change_mtu
      
      xpnet:
      - set min/max_mtu
      - remove xpnet_dev_change_mtu
      
      hippi:
      - set min/max_mtu
      - remove hippi_change_mtu
      
      batman-adv:
      - set max_mtu
      - remove batadv_interface_change_mtu
      - initialization is a little async, not 100% certain that max_mtu is set
        in the optimal place, don't have hardware to test with
      
      rionet:
      - set min/max_mtu
      - remove rionet_change_mtu
      
      slip:
      - set min/max_mtu
      - streamline sl_change_mtu
      
      um/net_kern:
      - remove pointless ndo_change_mtu
      
      hsi/clients/ssi_protocol:
      - use core MTU range checking
      - remove now redundant ssip_pn_set_mtu
      
      ipoib:
      - set a default max MTU value
      - Note: ipoib's actual max MTU can vary, depending on if the device is in
        connected mode or not, so we'll just set the max_mtu value to the max
        possible, and let the ndo_change_mtu function continue to validate any new
        MTU change requests with checks for CM or not. Note that ipoib has no
        min_mtu set, and thus, the network core's mtu > 0 check is the only lower
        bounds here.
      
      mptlan:
      - use net core MTU range checking
      - remove now redundant mpt_lan_change_mtu
      
      fddi:
      - min_mtu = 21, max_mtu = 4470
      - remove now redundant fddi_change_mtu (including export)
      
      fjes:
      - min_mtu = 8192, max_mtu = 65536
      - The max_mtu value is actually one over IP_MAX_MTU here, but the idea is to
        get past the core net MTU range checks so fjes_change_mtu can validate a
        new MTU against what it supports (see fjes_support_mtu in fjes_hw.c)
      
      hsr:
      - min_mtu = 0 (calls ether_setup, max_mtu is 1500)
      
      f_phonet:
      - min_mtu = 6, max_mtu = 65541
      
      u_ether:
      - min_mtu = 14, max_mtu = 15412
      
      phonet/pep-gprs:
      - min_mtu = 576, max_mtu = 65530
      - remove redundant gprs_set_mtu
      
      CC: netdev@vger.kernel.org
      CC: linux-rdma@vger.kernel.org
      CC: Stefan Richter <stefanr@s5r6.in-berlin.de>
      CC: Faisal Latif <faisal.latif@intel.com>
      CC: linux-rdma@vger.kernel.org
      CC: Cliff Whickman <cpw@sgi.com>
      CC: Robin Holt <robinmholt@gmail.com>
      CC: Jes Sorensen <jes@trained-monkey.org>
      CC: Marek Lindner <mareklindner@neomailbox.ch>
      CC: Simon Wunderlich <sw@simonwunderlich.de>
      CC: Antonio Quartulli <a@unstable.cc>
      CC: Sathya Prakash <sathya.prakash@broadcom.com>
      CC: Chaitra P B <chaitra.basappa@broadcom.com>
      CC: Suganath Prabu Subramani <suganath-prabu.subramani@broadcom.com>
      CC: MPT-FusionLinux.pdl@broadcom.com
      CC: Sebastian Reichel <sre@kernel.org>
      CC: Felipe Balbi <balbi@kernel.org>
      CC: Arvid Brodin <arvid.brodin@alten.se>
      CC: Remi Denis-Courmont <courmisch@gmail.com>
      Signed-off-by: NJarod Wilson <jarod@redhat.com>
      Signed-off-by: NDavid S. Miller <davem@davemloft.net>
      b3e3893e
  11. 17 10月, 2016 1 次提交
  12. 19 9月, 2016 1 次提交
  13. 09 9月, 2016 2 次提交
  14. 31 8月, 2016 1 次提交
  15. 11 8月, 2016 1 次提交
  16. 05 5月, 2016 1 次提交
  17. 17 12月, 2015 1 次提交
    • M
      usb: gadget: ether: Allow changing the MTU · ab738ff1
      Mike Looijmans 提交于
      The gadget ethernet driver supports changing the MTU, but only allows this
      when the USB cable is removed. The comment indicates that this is because
      the "peer won't know". Even if the network link is still down and only the
      USB link is established, the driver won't allow the change.
      
      Other network interfaces allow changing the MTU any time, and don't force
      the link to be disabled. This makes perfect sense, because in order to be
      able to negotiate the MTU, the link needs to be up.
      
      Remove the restriction so that it is now actually possible to change the
      MTU (e.g. using "ifconfig usb0 mtu 15000") without having to manually pull
      the plug or change the driver's default setting.
      
      This is especially important after commit bba787a8
      ("usb: gadget: ether: Allow jumbo frames")
      Signed-off-by: NMike Looijmans <mike.looijmans@topic.nl>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      ab738ff1
  18. 27 9月, 2015 2 次提交
    • R
      usb: gadget: u_ether: eliminate abuse of ep->driver data · 6e4bfc54
      Robert Baldyga 提交于
      Since ep->driver_data is not used for endpoint claiming, neither for
      enabled/disabled state storing, we can reduce number of places where
      we read or modify it's value, as now it has no particular meaning for
      function or framework logic.
      
      In case of u_ether we only need to store in ep->driver_data pointer to
      struct eth_dev, as it's used in rx_complete() and tx_complete() callbacks.
      All other uses of ep->driver_data are now meaningless and can be safely
      removed.
      Signed-off-by: NRobert Baldyga <r.baldyga@samsung.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      6e4bfc54
    • M
      usb: gadget: ether: Allow jumbo frames · bba787a8
      Mike Looijmans 提交于
      USB network adapters support Jumbo frames. The only thing blocking
      that feature is the code in the gadget driver that disposes of
      packets larger than 1518 bytes, and the limit on the ioctl to set
      the mtu.
      
      This patch relaxes these limits, and allows up to 15k frames sizes.
      The 15k value was chosen because 16k does not work on all platforms,
      and usingclose to 16k will result in allocating 5 or 8 4k pages to
      store the skb, wasting pages at no measurable performance gain.
      
      On a topic-miami board (Zynq-7000), iperf3 performance reports:
      MTU= 1500, PC-to-gadget: 139 Mbps, Gadget-to-PC: 116 Mbps
      MTU=15000, PC-to-gadget: 239 Mbps, Gadget-to-PC: 361 Mbps
      
      On boards with slower CPUs the performance improvement will be
      relatively much larger, e.g. an OMAP-L138 increased from 40 to
      220 Mbps using a similar patch on an  2.6.37 kernel.
      Signed-off-by: NMike Looijmans <mike.looijmans@topic.nl>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      bba787a8
  19. 20 1月, 2015 1 次提交
  20. 19 8月, 2014 1 次提交
    • L
      Revert "usb: gadget: u_ether: synchronize with transmit when stopping queue" · 7166c32d
      Li RongQing 提交于
      This reverts commit a9232076.
      
      It introduced a dead lock, and did not fix anything.
      
      it made netif_tx_lock() be called in IRQ context, but in softirq context,
      the same lock is locked without disabling IRQ. In fact, the commit a9232076
      did not fix anything, since netif_stop_queue did not free the any resource
      
      [   10.154920] =================================
      [   10.156026] [ INFO: inconsistent lock state ]
      [   10.156026] 3.16.0-rc5+ #13 Not tainted
      [   10.156026] ---------------------------------
      [   10.156026] inconsistent {IN-HARDIRQ-W} -> {HARDIRQ-ON-W} usage.
      [   10.156026] swapper/1/0 [HC0[0]:SC1[5]:HE1:SE0] takes:
      [   10.156026]  (_xmit_ETHER){?.-...}, at: [<80948b6a>] sch_direct_xmit+0x7a/0x250
      [   10.156026] {IN-HARDIRQ-W} state was registered at:
      [   10.156026]   [<804811f0>] __lock_acquire+0x800/0x17a0
      [   10.156026]   [<804828ba>] lock_acquire+0x6a/0xf0
      [   10.156026]   [<809ed477>] _raw_spin_lock+0x27/0x40
      [   10.156026]   [<8088d508>] gether_disconnect+0x68/0x280
      [   10.156026]   [<8088e777>] eem_set_alt+0x37/0xc0
      [   10.156026]   [<808847ce>] composite_setup+0x30e/0x1240
      [   10.156026]   [<8088b8ae>] pch_udc_isr+0xa6e/0xf50
      [   10.156026]   [<8048abe8>] handle_irq_event_percpu+0x38/0x1e0
      [   10.156026]   [<8048adc1>] handle_irq_event+0x31/0x50
      [   10.156026]   [<8048d94b>] handle_fasteoi_irq+0x6b/0x140
      [   10.156026]   [<804040a5>] handle_irq+0x65/0x80
      [   10.156026]   [<80403cfc>] do_IRQ+0x3c/0xc0
      [   10.156026]   [<809ee6ae>] common_interrupt+0x2e/0x34
      [   10.156026]   [<804668c5>] finish_task_switch+0x65/0xd0
      [   10.156026]   [<809e89df>] __schedule+0x20f/0x7d0
      [   10.156026]   [<809e94aa>] schedule_preempt_disabled+0x2a/0x70
      [   10.156026]   [<8047bf03>] cpu_startup_entry+0x143/0x410
      [   10.156026]   [<809e2e61>] rest_init+0xa1/0xb0
      [   10.156026]   [<80ce2a3b>] start_kernel+0x336/0x33b
      [   10.156026]   [<80ce22ab>] i386_start_kernel+0x79/0x7d
      [   10.156026] irq event stamp: 52070
      [   10.156026] hardirqs last  enabled at (52070): [<809375de>] neigh_resolve_output+0xee/0x2a0
      [   10.156026] hardirqs last disabled at (52069): [<809375a8>] neigh_resolve_output+0xb8/0x2a0
      [   10.156026] softirqs last  enabled at (52020): [<8044401f>] _local_bh_enable+0x1f/0x50
      [   10.156026] softirqs last disabled at (52021): [<80404036>] do_softirq_own_stack+0x26/0x30
      [   10.156026]
      [   10.156026] other info that might help us debug this:
      [   10.156026]  Possible unsafe locking scenario:
      [   10.156026]
      [   10.156026]        CPU0
      [   10.156026]        ----
      [   10.156026]   lock(_xmit_ETHER);
      [   10.156026]   <Interrupt>
      [   10.156026]     lock(_xmit_ETHER);
      [   10.156026]
      [   10.156026]  *** DEADLOCK ***
      [   10.156026]
      [   10.156026] 4 locks held by swapper/1/0:
      [   10.156026]  #0:  (((&idev->mc_ifc_timer))){+.-...}, at: [<8044b100>] call_timer_fn+0x0/0x190
      [   10.156026]  #1:  (rcu_read_lock){......}, at: [<a0577c40>] mld_sendpack+0x0/0x590 [ipv6]
      [   10.156026]  #2:  (rcu_read_lock_bh){......}, at: [<a055680c>] ip6_finish_output2+0x4c/0x7f0 [ipv6]
      [   10.156026]  #3:  (rcu_read_lock_bh){......}, at: [<8092e510>] __dev_queue_xmit+0x0/0x5f0
      [   10.156026]
      [   10.156026] stack backtrace:
      [   10.156026] CPU: 1 PID: 0 Comm: swapper/1 Not tainted 3.16.0-rc5+ #13
      [   10.156026]  811dbb10 00000000 9e919d10 809e6785 9e8b8000 9e919d3c 809e561e 80b95511
      [   10.156026]  80b9545a 80b9543d 80b95450 80b95441 80b957e4 9e8b84e0 00000002 8047f7b0
      [   10.156026]  9e919d5c 8048043b 00000002 00000000 9e8b8000 00000001 00000004 9e8b8000
      [   10.156026] Call Trace:
      [   10.156026]  [<809e6785>] dump_stack+0x48/0x69
      [   10.156026]  [<809e561e>] print_usage_bug+0x18f/0x19c
      [   10.156026]  [<8047f7b0>] ? print_shortest_lock_dependencies+0x170/0x170
      [   10.156026]  [<8048043b>] mark_lock+0x53b/0x5f0
      [   10.156026]  [<804810cf>] __lock_acquire+0x6df/0x17a0
      [   10.156026]  [<804828ba>] lock_acquire+0x6a/0xf0
      [   10.156026]  [<80948b6a>] ? sch_direct_xmit+0x7a/0x250
      [   10.156026]  [<809ed477>] _raw_spin_lock+0x27/0x40
      [   10.156026]  [<80948b6a>] ? sch_direct_xmit+0x7a/0x250
      [   10.156026]  [<80948b6a>] sch_direct_xmit+0x7a/0x250
      [   10.156026]  [<8092e6bf>] __dev_queue_xmit+0x1af/0x5f0
      [   10.156026]  [<80947fc0>] ? ether_setup+0x80/0x80
      [   10.156026]  [<8092eb0f>] dev_queue_xmit+0xf/0x20
      [   10.156026]  [<8093764c>] neigh_resolve_output+0x15c/0x2a0
      [   10.156026]  [<a0556927>] ip6_finish_output2+0x167/0x7f0 [ipv6]
      [   10.156026]  [<a0559b05>] ip6_finish_output+0x85/0x1c0 [ipv6]
      [   10.156026]  [<a0559cb7>] ip6_output+0x77/0x240 [ipv6]
      [   10.156026]  [<a0578163>] mld_sendpack+0x523/0x590 [ipv6]
      [   10.156026]  [<80480501>] ? mark_held_locks+0x11/0x90
      [   10.156026]  [<a057947d>] mld_ifc_timer_expire+0x15d/0x280 [ipv6]
      [   10.156026]  [<8044b168>] call_timer_fn+0x68/0x190
      [   10.156026]  [<a0579320>] ? igmp6_group_added+0x150/0x150 [ipv6]
      [   10.156026]  [<8044b3fa>] run_timer_softirq+0x16a/0x240
      [   10.156026]  [<a0579320>] ? igmp6_group_added+0x150/0x150 [ipv6]
      [   10.156026]  [<80444984>] __do_softirq+0xd4/0x2f0
      [   10.156026]  [<804448b0>] ? tasklet_action+0x100/0x100
      [   10.156026]  [<80404036>] do_softirq_own_stack+0x26/0x30
      [   10.156026]  <IRQ>  [<80444d05>] irq_exit+0x65/0x70
      [   10.156026]  [<8042d758>] smp_apic_timer_interrupt+0x38/0x50
      [   10.156026]  [<809ee91f>] apic_timer_interrupt+0x2f/0x34
      [   10.156026]  [<8048007b>] ? mark_lock+0x17b/0x5f0
      [   10.156026]  [<8040a912>] ? default_idle+0x22/0xf0
      [   10.156026]  [<8040b13e>] arch_cpu_idle+0xe/0x10
      [   10.156026]  [<8047bfc6>] cpu_startup_entry+0x206/0x410
      [   10.156026]  [<8042bfbd>] start_secondary+0x19d/0x1e0
      Acked-by: NTony Lindgren <tony@atomide.com>
      Reported-by: NThomas Gleixner <tglx@linutronix.de>
      Cc: Jeff Westfahl <jeff.westfahl@ni.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: <linux-usb@vger.kernel.org>
      Signed-off-by: NLi RongQing <roy.qing.li@gmail.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      7166c32d
  21. 17 7月, 2014 1 次提交
  22. 10 7月, 2014 1 次提交
    • J
      usb: gadget: NCM: Add transmit multi-frame. · 6d3865f9
      Jim Baxter 提交于
      This adds multi-frame support to the NCM NTB's for
      the gadget driver. This allows multiple network
      packets to be put inside a single USB NTB with a
      maximum size of 16kB.
      
      It has a time out of 300ms to ensure that smaller
      number of packets still maintain a normal latency.
      
      Also the .fp_index and .next_fp_index have been
      changed to .ndp_index and .next_ndp_index to
      match the latest CDC-NCM specification and
      help with maintenance.
      
      Results transmitting from gadget to host.
      
      Before the change:
      
      TCP_STREAM Throughput (10^6bits/sec): 22.72
      UDP_STREAM Throughput (10^6bits/sec): 25.94
      
      Latency:
      netperf -H 192.168.1.101 -v2 -l 50 -t TCP_RR -- -r 16384,16384
      Trans.   RoundTrip  Throughput
      Rate     Latency    10^6bits/s
      per sec  usec/Tran  Outbound
      
      100.83   9918.116   13.215
      
      After the change:
      
      TCP_STREAM Throughput (10^6bits/sec): 124.26
      UDP_STREAM Throughput (10^6bits/sec): 227.48
      
      Latency:
      netperf -H 192.168.1.101 -v2 -l 50 -t TCP_RR -- -r 16384,16384
      Trans.   RoundTrip  Throughput
      Rate     Latency    10^6bits/s
      per sec  usec/Tran  Outbound
      
      156.80   6377.730   20.552
      Signed-off-by: NJim Baxter <jim_baxter@mentor.com>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      6d3865f9
  23. 19 6月, 2014 1 次提交
  24. 14 5月, 2014 1 次提交
  25. 22 4月, 2014 1 次提交
  26. 21 4月, 2014 1 次提交
    • F
      Revert "usb: gadget: u_ether: move hardware transmit to RX NAPI" · 9189a330
      Felipe Balbi 提交于
      This reverts commit 716fb91d.
      
      That commit caused a regression which would end up in a kernel
      BUG() as below:
      
      [  101.554300] g_ether gadget: full-speed config #1: CDC Subset/SAFE
      [  101.585186] ------------[ cut here ]------------
      [  101.600587] kernel BUG at include/linux/netdevice.h:495!
      [  101.615850] Internal error: Oops - BUG: 0 [#1] PREEMPT ARM
      [  101.645539] Modules linked in:
      [  101.660483] CPU: 0 PID: 0 Comm: swapper Not tainted 3.15.0-rc1+ #104
      [  101.690175] task: c05dc5c8 ti: c05d2000 task.ti: c05d2000
      [  101.705579] PC is at eth_start+0x64/0x8c
      [  101.720981] LR is at __netif_schedule+0x7c/0x90
      [  101.736455] pc : [<c0299174>]    lr : [<c036a134>]    psr: 60000093
      [  101.736455] sp : c05d3d18  ip : c05d3cf8  fp : c05d3d2c
      [  101.782340] r10: 00000000  r9 : c196c1f0  r8 : c196c1a0
      [  101.797823] r7 : 00000000  r6 : 00000002  r5 : c1976400  r4 : c1976400
      [  101.828058] r3 : 00000000  r2 : c05d3ce8  r1 : 00000001  r0 : 00000002
      [  101.858722] Flags: nZCv  IRQs off  FIQs on  Mode SVC_32  ISA ARM Segment kernel
      Reported-by: NRobert Jarzmik <robert.jarzmik@free.fr>
      Signed-of-by: NFelipe Balbi <balbi@ti.com>
      9189a330
  27. 08 3月, 2014 1 次提交
    • W
      usb: gadget: u_ether: move hardware transmit to RX NAPI · 716fb91d
      Weinn Jheng 提交于
      In order to reduce the interrupt times in the embedded system,
      a receiving workqueue is introduced.
      This modification also enhanced the overall throughput as the
      benefits of reducing interrupt occurrence.
      
      This work was derived from previous work:
      u_ether: move hardware transmit to RX workqueue.
      Which should be base on codeaurora's work.
      
      However, the benchmark on my platform shows the throughput
      with workqueue is slightly better than NAPI.
      Signed-off-by: NWeinn Jheng <clanlab.proj@gmail.com>
      Cc: David Brownell <dbrownell@users.sourceforge.net>
      Cc: David S. Miller <davem@davemloft.net>
      Cc: Stephen Hemminger <shemminger@vyatta.com>
      Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
      Cc: Manu Gautam <mgautam@codeaurora.org>
      Signed-off-by: NFelipe Balbi <balbi@ti.com>
      716fb91d
  28. 27 11月, 2013 1 次提交
  29. 10 6月, 2013 3 次提交
  30. 03 4月, 2013 1 次提交
  31. 07 1月, 2013 1 次提交
  32. 08 11月, 2012 2 次提交
  33. 10 9月, 2012 1 次提交