mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-07 11:26:02 +09:00
ethernet: stmmac: Dynamically change limit to fit dma size
First, ensure that limit cannot exceed dma size, and rx cannot clear the over dma_size buffers. Second, ensure that dirty is not equal to 0, if really need to clean rx at this time. [ 552.964089] Unable to handle kernel paging request at virtual address b8280000 [ 552.971316] pgd = d04d5ca4 [ 552.974019] [b8280000] *pgd=00000000 [ 552.977594] Internal error: Oops - BUG: 5 [#1] THUMB2 [ 553.014986] Hardware name: Generic DT based system [ 553.019780] PC is at memcpy+0xd6/0x2dc [ 553.023536] LR is at stmmac_napi_poll_rx+0x32f/0x744 [ 553.028492] pc : [<b0185e8e>] lr : [<b02329f3>] psr: 6000a833 [ 553.034748] sp : b0663e4c ip : 00000002 fp : b1273900 [ 553.039967] r10: 00000010 r9 : b09444e0 r8 : 00000000 [ 553.045188] r7 : 00000000 r6 : 000005ea r5 : b2693600 r4 : b09444e0 [ 553.051709] r3 : 4c105000 r2 : 000005e6 r1 : b8280000 r0 : b0dbb7c2 Signed-off-by: David Wu <david.wu@rock-chips.com> Change-Id: Ie82acf7edf39835ac9bb4f13e599718d03550154
This commit is contained in:
@@ -3783,7 +3783,7 @@ static int stmmac_rx(struct stmmac_priv *priv, int limit, u32 queue)
|
||||
len = 0;
|
||||
}
|
||||
|
||||
if (count >= limit)
|
||||
if ((count >= limit - 1) && limit > 1)
|
||||
break;
|
||||
|
||||
read_again:
|
||||
@@ -4810,6 +4810,10 @@ static void stmmac_napi_add(struct net_device *dev)
|
||||
|
||||
for (queue = 0; queue < maxq; queue++) {
|
||||
struct stmmac_channel *ch = &priv->channel[queue];
|
||||
int rx_budget = (priv->plat->dma_rx_size < NAPI_POLL_WEIGHT) ?
|
||||
priv->plat->dma_rx_size : NAPI_POLL_WEIGHT;
|
||||
int tx_budget = (priv->plat->dma_tx_size < NAPI_POLL_WEIGHT) ?
|
||||
priv->plat->dma_tx_size : NAPI_POLL_WEIGHT;
|
||||
|
||||
ch->priv_data = priv;
|
||||
ch->index = queue;
|
||||
@@ -4817,12 +4821,11 @@ static void stmmac_napi_add(struct net_device *dev)
|
||||
|
||||
if (queue < priv->plat->rx_queues_to_use) {
|
||||
netif_napi_add(dev, &ch->rx_napi, stmmac_napi_poll_rx,
|
||||
NAPI_POLL_WEIGHT);
|
||||
rx_budget);
|
||||
}
|
||||
if (queue < priv->plat->tx_queues_to_use) {
|
||||
netif_tx_napi_add(dev, &ch->tx_napi,
|
||||
stmmac_napi_poll_tx,
|
||||
NAPI_POLL_WEIGHT);
|
||||
stmmac_napi_poll_tx, tx_budget);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user