Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh_eth: Optimization for RX excess judgement

Both of 'boguscnt' and 'quota' have nearly meaning as the condition of
the reception loop.
In order to cut down redundant processing, this patch changes excess
judgement.

Signed-off-by: Mitsuhiro Kimura <mitsuhiro.kimura.kc@renesas.com>
Signed-off-by: Yoshihiro Kaneko <ykaneko0929@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Mitsuhiro Kimura and committed by
David S. Miller
319cd520 e008f3f0

+5 -5
+5 -5
drivers/net/ethernet/renesas/sh_eth.c
··· 1395 1395 1396 1396 int entry = mdp->cur_rx % mdp->num_rx_ring; 1397 1397 int boguscnt = (mdp->dirty_rx + mdp->num_rx_ring) - mdp->cur_rx; 1398 + int limit; 1398 1399 struct sk_buff *skb; 1399 1400 u16 pkt_len = 0; 1400 1401 u32 desc_status; 1401 1402 1403 + boguscnt = min(boguscnt, *quota); 1404 + limit = boguscnt; 1402 1405 rxdesc = &mdp->rx_ring[entry]; 1403 1406 while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) { 1404 1407 desc_status = edmac_to_cpu(mdp, rxdesc->status); ··· 1409 1406 1410 1407 if (--boguscnt < 0) 1411 1408 break; 1412 - 1413 - if (*quota <= 0) 1414 - break; 1415 - 1416 - (*quota)--; 1417 1409 1418 1410 if (!(desc_status & RDFEND)) 1419 1411 ndev->stats.rx_length_errors++; ··· 1499 1501 } 1500 1502 sh_eth_write(ndev, EDRRR_R, EDRRR); 1501 1503 } 1504 + 1505 + *quota -= limit - boguscnt - 1; 1502 1506 1503 1507 return *quota <= 0; 1504 1508 }