Re: [PATCH net] net: renesas: rswitch: Fix return value in error path of xmit

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, 2023-05-30 at 13:42 +0200, Simon Horman wrote:
> On Mon, May 29, 2023 at 04:38:17PM +0900, Yoshihiro Shimoda wrote:
> > Fix return value in the error path of rswitch_start_xmit(). If TX
> > queues are full, this function should return NETDEV_TX_BUSY.
> > 
> > Fixes: 3590918b5d07 ("net: ethernet: renesas: Add support for "Ethernet Switch"")
> > Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>
> 
> Hi Shimoda-san,
> 
> I agree that this is the correct return value for this case.
> But I do wonder if, as per the documentation of ndo_start_xmit,
> something should be done to avoid getting into such a situation.
> 
>  * netdev_tx_t (*ndo_start_xmit)(struct sk_buff *skb,
>  *                               struct net_device *dev);
>  *      Called when a packet needs to be transmitted.
>  *      Returns NETDEV_TX_OK.  Can return NETDEV_TX_BUSY, but you should stop
>  *      the queue before that can happen; it's for obsolete devices and weird
>  *      corner cases, but the stack really does a non-trivial amount
>  *      of useless work if you return NETDEV_TX_BUSY.
>  *      Required; cannot be NULL.

I agree with Simon, it looks like the driver usage of
netif_stop_subqueue()/netif_wake_subqueue() is a dubious.

I think you will be better of using
netif_subqueue_maybe_stop()/netif_subqueue_completed_wake() alike what
rtl8169 is doing. e.g. netif_subqueue_maybe_stop() should be invoked
after the tx buffer enqueue, and netif_subqueue_completed_wake() should
be invoked after successful tx ring cleanup.

Thanks!

Paolo






[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux