All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: mvpp2: small improvements
@ 2018-05-17  8:34 Antoine Tenart
  2018-05-17  8:34 ` [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice Antoine Tenart
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Antoine Tenart @ 2018-05-17  8:34 UTC (permalink / raw)
  To: davem
  Cc: Antoine Tenart, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, ymarkman, mw

Hi all,

Those 3 patches are small improvements to the Marvell PPv2 driver. The
series does not conflict with the one sent about phylink and
1000/2500baseX support, so the two series can live in parallel.

Thanks!
Antoine

Yan Markman (3):
  net: mvpp2: avoid checking for free aggregated descriptors twice
  net: mvpp2: set mac address does not require the stop/start sequence
  net: mvpp2: print rx error with rate-limit

 drivers/net/ethernet/marvell/mvpp2.c | 59 +++++++++-------------------
 1 file changed, 18 insertions(+), 41 deletions(-)

-- 
2.17.0

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

* [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice
  2018-05-17  8:34 [PATCH net-next 0/3] net: mvpp2: small improvements Antoine Tenart
@ 2018-05-17  8:34 ` Antoine Tenart
  2018-05-17 20:19   ` David Miller
  2018-05-17  8:34 ` [PATCH net-next 2/3] net: mvpp2: set mac address does not require the stop/start sequence Antoine Tenart
  2018-05-17  8:34 ` [PATCH net-next 3/3] net: mvpp2: print rx error with rate-limit Antoine Tenart
  2 siblings, 1 reply; 7+ messages in thread
From: Antoine Tenart @ 2018-05-17  8:34 UTC (permalink / raw)
  To: davem
  Cc: Yan Markman, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, mw, Antoine Tenart

From: Yan Markman <ymarkman@marvell.com>

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

Signed-off-by: Yan Markman <ymarkman@marvell.com>
[Antoine: commit message]
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 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 df59f0e0d33c..73b2f2d331c5 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -5488,11 +5488,10 @@ static int mvpp2_aggr_desc_num_check(struct mvpp2 *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.17.0

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

* [PATCH net-next 2/3] net: mvpp2: set mac address does not require the stop/start sequence
  2018-05-17  8:34 [PATCH net-next 0/3] net: mvpp2: small improvements Antoine Tenart
  2018-05-17  8:34 ` [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice Antoine Tenart
@ 2018-05-17  8:34 ` Antoine Tenart
  2018-05-17 20:19   ` David Miller
  2018-05-17  8:34 ` [PATCH net-next 3/3] net: mvpp2: print rx error with rate-limit Antoine Tenart
  2 siblings, 1 reply; 7+ messages in thread
From: Antoine Tenart @ 2018-05-17  8:34 UTC (permalink / raw)
  To: davem
  Cc: Yan Markman, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, mw, Antoine Tenart

From: Yan Markman <ymarkman@marvell.com>

Remove special stop/start handling from the set_mac_address callback.
All this special care is not needed, and can be removed. It also
simplifies the up/down status in the driver and helps avoiding possible
link status mismatch issues.

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

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index 73b2f2d331c5..a9483da18e00 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -7358,42 +7358,18 @@ static void mvpp2_set_rx_mode(struct net_device *dev)
 
 static int mvpp2_set_mac_address(struct net_device *dev, void *p)
 {
-	struct mvpp2_port *port = netdev_priv(dev);
 	const struct sockaddr *addr = p;
 	int err;
 
-	if (!is_valid_ether_addr(addr->sa_data)) {
-		err = -EADDRNOTAVAIL;
-		goto log_error;
-	}
-
-	if (!netif_running(dev)) {
-		err = mvpp2_prs_update_mac_da(dev, addr->sa_data);
-		if (!err)
-			return 0;
-		/* Reconfigure parser to accept the original MAC address */
-		err = mvpp2_prs_update_mac_da(dev, dev->dev_addr);
-		if (err)
-			goto log_error;
-	}
-
-	mvpp2_stop_dev(port);
+	if (!is_valid_ether_addr(addr->sa_data))
+		return -EADDRNOTAVAIL;
 
 	err = mvpp2_prs_update_mac_da(dev, addr->sa_data);
-	if (!err)
-		goto out_start;
-
-	/* Reconfigure parser accept the original MAC address */
-	err = mvpp2_prs_update_mac_da(dev, dev->dev_addr);
-	if (err)
-		goto log_error;
-out_start:
-	mvpp2_start_dev(port);
-	mvpp2_egress_enable(port);
-	mvpp2_ingress_enable(port);
-	return 0;
-log_error:
-	netdev_err(dev, "failed to change MAC address\n");
+	if (err) {
+		/* Reconfigure parser accept the original MAC address */
+		mvpp2_prs_update_mac_da(dev, dev->dev_addr);
+		netdev_err(dev, "failed to change MAC address\n");
+	}
 	return err;
 }
 
-- 
2.17.0

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

* [PATCH net-next 3/3] net: mvpp2: print rx error with rate-limit
  2018-05-17  8:34 [PATCH net-next 0/3] net: mvpp2: small improvements Antoine Tenart
  2018-05-17  8:34 ` [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice Antoine Tenart
  2018-05-17  8:34 ` [PATCH net-next 2/3] net: mvpp2: set mac address does not require the stop/start sequence Antoine Tenart
@ 2018-05-17  8:34 ` Antoine Tenart
  2018-05-17 20:19   ` David Miller
  2 siblings, 1 reply; 7+ messages in thread
From: Antoine Tenart @ 2018-05-17  8:34 UTC (permalink / raw)
  To: davem
  Cc: Yan Markman, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, mw, Antoine Tenart

From: Yan Markman <ymarkman@marvell.com>

Prevent flood of RX error prints during heavy traffic with weak signal
in link by checking net_ratelimit() before using netdev_err().

Signed-off-by: Yan Markman <ymarkman@marvell.com>
[Antoine: small rework, commit message]
Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>
---
 drivers/net/ethernet/marvell/mvpp2.c | 14 ++++++++------
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c
index a9483da18e00..f8ed983bc767 100644
--- a/drivers/net/ethernet/marvell/mvpp2.c
+++ b/drivers/net/ethernet/marvell/mvpp2.c
@@ -6382,21 +6382,23 @@ static void mvpp2_rx_error(struct mvpp2_port *port,
 {
 	u32 status = mvpp2_rxdesc_status_get(port, rx_desc);
 	size_t sz = mvpp2_rxdesc_size_get(port, rx_desc);
+	char *err_str = NULL;
 
 	switch (status & MVPP2_RXD_ERR_CODE_MASK) {
 	case MVPP2_RXD_ERR_CRC:
-		netdev_err(port->dev, "bad rx status %08x (crc error), size=%zu\n",
-			   status, sz);
+		err_str = "crc";
 		break;
 	case MVPP2_RXD_ERR_OVERRUN:
-		netdev_err(port->dev, "bad rx status %08x (overrun error), size=%zu\n",
-			   status, sz);
+		err_str = "overrun";
 		break;
 	case MVPP2_RXD_ERR_RESOURCE:
-		netdev_err(port->dev, "bad rx status %08x (resource error), size=%zu\n",
-			   status, sz);
+		err_str = "resource";
 		break;
 	}
+	if (err_str && net_ratelimit())
+		netdev_err(port->dev,
+			   "bad rx status %08x (%s error), size=%zu\n",
+			   status, err_str, sz);
 }
 
 /* Handle RX checksum offload */
-- 
2.17.0

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

* Re: [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice
  2018-05-17  8:34 ` [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice Antoine Tenart
@ 2018-05-17 20:19   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-05-17 20:19 UTC (permalink / raw)
  To: antoine.tenart
  Cc: ymarkman, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, mw

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Thu, 17 May 2018 10:34:25 +0200

> From: Yan Markman <ymarkman@marvell.com>
> 
> Avoid repeating the check for free aggregated descriptors when it
> already failed at the beginning of the function.
> 
> Signed-off-by: Yan Markman <ymarkman@marvell.com>
> [Antoine: commit message]
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied.

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

* Re: [PATCH net-next 2/3] net: mvpp2: set mac address does not require the stop/start sequence
  2018-05-17  8:34 ` [PATCH net-next 2/3] net: mvpp2: set mac address does not require the stop/start sequence Antoine Tenart
@ 2018-05-17 20:19   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-05-17 20:19 UTC (permalink / raw)
  To: antoine.tenart
  Cc: ymarkman, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, mw

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Thu, 17 May 2018 10:34:26 +0200

> From: Yan Markman <ymarkman@marvell.com>
> 
> Remove special stop/start handling from the set_mac_address callback.
> All this special care is not needed, and can be removed. It also
> simplifies the up/down status in the driver and helps avoiding possible
> link status mismatch issues.
> 
> Signed-off-by: Yan Markman <ymarkman@marvell.com>
> [Antoine: commit message]
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied.

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

* Re: [PATCH net-next 3/3] net: mvpp2: print rx error with rate-limit
  2018-05-17  8:34 ` [PATCH net-next 3/3] net: mvpp2: print rx error with rate-limit Antoine Tenart
@ 2018-05-17 20:19   ` David Miller
  0 siblings, 0 replies; 7+ messages in thread
From: David Miller @ 2018-05-17 20:19 UTC (permalink / raw)
  To: antoine.tenart
  Cc: ymarkman, netdev, linux-kernel, thomas.petazzoni,
	maxime.chevallier, gregory.clement, miquel.raynal, nadavh,
	stefanc, mw

From: Antoine Tenart <antoine.tenart@bootlin.com>
Date: Thu, 17 May 2018 10:34:27 +0200

> From: Yan Markman <ymarkman@marvell.com>
> 
> Prevent flood of RX error prints during heavy traffic with weak signal
> in link by checking net_ratelimit() before using netdev_err().
> 
> Signed-off-by: Yan Markman <ymarkman@marvell.com>
> [Antoine: small rework, commit message]
> Signed-off-by: Antoine Tenart <antoine.tenart@bootlin.com>

Applied.

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

end of thread, other threads:[~2018-05-17 20:20 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-17  8:34 [PATCH net-next 0/3] net: mvpp2: small improvements Antoine Tenart
2018-05-17  8:34 ` [PATCH net-next 1/3] net: mvpp2: avoid checking for free aggregated descriptors twice Antoine Tenart
2018-05-17 20:19   ` David Miller
2018-05-17  8:34 ` [PATCH net-next 2/3] net: mvpp2: set mac address does not require the stop/start sequence Antoine Tenart
2018-05-17 20:19   ` David Miller
2018-05-17  8:34 ` [PATCH net-next 3/3] net: mvpp2: print rx error with rate-limit Antoine Tenart
2018-05-17 20:19   ` 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.