Skip to content

Commit

Permalink
net: atlantic: reduce scope of is_rsc_complete
Browse files Browse the repository at this point in the history
[ Upstream commit 79784d7 ]

Don't defer handling the err case outside the loop. That's pointless.

And since is_rsc_complete is only used inside this loop, declare
it inside the loop to reduce it's scope.

Signed-off-by: Grant Grundler <grundler@chromium.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
  • Loading branch information
grundlerchromium authored and gregkh committed May 25, 2022
1 parent 9b84e83 commit 9bee8b4
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions drivers/net/ethernet/aquantia/atlantic/aq_ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,6 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
int budget)
{
struct net_device *ndev = aq_nic_get_ndev(self->aq_nic);
bool is_rsc_completed = true;
int err = 0;

for (; (self->sw_head != self->hw_head) && budget;
Expand All @@ -365,6 +364,8 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
if (!buff->is_eop) {
buff_ = buff;
do {
bool is_rsc_completed = true;

if (buff_->next >= self->size) {
err = -EIO;
goto err_exit;
Expand All @@ -376,18 +377,16 @@ int aq_ring_rx_clean(struct aq_ring_s *self,
next_,
self->hw_head);

if (unlikely(!is_rsc_completed))
break;
if (unlikely(!is_rsc_completed)) {
err = 0;
goto err_exit;
}

buff->is_error |= buff_->is_error;
buff->is_cso_err |= buff_->is_cso_err;

} while (!buff_->is_eop);

if (!is_rsc_completed) {
err = 0;
goto err_exit;
}
if (buff->is_error ||
(buff->is_lro && buff->is_cso_err)) {
buff_ = buff;
Expand Down

0 comments on commit 9bee8b4

Please sign in to comment.