Revert "net: stmmac: use correct DMA buffer size in the RX descriptor"
authorChristian Hoffmann <chrmhoffmann@gmail.com>
Tue, 31 Jan 2023 22:20:55 +0000 (23:20 +0100)
committerChristian Hoffmann <chrmhoffmann@gmail.com>
Sun, 12 Feb 2023 08:05:38 +0000 (09:05 +0100)
This reverts commit 231f1d4c1c1184bfa6b59031eb40958be50393d3.

drivers/net/ethernet/stmicro/stmmac/common.h
drivers/net/ethernet/stmicro/stmmac/descs_com.h
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
drivers/net/ethernet/stmicro/stmmac/enh_desc.c
drivers/net/ethernet/stmicro/stmmac/norm_desc.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index e11920d1277483cbd7ca2f39715ab642efd04ba6..6d2de4e01f6d00404bde51f3816ba2271adff865 100644 (file)
@@ -354,7 +354,7 @@ struct dma_features {
 struct stmmac_desc_ops {
        /* DMA RX descriptor ring initialization */
        void (*init_rx_desc) (struct dma_desc *p, int disable_rx_ic, int mode,
-                             int end, int bfsize);
+                             int end);
        /* DMA TX descriptor ring initialization */
        void (*init_tx_desc) (struct dma_desc *p, int mode, int end);
 
index c8c1a7d0e4d19fe9dc008fe55f44a1be3e12bc78..1d181e205d6ecbb49c5d173fcb6f3ea5bfe6fe40 100644 (file)
 /* Specific functions used for Ring mode */
 
 /* Enhanced descriptors */
-static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end,
-                                          int bfsize)
+static inline void ehn_desc_rx_set_on_ring(struct dma_desc *p, int end)
 {
-       if (bfsize == BUF_SIZE_16KiB)
-               p->des1 |= ((BUF_SIZE_8KiB - 1) << ERDES1_BUFFER2_SIZE_SHIFT)
-                       & ERDES1_BUFFER2_SIZE_MASK;
+       p->des1 |= cpu_to_le32(((BUF_SIZE_8KiB - 1)
+                       << ERDES1_BUFFER2_SIZE_SHIFT)
+                  & ERDES1_BUFFER2_SIZE_MASK);
 
        if (end)
                p->des1 |= cpu_to_le32(ERDES1_END_RING);
@@ -64,15 +63,11 @@ static inline void enh_set_tx_desc_len_on_ring(struct dma_desc *p, int len)
 }
 
 /* Normal descriptors */
-static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end, int bfsize)
+static inline void ndesc_rx_set_on_ring(struct dma_desc *p, int end)
 {
-       if (bfsize >= BUF_SIZE_2KiB) {
-               int bfsize2;
-
-               bfsize2 = min(bfsize - BUF_SIZE_2KiB + 1, BUF_SIZE_2KiB - 1);
-               p->des1 |= cpu_to_le32((bfsize2 << RDES1_BUFFER2_SIZE_SHIFT)
-                           & RDES1_BUFFER2_SIZE_MASK);
-       }
+       p->des1 |= cpu_to_le32(((BUF_SIZE_2KiB - 1)
+                               << RDES1_BUFFER2_SIZE_SHIFT)
+                   & RDES1_BUFFER2_SIZE_MASK);
 
        if (end)
                p->des1 |= cpu_to_le32(RDES1_END_RING);
index a90b02926e4df498699deb28572afe55d39a6b77..3f5056858535a98215583da1cd59b24dd9255db6 100644 (file)
@@ -289,7 +289,7 @@ exit:
 }
 
 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
-                                  int mode, int end, int bfsize)
+                                  int mode, int end)
 {
        p->des3 = cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
 
index 9e2dfa31bc937d0175285364f4291764372af067..77dc5842bd0b366a0de1e6d5664ed026a55fa6c5 100644 (file)
@@ -269,19 +269,15 @@ static int enh_desc_get_rx_status(void *data, struct stmmac_extra_stats *x,
 }
 
 static void enh_desc_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
-                                 int mode, int end, int bfsize)
+                                 int mode, int end)
 {
-       int bfsize1;
-
-       p->des0 |= RDES0_OWN;
-
-       bfsize1 = min(bfsize, BUF_SIZE_8KiB);
-       p->des1 |= cpu_to_le32(bfsize1 & ERDES1_BUFFER1_SIZE_MASK);
+       p->des0 |= cpu_to_le32(RDES0_OWN);
+       p->des1 |= cpu_to_le32((BUF_SIZE_8KiB - 1) & ERDES1_BUFFER1_SIZE_MASK);
 
        if (mode == STMMAC_CHAIN_MODE)
                ehn_desc_rx_set_on_chain(p);
        else
-               ehn_desc_rx_set_on_ring(p, end, bfsize);
+               ehn_desc_rx_set_on_ring(p, end);
 
        if (disable_rx_ic)
                p->des1 |= cpu_to_le32(ERDES1_DISABLE_IC);
index d38a2fce87f768361126e5da63996d387db20d60..01f8f2e94c0fb974b7f0230c74fca83e929a2312 100644 (file)
@@ -137,19 +137,15 @@ static int ndesc_get_rx_status(void *data, struct stmmac_extra_stats *x,
 }
 
 static void ndesc_init_rx_desc(struct dma_desc *p, int disable_rx_ic, int mode,
-                              int end, int bfsize)
+                              int end)
 {
-       int bfsize1;
-
-       p->des0 |= RDES0_OWN;
-
-       bfsize1 = min(bfsize, BUF_SIZE_2KiB - 1);
-       p->des1 |= cpu_to_le32(bfsize & RDES1_BUFFER1_SIZE_MASK);
+       p->des0 |= cpu_to_le32(RDES0_OWN);
+       p->des1 |= cpu_to_le32((BUF_SIZE_2KiB - 1) & RDES1_BUFFER1_SIZE_MASK);
 
        if (mode == STMMAC_CHAIN_MODE)
                ndesc_rx_set_on_chain(p, end);
        else
-               ndesc_rx_set_on_ring(p, end, bfsize);
+               ndesc_rx_set_on_ring(p, end);
 
        if (disable_rx_ic)
                p->des1 |= cpu_to_le32(RDES1_DISABLE_IC);
index 724161147596139c7658eb9d5cfcddb419d49df1..978ce54d9230cb89b6d0199eddbe433c6eadd514 100644 (file)
@@ -972,13 +972,11 @@ static void stmmac_clear_descriptors(struct stmmac_priv *priv)
                if (priv->extend_desc)
                        priv->hw->desc->init_rx_desc(&priv->dma_erx[i].basic,
                                                     priv->use_riwt, priv->mode,
-                                                    (i == DMA_RX_SIZE - 1),
-                                                    priv->dma_buf_sz);
+                                                    (i == DMA_RX_SIZE - 1));
                else
                        priv->hw->desc->init_rx_desc(&priv->dma_rx[i],
                                                     priv->use_riwt, priv->mode,
-                                                    (i == DMA_RX_SIZE - 1),
-                                                    priv->dma_buf_sz);
+                                                    (i == DMA_RX_SIZE - 1));
        for (i = 0; i < DMA_TX_SIZE; i++)
                if (priv->extend_desc)
                        priv->hw->desc->init_tx_desc(&priv->dma_etx[i].basic,
@@ -2519,8 +2517,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv)
                wmb();
 
                if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
-                       priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0,
-                                                    priv->dma_buf_sz);
+                       priv->hw->desc->init_rx_desc(p, priv->use_riwt, 0, 0);
                else
                        priv->hw->desc->set_rx_owner(p);