net: stmmac: Uniformize set_rx_owner()
authorJose Abreu <Jose.Abreu@synopsys.com>
Fri, 18 May 2018 13:56:07 +0000 (14:56 +0100)
committerDavid S. Miller <davem@davemloft.net>
Fri, 18 May 2018 15:00:16 +0000 (11:00 -0400)
Currently an if condition is used to select the correct callback to set
rx_onwer in descriptor. Lets keep this simple and always use the same
callback.

Signed-off-by: Jose Abreu <joabreu@synopsys.com>
Cc: David S. Miller <davem@davemloft.net>
Cc: Joao Pinto <jpinto@synopsys.com>
Cc: Vitor Soares <soares@synopsys.com>
Cc: Giuseppe Cavallaro <peppe.cavallaro@st.com>
Cc: Alexandre Torgue <alexandre.torgue@st.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/stmicro/stmmac/dwmac4_descs.c
drivers/net/ethernet/stmicro/stmmac/enh_desc.c
drivers/net/ethernet/stmicro/stmmac/hwif.h
drivers/net/ethernet/stmicro/stmmac/norm_desc.c
drivers/net/ethernet/stmicro/stmmac/stmmac_main.c

index 119a2f93dd55ddff37ba3d2b40a9905b55f3c35c..63f869ce28afe658b1efb73f9989af3c5ec1cab1 100644 (file)
@@ -189,9 +189,12 @@ static void dwmac4_set_tx_owner(struct dma_desc *p)
        p->des3 |= cpu_to_le32(TDES3_OWN);
 }
 
-static void dwmac4_set_rx_owner(struct dma_desc *p)
+static void dwmac4_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
 {
-       p->des3 |= cpu_to_le32(RDES3_OWN);
+       p->des3 = cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
+
+       if (!disable_rx_ic)
+               p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
 }
 
 static int dwmac4_get_tx_ls(struct dma_desc *p)
@@ -292,10 +295,7 @@ exit:
 static void dwmac4_rd_init_rx_desc(struct dma_desc *p, int disable_rx_ic,
                                   int mode, int end)
 {
-       p->des3 = cpu_to_le32(RDES3_OWN | RDES3_BUFFER1_VALID_ADDR);
-
-       if (!disable_rx_ic)
-               p->des3 |= cpu_to_le32(RDES3_INT_ON_COMPLETION_EN);
+       dwmac4_set_rx_owner(p, disable_rx_ic);
 }
 
 static void dwmac4_rd_init_tx_desc(struct dma_desc *p, int mode, int end)
index 17cd26fb2a3d2fb0d6e5f29778f2070513c3095c..743a60f6ba2b7354c3f205090302476b21c27dec 100644 (file)
@@ -292,7 +292,7 @@ static void enh_desc_set_tx_owner(struct dma_desc *p)
        p->des0 |= cpu_to_le32(ETDES0_OWN);
 }
 
-static void enh_desc_set_rx_owner(struct dma_desc *p)
+static void enh_desc_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
 {
        p->des0 |= cpu_to_le32(RDES0_OWN);
 }
index 1c674d61060c3cfc029bb60f31c5e8cbca6a0823..06b5e5b15069c6161cf16354629c87a4aa3a8ea7 100644 (file)
@@ -59,7 +59,7 @@ struct stmmac_desc_ops {
        /* Get the buffer size from the descriptor */
        int (*get_tx_len)(struct dma_desc *p);
        /* Handle extra events on specific interrupts hw dependent */
-       void (*set_rx_owner)(struct dma_desc *p);
+       void (*set_rx_owner)(struct dma_desc *p, int disable_rx_ic);
        /* Get the receive frame size */
        int (*get_rx_frame_len)(struct dma_desc *p, int rx_coe_type);
        /* Return the reception status looking at the RDES1 */
index a7b221b591783476dd7fc025739ddaf71476030a..2facdb5d1aa07dd5ed90ec45340ceac79e4804f3 100644 (file)
@@ -168,7 +168,7 @@ static void ndesc_set_tx_owner(struct dma_desc *p)
        p->des0 |= cpu_to_le32(TDES0_OWN);
 }
 
-static void ndesc_set_rx_owner(struct dma_desc *p)
+static void ndesc_set_rx_owner(struct dma_desc *p, int disable_rx_ic)
 {
        p->des0 |= cpu_to_le32(RDES0_OWN);
 }
index 1e7ded6dd7b33174cb62224d8393c89cbf8cfe1e..35ccf3f8a5a7b7ff2756dbe8ba08ab513d01dbd0 100644 (file)
@@ -3262,10 +3262,7 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
                }
                dma_wmb();
 
-               if (unlikely(priv->synopsys_id >= DWMAC_CORE_4_00))
-                       stmmac_init_rx_desc(priv, p, priv->use_riwt, 0, 0);
-               else
-                       stmmac_set_rx_owner(priv, p);
+               stmmac_set_rx_owner(priv, p, priv->use_riwt);
 
                dma_wmb();