From patchwork Tue Nov 14 00:16:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13454642 X-Patchwork-Delegate: kuba@kernel.org Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 390BD33F5 for ; Tue, 14 Nov 2023 00:17:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="WgIFsTqs" Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 23E25D53 for ; Mon, 13 Nov 2023 16:17:01 -0800 (PST) Received: by mail-pf1-x430.google.com with SMTP id d2e1a72fcca58-6bf03b98b9bso4529946b3a.1 for ; Mon, 13 Nov 2023 16:17:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1699921020; x=1700525820; darn=vger.kernel.org; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:from:to:cc:subject:date:message-id:reply-to; bh=yVrCcKnQ6Jv1xDrLFriY66BoI6gR4/vYR3jarBi2LSg=; b=WgIFsTqs02UEgQ6pPhKK5ZXSxEEEJEtgHXcAnSM5WrVz6sazDf5NbjXdjqLEJ3E21O m6ZCsiBaTTYECUsXY35WgJHH11XzBOvfAo/bow5N07pxCFO0WTMokytqpv5KyodMVhiN iNardo0aejlXZonXq7hXCT3IKvIQlDKLIcJ9M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1699921020; x=1700525820; h=mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yVrCcKnQ6Jv1xDrLFriY66BoI6gR4/vYR3jarBi2LSg=; b=mrG2AjJsjoWrLbjuAHVWLAfP/PgS/KH+y6bjmYRvWIYdDbPBRgx7MMsMj/dLyw1mmn pnYTN3ljEK4SuA56Ow1SMQNC4Gyg0Axsg2eHOW+kofGuANETtuVDt+YofycUxldV+XTy Ww8MNEwV5XDgN5sHmnRYtfykM7gMmDR0HlMQKXmni+8bM4bqe67PWXkdp8C4sWEG06Qv NgqG4Hs5cFANfOj944df4MRZ8pXlaWVXY745dWXA7tnlhYoet69rzEueSJd8LHxRkJKX yq5GyvfzXNp01fhzIzldBPHKnqAluIu6R13AUGZrrZ1XW1W/k1rQC6Xz0hDTp48Jr2Rm CahQ== X-Gm-Message-State: AOJu0YzaSSzU8huGqv+WujKbPO/IS9YvS79FsHDo9UFWOaQaN2ZGVlBY Q0is8HjAdUlqRRZIRF7m/iNRVw== X-Google-Smtp-Source: AGHT+IGPQnZY/kLTf93ucbwYipmLiKKozeYXqXG8lWgei4m81hbzjw9pdEdIPhBJ1DM+Aj2Ylig+yA== X-Received: by 2002:a17:90a:e7cd:b0:280:204e:9121 with SMTP id kb13-20020a17090ae7cd00b00280204e9121mr1584295pjb.23.1699921020387; Mon, 13 Nov 2023 16:17:00 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id p6-20020a17090a680600b0027ffff956bcsm4063478pjj.47.2023.11.13.16.16.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 13 Nov 2023 16:16:59 -0800 (PST) From: Michael Chan To: davem@davemloft.net Cc: netdev@vger.kernel.org, edumazet@google.com, kuba@kernel.org, pabeni@redhat.com, gospo@broadcom.com, Andy Gospodarek Subject: [PATCH net-next v2 06/13] bnxt_en: Refactor bnxt_tx_int() Date: Mon, 13 Nov 2023 16:16:14 -0800 Message-Id: <20231114001621.101284-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231114001621.101284-1-michael.chan@broadcom.com> References: <20231114001621.101284-1-michael.chan@broadcom.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org bnxt_tx_int() processes the only one TX ring from the bnxt_napi pointer. To prepare for more TX rings associated with the bnxt_napi structure, add a new __bnxt_tx_int() function that takes the bnxt_tx_ring_info pointer to process that one TX ring. No functional change. Reviewed-by: Andy Gospodarek Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index a4f7fa17daf8..ad56ca9d3ceb 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -687,14 +687,14 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) return NETDEV_TX_OK; } -static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) +static void __bnxt_tx_int(struct bnxt *bp, struct bnxt_tx_ring_info *txr, + int budget) { - struct bnxt_tx_ring_info *txr = bnapi->tx_ring; struct netdev_queue *txq = netdev_get_tx_queue(bp->dev, txr->txq_index); - u16 hw_cons = txr->tx_hw_cons; - u16 cons = txr->tx_cons; struct pci_dev *pdev = bp->pdev; + u16 hw_cons = txr->tx_hw_cons; unsigned int tx_bytes = 0; + u16 cons = txr->tx_cons; int tx_pkts = 0; while (cons != hw_cons) { @@ -749,7 +749,6 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) dev_consume_skb_any(skb); } - bnapi->events &= ~BNXT_TX_CMP_EVENT; WRITE_ONCE(txr->tx_cons, cons); __netif_txq_completed_wake(txq, tx_pkts, tx_bytes, @@ -757,6 +756,14 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) READ_ONCE(txr->dev_state) == BNXT_DEV_STATE_CLOSING); } +static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) +{ + struct bnxt_tx_ring_info *txr = bnapi->tx_ring; + + __bnxt_tx_int(bp, txr, budget); + bnapi->events &= ~BNXT_TX_CMP_EVENT; +} + static struct page *__bnxt_alloc_rx_page(struct bnxt *bp, dma_addr_t *mapping, struct bnxt_rx_ring_info *rxr, unsigned int *offset,