aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet
Commit message (Collapse)AuthorAge
...
* ENGR00299323-3 net:fec: use multiqueue interface to allocate Ethernet deviceFugang Duan2014-04-16
| | | | | | | Since i.MX6SX enet-AVB IP support multi queues, so use multi queues interface to allocate and set up an Ethernet device. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00299323-2 net:fec: add enet AVB feature macro define for imx6sxFugang Duan2014-04-16
| | | | | | Add enet AVB feature macro define for imx6sx. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00299323-1 net:fec: add enet refrence clockFugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | i.MX6sx enet has below clocks for user config: clk_ipg: ipg_clk_s, ipg_clk_mac0_s, 66Mhz clk_ahb: enet system clock, it is enet AXI clock for imx6sx. For imx6sx, it alos is the clock source of interrupt coalescing. The clock range: 200Mhz ~ 266Mhz. clk_ref: refrence clock for tx and rx. For imx6sx enet RGMII mode, the refrence clock is 125Mhz coming from internal PLL or external. In i.MX6sx-arm2 board, the clock is from internal PLL. clk_ref is optional, depends on board. clk_enet_out: The clock can be output from internal PLL. It can supply 50Mhz clock for phy. clk_enet_out is optional, depends on chip and board. clk_ptp: 1588 ts clock. It is optional, depends on chip. The patch add clk_ref to distiguish the different clocks. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00288569: net:fec_ptp: fix the potential issue for storing timestampFugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The timestamps generated in the i.MX drivers are generated by the nanoseconds part coming from the 1588 clock. But the number of seconds are maintained in a private structure of the interface. Those are updated in a 1588 clock rollover interrupt. The timestamp is generated right before a rollover of a second and the timestamp value is constructed afterwards. Therefore the bigger part of the timestamp is wrong (the second). commit:54181c1d83e04b18e63c7723ac80f974b760e019 Suggested solution (pseudo-code): If( actual-time.nsec < timestamp.nsec ) Timestamp.sec = fpp->prtc -1; Else Timestamp.sec = fpp->prtc; But it is not perfect and there still exist potenitial second sync issue. So, the patch Suggested solution (pseudo-code): If( actual-time.nsec < timestamp.nsec && !FEC_IEVENT[TS_TIMER] ) Timestamp.sec = fpp->prtc -1; Else Timestamp.sec = fpp->prtc; Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00277698 net:fec: avoid kernel dump for skb page allocation failFugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fast reproduce steps: 1. set kernel parameter mem=500M, after kernel up, run below steps. 1. mount 10.192.225.224:/nfsroot /media/Videos/224nfsroot -t nfs -o rw,nolock,addr=10.192.225.224 2. cd /media/Videos/224nfsroot/gst-sanity-test 3. ./linux_recording_sanity_test.sh recording_playback_cmd.txt kernel dump: -------------------------------------------------------------- Swap cache stats: add 0, delete 0, find 0/0 Free swap = 0kB Total swap = 0kB kswapd0: page allocation failure: order:0, mode:0x20 CPU: 0 PID: 54 Comm: kswapd0 Tainted: G W 3.10.17-16884-gc530ac0 #239 [<80013c4c>] (unwind_backtrace+0x0/0xf8) from [<80011704>] (show_stack+0x10/0x14) [<80011704>] (show_stack+0x10/0x14) from [<8008bb7c>] (warn_alloc_failed+0xd0/0x114) [<8008bb7c>] (warn_alloc_failed+0xd0/0x114) from [<8008e860>] (__alloc_pages_nodemask+0x5e0/0x8b8) [<8008e860>] (__alloc_pages_nodemask+0x5e0/0x8b8) from [<804cceb8>] (__netdev_alloc_frag+0x9c/0x138) [<804cceb8>] (__netdev_alloc_frag+0x9c/0x138) from [<804cddc4>] (__netdev_alloc_skb+0x40/0xe0) [<804cddc4>] (__netdev_alloc_skb+0x40/0xe0) from [<8037dc8c>] (fec_enet_rx_napi+0x268/0x7e0) [<8037dc8c>] (fec_enet_rx_napi+0x268/0x7e0) from [<804d7cf8>] (net_rx_action+0x94/0x160) [<804d7cf8>] (net_rx_action+0x94/0x160) from [<8002c8fc>] (__do_softirq+0xe8/0x1d0) [<8002c8fc>] (__do_softirq+0xe8/0x1d0) from [<8002ca8c>] (do_softirq+0x4c/0x58) [<8002ca8c>] (do_softirq+0x4c/0x58) from [<8002ccf4>] (irq_exit+0x90/0xc8) [<8002ccf4>] (irq_exit+0x90/0xc8) from [<8000ea88>] (handle_IRQ+0x3c/0x94) [<8000ea88>] (handle_IRQ+0x3c/0x94) from [<8000855c>] (gic_handle_irq+0x28/0x5c) [<8000855c>] (gic_handle_irq+0x28/0x5c) from [<8000de00>] (__irq_svc+0x40/0x50) Exception stack(0xac21be08 to 0xac21be50) be00: 80ca16f0 00000000 0000bf28 0000bf28 80ca16c8 ac449c00 be20: 000006a4 00000000 00000000 00000000 000003a4 00000000 00000000 ac21be50 be40: 800bf9e4 805fc0d4 600f0013 ffffffff [<8000de00>] (__irq_svc+0x40/0x50) from [<805fc0d4>] (_raw_spin_lock+0x38/0x3c) [<805fc0d4>] (_raw_spin_lock+0x38/0x3c) from [<800bf9e4>] (put_super+0x18/0x3c) [<800bf9e4>] (put_super+0x18/0x3c) from [<800c0968>] (prune_super+0x13c/0x17c) [<800c0968>] (prune_super+0x13c/0x17c) from [<80093ff8>] (shrink_slab+0x88/0x218) [<80093ff8>] (shrink_slab+0x88/0x218) from [<8009637c>] (kswapd+0x510/0x80c) [<8009637c>] (kswapd+0x510/0x80c) from [<80042d64>] (kthread+0xa4/0xb0) [<80042d64>] (kthread+0xa4/0xb0) from [<8000e258>] (ret_from_fork+0x14/0x3c) -------------------------------------------------------------- Firstly, alloc_page() try to allocate page from pcp high speed cached page or free_list by calling get_page_from_freelist(). If failed, and then use low speed allocation mechanism by calling __alloc_pages_slowpath(), which may allocate from reclaimed pages and kernel dump the memory allocate info. Still don't find the root cause, this patch avoid the kernel dump in temporarily. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00288342 net:fec_ptp: fix the potential issue for storing timestampFugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | The timestamps generated in the i.MX drivers are generated by the nanoseconds part coming from the 1588 clock. But the number of seconds are maintained in a private structure of the interface. Those are updated in a 1588 clock rollover interrupt. The timestamp is generated right before a rollover of a second and the timestamp value is constructed afterwards. Therefore the bigger part of the timestamp is wrong (the second). Suggested solution (pseudo-code): If( actual-time.nsec < timestamp.nsec ) Timestamp.sec = fpp->prtc -1; Else Timestamp.sec = fpp->prtc; Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00288046: net:fec_ptp: fix WARNING caused by mutex_trylock run in ↵Fugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | interrupt context Kernel warning dump by enable kernel config "CONFIG_DEBUG_MUTEXES": ------------[ cut here ]------------ WARNING: at kernel/mutex.c:577 mutex_trylock+0x180/0x1d0() DEBUG_LOCKS_WARN_ON(in_interrupt()) Modules linked in: CPU: 0 PID: 68 Comm: kworker/0:2 Tainted: G W 3.10.17-16855-ga44de14 #1325 Workqueue: events phy_state_machine [<80014cbc>] (unwind_backtrace+0x0/0x138) from [<8001251c>] (show_stack+0x10/0x14) [<8001251c>] (show_stack+0x10/0x14) from [<80026754>] (warn_slowpath_common+0x4c/0x68) [<80026754>] (warn_slowpath_common+0x4c/0x68) from [<80026804>] (warn_slowpath_fmt+0x30/0x40) [<80026804>] (warn_slowpath_fmt+0x30/0x40) from [<8069f6b0>] (mutex_trylock+0x180/0x1d0) [<8069f6b0>] (mutex_trylock+0x180/0x1d0) from [<804dce7c>] (clk_prepare_lock+0xc/0xd8) [<804dce7c>] (clk_prepare_lock+0xc/0xd8) from [<804ddbcc>] (clk_get_rate+0xc/0x5c) [<804ddbcc>] (clk_get_rate+0xc/0x5c) from [<803b7528>] (fec_ptp_start_cyclecounter+0x1c/0x198) [<803b7528>] (fec_ptp_start_cyclecounter+0x1c/0x198) from [<803b5928>] (fec_restart+0x6e8/0x870) [<803b5928>] (fec_restart+0x6e8/0x870) from [<803b5d50>] (fec_enet_adjust_link+0x7c/0xb4) [<803b5d50>] (fec_enet_adjust_link+0x7c/0xb4) from [<803b07b8>] (phy_state_machine+0xfc/0x394) [<803b07b8>] (phy_state_machine+0xfc/0x394) from [<8003f03c>] (process_one_work+0x198/0x428) [<8003f03c>] (process_one_work+0x198/0x428) from [<8003fd24>] (worker_thread+0x144/0x3a4) [<8003fd24>] (worker_thread+0x144/0x3a4) from [<800458d8>] (kthread+0xa4/0xb0) [<800458d8>] (kthread+0xa4/0xb0) from [<8000ebd8>] (ret_from_fork+0x14/0x3c) ---[ end trace d1930b3e1c195329 ]--- Root cause: Worker thread call netif_tx_lock_bh() to diable the softirq preempt, and then call clk_get_rate() to get ptp clock rate. In fact, netif_tx_lock_bh()->local_bh_disable(), which make in_interrupt() to be ture. clk_get_rate()->clk_prepare_lock()->mutex_trylock(), and mutex_trylock() cannot use at interrupt context, otherwise there have kernel dump. So, remove the clk_get_rate() in there. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00287512 net:fec: fix WARNING caused by lack of calling dma_mapping_error()Fugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Enable CONFIG_HAVE_DMA_API_DEBUG, the kernel dump warning: ------------[ cut here ]------------ WARNING: at lib/dma-debug.c:937 check_unmap+0x43c/0x7d8() fec 2188000.ethernet: DMA-API: device driver failed to check map error[device address=0x00000000383a8040] [size=2048 bytes] [mapped as single] Modules linked in: CPU: 0 PID: 0 Comm: swapper/0 Not tainted 3.10.17-16827-g9cdb0ba-dirty #188 [<80013c4c>] (unwind_backtrace+0x0/0xf8) from [<80011704>] (show_stack+0x10 [<80011704>] (show_stack+0x10/0x14) from [<80025614>] (warn_slowpath_common [<80025614>] (warn_slowpath_common+0x4c/0x6c) from [<800256c8>] (warn_slowp [<800256c8>] (warn_slowpath_fmt+0x30/0x40) from [<8026bfdc>] (check_unmap+0 [<8026bfdc>] (check_unmap+0x43c/0x7d8) from [<8026c584>] (debug_dma_unmap_p [<8026c584>] (debug_dma_unmap_page+0x6c/0x78) from [<8038049c>] (fec_enet_r [<8038049c>] (fec_enet_rx_napi+0x254/0x8a8) from [<804dc8c0>] (net_rx_actio [<804dc8c0>] (net_rx_action+0x94/0x160) from [<8002c758>] (__do_softirq+0xe [<8002c758>] (__do_softirq+0xe8/0x1d0) from [<8002c8e8>] (do_softirq+0x4c/0 [<8002c8e8>] (do_softirq+0x4c/0x58) from [<8002cb50>] (irq_exit+0x90/0xc8) [<8002cb50>] (irq_exit+0x90/0xc8) from [<8000ea88>] (handle_IRQ+0x3c/0x94) [<8000ea88>] (handle_IRQ+0x3c/0x94) from [<8000855c>] (gic_handle_irq+0x28/ [<8000855c>] (gic_handle_irq+0x28/0x5c) from [<8000de00>] (__irq_svc+0x40/0 Exception stack(0x815a5f38 to 0x815a5f80) 5f20: 815a5f80 3b9aca 5f40: 0fe52383 00000002 0dd8950e 00000002 81e7b080 00000000 00000000 815ac4 5f60: 806032ec 00000000 00000017 815a5f80 80059028 8041fc4c 60000013 ffffff [<8000de00>] (__irq_svc+0x40/0x50) from [<8041fc4c>] (cpuidle_enter_state+0 [<8041fc4c>] (cpuidle_enter_state+0x50/0xf0) from [<8041fd94>] (cpuidle_idl [<8041fd94>] (cpuidle_idle_call+0xa8/0x14c) from [<8000edac>] (arch_cpu_idl [<8000edac>] (arch_cpu_idle+0x10/0x4c) from [<800582f8>] (cpu_startup_entry [<800582f8>] (cpu_startup_entry+0x60/0x130) from [<80bc7a48>] (start_kernel [<80bc7a48>] (start_kernel+0x2d0/0x328) from [<10008074>] (0x10008074) ---[ end trace c6edec32436e0042 ]--- Because dma-debug add new interfaces to debug dma mapping errors, pls refer to: http://lwn.net/Articles/516640/ After dma mapping, it must call dma_mapping_error() to check mapping error, otherwise the map_err_type alway is MAP_ERR_NOT_CHECKED, check_unmap() define the mapping is not checked and dump the error msg. So, and dma_mapping_error() checking to fix the WARNING. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00286416 net:fec: Pinctrl PM: add net device running status checkFugang Duan2014-04-16
| | | | | | | | | | | | In below case: ifconfig eth0 down echo mem > /sys/power/state After resume, fec pin status set to default, which is not expected and cost unnecessary power. So, add net device running status check before calling Pinctrl PM APIs. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00286017: net:fec: fix clock enable/disable usecount mismatchFugang Duan2014-04-16
| | | | | | | | | | | | | | Reproduce: 1. Boot up kernel with DHCP; 2. ifconfig eth0 down; 3. echo mem > /sys/power/state; There have clock enable/disable usecount mismatch warning dump. Fix this by checking device's netif_running state is up and then enable/disable clock. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00283540-02: net: fec: use pinctrl PM helpersFugang Duan2014-04-16
| | | | | | | | | | when system suspend, need to set pins to low power state to save IO power consumption, there are three states of pinctrl: "default", "idle" and "sleep". Currently enet supports default and sleep state. Signed-off-by: Fugang Duan <B38611@freescale.com> Signed-off-by: Anson Huang <b20788@freescale.com>
* ENGR00265935 net: fec: add pm_qos to avoid cpu enter to wait modeFugang Duan2014-04-16
| | | | | | | Since imx6q/dl enet cannot wake up wait mode, which cause performance drops. Add pm_qos to request low cpu latency to avoid enter to wait mode. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00279948 net: fec: add clock control to save powerFugang Duan2014-04-16
| | | | | | | | | - After probe, disable all clocks incluing ipg, ahb, enet_out, ptp clock. - Open ethx interface enable necessary clocks. Close ethx interface disable all clocks. - Correct the MDIO clock source. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00276335 net:fec: fix build warningFugang Duan2014-04-16
| | | | | | | | | | | drivers/net/ethernet/freescale/fec_main.c:864 warning: 'vlan_tag' may be used uninitialized in this function note: 'vlan_tag' was declared here Compiler with the warning option: -Wuninitialized, the warning will be reported. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00275974-3 [iMX6x] Add busfreq support to the driversRanjani Vaidyanathan2014-04-16
| | | | | | | | Add request_bus_freq() and release_bus_freq() calls to the various drivers to ensure that the DDR and AHB are the requested frequency before the driver starts its task. Signed-off-by: Ranjani Vaidyanathan <ra5478@freescale.com>
* ENGR00275619 net: fec: set reset phy gpio to high in .probe().Fugang Duan2014-04-16
| | | | | | | | In .probe() call fec_of_init() to parse phy reset gpio, and request the gpio for later use. For the init, we must set the gpio to high to let phy power on. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00275469 net:fec: move devm_* and of_* apis to probe functionFugang Duan2014-04-16
| | | | | | | | | | | | | | fec_reset_phy() function is called in fec_enet_open(). And fec_reset_phy() call of_get_named_gpio() and devm_gpio_request_one() apis, which makes no sense since the two apis do something that should only be done at .probe() time. So move two functions into fec_probe() and only leave gpio_set_value() and msleep() calls in fec_reset_phy(). And remove fec_free_reset_gpio() function. Signed-off-by: Fugang Duan <B38611@freescale.com> Acked-by: Shawn Guo <shawn.guo@linaro.org>
* ENGR00275371 net: fec: PTP: Add ptp support for IXXAT stackLuwei Zhou2014-04-16
| | | | | | | These patch add ptp support for IXXAT stack. Cherry picked from commit 1c8839574ac87826f53b96f987975a9bb1d72915. Signed-off-by: Luwei Zhou <B45643@freescale.com>
* ENGR00275246-05: net: fec: add mac address init for imx25/imx53 fecFugang Duan2014-04-16
| | | | | | Add mac address init for imx25/imx53 fec in restart function. Signed-off-by: Fugang Duan <B38611@freescale.com>
* ENGR00275246-04: net: fec: fix phy reset operationFugang Duan2014-04-16
| | | | | | | | | | | | | | | | | | | | | | Current driver only do phy reset in probe function, which is not right. Since some phy clock is disabled after module probe, the phy enter abnormal status, which needs do reset to recovery the phy. And do ifconfig ethx up/down test, the phy also enter abnormal status. The log as: libphy: 2188000.ethernet:04 - Link is Up - 10/Full libphy: 2188000.ethernet:04 - Link is Up - 100/Full libphy: 2188000.ethernet:04 - Link is Down libphy: 2188000.ethernet:04 - Link is Up - 10/Half libphy: 2188000.ethernet:04 - Link is Up - 10/Full libphy: 2188000.ethernet:04 - Link is Up - 100/Full ... So, do phy reset if ethx up/down or do clock enable/disable operation. Signed-off-by: Fugang Duan <B38611@freescale.com>
* net/fec: Don't let ndo_start_xmit return NETDEV_TX_BUSY without linkUwe Kleine-König2014-04-16
| | | | | | | | | | | | | | | Don't test for having link and let hardware deal with this situation. Without this patch I see a machine running an -rt patched Linux being stuck in sch_direct_xmit when it looses link while there is still a packet to be sent. In this case the fec_enet_start_xmit routine returned NETDEV_TX_BUSY which makes the network stack reschedule the packet and so sch_direct_xmit calls fec_enet_start_xmit again. I failed to reproduce a complete hang without -rt, but I think the problem exists there, too. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: fec: workaround stop tx during errata ERR006358Frank Li2014-04-16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the ready bit in the transmit buffer descriptor (TxBD[R]) is previously detected as not set during a prior frame transmission, then the ENET_TDAR[TDAR] bit is cleared at a later time, even if additional TxBDs were added to the ring and the ENET_TDAR[TDAR] bit is set. This results in frames not being transmitted until there is a 0-to-1 transition on ENET_TDAR[TDAR]. Workarounds: code can use the transmit frame interrupt flag (ENET_EIR[TXF]) as a method to detect whether the ENET has completed transmission and the ENET_TDAR[TDAR] has been cleared. If ENET_TDAR[TDAR] is detected as cleared when packets are queued and waiting for transmit, then a write to the TDAR bit will restart TxBD processing. This case main happen when loading is light. A ethernet package may not send out utile next package put into tx queue. How to test: while [ true ] do ping <IP> -s 10000 -w 4 ping <IP> -s 6000 -w 2 ping <IP> -s 4000 -w 2 ping <IP> -s 10000 -w 2 done You will see below result in overnight test. 6008 bytes from 10.192.242.116: seq=1 ttl=128 time=0.722 ms 4008 bytes from 10.192.242.116: seq=0 ttl=128 time=1001.008 ms 4008 bytes from 10.192.242.116: seq=1 ttl=128 time=1.010 ms 10008 bytes from 10.192.242.116: seq=0 ttl=128 time=0.896 ms After apply this patch, >1000ms delay disappear. Signed-off-by: Frank Li <Frank.Li@freescale.com> Acked-by: Fugang Duan <B38611@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Add MODULE_ALIASFabio Estevam2014-04-16
| | | | | | | Add MODULE_ALIAS, so that auto module loading can work. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: fec: Add VLAN receive HW support.Jim Baxter2014-04-16
| | | | | | | | This enables the driver to take advantage of the FEC VLAN indicator to improve performance. Signed-off-by: Jim Baxter <jim_baxter@mentor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: fec: Fix RMON registers on imx6Jim Baxter2014-04-16
| | | | | | | | | | | commit 38ae92d "fec: Add support for reading RMON registers" causes the imx6Q to crash. This fixes it by only enabling the RMON registers, the registers are already cleared by the MAC being reset. Signed-off-by: Jim Baxter <jim_baxter@mentor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: fec: Fix Transmitted bytes counterJim Baxter2014-04-16
| | | | | | | | The tx_bytes field was not being updated so the network card statistics showed 0.0B transmitted. Signed-off-by: Jim Baxter <jim_baxter@mentor.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: fec: Fix multicast list setup in fec_restart().Christoph Müllner2014-04-16
| | | | | | | | | | Setup the multicast list of the net_device instead of clearing it blindly. This restores the multicast groups in case of a link down/up event or when resuming from suspend. Signed-off-by: Christoph Muellner <christoph.muellner@theobroma-systems.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Add support for reading RMON registersChris Healy2014-04-16
| | | | | | | | | | | Add ethtool operation to read RMON registers. Tested against net-next on i.MX28. v2: make conditional on #ifndef CONFIG_M5272 Signed-off-by: Chris Healy <cphealy@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Add support to restart autonegotiateChris Healy2014-04-16
| | | | | | | | | Add ethtool operation to restart autonegotiation via the PHY. Tested on i.MX28EVK. Signed-off-by: Chris Healy <cphealy@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: fec: Convert to use devm_ioremap_resourceTushar Behera2014-04-16
| | | | | | | | | | | Commit 75096579c3ac ("lib: devres: Introduce devm_ioremap_resource()") introduced devm_ioremap_resource() and deprecated the use of devm_request_and_ioremap(). Signed-off-by: Tushar Behera <tushar.behera@linaro.org> CC: netdev@vger.kernel.org CC: "David S. Miller" <davem@davemloft.net> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Only pass pdev in fec_ptp_init()Fabio Estevam2014-04-16
| | | | | | | Passing pdev in fec_ptp_init() is enough, since we can get ndev locally. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net: ethernet: remove unnecessary platform_set_drvdata()Jingoo Han2014-04-16
| | | | | | | | | | | | | | | | The driver core clears the driver data to NULL after device_release or on probe failure, since commit 0998d0631001288a5974afc0b2a5f568bcdecb4d (device-core: Ensure drvdata = NULL when no driver is bound). Thus, it is not needed to manually clear the device driver data to NULL. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com> Acked-by: Rob Herring <rob.herring@calxeda.com> Acked-by: Roland Stigge <stigge@antcom.de> Acked-by: Mugunthan V N <mugunthanvnm@ti.com> Reviewed-by: H Hartley Sweeten <hsweeten@visionengravers.com> Tested-by: Roland Stigge <stigge@antcom.de> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Handle the regulator in suspend/resumeFabio Estevam2014-04-16
| | | | | | | | | | In order to save power, let's disable the regulator in the suspend function and enable it in resume. Tested on a mx28evk board. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Remove irqs firstFabio Estevam2014-04-16
| | | | | | | | | | During probe the clocks are enabled prior than the acquiring the interrupts. In the remove function we need to do the opposite: first remove the interrupts and then disable the clocks. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Disable the PHY regulator on error and removalFabio Estevam2014-04-16
| | | | | | | | | In the case of error during probe, disable the PHY regulator. Do the same in fec_drv_remove(). Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Invert the order of error path sequenceFabio Estevam2014-04-16
| | | | | | | | | | | | Currently when fec_enet_init fails it jumps to 'failed_init' error path, which will attemp to free the interrupts. This is wrong because at this point the interrupts have not even been acquired. Swap failed_init/failed_irq to fix the error path. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Place the phy regulator in the private structureFabio Estevam2014-04-16
| | | | | | | | | | | | Instead of using a local reg_phy structure, let's put it inside the private structure, so that we are able to have access to the regulator structure even when we are outside fec_probe(). This is in preparation for controlling the FEC PHY regulator in the suspend and resume functions. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Use DIV_ROUND_UP macroFabio Estevam2014-04-16
| | | | | | | Use the standard DIV_ROUND_UP macro in order to provide better readability. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* fec: Let device core handle pinctrlFabio Estevam2014-04-16
| | | | | | | | | Since commit ab78029 (drivers/pinctrl: grab default handles from device core) we can rely on device core for handling pinctrl, so remove devm_pinctrl_get_select_default() from the driver. Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net>
* net,via-rhine: Fix tx_timeout handlingRichard Weinberger2014-02-06
| | | | | | | | | | | | | | | | [ Upstream commit a926592f5e4e900f3fa903298c4619a131e60963 ] rhine_reset_task() misses to disable the tx scheduler upon reset, this can lead to a crash if work is still scheduled while we're resetting the tx queue. Fixes: [ 93.591707] BUG: unable to handle kernel NULL pointer dereference at 0000004c [ 93.595514] IP: [<c119d10d>] rhine_napipoll+0x491/0x6 Signed-off-by: Richard Weinberger <richard@nod.at> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* bnx2x: fix DMA unmapping of TSO split BDsMichal Schmidt2014-02-06
| | | | | | | | | | | | | | | | | | | | | | | [ Upstream commit 95e92fd40c967c363ad66b2fd1ce4dcd68132e54 ] bnx2x triggers warnings with CONFIG_DMA_API_DEBUG=y: WARNING: CPU: 0 PID: 2253 at lib/dma-debug.c:887 check_unmap+0xf8/0x920() bnx2x 0000:28:00.0: DMA-API: device driver frees DMA memory with different size [device address=0x00000000da2b389e] [map size=1490 bytes] [unmap size=66 bytes] The reason is that bnx2x splits a TSO BD into two BDs (headers + data) using one DMA mapping for both, but it uses only the length of the first BD when unmapping. This patch fixes the bug by unmapping the whole length of the two BDs. Signed-off-by: Michal Schmidt <mschmidt@redhat.com> Reviewed-by: Eric Dumazet <edumazet@google.com> Acked-by: Dmitry Kravkov <dmitry@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* e1000e: fix compiler warningsDavid Ertman2014-02-06
| | | | | | | | | | | | | | | | | | | | commit 9e6c3b63399dd424d33a34e08b77f2cab0b84cdc upstream. This patch is to fix a compiler warning of __bad_udelay due to a value of >999 being passed as a parameter to udelay() in the function e1000e_phy_has_link_generic(). This affects the gcc compiler when it is given a flag of -O3 and the icc compiler. This patch is also making the change from mdelay() to msleep() in the same function, since it was determined though code inspection that this function is never called in atomic context. Signed-off-by: David Ertman <davidx.m.ertman@intel.com> Acked-by: Bruce Allan <bruce.w.allan@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* net: fec: fix potential use after freeEric Dumazet2014-01-15
| | | | | | | | | | | | | | | | | [ Upstream commit 7a2a84518cfb263d2c4171b3d63671f88316adb2 ] skb_tx_timestamp(skb) should be called _before_ TX completion has a chance to trigger, otherwise it is too late and we access freed memory. Signed-off-by: Eric Dumazet <edumazet@google.com> Fixes: de5fb0a05348 ("net: fec: put tx to napi poll function to fix dead lock") Cc: Frank Li <Frank.Li@freescale.com> Cc: Richard Cochran <richardcochran@gmail.com> Acked-by: Richard Cochran <richardcochran@gmail.com> Acked-by: Frank Li <Frank.Li@freescale.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tg3: Initialize REG_BASE_ADDR at PCI config offset 120 to 0Nat Gurumoorthy2014-01-15
| | | | | | | | | | | | | | | | | [ Upstream commit 388d3335575f4c056dcf7138a30f1454e2145cd8 ] The new tg3 driver leaves REG_BASE_ADDR (PCI config offset 120) uninitialized. From power on reset this register may have garbage in it. The Register Base Address register defines the device local address of a register. The data pointed to by this location is read or written using the Register Data register (PCI config offset 128). When REG_BASE_ADDR has garbage any read or write of Register Data Register (PCI 128) will cause the PCI bus to lock up. The TCO watchdog will fire and bring down the system. Signed-off-by: Nat Gurumoorthy <natg@google.com> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* net: do not pretend FRAGLIST supportEric Dumazet2014-01-15
| | | | | | | | | | | | | | | | | | | | [ Upstream commit 28e24c62ab3062e965ef1b3bcc244d50aee7fa85 ] Few network drivers really supports frag_list : virtual drivers. Some drivers wrongly advertise NETIF_F_FRAGLIST feature. If skb with a frag_list is given to them, packet on the wire will be corrupt. Remove this flag, as core networking stack will make sure to provide packets that can be sent without corruption. Signed-off-by: Eric Dumazet <edumazet@google.com> Cc: Thadeu Lima de Souza Cascardo <cascardo@linux.vnet.ibm.com> Cc: Anirudha Sarangi <anirudh@xilinx.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tg3: Expand 4g_overflow_test workaround to skb fragments of any size.Nithin Sujir2014-01-09
| | | | | | | | | | | | | | | | commit 375679104ab3ccfd18dcbd7ba503734fb9a2c63a upstream. The current driver assumes that an skb fragment can only be upto jumbo size. Presumably this was a fast-path optimization. This assumption is no longer true as fragments can be upto 32k. v2: Remove unnecessary parantheses per Eric Dumazet. Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com> Signed-off-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* igb: Fix for issue where values could be too high for udelay function.Carolyn Wyborny2013-12-20
| | | | | | | | | | | | | | | | | commit df29df92adda751ac04ca5149d30014b5199db81 upstream. This patch changes the igb_phy_has_link function to check the value of the parameter before deciding to use udelay or mdelay in order to be sure that the value is not too high for udelay function. Signed-off-by: Sunil K Pandey <sunil.k.pandey@intel.com> Signed-off-by: Kevin B Smith <kevin.b.smith@intel.com> Signed-off-by: Carolyn Wyborny <carolyn.wyborny@intel.com> Tested-by: Aaron Brown <aaron.f.brown@intel.com> Signed-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* tg3: avoid double-freeing of rx data memoryIvan Vecera2013-12-12
| | | | | | | | | | | | | | | | | | commit 85aec73d595b8847f9c4ea571deb127913f0d508 upstream. If build_skb fails the memory associated with the ring buffer is freed but the ri->data member is not zeroed in this case. This causes a double-free of this memory in tg3_free_rings->... path. The patch moves this block after setting ri->data to NULL. It would be nice to fix this bug also in stable >= v3.4 trees. Cc: Nithin Nayak Sujir <nsujir@broadcom.com> Cc: Michael Chan <mchan@broadcom.com> Signed-off-by: Ivan Vecera <ivecera@redhat.com> Acked-by: Michael Chan <mchan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* net: smc91: fix crash regression on the versatileLinus Walleij2013-12-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | commit a0c20fb02592d372e744d1d739cda3e1b3defaae upstream. After commit e9e4ea74f06635f2ffc1dffe5ef40c854faa0a90 "net: smc91x: dont't use SMC_outw for fixing up halfword-aligned data" The Versatile SMSC LAN91C111 is crashing like this: ------------[ cut here ]------------ kernel BUG at /home/linus/linux/drivers/net/ethernet/smsc/smc91x.c:599! Internal error: Oops - BUG: 0 [#1] ARM Modules linked in: CPU: 0 PID: 43 Comm: udhcpc Not tainted 3.13.0-rc1+ #24 task: c6ccfaa0 ti: c6cd0000 task.ti: c6cd0000 PC is at smc_hardware_send_pkt+0x198/0x22c LR is at smc_hardware_send_pkt+0x24/0x22c pc : [<c01be324>] lr : [<c01be1b0>] psr: 20000013 sp : c6cd1d08 ip : 00000001 fp : 00000000 r10: c02adb08 r9 : 00000000 r8 : c6ced802 r7 : c786fba0 r6 : 00000146 r5 : c8800000 r4 : c78d6000 r3 : 0000000f r2 : 00000146 r1 : 00000000 r0 : 00000031 Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment user Control: 0005317f Table: 06cf4000 DAC: 00000015 Process udhcpc (pid: 43, stack limit = 0xc6cd01c0) Stack: (0xc6cd1d08 to 0xc6cd2000) 1d00: 00000010 c8800000 c78d6000 c786fba0 c78d6000 c01be868 1d20: c01be7a4 00004000 00000000 c786fba0 c6c12b80 c0208554 000004d0 c780fc60 1d40: 00000220 c01fb734 00000000 00000000 00000000 c6c9a440 c6c12b80 c78d6000 1d60: c786fba0 c6c9a440 00000000 c021d1d8 00000000 00000000 c6c12b80 c78d6000 1d80: c786fba0 00000001 c6c9a440 c02087f8 c6c9a4a0 00080008 00000000 00000000 1da0: c78d6000 c786fba0 c78d6000 00000138 00000000 00000000 00000000 00000000 1dc0: 00000000 c027ba74 00000138 00000138 00000001 00000010 c6cedc00 00000000 1de0: 00000008 c7404400 c6cd1eec c6cd1f14 c067a73c c065c0b8 00000000 c067a740 1e00: 01ffffff 002040d0 00000000 00000000 00000000 00000000 00000000 ffffffff 1e20: 43004400 00110022 c6cdef20 c027ae8c c6ccfaa0 be82d65c 00000014 be82d3cc 1e40: 00000000 00000000 00000000 c01f2870 00000000 00000000 00000000 c6cd1e88 1e60: c6ccfaa0 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1e80: 00000000 00000000 00000031 c7802310 c7802300 00000138 c7404400 c0771da0 1ea0: 00000000 c6cd1eec c7800340 00000138 be82d65c 00000014 be82d3cc c6cd1f08 1ec0: 00000014 00000000 c7404400 c7404400 00000138 c01f4628 c78d6000 00000000 1ee0: 00000000 be82d3cc 00000138 c6cd1f08 00000014 c6cd1ee4 00000001 00000000 1f00: 00000000 00000000 00080011 00000002 06000000 ffffffff 0000ffff 00000002 1f20: 06000000 ffffffff 0000ffff c00928c8 c065c520 c6cd1f58 00000003 c009299c 1f40: 00000003 c065c520 c7404400 00000000 c7404400 c01f2218 c78106b0 c7441cb0 1f60: 00000000 00000006 c06799fc 00000000 00000000 00000006 00000000 c01f3ee0 1f80: 00000000 00000000 be82d678 be82d65c 00000014 00000001 00000122 c00139c8 1fa0: c6cd0000 c0013840 be82d65c 00000014 00000006 be82d3cc 00000138 00000000 1fc0: be82d65c 00000014 00000001 00000122 00000000 00000000 00018cb1 00000000 1fe0: 00003801 be82d3a8 0003a0c7 b6e9af08 60000010 00000006 00000000 00000000 [<c01be324>] (smc_hardware_send_pkt+0x198/0x22c) from [<c01be868>] (smc_hard_start_xmit+0xc4/0x1e8) [<c01be868>] (smc_hard_start_xmit+0xc4/0x1e8) from [<c0208554>] (dev_hard_start_xmit+0x460/0x4cc) [<c0208554>] (dev_hard_start_xmit+0x460/0x4cc) from [<c021d1d8>] (sch_direct_xmit+0x94/0x18c) [<c021d1d8>] (sch_direct_xmit+0x94/0x18c) from [<c02087f8>] (dev_queue_xmit+0x238/0x42c) [<c02087f8>] (dev_queue_xmit+0x238/0x42c) from [<c027ba74>] (packet_sendmsg+0xbe8/0xd28) [<c027ba74>] (packet_sendmsg+0xbe8/0xd28) from [<c01f2870>] (sock_sendmsg+0x84/0xa8) [<c01f2870>] (sock_sendmsg+0x84/0xa8) from [<c01f4628>] (SyS_sendto+0xb8/0xdc) [<c01f4628>] (SyS_sendto+0xb8/0xdc) from [<c0013840>] (ret_fast_syscall+0x0/0x2c) Code: e3130002 1a000001 e3130001 0affffcd (e7f001f2) ---[ end trace 81104fe70e8da7fe ]--- Kernel panic - not syncing: Fatal exception in interrupt This is because the macro operations in smc91x.h defined for Versatile are missing SMC_outsw() as used in this commit. The Versatile needs and uses the same accessors as the other platforms in the first if(...) clause, just switch it to using that and we have one problem less to worry about. This includes a hunk of a patch from Will Deacon fixin the other 32bit platforms as well: Innokom, Ramses, PXA, PCM027. Checkpatch complains about spacing, but I have opted to follow the style of this .h-file. Cc: Russell King <linux@arm.linux.org.uk> Cc: Nicolas Pitre <nico@fluxnic.net> Cc: Eric Miao <eric.y.miao@gmail.com> Cc: Jonathan Cameron <jic23@cam.ac.uk> Signed-off-by: Will Deacon <will.deacon@arm.com> Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
* net: 8139cp: fix a BUG_ON triggered by wrong bytes_complYang Yingliang2013-12-08
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | [ Upstream commit 7fe0ee099ad5e3dea88d4ee1b6f20246b1ca57c3 ] Using iperf to send packets(GSO mode is on), a bug is triggered: [ 212.672781] kernel BUG at lib/dynamic_queue_limits.c:26! [ 212.673396] invalid opcode: 0000 [#1] SMP [ 212.673882] Modules linked in: 8139cp(O) nls_utf8 edd fuse loop dm_mod ipv6 i2c_piix4 8139too i2c_core intel_agp joydev pcspkr hid_generic intel_gtt floppy sr_mod mii button sg cdrom ext3 jbd mbcache usbhid hid uhci_hcd ehci_hcd usbcore sd_mod usb_common crc_t10dif crct10dif_common processor thermal_sys hwmon scsi_dh_emc scsi_dh_rdac scsi_dh_hp_sw scsi_dh ata_generic ata_piix libata scsi_mod [last unloaded: 8139cp] [ 212.676084] CPU: 0 PID: 4124 Comm: iperf Tainted: G O 3.12.0-0.7-default+ #16 [ 212.676084] Hardware name: Bochs Bochs, BIOS Bochs 01/01/2007 [ 212.676084] task: ffff8800d83966c0 ti: ffff8800db4c8000 task.ti: ffff8800db4c8000 [ 212.676084] RIP: 0010:[<ffffffff8122e23f>] [<ffffffff8122e23f>] dql_completed+0x17f/0x190 [ 212.676084] RSP: 0018:ffff880116e03e30 EFLAGS: 00010083 [ 212.676084] RAX: 00000000000005ea RBX: 0000000000000f7c RCX: 0000000000000002 [ 212.676084] RDX: ffff880111dd0dc0 RSI: 0000000000000bd4 RDI: ffff8800db6ffcc0 [ 212.676084] RBP: ffff880116e03e48 R08: 0000000000000992 R09: 0000000000000000 [ 212.676084] R10: ffffffff8181e400 R11: 0000000000000004 R12: 000000000000000f [ 212.676084] R13: ffff8800d94ec840 R14: ffff8800db440c80 R15: 000000000000000e [ 212.676084] FS: 00007f6685a3c700(0000) GS:ffff880116e00000(0000) knlGS:0000000000000000 [ 212.676084] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033 [ 212.676084] CR2: 00007f6685ad6460 CR3: 00000000db714000 CR4: 00000000000006f0 [ 212.676084] Stack: [ 212.676084] ffff8800db6ffc00 000000000000000f ffff8800d94ec840 ffff880116e03eb8 [ 212.676084] ffffffffa041509f ffff880116e03e88 0000000f16e03e88 ffff8800d94ec000 [ 212.676084] 00000bd400059858 000000050000000f ffffffff81094c36 ffff880116e03eb8 [ 212.676084] Call Trace: [ 212.676084] <IRQ> [ 212.676084] [<ffffffffa041509f>] cp_interrupt+0x4ef/0x590 [8139cp] [ 212.676084] [<ffffffff81094c36>] ? ktime_get+0x56/0xd0 [ 212.676084] [<ffffffff8108cf73>] handle_irq_event_percpu+0x53/0x170 [ 212.676084] [<ffffffff8108d0cc>] handle_irq_event+0x3c/0x60 [ 212.676084] [<ffffffff8108fdb5>] handle_fasteoi_irq+0x55/0xf0 [ 212.676084] [<ffffffff810045df>] handle_irq+0x1f/0x30 [ 212.676084] [<ffffffff81003c8b>] do_IRQ+0x5b/0xe0 [ 212.676084] [<ffffffff8142beaa>] common_interrupt+0x6a/0x6a [ 212.676084] <EOI> [ 212.676084] [<ffffffffa0416a21>] ? cp_start_xmit+0x621/0x97c [8139cp] [ 212.676084] [<ffffffffa0416a09>] ? cp_start_xmit+0x609/0x97c [8139cp] [ 212.676084] [<ffffffff81378ed9>] dev_hard_start_xmit+0x2c9/0x550 [ 212.676084] [<ffffffff813960a9>] sch_direct_xmit+0x179/0x1d0 [ 212.676084] [<ffffffff813793f3>] dev_queue_xmit+0x293/0x440 [ 212.676084] [<ffffffff813b0e46>] ip_finish_output+0x236/0x450 [ 212.676084] [<ffffffff810e59e7>] ? __alloc_pages_nodemask+0x187/0xb10 [ 212.676084] [<ffffffff813b10e8>] ip_output+0x88/0x90 [ 212.676084] [<ffffffff813afa64>] ip_local_out+0x24/0x30 [ 212.676084] [<ffffffff813aff0d>] ip_queue_xmit+0x14d/0x3e0 [ 212.676084] [<ffffffff813c6fd1>] tcp_transmit_skb+0x501/0x840 [ 212.676084] [<ffffffff813c8323>] tcp_write_xmit+0x1e3/0xb20 [ 212.676084] [<ffffffff81363237>] ? skb_page_frag_refill+0x87/0xd0 [ 212.676084] [<ffffffff813c8c8b>] tcp_push_one+0x2b/0x40 [ 212.676084] [<ffffffff813bb7e6>] tcp_sendmsg+0x926/0xc90 [ 212.676084] [<ffffffff813e1d21>] inet_sendmsg+0x61/0xc0 [ 212.676084] [<ffffffff8135e861>] sock_aio_write+0x101/0x120 [ 212.676084] [<ffffffff81107cf1>] ? vma_adjust+0x2e1/0x5d0 [ 212.676084] [<ffffffff812163e0>] ? timerqueue_add+0x60/0xb0 [ 212.676084] [<ffffffff81130b60>] do_sync_write+0x60/0x90 [ 212.676084] [<ffffffff81130d44>] ? rw_verify_area+0x54/0xf0 [ 212.676084] [<ffffffff81130f66>] vfs_write+0x186/0x190 [ 212.676084] [<ffffffff811317fd>] SyS_write+0x5d/0xa0 [ 212.676084] [<ffffffff814321e2>] system_call_fastpath+0x16/0x1b [ 212.676084] Code: ca 41 89 dc 41 29 cc 45 31 db 29 c2 41 89 c5 89 d0 45 29 c5 f7 d0 c1 e8 1f e9 43 ff ff ff 66 0f 1f 44 00 00 31 c0 e9 7b ff ff ff <0f> 0b eb fe 66 66 66 66 2e 0f 1f 84 00 00 00 00 00 c7 47 40 00 [ 212.676084] RIP [<ffffffff8122e23f>] dql_completed+0x17f/0x190 ------------[ cut here ]------------ When a skb has frags, bytes_compl plus skb->len nr_frags times in cp_tx(). It's not the correct value(actually, it should plus skb->len once) and it will trigger the BUG_ON(bytes_compl > num_queued - dql->num_completed). So only increase bytes_compl when finish sending all frags. pkts_compl also has a wrong value, fix it too. It's introduced by commit 871f0d4c ("8139cp: enable bql"). Suggested-by: Eric Dumazet <edumazet@google.com> Signed-off-by: Yang Yingliang <yangyingliang@huawei.com> Signed-off-by: David S. Miller <davem@davemloft.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>