bnxt_en: 2 bug fixes.
Michael Chan
maintainercover bnxt_en: 2 bug fixes.
The first patch prevents possible driver crash if we get a bad RX index from the hardware. The second patch resets the device when the hardware reports buffer error to recover from the error.
Please queue these for -stable also. Thanks.
Michael Chan (2):
bnxt_en: Improve RX consumer index validity check.
bnxt_en: Reset device on RX buffer errors.
drivers/net/ethernet/broadcom/bnxt/bnxt.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-)
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 1/2 bnxt_en: Improve RX consumer index validity check.
There is logic to check that the RX/TPA consumer index is the expected index to work around a hardware problem. However, the potentially bad consumer index is first used to index into an array to reference an entry. This can potentially crash if the bad consumer index is beyond legal range. Improve the logic to use the consumer index for dereferencing after the validity check and log an error message.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +7 -3
@@ -1133,6 +1133,8 @@ static void bnxt_tpa_start(struct bnxt *bp, struct bnxt_rx_ring_info *rxr, tpa_info = &rxr->rx_tpa[agg_id];if (unlikely (cons != rxr->rx_next_cons)) { +netdev_warn (bp->dev,"TPA cons %x != expected cons %x\n" , + cons, rxr->rx_next_cons);bnxt_sched_reset (bp, rxr);return ; }
@@ -1585,15 +1587,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, } cons = rxcmp->rx_cmp_opaque; - rx_buf = &rxr->rx_buf_ring[cons]; - data = rx_buf->data; - data_ptr = rx_buf->data_ptr;if (unlikely (cons != rxr->rx_next_cons)) {int rc1 =bnxt_discard_rx (bp, cpr, raw_cons, rxcmp); +netdev_warn (bp->dev,"RX cons %x != expected cons %x\n" , + cons, rxr->rx_next_cons);bnxt_sched_reset (bp, rxr);return rc1; } + rx_buf = &rxr->rx_buf_ring[cons]; + data = rx_buf->data; + data_ptr = rx_buf->data_ptr;prefetch (data_ptr); misc =le32_to_cpu (rxcmp->rx_cmp_misc_v1);
Signature · 1 line
2.5.1
Michael Chan
maintainerPATCH 2/2 bnxt_en: Reset device on RX buffer errors.
In reply to Michael ChanIf the RX completion indicates RX buffers errors, the RX ring will be disabled by firmware and no packets will be received on that ring from that point on. Recover by resetting the device.
--- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/net/ethernet/broadcom/bnxt/bnxt.c +6 -0
@@ -1614,11 +1614,17 @@ static int bnxt_rx_pkt(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, rx_buf->data =NULL ;if (rxcmp1->rx_cmp_cfa_code_errors_v2 &RX_CMP_L2_ERRORS ) { +u32 rx_err =le32_to_cpu (rxcmp1->rx_cmp_cfa_code_errors_v2); +bnxt_reuse_rx_data (rxr, cons, data);if (agg_bufs)bnxt_reuse_rx_agg_bufs (cpr, cp_cons, agg_bufs); rc = -EIO ; +if (rx_err &RX_CMPL_ERRORS_BUFFER_ERROR_MASK ) { +netdev_warn (bp->dev,"RX buffer error %x\n" , rx_err); +bnxt_sched_reset (bp, rxr); + } goto next_rx; }
Signature · 1 line
2.5.1
David Miller
maintainerFrom: Michael Chan <[email protected]>
Date: Mon, 8 Apr 2019 17:39:53 -0400
Quoted 5 lines
The first patch prevents possible driver crash if we get a bad RX index from the hardware. The second patch resets the device when the hardware reports buffer error to recover from the error.
Please queue these for -stable also. Thanks.
Series applied and queued up for -stable, thanks.