Skip to content

Commit ac09946

Browse files
rogerqdavem330
authored andcommitted
net: ethernet: ti: am65-cpsw: Re-arrange functions to avoid forward declaration
Re-arrange am65_cpsw_nuss_rx_cleanup(), am65_cpsw_nuss_xmit_free() and am65_cpsw_nuss_tx_cleanup() to avoid forward declaration. No functional change. Signed-off-by: Roger Quadros <rogerq@kernel.org> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 67372d7 commit ac09946

File tree

1 file changed

+71
-74
lines changed

1 file changed

+71
-74
lines changed

drivers/net/ethernet/ti/am65-cpsw-nuss.c

Lines changed: 71 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -367,6 +367,77 @@ static void am65_cpsw_init_host_port_emac(struct am65_cpsw_common *common);
367367
static void am65_cpsw_init_port_switch_ale(struct am65_cpsw_port *port);
368368
static void am65_cpsw_init_port_emac_ale(struct am65_cpsw_port *port);
369369

370+
static void am65_cpsw_nuss_rx_cleanup(void *data, dma_addr_t desc_dma)
371+
{
372+
struct am65_cpsw_rx_chn *rx_chn = data;
373+
struct cppi5_host_desc_t *desc_rx;
374+
struct sk_buff *skb;
375+
dma_addr_t buf_dma;
376+
u32 buf_dma_len;
377+
void **swdata;
378+
379+
desc_rx = k3_cppi_desc_pool_dma2virt(rx_chn->desc_pool, desc_dma);
380+
swdata = cppi5_hdesc_get_swdata(desc_rx);
381+
skb = *swdata;
382+
cppi5_hdesc_get_obuf(desc_rx, &buf_dma, &buf_dma_len);
383+
k3_udma_glue_rx_cppi5_to_dma_addr(rx_chn->rx_chn, &buf_dma);
384+
385+
dma_unmap_single(rx_chn->dma_dev, buf_dma, buf_dma_len, DMA_FROM_DEVICE);
386+
k3_cppi_desc_pool_free(rx_chn->desc_pool, desc_rx);
387+
388+
dev_kfree_skb_any(skb);
389+
}
390+
391+
static void am65_cpsw_nuss_xmit_free(struct am65_cpsw_tx_chn *tx_chn,
392+
struct cppi5_host_desc_t *desc)
393+
{
394+
struct cppi5_host_desc_t *first_desc, *next_desc;
395+
dma_addr_t buf_dma, next_desc_dma;
396+
u32 buf_dma_len;
397+
398+
first_desc = desc;
399+
next_desc = first_desc;
400+
401+
cppi5_hdesc_get_obuf(first_desc, &buf_dma, &buf_dma_len);
402+
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &buf_dma);
403+
404+
dma_unmap_single(tx_chn->dma_dev, buf_dma, buf_dma_len, DMA_TO_DEVICE);
405+
406+
next_desc_dma = cppi5_hdesc_get_next_hbdesc(first_desc);
407+
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &next_desc_dma);
408+
while (next_desc_dma) {
409+
next_desc = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool,
410+
next_desc_dma);
411+
cppi5_hdesc_get_obuf(next_desc, &buf_dma, &buf_dma_len);
412+
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &buf_dma);
413+
414+
dma_unmap_page(tx_chn->dma_dev, buf_dma, buf_dma_len,
415+
DMA_TO_DEVICE);
416+
417+
next_desc_dma = cppi5_hdesc_get_next_hbdesc(next_desc);
418+
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &next_desc_dma);
419+
420+
k3_cppi_desc_pool_free(tx_chn->desc_pool, next_desc);
421+
}
422+
423+
k3_cppi_desc_pool_free(tx_chn->desc_pool, first_desc);
424+
}
425+
426+
static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
427+
{
428+
struct am65_cpsw_tx_chn *tx_chn = data;
429+
struct cppi5_host_desc_t *desc_tx;
430+
struct sk_buff *skb;
431+
void **swdata;
432+
433+
desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool, desc_dma);
434+
swdata = cppi5_hdesc_get_swdata(desc_tx);
435+
skb = *(swdata);
436+
am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
437+
438+
dev_kfree_skb_any(skb);
439+
}
440+
370441
static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common)
371442
{
372443
struct am65_cpsw_host *host_p = am65_common_get_host(common);
@@ -470,9 +541,6 @@ static int am65_cpsw_nuss_common_open(struct am65_cpsw_common *common)
470541
return 0;
471542
}
472543

473-
static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma);
474-
static void am65_cpsw_nuss_rx_cleanup(void *data, dma_addr_t desc_dma);
475-
476544
static int am65_cpsw_nuss_common_stop(struct am65_cpsw_common *common)
477545
{
478546
int i;
@@ -646,27 +714,6 @@ static int am65_cpsw_nuss_ndo_slave_open(struct net_device *ndev)
646714
return ret;
647715
}
648716

649-
static void am65_cpsw_nuss_rx_cleanup(void *data, dma_addr_t desc_dma)
650-
{
651-
struct am65_cpsw_rx_chn *rx_chn = data;
652-
struct cppi5_host_desc_t *desc_rx;
653-
struct sk_buff *skb;
654-
dma_addr_t buf_dma;
655-
u32 buf_dma_len;
656-
void **swdata;
657-
658-
desc_rx = k3_cppi_desc_pool_dma2virt(rx_chn->desc_pool, desc_dma);
659-
swdata = cppi5_hdesc_get_swdata(desc_rx);
660-
skb = *swdata;
661-
cppi5_hdesc_get_obuf(desc_rx, &buf_dma, &buf_dma_len);
662-
k3_udma_glue_rx_cppi5_to_dma_addr(rx_chn->rx_chn, &buf_dma);
663-
664-
dma_unmap_single(rx_chn->dma_dev, buf_dma, buf_dma_len, DMA_FROM_DEVICE);
665-
k3_cppi_desc_pool_free(rx_chn->desc_pool, desc_rx);
666-
667-
dev_kfree_skb_any(skb);
668-
}
669-
670717
static void am65_cpsw_nuss_rx_ts(struct sk_buff *skb, u32 *psdata)
671718
{
672719
struct skb_shared_hwtstamps *ssh;
@@ -840,56 +887,6 @@ static int am65_cpsw_nuss_rx_poll(struct napi_struct *napi_rx, int budget)
840887
return num_rx;
841888
}
842889

843-
static void am65_cpsw_nuss_xmit_free(struct am65_cpsw_tx_chn *tx_chn,
844-
struct cppi5_host_desc_t *desc)
845-
{
846-
struct cppi5_host_desc_t *first_desc, *next_desc;
847-
dma_addr_t buf_dma, next_desc_dma;
848-
u32 buf_dma_len;
849-
850-
first_desc = desc;
851-
next_desc = first_desc;
852-
853-
cppi5_hdesc_get_obuf(first_desc, &buf_dma, &buf_dma_len);
854-
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &buf_dma);
855-
856-
dma_unmap_single(tx_chn->dma_dev, buf_dma, buf_dma_len, DMA_TO_DEVICE);
857-
858-
next_desc_dma = cppi5_hdesc_get_next_hbdesc(first_desc);
859-
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &next_desc_dma);
860-
while (next_desc_dma) {
861-
next_desc = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool,
862-
next_desc_dma);
863-
cppi5_hdesc_get_obuf(next_desc, &buf_dma, &buf_dma_len);
864-
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &buf_dma);
865-
866-
dma_unmap_page(tx_chn->dma_dev, buf_dma, buf_dma_len,
867-
DMA_TO_DEVICE);
868-
869-
next_desc_dma = cppi5_hdesc_get_next_hbdesc(next_desc);
870-
k3_udma_glue_tx_cppi5_to_dma_addr(tx_chn->tx_chn, &next_desc_dma);
871-
872-
k3_cppi_desc_pool_free(tx_chn->desc_pool, next_desc);
873-
}
874-
875-
k3_cppi_desc_pool_free(tx_chn->desc_pool, first_desc);
876-
}
877-
878-
static void am65_cpsw_nuss_tx_cleanup(void *data, dma_addr_t desc_dma)
879-
{
880-
struct am65_cpsw_tx_chn *tx_chn = data;
881-
struct cppi5_host_desc_t *desc_tx;
882-
struct sk_buff *skb;
883-
void **swdata;
884-
885-
desc_tx = k3_cppi_desc_pool_dma2virt(tx_chn->desc_pool, desc_dma);
886-
swdata = cppi5_hdesc_get_swdata(desc_tx);
887-
skb = *(swdata);
888-
am65_cpsw_nuss_xmit_free(tx_chn, desc_tx);
889-
890-
dev_kfree_skb_any(skb);
891-
}
892-
893890
static struct sk_buff *
894891
am65_cpsw_nuss_tx_compl_packet(struct am65_cpsw_tx_chn *tx_chn,
895892
dma_addr_t desc_dma)

0 commit comments

Comments
 (0)