diff mbox

[03/10] dpaa_eth: add configurable bpool thresholds

Message ID 1437581806-17420-3-git-send-email-madalin.bucur@freescale.com (mailing list archive)
State Not Applicable
Delegated to: Scott Wood
Headers show

Commit Message

Madalin Bucur July 22, 2015, 4:16 p.m. UTC
Allow the user to tweak the refill threshold and the total number
of buffers in the buffer pool. The provided values are for one CPU.

Signed-off-by: Madalin Bucur <madalin.bucur@freescale.com>
---
 drivers/net/ethernet/freescale/dpaa/Kconfig       | 18 ++++++++++++++++++
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.c    |  2 +-
 drivers/net/ethernet/freescale/dpaa/dpaa_eth.h    |  3 ---
 drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c |  6 +++---
 4 files changed, 22 insertions(+), 7 deletions(-)

Comments

Joe Perches July 22, 2015, 5:47 p.m. UTC | #1
On Wed, 2015-07-22 at 19:16 +0300, Madalin Bucur wrote:
> Allow the user to tweak the refill threshold and the total number
> of buffers in the buffer pool. The provided values are for one CPU.

Any value in making these module parameters instead?

> +config FSL_DPAA_ETH_MAX_BUF_COUNT
> +	int "Maximum number of buffers in private bpool"
> +	range 64 2048
> +	default "128"
> +	---help---
> +	  The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's
> +	  buffer pool. One needn't normally modify this, as it has probably been tuned for performance
> +	  already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD.
> +
> +config FSL_DPAA_ETH_REFILL_THRESHOLD
> +	int "Private bpool refill threshold"
> +	range 32 FSL_DPAA_ETH_MAX_BUF_COUNT
> +	default "80"
> +	---help---
> +	  The DPAA-Ethernet driver will start replenishing buffer pools whose count
> +	  falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally
> +	  modify this value unless one has very specific performance reasons.
> +
>  config FSL_DPAA_CS_THRESHOLD_1G
>  	hex "Egress congestion threshold on 1G ports"
>  	range 0x1000 0x10000000
Madalin Bucur July 24, 2015, 3:49 p.m. UTC | #2
> -----Original Message-----
> From: Joe Perches [mailto:joe@perches.com]
> On Wed, 2015-07-22 at 19:16 +0300, Madalin Bucur wrote:
> > Allow the user to tweak the refill threshold and the total number
> > of buffers in the buffer pool. The provided values are for one CPU.
> 
> Any value in making these module parameters instead?

I expect one would (hardly ever) change these to improve some corner
cases then use them with the new values. It may help in the tuning process
but afterwards the bloat to the bootcmd would probably be  a nuisance.

> > +config FSL_DPAA_ETH_MAX_BUF_COUNT
> > +	int "Maximum number of buffers in private bpool"
> > +	range 64 2048
> > +	default "128"
> > +	---help---
> > +	  The maximum number of buffers to be by default allocated in the
> DPAA-Ethernet private port's
> > +	  buffer pool. One needn't normally modify this, as it has probably
> been tuned for performance
> > +	  already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD.
> > +
> > +config FSL_DPAA_ETH_REFILL_THRESHOLD
> > +	int "Private bpool refill threshold"
> > +	range 32 FSL_DPAA_ETH_MAX_BUF_COUNT
> > +	default "80"
> > +	---help---
> > +	  The DPAA-Ethernet driver will start replenishing buffer pools whose
> count
> > +	  falls below this threshold. This must be related to
> DPAA_ETH_MAX_BUF_COUNT. One needn't normally
> > +	  modify this value unless one has very specific performance reasons.
> > +
> >  config FSL_DPAA_CS_THRESHOLD_1G
> >  	hex "Egress congestion threshold on 1G ports"
> >  	range 0x1000 0x10000000
> 
>
David Miller July 26, 2015, 11:35 p.m. UTC | #3
From: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
Date: Fri, 24 Jul 2015 15:49:39 +0000

>> -----Original Message-----
>> From: Joe Perches [mailto:joe@perches.com]
>> On Wed, 2015-07-22 at 19:16 +0300, Madalin Bucur wrote:
>> > Allow the user to tweak the refill threshold and the total number
>> > of buffers in the buffer pool. The provided values are for one CPU.
>> 
>> Any value in making these module parameters instead?
> 
> I expect one would (hardly ever) change these to improve some corner
> cases then use them with the new values. It may help in the tuning process
> but afterwards the bloat to the bootcmd would probably be  a nuisance.

I think these should be controlled by the existing ethtool infrastructure.

Neither the Kconfig mechanism nor module parameters are appropriate, at all.
Madalin Bucur July 27, 2015, 12:54 p.m. UTC | #4
> -----Original Message-----
> From: David Miller [mailto:davem@davemloft.net]
> Sent: Monday, July 27, 2015 2:35 AM
> To: Bucur Madalin-Cristian-B32716
> Cc: joe@perches.com; netdev@vger.kernel.org; linuxppc-
> dev@lists.ozlabs.org; linux-kernel@vger.kernel.org; Wood Scott-B07421;
> Liberman Igal-B31950; ppc@mindchasers.com; pebolle@tiscali.nl;
> joakim.tjernlund@transmode.se
> Subject: Re: [PATCH 03/10] dpaa_eth: add configurable bpool thresholds
> 
> From: Madalin-Cristian Bucur <madalin.bucur@freescale.com>
> Date: Fri, 24 Jul 2015 15:49:39 +0000
> 
> >> -----Original Message-----
> >> From: Joe Perches [mailto:joe@perches.com]
> >> On Wed, 2015-07-22 at 19:16 +0300, Madalin Bucur wrote:
> >> > Allow the user to tweak the refill threshold and the total number
> >> > of buffers in the buffer pool. The provided values are for one CPU.
> >>
> >> Any value in making these module parameters instead?
> >
> > I expect one would (hardly ever) change these to improve some corner
> > cases then use them with the new values. It may help in the tuning process
> > but afterwards the bloat to the bootcmd would probably be  a nuisance.
> 
> I think these should be controlled by the existing ethtool infrastructure.
> 
> Neither the Kconfig mechanism nor module parameters are appropriate, at
> all.

The existing ethtool options are for ring based drivers (ethtool -g / -G).
I would not use those as we are not using rings (they do not map well anyway).

We could introduce special options for our non-ring devices but for these
parameters in particular I'd just resort to defines in the code as it's
improbable one would want to change them.

Madalin
diff mbox

Patch

diff --git a/drivers/net/ethernet/freescale/dpaa/Kconfig b/drivers/net/ethernet/freescale/dpaa/Kconfig
index 1f3a203..9e6a39f 100644
--- a/drivers/net/ethernet/freescale/dpaa/Kconfig
+++ b/drivers/net/ethernet/freescale/dpaa/Kconfig
@@ -11,6 +11,24 @@  menuconfig FSL_DPAA_ETH
 
 if FSL_DPAA_ETH
 
+config FSL_DPAA_ETH_MAX_BUF_COUNT
+	int "Maximum number of buffers in private bpool"
+	range 64 2048
+	default "128"
+	---help---
+	  The maximum number of buffers to be by default allocated in the DPAA-Ethernet private port's
+	  buffer pool. One needn't normally modify this, as it has probably been tuned for performance
+	  already. This cannot be lower than DPAA_ETH_REFILL_THRESHOLD.
+
+config FSL_DPAA_ETH_REFILL_THRESHOLD
+	int "Private bpool refill threshold"
+	range 32 FSL_DPAA_ETH_MAX_BUF_COUNT
+	default "80"
+	---help---
+	  The DPAA-Ethernet driver will start replenishing buffer pools whose count
+	  falls below this threshold. This must be related to DPAA_ETH_MAX_BUF_COUNT. One needn't normally
+	  modify this value unless one has very specific performance reasons.
+
 config FSL_DPAA_CS_THRESHOLD_1G
 	hex "Egress congestion threshold on 1G ports"
 	range 0x1000 0x10000000
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
index 500d0e3..fc2071e 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.c
@@ -475,7 +475,7 @@  dpa_priv_bp_probe(struct device *dev)
 		return ERR_PTR(-ENOMEM);
 
 	dpa_bp->percpu_count = devm_alloc_percpu(dev, *dpa_bp->percpu_count);
-	dpa_bp->target_count = FSL_DPAA_ETH_MAX_BUF_COUNT;
+	dpa_bp->target_count = CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT;
 
 	dpa_bp->seed_cb = dpa_bp_priv_seed;
 	dpa_bp->free_buf_cb = _dpa_bp_free_pf;
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
index 08c1b01..fc6c5dc 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth.h
@@ -126,9 +126,6 @@  struct dpa_buffer_layout_s {
 
 #define DPAA_ETH_RX_QUEUES	128
 
-#define FSL_DPAA_ETH_MAX_BUF_COUNT	128
-#define FSL_DPAA_ETH_REFILL_THRESHOLD	80
-
 /* More detailed FQ types - used for fine-grained WQ assignments */
 enum dpa_fq_type {
 	FQ_TYPE_RX_DEFAULT = 1, /* Rx Default FQs */
diff --git a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
index b865d2a..d781219 100644
--- a/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
+++ b/drivers/net/ethernet/freescale/dpaa/dpaa_eth_sg.c
@@ -151,7 +151,7 @@  int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *countptr)
 	int count = *countptr;
 	int new_bufs;
 
-	if (unlikely(count < FSL_DPAA_ETH_REFILL_THRESHOLD)) {
+	if (unlikely(count < CONFIG_FSL_DPAA_ETH_REFILL_THRESHOLD)) {
 		do {
 			new_bufs = _dpa_bp_add_8_bufs(dpa_bp);
 			if (unlikely(!new_bufs)) {
@@ -162,10 +162,10 @@  int dpaa_eth_refill_bpools(struct dpa_bp *dpa_bp, int *countptr)
 				break;
 			}
 			count += new_bufs;
-		} while (count < FSL_DPAA_ETH_MAX_BUF_COUNT);
+		} while (count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT);
 
 		*countptr = count;
-		if (unlikely(count < FSL_DPAA_ETH_MAX_BUF_COUNT))
+		if (unlikely(count < CONFIG_FSL_DPAA_ETH_MAX_BUF_COUNT))
 			return -ENOMEM;
 	}