[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <0835B3720019904CB8F7AA43166CEEB2F18E1587@RTITMBSVM03.realtek.com.tw>
Date: Tue, 24 Sep 2019 02:47:47 +0000
From: Hayes Wang <hayeswang@...ltek.com>
To: Prashant Malani <pmalani@...omium.org>
CC: "grundler@...omium.org" <grundler@...omium.org>,
"netdev@...r.kernel.org" <netdev@...r.kernel.org>,
nic_swsd <nic_swsd@...ltek.com>
Subject: RE: [PATCH] r8152: Use guard clause and fix comment typos
Prashant Malani [mailto:pmalani@...omium.org]
> Sent: Tuesday, September 24, 2019 6:27 AM
> To: Hayes Wang
[...]
> - do {
> + while (1) {
> struct tx_agg *agg;
> + struct net_device *netdev = tp->netdev;
>
> if (skb_queue_empty(&tp->tx_queue))
> break;
> @@ -2188,26 +2189,25 @@ static void tx_bottom(struct r8152 *tp)
> break;
>
> res = r8152_tx_agg_fill(tp, agg);
> - if (res) {
> - struct net_device *netdev = tp->netdev;
> + if (!res)
> + break;
I let the loop run continually until an error occurs or the queue is empty.
However, you stop the loop when r8152_tx_agg_fill() is successful.
If an error occurs continually, the loop may not be broken.
> - if (res == -ENODEV) {
> - rtl_set_unplug(tp);
> - netif_device_detach(netdev);
> - } else {
> - struct net_device_stats *stats = &netdev->stats;
> - unsigned long flags;
> + if (res == -ENODEV) {
> + rtl_set_unplug(tp);
> + netif_device_detach(netdev);
> + } else {
> + struct net_device_stats *stats = &netdev->stats;
> + unsigned long flags;
>
> - netif_warn(tp, tx_err, netdev,
> - "failed tx_urb %d\n", res);
> - stats->tx_dropped += agg->skb_num;
> + netif_warn(tp, tx_err, netdev,
> + "failed tx_urb %d\n", res);
> + stats->tx_dropped += agg->skb_num;
>
> - spin_lock_irqsave(&tp->tx_lock, flags);
> - list_add_tail(&agg->list, &tp->tx_free);
> - spin_unlock_irqrestore(&tp->tx_lock, flags);
> - }
> + spin_lock_irqsave(&tp->tx_lock, flags);
> + list_add_tail(&agg->list, &tp->tx_free);
> + spin_unlock_irqrestore(&tp->tx_lock, flags);
> }
> - } while (res == 0);
> + }
I think the behavior is different from the current one.
Best Regards,
Hayes
Powered by blists - more mailing lists