From patchwork Tue Dec 12 00:51:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488256 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="WP7SBu98" Received: from mail-qk1-x736.google.com (mail-qk1-x736.google.com [IPv6:2607:f8b0:4864:20::736]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AC2ADA6 for ; Mon, 11 Dec 2023 16:51:45 -0800 (PST) Received: by mail-qk1-x736.google.com with SMTP id af79cd13be357-77f8308616eso37638885a.2 for ; Mon, 11 Dec 2023 16:51:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342305; x=1702947105; 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=I/PK91kUO/CCAwjCt15o7px/ZKEUyN3JIcrH6rtuZho=; b=WP7SBu987YVrRk6W/R5eVPhyXcWQN5wHW/oMstdU8zF4qqnBZzmiHwMVniH0KyZezh ZgvWb95ZDlE+z+Jv7EDLpqvIFH1sqbUqcEhEe0nKEPTXa24UYr3lsMuV1EwkMQ8LdUTB mKbhXz6WeX/BFB3KlVxp7eiygwTFSHawxI4tA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342305; x=1702947105; 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=I/PK91kUO/CCAwjCt15o7px/ZKEUyN3JIcrH6rtuZho=; b=hjSopr8T8UWCCBnu5E9U3gSyjb17Ec/n4r/XNzFyxMt7wTm1ix/pGn24Lg/az61S/6 PKk405ali+JmPO0zNJwnH/YmuISn6HVPgg3x68g3vJARb2uBFl1TnbFRP85OqTBgwrpf LWmbxgmHPyaAOVFk0l+tjXU6UrP+pfjmttUIZKdjGCgjOcA3oAwj87y2MWwXyrIwjNis 2kLhs2tdwi4NPREK/KbSAFklE5Q+zacao1aLhwYsQnZxyShyZv118sE5BxFdcT02aNbn NWo1WkhGAcuZWc5Ae+0aHnEJDJvvID+OFNXgTZCkJii9yumAGDCMXN/mUaGnkcogDq3X 0PtA== X-Gm-Message-State: AOJu0Yx9hnm3p9PNlCiYk/ivD6QW3H1DoHShnzkL7gvAw3IAd0P3AYoL S49g+gGx/x75Bwk7NH4xu+MLfFZ42Cvm+fMYsag= X-Google-Smtp-Source: AGHT+IF41m66EyCBuStgRbd7mlaXNngkMhu3Uusk/Y/tWOFx40rqknxXtvpHNPZMhRBWtGDQED9IGQ== X-Received: by 2002:a05:622a:341:b0:425:a60b:4d94 with SMTP id r1-20020a05622a034100b00425a60b4d94mr8482836qtw.21.1702342304734; Mon, 11 Dec 2023 16:51:44 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:44 -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, Pavan Chebbi Subject: [PATCH net-next 01/13] bnxt_en: Fix trimming of P5 RX and TX rings Date: Mon, 11 Dec 2023 16:51:10 -0800 Message-Id: <20231212005122.2401-2-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 The recent commit to trim the RX and TX rings on P5 chips by assigning each with max CP rings divided by 2 is not correct. Max CP rings divided by 2 may be bigger than the original RX or TX and would lead to failure. In other words, we may be checking for increased RX/TX rings than required and it may fail. Fix it by calling __bnxt_trim_rings() instead that would properly trim RX and TX without the possibility of increasing their values. Fixes: f5b29c6afe36 ("bnxt_en: Add helper to get the number of CP rings required for TX rings") Reviewed-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 92a54113f872..7afbbc71f92f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -6489,6 +6489,8 @@ static void bnxt_hwrm_ring_free(struct bnxt *bp, bool close_path) } } +static int __bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max, + bool shared); static int bnxt_trim_rings(struct bnxt *bp, int *rx, int *tx, int max, bool shared); @@ -6532,8 +6534,9 @@ static int bnxt_hwrm_get_rings(struct bnxt *bp) if (bp->flags & BNXT_FLAG_AGG_RINGS) rx >>= 1; if (cp < (rx + tx)) { - rx = cp / 2; - tx = rx; + rc = __bnxt_trim_rings(bp, &rx, &tx, cp, false); + if (rc) + return rc; if (bp->flags & BNXT_FLAG_AGG_RINGS) rx <<= 1; hw_resc->resv_rx_rings = rx; @@ -13885,9 +13888,12 @@ static void _bnxt_get_max_rings(struct bnxt *bp, int *max_rx, int *max_tx, if (bp->flags & BNXT_FLAG_AGG_RINGS) *max_rx >>= 1; if (bp->flags & BNXT_FLAG_CHIP_P5_PLUS) { - if (*max_cp < (*max_rx + *max_tx)) { - *max_rx = *max_cp / 2; - *max_tx = *max_rx; + int rc; + + rc = __bnxt_trim_rings(bp, max_rx, max_tx, *max_cp, false); + if (rc) { + *max_rx = 0; + *max_tx = 0; } /* On P5 chips, max_cp output param should be available NQs */ *max_cp = max_irq; From patchwork Tue Dec 12 00:51:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488257 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="P/w+Tobs" Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 17F6DB3 for ; Mon, 11 Dec 2023 16:51:47 -0800 (PST) Received: by mail-qt1-x831.google.com with SMTP id d75a77b69052e-425baafa3c3so18275941cf.0 for ; Mon, 11 Dec 2023 16:51:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342306; x=1702947106; 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=VNAhbz/3JFmavnnVl0fxEttHYiHJ/95LJZIsp5PVOsQ=; b=P/w+TobszbxurpzIB+Pen93+TjCR00Ggbj6Rj55aPTDrKPT3NDXtiKPIq4IGxKWkXC 7tB7YHZMXnxka8t/Z7+Qtn4V0/nqd8wKImjNUHFBrX4bBBpzAKyhVJY6u7W5q4xSRhnC wTD5vl8lFNmvFNYVYX8LZgQjQQPmpkKvmvAdA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342306; x=1702947106; 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=VNAhbz/3JFmavnnVl0fxEttHYiHJ/95LJZIsp5PVOsQ=; b=kYMmKtMFI6nDdXj0oX9gLBMwHf9s4hPt7c8WMnJqwxhCDZiG9Kh6NZnIVpiP625M/0 LVUvlVyEvGRk3Ay0MZIVtH5+sd8beNyMiQD3ibHi+QqkWMBGVMzmbL8aF4Ul4+JIJctm cY9qOkEmqvgMxB9xEfNbmArmNJClUqw3fybfVh/rw/+Mz0b1b67Ix574snQ+bQX3bIVm YXLRT92TbEfsBv2gfkG4DoCunSC4VLLkHVIOIlQHG8gl+mJuqCt/0o0JFrx+Fwv0pT6F gg6+QmBShgf0Alf/qh3L4TzhxWyPyprWblfo9eEGMdhsMgxKMk+RN33CuOG21jrBmLVl KM9w== X-Gm-Message-State: AOJu0YxuNdqzm4kHuAbCyUNslXAHsT7UDx8uGp+qTvtew2iNb3++wPih j9rlCYyAhetZ9mVFsiERC0WMYA== X-Google-Smtp-Source: AGHT+IEwxJmur6f7NI72c3kkQJ9GSly4tL9h2ePK9SjEhaQZBhIYMobDvdbrC2Z65OWP1WrJXh8QJg== X-Received: by 2002:a05:622a:5c8:b0:425:9ddf:2bc8 with SMTP id d8-20020a05622a05c800b004259ddf2bc8mr8400458qtb.135.1702342306116; Mon, 11 Dec 2023 16:51:46 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.44 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:45 -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, Somnath Kotur Subject: [PATCH net-next 02/13] bnxt_en: Fix AGG ring check logic in bnxt_check_rings() Date: Mon, 11 Dec 2023 16:51:11 -0800 Message-Id: <20231212005122.2401-3-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 From: Somnath Kotur _bnxt_get_max_rings() that is invoked in bnxt_check_rings() already accounts for the AGG ring(s) and gives a max value based on that. Increasing for AGG rings before calling _bnxt_get_max_rings() will result in checking for twice the number of rings than required and it can fail. Fix it by adjusting for AGG rings after calling _bnxt_get_max_rings(). Fixes: f5b29c6afe36 ("bnxt_en: Add helper to get the number of CP rings required for TX rings") Signed-off-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 7afbbc71f92f..114beaa95e78 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -12724,14 +12724,14 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs, if (tcs) tx_sets = tcs; - if (bp->flags & BNXT_FLAG_AGG_RINGS) - rx_rings <<= 1; - _bnxt_get_max_rings(bp, &max_rx, &max_tx, &max_cp); if (max_rx < rx_rings) return -ENOMEM; + if (bp->flags & BNXT_FLAG_AGG_RINGS) + rx_rings <<= 1; + tx_rings_needed = tx * tx_sets + tx_xdp; if (max_tx < tx_rings_needed) return -ENOMEM; From patchwork Tue Dec 12 00:51:12 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488258 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="GB8MU0fv" Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 58DC999 for ; Mon, 11 Dec 2023 16:51:48 -0800 (PST) Received: by mail-qt1-x82f.google.com with SMTP id d75a77b69052e-425c9cd7dd2so7291321cf.2 for ; Mon, 11 Dec 2023 16:51:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342307; x=1702947107; 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=zhmud6rNG2vA24AXXNtsQgp6NcXH4CphmkbZl0Gzdcw=; b=GB8MU0fvCRrvlbOlU5z5v1GhLyGu0vxa2pFTTXdfkpASJjH9qTkRqe7vFip/pXFe3Q 3BFoiq+azS36mnehsUnqV16AVKBZ8iYWYuUpQZw0cF8EkL82y2M8ryeZMuiob/LaXF+/ skSdzwIJyfbJRY0UIGBEqwUmsTFevieMKqxhM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342307; x=1702947107; 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=zhmud6rNG2vA24AXXNtsQgp6NcXH4CphmkbZl0Gzdcw=; b=IUZpSA+Fh+8dsG3muGWoxk9P8uPXGIO6clKsaND8JnYSXWEx/sjv7SQn7u8hzIUP6I bGj7qNm9W9i72jCk8bwQV0HCeek1KbNrQR12FCAoIWoxWO/5jthlNY9leiEl9b79FMG5 cQU+pULYd7MxP7ws+lCUhLA6nnbBOmPD6VDUGzndSQ+EgPBAZED0PDhU/xeogMzUouvw Pg8vn8oCuqA+OKrHOuhdn9RPL4+855HNNPQ/iajDzqLdM8v/qYqlGLK6+PMM4CWfN42U hlMSfAaB74vFpFHl61BtQBe4/CbzO1VjCFMZv6O5f0oKNaSfQPrZ8xOS+ercfstSdsz8 RAQA== X-Gm-Message-State: AOJu0Yw0pgGw/7D3BKrubOlh2lIs9m96FOXhDnERyBISIc06pusX01R+ B/xgl+xIAcpt5eJdXWD2Cln51fRx7RyBaETzjeU= X-Google-Smtp-Source: AGHT+IGPq+Xlynhc914qVmk2lubMaXXxG4nMzNn3kfu2io3uH3UHnO1rwm0h5QkeJUO1stGynILXyg== X-Received: by 2002:a05:622a:1792:b0:425:85eb:c2b1 with SMTP id s18-20020a05622a179200b0042585ebc2b1mr4740281qtk.15.1702342307361; Mon, 11 Dec 2023 16:51:47 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:47 -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 Subject: [PATCH net-next 03/13] bnxt_en: Fix TX ring indexing logic Date: Mon, 11 Dec 2023 16:51:12 -0800 Message-Id: <20231212005122.2401-4-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 Two spots were missed when modifying the TX ring indexing logic. The use of unmasked TX index in bnxt_tx_int() will cause unnecessary __bnxt_tx_int() calls. The same issue in bnxt_tx_int_xdp() can result in illegal array index. Fixes: 6d1add95536b ("bnxt_en: Modify TX ring indexing logic.") Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 2 +- drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 114beaa95e78..83a47feaf869 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -781,7 +781,7 @@ static void bnxt_tx_int(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) int i; bnxt_for_each_napi_tx(i, bnapi, txr) { - if (txr->tx_hw_cons != txr->tx_cons) + if (txr->tx_hw_cons != RING_TX(bp, txr->tx_cons)) __bnxt_tx_int(bp, txr, budget); } bnapi->events &= ~BNXT_TX_CMP_EVENT; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c index 4791f6a14e55..037624f17aea 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_xdp.c @@ -173,7 +173,7 @@ void bnxt_tx_int_xdp(struct bnxt *bp, struct bnxt_napi *bnapi, int budget) bnapi->events &= ~BNXT_TX_CMP_EVENT; WRITE_ONCE(txr->tx_cons, tx_cons); if (rx_doorbell_needed) { - tx_buf = &txr->tx_buf_ring[last_tx_cons]; + tx_buf = &txr->tx_buf_ring[RING_TX(bp, last_tx_cons)]; bnxt_db_write(bp, &rxr->rx_db, tx_buf->rx_prod); } From patchwork Tue Dec 12 00:51:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488259 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Yku+/dm/" 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 68555A6 for ; Mon, 11 Dec 2023 16:51:50 -0800 (PST) Received: by mail-qt1-x833.google.com with SMTP id d75a77b69052e-425a2b4df7bso28950281cf.0 for ; Mon, 11 Dec 2023 16:51:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342309; x=1702947109; 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=aelxwKrcpUovV+lrvFh8GS5TLlt4A+P3CdYnZDF2F/w=; b=Yku+/dm/cH+/hFoDnsKYhIIxs/e2XvQpHroMLXqozetr4dkjj1GQKzkMHUoAozHuia 7JjUS8/9+dcYepTPFQOlyohwTGpw81T+nBH/yk7xC10oLgkT81BiyonYoc6bE/MddAQ1 LfWxz1X+g+gsFuuEbLMmV2H+MPw+0ja9WwBJE= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342309; x=1702947109; 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=aelxwKrcpUovV+lrvFh8GS5TLlt4A+P3CdYnZDF2F/w=; b=WMNakwdWuwWJ2fmp/Dqlo5MMKDDGm+r/in7YQW4A+q/VK/I8cHCl88Fp4ezuTL/Soo IQfTjehtp1LyqJidG+Yj94+ks09HOGRK1XoQQMPBEkHpl7Zdkt/v61DbUPrg7AullvBI tal0kjg4j8NGxkPE+CE98QkSYWvpiBYqoPeSLNXhva53AmupFk4YyMZimWAcpzcasorL MhBJlocjgAL914KPGsp7tcMMHEep3G4TBO99Oi34bXIr4wozmIbrc0nQc+zgUE9vjFBj AlFE2CN0W9as1IMZl27CTdnK6tnLyPni3I0++3P7DlKVnx/Am83hO/alHTALyJ6m0NBN AF0A== X-Gm-Message-State: AOJu0YxpAYyEkuDD+RnbgPYm3lpdbiDc3AgHVlPZgvuUY8oYqbVImWpJ HCBMBBRBmxdQv13fU72GI9eaXQ== X-Google-Smtp-Source: AGHT+IHH4KnZGqbhTxGq39hEVczEoou9+1LzRp/2NKu+++dNjSFt3phDOo+GwxdOFc1+tn15GVHsiw== X-Received: by 2002:ac8:7e88:0:b0:425:a282:71af with SMTP id w8-20020ac87e88000000b00425a28271afmr8195649qtj.35.1702342309504; Mon, 11 Dec 2023 16:51:49 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.47 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:48 -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, Somnath Kotur , Andy Gospodarek , Hongguang Gao Subject: [PATCH net-next 04/13] bnxt_en: Prevent TX timeout with a very small TX ring Date: Mon, 11 Dec 2023 16:51:13 -0800 Message-Id: <20231212005122.2401-5-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 If xmit_more condition is true, the driver may set the TX_BD_FLAGS_NO_CMPL flag. If after this packet, the TX ring can no longer hold a packet with maximum fragments, we will stop the TX queue. When this happens, we must clear the TX_BD_FLAGS_NO_CMPL flag on the last packet or there will be no completion and cause TX timeout. Fixes: c1056a59aee1 ("bnxt_en: Optimize xmit_more TX path") Reviewed-by: Somnath Kotur Reviewed-by: Andy Gospodarek Reviewed-by: Hongguang Gao Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 83a47feaf869..cc6cab340423 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -666,8 +666,11 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) tx_done: if (unlikely(bnxt_tx_avail(bp, txr) <= MAX_SKB_FRAGS + 1)) { - if (netdev_xmit_more() && !tx_buf->is_push) + if (netdev_xmit_more() && !tx_buf->is_push) { + txbd0->tx_bd_len_flags_type &= + cpu_to_le32(~TX_BD_FLAGS_NO_CMPL); bnxt_txr_db_kick(bp, txr, prod); + } netif_txq_try_stop(txq, bnxt_tx_avail(bp, txr), bp->tx_wake_thresh); From patchwork Tue Dec 12 00:51: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: 13488260 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="fdnASrfP" Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B38AF99 for ; Mon, 11 Dec 2023 16:51:51 -0800 (PST) Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-4259cd18f85so29506651cf.3 for ; Mon, 11 Dec 2023 16:51:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342311; x=1702947111; 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=0GRg3tTFnd1ThzcDN5BotumcET1n98r4nqdLd+1/9JM=; b=fdnASrfPK/x21RTyibo363r5cUc9OIVrkF4OJHKNhMF+JPhbL0K0VxXxgmabPsH46c bAOuYVCY7Emvfq+xJSrFI7QgT9xleooXq7CHNH0bGab1le890vj+ex4rDJeUgN/jN1Kw nFlxpytRXKH4fXRRFjsRXk16IMlH2GNd81G0U= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342311; x=1702947111; 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=0GRg3tTFnd1ThzcDN5BotumcET1n98r4nqdLd+1/9JM=; b=dxWdhper1SEvmvKavDAz53haVn9CBIgisH79sD8y/QtLZIQIBqP2gJVzMJ5VrRifGy Djtmr4LIBLU8Hv+v29nk0cuIGd81zPeIxF2KvMxVzEMG1M2kc5Tq0rfMRKdolVaalXwI 3eIWfA7gq+houys4EumDJJQ9SgHRudKIV5egMXcg/MENyx2I/V+bX3BWUecAxVlHTEp6 Hek8sdBmuYzDb74Q/RurJvyfa9fCf3V0qALN3tM9+RloH/GfYJ9bqz5N20y9kecUKo+c QbCanAZeILXeJYRiy2VY89AZ8Tn35QuViYQ81dTfI7FXboqyRcWdcEwzAFpS1TMec49O OusA== X-Gm-Message-State: AOJu0YzWIa7V19LDgA0KxQu8orsm5gKjpm9yiNFByGBr5p5oDzrf/oHp HNbMH1jSJacw8CE48fDn2SZm5g== X-Google-Smtp-Source: AGHT+IE5KkuGXZbRzG2M6AVpsZWUMHWXImPYSUcpzCiBDezEOyYf2r9UxlK7Wuw+dqjq0CnBkLHwpw== X-Received: by 2002:ac8:7d52:0:b0:425:4043:7650 with SMTP id h18-20020ac87d52000000b0042540437650mr8206344qtb.120.1702342310721; Mon, 11 Dec 2023 16:51:50 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.49 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:50 -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 Subject: [PATCH net-next 05/13] bnxt_en: Support TX coalesced completion on 5760X chips Date: Mon, 11 Dec 2023 16:51:14 -0800 Message-Id: <20231212005122.2401-6-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 TX coalesced completions are supported on newer chips to provide one TX completion record for multiple TX packets up to the sq_cons_idx in the completion record. This method saves PCIe bandwidth by reducing the number of TX completions. Only very minor changes are now required to support this mode with the new framework that handles TX completions based on the consumer indices. Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 +++++++++++-- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index cc6cab340423..72e2bd4611de 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -2785,14 +2785,18 @@ static int __bnxt_poll_work(struct bnxt *bp, struct bnxt_cp_ring_info *cpr, */ dma_rmb(); cmp_type = TX_CMP_TYPE(txcmp); - if (cmp_type == CMP_TYPE_TX_L2_CMP) { + if (cmp_type == CMP_TYPE_TX_L2_CMP || + cmp_type == CMP_TYPE_TX_L2_COAL_CMP) { u32 opaque = txcmp->tx_cmp_opaque; struct bnxt_tx_ring_info *txr; u16 tx_freed; txr = bnapi->tx_ring[TX_OPAQUE_RING(opaque)]; event |= BNXT_TX_CMP_EVENT; - txr->tx_hw_cons = TX_OPAQUE_PROD(bp, opaque); + if (cmp_type == CMP_TYPE_TX_L2_COAL_CMP) + txr->tx_hw_cons = TX_CMP_SQ_CONS_IDX(txcmp); + else + txr->tx_hw_cons = TX_OPAQUE_PROD(bp, opaque); tx_freed = (txr->tx_hw_cons - txr->tx_cons) & bp->tx_ring_mask; /* return full budget so NAPI will complete. */ @@ -6068,6 +6072,9 @@ static int hwrm_ring_alloc_send_msg(struct bnxt *bp, req->length = cpu_to_le32(bp->tx_ring_mask + 1); req->stat_ctx_id = cpu_to_le32(grp_info->fw_stats_ctx); req->queue_id = cpu_to_le16(ring->queue_id); + if (bp->flags & BNXT_FLAG_TX_COAL_CMPL) + req->cmpl_coal_cnt = + RING_ALLOC_REQ_CMPL_COAL_CNT_COAL_64; break; } case HWRM_RING_ALLOC_RX: @@ -8279,6 +8286,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) bp->fw_cap |= BNXT_FW_CAP_LIVEPATCH; if (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_BS_V2_SUPPORTED) bp->fw_cap |= BNXT_FW_CAP_BACKING_STORE_V2; + if (flags_ext & FUNC_QCAPS_RESP_FLAGS_EXT_TX_COAL_CMPL_CAP) + bp->flags |= BNXT_FLAG_TX_COAL_CMPL; flags_ext2 = le32_to_cpu(resp->flags_ext2); if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index afa784305fea..67915ab13f50 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2047,6 +2047,7 @@ struct bnxt { #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 #define BNXT_FLAG_DIM 0x2000000 #define BNXT_FLAG_ROCE_MIRROR_CAP 0x4000000 + #define BNXT_FLAG_TX_COAL_CMPL 0x8000000 #define BNXT_FLAG_PORT_STATS_EXT 0x10000000 #define BNXT_FLAG_ALL_CONFIG_FEATS (BNXT_FLAG_TPA | \ From patchwork Tue Dec 12 00:51:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488261 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="JSC3i7Pf" Received: from mail-qk1-x72e.google.com (mail-qk1-x72e.google.com [IPv6:2607:f8b0:4864:20::72e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3EF14A6 for ; Mon, 11 Dec 2023 16:51:53 -0800 (PST) Received: by mail-qk1-x72e.google.com with SMTP id af79cd13be357-77f8308616eso37643185a.2 for ; Mon, 11 Dec 2023 16:51:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342312; x=1702947112; 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=WguqJFGGFl7e8875DmHuLLtOdnq7eY2Vkwa0CIPYSw0=; b=JSC3i7Pfd3KJu9dEAmpxma/oWAzHuSpI+MXn8jb7l8ceUbu63QEJ6KzUW1qVM0SWEk U+vHNcXyZlcT2NUcG1D9c5jKliMx2PeGZQmoRs6ZsOygMLVFvktZcvFHCJdOLPmC4zQt J0PCKY6djSjSKk/gCunz2PyEO4P9iwDgqxVPA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342312; x=1702947112; 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=WguqJFGGFl7e8875DmHuLLtOdnq7eY2Vkwa0CIPYSw0=; b=fY7d+I07B05DtQsU3AFkE4hYAyKcLqBAMl7NWZKrfnNrJRtNYXK6KgVHhirBvPn2Dr aOS40KgM81yrMHYoqz38kMJ2Fv6r2tGm642Bf7oK7XOsvqqeBAmidUk8wYic1NlFeXZ4 TX7CHeCdevFeq2WurRfhD0MrmhQhIEpwJSk9uI1Z8gyeIiNFMDa2RXCeFv8LF75Hek78 U8nWuHxYJzYjFDbnAVcAsgdzmAh/zAUxeqhVByL7XxKKkQZptYfGq76j/yl16NZJXLVM 75z25HhwLGX5Sr8u7w0+pZ8DVH8B3SLZSS9TaOQmvnGEp9R6CfGxs+b/CRlpB7+7fEzQ fqug== X-Gm-Message-State: AOJu0Yywu0YsXIXZQ26plJ43oOWV5JmzQ3JPvlwM5GxaYmFpx+49Ae6e ni5d/n6ocSB37Uyhz2M6r0kC4A== X-Google-Smtp-Source: AGHT+IGCcVHzuu8NbMCKMPE5+Zp/cwi4JFvU1qtrzIP7uPdR+nYxOsKaRqccvq1WWQ598YO0pxgPNw== X-Received: by 2002:a05:622a:64a:b0:425:9d55:e9f5 with SMTP id a10-20020a05622a064a00b004259d55e9f5mr8564026qtb.75.1702342312259; Mon, 11 Dec 2023 16:51:52 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.50 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:51 -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, Selvin Xavier Subject: [PATCH net-next 06/13] bnxt_en: Allocate extra QP backing store memory when RoCE FW reports it Date: Mon, 11 Dec 2023 16:51:15 -0800 Message-Id: <20231212005122.2401-7-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 From: Selvin Xavier The Fast QP modify destroy RoCE feature requires additional QP entries in QP context backing store. FW reports the extra count to be allocated during backing store query. Use this value and allocate extra memory. Note that this works for both the V1 and V1 backing store FW APIs. Signed-off-by: Selvin Xavier Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 72e2bd4611de..42a52ee8c1bc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -7535,6 +7535,7 @@ static int bnxt_hwrm_func_backing_store_qcaps(struct bnxt *bp) ctxm->max_entries = le32_to_cpu(resp->qp_max_entries); ctxm->qp_qp1_entries = le16_to_cpu(resp->qp_min_qp1_entries); ctxm->qp_l2_entries = le16_to_cpu(resp->qp_max_l2_entries); + ctxm->qp_fast_qpmd_entries = le16_to_cpu(resp->fast_qpmd_qp_num_entries); ctxm->entry_size = le16_to_cpu(resp->qp_entry_size); bnxt_init_ctx_initializer(ctxm, init_val, resp->qp_init_offset, (init_mask & (1 << init_idx++)) != 0); @@ -7672,6 +7673,9 @@ static int bnxt_hwrm_func_backing_store_cfg(struct bnxt *bp, u32 enables) bnxt_hwrm_set_pg_attr(&ctx_pg->ring_mem, &req->qpc_pg_size_qpc_lvl, &req->qpc_page_dir); + + if (enables & FUNC_BACKING_STORE_CFG_REQ_ENABLES_QP_FAST_QPMD) + req->qp_num_fast_qpmd_entries = cpu_to_le16(ctxm->qp_fast_qpmd_entries); } if (enables & FUNC_BACKING_STORE_CFG_REQ_ENABLES_SRQ) { ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; @@ -8004,6 +8008,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) u32 num_mr, num_ah; u32 extra_srqs = 0; u32 extra_qps = 0; + u32 fast_qpmd_qps; u8 pg_lvl = 1; int i, rc; @@ -8020,14 +8025,20 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; l2_qps = ctxm->qp_l2_entries; qp1_qps = ctxm->qp_qp1_entries; + fast_qpmd_qps = ctxm->qp_fast_qpmd_entries; max_qps = ctxm->max_entries; ctxm = &ctx->ctx_arr[BNXT_CTX_SRQ]; srqs = ctxm->srq_l2_entries; max_srqs = ctxm->max_entries; + ena = 0; if ((bp->flags & BNXT_FLAG_ROCE_CAP) && !is_kdump_kernel()) { pg_lvl = 2; extra_qps = min_t(u32, 65536, max_qps - l2_qps - qp1_qps); + /* allocate extra qps if fw supports RoCE fast qp destroy feature */ + extra_qps += fast_qpmd_qps; extra_srqs = min_t(u32, 8192, max_srqs - srqs); + if (fast_qpmd_qps) + ena |= FUNC_BACKING_STORE_CFG_REQ_ENABLES_QP_FAST_QPMD; } ctxm = &ctx->ctx_arr[BNXT_CTX_QP]; @@ -8057,7 +8068,6 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) if (rc) return rc; - ena = 0; if (!(bp->flags & BNXT_FLAG_ROCE_CAP)) goto skip_rdma; @@ -8074,7 +8084,7 @@ static int bnxt_alloc_ctx_mem(struct bnxt *bp) rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, num_mr + num_ah, 2); if (rc) return rc; - ena = FUNC_BACKING_STORE_CFG_REQ_ENABLES_MRAV; + ena |= FUNC_BACKING_STORE_CFG_REQ_ENABLES_MRAV; ctxm = &ctx->ctx_arr[BNXT_CTX_TIM]; rc = bnxt_setup_ctxm_pg_tbls(bp, ctxm, l2_qps + qp1_qps + extra_qps, 1); From patchwork Tue Dec 12 00:51:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488262 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="CaCh1NWV" Received: from mail-qt1-x82e.google.com (mail-qt1-x82e.google.com [IPv6:2607:f8b0:4864:20::82e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8695299 for ; Mon, 11 Dec 2023 16:51:54 -0800 (PST) Received: by mail-qt1-x82e.google.com with SMTP id d75a77b69052e-425922f5b89so34917861cf.0 for ; Mon, 11 Dec 2023 16:51:54 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342313; x=1702947113; 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=/FQLSzIEljtj9qMhFQjt2/nf1M48P3DkoQUJaRn/gds=; b=CaCh1NWV+x1gxRN8ZN9LnrBSNgTEisY8LixjAR/9k9hbpfwWTdiISGm8LDXChfOEfL Au8+5JLzpdV8RkbhPoEqW/w2CCZKu1sdLixYeKfYCh8PbUnQOcLqQ4qByBBXVDD1Yulj ATyzNWUVRiUfAK/IoodvZFLsJmz61AslPlYZI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342313; x=1702947113; 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=/FQLSzIEljtj9qMhFQjt2/nf1M48P3DkoQUJaRn/gds=; b=EfZH44348LxaURXZwXhV4/Hx1QbK9linGLHMG44eSxM6YC1dKSbrKQTQRvPMFyTKaO 5XYEoaFgDxCpYC0+9e9N9zyCgHbKzq0f1fpstQ7Ip6bQrqDWiVwvkCv+AdidDdkQIE5q 79fFY7+m3WQ1zHrkvZlQCbmxvnkz6kNrsxZhda+gn1Fn/l0qy/JasM3+VDPs9d2Q81re TYxsn+1QgYQMKgB3alvSdCOXaneTOh1xfa5P6R5kMqI5fFzSLlz822DdPmj8ZpV8xWF+ mNxwQFUfOj9x+IjnbBRh6i1Ea6joLfdD+Aa779mjzrrqEpk5spNLGdtP+YE7uAiOml0j flnA== X-Gm-Message-State: AOJu0YzCJb6DpfDIOp2hLqOv7Qa2f2SCTeHbg8FBRk+6yMqwfYaNzRYM 2s4EoEimdyo1od43dnSuliHRqA== X-Google-Smtp-Source: AGHT+IF2ZB9iePLPYmeFIEQadMXffBZSqzyZJWP9CSnZOGyTlqau4Szhp9m48F6Cu8dgDKCZ14UlsA== X-Received: by 2002:a05:622a:30e:b0:425:9e14:3f1f with SMTP id q14-20020a05622a030e00b004259e143f1fmr7339755qtw.120.1702342313585; Mon, 11 Dec 2023 16:51:53 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.52 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:53 -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, Somnath Kotur Subject: [PATCH net-next 07/13] bnxt_en: Use proper TUNNEL_DST_PORT_ALLOC* commands Date: Mon, 11 Dec 2023 16:51:16 -0800 Message-Id: <20231212005122.2401-8-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 In bnxt_udp_tunnel_set_port(), use the proper ALLOC commands instead of the FREE commands for correctness. The ALLOC and FREE commands happen to be identical so this is just a cosmetic fix for correctness. Reviewed-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 42a52ee8c1bc..f2e8904de97f 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -13673,9 +13673,9 @@ static int bnxt_udp_tunnel_set_port(struct net_device *netdev, unsigned int tabl unsigned int cmd; if (ti->type == UDP_TUNNEL_TYPE_VXLAN) - cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN; + cmd = TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN; else - cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE; + cmd = TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE; return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti->port, cmd); } From patchwork Tue Dec 12 00:51:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488263 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="JOPrcZf0" Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 62726A6 for ; Mon, 11 Dec 2023 16:51:56 -0800 (PST) Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-42589694492so39940871cf.1 for ; Mon, 11 Dec 2023 16:51:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342315; x=1702947115; 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=SERu6RxsbEVFhDOFKQ6k8RPmhIGpfdfq8Cwt3oIkPZA=; b=JOPrcZf04h97MCxeNwNR1W2FdQYxI3yVDPzt+ittKMRYB94AWzF0DTbTZO9BH4iK/U W84xsIOcBtVjUzvKuA/uyXvGVreeQfPGHoQ4boByETNEQ7QWDf16mCstzDTKD8fxz/sm xTVIhuN+dBSmuOXQOlmwSejlofSa+wZcxuxms= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342315; x=1702947115; 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=SERu6RxsbEVFhDOFKQ6k8RPmhIGpfdfq8Cwt3oIkPZA=; b=YKEDm9zhtzXoo4/IjPHvnhsR8HVe9hI4e5ksNAq3iFHavXm8wqmU34QlKwLTvW9v1E zT+Y/Ef0jSXZlTleMPjV6PuQyJOLsTI+ohOZstjTcBbFd4xYgelrTY8JER+29fGMNXpd kx850nKKWDVe8a5M0BOTBXUQ2/PHtBkKXDq7t6GT6y3YfkEw5VG1xCELRCdmIlG99JXm +NuZgGLNS7whAa3FCD0aGjp9ylGvm7JTGaCrungCMOFl+lpyOOUQj0Roum2+h9yPPUR3 sNhMzVVVCWx2tqT6Dea0ogQqK/Ulfvsuz+GDAyDbrqju90oMgqL1Yazql70Axu1XdHxP U/sQ== X-Gm-Message-State: AOJu0YyGA7uKIuCPCisjigLJUJ529/W+Izj2W7+YBTeiuOV8qX5EUzwZ DfFVnn/TTAA6v5M4vtFG0vAWYg== X-Google-Smtp-Source: AGHT+IEqPcbY+X0FJiv+y/ozmmAGv2ksTG9MUqyI7eWQAfKu/fIRmigU9iVvxUsWBanTrassEHPGPQ== X-Received: by 2002:ac8:7f0c:0:b0:425:4043:5f0e with SMTP id f12-20020ac87f0c000000b0042540435f0emr6682465qtk.76.1702342315375; Mon, 11 Dec 2023 16:51:55 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.53 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:54 -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, Damodharam Ammepalli , Ajit Khaparde , Somnath Kotur Subject: [PATCH net-next 08/13] bnxt_en: Add support for VXLAN GPE Date: Mon, 11 Dec 2023 16:51:17 -0800 Message-Id: <20231212005122.2401-9-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 Add a new bnxt_udp_tunnels_p7 struct to support the new P7 chips that can parse VXLAN GPE packets. Add VXLAN GPE tunnel type handling to the .set_port() and .unset_port() functions. .ndo_features_check() is also enhanced to support VXLAN GPE which may encapsulate inner IP packets instead of ethernet packets. Reviewed-by: Damodharam Ammepalli Reviewed-by: Ajit Khaparde Reviewed-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 43 ++++++++++++++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 2 ++ 2 files changed, 40 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index f2e8904de97f..b9eb3e0c5995 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5179,6 +5179,11 @@ static int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, u8 tunnel_type) bp->nge_port = 0; bp->nge_fw_dst_port_id = INVALID_HW_RING_ID; break; + case TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN_GPE: + req->tunnel_dst_port_id = cpu_to_le16(bp->vxlan_gpe_fw_dst_port_id); + bp->vxlan_gpe_port = 0; + bp->vxlan_gpe_fw_dst_port_id = INVALID_HW_RING_ID; + break; default: break; } @@ -5222,6 +5227,11 @@ static int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, __be16 port, bp->nge_port = port; bp->nge_fw_dst_port_id = le16_to_cpu(resp->tunnel_dst_port_id); break; + case TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN_GPE: + bp->vxlan_gpe_port = port; + bp->vxlan_gpe_fw_dst_port_id = + le16_to_cpu(resp->tunnel_dst_port_id); + break; default: break; } @@ -12002,9 +12012,10 @@ static bool bnxt_udp_tunl_check(struct bnxt *bp, struct sk_buff *skb) struct udphdr *uh = udp_hdr(skb); __be16 udp_port = uh->dest; - if (udp_port != bp->vxlan_port && udp_port != bp->nge_port) + if (udp_port != bp->vxlan_port && udp_port != bp->nge_port && + udp_port != bp->vxlan_gpe_port) return false; - if (skb->inner_protocol_type == ENCAP_TYPE_ETHER) { + if (skb->inner_protocol == htons(ETH_P_TEB)) { struct ethhdr *eh = inner_eth_hdr(skb); switch (eh->h_proto) { @@ -12015,6 +12026,11 @@ static bool bnxt_udp_tunl_check(struct bnxt *bp, struct sk_buff *skb) skb_inner_network_offset(skb), NULL); } + } else if (skb->inner_protocol == htons(ETH_P_IP)) { + return true; + } else if (skb->inner_protocol == htons(ETH_P_IPV6)) { + return bnxt_exthdr_check(bp, skb, skb_inner_network_offset(skb), + NULL); } return false; } @@ -13674,8 +13690,10 @@ static int bnxt_udp_tunnel_set_port(struct net_device *netdev, unsigned int tabl if (ti->type == UDP_TUNNEL_TYPE_VXLAN) cmd = TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN; - else + else if (ti->type == UDP_TUNNEL_TYPE_GENEVE) cmd = TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_GENEVE; + else + cmd = TUNNEL_DST_PORT_ALLOC_REQ_TUNNEL_TYPE_VXLAN_GPE; return bnxt_hwrm_tunnel_dst_port_alloc(bp, ti->port, cmd); } @@ -13688,8 +13706,10 @@ static int bnxt_udp_tunnel_unset_port(struct net_device *netdev, unsigned int ta if (ti->type == UDP_TUNNEL_TYPE_VXLAN) cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN; - else + else if (ti->type == UDP_TUNNEL_TYPE_GENEVE) cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_GENEVE; + else + cmd = TUNNEL_DST_PORT_FREE_REQ_TUNNEL_TYPE_VXLAN_GPE; return bnxt_hwrm_tunnel_dst_port_free(bp, cmd); } @@ -13703,6 +13723,16 @@ static const struct udp_tunnel_nic_info bnxt_udp_tunnels = { { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, }, { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, }, }, +}, bnxt_udp_tunnels_p7 = { + .set_port = bnxt_udp_tunnel_set_port, + .unset_port = bnxt_udp_tunnel_unset_port, + .flags = UDP_TUNNEL_NIC_INFO_MAY_SLEEP | + UDP_TUNNEL_NIC_INFO_OPEN_ONLY, + .tables = { + { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN, }, + { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_GENEVE, }, + { .n_entries = 1, .tunnel_types = UDP_TUNNEL_TYPE_VXLAN_GPE, }, + }, }; static int bnxt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq, @@ -14298,7 +14328,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL; - dev->udp_tunnel_nic_info = &bnxt_udp_tunnels; + if (bp->flags & BNXT_FLAG_CHIP_P7) + dev->udp_tunnel_nic_info = &bnxt_udp_tunnels_p7; + else + dev->udp_tunnel_nic_info = &bnxt_udp_tunnels; dev->gso_partial_features = NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 67915ab13f50..609f4073f5ff 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2284,8 +2284,10 @@ struct bnxt { u16 vxlan_fw_dst_port_id; u16 nge_fw_dst_port_id; + u16 vxlan_gpe_fw_dst_port_id; __be16 vxlan_port; __be16 nge_port; + __be16 vxlan_gpe_port; u8 port_partition_type; u8 port_count; u16 br_mode; From patchwork Tue Dec 12 00:51:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488264 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="ZQN4RefR" Received: from mail-qt1-x829.google.com (mail-qt1-x829.google.com [IPv6:2607:f8b0:4864:20::829]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B56DC99 for ; Mon, 11 Dec 2023 16:51:57 -0800 (PST) Received: by mail-qt1-x829.google.com with SMTP id d75a77b69052e-425a3cdbda9so27442151cf.1 for ; Mon, 11 Dec 2023 16:51:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342317; x=1702947117; 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=wNk0zqQYBMzO6jSvmAkJ8DG3IL4S0aPTPP4piHNAOYQ=; b=ZQN4RefRch3+ZpKp3ms0c3Pc7dJdGc0I/aBc1GlnTNxvXW6FoVI66gqDaRJi5aNsuA fv4Lsy7yBr7aKrT4PVx4w9KwTO0SjjEIlcE3qIIciiQaSqOwiAKbvK4l0FHU6lOw01lo pq8riYV9R/I6rZLGkUXGDL+qG0pfPTlqjl7Qw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342317; x=1702947117; 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=wNk0zqQYBMzO6jSvmAkJ8DG3IL4S0aPTPP4piHNAOYQ=; b=YYBkqW0l52XocP6lCp/buEWR+srV8cltStkRljUp5IsOIIdjEPwSx+XQ1lB/Zq1NSS exFInyjgwYKH8nj7bxTkfn/AhqC5WOxwRG5fHKBalI+cvoUFe+2uXepPT66RwKygvKFI rwMt+dKMK2AjHgQiH1DwiDOmLL7fxp1ouVFrfQAbBZZ/NJ1XiHujZviMAd9oLB6pXDc5 DF3o55gLrVcsLmME0b+AuYUNHhxeSxtf4qZ17anqMAgVLpQLOlVMvEV170ZD6lHO8nms 6t5HePxRyTJdVvlydrc2sGvQTj+oy3vRjFXHF76shMNjQ/mb/nfxvUMhhoKQKdaYyI7I nGhg== X-Gm-Message-State: AOJu0Yzzbi7vNq1EQn67rEcg2ypWRxHdYonoj6Im0dP5q8AEBK7SMPRe YJSKIbBYwDw+LLH0lyoFkQN0W3w8gGfKKqY7tp0= X-Google-Smtp-Source: AGHT+IHu5a4Z6KgbPBnUGX65KBfcvkWJBI568YEMSfZYFeTSHiRZDJ+CBIVGZ9a9cTi6FH3sYFD7Yw== X-Received: by 2002:a05:622a:244:b0:425:4042:f45f with SMTP id c4-20020a05622a024400b004254042f45fmr7402952qtx.67.1702342316783; Mon, 11 Dec 2023 16:51:56 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.55 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:56 -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, Ajit Khaparde Subject: [PATCH net-next 09/13] bnxt_en: Configure UDP tunnel TPA Date: Mon, 11 Dec 2023 16:51:18 -0800 Message-Id: <20231212005122.2401-10-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 On the new P7 chips, TPA for tunnel packets can be independently enabled for each VNIC. The default TPA configuration should not include UDP tunnels because the UDP ports for these tunnels are not known yet. The chip should not aggregate these UDP tunneled packets using default UDP ports until the ports are known. Add a new function bnxt_hwrm_vnic_update_tunl_tpa() to enable VXLAN and Geneve TPA if the corresponding UDP ports are known. Reviewed-by: Ajit Khaparde Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 33 +++++++++++++++++++++++ drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 34 insertions(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index b9eb3e0c5995..3594290e187a 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -5150,6 +5150,8 @@ int bnxt_hwrm_func_drv_unrgtr(struct bnxt *bp) return hwrm_req_send(bp, req); } +static int bnxt_set_tpa(struct bnxt *bp, bool set_tpa); + static int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, u8 tunnel_type) { struct hwrm_tunnel_dst_port_free_input *req; @@ -5192,6 +5194,8 @@ static int bnxt_hwrm_tunnel_dst_port_free(struct bnxt *bp, u8 tunnel_type) if (rc) netdev_err(bp->dev, "hwrm_tunnel_dst_port_free failed. rc:%d\n", rc); + if (bp->flags & BNXT_FLAG_TPA) + bnxt_set_tpa(bp, true); return rc; } @@ -5235,6 +5239,8 @@ static int bnxt_hwrm_tunnel_dst_port_alloc(struct bnxt *bp, __be16 port, default: break; } + if (bp->flags & BNXT_FLAG_TPA) + bnxt_set_tpa(bp, true); err_out: hwrm_req_drop(bp, req); @@ -5427,6 +5433,30 @@ static int bnxt_hwrm_clear_vnic_filter(struct bnxt *bp) return rc; } +#define BNXT_DFLT_TUNL_TPA_BMAP \ + (VNIC_TPA_CFG_REQ_TNL_TPA_EN_BITMAP_GRE | \ + VNIC_TPA_CFG_REQ_TNL_TPA_EN_BITMAP_IPV4 | \ + VNIC_TPA_CFG_REQ_TNL_TPA_EN_BITMAP_IPV6) + +static void bnxt_hwrm_vnic_update_tunl_tpa(struct bnxt *bp, + struct hwrm_vnic_tpa_cfg_input *req) +{ + u32 tunl_tpa_bmap = BNXT_DFLT_TUNL_TPA_BMAP; + + if (!(bp->fw_cap & BNXT_FW_CAP_VNIC_TUNNEL_TPA)) + return; + + if (bp->vxlan_port) + tunl_tpa_bmap |= VNIC_TPA_CFG_REQ_TNL_TPA_EN_BITMAP_VXLAN; + if (bp->vxlan_gpe_port) + tunl_tpa_bmap |= VNIC_TPA_CFG_REQ_TNL_TPA_EN_BITMAP_VXLAN_GPE; + if (bp->nge_port) + tunl_tpa_bmap |= VNIC_TPA_CFG_REQ_TNL_TPA_EN_BITMAP_GENEVE; + + req->enables |= cpu_to_le32(VNIC_TPA_CFG_REQ_ENABLES_TNL_TPA_EN); + req->tnl_tpa_en_bitmap = cpu_to_le32(tunl_tpa_bmap); +} + static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags) { struct bnxt_vnic_info *vnic = &bp->vnic_info[vnic_id]; @@ -5483,6 +5513,7 @@ static int bnxt_hwrm_vnic_set_tpa(struct bnxt *bp, u16 vnic_id, u32 tpa_flags) req->max_aggs = cpu_to_le16(max_aggs); req->min_agg_len = cpu_to_le32(512); + bnxt_hwrm_vnic_update_tunl_tpa(bp, req); } req->vnic_id = cpu_to_le16(vnic->fw_vnic_id); @@ -5977,6 +6008,8 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp) else bp->hw_ring_stats_size = BNXT_RING_STATS_SIZE_P7; } + if (flags & VNIC_QCAPS_RESP_FLAGS_HW_TUNNEL_TPA_CAP) + bp->fw_cap |= BNXT_FW_CAP_VNIC_TUNNEL_TPA; } hwrm_req_drop(bp, req); return rc; diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 609f4073f5ff..15d33f4a61c2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2240,6 +2240,7 @@ struct bnxt { #define BNXT_FW_CAP_DFLT_VLAN_TPID_PCP BIT_ULL(34) #define BNXT_FW_CAP_PRE_RESV_VNICS BIT_ULL(35) #define BNXT_FW_CAP_BACKING_STORE_V2 BIT_ULL(36) + #define BNXT_FW_CAP_VNIC_TUNNEL_TPA BIT_ULL(37) u32 fw_dbg_cap; From patchwork Tue Dec 12 00:51:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488265 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="bCiRRHDC" Received: from mail-qk1-x732.google.com (mail-qk1-x732.google.com [IPv6:2607:f8b0:4864:20::732]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2FB4ABE for ; Mon, 11 Dec 2023 16:51:59 -0800 (PST) Received: by mail-qk1-x732.google.com with SMTP id af79cd13be357-77f35009e78so303632985a.1 for ; Mon, 11 Dec 2023 16:51:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342318; x=1702947118; 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=JJBMsv3FVn06uzjMtoqqWU5dW2ns332Qp8sF2/jzitk=; b=bCiRRHDC3UhEakEevsxzuLQ/1olQdIEgNMWzw4hBRwWcTcy3qisIjaHRL8TewdIAGk qdR+DfM7RQnc/vql3ynUSudVvAS4giqkyAAxWE2bIsR6RHwTq3YzoHIVrAPWYFN9b7fY CsAVHhHOaUZs1nxOsFe5LgIwOjzd4koCLJfvw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342318; x=1702947118; 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=JJBMsv3FVn06uzjMtoqqWU5dW2ns332Qp8sF2/jzitk=; b=NjGMhA60NKVwjSMZvTB9SEOQRRUkx3Mb/ISjM1FoihhBryqI/L9FE2CRwaiAV/Ife5 h2gLp3X1AgkATcvtB7vr8hSqqVLMK3ZgxwiOKLGL1g8JRsUvt06VfntDaMTPqQlGVOzD bFP2qTjRw7o5CUfG1mTsFwDYu0ZKXrgpj2PThF/HJjuBvPHRdob7dVVgg0zl3owOkIR6 2rc0XxushT+ePAN/sm8O5rrrziUYLYb3p28CE6JrN06WDnoZQOTZ668MrVgtxaVho+1I ghB7FOF6J9Vzaez6GTgn1p4xnezigOqYQnuxu0fgWu23489yeZ+16ncgMciog3VFp5no 80TA== X-Gm-Message-State: AOJu0YzSerI/qnQTaylx9wVTx1c4aQQox0anaf1VX8ttplsJB2Kvlf1e IMSWOyt84Bpk92tGHQnwE7G1Sg== X-Google-Smtp-Source: AGHT+IFDnqGeMTN31a9a/LwGsRbOn9ka7r1yPZMk/goWdNQLP/rSOsu7+zvMUkhRWtQm6Aj9ch51lw== X-Received: by 2002:ac8:58c6:0:b0:425:a72b:9a69 with SMTP id u6-20020ac858c6000000b00425a72b9a69mr7695260qta.20.1702342318240; Mon, 11 Dec 2023 16:51:58 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.56 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51:57 -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, Damodharam Ammepalli Subject: [PATCH net-next 10/13] bnxt_en: add rx_filter_miss extended stats Date: Mon, 11 Dec 2023 16:51:19 -0800 Message-Id: <20231212005122.2401-11-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 From: Damodharam Ammepalli rx_filter_miss counter is newly added to the rx_port_stats_ext stats structure for newer chips. Newer firmware will return the structure size that includes this counter. Add this entry to the bnxt_port_stats_ext_arr array and the ethtool -S code will pick up this counter if it is supported. Signed-off-by: Damodharam Ammepalli Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c index bb9cab821587..45ce7e2e3662 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ethtool.c @@ -461,6 +461,7 @@ static const struct { BNXT_RX_STATS_EXT_DISCARD_COS_ENTRIES, BNXT_RX_STATS_EXT_ENTRY(rx_fec_corrected_blocks), BNXT_RX_STATS_EXT_ENTRY(rx_fec_uncorrectable_blocks), + BNXT_RX_STATS_EXT_ENTRY(rx_filter_miss), }; static const struct { From patchwork Tue Dec 12 00:51:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488266 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="DhSa6EHH" Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9997299 for ; Mon, 11 Dec 2023 16:52:00 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-423d9d508d1so37925921cf.1 for ; Mon, 11 Dec 2023 16:52:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342320; x=1702947120; 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=Y31AXfseHY/Z2MxXIG+382UCPQ7kYpOYr14O/Eow5PY=; b=DhSa6EHH+hK3ilRr9ZLjs9Jks8wOWahu8JG2Icp8QN/soSDVVi8TItD4pHaboE6Jz1 U1EdUKXEInPMTDz7itiYEfi/hOv+ujF97WINi7M3ZAj3l45rm59rYGZb4andQqu8Bozi OSeFWaDsC0b4z1WRQ5T0k8R2BeOl99AaRH6t4= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342320; x=1702947120; 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=Y31AXfseHY/Z2MxXIG+382UCPQ7kYpOYr14O/Eow5PY=; b=e+w5cjKi5lWs2sctrqVMwgcCqcB97HahFMFad6pdf+brcp1+z7dIvIkQ7M6kHHvpJj g3GnmHZvVuALSStbNgJxnN6KRB2D31nKt7teSzuI7STGv+7sxPrP123dDgxdOXL7r2XK JW9LobQQQFU7Ek/sYB1ZbWrzju+36M+AgYNBs0kYTvk8rsP4ON9/uCWXlbKAKISwu39B glxWrTQgG0/BNNfMjlCP6fYIjKRG3hk1kj0bjr6uhZJwIuIb2dWArSW3eeGJgu4jp6fc IXwaIq8Sg6rjP/lO1pF2f+ovp7JcxFszz3r88W0D3vfHqjVVkSY0Qj7bLtbbJAS+m4CU fbFg== X-Gm-Message-State: AOJu0Yw81ymSwczctNPrbA2j2U0S4D2ZoGqZGdRJMz4BpLIjd5j+bufS ARLNMk7ZIcYVwJNUracbFd4g6QgYMlLgj73/d5k= X-Google-Smtp-Source: AGHT+IHZizINclv8TsAsCbL7yHI0AqJ4xn4Sq3UBdijdduq+wVjMBLrpL/NA9s9orxUk5cYjPYdCRA== X-Received: by 2002:ac8:4e92:0:b0:41e:ae5a:2b96 with SMTP id 18-20020ac84e92000000b0041eae5a2b96mr8488650qtp.13.1702342319647; Mon, 11 Dec 2023 16:51:59 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.58 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:51: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 , Somnath Kotur Subject: [PATCH net-next 11/13] bnxt_en: Add support for UDP GSO on 5760X chips Date: Mon, 11 Dec 2023 16:51:20 -0800 Message-Id: <20231212005122.2401-12-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 The new 5760X chips supports UDP GSO. Tested using udpgso_bench_tx. Reviewed-by: Andy Gospodarek Reviewed-by: Somnath Kotur Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt.c | 21 ++++++++++++++++++--- drivers/net/ethernet/broadcom/bnxt/bnxt.h | 1 + 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c index 3594290e187a..be3fa0545fdc 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c @@ -587,12 +587,21 @@ static netdev_tx_t bnxt_start_xmit(struct sk_buff *skb, struct net_device *dev) txbd1->tx_bd_hsize_lflags = lflags; if (skb_is_gso(skb)) { + bool udp_gso = !!(skb_shinfo(skb)->gso_type & SKB_GSO_UDP_L4); u32 hdr_len; - if (skb->encapsulation) - hdr_len = skb_inner_tcp_all_headers(skb); - else + if (skb->encapsulation) { + if (udp_gso) + hdr_len = skb_inner_transport_offset(skb) + + sizeof(struct udphdr); + else + hdr_len = skb_inner_tcp_all_headers(skb); + } else if (udp_gso) { + hdr_len = skb_transport_offset(skb) + + sizeof(struct udphdr); + } else { hdr_len = skb_tcp_all_headers(skb); + } txbd1->tx_bd_hsize_lflags |= cpu_to_le32(TX_BD_FLAGS_LSO | TX_BD_FLAGS_T_IPID | @@ -8345,6 +8354,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp) flags_ext2 = le32_to_cpu(resp->flags_ext2); if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_RX_ALL_PKTS_TIMESTAMPS_SUPPORTED) bp->fw_cap |= BNXT_FW_CAP_RX_ALL_PKT_TS; + if (flags_ext2 & FUNC_QCAPS_RESP_FLAGS_EXT2_UDP_GSO_SUPPORTED) + bp->flags |= BNXT_FLAG_UDP_GSO_CAP; bp->tx_push_thresh = 0; if ((flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED) && @@ -14351,6 +14362,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_PARTIAL | NETIF_F_RXHASH | NETIF_F_RXCSUM | NETIF_F_GRO; + if (bp->flags & BNXT_FLAG_UDP_GSO_CAP) + dev->hw_features |= NETIF_F_GSO_UDP_L4; if (BNXT_SUPPORTS_TPA(bp)) dev->hw_features |= NETIF_F_LRO; @@ -14361,6 +14374,8 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) NETIF_F_GSO_UDP_TUNNEL | NETIF_F_GSO_GRE | NETIF_F_GSO_UDP_TUNNEL_CSUM | NETIF_F_GSO_GRE_CSUM | NETIF_F_GSO_IPXIP4 | NETIF_F_GSO_PARTIAL; + if (bp->flags & BNXT_FLAG_UDP_GSO_CAP) + dev->hw_enc_features |= NETIF_F_GSO_UDP_L4; if (bp->flags & BNXT_FLAG_CHIP_P7) dev->udp_tunnel_nic_info = &bnxt_udp_tunnels_p7; else diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h index 15d33f4a61c2..1269463b9b04 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h @@ -2044,6 +2044,7 @@ struct bnxt { #define BNXT_FLAG_MULTI_HOST 0x100000 #define BNXT_FLAG_DSN_VALID 0x200000 #define BNXT_FLAG_DOUBLE_DB 0x400000 + #define BNXT_FLAG_UDP_GSO_CAP 0x800000 #define BNXT_FLAG_CHIP_NITRO_A0 0x1000000 #define BNXT_FLAG_DIM 0x2000000 #define BNXT_FLAG_ROCE_MIRROR_CAP 0x4000000 From patchwork Tue Dec 12 00:51:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488270 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="H3elgDAT" Received: from mail-qt1-x82a.google.com (mail-qt1-x82a.google.com [IPv6:2607:f8b0:4864:20::82a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BA72B3 for ; Mon, 11 Dec 2023 16:52:02 -0800 (PST) Received: by mail-qt1-x82a.google.com with SMTP id d75a77b69052e-4254223c150so37232761cf.1 for ; Mon, 11 Dec 2023 16:52:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342321; x=1702947121; 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=dd/pNLH0aZ4KKkS06SKGs/okNQiZTfx+tNh61rLozpI=; b=H3elgDATKtNi/6tXm60nHEwKva31RL44+4kW7ox9/P1VM3+00sCoCHgmbgyZDePlVf sURJ4tRTfCGr4gJcSzDm3yV4O9V+UhUlbjJNgGzrTIcAWGP2fP6g6Ijr0myT4PEBCa32 TYm+IGQ14r/6R/bRRVbx08DrNmkbpRpQ3YxFs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342321; x=1702947121; 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=dd/pNLH0aZ4KKkS06SKGs/okNQiZTfx+tNh61rLozpI=; b=D4be9yd4hRDBgpOYEjC+EFui4E/FPgN3Qs82IgdANkvogRGX7nQPlqjnewul831AIg al1tokfWatjVh0Ztxxcc7vR9AONeKBPRdXUIUzzRgRJSpYB5rp4NoWjdoZgbXUvdpMCC 3V6+7A0T/dJbmcdfwl9VcRLcBjxkb2nxaqw+kKT7Yjb7g+p2WtIIuiEFgJ13BQbqTd2K TnRHntABfpb0qLA66FkTHmrotYmz76UFOk0fA9qduTVCn2YZ0NtZ+XQSaV4P9S4zmiw7 cdtGqdVIabMEVh6VP6Vc6TljGb7VBl28qEq/VN+HsGCfFTAjTKsbwCnMfO7t2aX7JjgE yOaQ== X-Gm-Message-State: AOJu0YwRKlPEDw/PSOFNQjt1nFT6NBQib04e8ez8I7f3EUO/h3Z51pMU Bf6tiKQJLypS3kJ5RNC0PvGleQ== X-Google-Smtp-Source: AGHT+IGzO81o/G4pqxO+8y1SYU2OvZcsu3MwtpOShvjmistG8G//kV1NeZH6KSgglcFvmobntJCoSA== X-Received: by 2002:ac8:7e88:0:b0:425:4043:50e1 with SMTP id w8-20020ac87e88000000b00425404350e1mr8025266qtj.112.1702342321100; Mon, 11 Dec 2023 16:52:01 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.51.59 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:52:00 -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, Pavan Chebbi , Andy Gospodarek Subject: [PATCH net-next 12/13] bnxt_en: Skip nic close/open when configuring tstamp filters Date: Mon, 11 Dec 2023 16:51:21 -0800 Message-Id: <20231212005122.2401-13-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 From: Pavan Chebbi We don't have to close and open the nic to make sure we have valid rx timestamps. Once we have the timestamp filter applied to the HW and the timestamp_fld_format bit is cleared in the rx completion and the timestamp is non-zero, we can be sure that rx timestamp is valid data. Skip close/open when we set any timestamp filter. Reviewed-by: Andy Gospodarek Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 29 +++++++------------ drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h | 2 +- 2 files changed, 11 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index a1ec39b46518..3d1c36d384c2 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -319,15 +319,17 @@ static int bnxt_ptp_cfg_event(struct bnxt *bp, u8 event) return hwrm_req_send(bp, req); } -void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp) +int bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp) { struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; struct hwrm_port_mac_cfg_input *req; + int rc; if (!ptp || !ptp->tstamp_filters) - return; + return -EIO; - if (hwrm_req_init(bp, req, HWRM_PORT_MAC_CFG)) + rc = hwrm_req_init(bp, req, HWRM_PORT_MAC_CFG); + if (rc) goto out; if (!(bp->fw_cap & BNXT_FW_CAP_RX_ALL_PKT_TS) && (ptp->tstamp_filters & @@ -342,15 +344,17 @@ void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp) req->enables = cpu_to_le32(PORT_MAC_CFG_REQ_ENABLES_RX_TS_CAPTURE_PTP_MSG_TYPE); req->rx_ts_capture_ptp_msg_type = cpu_to_le16(ptp->rxctl); - if (!hwrm_req_send(bp, req)) { + rc = hwrm_req_send(bp, req); + if (!rc) { bp->ptp_all_rx_tstamp = !!(ptp->tstamp_filters & PORT_MAC_CFG_REQ_FLAGS_ALL_RX_TS_CAPTURE_ENABLE); - return; + return 0; } ptp->tstamp_filters = 0; out: bp->ptp_all_rx_tstamp = 0; netdev_warn(bp->dev, "Failed to configure HW packet timestamp filters\n"); + return rc; } void bnxt_ptp_reapply_pps(struct bnxt *bp) @@ -494,7 +498,6 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp) { struct bnxt_ptp_cfg *ptp = bp->ptp_cfg; u32 flags = 0; - int rc = 0; switch (ptp->rx_filter) { case HWTSTAMP_FILTER_ALL: @@ -519,19 +522,7 @@ static int bnxt_hwrm_ptp_cfg(struct bnxt *bp) ptp->tstamp_filters = flags; - if (netif_running(bp->dev)) { - if (ptp->rx_filter == HWTSTAMP_FILTER_ALL) { - rc = bnxt_close_nic(bp, false, false); - if (!rc) - rc = bnxt_open_nic(bp, false, false); - } else { - bnxt_ptp_cfg_tstamp_filters(bp); - } - if (!rc && !ptp->tstamp_filters) - rc = -EIO; - } - - return rc; + return bnxt_ptp_cfg_tstamp_filters(bp); } int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h index 34162e07a119..fce8dc39a7d0 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h @@ -137,7 +137,7 @@ do { \ int bnxt_ptp_parse(struct sk_buff *skb, u16 *seq_id, u16 *hdr_off); void bnxt_ptp_update_current_time(struct bnxt *bp); void bnxt_ptp_pps_event(struct bnxt *bp, u32 data1, u32 data2); -void bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp); +int bnxt_ptp_cfg_tstamp_filters(struct bnxt *bp); void bnxt_ptp_reapply_pps(struct bnxt *bp); int bnxt_hwtstamp_set(struct net_device *dev, struct ifreq *ifr); int bnxt_hwtstamp_get(struct net_device *dev, struct ifreq *ifr); From patchwork Tue Dec 12 00:51:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Chan X-Patchwork-Id: 13488271 X-Patchwork-Delegate: kuba@kernel.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="b/vjbFu5" Received: from mail-qt1-x834.google.com (mail-qt1-x834.google.com [IPv6:2607:f8b0:4864:20::834]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6D41BB8 for ; Mon, 11 Dec 2023 16:52:03 -0800 (PST) Received: by mail-qt1-x834.google.com with SMTP id d75a77b69052e-425952708afso35202771cf.0 for ; Mon, 11 Dec 2023 16:52:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; t=1702342322; x=1702947122; 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=A03aN42yKFJNYwriH9O+9ACFYNFi/+3xamR20lCO7dY=; b=b/vjbFu5wnP1ORM7H95U6vzssS3jMclBBEGVHwqA6aqqc/7XDnVBEO1CMSUwBJJQdH XuOCWD9yoock5ffTO9G7wR16rFsS+eFwiE888gP+LOALgxUe6AS5kATByj5lcN2mN5on yyug29x/0dtlMPasKs8HYPhzpwrZj4wWwBULc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1702342322; x=1702947122; 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=A03aN42yKFJNYwriH9O+9ACFYNFi/+3xamR20lCO7dY=; b=iw9xukUeJMDOI1mcmAP0z/UZtdcT5KQvS3CD3LDmZIpe/O31j81qnTBiJH1+lx4FZf RQr7qGQtygeNzy1tUlVA10Veq7LjV1fpIsZvKvO7ri0lnK05rvBIDW2nVKCv5suWqYde xI3/4c5+LphHTLNvxtrfEScHAWgu4RkuWW5SuJF8ybX1rKzVzvJCScsJmSvhYMO00DpW 3dUxeFjShgWCS1St1ItBIsODOc4VdAutG4LcHRcniF7VmiZCcVID1I4ItGQS987xkmwy dqSHZyHQbJzPVOKfbFgim2dTyaoFKpDbhqUkD04G2rJ8d/BuBj/sbEo3vqE6TgBqnfxS g9Ew== X-Gm-Message-State: AOJu0YynTNJvN4nI9bpYoG3OotG3CWWx3KhxEh+n0lJfORLuH6FNnE48 xW/g0C1TQOPgxvxrJZaKN3qC5Q== X-Google-Smtp-Source: AGHT+IHkpwJzBtGVoOJaX4wvS0TUxxu9z0V6oXqRg3Sb7WV311XiFGP/nAL/nQfnlESZK2cw6bGZ/g== X-Received: by 2002:ac8:5dce:0:b0:425:4042:f45c with SMTP id e14-20020ac85dce000000b004254042f45cmr7615400qtx.64.1702342322504; Mon, 11 Dec 2023 16:52:02 -0800 (PST) Received: from lvnvda5233.lvn.broadcom.net ([192.19.161.250]) by smtp.gmail.com with ESMTPSA id r5-20020ac87945000000b00423ea1b31b3sm3619664qtt.66.2023.12.11.16.52.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 11 Dec 2023 16:52:02 -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, Pavan Chebbi Subject: [PATCH net-next 13/13] bnxt_en: Make PTP TX timestamp HWRM query silent Date: Mon, 11 Dec 2023 16:51:22 -0800 Message-Id: <20231212005122.2401-14-michael.chan@broadcom.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20231212005122.2401-1-michael.chan@broadcom.com> References: <20231212005122.2401-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 From: Pavan Chebbi In a busy network, especially with flow control enabled, we may experience timestamp query failures fairly regularly. After a while, dmesg may be flooded with timestamp query failure error messages. Silence the error message from the low level hwrm function that sends the firmware message. Change netdev_err() to netdev_WARN_ONCE() if this FW call ever fails. Signed-off-by: Pavan Chebbi Signed-off-by: Michael Chan --- drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c index 3d1c36d384c2..adad188e38b8 100644 --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c @@ -129,7 +129,7 @@ static int bnxt_hwrm_port_ts_query(struct bnxt *bp, u32 flags, u64 *ts) } resp = hwrm_req_hold(bp, req); - rc = hwrm_req_send(bp, req); + rc = hwrm_req_send_silent(bp, req); if (!rc) *ts = le64_to_cpu(resp->ptp_msg_ts); hwrm_req_drop(bp, req); @@ -684,8 +684,8 @@ static void bnxt_stamp_tx_skb(struct bnxt *bp, struct sk_buff *skb) timestamp.hwtstamp = ns_to_ktime(ns); skb_tstamp_tx(ptp->tx_skb, ×tamp); } else { - netdev_err(bp->dev, "TS query for TX timer failed rc = %x\n", - rc); + netdev_WARN_ONCE(bp->dev, + "TS query for TX timer failed rc = %x\n", rc); } dev_kfree_skb_any(ptp->tx_skb);