linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Madalin Bucur <madalin.bucur@nxp.com>
To: <netdev@vger.kernel.org>
Cc: <linuxppc-dev@lists.ozlabs.org>, <linux-kernel@vger.kernel.org>,
	<davem@davemloft.net>, <oss@buserror.net>, <ppc@mindchasers.com>,
	<joe@perches.com>, <pebolle@tiscali.nl>,
	<joakim.tjernlund@transmode.se>
Subject: [PATCH net-next v6 03/10] dpaa_eth: add option to use one buffer pool set
Date: Wed, 2 Nov 2016 22:17:27 +0200	[thread overview]
Message-ID: <1478117854-8952-4-git-send-email-madalin.bucur@nxp.com> (raw)
In-Reply-To: <1478117854-8952-1-git-send-email-madalin.bucur@nxp.com>

Signed-off-by: Madalin Bucur <madalin.bucur@nxp.com>
---
 drivers/net/ethernet/freescale/dpaa/Kconfig    |  6 ++++++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c | 23 +++++++++++++++++++++++
 2 files changed, 29 insertions(+)

diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig
index 670e039..308fc21 100644
--- a/drivers/net/ethernet/freescale/dpaa/Kconfig
+++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
@@ -18,4 +18,10 @@ config FSL_DPAA_ETH_FRIENDLY_IF_NAME
 	  The DPAA Ethernet netdevices are created for each FMan port available
 	  on a certain board. Enable this to get interface names derived from
 	  the underlying FMan hardware for a simple identification.
+config FSL_DPAA_ETH_COMMON_BPOOL
+	bool "Use a common buffer pool set for all the interfaces"
+	---help---
+	  The DPAA Ethernet netdevices require buffer pools for storing the buffers
+	  used by the FMan hardware for reception. One can use a single buffer pool
+	  set for all interfaces or a dedicated buffer pool set for each interface.
 endif # FSL_DPAA_ETH
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 55e89b7..5e8c3df 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -158,6 +158,11 @@ struct fm_port_fqs {
 	struct dpaa_fq *rx_errq;
 };
 
+#ifdef CONFIG_FSL_DPAA_ETH_COMMON_BPOOL
+/* These bpools are shared by all the dpaa interfaces */
+static u8 dpaa_common_bpids[DPAA_BPS_NUM];
+#endif
+
 /* All the dpa bps in use at any moment */
 static struct dpaa_bp *dpaa_bp_array[BM_MAX_NUM_OF_POOLS];
 
@@ -2527,6 +2532,12 @@ static int dpaa_eth_probe(struct platform_device *pdev)
 	for (i = 0; i < DPAA_BPS_NUM; i++) {
 		int err;
 
+#ifdef CONFIG_FSL_DPAA_ETH_COMMON_BPOOL
+		/* if another interface probed the bps reuse those */
+		dpaa_bps[i] = (dpaa_common_bpids[i] != FSL_DPAA_BPID_INV) ?
+				dpaa_bpid2pool(dpaa_common_bpids[i]) : NULL;
+		if (!dpaa_bps[i]) {
+#endif
 		dpaa_bps[i] = dpaa_bp_alloc(dev);
 		if (IS_ERR(dpaa_bps[i]))
 			return PTR_ERR(dpaa_bps[i]);
@@ -2542,6 +2553,11 @@ static int dpaa_eth_probe(struct platform_device *pdev)
 			priv->dpaa_bps[i] = NULL;
 			goto bp_create_failed;
 		}
+#ifdef CONFIG_FSL_DPAA_ETH_COMMON_BPOOL
+		}
+		dpaa_common_bpids[i] = dpaa_bps[i]->bpid;
+		dpaa_bps[i] = (dpaa_bpid2pool(dpaa_common_bpids[i]));
+#endif
 		priv->dpaa_bps[i] = dpaa_bps[i];
 	}
 
@@ -2716,6 +2732,13 @@ static int __init dpaa_load(void)
 	dpaa_rx_extra_headroom = fman_get_rx_extra_headroom();
 	dpaa_max_frm = fman_get_max_frm();
 
+#ifdef CONFIG_FSL_DPAA_ETH_COMMON_BPOOL
+	/* set initial invalid values, first interface probe will set correct
+	 * values that will be shared by the other interfaces
+	 */
+	memset(dpaa_common_bpids, FSL_DPAA_BPID_INV, sizeof(dpaa_common_bpids));
+#endif
+
 	err = platform_driver_register(&dpaa_driver);
 	if (err < 0)
 		pr_err("Error, platform_driver_register() = %d\n", err);
-- 
2.1.0

  parent reply	other threads:[~2016-11-02 20:33 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-11-02 20:17 [PATCH net-next v6 00/10] dpaa_eth: Add the QorIQ DPAA Ethernet driver Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 01/10] devres: add devm_alloc_percpu() Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet Madalin Bucur
2016-11-03 19:58   ` David Miller
2016-11-04  6:53     ` Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) Joe Perches
2016-11-04 11:01       ` Lino Sanfilippo
2016-11-04 15:07         ` Coding Style: Reverse XMAS tree declarations ? David Miller
2016-11-04 17:44           ` Joe Perches
2016-11-04 20:06             ` Lino Sanfilippo
2016-11-07 11:00               ` David Laight
2016-11-04 17:05       ` Coding Style: Reverse XMAS tree declarations ? (was Re: [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet) Randy Dunlap
2016-11-04 19:48         ` David VomLehn
2016-11-07  8:05       ` Michael Ellerman
2016-11-07 15:43     ` [PATCH net-next v6 02/10] dpaa_eth: add support for DPAA Ethernet Madalin-Cristian Bucur
2016-11-07 15:55       ` David Miller
2016-11-07 16:32         ` Madalin-Cristian Bucur
2016-11-07 16:39           ` David Miller
2016-11-07 16:59             ` Madalin-Cristian Bucur
2016-11-09 17:16     ` Madalin-Cristian Bucur
2016-11-09 17:18       ` David Miller
2016-11-07 16:25   ` Joakim Tjernlund
2016-11-02 20:17 ` Madalin Bucur [this message]
2016-11-02 20:17 ` [PATCH net-next v6 04/10] dpaa_eth: add ethtool functionality Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 05/10] dpaa_eth: add ethtool statistics Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 06/10] dpaa_eth: add sysfs exports Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 07/10] dpaa_eth: add trace points Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 08/10] arch/powerpc: Enable FSL_PAMU Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 09/10] arch/powerpc: Enable FSL_FMAN Madalin Bucur
2016-11-02 20:17 ` [PATCH net-next v6 10/10] arch/powerpc: Enable dpaa_eth Madalin Bucur

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=1478117854-8952-4-git-send-email-madalin.bucur@nxp.com \
    --to=madalin.bucur@nxp.com \
    --cc=davem@davemloft.net \
    --cc=joakim.tjernlund@transmode.se \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=netdev@vger.kernel.org \
    --cc=oss@buserror.net \
    --cc=pebolle@tiscali.nl \
    --cc=ppc@mindchasers.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).