From: Joe Perches <joe@perches.com>
To: Jeff Kirsher <jeffrey.t.kirsher@intel.com>
Cc: davem@davemloft.net, Shannon Nelson <shannon.nelson@intel.com>,
netdev@vger.kernel.org
Subject: [PATCH net-next] i40e: Reduce stack in i40e_dbg_dump_desc
Date: Sun, 16 Nov 2014 14:12:48 -0800 [thread overview]
Message-ID: <1416175968.24600.1.camel@perches.com> (raw)
In-Reply-To: <5467C3BA.6090003@gmail.com>
Reduce stack use by using kmemdup and not using a very
large struct on stack.
In function ‘i40e_dbg_dump_desc’:
warning: the frame size of 8192 bytes is larger than 2048 bytes [-Wframe-larger-than=]
Signed-off-by: Joe Perches <joe@perches.com>
---
drivers/net/ethernet/intel/i40e/i40e_debugfs.c | 30 +++++++++++++++-----------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
index a03f459..232783d 100644
--- a/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
+++ b/drivers/net/ethernet/intel/i40e/i40e_debugfs.c
@@ -773,7 +773,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
{
struct i40e_tx_desc *txd;
union i40e_rx_desc *rxd;
- struct i40e_ring ring;
+ struct i40e_ring *ring;
struct i40e_vsi *vsi;
int i;
@@ -792,29 +792,32 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
vsi_seid);
return;
}
- if (is_rx_ring)
- ring = *vsi->rx_rings[ring_id];
- else
- ring = *vsi->tx_rings[ring_id];
+
+ ring = kmemdup(is_rx_ring
+ ? vsi->rx_rings[ring_id] : vsi->tx_rings[ring_id],
+ sizeof(*ring), GFP_KERNEL);
+ if (!ring)
+ return;
+
if (cnt == 2) {
dev_info(&pf->pdev->dev, "vsi = %02i %s ring = %02i\n",
vsi_seid, is_rx_ring ? "rx" : "tx", ring_id);
- for (i = 0; i < ring.count; i++) {
+ for (i = 0; i < ring->count; i++) {
if (!is_rx_ring) {
- txd = I40E_TX_DESC(&ring, i);
+ txd = I40E_TX_DESC(ring, i);
dev_info(&pf->pdev->dev,
" d[%03i] = 0x%016llx 0x%016llx\n",
i, txd->buffer_addr,
txd->cmd_type_offset_bsz);
} else if (sizeof(union i40e_rx_desc) ==
sizeof(union i40e_16byte_rx_desc)) {
- rxd = I40E_RX_DESC(&ring, i);
+ rxd = I40E_RX_DESC(ring, i);
dev_info(&pf->pdev->dev,
" d[%03i] = 0x%016llx 0x%016llx\n",
i, rxd->read.pkt_addr,
rxd->read.hdr_addr);
} else {
- rxd = I40E_RX_DESC(&ring, i);
+ rxd = I40E_RX_DESC(ring, i);
dev_info(&pf->pdev->dev,
" d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
i, rxd->read.pkt_addr,
@@ -823,26 +826,26 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
}
}
} else if (cnt == 3) {
- if (desc_n >= ring.count || desc_n < 0) {
+ if (desc_n >= ring->count || desc_n < 0) {
dev_info(&pf->pdev->dev,
"descriptor %d not found\n", desc_n);
return;
}
if (!is_rx_ring) {
- txd = I40E_TX_DESC(&ring, desc_n);
+ txd = I40E_TX_DESC(ring, desc_n);
dev_info(&pf->pdev->dev,
"vsi = %02i tx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
vsi_seid, ring_id, desc_n,
txd->buffer_addr, txd->cmd_type_offset_bsz);
} else if (sizeof(union i40e_rx_desc) ==
sizeof(union i40e_16byte_rx_desc)) {
- rxd = I40E_RX_DESC(&ring, desc_n);
+ rxd = I40E_RX_DESC(ring, desc_n);
dev_info(&pf->pdev->dev,
"vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx\n",
vsi_seid, ring_id, desc_n,
rxd->read.pkt_addr, rxd->read.hdr_addr);
} else {
- rxd = I40E_RX_DESC(&ring, desc_n);
+ rxd = I40E_RX_DESC(ring, desc_n);
dev_info(&pf->pdev->dev,
"vsi = %02i rx ring = %02i d[%03i] = 0x%016llx 0x%016llx 0x%016llx 0x%016llx\n",
vsi_seid, ring_id, desc_n,
@@ -852,6 +855,7 @@ static void i40e_dbg_dump_desc(int cnt, int vsi_seid, int ring_id, int desc_n,
} else {
dev_info(&pf->pdev->dev, "dump desc rx/tx <vsi_seid> <ring_id> [<desc_n>]\n");
}
+ kfree(ring);
}
/**
next prev parent reply other threads:[~2014-11-16 22:12 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-15 6:08 [net-next 00/12][pull request] Intel Wired LAN Driver Updates 2014-11-14 Jeff Kirsher
2014-11-15 6:08 ` [net-next 01/12] i40e: only warn once of PTP nonsupport in 100Mbit speed Jeff Kirsher
2014-11-15 21:20 ` Florian Fainelli
2014-11-15 22:38 ` [PATCH net-next] device: Add dev_<level>_once variants Joe Perches
2014-11-16 20:49 ` David Miller
2014-11-16 22:21 ` [PATCH net-next] netdevice: Neaten includes and forward declarations Joe Perches
2014-11-18 20:48 ` David Miller
2014-11-18 21:09 ` Joe Perches
2014-11-18 21:21 ` David Miller
2014-11-16 22:12 ` Joe Perches [this message]
2014-11-17 21:06 ` [PATCH net-next] i40e: Reduce stack in i40e_dbg_dump_desc David Miller
2014-11-17 21:30 ` Jeff Kirsher
2014-11-18 2:18 ` [PATCH (sent originally to netdev)] device: Add dev_<level>_once variants Joe Perches
2014-11-18 2:23 ` Jeff Kirsher
2014-11-15 6:08 ` [net-next 02/12] i40e: re-enable VFLR interrupt sooner Jeff Kirsher
2014-11-15 6:08 ` [net-next 03/12] i40e: Handle a single mss packet with more than 8 frags Jeff Kirsher
2014-11-15 18:21 ` Eric Dumazet
2014-11-17 14:15 ` David Laight
2014-11-17 14:31 ` Eric Dumazet
2014-11-17 14:40 ` David Laight
2014-11-17 14:55 ` Eric Dumazet
2014-11-17 16:04 ` Nelson, Shannon
2014-11-17 16:16 ` David Laight
2014-11-17 16:52 ` Eric Dumazet
2014-11-17 16:58 ` Eric Dumazet
2014-11-17 17:09 ` Eric Dumazet
2014-11-18 9:46 ` David Laight
2014-11-18 14:33 ` Eric Dumazet
2014-11-17 16:45 ` Eric Dumazet
2014-11-15 6:08 ` [net-next 04/12] i40e: Bump version to 1.1.23 Jeff Kirsher
2014-11-15 6:08 ` [net-next 05/12] i40e: Resume Port Tx after DCB event Jeff Kirsher
2014-11-15 6:08 ` [net-next 06/12] i40e: Add support to firmware CEE DCBX mode Jeff Kirsher
2014-11-15 6:08 ` [net-next 07/12] i40e: Check for LLDP AdminStatus before querying DCBX Jeff Kirsher
2014-11-15 6:08 ` [net-next 08/12] i40e: Update VEB's enabled_tc after reconfiguration Jeff Kirsher
2014-11-15 6:08 ` [net-next 09/12] i40e: Modify Tx disable wait flow in case of DCB reconfiguration Jeff Kirsher
2014-11-15 6:08 ` [net-next 10/12] i40e: Do not disable/enable FCoE VSI with DCB reconfig Jeff Kirsher
2014-11-15 6:08 ` [net-next 11/12] i40e: Prevent link flow control settings when PFC is enabled Jeff Kirsher
2014-11-15 6:08 ` [net-next 12/12] i40e: Set XPS bit mask to zero in DCB mode Jeff Kirsher
2014-11-16 20:04 ` [net-next 00/12][pull request] Intel Wired LAN Driver Updates 2014-11-14 David Miller
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=1416175968.24600.1.camel@perches.com \
--to=joe@perches.com \
--cc=davem@davemloft.net \
--cc=jeffrey.t.kirsher@intel.com \
--cc=netdev@vger.kernel.org \
--cc=shannon.nelson@intel.com \
/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).