1 From 8531c80800c10e8ef7952022326c2f983e1314bf Mon Sep 17 00:00:00 2001
2 From: Christian Marangi <ansuelsmth@gmail.com>
3 Date: Sat, 23 Jul 2022 16:29:31 +0200
4 Subject: [PATCH 3/5] net: ethernet: stmicro: stmmac: move dma conf to
7 Move dma buf conf to dedicated struct. This in preparation for code
8 rework that will permit to allocate separate dma_conf without affecting
11 Signed-off-by: Christian Marangi <ansuelsmth@gmail.com>
12 Signed-off-by: Jakub Kicinski <kuba@kernel.org>
14 .../net/ethernet/stmicro/stmmac/chain_mode.c | 6 +-
15 .../net/ethernet/stmicro/stmmac/ring_mode.c | 4 +-
16 drivers/net/ethernet/stmicro/stmmac/stmmac.h | 21 +-
17 .../ethernet/stmicro/stmmac/stmmac_ethtool.c | 4 +-
18 .../net/ethernet/stmicro/stmmac/stmmac_main.c | 286 +++++++++---------
19 .../stmicro/stmmac/stmmac_selftests.c | 8 +-
20 .../net/ethernet/stmicro/stmmac/stmmac_tc.c | 6 +-
21 7 files changed, 172 insertions(+), 163 deletions(-)
23 --- a/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
24 +++ b/drivers/net/ethernet/stmicro/stmmac/chain_mode.c
25 @@ -46,7 +46,7 @@ static int jumbo_frm(void *p, struct sk_
28 tx_q->tx_skbuff[entry] = NULL;
29 - entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
30 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
31 desc = tx_q->dma_tx + entry;
34 @@ -137,7 +137,7 @@ static void refill_desc3(void *priv_ptr,
36 p->des3 = cpu_to_le32((unsigned int)(rx_q->dma_rx_phy +
37 (((rx_q->dirty_rx) + 1) %
38 - priv->dma_rx_size) *
39 + priv->dma_conf.dma_rx_size) *
40 sizeof(struct dma_desc)));
43 @@ -155,7 +155,7 @@ static void clean_desc3(void *priv_ptr,
45 p->des3 = cpu_to_le32((unsigned int)((tx_q->dma_tx_phy +
46 ((tx_q->dirty_tx + 1) %
48 + priv->dma_conf.dma_tx_size))
49 * sizeof(struct dma_desc)));
52 --- a/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
53 +++ b/drivers/net/ethernet/stmicro/stmmac/ring_mode.c
54 @@ -51,7 +51,7 @@ static int jumbo_frm(void *p, struct sk_
55 stmmac_prepare_tx_desc(priv, desc, 1, bmax, csum,
56 STMMAC_RING_MODE, 0, false, skb->len);
57 tx_q->tx_skbuff[entry] = NULL;
58 - entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
59 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
61 if (priv->extend_desc)
62 desc = (struct dma_desc *)(tx_q->dma_etx + entry);
63 @@ -107,7 +107,7 @@ static void refill_desc3(void *priv_ptr,
64 struct stmmac_priv *priv = rx_q->priv_data;
66 /* Fill DES3 in case of RING mode */
67 - if (priv->dma_buf_sz == BUF_SIZE_16KiB)
68 + if (priv->dma_conf.dma_buf_sz == BUF_SIZE_16KiB)
69 p->des3 = cpu_to_le32(le32_to_cpu(p->des2) + BUF_SIZE_8KiB);
72 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac.h
73 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac.h
74 @@ -185,6 +185,18 @@ struct stmmac_rfs_entry {
78 +struct stmmac_dma_conf {
79 + unsigned int dma_buf_sz;
82 + struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
83 + unsigned int dma_rx_size;
86 + struct stmmac_tx_queue tx_queue[MTL_MAX_TX_QUEUES];
87 + unsigned int dma_tx_size;
91 /* Frequently used values are kept adjacent for cache effect */
92 u32 tx_coal_frames[MTL_MAX_TX_QUEUES];
93 @@ -199,7 +211,6 @@ struct stmmac_priv {
97 - unsigned int dma_buf_sz;
98 unsigned int rx_copybreak;
99 u32 rx_riwt[MTL_MAX_TX_QUEUES];
101 @@ -211,13 +222,7 @@ struct stmmac_priv {
102 int (*hwif_quirks)(struct stmmac_priv *priv);
106 - struct stmmac_rx_queue rx_queue[MTL_MAX_RX_QUEUES];
107 - unsigned int dma_rx_size;
110 - struct stmmac_tx_queue tx_queue[MTL_MAX_TX_QUEUES];
111 - unsigned int dma_tx_size;
112 + struct stmmac_dma_conf dma_conf;
114 /* Generic channel for NAPI */
115 struct stmmac_channel channel[STMMAC_CH_MAX];
116 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
117 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
118 @@ -484,8 +484,8 @@ static void stmmac_get_ringparam(struct
120 ring->rx_max_pending = DMA_MAX_RX_SIZE;
121 ring->tx_max_pending = DMA_MAX_TX_SIZE;
122 - ring->rx_pending = priv->dma_rx_size;
123 - ring->tx_pending = priv->dma_tx_size;
124 + ring->rx_pending = priv->dma_conf.dma_rx_size;
125 + ring->tx_pending = priv->dma_conf.dma_tx_size;
128 static int stmmac_set_ringparam(struct net_device *netdev,
129 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
130 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c
131 @@ -74,8 +74,8 @@ static int phyaddr = -1;
132 module_param(phyaddr, int, 0444);
133 MODULE_PARM_DESC(phyaddr, "Physical device address");
135 -#define STMMAC_TX_THRESH(x) ((x)->dma_tx_size / 4)
136 -#define STMMAC_RX_THRESH(x) ((x)->dma_rx_size / 4)
137 +#define STMMAC_TX_THRESH(x) ((x)->dma_conf.dma_tx_size / 4)
138 +#define STMMAC_RX_THRESH(x) ((x)->dma_conf.dma_rx_size / 4)
140 /* Limit to make sure XDP TX and slow path can coexist */
141 #define STMMAC_XSK_TX_BUDGET_MAX 256
142 @@ -232,7 +232,7 @@ static void stmmac_disable_all_queues(st
144 /* synchronize_rcu() needed for pending XDP buffers to drain */
145 for (queue = 0; queue < rx_queues_cnt; queue++) {
146 - rx_q = &priv->rx_queue[queue];
147 + rx_q = &priv->dma_conf.rx_queue[queue];
148 if (rx_q->xsk_pool) {
151 @@ -358,13 +358,13 @@ static void print_pkt(unsigned char *buf
153 static inline u32 stmmac_tx_avail(struct stmmac_priv *priv, u32 queue)
155 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
156 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
159 if (tx_q->dirty_tx > tx_q->cur_tx)
160 avail = tx_q->dirty_tx - tx_q->cur_tx - 1;
162 - avail = priv->dma_tx_size - tx_q->cur_tx + tx_q->dirty_tx - 1;
163 + avail = priv->dma_conf.dma_tx_size - tx_q->cur_tx + tx_q->dirty_tx - 1;
167 @@ -376,13 +376,13 @@ static inline u32 stmmac_tx_avail(struct
169 static inline u32 stmmac_rx_dirty(struct stmmac_priv *priv, u32 queue)
171 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
172 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
175 if (rx_q->dirty_rx <= rx_q->cur_rx)
176 dirty = rx_q->cur_rx - rx_q->dirty_rx;
178 - dirty = priv->dma_rx_size - rx_q->dirty_rx + rx_q->cur_rx;
179 + dirty = priv->dma_conf.dma_rx_size - rx_q->dirty_rx + rx_q->cur_rx;
183 @@ -410,7 +410,7 @@ static int stmmac_enable_eee_mode(struct
185 /* check if all TX queues have the work finished */
186 for (queue = 0; queue < tx_cnt; queue++) {
187 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
188 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
190 if (tx_q->dirty_tx != tx_q->cur_tx)
191 return -EBUSY; /* still unfinished work */
192 @@ -1310,7 +1310,7 @@ static void stmmac_display_rx_rings(stru
194 /* Display RX rings */
195 for (queue = 0; queue < rx_cnt; queue++) {
196 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
197 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
199 pr_info("\tRX Queue %u rings\n", queue);
201 @@ -1323,7 +1323,7 @@ static void stmmac_display_rx_rings(stru
204 /* Display RX ring */
205 - stmmac_display_ring(priv, head_rx, priv->dma_rx_size, true,
206 + stmmac_display_ring(priv, head_rx, priv->dma_conf.dma_rx_size, true,
207 rx_q->dma_rx_phy, desc_size);
210 @@ -1337,7 +1337,7 @@ static void stmmac_display_tx_rings(stru
212 /* Display TX rings */
213 for (queue = 0; queue < tx_cnt; queue++) {
214 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
215 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
217 pr_info("\tTX Queue %d rings\n", queue);
219 @@ -1352,7 +1352,7 @@ static void stmmac_display_tx_rings(stru
220 desc_size = sizeof(struct dma_desc);
223 - stmmac_display_ring(priv, head_tx, priv->dma_tx_size, false,
224 + stmmac_display_ring(priv, head_tx, priv->dma_conf.dma_tx_size, false,
225 tx_q->dma_tx_phy, desc_size);
228 @@ -1393,21 +1393,21 @@ static int stmmac_set_bfsize(int mtu, in
230 static void stmmac_clear_rx_descriptors(struct stmmac_priv *priv, u32 queue)
232 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
233 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
236 /* Clear the RX descriptors */
237 - for (i = 0; i < priv->dma_rx_size; i++)
238 + for (i = 0; i < priv->dma_conf.dma_rx_size; i++)
239 if (priv->extend_desc)
240 stmmac_init_rx_desc(priv, &rx_q->dma_erx[i].basic,
241 priv->use_riwt, priv->mode,
242 - (i == priv->dma_rx_size - 1),
244 + (i == priv->dma_conf.dma_rx_size - 1),
245 + priv->dma_conf.dma_buf_sz);
247 stmmac_init_rx_desc(priv, &rx_q->dma_rx[i],
248 priv->use_riwt, priv->mode,
249 - (i == priv->dma_rx_size - 1),
251 + (i == priv->dma_conf.dma_rx_size - 1),
252 + priv->dma_conf.dma_buf_sz);
256 @@ -1419,12 +1419,12 @@ static void stmmac_clear_rx_descriptors(
258 static void stmmac_clear_tx_descriptors(struct stmmac_priv *priv, u32 queue)
260 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
261 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
264 /* Clear the TX descriptors */
265 - for (i = 0; i < priv->dma_tx_size; i++) {
266 - int last = (i == (priv->dma_tx_size - 1));
267 + for (i = 0; i < priv->dma_conf.dma_tx_size; i++) {
268 + int last = (i == (priv->dma_conf.dma_tx_size - 1));
271 if (priv->extend_desc)
272 @@ -1472,7 +1472,7 @@ static void stmmac_clear_descriptors(str
273 static int stmmac_init_rx_buffers(struct stmmac_priv *priv, struct dma_desc *p,
274 int i, gfp_t flags, u32 queue)
276 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
277 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
278 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
281 @@ -1497,7 +1497,7 @@ static int stmmac_init_rx_buffers(struct
282 buf->addr = page_pool_get_dma_addr(buf->page) + buf->page_offset;
284 stmmac_set_desc_addr(priv, p, buf->addr);
285 - if (priv->dma_buf_sz == BUF_SIZE_16KiB)
286 + if (priv->dma_conf.dma_buf_sz == BUF_SIZE_16KiB)
287 stmmac_init_desc3(priv, p);
290 @@ -1511,7 +1511,7 @@ static int stmmac_init_rx_buffers(struct
292 static void stmmac_free_rx_buffer(struct stmmac_priv *priv, u32 queue, int i)
294 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
295 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
296 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
299 @@ -1531,7 +1531,7 @@ static void stmmac_free_rx_buffer(struct
301 static void stmmac_free_tx_buffer(struct stmmac_priv *priv, u32 queue, int i)
303 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
304 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
306 if (tx_q->tx_skbuff_dma[i].buf &&
307 tx_q->tx_skbuff_dma[i].buf_type != STMMAC_TXBUF_T_XDP_TX) {
308 @@ -1576,17 +1576,17 @@ static void dma_free_rx_skbufs(struct st
312 - for (i = 0; i < priv->dma_rx_size; i++)
313 + for (i = 0; i < priv->dma_conf.dma_rx_size; i++)
314 stmmac_free_rx_buffer(priv, queue, i);
317 static int stmmac_alloc_rx_buffers(struct stmmac_priv *priv, u32 queue,
320 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
321 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
324 - for (i = 0; i < priv->dma_rx_size; i++) {
325 + for (i = 0; i < priv->dma_conf.dma_rx_size; i++) {
329 @@ -1613,10 +1613,10 @@ static int stmmac_alloc_rx_buffers(struc
331 static void dma_free_rx_xskbufs(struct stmmac_priv *priv, u32 queue)
333 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
334 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
337 - for (i = 0; i < priv->dma_rx_size; i++) {
338 + for (i = 0; i < priv->dma_conf.dma_rx_size; i++) {
339 struct stmmac_rx_buffer *buf = &rx_q->buf_pool[i];
342 @@ -1629,10 +1629,10 @@ static void dma_free_rx_xskbufs(struct s
344 static int stmmac_alloc_rx_buffers_zc(struct stmmac_priv *priv, u32 queue)
346 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
347 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
350 - for (i = 0; i < priv->dma_rx_size; i++) {
351 + for (i = 0; i < priv->dma_conf.dma_rx_size; i++) {
352 struct stmmac_rx_buffer *buf;
355 @@ -1675,7 +1675,7 @@ static struct xsk_buff_pool *stmmac_get_
357 static int __init_dma_rx_desc_rings(struct stmmac_priv *priv, u32 queue, gfp_t flags)
359 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
360 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
363 netif_dbg(priv, probe, priv->dev,
364 @@ -1721,11 +1721,11 @@ static int __init_dma_rx_desc_rings(stru
365 if (priv->extend_desc)
366 stmmac_mode_init(priv, rx_q->dma_erx,
368 - priv->dma_rx_size, 1);
369 + priv->dma_conf.dma_rx_size, 1);
371 stmmac_mode_init(priv, rx_q->dma_rx,
373 - priv->dma_rx_size, 0);
374 + priv->dma_conf.dma_rx_size, 0);
378 @@ -1752,7 +1752,7 @@ static int init_dma_rx_desc_rings(struct
382 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
383 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
386 dma_free_rx_xskbufs(priv, queue);
387 @@ -1781,7 +1781,7 @@ err_init_rx_buffers:
389 static int __init_dma_tx_desc_rings(struct stmmac_priv *priv, u32 queue)
391 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
392 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
395 netif_dbg(priv, probe, priv->dev,
396 @@ -1793,16 +1793,16 @@ static int __init_dma_tx_desc_rings(stru
397 if (priv->extend_desc)
398 stmmac_mode_init(priv, tx_q->dma_etx,
400 - priv->dma_tx_size, 1);
401 + priv->dma_conf.dma_tx_size, 1);
402 else if (!(tx_q->tbs & STMMAC_TBS_AVAIL))
403 stmmac_mode_init(priv, tx_q->dma_tx,
405 - priv->dma_tx_size, 0);
406 + priv->dma_conf.dma_tx_size, 0);
409 tx_q->xsk_pool = stmmac_get_xsk_pool(priv, queue);
411 - for (i = 0; i < priv->dma_tx_size; i++) {
412 + for (i = 0; i < priv->dma_conf.dma_tx_size; i++) {
415 if (priv->extend_desc)
416 @@ -1872,12 +1872,12 @@ static int init_dma_desc_rings(struct ne
418 static void dma_free_tx_skbufs(struct stmmac_priv *priv, u32 queue)
420 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
421 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
424 tx_q->xsk_frames_done = 0;
426 - for (i = 0; i < priv->dma_tx_size; i++)
427 + for (i = 0; i < priv->dma_conf.dma_tx_size; i++)
428 stmmac_free_tx_buffer(priv, queue, i);
430 if (tx_q->xsk_pool && tx_q->xsk_frames_done) {
431 @@ -1907,7 +1907,7 @@ static void stmmac_free_tx_skbufs(struct
433 static void __free_dma_rx_desc_resources(struct stmmac_priv *priv, u32 queue)
435 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
436 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
438 /* Release the DMA RX socket buffers */
440 @@ -1920,11 +1920,11 @@ static void __free_dma_rx_desc_resources
442 /* Free DMA regions of consistent memory previously allocated */
443 if (!priv->extend_desc)
444 - dma_free_coherent(priv->device, priv->dma_rx_size *
445 + dma_free_coherent(priv->device, priv->dma_conf.dma_rx_size *
446 sizeof(struct dma_desc),
447 rx_q->dma_rx, rx_q->dma_rx_phy);
449 - dma_free_coherent(priv->device, priv->dma_rx_size *
450 + dma_free_coherent(priv->device, priv->dma_conf.dma_rx_size *
451 sizeof(struct dma_extended_desc),
452 rx_q->dma_erx, rx_q->dma_rx_phy);
454 @@ -1953,7 +1953,7 @@ static void free_dma_rx_desc_resources(s
456 static void __free_dma_tx_desc_resources(struct stmmac_priv *priv, u32 queue)
458 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
459 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
463 @@ -1971,7 +1971,7 @@ static void __free_dma_tx_desc_resources
467 - size *= priv->dma_tx_size;
468 + size *= priv->dma_conf.dma_tx_size;
470 dma_free_coherent(priv->device, size, addr, tx_q->dma_tx_phy);
472 @@ -2000,7 +2000,7 @@ static void free_dma_tx_desc_resources(s
474 static int __alloc_dma_rx_desc_resources(struct stmmac_priv *priv, u32 queue)
476 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
477 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
478 struct stmmac_channel *ch = &priv->channel[queue];
479 bool xdp_prog = stmmac_xdp_is_enabled(priv);
480 struct page_pool_params pp_params = { 0 };
481 @@ -2012,8 +2012,8 @@ static int __alloc_dma_rx_desc_resources
482 rx_q->priv_data = priv;
484 pp_params.flags = PP_FLAG_DMA_MAP | PP_FLAG_DMA_SYNC_DEV;
485 - pp_params.pool_size = priv->dma_rx_size;
486 - num_pages = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE);
487 + pp_params.pool_size = priv->dma_conf.dma_rx_size;
488 + num_pages = DIV_ROUND_UP(priv->dma_conf.dma_buf_sz, PAGE_SIZE);
489 pp_params.order = ilog2(num_pages);
490 pp_params.nid = dev_to_node(priv->device);
491 pp_params.dev = priv->device;
492 @@ -2028,7 +2028,7 @@ static int __alloc_dma_rx_desc_resources
496 - rx_q->buf_pool = kcalloc(priv->dma_rx_size,
497 + rx_q->buf_pool = kcalloc(priv->dma_conf.dma_rx_size,
498 sizeof(*rx_q->buf_pool),
501 @@ -2036,7 +2036,7 @@ static int __alloc_dma_rx_desc_resources
503 if (priv->extend_desc) {
504 rx_q->dma_erx = dma_alloc_coherent(priv->device,
505 - priv->dma_rx_size *
506 + priv->dma_conf.dma_rx_size *
507 sizeof(struct dma_extended_desc),
510 @@ -2045,7 +2045,7 @@ static int __alloc_dma_rx_desc_resources
513 rx_q->dma_rx = dma_alloc_coherent(priv->device,
514 - priv->dma_rx_size *
515 + priv->dma_conf.dma_rx_size *
516 sizeof(struct dma_desc),
519 @@ -2102,20 +2102,20 @@ err_dma:
521 static int __alloc_dma_tx_desc_resources(struct stmmac_priv *priv, u32 queue)
523 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
524 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
528 tx_q->queue_index = queue;
529 tx_q->priv_data = priv;
531 - tx_q->tx_skbuff_dma = kcalloc(priv->dma_tx_size,
532 + tx_q->tx_skbuff_dma = kcalloc(priv->dma_conf.dma_tx_size,
533 sizeof(*tx_q->tx_skbuff_dma),
535 if (!tx_q->tx_skbuff_dma)
538 - tx_q->tx_skbuff = kcalloc(priv->dma_tx_size,
539 + tx_q->tx_skbuff = kcalloc(priv->dma_conf.dma_tx_size,
540 sizeof(struct sk_buff *),
542 if (!tx_q->tx_skbuff)
543 @@ -2128,7 +2128,7 @@ static int __alloc_dma_tx_desc_resources
545 size = sizeof(struct dma_desc);
547 - size *= priv->dma_tx_size;
548 + size *= priv->dma_conf.dma_tx_size;
550 addr = dma_alloc_coherent(priv->device, size,
551 &tx_q->dma_tx_phy, GFP_KERNEL);
552 @@ -2372,7 +2372,7 @@ static void stmmac_dma_operation_mode(st
554 /* configure all channels */
555 for (chan = 0; chan < rx_channels_count; chan++) {
556 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[chan];
557 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[chan];
560 qmode = priv->plat->rx_queues_cfg[chan].mode_to_use;
561 @@ -2387,7 +2387,7 @@ static void stmmac_dma_operation_mode(st
564 stmmac_set_dma_bfsize(priv, priv->ioaddr,
566 + priv->dma_conf.dma_buf_sz,
570 @@ -2403,7 +2403,7 @@ static void stmmac_dma_operation_mode(st
571 static bool stmmac_xdp_xmit_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
573 struct netdev_queue *nq = netdev_get_tx_queue(priv->dev, queue);
574 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
575 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
576 struct xsk_buff_pool *pool = tx_q->xsk_pool;
577 unsigned int entry = tx_q->cur_tx;
578 struct dma_desc *tx_desc = NULL;
579 @@ -2478,7 +2478,7 @@ static bool stmmac_xdp_xmit_zc(struct st
581 stmmac_enable_dma_transmission(priv, priv->ioaddr);
583 - tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_tx_size);
584 + tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size);
585 entry = tx_q->cur_tx;
588 @@ -2504,7 +2504,7 @@ static bool stmmac_xdp_xmit_zc(struct st
590 static int stmmac_tx_clean(struct stmmac_priv *priv, int budget, u32 queue)
592 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
593 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
594 unsigned int bytes_compl = 0, pkts_compl = 0;
595 unsigned int entry, xmits = 0, count = 0;
597 @@ -2517,7 +2517,7 @@ static int stmmac_tx_clean(struct stmmac
598 entry = tx_q->dirty_tx;
600 /* Try to clean all TX complete frame in 1 shot */
601 - while ((entry != tx_q->cur_tx) && count < priv->dma_tx_size) {
602 + while ((entry != tx_q->cur_tx) && count < priv->dma_conf.dma_tx_size) {
603 struct xdp_frame *xdpf;
606 @@ -2617,7 +2617,7 @@ static int stmmac_tx_clean(struct stmmac
608 stmmac_release_tx_desc(priv, p, priv->mode);
610 - entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
611 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
613 tx_q->dirty_tx = entry;
615 @@ -2682,7 +2682,7 @@ static int stmmac_tx_clean(struct stmmac
617 static void stmmac_tx_err(struct stmmac_priv *priv, u32 chan)
619 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
620 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
622 netif_tx_stop_queue(netdev_get_tx_queue(priv->dev, chan));
624 @@ -2749,8 +2749,8 @@ static int stmmac_napi_check(struct stmm
626 int status = stmmac_dma_interrupt_status(priv, priv->ioaddr,
627 &priv->xstats, chan, dir);
628 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[chan];
629 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
630 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[chan];
631 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
632 struct stmmac_channel *ch = &priv->channel[chan];
633 struct napi_struct *rx_napi;
634 struct napi_struct *tx_napi;
635 @@ -2926,7 +2926,7 @@ static int stmmac_init_dma_engine(struct
637 /* DMA RX Channel Configuration */
638 for (chan = 0; chan < rx_channels_count; chan++) {
639 - rx_q = &priv->rx_queue[chan];
640 + rx_q = &priv->dma_conf.rx_queue[chan];
642 stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
643 rx_q->dma_rx_phy, chan);
644 @@ -2940,7 +2940,7 @@ static int stmmac_init_dma_engine(struct
646 /* DMA TX Channel Configuration */
647 for (chan = 0; chan < tx_channels_count; chan++) {
648 - tx_q = &priv->tx_queue[chan];
649 + tx_q = &priv->dma_conf.tx_queue[chan];
651 stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
652 tx_q->dma_tx_phy, chan);
653 @@ -2955,7 +2955,7 @@ static int stmmac_init_dma_engine(struct
655 static void stmmac_tx_timer_arm(struct stmmac_priv *priv, u32 queue)
657 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
658 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
660 hrtimer_start(&tx_q->txtimer,
661 STMMAC_COAL_TIMER(priv->tx_coal_timer[queue]),
662 @@ -3005,7 +3005,7 @@ static void stmmac_init_coalesce(struct
665 for (chan = 0; chan < tx_channel_count; chan++) {
666 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
667 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
669 priv->tx_coal_frames[chan] = STMMAC_TX_FRAMES;
670 priv->tx_coal_timer[chan] = STMMAC_COAL_TX_TIMER;
671 @@ -3027,12 +3027,12 @@ static void stmmac_set_rings_length(stru
672 /* set TX ring length */
673 for (chan = 0; chan < tx_channels_count; chan++)
674 stmmac_set_tx_ring_len(priv, priv->ioaddr,
675 - (priv->dma_tx_size - 1), chan);
676 + (priv->dma_conf.dma_tx_size - 1), chan);
678 /* set RX ring length */
679 for (chan = 0; chan < rx_channels_count; chan++)
680 stmmac_set_rx_ring_len(priv, priv->ioaddr,
681 - (priv->dma_rx_size - 1), chan);
682 + (priv->dma_conf.dma_rx_size - 1), chan);
686 @@ -3367,7 +3367,7 @@ static int stmmac_hw_setup(struct net_de
689 for (chan = 0; chan < tx_cnt; chan++) {
690 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
691 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
693 /* TSO and TBS cannot co-exist */
694 if (tx_q->tbs & STMMAC_TBS_AVAIL)
695 @@ -3389,7 +3389,7 @@ static int stmmac_hw_setup(struct net_de
698 for (chan = 0; chan < tx_cnt; chan++) {
699 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
700 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
701 int enable = tx_q->tbs & STMMAC_TBS_AVAIL;
703 stmmac_enable_tbs(priv, priv->ioaddr, enable, chan);
704 @@ -3433,7 +3433,7 @@ static void stmmac_free_irq(struct net_d
705 for (j = irq_idx - 1; j >= 0; j--) {
706 if (priv->tx_irq[j] > 0) {
707 irq_set_affinity_hint(priv->tx_irq[j], NULL);
708 - free_irq(priv->tx_irq[j], &priv->tx_queue[j]);
709 + free_irq(priv->tx_irq[j], &priv->dma_conf.tx_queue[j]);
712 irq_idx = priv->plat->rx_queues_to_use;
713 @@ -3442,7 +3442,7 @@ static void stmmac_free_irq(struct net_d
714 for (j = irq_idx - 1; j >= 0; j--) {
715 if (priv->rx_irq[j] > 0) {
716 irq_set_affinity_hint(priv->rx_irq[j], NULL);
717 - free_irq(priv->rx_irq[j], &priv->rx_queue[j]);
718 + free_irq(priv->rx_irq[j], &priv->dma_conf.rx_queue[j]);
722 @@ -3575,7 +3575,7 @@ static int stmmac_request_irq_multi_msi(
723 sprintf(int_name, "%s:%s-%d", dev->name, "rx", i);
724 ret = request_irq(priv->rx_irq[i],
726 - 0, int_name, &priv->rx_queue[i]);
727 + 0, int_name, &priv->dma_conf.rx_queue[i]);
728 if (unlikely(ret < 0)) {
729 netdev_err(priv->dev,
730 "%s: alloc rx-%d MSI %d (error: %d)\n",
731 @@ -3598,7 +3598,7 @@ static int stmmac_request_irq_multi_msi(
732 sprintf(int_name, "%s:%s-%d", dev->name, "tx", i);
733 ret = request_irq(priv->tx_irq[i],
735 - 0, int_name, &priv->tx_queue[i]);
736 + 0, int_name, &priv->dma_conf.tx_queue[i]);
737 if (unlikely(ret < 0)) {
738 netdev_err(priv->dev,
739 "%s: alloc tx-%d MSI %d (error: %d)\n",
740 @@ -3729,21 +3729,21 @@ static int stmmac_open(struct net_device
743 if (bfsize < BUF_SIZE_16KiB)
744 - bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_buf_sz);
745 + bfsize = stmmac_set_bfsize(dev->mtu, priv->dma_conf.dma_buf_sz);
747 - priv->dma_buf_sz = bfsize;
748 + priv->dma_conf.dma_buf_sz = bfsize;
751 priv->rx_copybreak = STMMAC_RX_COPYBREAK;
753 - if (!priv->dma_tx_size)
754 - priv->dma_tx_size = DMA_DEFAULT_TX_SIZE;
755 - if (!priv->dma_rx_size)
756 - priv->dma_rx_size = DMA_DEFAULT_RX_SIZE;
757 + if (!priv->dma_conf.dma_tx_size)
758 + priv->dma_conf.dma_tx_size = DMA_DEFAULT_TX_SIZE;
759 + if (!priv->dma_conf.dma_rx_size)
760 + priv->dma_conf.dma_rx_size = DMA_DEFAULT_RX_SIZE;
762 /* Earlier check for TBS */
763 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++) {
764 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[chan];
765 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[chan];
766 int tbs_en = priv->plat->tx_queues_cfg[chan].tbs_en;
768 /* Setup per-TXQ tbs flag before TX descriptor alloc */
769 @@ -3801,7 +3801,7 @@ irq_error:
770 phylink_stop(priv->phylink);
772 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
773 - hrtimer_cancel(&priv->tx_queue[chan].txtimer);
774 + hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
776 stmmac_hw_teardown(dev);
778 @@ -3843,7 +3843,7 @@ static int stmmac_release(struct net_dev
779 stmmac_disable_all_queues(priv);
781 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
782 - hrtimer_cancel(&priv->tx_queue[chan].txtimer);
783 + hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
785 netif_tx_disable(dev);
787 @@ -3907,7 +3907,7 @@ static bool stmmac_vlan_insert(struct st
790 stmmac_set_tx_owner(priv, p);
791 - tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_tx_size);
792 + tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size);
796 @@ -3925,7 +3925,7 @@ static bool stmmac_vlan_insert(struct st
797 static void stmmac_tso_allocator(struct stmmac_priv *priv, dma_addr_t des,
798 int total_len, bool last_segment, u32 queue)
800 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
801 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
802 struct dma_desc *desc;
805 @@ -3936,7 +3936,7 @@ static void stmmac_tso_allocator(struct
806 dma_addr_t curr_addr;
808 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx,
809 - priv->dma_tx_size);
810 + priv->dma_conf.dma_tx_size);
811 WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]);
813 if (tx_q->tbs & STMMAC_TBS_AVAIL)
814 @@ -3964,7 +3964,7 @@ static void stmmac_tso_allocator(struct
816 static void stmmac_flush_tx_descriptors(struct stmmac_priv *priv, int queue)
818 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
819 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
822 if (likely(priv->extend_desc))
823 @@ -4026,7 +4026,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
827 - tx_q = &priv->tx_queue[queue];
828 + tx_q = &priv->dma_conf.tx_queue[queue];
829 first_tx = tx_q->cur_tx;
831 /* Compute header lengths */
832 @@ -4066,7 +4066,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
833 stmmac_set_mss(priv, mss_desc, mss);
835 tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx,
836 - priv->dma_tx_size);
837 + priv->dma_conf.dma_tx_size);
838 WARN_ON(tx_q->tx_skbuff[tx_q->cur_tx]);
841 @@ -4178,7 +4178,7 @@ static netdev_tx_t stmmac_tso_xmit(struc
842 * ndo_start_xmit will fill this descriptor the next time it's
843 * called and stmmac_tx_clean may clean up to this descriptor.
845 - tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_tx_size);
846 + tx_q->cur_tx = STMMAC_GET_ENTRY(tx_q->cur_tx, priv->dma_conf.dma_tx_size);
848 if (unlikely(stmmac_tx_avail(priv, queue) <= (MAX_SKB_FRAGS + 1))) {
849 netif_dbg(priv, hw, priv->dev, "%s: stop transmitted packets\n",
850 @@ -4266,7 +4266,7 @@ static netdev_tx_t stmmac_xmit(struct sk
854 - tx_q = &priv->tx_queue[queue];
855 + tx_q = &priv->dma_conf.tx_queue[queue];
856 first_tx = tx_q->cur_tx;
858 if (priv->tx_path_in_lpi_mode && priv->eee_sw_timer_en)
859 @@ -4329,7 +4329,7 @@ static netdev_tx_t stmmac_xmit(struct sk
860 int len = skb_frag_size(frag);
861 bool last_segment = (i == (nfrags - 1));
863 - entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
864 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
865 WARN_ON(tx_q->tx_skbuff[entry]);
867 if (likely(priv->extend_desc))
868 @@ -4400,7 +4400,7 @@ static netdev_tx_t stmmac_xmit(struct sk
869 * ndo_start_xmit will fill this descriptor the next time it's
870 * called and stmmac_tx_clean may clean up to this descriptor.
872 - entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
873 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
874 tx_q->cur_tx = entry;
876 if (netif_msg_pktdata(priv)) {
877 @@ -4515,7 +4515,7 @@ static void stmmac_rx_vlan(struct net_de
879 static inline void stmmac_rx_refill(struct stmmac_priv *priv, u32 queue)
881 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
882 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
883 int dirty = stmmac_rx_dirty(priv, queue);
884 unsigned int entry = rx_q->dirty_rx;
886 @@ -4565,7 +4565,7 @@ static inline void stmmac_rx_refill(stru
888 stmmac_set_rx_owner(priv, p, use_rx_wd);
890 - entry = STMMAC_GET_ENTRY(entry, priv->dma_rx_size);
891 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_rx_size);
893 rx_q->dirty_rx = entry;
894 rx_q->rx_tail_addr = rx_q->dma_rx_phy +
895 @@ -4593,12 +4593,12 @@ static unsigned int stmmac_rx_buf1_len(s
897 /* First descriptor, not last descriptor and not split header */
898 if (status & rx_not_ls)
899 - return priv->dma_buf_sz;
900 + return priv->dma_conf.dma_buf_sz;
902 plen = stmmac_get_rx_frame_len(priv, p, coe);
904 /* First descriptor and last descriptor and not split header */
905 - return min_t(unsigned int, priv->dma_buf_sz, plen);
906 + return min_t(unsigned int, priv->dma_conf.dma_buf_sz, plen);
909 static unsigned int stmmac_rx_buf2_len(struct stmmac_priv *priv,
910 @@ -4614,7 +4614,7 @@ static unsigned int stmmac_rx_buf2_len(s
912 /* Not last descriptor */
913 if (status & rx_not_ls)
914 - return priv->dma_buf_sz;
915 + return priv->dma_conf.dma_buf_sz;
917 plen = stmmac_get_rx_frame_len(priv, p, coe);
919 @@ -4625,7 +4625,7 @@ static unsigned int stmmac_rx_buf2_len(s
920 static int stmmac_xdp_xmit_xdpf(struct stmmac_priv *priv, int queue,
921 struct xdp_frame *xdpf, bool dma_map)
923 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
924 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
925 unsigned int entry = tx_q->cur_tx;
926 struct dma_desc *tx_desc;
928 @@ -4688,7 +4688,7 @@ static int stmmac_xdp_xmit_xdpf(struct s
930 stmmac_enable_dma_transmission(priv, priv->ioaddr);
932 - entry = STMMAC_GET_ENTRY(entry, priv->dma_tx_size);
933 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_tx_size);
934 tx_q->cur_tx = entry;
936 return STMMAC_XDP_TX;
937 @@ -4862,7 +4862,7 @@ static void stmmac_dispatch_skb_zc(struc
939 static bool stmmac_rx_refill_zc(struct stmmac_priv *priv, u32 queue, u32 budget)
941 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
942 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
943 unsigned int entry = rx_q->dirty_rx;
944 struct dma_desc *rx_desc = NULL;
946 @@ -4905,7 +4905,7 @@ static bool stmmac_rx_refill_zc(struct s
948 stmmac_set_rx_owner(priv, rx_desc, use_rx_wd);
950 - entry = STMMAC_GET_ENTRY(entry, priv->dma_rx_size);
951 + entry = STMMAC_GET_ENTRY(entry, priv->dma_conf.dma_rx_size);
955 @@ -4920,7 +4920,7 @@ static bool stmmac_rx_refill_zc(struct s
957 static int stmmac_rx_zc(struct stmmac_priv *priv, int limit, u32 queue)
959 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
960 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
961 unsigned int count = 0, error = 0, len = 0;
962 int dirty = stmmac_rx_dirty(priv, queue);
963 unsigned int next_entry = rx_q->cur_rx;
964 @@ -4942,7 +4942,7 @@ static int stmmac_rx_zc(struct stmmac_pr
965 desc_size = sizeof(struct dma_desc);
968 - stmmac_display_ring(priv, rx_head, priv->dma_rx_size, true,
969 + stmmac_display_ring(priv, rx_head, priv->dma_conf.dma_rx_size, true,
970 rx_q->dma_rx_phy, desc_size);
972 while (count < limit) {
973 @@ -4989,7 +4989,7 @@ read_again:
975 /* Prefetch the next RX descriptor */
976 rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx,
977 - priv->dma_rx_size);
978 + priv->dma_conf.dma_rx_size);
979 next_entry = rx_q->cur_rx;
981 if (priv->extend_desc)
982 @@ -5110,7 +5110,7 @@ read_again:
984 static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
986 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
987 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
988 struct stmmac_channel *ch = &priv->channel[queue];
989 unsigned int count = 0, error = 0, len = 0;
990 int status = 0, coe = priv->hw->rx_csum;
991 @@ -5123,7 +5123,7 @@ static int stmmac_rx(struct stmmac_priv
994 dma_dir = page_pool_get_dma_dir(rx_q->page_pool);
995 - buf_sz = DIV_ROUND_UP(priv->dma_buf_sz, PAGE_SIZE) * PAGE_SIZE;
996 + buf_sz = DIV_ROUND_UP(priv->dma_conf.dma_buf_sz, PAGE_SIZE) * PAGE_SIZE;
998 if (netif_msg_rx_status(priv)) {
1000 @@ -5137,7 +5137,7 @@ static int stmmac_rx(struct stmmac_priv
1001 desc_size = sizeof(struct dma_desc);
1004 - stmmac_display_ring(priv, rx_head, priv->dma_rx_size, true,
1005 + stmmac_display_ring(priv, rx_head, priv->dma_conf.dma_rx_size, true,
1006 rx_q->dma_rx_phy, desc_size);
1008 while (count < limit) {
1009 @@ -5181,7 +5181,7 @@ read_again:
1012 rx_q->cur_rx = STMMAC_GET_ENTRY(rx_q->cur_rx,
1013 - priv->dma_rx_size);
1014 + priv->dma_conf.dma_rx_size);
1015 next_entry = rx_q->cur_rx;
1017 if (priv->extend_desc)
1018 @@ -5315,7 +5315,7 @@ read_again:
1020 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
1021 buf->page, buf->page_offset, buf1_len,
1022 - priv->dma_buf_sz);
1023 + priv->dma_conf.dma_buf_sz);
1025 /* Data payload appended into SKB */
1026 page_pool_release_page(rx_q->page_pool, buf->page);
1027 @@ -5327,7 +5327,7 @@ read_again:
1029 skb_add_rx_frag(skb, skb_shinfo(skb)->nr_frags,
1030 buf->sec_page, 0, buf2_len,
1031 - priv->dma_buf_sz);
1032 + priv->dma_conf.dma_buf_sz);
1034 /* Data payload appended into SKB */
1035 page_pool_release_page(rx_q->page_pool, buf->sec_page);
1036 @@ -5770,11 +5770,13 @@ static irqreturn_t stmmac_safety_interru
1037 static irqreturn_t stmmac_msi_intr_tx(int irq, void *data)
1039 struct stmmac_tx_queue *tx_q = (struct stmmac_tx_queue *)data;
1040 + struct stmmac_dma_conf *dma_conf;
1041 int chan = tx_q->queue_index;
1042 struct stmmac_priv *priv;
1045 - priv = container_of(tx_q, struct stmmac_priv, tx_queue[chan]);
1046 + dma_conf = container_of(tx_q, struct stmmac_dma_conf, tx_queue[chan]);
1047 + priv = container_of(dma_conf, struct stmmac_priv, dma_conf);
1049 if (unlikely(!data)) {
1050 netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
1051 @@ -5814,10 +5816,12 @@ static irqreturn_t stmmac_msi_intr_tx(in
1052 static irqreturn_t stmmac_msi_intr_rx(int irq, void *data)
1054 struct stmmac_rx_queue *rx_q = (struct stmmac_rx_queue *)data;
1055 + struct stmmac_dma_conf *dma_conf;
1056 int chan = rx_q->queue_index;
1057 struct stmmac_priv *priv;
1059 - priv = container_of(rx_q, struct stmmac_priv, rx_queue[chan]);
1060 + dma_conf = container_of(rx_q, struct stmmac_dma_conf, rx_queue[chan]);
1061 + priv = container_of(dma_conf, struct stmmac_priv, dma_conf);
1063 if (unlikely(!data)) {
1064 netdev_err(priv->dev, "%s: invalid dev pointer\n", __func__);
1065 @@ -5848,10 +5852,10 @@ static void stmmac_poll_controller(struc
1067 if (priv->plat->multi_msi_en) {
1068 for (i = 0; i < priv->plat->rx_queues_to_use; i++)
1069 - stmmac_msi_intr_rx(0, &priv->rx_queue[i]);
1070 + stmmac_msi_intr_rx(0, &priv->dma_conf.rx_queue[i]);
1072 for (i = 0; i < priv->plat->tx_queues_to_use; i++)
1073 - stmmac_msi_intr_tx(0, &priv->tx_queue[i]);
1074 + stmmac_msi_intr_tx(0, &priv->dma_conf.tx_queue[i]);
1076 disable_irq(dev->irq);
1077 stmmac_interrupt(dev->irq, dev);
1078 @@ -6032,34 +6036,34 @@ static int stmmac_rings_status_show(stru
1081 for (queue = 0; queue < rx_count; queue++) {
1082 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
1083 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
1085 seq_printf(seq, "RX Queue %d:\n", queue);
1087 if (priv->extend_desc) {
1088 seq_printf(seq, "Extended descriptor ring:\n");
1089 sysfs_display_ring((void *)rx_q->dma_erx,
1090 - priv->dma_rx_size, 1, seq, rx_q->dma_rx_phy);
1091 + priv->dma_conf.dma_rx_size, 1, seq, rx_q->dma_rx_phy);
1093 seq_printf(seq, "Descriptor ring:\n");
1094 sysfs_display_ring((void *)rx_q->dma_rx,
1095 - priv->dma_rx_size, 0, seq, rx_q->dma_rx_phy);
1096 + priv->dma_conf.dma_rx_size, 0, seq, rx_q->dma_rx_phy);
1100 for (queue = 0; queue < tx_count; queue++) {
1101 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
1102 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
1104 seq_printf(seq, "TX Queue %d:\n", queue);
1106 if (priv->extend_desc) {
1107 seq_printf(seq, "Extended descriptor ring:\n");
1108 sysfs_display_ring((void *)tx_q->dma_etx,
1109 - priv->dma_tx_size, 1, seq, tx_q->dma_tx_phy);
1110 + priv->dma_conf.dma_tx_size, 1, seq, tx_q->dma_tx_phy);
1111 } else if (!(tx_q->tbs & STMMAC_TBS_AVAIL)) {
1112 seq_printf(seq, "Descriptor ring:\n");
1113 sysfs_display_ring((void *)tx_q->dma_tx,
1114 - priv->dma_tx_size, 0, seq, tx_q->dma_tx_phy);
1115 + priv->dma_conf.dma_tx_size, 0, seq, tx_q->dma_tx_phy);
1119 @@ -6406,7 +6410,7 @@ void stmmac_disable_rx_queue(struct stmm
1121 void stmmac_enable_rx_queue(struct stmmac_priv *priv, u32 queue)
1123 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
1124 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
1125 struct stmmac_channel *ch = &priv->channel[queue];
1126 unsigned long flags;
1128 @@ -6443,7 +6447,7 @@ void stmmac_enable_rx_queue(struct stmma
1131 stmmac_set_dma_bfsize(priv, priv->ioaddr,
1133 + priv->dma_conf.dma_buf_sz,
1137 @@ -6469,7 +6473,7 @@ void stmmac_disable_tx_queue(struct stmm
1139 void stmmac_enable_tx_queue(struct stmmac_priv *priv, u32 queue)
1141 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
1142 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
1143 struct stmmac_channel *ch = &priv->channel[queue];
1144 unsigned long flags;
1146 @@ -6519,7 +6523,7 @@ void stmmac_xdp_release(struct net_devic
1147 stmmac_disable_all_queues(priv);
1149 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
1150 - hrtimer_cancel(&priv->tx_queue[chan].txtimer);
1151 + hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
1153 /* Free the IRQ lines */
1154 stmmac_free_irq(dev, REQ_IRQ_ERR_ALL, 0);
1155 @@ -6578,7 +6582,7 @@ int stmmac_xdp_open(struct net_device *d
1157 /* DMA RX Channel Configuration */
1158 for (chan = 0; chan < rx_cnt; chan++) {
1159 - rx_q = &priv->rx_queue[chan];
1160 + rx_q = &priv->dma_conf.rx_queue[chan];
1162 stmmac_init_rx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
1163 rx_q->dma_rx_phy, chan);
1164 @@ -6596,7 +6600,7 @@ int stmmac_xdp_open(struct net_device *d
1167 stmmac_set_dma_bfsize(priv, priv->ioaddr,
1169 + priv->dma_conf.dma_buf_sz,
1173 @@ -6605,7 +6609,7 @@ int stmmac_xdp_open(struct net_device *d
1175 /* DMA TX Channel Configuration */
1176 for (chan = 0; chan < tx_cnt; chan++) {
1177 - tx_q = &priv->tx_queue[chan];
1178 + tx_q = &priv->dma_conf.tx_queue[chan];
1180 stmmac_init_tx_chan(priv, priv->ioaddr, priv->plat->dma_cfg,
1181 tx_q->dma_tx_phy, chan);
1182 @@ -6638,7 +6642,7 @@ int stmmac_xdp_open(struct net_device *d
1185 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
1186 - hrtimer_cancel(&priv->tx_queue[chan].txtimer);
1187 + hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
1189 stmmac_hw_teardown(dev);
1191 @@ -6665,8 +6669,8 @@ int stmmac_xsk_wakeup(struct net_device
1192 queue >= priv->plat->tx_queues_to_use)
1195 - rx_q = &priv->rx_queue[queue];
1196 - tx_q = &priv->tx_queue[queue];
1197 + rx_q = &priv->dma_conf.rx_queue[queue];
1198 + tx_q = &priv->dma_conf.tx_queue[queue];
1199 ch = &priv->channel[queue];
1201 if (!rx_q->xsk_pool && !tx_q->xsk_pool)
1202 @@ -6926,8 +6930,8 @@ int stmmac_reinit_ringparam(struct net_d
1203 if (netif_running(dev))
1204 stmmac_release(dev);
1206 - priv->dma_rx_size = rx_size;
1207 - priv->dma_tx_size = tx_size;
1208 + priv->dma_conf.dma_rx_size = rx_size;
1209 + priv->dma_conf.dma_tx_size = tx_size;
1211 if (netif_running(dev))
1212 ret = stmmac_open(dev);
1213 @@ -7362,7 +7366,7 @@ int stmmac_suspend(struct device *dev)
1214 stmmac_disable_all_queues(priv);
1216 for (chan = 0; chan < priv->plat->tx_queues_to_use; chan++)
1217 - hrtimer_cancel(&priv->tx_queue[chan].txtimer);
1218 + hrtimer_cancel(&priv->dma_conf.tx_queue[chan].txtimer);
1220 if (priv->eee_enabled) {
1221 priv->tx_path_in_lpi_mode = false;
1222 @@ -7414,7 +7418,7 @@ EXPORT_SYMBOL_GPL(stmmac_suspend);
1224 static void stmmac_reset_rx_queue(struct stmmac_priv *priv, u32 queue)
1226 - struct stmmac_rx_queue *rx_q = &priv->rx_queue[queue];
1227 + struct stmmac_rx_queue *rx_q = &priv->dma_conf.rx_queue[queue];
1231 @@ -7422,7 +7426,7 @@ static void stmmac_reset_rx_queue(struct
1233 static void stmmac_reset_tx_queue(struct stmmac_priv *priv, u32 queue)
1235 - struct stmmac_tx_queue *tx_q = &priv->tx_queue[queue];
1236 + struct stmmac_tx_queue *tx_q = &priv->dma_conf.tx_queue[queue];
1240 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
1241 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_selftests.c
1242 @@ -795,8 +795,8 @@ static int stmmac_test_flowctrl(struct s
1243 struct stmmac_channel *ch = &priv->channel[i];
1246 - tail = priv->rx_queue[i].dma_rx_phy +
1247 - (priv->dma_rx_size * sizeof(struct dma_desc));
1248 + tail = priv->dma_conf.rx_queue[i].dma_rx_phy +
1249 + (priv->dma_conf.dma_rx_size * sizeof(struct dma_desc));
1251 stmmac_set_rx_tail_ptr(priv, priv->ioaddr, tail, i);
1252 stmmac_start_rx(priv, priv->ioaddr, i);
1253 @@ -1684,7 +1684,7 @@ cleanup:
1254 static int __stmmac_test_jumbo(struct stmmac_priv *priv, u16 queue)
1256 struct stmmac_packet_attrs attr = { };
1257 - int size = priv->dma_buf_sz;
1258 + int size = priv->dma_conf.dma_buf_sz;
1260 attr.dst = priv->dev->dev_addr;
1261 attr.max_size = size - ETH_FCS_LEN;
1262 @@ -1767,7 +1767,7 @@ static int stmmac_test_tbs(struct stmmac
1264 /* Find first TBS enabled Queue, if any */
1265 for (i = 0; i < priv->plat->tx_queues_to_use; i++)
1266 - if (priv->tx_queue[i].tbs & STMMAC_TBS_AVAIL)
1267 + if (priv->dma_conf.tx_queue[i].tbs & STMMAC_TBS_AVAIL)
1270 if (i >= priv->plat->tx_queues_to_use)
1271 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
1272 +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_tc.c
1273 @@ -971,13 +971,13 @@ static int tc_setup_etf(struct stmmac_pr
1275 if (qopt->queue >= priv->plat->tx_queues_to_use)
1277 - if (!(priv->tx_queue[qopt->queue].tbs & STMMAC_TBS_AVAIL))
1278 + if (!(priv->dma_conf.tx_queue[qopt->queue].tbs & STMMAC_TBS_AVAIL))
1282 - priv->tx_queue[qopt->queue].tbs |= STMMAC_TBS_EN;
1283 + priv->dma_conf.tx_queue[qopt->queue].tbs |= STMMAC_TBS_EN;
1285 - priv->tx_queue[qopt->queue].tbs &= ~STMMAC_TBS_EN;
1286 + priv->dma_conf.tx_queue[qopt->queue].tbs &= ~STMMAC_TBS_EN;
1288 netdev_info(priv->dev, "%s ETF for Queue %d\n",
1289 qopt->enable ? "enabled" : "disabled", qopt->queue);