From: Sasha Levin <sashal@kernel.org>
To: linux-kernel@vger.kernel.org, stable@vger.kernel.org
Cc: Jakub Kicinski <jakub.kicinski@netronome.com>,
Dirk van der Merwe <dirk.vandermerwe@netronome.com>,
"David S . Miller" <davem@davemloft.net>,
Sasha Levin <sashal@kernel.org>,
oss-drivers@netronome.com, netdev@vger.kernel.org
Subject: [PATCH AUTOSEL 4.14 026/109] nfp: provide a better warning when ring allocation fails
Date: Sat, 9 Nov 2019 21:44:18 -0500 [thread overview]
Message-ID: <20191110024541.31567-26-sashal@kernel.org> (raw)
In-Reply-To: <20191110024541.31567-1-sashal@kernel.org>
From: Jakub Kicinski <jakub.kicinski@netronome.com>
[ Upstream commit 23d9f5531c7c28546954b0bf332134a9b8a38c0a ]
NFP supports fairly enormous ring sizes (up to 256k descriptors).
In commit 466271703867 ("nfp: use kvcalloc() to allocate SW buffer
descriptor arrays") we have started using kvcalloc() functions to
make sure the allocation of software state arrays doesn't hit
the MAX_ORDER limit. Unfortunately, we can't use virtual mappings
for the DMA region holding HW descriptors. In case this allocation
fails instead of the generic (and fairly scary) warning/splat in
the logs print a helpful message explaining what happened and
suggesting how to fix it.
Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Dirk van der Merwe <dirk.vandermerwe@netronome.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
.../net/ethernet/netronome/nfp/nfp_net_common.c | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 6df2c8b2ce6f3..bffa25d6dc294 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -2169,9 +2169,13 @@ nfp_net_tx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_tx_ring *tx_ring)
tx_ring->size = sizeof(*tx_ring->txds) * tx_ring->cnt;
tx_ring->txds = dma_zalloc_coherent(dp->dev, tx_ring->size,
- &tx_ring->dma, GFP_KERNEL);
- if (!tx_ring->txds)
+ &tx_ring->dma,
+ GFP_KERNEL | __GFP_NOWARN);
+ if (!tx_ring->txds) {
+ netdev_warn(dp->netdev, "failed to allocate TX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n",
+ tx_ring->cnt);
goto err_alloc;
+ }
sz = sizeof(*tx_ring->txbufs) * tx_ring->cnt;
tx_ring->txbufs = kzalloc(sz, GFP_KERNEL);
@@ -2314,9 +2318,13 @@ nfp_net_rx_ring_alloc(struct nfp_net_dp *dp, struct nfp_net_rx_ring *rx_ring)
rx_ring->cnt = dp->rxd_cnt;
rx_ring->size = sizeof(*rx_ring->rxds) * rx_ring->cnt;
rx_ring->rxds = dma_zalloc_coherent(dp->dev, rx_ring->size,
- &rx_ring->dma, GFP_KERNEL);
- if (!rx_ring->rxds)
+ &rx_ring->dma,
+ GFP_KERNEL | __GFP_NOWARN);
+ if (!rx_ring->rxds) {
+ netdev_warn(dp->netdev, "failed to allocate RX descriptor ring memory, requested descriptor count: %d, consider lowering descriptor count\n",
+ rx_ring->cnt);
goto err_alloc;
+ }
sz = sizeof(*rx_ring->rxbufs) * rx_ring->cnt;
rx_ring->rxbufs = kzalloc(sz, GFP_KERNEL);
--
2.20.1
next prev parent reply other threads:[~2019-11-10 2:46 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20191110024541.31567-1-sashal@kernel.org>
2019-11-10 2:43 ` [PATCH AUTOSEL 4.14 006/109] samples/bpf: fix a compilation failure Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 009/109] net: hns3: fix return type of ndo_start_xmit function Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 019/109] net: toshiba: " Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 020/109] net: xilinx: " Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 021/109] net: broadcom: " Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 022/109] net: amd: " Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 023/109] net: sun: " Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 024/109] net: hns3: Fix for setting speed for phy failed problem Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 025/109] net: hns3: Fix parameter type for q_id in hclge_tm_q_to_qs_map_cfg() Sasha Levin
2019-11-10 2:44 ` Sasha Levin [this message]
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 029/109] mlxsw: spectrum: Init shaper for TCs 8..15 Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 041/109] bnx2x: Ignore bandwidth attention in single function mode Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 042/109] samples/bpf: fix compilation failure Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 043/109] net: phy: mdio-bcm-unimac: Allow configuring MDIO clock divider Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 044/109] net: micrel: fix return type of ndo_start_xmit function Sasha Levin
2019-11-10 2:44 ` [PATCH AUTOSEL 4.14 045/109] net: freescale: " Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 076/109] net: smsc: " Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 077/109] net: faraday: " Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 084/109] Bluetooth: L2CAP: Detect if remote is not able to use the whole MPS Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 088/109] iwlwifi: dbg: don't crash if the firmware crashes in the middle of a debug dump Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 089/109] iwlwifi: api: annotate compressed BA notif array sizes Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 090/109] iwlwifi: mvm: Allow TKIP for AP mode Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 105/109] netfilter: masquerade: don't flush all conntracks if only one address deleted on device Sasha Levin
2019-11-10 2:45 ` [PATCH AUTOSEL 4.14 109/109] net: phy: mdio-bcm-unimac: mark PM functions as __maybe_unused Sasha Levin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191110024541.31567-26-sashal@kernel.org \
--to=sashal@kernel.org \
--cc=davem@davemloft.net \
--cc=dirk.vandermerwe@netronome.com \
--cc=jakub.kicinski@netronome.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=oss-drivers@netronome.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).