diff mbox series

[OpenWrt-Devel,PATCHv2,1/2] ramips: ethernet: Fix NAPI weight for non mt7621 devices

Message ID 20191029172328.85861-1-rosenp@gmail.com
State Changes Requested
Delegated to: Petr Štetiar
Headers show
Series [OpenWrt-Devel,PATCHv2,1/2] ramips: ethernet: Fix NAPI weight for non mt7621 devices | expand

Commit Message

Rosen Penev Oct. 29, 2019, 5:23 p.m. UTC
My original fix was to make the code do 16 * 4 as 64 is the limit for NAPI
weight. However this also reduces the weight for non mt7621 devices.

Changed the multiplier to 2 instead.

Fixes: dcdc2880b6

Signed-off-by: Rosen Penev <rosenp@gmail.com>
---
 v2: Added Fixes comment.
 .../drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Comments

Petr Štetiar Feb. 11, 2020, 6:48 p.m. UTC | #1
Rosen Penev <rosenp@gmail.com> [2019-10-29 10:23:27]:

> My original fix was to make the code do 16 * 4 as 64 is the limit for NAPI
> weight. However this also reduces the weight for non mt7621 devices.
> 
> Changed the multiplier to 2 instead.
> 
> Fixes: dcdc2880b6
> 
> Signed-off-by: Rosen Penev <rosenp@gmail.com>
> ---
>  v2: Added Fixes comment.
>  .../drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 8 ++++----
>  1 file changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> index 00e84bbcfb..91974a461c 100644
> --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> @@ -1663,11 +1663,11 @@ static int fe_probe(struct platform_device *pdev)
>  	INIT_WORK(&priv->pending_work, fe_pending_work);
>  	u64_stats_init(&priv->hw_stats->syncp);
>  
> -	napi_weight = 16;
> +	napi_weight = 32;
>  	if (priv->flags & FE_FLAG_NAPI_WEIGHT) {
> -		napi_weight *= 4;
> +		napi_weight *= 2;

Above changes makes sense and corresponds with the commit description and with
change in commit dcdc2880b605 ("ramips: reduce napi_weight in the ethernet
driver.")

> -		priv->tx_ring.tx_ring_size *= 4;
> -		priv->rx_ring.rx_ring_size *= 4;
> +		priv->tx_ring.tx_ring_size *= 2;
> +		priv->rx_ring.rx_ring_size *= 2;

This changes don't.

-- ynezz
Rosen Penev Feb. 11, 2020, 8:56 p.m. UTC | #2
On Tue, Feb 11, 2020 at 10:48 AM Petr Štetiar <ynezz@true.cz> wrote:
>
> Rosen Penev <rosenp@gmail.com> [2019-10-29 10:23:27]:
>
> > My original fix was to make the code do 16 * 4 as 64 is the limit for NAPI
> > weight. However this also reduces the weight for non mt7621 devices.
> >
> > Changed the multiplier to 2 instead.
> >
> > Fixes: dcdc2880b6
> >
> > Signed-off-by: Rosen Penev <rosenp@gmail.com>
> > ---
> >  v2: Added Fixes comment.
> >  .../drivers/net/ethernet/mediatek/mtk_eth_soc.c           | 8 ++++----
> >  1 file changed, 4 insertions(+), 4 deletions(-)
> >
> > diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > index 00e84bbcfb..91974a461c 100644
> > --- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > +++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
> > @@ -1663,11 +1663,11 @@ static int fe_probe(struct platform_device *pdev)
> >       INIT_WORK(&priv->pending_work, fe_pending_work);
> >       u64_stats_init(&priv->hw_stats->syncp);
> >
> > -     napi_weight = 16;
> > +     napi_weight = 32;
> >       if (priv->flags & FE_FLAG_NAPI_WEIGHT) {
> > -             napi_weight *= 4;
> > +             napi_weight *= 2;
>
> Above changes makes sense and corresponds with the commit description and with
> change in commit dcdc2880b605 ("ramips: reduce napi_weight in the ethernet
> driver.")
>
> > -             priv->tx_ring.tx_ring_size *= 4;
> > -             priv->rx_ring.rx_ring_size *= 4;
> > +             priv->tx_ring.tx_ring_size *= 2;
> > +             priv->rx_ring.rx_ring_size *= 2;
i don't have the hardware anymore, but I remember the sizes being excessive.

The code says this gets assigned to BIT(10), which seems excessive...
>
> This changes don't.
>
> -- ynezz
diff mbox series

Patch

diff --git a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
index 00e84bbcfb..91974a461c 100644
--- a/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
+++ b/target/linux/ramips/files-4.14/drivers/net/ethernet/mediatek/mtk_eth_soc.c
@@ -1663,11 +1663,11 @@  static int fe_probe(struct platform_device *pdev)
 	INIT_WORK(&priv->pending_work, fe_pending_work);
 	u64_stats_init(&priv->hw_stats->syncp);
 
-	napi_weight = 16;
+	napi_weight = 32;
 	if (priv->flags & FE_FLAG_NAPI_WEIGHT) {
-		napi_weight *= 4;
-		priv->tx_ring.tx_ring_size *= 4;
-		priv->rx_ring.rx_ring_size *= 4;
+		napi_weight *= 2;
+		priv->tx_ring.tx_ring_size *= 2;
+		priv->rx_ring.rx_ring_size *= 2;
 	}
 	netif_napi_add(netdev, &priv->rx_napi, fe_poll, napi_weight);
 	fe_set_ethtool_ops(netdev);