public inbox for netdev@vger.kernel.org 
 help / color / mirror / Atom feed
From: Michael Chan <michael.chan@broadcom•com>
To: davem@davemloft•net
Cc: netdev@vger•kernel.org
Subject: [PATCH net-next 07/11] bnxt_en: Reduce default rings on multi-port cards.
Date: Mon, 28 Aug 2017 13:40:31 -0400	[thread overview]
Message-ID: <1503942035-24924-8-git-send-email-michael.chan@broadcom.com> (raw)
In-Reply-To: <1503942035-24924-1-git-send-email-michael.chan@broadcom.com>

Reduce default rings from 8 to 4 on multi-port cards to reduce memory
usage.

Signed-off-by: Michael Chan <michael.chan@broadcom•com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c | 13 +++++++++----
 drivers/net/ethernet/broadcom/bnxt/bnxt.h |  1 +
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index a34fcdd..4406f91 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -5795,6 +5795,8 @@ static int bnxt_hwrm_phy_qcaps(struct bnxt *bp)
 		link_info->support_auto_speeds =
 			le16_to_cpu(resp->supported_speeds_auto_mode);
 
+	bp->port_count = resp->port_cnt;
+
 hwrm_phy_qcaps_exit:
 	mutex_unlock(&bp->hwrm_cmd_lock);
 	return rc;
@@ -7877,6 +7879,9 @@ static int bnxt_set_dflt_rings(struct bnxt *bp, bool sh)
 	if (sh)
 		bp->flags |= BNXT_FLAG_SHARED_RINGS;
 	dflt_rings = netif_get_num_default_rss_queues();
+	/* Reduce default rings to reduce memory usage on multi-port cards */
+	if (bp->port_count > 1)
+		dflt_rings = min_t(int, dflt_rings, 4);
 	rc = bnxt_get_dflt_rings(bp, &max_rx_rings, &max_tx_rings, sh);
 	if (rc)
 		return rc;
@@ -8049,6 +8054,10 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	bnxt_ethtool_init(bp);
 	bnxt_dcb_init(bp);
 
+	rc = bnxt_probe_phy(bp);
+	if (rc)
+		goto init_err_pci_clean;
+
 	bnxt_set_rx_skb_mode(bp, false);
 	bnxt_set_tpa_flags(bp);
 	bnxt_set_ring_params(bp);
@@ -8083,10 +8092,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	if (dev->hw_features & NETIF_F_HW_VLAN_CTAG_RX)
 		bp->flags |= BNXT_FLAG_STRIP_VLAN;
 
-	rc = bnxt_probe_phy(bp);
-	if (rc)
-		goto init_err_pci_clean;
-
 	rc = bnxt_init_int_mode(bp);
 	if (rc)
 		goto init_err_pci_clean;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 3521e46..86af8ea 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -1207,6 +1207,7 @@ struct bnxt {
 	u8			nge_port_cnt;
 	__le16			nge_fw_dst_port_id;
 	u8			port_partition_type;
+	u8			port_count;
 	u16			br_mode;
 
 	u16			rx_coal_ticks;
-- 
1.8.3.1

  parent reply	other threads:[~2017-08-28 17:40 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-28 17:40 [PATCH net-next 00/11] bnxt_en: Updates Michael Chan
2017-08-28 17:40 ` [PATCH net-next 01/11] bnxt_en: Update firmware interface spec. to 1.8.1.4 Michael Chan
2017-08-28 17:40 ` [PATCH net-next 02/11] bnxt_en: Improve tx ring reservation logic Michael Chan
2017-08-28 17:40 ` [PATCH net-next 03/11] bnxt_en: assign CPU affinity hints to bnxt_en IRQs Michael Chan
2017-08-28 17:40 ` [PATCH net-next 04/11] bnxt: Add PCIe device IDs for bcm58802/bcm58808 Michael Chan
2017-08-28 17:40 ` [PATCH net-next 05/11] bnxt: initialize board_info values with proper enums Michael Chan
2017-08-28 17:40 ` [PATCH net-next 06/11] bnxt_en: Improve -ENOMEM logic in NAPI poll loop Michael Chan
2017-08-28 19:05   ` Martin KaFai Lau
2017-08-28 17:40 ` Michael Chan [this message]
2017-08-28 17:40 ` [PATCH net-next 08/11] bnxt_en: fix clearing devlink ptr from bnxt struct Michael Chan
2017-08-28 17:40 ` [PATCH net-next 09/11] bnxt_en: bnxt: add TC flower filter offload support Michael Chan
2017-09-11 13:36   ` Jiri Pirko
     [not found]     ` <CAKvpyk1iV4z_f7cUA8DL1nU772hPtiZC4MtjA9t=S5J=8EcD-A@mail.gmail.com>
2017-09-18  9:52       ` Jiri Pirko
2017-08-28 17:40 ` [PATCH net-next 10/11] bnxt_en: add TC flower offload flow_alloc/free FW cmds Michael Chan
2017-08-28 17:40 ` [PATCH net-next 11/11] bnxt_en: add code to query TC flower offload stats Michael Chan
2017-08-28 23:57 ` [PATCH net-next 00/11] bnxt_en: Updates 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=1503942035-24924-8-git-send-email-michael.chan@broadcom.com \
    --to=michael.chan@broadcom$(echo .)com \
    --cc=davem@davemloft$(echo .)net \
    --cc=netdev@vger$(echo .)kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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