提交 9aaae044 编写于 作者: W wenxiong@linux.vnet.ibm.com 提交者: David S. Miller

bnx2x: Fix kernel crash and data miscompare after EEH recovery

A rmb() is required to ensure that the CQE is not read before it
is written by the adapter DMA.  PCI ordering rules will make sure
the other fields are written before the marker at the end of struct
eth_fast_path_rx_cqe but without rmb() a weakly ordered processor can
process stale data.

Without the barrier we have observed various crashes including
bnx2x_tpa_start being called on queues not stopped (resulting in message
start of bin not in stop) and NULL pointer exceptions from bnx2x_rx_int.
Signed-off-by: NMilton Miller <miltonm@us.ibm.com>
Signed-off-by: NWen Xiong <wenxiong@linux.vnet.ibm.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 0c0e6341
...@@ -906,6 +906,18 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget) ...@@ -906,6 +906,18 @@ static int bnx2x_rx_int(struct bnx2x_fastpath *fp, int budget)
bd_prod = RX_BD(bd_prod); bd_prod = RX_BD(bd_prod);
bd_cons = RX_BD(bd_cons); bd_cons = RX_BD(bd_cons);
/* A rmb() is required to ensure that the CQE is not read
* before it is written by the adapter DMA. PCI ordering
* rules will make sure the other fields are written before
* the marker at the end of struct eth_fast_path_rx_cqe
* but without rmb() a weakly ordered processor can process
* stale data. Without the barrier TPA state-machine might
* enter inconsistent state and kernel stack might be
* provided with incorrect packet description - these lead
* to various kernel crashed.
*/
rmb();
cqe_fp_flags = cqe_fp->type_error_flags; cqe_fp_flags = cqe_fp->type_error_flags;
cqe_fp_type = cqe_fp_flags & ETH_FAST_PATH_RX_CQE_TYPE; cqe_fp_type = cqe_fp_flags & ETH_FAST_PATH_RX_CQE_TYPE;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册