All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next v2 0/5] net: mvpp2: various improvements
@ 2017-12-11  8:13 Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 1/5] net: mvpp2: only free the TSO header buffers when it was allocated Antoine Tenart
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-12-11  8:13 UTC (permalink / raw
  To: davem
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, ymarkman, netdev, linux-kernel

Hi all,

These patches are sent as a series to avoid any possible conflict, even
though there're not entirely related. I can send them separately if
needed. The series applies on today's net-next tree.

Thanks!
Antoine

Since v1:
  - Removed the patch disabling TSO on allocation errors.

Antoine Tenart (4):
  net: mvpp2: only free the TSO header buffers when it was allocated
  net: mvpp2: align values in ethtool get_coalesce
  net: mvpp2: report the tx-usec coalescing information to ethtool
  net: mvpp2: adjust the coalescing parameters

Yan Markman (1):
  net: mvpp2: split the max ring size from the default one

 drivers/net/ethernet/marvell/mvpp2.c | 47 +++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 20 deletions(-)

-- 
2.14.3

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH net-next v2 1/5] net: mvpp2: only free the TSO header buffers when it was allocated
  2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
@ 2017-12-11  8:13 ` Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 2/5] net: mvpp2: split the max ring size from the default one Antoine Tenart
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-12-11  8:13 UTC (permalink / raw
  To: davem
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, ymarkman, netdev, linux-kernel

This patch adds a check to only free the TSO header buffer when its
allocation previously succeeded.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 12 ++++++++----
 1 file changed, 8 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 634b2f41cc9e..f203f0857596 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -5802,6 +5802,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 		txq_pcpu->reserved_num = 0;
 		txq_pcpu->txq_put_index = 0;
 		txq_pcpu->txq_get_index = 0;
+		txq_pcpu->tso_headers = NULL;
 
 		txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS;
 		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2;
@@ -5829,10 +5830,13 @@ static void mvpp2_txq_deinit(struct mvpp2_port *port,
 		txq_pcpu = per_cpu_ptr(txq->pcpu, cpu);
 		kfree(txq_pcpu->buffs);
 
-		dma_free_coherent(port->dev->dev.parent,
-				  txq_pcpu->size * TSO_HEADER_SIZE,
-				  txq_pcpu->tso_headers,
-				  txq_pcpu->tso_headers_dma);
+		if (txq_pcpu->tso_headers)
+			dma_free_coherent(port->dev->dev.parent,
+					  txq_pcpu->size * TSO_HEADER_SIZE,
+					  txq_pcpu->tso_headers,
+					  txq_pcpu->tso_headers_dma);
+
+		txq_pcpu->tso_headers = NULL;
 	}
 
 	if (txq->descs)
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next v2 2/5] net: mvpp2: split the max ring size from the default one
  2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 1/5] net: mvpp2: only free the TSO header buffers when it was allocated Antoine Tenart
@ 2017-12-11  8:13 ` Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 3/5] net: mvpp2: align values in ethtool get_coalesce Antoine Tenart
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-12-11  8:13 UTC (permalink / raw
  To: davem
  Cc: Yan Markman, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, netdev, linux-kernel, Antoine Tenart

From: Yan Markman <ymarkman@marvell.com>

The Rx/Tx ring sizes can be adjusted thanks to ethtool given specific
network needs. This commit splits the default ring size from its max
value to allow ethtool to vary the parameters in both ways.

Signed-off-by: Yan Markman <ymarkman@marvell.com>
[Antoine: commit message]
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 24 +++++++++++++-----------
 1 file changed, 13 insertions(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index f203f0857596..5e88403d2132 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -504,10 +504,12 @@
 #define MVPP2_DEFAULT_RXQ		4
 
 /* Max number of Rx descriptors */
-#define MVPP2_MAX_RXD			128
+#define MVPP2_MAX_RXD_MAX		1024
+#define MVPP2_MAX_RXD_DFLT		128
 
 /* Max number of Tx descriptors */
-#define MVPP2_MAX_TXD			1024
+#define MVPP2_MAX_TXD_MAX		2048
+#define MVPP2_MAX_TXD_DFLT		1024
 
 /* Amount of Tx descriptors that can be reserved at once by CPU */
 #define MVPP2_CPU_DESC_CHUNK		64
@@ -6836,13 +6838,13 @@ static int mvpp2_check_ringparam_valid(struct net_device *dev,
 	if (ring->rx_pending == 0 || ring->tx_pending == 0)
 		return -EINVAL;
 
-	if (ring->rx_pending > MVPP2_MAX_RXD)
-		new_rx_pending = MVPP2_MAX_RXD;
+	if (ring->rx_pending > MVPP2_MAX_RXD_MAX)
+		new_rx_pending = MVPP2_MAX_RXD_MAX;
 	else if (!IS_ALIGNED(ring->rx_pending, 16))
 		new_rx_pending = ALIGN(ring->rx_pending, 16);
 
-	if (ring->tx_pending > MVPP2_MAX_TXD)
-		new_tx_pending = MVPP2_MAX_TXD;
+	if (ring->tx_pending > MVPP2_MAX_TXD_MAX)
+		new_tx_pending = MVPP2_MAX_TXD_MAX;
 	else if (!IS_ALIGNED(ring->tx_pending, 32))
 		new_tx_pending = ALIGN(ring->tx_pending, 32);
 
@@ -7344,8 +7346,8 @@ static void mvpp2_ethtool_get_ringparam(struct net_device *dev,
 {
 	struct mvpp2_port *port = netdev_priv(dev);
 
-	ring->rx_max_pending = MVPP2_MAX_RXD;
-	ring->tx_max_pending = MVPP2_MAX_TXD;
+	ring->rx_max_pending = MVPP2_MAX_RXD_MAX;
+	ring->tx_max_pending = MVPP2_MAX_TXD_MAX;
 	ring->rx_pending = port->rx_ring_size;
 	ring->tx_pending = port->tx_ring_size;
 }
@@ -7792,7 +7794,7 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 		goto err_free_netdev;
 	}
 
-	dev->tx_queue_len = MVPP2_MAX_TXD;
+	dev->tx_queue_len = MVPP2_MAX_TXD_MAX;
 	dev->watchdog_timeo = 5 * HZ;
 	dev->netdev_ops = &mvpp2_netdev_ops;
 	dev->ethtool_ops = &mvpp2_eth_tool_ops;
@@ -7875,8 +7877,8 @@ static int mvpp2_port_probe(struct platform_device *pdev,
 
 	mvpp2_port_copy_mac_addr(dev, priv, port_node, &mac_from);
 
-	port->tx_ring_size = MVPP2_MAX_TXD;
-	port->rx_ring_size = MVPP2_MAX_RXD;
+	port->tx_ring_size = MVPP2_MAX_TXD_DFLT;
+	port->rx_ring_size = MVPP2_MAX_RXD_DFLT;
 	SET_NETDEV_DEV(dev, &pdev->dev);
 
 	err = mvpp2_port_init(port);
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next v2 3/5] net: mvpp2: align values in ethtool get_coalesce
  2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 1/5] net: mvpp2: only free the TSO header buffers when it was allocated Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 2/5] net: mvpp2: split the max ring size from the default one Antoine Tenart
@ 2017-12-11  8:13 ` Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 4/5] net: mvpp2: report the tx-usec coalescing information to ethtool Antoine Tenart
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-12-11  8:13 UTC (permalink / raw
  To: davem
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, ymarkman, netdev, linux-kernel

Cosmetic patch aligning values in the ethtool get_coalesce function.
This patch do not modify in anyway the driver's behaviour.

Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 5e88403d2132..5c16731ee292 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7324,9 +7324,9 @@ static int mvpp2_ethtool_get_coalesce(struct net_device *dev,
 {
 	struct mvpp2_port *port = netdev_priv(dev);
 
-	c->rx_coalesce_usecs        = port->rxqs[0]->time_coal;
-	c->rx_max_coalesced_frames  = port->rxqs[0]->pkts_coal;
-	c->tx_max_coalesced_frames =  port->txqs[0]->done_pkts_coal;
+	c->rx_coalesce_usecs       = port->rxqs[0]->time_coal;
+	c->rx_max_coalesced_frames = port->rxqs[0]->pkts_coal;
+	c->tx_max_coalesced_frames = port->txqs[0]->done_pkts_coal;
 	return 0;
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next v2 4/5] net: mvpp2: report the tx-usec coalescing information to ethtool
  2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
                   ` (2 preceding siblings ...)
  2017-12-11  8:13 ` [PATCH net-next v2 3/5] net: mvpp2: align values in ethtool get_coalesce Antoine Tenart
@ 2017-12-11  8:13 ` Antoine Tenart
  2017-12-11  8:13 ` [PATCH net-next v2 5/5] net: mvpp2: adjust the coalescing parameters Antoine Tenart
  2017-12-13 16:17 ` [PATCH net-next v2 0/5] net: mvpp2: various improvements David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-12-11  8:13 UTC (permalink / raw
  To: davem
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, ymarkman, netdev, linux-kernel

This patch adds the tx-usec value to the informations reported to
ethtool by the get_coalesce function.

Suggested-by: Yan Markman <ymarkman@marvell.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 5c16731ee292..aa72109290c3 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7327,6 +7327,7 @@ static int mvpp2_ethtool_get_coalesce(struct net_device *dev,
 	c->rx_coalesce_usecs       = port->rxqs[0]->time_coal;
 	c->rx_max_coalesced_frames = port->rxqs[0]->pkts_coal;
 	c->tx_max_coalesced_frames = port->txqs[0]->done_pkts_coal;
+	c->tx_coalesce_usecs       = port->tx_time_coal;
 	return 0;
 }
 
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH net-next v2 5/5] net: mvpp2: adjust the coalescing parameters
  2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
                   ` (3 preceding siblings ...)
  2017-12-11  8:13 ` [PATCH net-next v2 4/5] net: mvpp2: report the tx-usec coalescing information to ethtool Antoine Tenart
@ 2017-12-11  8:13 ` Antoine Tenart
  2017-12-13 16:17 ` [PATCH net-next v2 0/5] net: mvpp2: various improvements David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: Antoine Tenart @ 2017-12-11  8:13 UTC (permalink / raw
  To: davem
  Cc: Antoine Tenart, gregory.clement, thomas.petazzoni, miquel.raynal,
	nadavh, mw, stefanc, ymarkman, netdev, linux-kernel

This patch adjust the coalescing parameters to the vendor
recommendations for the PPv2 network controller.

Suggested-by: Yan Markman <ymarkman@marvell.com>
Signed-off-by: Antoine Tenart <antoine.tenart@free-electrons.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index aa72109290c3..a19760736b71 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -454,11 +454,11 @@
 /* Various constants */
 
 /* Coalescing */
-#define MVPP2_TXDONE_COAL_PKTS_THRESH	15
+#define MVPP2_TXDONE_COAL_PKTS_THRESH	64
 #define MVPP2_TXDONE_HRTIMER_PERIOD_NS	1000000UL
 #define MVPP2_TXDONE_COAL_USEC		1000
 #define MVPP2_RX_COAL_PKTS		32
-#define MVPP2_RX_COAL_USEC		100
+#define MVPP2_RX_COAL_USEC		64
 
 /* The two bytes Marvell header. Either contains a special value used
  * by Marvell switches when a specific hardware mode is enabled (not
-- 
2.14.3

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH net-next v2 0/5] net: mvpp2: various improvements
  2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
                   ` (4 preceding siblings ...)
  2017-12-11  8:13 ` [PATCH net-next v2 5/5] net: mvpp2: adjust the coalescing parameters Antoine Tenart
@ 2017-12-13 16:17 ` David Miller
  5 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2017-12-13 16:17 UTC (permalink / raw
  To: antoine.tenart
  Cc: gregory.clement, thomas.petazzoni, miquel.raynal, nadavh, mw,
	stefanc, ymarkman, netdev, linux-kernel

From: Antoine Tenart <antoine.tenart@free-electrons.com>
Date: Mon, 11 Dec 2017 09:13:24 +0100

> These patches are sent as a series to avoid any possible conflict, even
> though there're not entirely related. I can send them separately if
> needed. The series applies on today's net-next tree.
 ...
> Since v1:
>   - Removed the patch disabling TSO on allocation errors.

Series applied.

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-12-13 16:17 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-11  8:13 [PATCH net-next v2 0/5] net: mvpp2: various improvements Antoine Tenart
2017-12-11  8:13 ` [PATCH net-next v2 1/5] net: mvpp2: only free the TSO header buffers when it was allocated Antoine Tenart
2017-12-11  8:13 ` [PATCH net-next v2 2/5] net: mvpp2: split the max ring size from the default one Antoine Tenart
2017-12-11  8:13 ` [PATCH net-next v2 3/5] net: mvpp2: align values in ethtool get_coalesce Antoine Tenart
2017-12-11  8:13 ` [PATCH net-next v2 4/5] net: mvpp2: report the tx-usec coalescing information to ethtool Antoine Tenart
2017-12-11  8:13 ` [PATCH net-next v2 5/5] net: mvpp2: adjust the coalescing parameters Antoine Tenart
2017-12-13 16:17 ` [PATCH net-next v2 0/5] net: mvpp2: various improvements David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.