Subject: Re: [PATCH 2/2] net: ks8851: Handle softirqs at the end of IRQ thread to fix hang

From: Jakub Kicinski <[email-masked]>
Date: Mon, 1 Apr 2024 21:06:42 -0700

On Sun, 31 Mar 2024 16:21:46 +0200 Marek Vasut wrote:
> diff --git a/drivers/net/ethernet/micrel/ks8851_common.c b/drivers/net/ethernet/micrel/ks8851_common.c
> index 896d43bb8883d..b6b727e651f3d 100644
> --- a/drivers/net/ethernet/micrel/ks8851_common.c
> +++ b/drivers/net/ethernet/micrel/ks8851_common.c
> @@ -299,7 +299,7 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
>  					ks8851_dbg_dumpkkt(ks, rxpkt);
>  
>  				skb->protocol = eth_type_trans(skb, ks->netdev);
> -				netif_rx(skb);
> +				__netif_rx(skb);

maybe return the packets from ks8851_rx_pkts()
(you can put them on a queue / struct sk_buff_head)
and process them once the lock is released?

Also why not NAPI?

>  				ks->netdev->stats.rx_packets++;
>  				ks->netdev->stats.rx_bytes += rxlen;
> @@ -325,11 +325,15 @@ static void ks8851_rx_pkts(struct ks8851_net *ks)
>   */
>  static irqreturn_t ks8851_irq(int irq, void *_ks)
>  {
> +	bool need_bh_off = !(hardirq_count() | softirq_count());

I don't think IRQ / RT developers look approvingly at uses of such
low level macros in drivers.