Commit ffbf9870 authored by Ilias Apalodimas's avatar Ilias Apalodimas Committed by David S. Miller

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: default avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
Acked-by: default avatarJassi Brar <jaswinder.singh@linaro.org>
Fixes: 4acb20b4 ("net: socionext: different approach on DMA")
Signed-off-by: default avatarIlias Apalodimas <ilias.apalodimas@linaro.org>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 66c03171
...@@ -673,7 +673,8 @@ static void netsec_process_tx(struct netsec_priv *priv) ...@@ -673,7 +673,8 @@ static void netsec_process_tx(struct netsec_priv *priv)
} }
static void *netsec_alloc_rx_data(struct netsec_priv *priv, static void *netsec_alloc_rx_data(struct netsec_priv *priv,
dma_addr_t *dma_handle, u16 *desc_len) dma_addr_t *dma_handle, u16 *desc_len,
bool napi)
{ {
size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info)); size_t total_len = SKB_DATA_ALIGN(sizeof(struct skb_shared_info));
size_t payload_len = NETSEC_RX_BUF_SZ; size_t payload_len = NETSEC_RX_BUF_SZ;
...@@ -682,7 +683,7 @@ static void *netsec_alloc_rx_data(struct netsec_priv *priv, ...@@ -682,7 +683,7 @@ static void *netsec_alloc_rx_data(struct netsec_priv *priv,
total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD); total_len += SKB_DATA_ALIGN(payload_len + NETSEC_SKB_PAD);
buf = napi_alloc_frag(total_len); buf = napi ? napi_alloc_frag(total_len) : netdev_alloc_frag(total_len);
if (!buf) if (!buf)
return NULL; return NULL;
...@@ -765,7 +766,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget) ...@@ -765,7 +766,8 @@ static int netsec_process_rx(struct netsec_priv *priv, int budget)
/* allocate a fresh buffer and map it to the hardware. /* allocate a fresh buffer and map it to the hardware.
* This will eventually replace the old buffer in the hardware * This will eventually replace the old buffer in the hardware
*/ */
buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len); buf_addr = netsec_alloc_rx_data(priv, &dma_handle, &desc_len,
true);
if (unlikely(!buf_addr)) if (unlikely(!buf_addr))
break; break;
...@@ -1069,7 +1071,8 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv) ...@@ -1069,7 +1071,8 @@ static int netsec_setup_rx_dring(struct netsec_priv *priv)
void *buf; void *buf;
u16 len; u16 len;
buf = netsec_alloc_rx_data(priv, &dma_handle, &len); buf = netsec_alloc_rx_data(priv, &dma_handle, &len,
false);
if (!buf) { if (!buf) {
netsec_uninit_pkt_dring(priv, NETSEC_RING_RX); netsec_uninit_pkt_dring(priv, NETSEC_RING_RX);
goto err_out; goto err_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment