Netdev List
 help / color / mirror / Atom feed
* [PATCH v2 02/14] sh_eth: fix invalid context bug while changing link options by ethtool
From: Vladimir Zapolskiy @ 2018-07-04  8:12 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The change fixes sleep in atomic context bug, which is encountered
every time when link settings are changed by ethtool.

Since commit 35b5f6b1a82b ("PHYLIB: Locking fixes for PHY I/O
potentially sleeping") phy_start_aneg() function utilizes a mutex
to serialize changes to phy state, however that helper function is
called in atomic context under a grabbed spinlock, because
phy_start_aneg() is called by phy_ethtool_ksettings_set() and by
replaced phy_ethtool_sset() helpers from phylib.

Now duplex mode setting is enforced in sh_eth_adjust_link() only,
also now RX/TX is disabled when link is put down or modifications
to E-MAC registers ECMR and GECMR are expected for both cases of
checked and ignored link status pin state from E-MAC interrupt handler.

For reference the change is a partial rework of commit 1e1b812bbe10
("sh_eth: fix handling of no LINK signal").

Fixes: dc19e4e5e02f ("sh: sh_eth: Add support ethtool")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 49 ++++++++-------------------
 1 file changed, 15 insertions(+), 34 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index e8aca46bb925..8e429e865552 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1927,8 +1927,15 @@ static void sh_eth_adjust_link(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
 	struct phy_device *phydev = ndev->phydev;
+	unsigned long flags;
 	int new_state = 0;
 
+	spin_lock_irqsave(&mdp->lock, flags);
+
+	/* Disable TX and RX right over here, if E-MAC change is ignored */
+	if (mdp->cd->no_psr || mdp->no_ether_link)
+		sh_eth_rcv_snd_disable(ndev);
+
 	if (phydev->link) {
 		if (phydev->duplex != mdp->duplex) {
 			new_state = 1;
@@ -1947,18 +1954,21 @@ static void sh_eth_adjust_link(struct net_device *ndev)
 			sh_eth_modify(ndev, ECMR, ECMR_TXF, 0);
 			new_state = 1;
 			mdp->link = phydev->link;
-			if (mdp->cd->no_psr || mdp->no_ether_link)
-				sh_eth_rcv_snd_enable(ndev);
 		}
 	} else if (mdp->link) {
 		new_state = 1;
 		mdp->link = 0;
 		mdp->speed = 0;
 		mdp->duplex = -1;
-		if (mdp->cd->no_psr || mdp->no_ether_link)
-			sh_eth_rcv_snd_disable(ndev);
 	}
 
+	/* Enable TX and RX right over here, if E-MAC change is ignored */
+	if ((mdp->cd->no_psr || mdp->no_ether_link) && phydev->link)
+		sh_eth_rcv_snd_enable(ndev);
+
+	mmiowb();
+	spin_unlock_irqrestore(&mdp->lock, flags);
+
 	if (new_state && netif_msg_link(mdp))
 		phy_print_status(phydev);
 }
@@ -2049,39 +2059,10 @@ static int sh_eth_get_link_ksettings(struct net_device *ndev,
 static int sh_eth_set_link_ksettings(struct net_device *ndev,
 				     const struct ethtool_link_ksettings *cmd)
 {
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-	unsigned long flags;
-	int ret;
-
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	spin_lock_irqsave(&mdp->lock, flags);
-
-	/* disable tx and rx */
-	sh_eth_rcv_snd_disable(ndev);
-
-	ret = phy_ethtool_ksettings_set(ndev->phydev, cmd);
-	if (ret)
-		goto error_exit;
-
-	if (cmd->base.duplex == DUPLEX_FULL)
-		mdp->duplex = 1;
-	else
-		mdp->duplex = 0;
-
-	if (mdp->cd->set_duplex)
-		mdp->cd->set_duplex(ndev);
-
-error_exit:
-	mdelay(1);
-
-	/* enable tx and rx */
-	sh_eth_rcv_snd_enable(ndev);
-
-	spin_unlock_irqrestore(&mdp->lock, flags);
-
-	return ret;
+	return phy_ethtool_ksettings_set(ndev->phydev, cmd);
 }
 
 /* If it is ever necessary to increase SH_ETH_REG_DUMP_MAX_REGS, the
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 03/14] sh_eth: simplify link auto-negotiation by ethtool
From: Vladimir Zapolskiy @ 2018-07-04  8:12 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

There is no need to call a heavyweight phy_start_aneg() for phy
auto-negotiation by ethtool, the phy is already initialized and
link auto-negotiation is started by calling phy_start() from
sh_eth_phy_start() when a network device is opened.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 8e429e865552..1bed2ee4d709 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2249,7 +2249,7 @@ static int sh_eth_nway_reset(struct net_device *ndev)
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	return phy_start_aneg(ndev->phydev);
+	return phy_restart_aneg(ndev->phydev);
 }
 
 static u32 sh_eth_get_msglevel(struct net_device *ndev)
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 04/14] sh_eth: remove custom .nway_reset from ethtool ops
From: Vladimir Zapolskiy @ 2018-07-04  8:12 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The generic phy_ethtool_nway_reset() function from phylib can be used
instead of in-house sh_eth_nway_reset().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 10 +---------
 1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 1bed2ee4d709..50ff18870be2 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2244,14 +2244,6 @@ static void sh_eth_get_regs(struct net_device *ndev, struct ethtool_regs *regs,
 	pm_runtime_put_sync(&mdp->pdev->dev);
 }
 
-static int sh_eth_nway_reset(struct net_device *ndev)
-{
-	if (!ndev->phydev)
-		return -ENODEV;
-
-	return phy_restart_aneg(ndev->phydev);
-}
-
 static u32 sh_eth_get_msglevel(struct net_device *ndev)
 {
 	struct sh_eth_private *mdp = netdev_priv(ndev);
@@ -2402,7 +2394,7 @@ static int sh_eth_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 static const struct ethtool_ops sh_eth_ethtool_ops = {
 	.get_regs_len	= sh_eth_get_regs_len,
 	.get_regs	= sh_eth_get_regs,
-	.nway_reset	= sh_eth_nway_reset,
+	.nway_reset	= phy_ethtool_nway_reset,
 	.get_msglevel	= sh_eth_get_msglevel,
 	.set_msglevel	= sh_eth_set_msglevel,
 	.get_link	= ethtool_op_get_link,
-- 
2.17.1

^ permalink raw reply related

* Re: [PATCH net-next 8/8] vhost: event suppression for packed ring
From: Wei Xu @ 2018-07-04  8:13 UTC (permalink / raw)
  To: Jason Wang
  Cc: kvm, mst, netdev, linux-kernel, virtualization, maxime.coquelin
In-Reply-To: <493c3a3e-e088-d6fb-1da4-cda8bfb34400@redhat.com>

On Wed, Jul 04, 2018 at 01:23:18PM +0800, Jason Wang wrote:
> 
> 
> On 2018年07月04日 12:13, Wei Xu wrote:
> >On Tue, Jul 03, 2018 at 01:38:04PM +0800, Jason Wang wrote:
> >>This patch introduces support for event suppression. This is done by
> >>have a two areas: device area and driver area. One side could then try
> >>to disable or enable (delayed) notification from other side by using a
> >>boolean hint or event index interface in the areas.
> >>
> >>For more information, please refer Virtio spec.
> >>
> >>Signed-off-by: Jason Wang<jasowang@redhat.com>
> >>---
> >>  drivers/vhost/vhost.c | 191 ++++++++++++++++++++++++++++++++++++++++++++++----
> >>  drivers/vhost/vhost.h |  10 ++-
> >>  2 files changed, 185 insertions(+), 16 deletions(-)
> >>
> >>diff --git a/drivers/vhost/vhost.c b/drivers/vhost/vhost.c
> >>index 0f3f07c..cccbc82 100644
> >>--- a/drivers/vhost/vhost.c
> >>+++ b/drivers/vhost/vhost.c
> >>@@ -1115,10 +1115,15 @@ static int vq_access_ok_packed(struct vhost_virtqueue *vq, unsigned int num,
> >>  			       struct vring_used __user *used)
> >>  {
> >>  	struct vring_desc_packed *packed = (struct vring_desc_packed *)desc;
> >>+	struct vring_packed_desc_event *driver_event =
> >>+		(struct vring_packed_desc_event *)avail;
> >>+	struct vring_packed_desc_event *device_event =
> >>+		(struct vring_packed_desc_event *)used;
> >>-	/* TODO: check device area and driver area */
> >>  	return access_ok(VERIFY_READ, packed, num * sizeof(*packed)) &&
> >>-	       access_ok(VERIFY_WRITE, packed, num * sizeof(*packed));
> >>+	       access_ok(VERIFY_WRITE, packed, num * sizeof(*packed)) &&
> >R/W parameter doesn't make sense to most architectures and the comment in x86
> >says WRITE is a superset of READ, is it possible to converge them here?
> >
> >/**
> >  * access_ok: - Checks if a user space pointer is valid
> >  * @type: Type of access: %VERIFY_READ or %VERIFY_WRITE.  Note that
> >  *        %VERIFY_WRITE is a superset of %VERIFY_READ - if it is safe
> >  *        to write to a block, it is always safe to read from it.
> >  * @addr: User space pointer to start of block to check
> >  * @size: Size of block to check
> >  *
> >  * Context: User context only. This function may sleep if pagefaults are
> >  *          enabled.
> >  *
> >  * Checks if a pointer to a block of memory in user space is valid.
> >  *
> >  * Returns true (nonzero) if the memory block may be valid, false (zero)
> >  * if it is definitely invalid.
> >  *
> >  * Note that, depending on architecture, this function probably just
> >  * checks that the pointer is in the user space range - after calling
> >  * this function, memory access functions may still return -EFAULT.
> >  */
> >#define access_ok(type, addr, size)
> >......
> >
> >Thanks,
> >Wei
> >
> 
> Well, this is a question that beyond the scope of this patch.
> 
> My understanding is we should keep it unless type was meaningless on all
> archs.

No problem, go ahead.

Wei

> 
> Thanks
> 
_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply

* [PATCH v2 05/14] sh_eth: remove useless serialization in sh_eth_get_link_ksettings()
From: Vladimir Zapolskiy @ 2018-07-04  8:14 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

phy_ethtool_ksettings_get() call does not modify device state or device
driver state, hence there is no need to utilize a driver specific
spinlock.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 50ff18870be2..152edd1e9a23 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2043,15 +2043,10 @@ static int sh_eth_phy_start(struct net_device *ndev)
 static int sh_eth_get_link_ksettings(struct net_device *ndev,
 				     struct ethtool_link_ksettings *cmd)
 {
-	struct sh_eth_private *mdp = netdev_priv(ndev);
-	unsigned long flags;
-
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	spin_lock_irqsave(&mdp->lock, flags);
 	phy_ethtool_ksettings_get(ndev->phydev, cmd);
-	spin_unlock_irqrestore(&mdp->lock, flags);
 
 	return 0;
 }
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 06/14] sh_eth: remove custom .get_link_ksettings from ethtool ops
From: Vladimir Zapolskiy @ 2018-07-04  8:14 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The generic phy_ethtool_get_link_ksettings() function from phylib can be
used instead of in-house sh_eth_get_link_ksettings().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 152edd1e9a23..bd4a0b9c3362 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2040,17 +2040,6 @@ static int sh_eth_phy_start(struct net_device *ndev)
 	return 0;
 }
 
-static int sh_eth_get_link_ksettings(struct net_device *ndev,
-				     struct ethtool_link_ksettings *cmd)
-{
-	if (!ndev->phydev)
-		return -ENODEV;
-
-	phy_ethtool_ksettings_get(ndev->phydev, cmd);
-
-	return 0;
-}
-
 static int sh_eth_set_link_ksettings(struct net_device *ndev,
 				     const struct ethtool_link_ksettings *cmd)
 {
@@ -2398,7 +2387,7 @@ static const struct ethtool_ops sh_eth_ethtool_ops = {
 	.get_sset_count     = sh_eth_get_sset_count,
 	.get_ringparam	= sh_eth_get_ringparam,
 	.set_ringparam	= sh_eth_set_ringparam,
-	.get_link_ksettings = sh_eth_get_link_ksettings,
+	.get_link_ksettings = phy_ethtool_get_link_ksettings,
 	.set_link_ksettings = sh_eth_set_link_ksettings,
 	.get_wol	= sh_eth_get_wol,
 	.set_wol	= sh_eth_set_wol,
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 07/14] sh_eth: remove custom .set_link_ksettings from ethtool ops
From: Vladimir Zapolskiy @ 2018-07-04  8:14 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The generic phy_ethtool_set_link_ksettings() function from phylib can
be used instead of in-house sh_eth_set_link_ksettings().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/sh_eth.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index bd4a0b9c3362..5614fd231bbe 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -2040,15 +2040,6 @@ static int sh_eth_phy_start(struct net_device *ndev)
 	return 0;
 }
 
-static int sh_eth_set_link_ksettings(struct net_device *ndev,
-				     const struct ethtool_link_ksettings *cmd)
-{
-	if (!ndev->phydev)
-		return -ENODEV;
-
-	return phy_ethtool_ksettings_set(ndev->phydev, cmd);
-}
-
 /* If it is ever necessary to increase SH_ETH_REG_DUMP_MAX_REGS, the
  * version must be bumped as well.  Just adding registers up to that
  * limit is fine, as long as the existing register indices don't
@@ -2388,7 +2379,7 @@ static const struct ethtool_ops sh_eth_ethtool_ops = {
 	.get_ringparam	= sh_eth_get_ringparam,
 	.set_ringparam	= sh_eth_set_ringparam,
 	.get_link_ksettings = phy_ethtool_get_link_ksettings,
-	.set_link_ksettings = sh_eth_set_link_ksettings,
+	.set_link_ksettings = phy_ethtool_set_link_ksettings,
 	.get_wol	= sh_eth_get_wol,
 	.set_wol	= sh_eth_set_wol,
 };
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 08/14] ravb: fix invalid context bug while calling auto-negotiation by ethtool
From: Vladimir Zapolskiy @ 2018-07-04  8:14 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

Since commit 35b5f6b1a82b ("PHYLIB: Locking fixes for PHY I/O
potentially sleeping") phy_start_aneg() function utilizes a mutex
to serialize changes to phy state, however the helper function is
called in atomic context.

The bug can be reproduced by running "ethtool -r" command, the bug
is reported if CONFIG_DEBUG_ATOMIC_SLEEP build option is enabled.

Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 68f122140966..e7d6d1b6e7d6 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1152,15 +1152,10 @@ static int ravb_set_link_ksettings(struct net_device *ndev,
 
 static int ravb_nway_reset(struct net_device *ndev)
 {
-	struct ravb_private *priv = netdev_priv(ndev);
 	int error = -ENODEV;
-	unsigned long flags;
 
-	if (ndev->phydev) {
-		spin_lock_irqsave(&priv->lock, flags);
+	if (ndev->phydev)
 		error = phy_start_aneg(ndev->phydev);
-		spin_unlock_irqrestore(&priv->lock, flags);
-	}
 
 	return error;
 }
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 09/14] ravb: fix invalid context bug while changing link options by ethtool
From: Vladimir Zapolskiy @ 2018-07-04  8:14 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The change fixes sleep in atomic context bug, which is encountered
every time when link settings are changed by ethtool.

Since commit 35b5f6b1a82b ("PHYLIB: Locking fixes for PHY I/O
potentially sleeping") phy_start_aneg() function utilizes a mutex
to serialize changes to phy state, however that helper function is
called in atomic context under a grabbed spinlock, because
phy_start_aneg() is called by phy_ethtool_ksettings_set() and by
replaced phy_ethtool_sset() helpers from phylib.

Now duplex mode setting is enforced in ravb_adjust_link() only, also
now RX/TX is disabled when link is put down or modifications to E-MAC
registers ECMR and GECMR are expected for both cases of checked and
ignored link status pin state from E-MAC interrupt handler.

Fixes: a0d2f20650e8 ("Renesas Ethernet AVB PTP clock driver")
Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 49 ++++++++----------------
 1 file changed, 15 insertions(+), 34 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index e7d6d1b6e7d6..40266fe01186 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -980,6 +980,13 @@ static void ravb_adjust_link(struct net_device *ndev)
 	struct ravb_private *priv = netdev_priv(ndev);
 	struct phy_device *phydev = ndev->phydev;
 	bool new_state = false;
+	unsigned long flags;
+
+	spin_lock_irqsave(&priv->lock, flags);
+
+	/* Disable TX and RX right over here, if E-MAC change is ignored */
+	if (priv->no_avb_link)
+		ravb_rcv_snd_disable(ndev);
 
 	if (phydev->link) {
 		if (phydev->duplex != priv->duplex) {
@@ -997,18 +1004,21 @@ static void ravb_adjust_link(struct net_device *ndev)
 			ravb_modify(ndev, ECMR, ECMR_TXF, 0);
 			new_state = true;
 			priv->link = phydev->link;
-			if (priv->no_avb_link)
-				ravb_rcv_snd_enable(ndev);
 		}
 	} else if (priv->link) {
 		new_state = true;
 		priv->link = 0;
 		priv->speed = 0;
 		priv->duplex = -1;
-		if (priv->no_avb_link)
-			ravb_rcv_snd_disable(ndev);
 	}
 
+	/* Enable TX and RX right over here, if E-MAC change is ignored */
+	if (priv->no_avb_link && phydev->link)
+		ravb_rcv_snd_enable(ndev);
+
+	mmiowb();
+	spin_unlock_irqrestore(&priv->lock, flags);
+
 	if (new_state && netif_msg_link(priv))
 		phy_print_status(phydev);
 }
@@ -1115,39 +1125,10 @@ static int ravb_get_link_ksettings(struct net_device *ndev,
 static int ravb_set_link_ksettings(struct net_device *ndev,
 				   const struct ethtool_link_ksettings *cmd)
 {
-	struct ravb_private *priv = netdev_priv(ndev);
-	unsigned long flags;
-	int error;
-
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	spin_lock_irqsave(&priv->lock, flags);
-
-	/* Disable TX and RX */
-	ravb_rcv_snd_disable(ndev);
-
-	error = phy_ethtool_ksettings_set(ndev->phydev, cmd);
-	if (error)
-		goto error_exit;
-
-	if (cmd->base.duplex == DUPLEX_FULL)
-		priv->duplex = 1;
-	else
-		priv->duplex = 0;
-
-	ravb_set_duplex(ndev);
-
-error_exit:
-	mdelay(1);
-
-	/* Enable TX and RX */
-	ravb_rcv_snd_enable(ndev);
-
-	mmiowb();
-	spin_unlock_irqrestore(&priv->lock, flags);
-
-	return error;
+	return phy_ethtool_ksettings_set(ndev->phydev, cmd);
 }
 
 static int ravb_nway_reset(struct net_device *ndev)
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 10/14] ravb: simplify link auto-negotiation by ethtool
From: Vladimir Zapolskiy @ 2018-07-04  8:16 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

There is no need to call a heavyweight phy_start_aneg() for phy
auto-negotiation by ethtool, the phy is already initialized and
link auto-negotiation is started by calling phy_start() from
ravb_phy_start() when a network device is opened.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 40266fe01186..31913a469001 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1136,7 +1136,7 @@ static int ravb_nway_reset(struct net_device *ndev)
 	int error = -ENODEV;
 
 	if (ndev->phydev)
-		error = phy_start_aneg(ndev->phydev);
+		error = phy_restart_aneg(ndev->phydev);
 
 	return error;
 }
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 11/14] ravb: remove custom .nway_reset from ethtool ops
From: Vladimir Zapolskiy @ 2018-07-04  8:16 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The generic phy_ethtool_nway_reset() function from phylib can be used
instead of in-house ravb_nway_reset().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 31913a469001..6002132093cd 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1131,16 +1131,6 @@ static int ravb_set_link_ksettings(struct net_device *ndev,
 	return phy_ethtool_ksettings_set(ndev->phydev, cmd);
 }
 
-static int ravb_nway_reset(struct net_device *ndev)
-{
-	int error = -ENODEV;
-
-	if (ndev->phydev)
-		error = phy_restart_aneg(ndev->phydev);
-
-	return error;
-}
-
 static u32 ravb_get_msglevel(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -1353,7 +1343,7 @@ static int ravb_set_wol(struct net_device *ndev, struct ethtool_wolinfo *wol)
 }
 
 static const struct ethtool_ops ravb_ethtool_ops = {
-	.nway_reset		= ravb_nway_reset,
+	.nway_reset		= phy_ethtool_nway_reset,
 	.get_msglevel		= ravb_get_msglevel,
 	.set_msglevel		= ravb_set_msglevel,
 	.get_link		= ethtool_op_get_link,
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 12/14] ravb: remove useless serialization in ravb_get_link_ksettings()
From: Vladimir Zapolskiy @ 2018-07-04  8:16 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

phy_ethtool_ksettings_get() call does not modify device state or device
driver state, hence there is no need to utilize a driver specific
spinlock.

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 6002132093cd..772687a5faee 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1109,15 +1109,10 @@ static int ravb_phy_start(struct net_device *ndev)
 static int ravb_get_link_ksettings(struct net_device *ndev,
 				   struct ethtool_link_ksettings *cmd)
 {
-	struct ravb_private *priv = netdev_priv(ndev);
-	unsigned long flags;
-
 	if (!ndev->phydev)
 		return -ENODEV;
 
-	spin_lock_irqsave(&priv->lock, flags);
 	phy_ethtool_ksettings_get(ndev->phydev, cmd);
-	spin_unlock_irqrestore(&priv->lock, flags);
 
 	return 0;
 }
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 13/14] ravb: remove custom .get_link_ksettings from ethtool ops
From: Vladimir Zapolskiy @ 2018-07-04  8:16 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The generic phy_ethtool_get_link_ksettings() function from phylib can be
used instead of in-house ravb_get_link_ksettings().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 13 +------------
 1 file changed, 1 insertion(+), 12 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 772687a5faee..9fe01259be6f 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1106,17 +1106,6 @@ static int ravb_phy_start(struct net_device *ndev)
 	return 0;
 }
 
-static int ravb_get_link_ksettings(struct net_device *ndev,
-				   struct ethtool_link_ksettings *cmd)
-{
-	if (!ndev->phydev)
-		return -ENODEV;
-
-	phy_ethtool_ksettings_get(ndev->phydev, cmd);
-
-	return 0;
-}
-
 static int ravb_set_link_ksettings(struct net_device *ndev,
 				   const struct ethtool_link_ksettings *cmd)
 {
@@ -1348,7 +1337,7 @@ static const struct ethtool_ops ravb_ethtool_ops = {
 	.get_ringparam		= ravb_get_ringparam,
 	.set_ringparam		= ravb_set_ringparam,
 	.get_ts_info		= ravb_get_ts_info,
-	.get_link_ksettings	= ravb_get_link_ksettings,
+	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
 	.set_link_ksettings	= ravb_set_link_ksettings,
 	.get_wol		= ravb_get_wol,
 	.set_wol		= ravb_set_wol,
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2 14/14] ravb: remove custom .set_link_ksettings from ethtool ops
From: Vladimir Zapolskiy @ 2018-07-04  8:16 UTC (permalink / raw)
  To: Sergei Shtylyov, David S . Miller
  Cc: Andrew Lunn, Geert Uytterhoeven, netdev, linux-renesas-soc
In-Reply-To: <20180704081245.7395-1-vladimir_zapolskiy@mentor.com>

The generic phy_ethtool_set_link_ksettings() function from phylib can
be used instead of in-house ravb_set_link_ksettings().

Signed-off-by: Vladimir Zapolskiy <vladimir_zapolskiy@mentor.com>
---
 drivers/net/ethernet/renesas/ravb_main.c | 11 +----------
 1 file changed, 1 insertion(+), 10 deletions(-)

diff --git a/drivers/net/ethernet/renesas/ravb_main.c b/drivers/net/ethernet/renesas/ravb_main.c
index 9fe01259be6f..0d811c02ff34 100644
--- a/drivers/net/ethernet/renesas/ravb_main.c
+++ b/drivers/net/ethernet/renesas/ravb_main.c
@@ -1106,15 +1106,6 @@ static int ravb_phy_start(struct net_device *ndev)
 	return 0;
 }
 
-static int ravb_set_link_ksettings(struct net_device *ndev,
-				   const struct ethtool_link_ksettings *cmd)
-{
-	if (!ndev->phydev)
-		return -ENODEV;
-
-	return phy_ethtool_ksettings_set(ndev->phydev, cmd);
-}
-
 static u32 ravb_get_msglevel(struct net_device *ndev)
 {
 	struct ravb_private *priv = netdev_priv(ndev);
@@ -1338,7 +1329,7 @@ static const struct ethtool_ops ravb_ethtool_ops = {
 	.set_ringparam		= ravb_set_ringparam,
 	.get_ts_info		= ravb_get_ts_info,
 	.get_link_ksettings	= phy_ethtool_get_link_ksettings,
-	.set_link_ksettings	= ravb_set_link_ksettings,
+	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
 	.get_wol		= ravb_get_wol,
 	.set_wol		= ravb_set_wol,
 };
-- 
2.17.1

^ permalink raw reply related

* [PATCH v2] staging: fsl-dpaa2/ethsw: Update maintainers for Ethernet Switch driver
From: Razvan Stefanescu @ 2018-07-04  8:17 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel, netdev, ruxandra.radulescu, ioana.ciornei

Removing myself as the maintainer for this driver and adding Ioana R.
and Ioana C.

Signed-off-by: Razvan Stefanescu <razvan.stefanescu@nxp.com>
Acked-by: Ioana Radulescu <ruxandra.radulescu@nxp.com>
Acked-by: Ioana Ciornei <ioana.ciornei@nxp.com>
---
Changelog
 v2
	- add commit message and ack lines

 MAINTAINERS | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/MAINTAINERS b/MAINTAINERS
index b6d0cc0..0d36546 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -4434,7 +4434,8 @@ S:	Maintained
 F:	drivers/staging/fsl-dpaa2/ethernet
 
 DPAA2 ETHERNET SWITCH DRIVER
-M:	Razvan Stefanescu <razvan.stefanescu@nxp.com>
+M:	Ioana Radulescu <ruxandra.radulescu@nxp.com>
+M:	Ioana Ciornei <ioana.ciornei@nxp.com>
 L:	linux-kernel@vger.kernel.org
 S:	Maintained
 F:	drivers/staging/fsl-dpaa2/ethsw
-- 
1.9.1

^ permalink raw reply related

* Re: [RFC PATCH 1/2] net: macb: Free RX ring for all queues
From: Claudiu Beznea @ 2018-07-04  8:21 UTC (permalink / raw)
  To: Harini Katakam, nicolas.ferre, davem
  Cc: netdev, linux-kernel, michal.simek, harinikatakamlinux
In-Reply-To: <1530286269-32235-1-git-send-email-harini.katakam@xilinx.com>



On 29.06.2018 18:31, Harini Katakam wrote:
> rx ring is allocated for all queues in macb_alloc_consistent.
> Free the same for all queues instead of just Q0.
> 
> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>

Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

> ---
>  drivers/net/ethernet/cadence/macb_main.c | 11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index 3e93df5..e56ffa9 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1812,13 +1812,7 @@ static void macb_free_consistent(struct macb *bp)
>  	struct macb_queue *queue;
>  	unsigned int q;
>  
> -	queue = &bp->queues[0];
>  	bp->macbgem_ops.mog_free_rx_buffers(bp);
> -	if (queue->rx_ring) {
> -		dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp),
> -				queue->rx_ring, queue->rx_ring_dma);
> -		queue->rx_ring = NULL;
> -	}
>  
>  	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
>  		kfree(queue->tx_skb);
> @@ -1828,6 +1822,11 @@ static void macb_free_consistent(struct macb *bp)
>  					  queue->tx_ring, queue->tx_ring_dma);
>  			queue->tx_ring = NULL;
>  		}
> +		if (queue->rx_ring) {
> +			dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp),
> +					  queue->rx_ring, queue->rx_ring_dma);
> +			queue->rx_ring = NULL;
> +		}
>  	}
>  }
>  
> 

^ permalink raw reply

* Re: [RFC PATCH 2/2] net: macb: Allocate valid memory for TX and RX BD prefetch
From: Claudiu Beznea @ 2018-07-04  8:22 UTC (permalink / raw)
  To: Harini Katakam, nicolas.ferre, davem
  Cc: netdev, linux-kernel, michal.simek, harinikatakamlinux
In-Reply-To: <1530286269-32235-2-git-send-email-harini.katakam@xilinx.com>

Hi Harini,

Few comments below.

Thank you,
Claudiu Beznea

On 29.06.2018 18:31, Harini Katakam wrote:
> GEM version in ZynqMP and most versions greater than r1p07 supports
> TX and RX BD prefetch. The number of BDs that can be prefetched is a
> HW configurable parameter. For ZynqMP, this parameter is 4.
> 
> When GEM DMA is accessing the last BD in the ring, even before the
> BD is processed and the WRAP bit is noticed, it will have prefetched
> BDs outside the BD ring. These will not be processed but it is
> necessary to have accessible memory after the last BD. Especially
> in cases where SMMU is used, memory locations immediately after the
> last BD may not have translation tables triggering HRESP errors. Hence
> always allocate extra BDs to accommodate for prefetch.
> The value of tx/rx bd prefetch for any given SoC version is:
> 2 ^ (corresponding field in design config 10 register).
> (value of this field >= 1)
> 
> Added a capability flag so that older IP versions that do not have
> DCFG10 or this prefetch capability are not affected.
> 
> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
> ---
>  drivers/net/ethernet/cadence/macb.h      | 11 +++++++++++
>  drivers/net/ethernet/cadence/macb_main.c | 31 +++++++++++++++++++++++++------
>  2 files changed, 36 insertions(+), 6 deletions(-)
> 
> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
> index 8665982..b267a7b 100644
> --- a/drivers/net/ethernet/cadence/macb.h
> +++ b/drivers/net/ethernet/cadence/macb.h
> @@ -166,6 +166,7 @@
>  #define GEM_DCFG6		0x0294 /* Design Config 6 */
>  #define GEM_DCFG7		0x0298 /* Design Config 7 */
>  #define GEM_DCFG8		0x029C /* Design Config 8 */
> +#define GEM_DCFG10		0x02A4 /* Design Config 10 */
>  
>  #define GEM_TXBDCTRL	0x04cc /* TX Buffer Descriptor control register */
>  #define GEM_RXBDCTRL	0x04d0 /* RX Buffer Descriptor control register */
> @@ -490,6 +491,12 @@
>  #define GEM_SCR2CMP_OFFSET			0
>  #define GEM_SCR2CMP_SIZE			8
>  
> +/* Bitfields in DCFG10 */
> +#define GEM_TXBD_RDBUFF_OFFSET			12
> +#define GEM_TXBD_RDBUFF_SIZE			4
> +#define GEM_RXBD_RDBUFF_OFFSET			8
> +#define GEM_RXBD_RDBUFF_SIZE			4
> +
>  /* Bitfields in TISUBN */
>  #define GEM_SUBNSINCR_OFFSET			0
>  #define GEM_SUBNSINCR_SIZE			16
> @@ -635,6 +642,7 @@
>  #define MACB_CAPS_USRIO_DISABLED		0x00000010
>  #define MACB_CAPS_JUMBO				0x00000020
>  #define MACB_CAPS_GEM_HAS_PTP			0x00000040
> +#define MACB_CAPS_BD_PREFETCH			0x00000080

Rename it to MACB_CAPS_BD_RD_PREFETCH, since it is about read prefetch.

>  #define MACB_CAPS_FIFO_MODE			0x10000000
>  #define MACB_CAPS_GIGABIT_MODE_AVAILABLE	0x20000000
>  #define MACB_CAPS_SG_DISABLED			0x40000000
> @@ -1203,6 +1211,9 @@ struct macb {
>  	unsigned int max_tuples;
>  
>  	struct tasklet_struct	hresp_err_tasklet;
> +
> +	int	rx_bd_prefetch;
> +	int	tx_bd_prefetch;

Since it is about read prefetch I would say to rename these fields properly
to describe this:
	int	rx_bd_rd_prefetch;
	int	tx_bd_rd_prefetch;

or something similar as you did with macros.

>  };
>  
>  #ifdef CONFIG_MACB_USE_HWSTAMP
> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
> index e56ffa9..a7612f6 100644
> --- a/drivers/net/ethernet/cadence/macb_main.c
> +++ b/drivers/net/ethernet/cadence/macb_main.c
> @@ -1811,6 +1811,7 @@ static void macb_free_consistent(struct macb *bp)
>  {
>  	struct macb_queue *queue;
>  	unsigned int q;
> +	int size;
>  
>  	bp->macbgem_ops.mog_free_rx_buffers(bp);
>  
> @@ -1818,12 +1819,16 @@ static void macb_free_consistent(struct macb *bp)
>  		kfree(queue->tx_skb);
>  		queue->tx_skb = NULL;
>  		if (queue->tx_ring) {
> -			dma_free_coherent(&bp->pdev->dev, TX_RING_BYTES(bp),
> +			size = TX_RING_BYTES(bp) +
> +			       (macb_dma_desc_get_size(bp) * bp->tx_bd_prefetch);
> +			dma_free_coherent(&bp->pdev->dev, size,
>  					  queue->tx_ring, queue->tx_ring_dma);
>  			queue->tx_ring = NULL;
>  		}
>  		if (queue->rx_ring) {
> -			dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp),
> +			size = RX_RING_BYTES(bp) +
> +			       (macb_dma_desc_get_size(bp) * bp->rx_bd_prefetch);
> +			dma_free_coherent(&bp->pdev->dev, size,
>  					  queue->rx_ring, queue->rx_ring_dma);
>  			queue->rx_ring = NULL;
>  		}
> @@ -1873,7 +1878,8 @@ static int macb_alloc_consistent(struct macb *bp)
>  	int size;
>  
>  	for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
> -		size = TX_RING_BYTES(bp);
> +		size = TX_RING_BYTES(bp) +
> +		       (macb_dma_desc_get_size(bp) * bp->tx_bd_prefetch);
>  		queue->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
>  						    &queue->tx_ring_dma,
>  						    GFP_KERNEL);
> @@ -1889,7 +1895,8 @@ static int macb_alloc_consistent(struct macb *bp)
>  		if (!queue->tx_skb)
>  			goto out_err;
>  
> -		size = RX_RING_BYTES(bp);
> +		size = RX_RING_BYTES(bp) +
> +		       (macb_dma_desc_get_size(bp) * bp->rx_bd_prefetch);
>  		queue->rx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
>  						 &queue->rx_ring_dma, GFP_KERNEL);
>  		if (!queue->rx_ring)
> @@ -3794,7 +3801,7 @@ static const struct macb_config np4_config = {
>  static const struct macb_config zynqmp_config = {
>  	.caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE |
>  			MACB_CAPS_JUMBO |
> -			MACB_CAPS_GEM_HAS_PTP,
> +			MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_PREFETCH,
>  	.dma_burst_length = 16,
>  	.clk_init = macb_clk_init,
>  	.init = macb_init,
> @@ -3855,7 +3862,7 @@ static int macb_probe(struct platform_device *pdev)
>  	void __iomem *mem;
>  	const char *mac;
>  	struct macb *bp;
> -	int err;
> +	int err, buff;

I would use "val" instead of "buff"

>  
>  	regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>  	mem = devm_ioremap_resource(&pdev->dev, regs);
> @@ -3944,6 +3951,18 @@ static int macb_probe(struct platform_device *pdev)
>  	else
>  		dev->max_mtu = ETH_DATA_LEN;
>  
> +	bp->rx_bd_prefetch = 0;
> +	bp->tx_bd_prefetch = 0;

No need for zero init since alloc_etherdev_mq() will allocate with
__GFP_ZERO flag (actually, kvzalloc() will be called)

> +	if (bp->caps & MACB_CAPS_BD_PREFETCH) {
> +		buff = GEM_BFEXT(RXBD_RDBUFF, gem_readl(bp, DCFG10));
> +		if (buff)
> +			bp->rx_bd_prefetch = 2 << (buff - 1);
> +
> +		buff = GEM_BFEXT(TXBD_RDBUFF, gem_readl(bp, DCFG10));
> +		if (buff)
> +			bp->tx_bd_prefetch = 2 << (buff - 1);
> +	}
> +
>  	mac = of_get_mac_address(np);
>  	if (mac) {
>  		ether_addr_copy(bp->dev->dev_addr, mac);
> 

With these you can add:
Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

^ permalink raw reply

* Re: [RFC bpf-next 5/6] net/mlx5e: Add XDP RX meta data support
From: Daniel Borkmann @ 2018-07-04  8:28 UTC (permalink / raw)
  To: Saeed Mahameed, Jesper Dangaard Brouer, Alexei Starovoitov,
	Daniel Borkmann
  Cc: neerav.parikh, pjwaskiewicz, ttoukan.linux, Tariq Toukan,
	alexander.h.duyck, peter.waskiewicz.jr, Opher Reviv, Rony Efraim,
	netdev, Saeed Mahameed
In-Reply-To: <20180627024615.17856-6-saeedm@mellanox.com>

On 06/27/2018 04:46 AM, Saeed Mahameed wrote:
[...]
> @@ -935,11 +958,16 @@ static inline bool mlx5e_xdp_handle(struct mlx5e_rq *rq,
>  		return false;
>  
>  	xdp.data = va + *rx_headroom;
> -	xdp_set_data_meta_invalid(&xdp);
>  	xdp.data_end = xdp.data + *len;
>  	xdp.data_hard_start = va;
>  	xdp.rxq = &rq->xdp_rxq;
>  
> +	if (rq->xdp.flags & XDP_FLAGS_META_ALL) {
> +		xdp_reset_data_meta(&xdp);
> +		mlx5e_xdp_fill_data_meta(rq->xdp.md_info, xdp.data_meta, cqe);
> +	} else
> +		xdp_set_data_meta_invalid(&xdp);
> +

Just a quick note on this one: would actually be great to not set
the xdp_set_data_meta_invalid() in the else path as this meta buffer
should also be usable independent of hw hints. Meaning, in any case
it would be great if mlx5 + mlx4 could implement the xdp->data_meta
support we have today, this might probably be a good first step
anyway; so far supported on i40e, ixgbe, ixgbevf, nfp.

>  	act = bpf_prog_run_xdp(prog, &xdp);
>  	switch (act) {
>  	case XDP_PASS:
> 

Thanks,
Daniel

^ permalink raw reply

* Re: [PATCH v4 08/18] net: davinci_emac: potentially get the MAC address from MTD
From: Bartosz Golaszewski @ 2018-07-04  8:29 UTC (permalink / raw)
  To: Ladislav Michl
  Cc: Florian Fainelli, Sekhar Nori, Kevin Hilman, Russell King,
	Grygorii Strashko, David S . Miller, Srinivas Kandagatla,
	Lukas Wunner, Rob Herring, Dan Carpenter, Ivan Khoronzhuk,
	David Lechner, Greg Kroah-Hartman, Andrew Lunn, Jonathan Corbet,
	Linux ARM, Linux Kernel Mailing List, linux-omap, netdev,
	Bartosz 
In-Reply-To: <20180704070919.GA14051@lenoch>

2018-07-04 9:09 GMT+02:00 Ladislav Michl <ladis@linux-mips.org>:
> On Tue, Jul 03, 2018 at 09:39:51AM -0700, Florian Fainelli wrote:
>>
>>
>> On 06/29/2018 02:40 AM, Bartosz Golaszewski wrote:
>> > From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> >
>> > On da850-evm board we can read the MAC address from MTD. It's currently
>> > done in the relevant board file, but we want to get rid of all the MAC
>> > reading callbacks from the board file (SPI and NAND). Move the reading
>> > of the MAC address from SPI to the emac driver's probe function.
>>
>> This should be made something generic to all drivers, not just something
>> the davinci_emac driver does, something like this actually:
>>
>> https://lkml.org/lkml/2018/3/24/312
>
> ...and that's would also make it work when MAC address is stored
> in 24c08 EEPROM, which is quite common.
>

This is what the second patch for davinci_emac in this series does. I
agree that this should become more generic at some point - we should
probably have a routine somewhere in net that would try to get the MAC
address from all possible sources (nvmem, of etc.). This is somewhat
related to the work I want to do on nvmem to make the at24 setup()
callback more generic.

Unfortunately we don't have it yet and I will not have time to work on
it before v4.20 so if there are no serious objections, I'd like to get
this series merged for v4.19 and then we can refactor the MAC reading
later.

How does it sound?

Best regards,
Bartosz Golaszewski

>> > Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>> > ---
>> >  drivers/net/ethernet/ti/davinci_emac.c | 20 ++++++++++++++++++--
>> >  1 file changed, 18 insertions(+), 2 deletions(-)
>> >
>> > diff --git a/drivers/net/ethernet/ti/davinci_emac.c b/drivers/net/ethernet/ti/davinci_emac.c
>> > index a1a6445b5a7e..48e6a7755811 100644
>> > --- a/drivers/net/ethernet/ti/davinci_emac.c
>> > +++ b/drivers/net/ethernet/ti/davinci_emac.c
>> > @@ -67,7 +67,7 @@
>> >  #include <linux/of_irq.h>
>> >  #include <linux/of_net.h>
>> >  #include <linux/mfd/syscon.h>
>> > -
>> > +#include <linux/mtd/mtd.h>
>> >  #include <asm/irq.h>
>> >  #include <asm/page.h>
>> >
>> > @@ -1783,7 +1783,10 @@ static int davinci_emac_probe(struct platform_device *pdev)
>> >     struct cpdma_params dma_params;
>> >     struct clk *emac_clk;
>> >     unsigned long emac_bus_frequency;
>> > -
>> > +#ifdef CONFIG_MTD
>> > +   size_t mac_addr_len;
>> > +   struct mtd_info *mtd;
>> > +#endif /* CONFIG_MTD */
>> >
>> >     /* obtain emac clock from kernel */
>> >     emac_clk = devm_clk_get(&pdev->dev, NULL);
>> > @@ -1815,6 +1818,19 @@ static int davinci_emac_probe(struct platform_device *pdev)
>> >             goto err_free_netdev;
>> >     }
>> >
>> > +#ifdef CONFIG_MTD
>> > +   mtd = get_mtd_device_nm("MAC-Address");
>> > +   if (!IS_ERR(mtd)) {
>> > +           rc = mtd_read(mtd, 0, ETH_ALEN,
>> > +                         &mac_addr_len, priv->mac_addr);
>> > +           if (rc == 0)
>> > +                   dev_info(&pdev->dev,
>> > +                            "Read MAC addr from SPI Flash: %pM\n",
>> > +                            priv->mac_addr);
>> > +           put_mtd_device(mtd);
>> > +   }
>> > +#endif /* CONFIG_MTD */
>> > +
>> >     /* MAC addr and PHY mask , RMII enable info from platform_data */
>> >     memcpy(priv->mac_addr, pdata->mac_addr, ETH_ALEN);
>> >     priv->phy_id = pdata->phy_id;
>> >
>>
>> --
>> Florian
>> --
>> To unsubscribe from this list: send the line "unsubscribe linux-omap" in
>> the body of a message to majordomo@vger.kernel.org
>> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply

* Wohltätigkeitsspende in Höhe von € 2.000.000,00 EUR
From: mk.elblag @ 2018-07-04  7:49 UTC (permalink / raw)
  To: Recipients

Lieber Freund,
 
Ich bin Herr Richard Wahl der Mega-Gewinner von $ 533M In Mega Millions Jackpot spende ich an 5 zufällige Personen, wenn Sie diese E-Mail erhalten, dann wurde Ihre E-Mail nach einem Spinball ausgewählt. Ich habe den größten Teil meines Vermögens auf eine Reihe von Wohltätigkeitsorganisationen und Organisationen verteilt. Ich habe mich freiwillig dazu entschieden, Ihnen den Betrag von € 2.000.000,00 EUR zu spenden eine der ausgewählten 5, um meine Gewinne zu überprüfen, finden Sie auf meiner You Tube Seite unten.
 
UHR MICH HIER: https://www.youtube.com/watch?v=NejIUDafu3U
 
Das ist dein Spendencode: [DF00430342018]
 
Antworten Sie mit dem Spendencode auf diese E-Mail: oceanicfinancialhome@gmail.com
 
Ich hoffe, Sie und Ihre Familie glücklich zu machen.
 
Grüße
Herr Richard Wahl

^ permalink raw reply

* RE: [PATCH] net: ethernet: gianfar_ethtool: remove redundant variable last_rule_idx
From: Claudiu Manoil @ 2018-07-04  8:43 UTC (permalink / raw)
  To: Colin King, David S . Miller, netdev@vger.kernel.org
  Cc: kernel-janitors@vger.kernel.org, linux-kernel@vger.kernel.org
In-Reply-To: <20180704075455.16010-1-colin.king@canonical.com>

>-----Original Message-----
>From: Colin King [mailto:colin.king@canonical.com]
>Sent: Wednesday, July 4, 2018 10:55 AM
>To: Claudiu Manoil <claudiu.manoil@nxp.com>; David S . Miller
><davem@davemloft.net>; netdev@vger.kernel.org
>Cc: kernel-janitors@vger.kernel.org; linux-kernel@vger.kernel.org
>Subject: [PATCH] net: ethernet: gianfar_ethtool: remove redundant variable
>last_rule_idx
>
>From: Colin Ian King <colin.king@canonical.com>
>
>Variable last_rule_idx is being assigned but is never used hence it is
>redundant and can be removed.
>
>Cleans up clang warning:
>warning: variable 'last_rule_idx' set but not used [-Wunused-but-set-variable]
>
>Signed-off-by: Colin Ian King <colin.king@canonical.com>
Acked-by: Claudiu Manoil <claudiu.manoil@nxp.com>

^ permalink raw reply

* Re: [RFC PATCH 2/2] net: macb: Allocate valid memory for TX and RX BD prefetch
From: Harini Katakam @ 2018-07-04  8:45 UTC (permalink / raw)
  To: Claudiu Beznea
  Cc: Harini Katakam, Nicolas Ferre, David Miller, netdev, linux-kernel,
	Michal Simek
In-Reply-To: <c162ab8d-127d-d998-b92b-2d61511729ff@microchip.com>

Hi Claudiu,

On Wed, Jul 4, 2018 at 1:52 PM, Claudiu Beznea
<Claudiu.Beznea@microchip.com> wrote:
> Hi Harini,
>
> Few comments below.
>
> Thank you,
> Claudiu Beznea
>
> On 29.06.2018 18:31, Harini Katakam wrote:
>> GEM version in ZynqMP and most versions greater than r1p07 supports
>> TX and RX BD prefetch. The number of BDs that can be prefetched is a
>> HW configurable parameter. For ZynqMP, this parameter is 4.
>>
>> When GEM DMA is accessing the last BD in the ring, even before the
>> BD is processed and the WRAP bit is noticed, it will have prefetched
>> BDs outside the BD ring. These will not be processed but it is
>> necessary to have accessible memory after the last BD. Especially
>> in cases where SMMU is used, memory locations immediately after the
>> last BD may not have translation tables triggering HRESP errors. Hence
>> always allocate extra BDs to accommodate for prefetch.
>> The value of tx/rx bd prefetch for any given SoC version is:
>> 2 ^ (corresponding field in design config 10 register).
>> (value of this field >= 1)
>>
>> Added a capability flag so that older IP versions that do not have
>> DCFG10 or this prefetch capability are not affected.
>>
>> Signed-off-by: Harini Katakam <harini.katakam@xilinx.com>
>> ---
>>  drivers/net/ethernet/cadence/macb.h      | 11 +++++++++++
>>  drivers/net/ethernet/cadence/macb_main.c | 31 +++++++++++++++++++++++++------
>>  2 files changed, 36 insertions(+), 6 deletions(-)
>>
>> diff --git a/drivers/net/ethernet/cadence/macb.h b/drivers/net/ethernet/cadence/macb.h
>> index 8665982..b267a7b 100644
>> --- a/drivers/net/ethernet/cadence/macb.h
>> +++ b/drivers/net/ethernet/cadence/macb.h
>> @@ -166,6 +166,7 @@
>>  #define GEM_DCFG6            0x0294 /* Design Config 6 */
>>  #define GEM_DCFG7            0x0298 /* Design Config 7 */
>>  #define GEM_DCFG8            0x029C /* Design Config 8 */
>> +#define GEM_DCFG10           0x02A4 /* Design Config 10 */
>>
>>  #define GEM_TXBDCTRL 0x04cc /* TX Buffer Descriptor control register */
>>  #define GEM_RXBDCTRL 0x04d0 /* RX Buffer Descriptor control register */
>> @@ -490,6 +491,12 @@
>>  #define GEM_SCR2CMP_OFFSET                   0
>>  #define GEM_SCR2CMP_SIZE                     8
>>
>> +/* Bitfields in DCFG10 */
>> +#define GEM_TXBD_RDBUFF_OFFSET                       12
>> +#define GEM_TXBD_RDBUFF_SIZE                 4
>> +#define GEM_RXBD_RDBUFF_OFFSET                       8
>> +#define GEM_RXBD_RDBUFF_SIZE                 4
>> +
>>  /* Bitfields in TISUBN */
>>  #define GEM_SUBNSINCR_OFFSET                 0
>>  #define GEM_SUBNSINCR_SIZE                   16
>> @@ -635,6 +642,7 @@
>>  #define MACB_CAPS_USRIO_DISABLED             0x00000010
>>  #define MACB_CAPS_JUMBO                              0x00000020
>>  #define MACB_CAPS_GEM_HAS_PTP                        0x00000040
>> +#define MACB_CAPS_BD_PREFETCH                        0x00000080
>
> Rename it to MACB_CAPS_BD_RD_PREFETCH, since it is about read prefetch.
>
>>  #define MACB_CAPS_FIFO_MODE                  0x10000000
>>  #define MACB_CAPS_GIGABIT_MODE_AVAILABLE     0x20000000
>>  #define MACB_CAPS_SG_DISABLED                        0x40000000
>> @@ -1203,6 +1211,9 @@ struct macb {
>>       unsigned int max_tuples;
>>
>>       struct tasklet_struct   hresp_err_tasklet;
>> +
>> +     int     rx_bd_prefetch;
>> +     int     tx_bd_prefetch;
>
> Since it is about read prefetch I would say to rename these fields properly
> to describe this:
>         int     rx_bd_rd_prefetch;
>         int     tx_bd_rd_prefetch;
>
> or something similar as you did with macros.
>
>>  };
>>
>>  #ifdef CONFIG_MACB_USE_HWSTAMP
>> diff --git a/drivers/net/ethernet/cadence/macb_main.c b/drivers/net/ethernet/cadence/macb_main.c
>> index e56ffa9..a7612f6 100644
>> --- a/drivers/net/ethernet/cadence/macb_main.c
>> +++ b/drivers/net/ethernet/cadence/macb_main.c
>> @@ -1811,6 +1811,7 @@ static void macb_free_consistent(struct macb *bp)
>>  {
>>       struct macb_queue *queue;
>>       unsigned int q;
>> +     int size;
>>
>>       bp->macbgem_ops.mog_free_rx_buffers(bp);
>>
>> @@ -1818,12 +1819,16 @@ static void macb_free_consistent(struct macb *bp)
>>               kfree(queue->tx_skb);
>>               queue->tx_skb = NULL;
>>               if (queue->tx_ring) {
>> -                     dma_free_coherent(&bp->pdev->dev, TX_RING_BYTES(bp),
>> +                     size = TX_RING_BYTES(bp) +
>> +                            (macb_dma_desc_get_size(bp) * bp->tx_bd_prefetch);
>> +                     dma_free_coherent(&bp->pdev->dev, size,
>>                                         queue->tx_ring, queue->tx_ring_dma);
>>                       queue->tx_ring = NULL;
>>               }
>>               if (queue->rx_ring) {
>> -                     dma_free_coherent(&bp->pdev->dev, RX_RING_BYTES(bp),
>> +                     size = RX_RING_BYTES(bp) +
>> +                            (macb_dma_desc_get_size(bp) * bp->rx_bd_prefetch);
>> +                     dma_free_coherent(&bp->pdev->dev, size,
>>                                         queue->rx_ring, queue->rx_ring_dma);
>>                       queue->rx_ring = NULL;
>>               }
>> @@ -1873,7 +1878,8 @@ static int macb_alloc_consistent(struct macb *bp)
>>       int size;
>>
>>       for (q = 0, queue = bp->queues; q < bp->num_queues; ++q, ++queue) {
>> -             size = TX_RING_BYTES(bp);
>> +             size = TX_RING_BYTES(bp) +
>> +                    (macb_dma_desc_get_size(bp) * bp->tx_bd_prefetch);
>>               queue->tx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
>>                                                   &queue->tx_ring_dma,
>>                                                   GFP_KERNEL);
>> @@ -1889,7 +1895,8 @@ static int macb_alloc_consistent(struct macb *bp)
>>               if (!queue->tx_skb)
>>                       goto out_err;
>>
>> -             size = RX_RING_BYTES(bp);
>> +             size = RX_RING_BYTES(bp) +
>> +                    (macb_dma_desc_get_size(bp) * bp->rx_bd_prefetch);
>>               queue->rx_ring = dma_alloc_coherent(&bp->pdev->dev, size,
>>                                                &queue->rx_ring_dma, GFP_KERNEL);
>>               if (!queue->rx_ring)
>> @@ -3794,7 +3801,7 @@ static const struct macb_config np4_config = {
>>  static const struct macb_config zynqmp_config = {
>>       .caps = MACB_CAPS_GIGABIT_MODE_AVAILABLE |
>>                       MACB_CAPS_JUMBO |
>> -                     MACB_CAPS_GEM_HAS_PTP,
>> +                     MACB_CAPS_GEM_HAS_PTP | MACB_CAPS_BD_PREFETCH,
>>       .dma_burst_length = 16,
>>       .clk_init = macb_clk_init,
>>       .init = macb_init,
>> @@ -3855,7 +3862,7 @@ static int macb_probe(struct platform_device *pdev)
>>       void __iomem *mem;
>>       const char *mac;
>>       struct macb *bp;
>> -     int err;
>> +     int err, buff;
>
> I would use "val" instead of "buff"
>
>>
>>       regs = platform_get_resource(pdev, IORESOURCE_MEM, 0);
>>       mem = devm_ioremap_resource(&pdev->dev, regs);
>> @@ -3944,6 +3951,18 @@ static int macb_probe(struct platform_device *pdev)
>>       else
>>               dev->max_mtu = ETH_DATA_LEN;
>>
>> +     bp->rx_bd_prefetch = 0;
>> +     bp->tx_bd_prefetch = 0;
>
> No need for zero init since alloc_etherdev_mq() will allocate with
> __GFP_ZERO flag (actually, kvzalloc() will be called)
>
>> +     if (bp->caps & MACB_CAPS_BD_PREFETCH) {
>> +             buff = GEM_BFEXT(RXBD_RDBUFF, gem_readl(bp, DCFG10));
>> +             if (buff)
>> +                     bp->rx_bd_prefetch = 2 << (buff - 1);
>> +
>> +             buff = GEM_BFEXT(TXBD_RDBUFF, gem_readl(bp, DCFG10));
>> +             if (buff)
>> +                     bp->tx_bd_prefetch = 2 << (buff - 1);
>> +     }
>> +
>>       mac = of_get_mac_address(np);
>>       if (mac) {
>>               ether_addr_copy(bp->dev->dev_addr, mac);
>>
>
> With these you can add:
> Reviewed-by: Claudiu Beznea <claudiu.beznea@microchip.com>

Thanks for the review. I'll send a v2 with these changes.

Regards,
Harini

^ permalink raw reply

* [PATCH][net-next] net: limit each hash list length to MAX_GRO_SKBS
From: Li RongQing @ 2018-07-04  8:42 UTC (permalink / raw)
  To: netdev

After commit 07d78363dcff ("net: Convert NAPI gro list into a small hash
table.")' there is 8 hash buckets, which allows more flows to be held for
merging.  but MAX_GRO_SKBS, the total held skb for merging, is 8 skb still,
limit the hash table performance.

keep MAX_GRO_SKBS as 8 skb, but limit each hash list length to 8 skb, not
the total 8 skb

Signed-off-by: Li RongQing <lirongqing@baidu.com>
---
 include/linux/netdevice.h |  7 +++++-
 net/core/dev.c            | 54 +++++++++++++++++++----------------------------
 2 files changed, 28 insertions(+), 33 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index 8bf8d6149f79..3b60ac51ddba 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -302,6 +302,11 @@ struct netdev_boot_setup {
 
 int __init netdev_boot_setup(char *str);
 
+struct gro_list {
+	struct list_head	list;
+	int			count;
+};
+
 /*
  * Structure for NAPI scheduling similar to tasklet but with weighting
  */
@@ -323,7 +328,7 @@ struct napi_struct {
 	int			poll_owner;
 #endif
 	struct net_device	*dev;
-	struct list_head	gro_hash[GRO_HASH_BUCKETS];
+	struct gro_list		gro_hash[GRO_HASH_BUCKETS];
 	struct sk_buff		*skb;
 	struct hrtimer		timer;
 	struct list_head	dev_list;
diff --git a/net/core/dev.c b/net/core/dev.c
index 08d58e0debe5..f8cdc27ee276 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -149,7 +149,6 @@
 
 #include "net-sysfs.h"
 
-/* Instead of increasing this, you should create a hash table. */
 #define MAX_GRO_SKBS 8
 
 /* This should be increased if a protocol with a bigger head is added. */
@@ -4989,10 +4988,11 @@ static int napi_gro_complete(struct sk_buff *skb)
 	return netif_receive_skb_internal(skb);
 }
 
-static void __napi_gro_flush_chain(struct napi_struct *napi, struct list_head *head,
+static void __napi_gro_flush_chain(struct napi_struct *napi, int index,
 				   bool flush_old)
 {
 	struct sk_buff *skb, *p;
+	struct list_head *head = &napi->gro_hash[index].list;
 
 	list_for_each_entry_safe_reverse(skb, p, head, list) {
 		if (flush_old && NAPI_GRO_CB(skb)->age == jiffies)
@@ -5000,10 +5000,11 @@ static void __napi_gro_flush_chain(struct napi_struct *napi, struct list_head *h
 		list_del_init(&skb->list);
 		napi_gro_complete(skb);
 		napi->gro_count--;
+		napi->gro_hash[index].count--;
 	}
 }
 
-/* napi->gro_hash contains packets ordered by age.
+/* napi->gro_hash[].list contains packets ordered by age.
  * youngest packets at the head of it.
  * Complete skbs in reverse order to reduce latencies.
  */
@@ -5011,11 +5012,8 @@ void napi_gro_flush(struct napi_struct *napi, bool flush_old)
 {
 	int i;
 
-	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
-		struct list_head *head = &napi->gro_hash[i];
-
-		__napi_gro_flush_chain(napi, head, flush_old);
-	}
+	for (i = 0; i < GRO_HASH_BUCKETS; i++)
+		__napi_gro_flush_chain(napi, i, flush_old);
 }
 EXPORT_SYMBOL(napi_gro_flush);
 
@@ -5027,7 +5025,7 @@ static struct list_head *gro_list_prepare(struct napi_struct *napi,
 	struct list_head *head;
 	struct sk_buff *p;
 
-	head = &napi->gro_hash[hash & (GRO_HASH_BUCKETS - 1)];
+	head = &napi->gro_hash[hash & (GRO_HASH_BUCKETS - 1)].list;
 	list_for_each_entry(p, head, list) {
 		unsigned long diffs;
 
@@ -5095,27 +5093,13 @@ static void gro_pull_from_frag0(struct sk_buff *skb, int grow)
 	}
 }
 
-static void gro_flush_oldest(struct napi_struct *napi)
+static void gro_flush_oldest(struct list_head *head)
 {
-	struct sk_buff *oldest = NULL;
-	unsigned long age = jiffies;
-	int i;
+	struct sk_buff *oldest;
 
-	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
-		struct list_head *head = &napi->gro_hash[i];
-		struct sk_buff *skb;
+	oldest = list_last_entry(head, struct sk_buff, list);
 
-		if (list_empty(head))
-			continue;
-
-		skb = list_last_entry(head, struct sk_buff, list);
-		if (!oldest || time_before(NAPI_GRO_CB(skb)->age, age)) {
-			oldest = skb;
-			age = NAPI_GRO_CB(skb)->age;
-		}
-	}
-
-	/* We are called with napi->gro_count >= MAX_GRO_SKBS, so this is
+	/* We are called with head length >= MAX_GRO_SKBS, so this is
 	 * impossible.
 	 */
 	if (WARN_ON_ONCE(!oldest))
@@ -5138,6 +5122,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 	enum gro_result ret;
 	int same_flow;
 	int grow;
+	u32 hash = skb_get_hash_raw(skb) & (GRO_HASH_BUCKETS - 1);
 
 	if (netif_elide_gro(skb->dev))
 		goto normal;
@@ -5196,6 +5181,7 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 		list_del_init(&pp->list);
 		napi_gro_complete(pp);
 		napi->gro_count--;
+		napi->gro_hash[hash].count--;
 	}
 
 	if (same_flow)
@@ -5204,10 +5190,11 @@ static enum gro_result dev_gro_receive(struct napi_struct *napi, struct sk_buff
 	if (NAPI_GRO_CB(skb)->flush)
 		goto normal;
 
-	if (unlikely(napi->gro_count >= MAX_GRO_SKBS)) {
-		gro_flush_oldest(napi);
+	if (unlikely(napi->gro_hash[hash].count >= MAX_GRO_SKBS)) {
+		gro_flush_oldest(gro_head);
 	} else {
 		napi->gro_count++;
+		napi->gro_hash[hash].count--;
 	}
 	NAPI_GRO_CB(skb)->count = 1;
 	NAPI_GRO_CB(skb)->age = jiffies;
@@ -5844,8 +5831,10 @@ void netif_napi_add(struct net_device *dev, struct napi_struct *napi,
 	hrtimer_init(&napi->timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL_PINNED);
 	napi->timer.function = napi_watchdog;
 	napi->gro_count = 0;
-	for (i = 0; i < GRO_HASH_BUCKETS; i++)
-		INIT_LIST_HEAD(&napi->gro_hash[i]);
+	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
+		INIT_LIST_HEAD(&napi->gro_hash[i].list);
+		napi->gro_hash[i].count = 0;
+	}
 	napi->skb = NULL;
 	napi->poll = poll;
 	if (weight > NAPI_POLL_WEIGHT)
@@ -5885,8 +5874,9 @@ static void flush_gro_hash(struct napi_struct *napi)
 	for (i = 0; i < GRO_HASH_BUCKETS; i++) {
 		struct sk_buff *skb, *n;
 
-		list_for_each_entry_safe(skb, n, &napi->gro_hash[i], list)
+		list_for_each_entry_safe(skb, n, &napi->gro_hash[i].list, list)
 			kfree_skb(skb);
+		napi->gro_hash[i].count = 0;
 	}
 }
 
-- 
2.16.2

^ permalink raw reply related

* Re: [PATCH v4 08/18] net: davinci_emac: potentially get the MAC address from MTD
From: Sekhar Nori @ 2018-07-04  9:04 UTC (permalink / raw)
  To: Bartosz Golaszewski, Ladislav Michl
  Cc: Rob Herring, Grygorii Strashko, David Lechner, Ivan Khoronzhuk,
	Kevin Hilman, Greg Kroah-Hartman, Jonathan Corbet, Russell King,
	Linux Kernel Mailing List, Andrew Lunn, Bartosz Golaszewski,
	Florian Fainelli, Srinivas Kandagatla, Linux ARM, netdev,
	Lukas Wunner, linux-omap, David S . Miller, Dan Carpenter
In-Reply-To: <CAMRc=McOYG9=naT2=4c4hnhJwxcqBCATEZOGXXv9u9zuvXyDXw@mail.gmail.com>

On Wednesday 04 July 2018 01:59 PM, Bartosz Golaszewski wrote:
> 2018-07-04 9:09 GMT+02:00 Ladislav Michl <ladis@linux-mips.org>:
>> On Tue, Jul 03, 2018 at 09:39:51AM -0700, Florian Fainelli wrote:
>>>
>>>
>>> On 06/29/2018 02:40 AM, Bartosz Golaszewski wrote:
>>>> From: Bartosz Golaszewski <bgolaszewski@baylibre.com>
>>>>
>>>> On da850-evm board we can read the MAC address from MTD. It's currently
>>>> done in the relevant board file, but we want to get rid of all the MAC
>>>> reading callbacks from the board file (SPI and NAND). Move the reading
>>>> of the MAC address from SPI to the emac driver's probe function.
>>>
>>> This should be made something generic to all drivers, not just something
>>> the davinci_emac driver does, something like this actually:
>>>
>>> https://lkml.org/lkml/2018/3/24/312
>>
>> ...and that's would also make it work when MAC address is stored
>> in 24c08 EEPROM, which is quite common.
>>
> 
> This is what the second patch for davinci_emac in this series does. I
> agree that this should become more generic at some point - we should
> probably have a routine somewhere in net that would try to get the MAC
> address from all possible sources (nvmem, of etc.). This is somewhat
> related to the work I want to do on nvmem to make the at24 setup()
> callback more generic.
> 
> Unfortunately we don't have it yet and I will not have time to work on
> it before v4.20 so if there are no serious objections, I'd like to get
> this series merged for v4.19 and then we can refactor the MAC reading
> later.
> 
> How does it sound?

I don't think the series introduces any regressions. We need to have MTD
and SPI flash built into the kernel even today to get mac address on
DA850 EVM. So from that perspective, I don't have objections (I need to
actually test still).

OTOH, it will be nice to do the conversion once and not piecemeal. That
way there is less churn and scope for regressions.

So from a mach-davinci perspective, I don't have a very strong position
either way.

Thanks,
Sekhar

^ permalink raw reply

* Re: [PATCH net-next v5 3/4] net: vhost: factor out busy polling logic to vhost_net_busy_poll()
From: Jason Wang @ 2018-07-04  9:18 UTC (permalink / raw)
  To: Toshiaki Makita, xiangxia.m.yue
  Cc: netdev, virtualization, Tonghao Zhang, mst
In-Reply-To: <808dea9b-6240-8055-acaa-a1b96389a673@lab.ntt.co.jp>



On 2018年07月04日 15:59, Toshiaki Makita wrote:
> On 2018/07/04 13:31, xiangxia.m.yue@gmail.com wrote:
> ...
>> +static void vhost_net_busy_poll(struct vhost_net *net,
>> +				struct vhost_virtqueue *rvq,
>> +				struct vhost_virtqueue *tvq,
>> +				bool rx)
>> +{
>> +	unsigned long uninitialized_var(endtime);
>> +	unsigned long busyloop_timeout;
>> +	struct socket *sock;
>> +	struct vhost_virtqueue *vq = rx ? tvq : rvq;
>> +
>> +	mutex_lock_nested(&vq->mutex, rx ? VHOST_NET_VQ_TX: VHOST_NET_VQ_RX);
>> +
>> +	vhost_disable_notify(&net->dev, vq);
>> +	sock = rvq->private_data;
>> +	busyloop_timeout = rx ? rvq->busyloop_timeout : tvq->busyloop_timeout;
>> +
>> +	preempt_disable();
>> +	endtime = busy_clock() + busyloop_timeout;
>> +	while (vhost_can_busy_poll(tvq->dev, endtime) &&
>> +	       !(sock && sk_has_rx_data(sock->sk)) &&
>> +	       vhost_vq_avail_empty(tvq->dev, tvq))
>> +		cpu_relax();
>> +	preempt_enable();
>> +
>> +	if ((rx && !vhost_vq_avail_empty(&net->dev, vq)) ||
>> +	    (!rx && (sock && sk_has_rx_data(sock->sk)))) {
>> +		vhost_poll_queue(&vq->poll);
>> +	} else if (vhost_enable_notify(&net->dev, vq) && rx) {
> Hmm... on tx here sock has no rx data, so you are waiting for sock
> wakeup for rx and vhost_enable_notify() seems not needed. Do you want
> this actually?
>
> } else if (rx && vhost_enable_notify(&net->dev, vq)) {

Right, rx need to be checked first here.

Thanks

>> +		vhost_disable_notify(&net->dev, vq);
>> +		vhost_poll_queue(&vq->poll);
>> +	}

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox