Browse Source

net: ethernet: ti: am65-cpsw-nuss: optimize napi rx during netif down

The RX NAPI handler am65_cpsw_nuss_rx_packets() will return errors now in
case there are still packets to process while interface is going down or
not ready which will cause break of the RX NAPI polling function and NAPI
resceduling. In other words, leftover packets will be processed one by one.

In such cases (interface is going down or not ready) it's valid to still
have unprocessed packets in RX queues and such packets expected just to be
dropped by RX NAPI handler am65_cpsw_nuss_rx_packets().

Hence, update am65_cpsw_nuss_rx_packets() to not return errors for packets
received while interface is going down or not ready, so they will be
processed in batch by NAPI polling function.

Signed-off-by: Grygorii Strashko <grygorii.strashko@ti.com>
Signed-off-by: Sekhar Nori <nsekhar@ti.com>
Grygorii Strashko 6 years ago
parent
commit
43b2e660a8
1 changed files with 2 additions and 2 deletions
  1. 2 2
      drivers/net/ethernet/ti/am65-cpsw-nuss.c

+ 2 - 2
drivers/net/ethernet/ti/am65-cpsw-nuss.c

@@ -790,7 +790,7 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_common *common,
 
 	if (unlikely(!netif_running(skb->dev))) {
 		dev_kfree_skb_any(skb);
-		return -ENODEV;
+		return 0;
 	}
 
 	new_skb = netdev_alloc_skb_ip_align(ndev, AM65_CPSW_MAX_PACKET_SIZE);
@@ -816,7 +816,7 @@ static int am65_cpsw_nuss_rx_packets(struct am65_cpsw_common *common,
 	if (netif_dormant(ndev)) {
 		dev_kfree_skb_any(new_skb);
 		ndev->stats.rx_dropped++;
-		return -ENODEV;
+		return 0;
 	}
 
 	ret = am65_cpsw_nuss_rx_push(common, new_skb);