From patchwork Mon Apr 18 23:17:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Grant Grundler X-Patchwork-Id: 12817155 X-Patchwork-Delegate: kuba@kernel.org Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0E05AC433F5 for ; Mon, 18 Apr 2022 23:18:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234754AbiDRXUu (ORCPT ); Mon, 18 Apr 2022 19:20:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39530 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234731AbiDRXUr (ORCPT ); Mon, 18 Apr 2022 19:20:47 -0400 Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9655523BD9 for ; Mon, 18 Apr 2022 16:18:07 -0700 (PDT) Received: by mail-qt1-x833.google.com with SMTP id z19so11121299qtw.2 for ; Mon, 18 Apr 2022 16:18:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cm6vrPc6zBxtc8mQWliADJPsKgyQwKE9+4mqmo5RZKE=; b=U8a3jSUSPI7w+GxtadKgv7/XegggLYVFgOz+hbw1AvD0DG03H+DOlpsGSI6Nhwu7dd qkPGuqZr5UIW/puXFV8QaEpgY8yYz+xeQ8UH+989o0lXmrOmvXwHXy6rbIlhTMF11tyD 1/0Q5Ao2CUxstvd2S0cJxiugKkXr5HGO3TbbI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cm6vrPc6zBxtc8mQWliADJPsKgyQwKE9+4mqmo5RZKE=; b=cPQV9JopnU2nZ+NRQQLE6iGu6NOF5iPLpRSE7AakOxrv9FvAA5+XzAISbYQioeYd75 x6S8+1xcXpBXon6GxmKXJcxHujr8ZRSBNRF/VBciCrHZEorjAhfHWg0fb7/QHAHJ8Wxh NkrsZ2lfvmt9N0b5nMUaFx4zuiO1twCDlUn2DJ5omltUQY5xBxwxr3TSGQiRz63f5QaM tqyrzME8xKWVyIKCMwM9hNjBcwJPBxnT1o7aGh9phRBuT2y8VeirVSDrn9jvrOjJUKB/ Xs/2rZF0SJyPdIbd2raYz9YGbXSXfGYx20Io6j3KF+sqwSy7CkBYarpR2275vGeZx8IJ UjSw== X-Gm-Message-State: AOAM530M061ajuy5MhmI82GbapYL/6XtE4jPIijH/kpnIHAuQM8fp0fX Y5NImn6cfLUcu54wfzqnP+YfGwpp1HnPCA== X-Google-Smtp-Source: ABdhPJy+508q4T003VTS1J7WP9dq1N2Y5oaYvHODfUb7OW6Ht+xF09/KjxlhYz+MfAtfzD6Y71opyA== X-Received: by 2002:a05:622a:6182:b0:2f1:e351:abcf with SMTP id hh2-20020a05622a618200b002f1e351abcfmr8548180qtb.321.1650323886785; Mon, 18 Apr 2022 16:18:06 -0700 (PDT) Received: from grundler-glapstation.lan ([70.134.62.80]) by smtp.gmail.com with ESMTPSA id a1-20020a05622a02c100b002f17cba4930sm8214048qtx.85.2022.04.18.16.18.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 18 Apr 2022 16:18:06 -0700 (PDT) From: Grant Grundler To: Igor Russkikh Cc: Jakub Kicinski , Paolo Abeni , netdev , "David S . Miller" , LKML , Aashay Shringarpure , Yi Chou , Shervin Oloumi , Grant Grundler Subject: [PATCH 3/5] net: atlantic: reduce scope of is_rsc_complete Date: Mon, 18 Apr 2022 16:17:44 -0700 Message-Id: <20220418231746.2464800-4-grundler@chromium.org> X-Mailer: git-send-email 2.36.0.rc0.470.gd361397f0d-goog In-Reply-To: <20220418231746.2464800-1-grundler@chromium.org> References: <20220418231746.2464800-1-grundler@chromium.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org X-Patchwork-Delegate: kuba@kernel.org 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 --- drivers/net/ethernet/aquantia/atlantic/aq_ring.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c index 440423b0e8ea..bc1952131799 100644 --- a/drivers/net/ethernet/aquantia/atlantic/aq_ring.c +++ b/drivers/net/ethernet/aquantia/atlantic/aq_ring.c @@ -346,7 +346,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; @@ -366,6 +365,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; @@ -377,18 +378,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;