linux/drivers/net/ethernet/huawei/hinic
Zhao Chen 9c2956d2ad net-next: hinic: fix a problem in free_tx_poll()
This patch fixes the problem below. The problem can be reproduced by the
following steps:
1) Connecting all HiNIC interfaces
2) On server side
    # sudo ifconfig eth0 192.168.100.1 up #Using MLX CX4 card
    # iperf -s
3) On client side
    # sudo ifconfig eth0 192.168.100.2 up #Using our HiNIC card
    # iperf -c 192.168.101.1 -P 10 -t 100000

after hours of testing, we will see errors:

    hinic 0000:05:00.0: No MGMT msg handler, mod = 0
    hinic 0000:05:00.0: No MGMT msg handler, mod = 0
    hinic 0000:05:00.0: No MGMT msg handler, mod = 0
    hinic 0000:05:00.0: No MGMT msg handler, mod = 0

The errors are caused by the following problem.
1) The hinic_get_wqe() checks the "wq->delta" to allocate new WQEs:

	if (atomic_sub_return(num_wqebbs, &wq->delta) <= 0) {
		atomic_add(num_wqebbs, &wq->delta);
		return ERR_PTR(-EBUSY);
	}

If the WQE occupies multiple pages, the shadow WQE will be used. Then the
hinic_xmit_frame() fills the WQE.

2) While in parallel with 1), the free_tx_poll() checks the "wq->delta"
to free old WQEs:

	if ((atomic_read(&wq->delta) + num_wqebbs) > wq->q_depth)
		return ERR_PTR(-EBUSY);

There is a probability that the shadow WQE which hinic_xmit_frame() is
using will be damaged by copy_wqe_to_shadow():

	if (curr_pg != end_pg) {
		void *shadow_addr = &wq->shadow_wqe[curr_pg * wq->max_wqe_size];

		copy_wqe_to_shadow(wq, shadow_addr, num_wqebbs, *cons_idx);
		return shadow_addr;
	}

This can cause WQE data error and you will see the above error messages.
This patch fixes the problem.

Signed-off-by: Zhao Chen <zhaochen6@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
2018-08-08 09:46:08 -07:00
..
Kconfig net-next/hinic: add arm64 support 2018-04-19 13:34:44 -04:00
Makefile net-next/hinic: Set qp context 2017-08-22 10:48:53 -07:00
hinic_common.c net-next/hinic: Add cmdq commands 2017-08-22 10:48:53 -07:00
hinic_common.h net-next/hinic: Add cmdq commands 2017-08-22 10:48:53 -07:00
hinic_dev.h net-next/hinic: Add ethtool and stats 2017-08-22 10:48:54 -07:00
hinic_hw_api_cmd.c hinic: uninitialized variable in hinic_api_cmd_init() 2017-08-24 21:47:11 -07:00
hinic_hw_api_cmd.h net-next/hinic: Add api cmd commands 2017-08-22 10:48:53 -07:00
hinic_hw_cmdq.c treewide: Use array_size() in vzalloc() 2018-06-12 16:19:22 -07:00
hinic_hw_cmdq.h hinic: Replace PCI pool old API 2018-01-02 16:14:49 -06:00
hinic_hw_csr.h net-next/hinic: Add Rx handler 2017-08-22 10:48:54 -07:00
hinic_hw_dev.c net: hinic: remove redundant pointer pfhwdev 2018-07-04 22:39:11 +09:00
hinic_hw_dev.h net-next/hinic: Add Tx operation 2017-08-22 10:48:54 -07:00
hinic_hw_eqs.c net: hinic: make functions set_ctrl0 and set_ctrl1 static 2017-08-23 22:20:28 -07:00
hinic_hw_eqs.h net-next/hinic: Add ceqs 2017-08-22 10:48:53 -07:00
hinic_hw_if.c net-next/hinic: Add Rx handler 2017-08-22 10:48:54 -07:00
hinic_hw_if.h net-next/hinic: Add Rx handler 2017-08-22 10:48:54 -07:00
hinic_hw_io.c net-next/hinic: Add ceqs 2017-08-22 10:48:53 -07:00
hinic_hw_io.h net-next/hinic: Add cmdq commands 2017-08-22 10:48:53 -07:00
hinic_hw_mgmt.c net-next/hinic: Add Rx mode and link event handler 2017-08-22 10:48:53 -07:00
hinic_hw_mgmt.h net-next/hinic: Add Rx handler 2017-08-22 10:48:54 -07:00
hinic_hw_qp.c net-next: hinic: fix a problem in free_tx_poll() 2018-08-08 09:46:08 -07:00
hinic_hw_qp.h net-next: hinic: fix a problem in free_tx_poll() 2018-08-08 09:46:08 -07:00
hinic_hw_qp_ctxt.h net-next/hinic: Set qp context 2017-08-22 10:48:53 -07:00
hinic_hw_wq.c net-next/hinic: Add Rx handler 2017-08-22 10:48:54 -07:00
hinic_hw_wq.h net-next/hinic: Add Rx handler 2017-08-22 10:48:54 -07:00
hinic_hw_wqe.h net-next/hinic: Add cmdq commands 2017-08-22 10:48:53 -07:00
hinic_main.c hinic: Link the logical network device to the pci device in sysfs 2018-07-25 13:54:52 -07:00
hinic_port.c net-next/hinic: Add ethtool and stats 2017-08-22 10:48:54 -07:00
hinic_port.h net-next/hinic: Add ethtool and stats 2017-08-22 10:48:54 -07:00
hinic_rx.c hinic: reset irq affinity before freeing irq 2018-06-28 13:34:57 +09:00
hinic_rx.h net-next/hinic: Add ethtool and stats 2017-08-22 10:48:54 -07:00
hinic_tx.c net-next: hinic: fix a problem in free_tx_poll() 2018-08-08 09:46:08 -07:00
hinic_tx.h net-next/hinic: Add ethtool and stats 2017-08-22 10:48:54 -07:00