@@ -1161,9 +1161,8 @@ static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p,
11611161 else
11621162 p -> des2 = cpu_to_le32 (rx_q -> rx_skbuff_dma [i ]);
11631163
1164- if ((priv -> hw -> mode -> init_desc3 ) &&
1165- (priv -> dma_buf_sz == BUF_SIZE_16KiB ))
1166- priv -> hw -> mode -> init_desc3 (p );
1164+ if (priv -> dma_buf_sz == BUF_SIZE_16KiB )
1165+ stmmac_init_desc3 (priv , p );
11671166
11681167 return 0 ;
11691168}
@@ -1229,13 +1228,14 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
12291228{
12301229 struct stmmac_priv * priv = netdev_priv (dev );
12311230 u32 rx_count = priv -> plat -> rx_queues_to_use ;
1232- unsigned int bfsize = 0 ;
12331231 int ret = - ENOMEM ;
1232+ int bfsize = 0 ;
12341233 int queue ;
12351234 int i ;
12361235
1237- if (priv -> hw -> mode -> set_16kib_bfsize )
1238- bfsize = priv -> hw -> mode -> set_16kib_bfsize (dev -> mtu );
1236+ bfsize = stmmac_set_16kib_bfsize (priv , dev -> mtu );
1237+ if (bfsize < 0 )
1238+ bfsize = 0 ;
12391239
12401240 if (bfsize < BUF_SIZE_16KiB )
12411241 bfsize = stmmac_set_bfsize (dev -> mtu , priv -> dma_buf_sz );
@@ -1279,13 +1279,11 @@ static int init_dma_rx_desc_rings(struct net_device *dev, gfp_t flags)
12791279 /* Setup the chained descriptor addresses */
12801280 if (priv -> mode == STMMAC_CHAIN_MODE ) {
12811281 if (priv -> extend_desc )
1282- priv -> hw -> mode -> init (rx_q -> dma_erx ,
1283- rx_q -> dma_rx_phy ,
1284- DMA_RX_SIZE , 1 );
1282+ stmmac_mode_init (priv , rx_q -> dma_erx ,
1283+ rx_q -> dma_rx_phy , DMA_RX_SIZE , 1 );
12851284 else
1286- priv -> hw -> mode -> init (rx_q -> dma_rx ,
1287- rx_q -> dma_rx_phy ,
1288- DMA_RX_SIZE , 0 );
1285+ stmmac_mode_init (priv , rx_q -> dma_rx ,
1286+ rx_q -> dma_rx_phy , DMA_RX_SIZE , 0 );
12891287 }
12901288 }
12911289
@@ -1332,13 +1330,11 @@ static int init_dma_tx_desc_rings(struct net_device *dev)
13321330 /* Setup the chained descriptor addresses */
13331331 if (priv -> mode == STMMAC_CHAIN_MODE ) {
13341332 if (priv -> extend_desc )
1335- priv -> hw -> mode -> init (tx_q -> dma_etx ,
1336- tx_q -> dma_tx_phy ,
1337- DMA_TX_SIZE , 1 );
1333+ stmmac_mode_init (priv , tx_q -> dma_etx ,
1334+ tx_q -> dma_tx_phy , DMA_TX_SIZE , 1 );
13381335 else
1339- priv -> hw -> mode -> init (tx_q -> dma_tx ,
1340- tx_q -> dma_tx_phy ,
1341- DMA_TX_SIZE , 0 );
1336+ stmmac_mode_init (priv , tx_q -> dma_tx ,
1337+ tx_q -> dma_tx_phy , DMA_TX_SIZE , 0 );
13421338 }
13431339
13441340 for (i = 0 ; i < DMA_TX_SIZE ; i ++ ) {
@@ -1886,8 +1882,7 @@ static void stmmac_tx_clean(struct stmmac_priv *priv, u32 queue)
18861882 tx_q -> tx_skbuff_dma [entry ].map_as_page = false;
18871883 }
18881884
1889- if (priv -> hw -> mode -> clean_desc3 )
1890- priv -> hw -> mode -> clean_desc3 (tx_q , p );
1885+ stmmac_clean_desc3 (priv , tx_q , p );
18911886
18921887 tx_q -> tx_skbuff_dma [entry ].last_segment = false;
18931888 tx_q -> tx_skbuff_dma [entry ].is_jumbo = false;
@@ -3099,11 +3094,11 @@ static netdev_tx_t stmmac_xmit(struct sk_buff *skb, struct net_device *dev)
30993094 enh_desc = priv -> plat -> enh_desc ;
31003095 /* To program the descriptors according to the size of the frame */
31013096 if (enh_desc )
3102- is_jumbo = priv -> hw -> mode -> is_jumbo_frm ( skb -> len , enh_desc );
3097+ is_jumbo = stmmac_is_jumbo_frm ( priv , skb -> len , enh_desc );
31033098
31043099 if (unlikely (is_jumbo ) && likely (priv -> synopsys_id <
31053100 DWMAC_CORE_4_00 )) {
3106- entry = priv -> hw -> mode -> jumbo_frm ( tx_q , skb , csum_insertion );
3101+ entry = stmmac_jumbo_frm ( priv , tx_q , skb , csum_insertion );
31073102 if (unlikely (entry < 0 ))
31083103 goto dma_map_err ;
31093104 }
@@ -3332,8 +3327,8 @@ static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
33323327 } else {
33333328 p -> des2 = cpu_to_le32 (rx_q -> rx_skbuff_dma [entry ]);
33343329 }
3335- if ( priv -> hw -> mode -> refill_desc3 )
3336- priv -> hw -> mode -> refill_desc3 ( rx_q , p );
3330+
3331+ stmmac_refill_desc3 ( priv , rx_q , p );
33373332
33383333 if (rx_q -> rx_zeroc_thresh > 0 )
33393334 rx_q -> rx_zeroc_thresh -- ;
0 commit comments