Skip to content

Commit 319cd52

Browse files
mitsu-kimuradavem330
authored andcommitted
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>
1 parent e008f3f commit 319cd52

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1395,10 +1395,13 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
13951395

13961396
int entry = mdp->cur_rx % mdp->num_rx_ring;
13971397
int boguscnt = (mdp->dirty_rx + mdp->num_rx_ring) - mdp->cur_rx;
1398+
int limit;
13981399
struct sk_buff *skb;
13991400
u16 pkt_len = 0;
14001401
u32 desc_status;
14011402

1403+
boguscnt = min(boguscnt, *quota);
1404+
limit = boguscnt;
14021405
rxdesc = &mdp->rx_ring[entry];
14031406
while (!(rxdesc->status & cpu_to_edmac(mdp, RD_RACT))) {
14041407
desc_status = edmac_to_cpu(mdp, rxdesc->status);
@@ -1407,11 +1410,6 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
14071410
if (--boguscnt < 0)
14081411
break;
14091412

1410-
if (*quota <= 0)
1411-
break;
1412-
1413-
(*quota)--;
1414-
14151413
if (!(desc_status & RDFEND))
14161414
ndev->stats.rx_length_errors++;
14171415

@@ -1502,6 +1500,8 @@ static int sh_eth_rx(struct net_device *ndev, u32 intr_status, int *quota)
15021500
sh_eth_write(ndev, EDRRR_R, EDRRR);
15031501
}
15041502

1503+
*quota -= limit - boguscnt - 1;
1504+
15051505
return *quota <= 0;
15061506
}
15071507

0 commit comments

Comments
 (0)