Patch "bnxt_en: Fix completion ring sizing with TPA enabled." has been added to the 5.7-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This is a note to let you know that I've just added the patch titled

    bnxt_en: Fix completion ring sizing with TPA enabled.

to the 5.7-stable tree which can be found at:
    http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary

The filename of the patch is:
     bnxt_en-fix-completion-ring-sizing-with-tpa-enabled.patch
and it can be found in the queue-5.7 subdirectory.

If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@xxxxxxxxxxxxxxx> know about it.



commit 7fa7ff14b8d2d7cb31958384df6cf473520cfcf9
Author: Michael Chan <michael.chan@xxxxxxxxxxxx>
Date:   Sat Jul 11 20:48:25 2020 -0400

    bnxt_en: Fix completion ring sizing with TPA enabled.
    
    [ Upstream commit 27640ce68d21e556b66bc5fa022aacd26e53c947 ]
    
    The current completion ring sizing formula is wrong with TPA enabled.
    The formula assumes that the number of TPA completions are bound by the
    RX ring size, but that's not true.  TPA_START completions are immediately
    recycled so they are not bound by the RX ring size.  We must add
    bp->max_tpa to the worst case maximum RX and TPA completions.
    
    The completion ring can overflow because of this mistake.  This will
    cause hardware to disable the completion ring when this happens,
    leading to RX and TX traffic to stall on that ring.  This issue is
    generally exposed only when the RX ring size is set very small.
    
    Fix the formula by adding bp->max_tpa to the number of RX completions
    if TPA is enabled.
    
    Fixes: c0c050c58d84 ("bnxt_en: New Broadcom ethernet driver.");
    Reviewed-by: Vasundhara Volam <vasundhara-v.volam@xxxxxxxxxxxx>
    Signed-off-by: Michael Chan <michael.chan@xxxxxxxxxxxx>
    Signed-off-by: David S. Miller <davem@xxxxxxxxxxxxx>
    Signed-off-by: Sasha Levin <sashal@xxxxxxxxxx>

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 198bca9c1e2df..1656dc277af41 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -3418,7 +3418,7 @@ void bnxt_set_tpa_flags(struct bnxt *bp)
  */
 void bnxt_set_ring_params(struct bnxt *bp)
 {
-	u32 ring_size, rx_size, rx_space;
+	u32 ring_size, rx_size, rx_space, max_rx_cmpl;
 	u32 agg_factor = 0, agg_ring_size = 0;
 
 	/* 8 for CRC and VLAN */
@@ -3474,7 +3474,15 @@ void bnxt_set_ring_params(struct bnxt *bp)
 	bp->tx_nr_pages = bnxt_calc_nr_ring_pages(ring_size, TX_DESC_CNT);
 	bp->tx_ring_mask = (bp->tx_nr_pages * TX_DESC_CNT) - 1;
 
-	ring_size = bp->rx_ring_size * (2 + agg_factor) + bp->tx_ring_size;
+	max_rx_cmpl = bp->rx_ring_size;
+	/* MAX TPA needs to be added because TPA_START completions are
+	 * immediately recycled, so the TPA completions are not bound by
+	 * the RX ring size.
+	 */
+	if (bp->flags & BNXT_FLAG_TPA)
+		max_rx_cmpl += bp->max_tpa;
+	/* RX and TPA completions are 32-byte, all others are 16-byte */
+	ring_size = max_rx_cmpl * 2 + agg_ring_size + bp->tx_ring_size;
 	bp->cp_ring_size = ring_size;
 
 	bp->cp_nr_pages = bnxt_calc_nr_ring_pages(ring_size, CP_DESC_CNT);



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux