From b86290a392dbea54fc4f2fff3de6bf17c8415bc8 Mon Sep 17 00:00:00 2001 From: Bhadram Varka Date: Fri, 21 Mar 2025 12:09:20 +0000 Subject: [PATCH] osi: dma: Fix Tx/Rx ring length configuration Issue: DMA Tx/Rx ring length not updating correctly after changing with ethtool. The issue was caused by the ring length being read from the hardware and then logically OR'd with the new ring length value. This resulted in the ring length being set to the value configured during boot, as the hardware was not reset in this process. Instead of reading the value from the hardware and logically OR'ing it with the new value, directly set the ring length value to the hardware. Fix: Instead of reading the value from the hardware and logically OR'ing it with the new value, directly set the ring length value to the hardware. Bug 5158977 Change-Id: I23dc3f18f21c884feea9845e439fbf2783d68bcb Signed-off-by: Bhadram Varka Reviewed-on: https://git-master.nvidia.com/r/c/kernel/nvethernetrm/+/3323922 Reviewed-by: svc-mobile-coverity Reviewed-by: svc-mobile-misra Reviewed-by: svc-mobile-cert Reviewed-by: Mahesh Patil Reviewed-by: Srinivas Ramachandran Reviewed-by: svcacv GVS: buildbot_gerritrpt --- osi/dma/osi_dma_txrx.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/osi/dma/osi_dma_txrx.c b/osi/dma/osi_dma_txrx.c index db89bf0..08015d1 100644 --- a/osi/dma/osi_dma_txrx.c +++ b/osi/dma/osi_dma_txrx.c @@ -1501,8 +1501,7 @@ static nve32_t rx_dma_desc_initialization(const struct osi_dma_priv_data *const } /* Update the HW DMA ring length */ - val = osi_dma_readl((nveu8_t *)osi_dma->base + ring_len_reg[osi_dma->mac]); - val |= (osi_dma->rx_ring_sz - 1U) & mask[osi_dma->mac]; + val = (osi_dma->rx_ring_sz - 1U) & mask[osi_dma->mac]; osi_dma_writel(val, (nveu8_t *)osi_dma->base + ring_len_reg[osi_dma->mac]); update_rx_tail_ptr(osi_dma, chan, tailptr); @@ -1584,8 +1583,7 @@ static inline void set_tx_ring_len_and_start_addr(const struct osi_dma_priv_data nveu32_t val; /* Program ring length */ - val = osi_dma_readl((nveu8_t *)osi_dma->base + ring_len_reg[osi_dma->mac]); - val |= len & mask[osi_dma->mac]; + val = len & mask[osi_dma->mac]; osi_dma_writel(val, (nveu8_t *)osi_dma->base + ring_len_reg[osi_dma->mac]); /* Program tx ring start address */