Skip to content

Commit ffbf987

Browse files
apalosdavem330
authored andcommitted
net: socionext: replace napi_alloc_frag with the netdev variant on init
The netdev variant is usable on any context since it disables interrupts. The napi variant of the call should only be used within softirq context. Replace napi_alloc_frag on driver init with the correct netdev_alloc_frag call Changes since v1: - Adjusted commit message Acked-by: Ard Biesheuvel <[email protected]> Acked-by: Jassi Brar <[email protected]> Fixes: 4acb20b ("net: socionext: different approach on DMA") Signed-off-by: Ilias Apalodimas <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 66c0317 commit ffbf987

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

drivers/net/ethernet/socionext/netsec.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -673,7 +673,8 @@ static void netsec_process_tx(struct netsec_priv *priv)
673673
}
674674

675675
static void *netsec_alloc_rx_data(struct netsec_priv *priv,
676-
dma_addr_t *dma_handle, u16 *desc_len)
676+
dma_addr_t *dma_handle, u16 *desc_len,
677+
bool napi)
677678
{
678679
size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
679680
size_t payload_len = NETSEC_RX_BUF_SZ;
@@ -682,7 +683,7 @@ static void *netsec_alloc_rx_data(struct netsec_priv *priv,
682683

683684
total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD);
684685

685-
buf = napi_alloc_frag(total_len);
686+
buf = napi ? napi_alloc_frag(total_len) : netdev_alloc_frag(total_len);
686687
if (!buf)
687688
return NULL;
688689

@@ -765,7 +766,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
765766
/* allocate a fresh buffer and map it to the hardware.
766767
* This will eventually replace the old buffer in the hardware
767768
*/
768-
buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len);
769+
buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len,
770+
true);
769771
if (unlikely(!buf_addr))
770772
break;
771773

@@ -1069,7 +1071,8 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv)
10691071
void *buf;
10701072
u16 len;
10711073

1072-
buf = netsec_alloc_rx_data(priv, &dma_handle, &len);
1074+
buf = netsec_alloc_rx_data(priv, &dma_handle, &len,
1075+
false);
10731076
if (!buf) {
10741077
netsec_uninit_pkt_dring(priv, NETSEC_RING_RX);
10751078
goto err_out;

0 commit comments

Comments
 (0)