r8152: break the loop when the budget is exhausted
authorHayes Wang <hayeswang@realtek.com>
Tue, 26 Sep 2023 11:17:13 +0000 (19:17 +0800)
committerJakub Kicinski <kuba@kernel.org>
Wed, 4 Oct 2023 23:51:31 +0000 (16:51 -0700)
commit2cf51f931797d9a47e75d999d0993a68cbd2a560
treef984726ccf5e823e914c4958bb45a76a4f93eba6
parentf8e5b778623767463ec62c81cf5a357b2f1d3315
r8152: break the loop when the budget is exhausted

A bulk transfer of the USB may contain many packets. And, the total
number of the packets in the bulk transfer may be more than budget.

Originally, only budget packets would be handled by napi_gro_receive(),
and the other packets would be queued in the driver for next schedule.

This patch would break the loop about getting next bulk transfer, when
the budget is exhausted. That is, only the current bulk transfer would
be handled, and the other bulk transfers would be queued for next
schedule. Besides, the packets which are more than the budget in the
current bulk trasnfer would be still queued in the driver, as the
original method.

In addition, a bulk transfer wouldn't contain more than 400 packets, so
the check of queue length is unnecessary. Therefore, I replace it with
WARN_ON_ONCE().

Fixes: cf74eb5a5bc8 ("eth: r8152: try to use a normal budget")
Signed-off-by: Hayes Wang <hayeswang@realtek.com>
Link: https://lore.kernel.org/r/20230926111714.9448-433-nic_swsd@realtek.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/usb/r8152.c