* [PATCH net] net: fec: validate the new settings in fec_enet_set_coalesce()
@ 2020-03-11 3:36 Jakub Kicinski
2020-03-11 3:47 ` [EXT] " Andy Duan
2020-03-12 5:42 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Jakub Kicinski @ 2020-03-11 3:36 UTC (permalink / raw)
To: davem; +Cc: netdev, fugang.duan, frank.li, Jakub Kicinski
fec_enet_set_coalesce() validates the previously set params
and if they are within range proceeds to apply the new ones.
The new ones, however, are not validated. This seems backwards,
probably a copy-paste error?
Compile tested only.
Fixes: d851b47b22fc ("net: fec: add interrupt coalescence feature support")
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
drivers/net/ethernet/freescale/fec_main.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/drivers/net/ethernet/freescale/fec_main.c b/drivers/net/ethernet/freescale/fec_main.c
index 4432a59904c7..23c5fef2f1ad 100644
--- a/drivers/net/ethernet/freescale/fec_main.c
+++ b/drivers/net/ethernet/freescale/fec_main.c
@@ -2529,15 +2529,15 @@ fec_enet_set_coalesce(struct net_device *ndev, struct ethtool_coalesce *ec)
return -EINVAL;
}
- cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr);
+ cycle = fec_enet_us_to_itr_clock(ndev, ec->rx_coalesce_usecs);
if (cycle > 0xFFFF) {
dev_err(dev, "Rx coalesced usec exceed hardware limitation\n");
return -EINVAL;
}
- cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr);
+ cycle = fec_enet_us_to_itr_clock(ndev, ec->tx_coalesce_usecs);
if (cycle > 0xFFFF) {
- dev_err(dev, "Rx coalesced usec exceed hardware limitation\n");
+ dev_err(dev, "Tx coalesced usec exceed hardware limitation\n");
return -EINVAL;
}
--
2.24.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [EXT] [PATCH net] net: fec: validate the new settings in fec_enet_set_coalesce()
2020-03-11 3:36 [PATCH net] net: fec: validate the new settings in fec_enet_set_coalesce() Jakub Kicinski
@ 2020-03-11 3:47 ` Andy Duan
2020-03-12 5:42 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Andy Duan @ 2020-03-11 3:47 UTC (permalink / raw)
To: Jakub Kicinski, davem; +Cc: netdev, Frank Li
From: netdev-owner@vger.kernel.org <netdev-owner@vger.kernel.org> On Behalf Of Jakub Kicinski
> fec_enet_set_coalesce() validates the previously set params and if they are
> within range proceeds to apply the new ones.
> The new ones, however, are not validated. This seems backwards, probably a
> copy-paste error?
>
> Compile tested only.
>
> Fixes: d851b47b22fc ("net: fec: add interrupt coalescence feature support")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Good catch, parameters range checking doesn't impact function, so it should be copy-paste error.
Acked-by: Fugang Duan <fugang.duan@nxp.com>
> ---
> drivers/net/ethernet/freescale/fec_main.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/net/ethernet/freescale/fec_main.c
> b/drivers/net/ethernet/freescale/fec_main.c
> index 4432a59904c7..23c5fef2f1ad 100644
> --- a/drivers/net/ethernet/freescale/fec_main.c
> +++ b/drivers/net/ethernet/freescale/fec_main.c
> @@ -2529,15 +2529,15 @@ fec_enet_set_coalesce(struct net_device *ndev,
> struct ethtool_coalesce *ec)
> return -EINVAL;
> }
>
> - cycle = fec_enet_us_to_itr_clock(ndev, fep->rx_time_itr);
> + cycle = fec_enet_us_to_itr_clock(ndev, ec->rx_coalesce_usecs);
> if (cycle > 0xFFFF) {
> dev_err(dev, "Rx coalesced usec exceed hardware
> limitation\n");
> return -EINVAL;
> }
>
> - cycle = fec_enet_us_to_itr_clock(ndev, fep->tx_time_itr);
> + cycle = fec_enet_us_to_itr_clock(ndev, ec->tx_coalesce_usecs);
> if (cycle > 0xFFFF) {
> - dev_err(dev, "Rx coalesced usec exceed hardware
> limitation\n");
> + dev_err(dev, "Tx coalesced usec exceed hardware
> + limitation\n");
> return -EINVAL;
> }
>
> --
> 2.24.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] net: fec: validate the new settings in fec_enet_set_coalesce()
2020-03-11 3:36 [PATCH net] net: fec: validate the new settings in fec_enet_set_coalesce() Jakub Kicinski
2020-03-11 3:47 ` [EXT] " Andy Duan
@ 2020-03-12 5:42 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2020-03-12 5:42 UTC (permalink / raw)
To: kuba; +Cc: netdev, fugang.duan, frank.li
From: Jakub Kicinski <kuba@kernel.org>
Date: Tue, 10 Mar 2020 20:36:16 -0700
> fec_enet_set_coalesce() validates the previously set params
> and if they are within range proceeds to apply the new ones.
> The new ones, however, are not validated. This seems backwards,
> probably a copy-paste error?
>
> Compile tested only.
>
> Fixes: d851b47b22fc ("net: fec: add interrupt coalescence feature support")
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-03-12 5:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-11 3:36 [PATCH net] net: fec: validate the new settings in fec_enet_set_coalesce() Jakub Kicinski
2020-03-11 3:47 ` [EXT] " Andy Duan
2020-03-12 5:42 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).