[PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice

Subsystems: networking drivers, the rest

STALE3096d

6 messages, 3 authors, 2018-02-27 · open the first message on its own page

[PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice

From: Antoine Tenart <hidden>
Date: 2018-02-26 14:15:21

From: Yan Markman <redacted>

Avoid repeating the check for free aggregated descriptors when it
already failed at the beginning of the function.

Signed-off-by: Yan Markman <redacted>
[Antoine: commit message]
Signed-off-by: Antoine Tenart <redacted>
---
 drivers/net/ethernet/marvell/mvpp2.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 5a1668cdb461..55300b1fe6c0 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -5224,11 +5224,10 @@ static int mvpp2_aggr_desc_num_check(struct mvpp2 *priv,
 		u32 val = mvpp2_read(priv, MVPP2_AGGR_TXQ_STATUS_REG(cpu));
 
 		aggr_txq->count = val & MVPP2_AGGR_TXQ_PENDING_MASK;
-	}
-
-	if ((aggr_txq->count + num) > MVPP2_AGGR_TXQ_SIZE)
-		return -ENOMEM;
 
+		if ((aggr_txq->count + num) > MVPP2_AGGR_TXQ_SIZE)
+			return -ENOMEM;
+	}
 	return 0;
 }
 
-- 
2.14.3

[PATCH net-next 3/3] net: mvpp2: align the ethtool ops definition

From: Antoine Tenart <hidden>
Date: 2018-02-26 14:15:25

Cosmetic patch to align the ethtool functions to ops definitions. This
patch does not change in any way the driver's behaviour.

Signed-off-by: Antoine Tenart <redacted>
---
 drivers/net/ethernet/marvell/mvpp2.c | 24 ++++++++++++------------
 1 file changed, 12 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 1a893ef70eab..babbb1ceba2a 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7435,18 +7435,18 @@ static const struct net_device_ops mvpp2_netdev_ops = {
 };
 
 static const struct ethtool_ops mvpp2_eth_tool_ops = {
-	.nway_reset	= phy_ethtool_nway_reset,
-	.get_link	= ethtool_op_get_link,
-	.set_coalesce	= mvpp2_ethtool_set_coalesce,
-	.get_coalesce	= mvpp2_ethtool_get_coalesce,
-	.get_drvinfo	= mvpp2_ethtool_get_drvinfo,
-	.get_ringparam	= mvpp2_ethtool_get_ringparam,
-	.set_ringparam	= mvpp2_ethtool_set_ringparam,
-	.get_strings	= mvpp2_ethtool_get_strings,
-	.get_ethtool_stats = mvpp2_ethtool_get_stats,
-	.get_sset_count	= mvpp2_ethtool_get_sset_count,
-	.get_link_ksettings = phy_ethtool_get_link_ksettings,
-	.set_link_ksettings = phy_ethtool_set_link_ksettings,
+	.nway_reset		= phy_ethtool_nway_reset,
+	.get_link		= ethtool_op_get_link,
+	.set_coalesce		= mvpp2_ethtool_set_coalesce,
+	.get_coalesce		= mvpp2_ethtool_get_coalesce,
+	.get_drvinfo		= mvpp2_ethtool_get_drvinfo,
+	.get_ringparam		= mvpp2_ethtool_get_ringparam,
+	.set_ringparam		= mvpp2_ethtool_set_ringparam,
+	.get_strings		= mvpp2_ethtool_get_strings,
+	.get_ethtool_stats	= mvpp2_ethtool_get_stats,
+	.get_sset_count		= mvpp2_ethtool_get_sset_count,
+	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
+	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
 };
 
 /* Used for PPv2.1, or PPv2.2 with the old Device Tree binding that
-- 
2.14.3

[PATCH net-next 2/3] net: mvpp2: adjust gso stop wake thresholds

From: Antoine Tenart <hidden>
Date: 2018-02-26 14:15:28

From: Yan Markman <redacted>

Adjust MVPP2_MAX_TSO_SEGS and stop_threshold/wake_threshold
for better TXQ utilization and performance.

Signed-off-by: Yan Markman <redacted>
---
 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 55300b1fe6c0..1a893ef70eab 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -498,7 +498,7 @@
  * skb. As we need a maxium of two descriptors per fragments (1 header, 1 data),
  * multiply this value by two to count the maximum number of skb descs needed.
  */
-#define MVPP2_MAX_TSO_SEGS		300
+#define MVPP2_MAX_TSO_SEGS		100
 #define MVPP2_MAX_SKB_DESCS		(MVPP2_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
 
 /* Dfault number of RXQs in use */
@@ -5810,7 +5810,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 		txq_pcpu->tso_headers = NULL;
 
 		txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS;
-		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2;
+		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold - 100;
 
 		txq_pcpu->tso_headers =
 			dma_alloc_coherent(port->dev->dev.parent,
-- 
2.14.3

Re: [PATCH net-next 2/3] net: mvpp2: adjust gso stop wake thresholds

From: David Miller <davem@davemloft.net>
Date: 2018-02-27 16:13:12

From: Antoine Tenart <redacted>
Date: Mon, 26 Feb 2018 15:14:26 +0100
quoted hunk
From: Yan Markman <redacted>

Adjust MVPP2_MAX_TSO_SEGS and stop_threshold/wake_threshold
for better TXQ utilization and performance.

Signed-off-by: Yan Markman <redacted>
---
 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 55300b1fe6c0..1a893ef70eab 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -498,7 +498,7 @@
  * skb. As we need a maxium of two descriptors per fragments (1 header, 1 data),
  * multiply this value by two to count the maximum number of skb descs needed.
  */
-#define MVPP2_MAX_TSO_SEGS		300
+#define MVPP2_MAX_TSO_SEGS		100
 #define MVPP2_MAX_SKB_DESCS		(MVPP2_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
 
 /* Dfault number of RXQs in use */
@@ -5810,7 +5810,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 		txq_pcpu->tso_headers = NULL;
 
 		txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS;
-		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2;
+		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold - 100;
 
This number 100 is a magic constant.  If it is related to
MVPP2_MAX_TSO_SEGS, please use that define.  Otherwise
define a new one which is descriptive.

Thank you.

Re: [PATCH net-next 2/3] net: mvpp2: adjust gso stop wake thresholds

From: Antoine Tenart <hidden>
Date: 2018-02-27 17:14:06

Hi David,

On Tue, Feb 27, 2018 at 11:13:06AM -0500, David Miller wrote:
From: Antoine Tenart <redacted>
quoted
From: Yan Markman <redacted>
-#define MVPP2_MAX_TSO_SEGS		300
+#define MVPP2_MAX_TSO_SEGS		100
 #define MVPP2_MAX_SKB_DESCS		(MVPP2_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
 
 /* Dfault number of RXQs in use */
@@ -5810,7 +5810,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 		txq_pcpu->tso_headers = NULL;
 
 		txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS;
-		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2;
+		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold - 100;
 
This number 100 is a magic constant.  If it is related to
MVPP2_MAX_TSO_SEGS, please use that define.  Otherwise
define a new one which is descriptive.
I agree. I'll ask Yan about it and update if possible.

Thanks!
Antoine

-- 
Antoine Ténart, Bootlin (formerly Free Electrons)
Embedded Linux and Kernel engineering
https://bootlin.com

RE: [PATCH net-next 2/3] net: mvpp2: adjust gso stop wake thresholds

From: Yan Markman <hidden>
Date: 2018-02-27 17:48:56

I will make this tomorrow.
Thanks for attention!
Best regards
Yan Markman
Tel. 05-44732819


-----Original Message-----
From: Antoine Tenart [mailto:antoine.tenart@bootlin.com] 
Sent: Tuesday, February 27, 2018 7:14 PM
To: David Miller <davem@davemloft.net>
Cc: antoine.tenart@bootlin.com; Yan Markman <redacted>; mw@semihalf.com; Stefan Chulski <redacted>; thomas.petazzoni@free-electrons.com; gregory.clement@free-electrons.com; miquel.raynal@free-electrons.com; Nadav Haklai <redacted>; maxime.chevallier@bootlin.com; netdev@vger.kernel.org; linux-kernel@vger.kernel.org
Subject: Re: [PATCH net-next 2/3] net: mvpp2: adjust gso stop wake thresholds

Hi David,

On Tue, Feb 27, 2018 at 11:13:06AM -0500, David Miller wrote:
From: Antoine Tenart <redacted>
quoted
From: Yan Markman <redacted>
-#define MVPP2_MAX_TSO_SEGS		300
+#define MVPP2_MAX_TSO_SEGS		100
 #define MVPP2_MAX_SKB_DESCS		(MVPP2_MAX_TSO_SEGS * 2 + MAX_SKB_FRAGS)
 
 /* Dfault number of RXQs in use */
@@ -5810,7 +5810,7 @@ static int mvpp2_txq_init(struct mvpp2_port *port,
 		txq_pcpu->tso_headers = NULL;
 
 		txq_pcpu->stop_threshold = txq->size - MVPP2_MAX_SKB_DESCS;
-		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold / 2;
+		txq_pcpu->wake_threshold = txq_pcpu->stop_threshold - 100;
 
This number 100 is a magic constant.  If it is related to 
MVPP2_MAX_TSO_SEGS, please use that define.  Otherwise define a new 
one which is descriptive.
I agree. I'll ask Yan about it and update if possible.

Thanks!
Antoine

--
Antoine Ténart, Bootlin (formerly Free Electrons) Embedded Linux and Kernel engineering https://bootlin.com
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help