I want to get permanent MAC address when the interface is down. And I think
it is more convenient to get statistics in the down state by 'ethtool -S'.
But current all of the ethool command return -EBUSY.
I don't think we should check that the network interface is up in '.begin',
which will cause that all the ethtool commands can't be used when the
network interface is down. If some ethtool commands can only be used in the
up state, check it in the corresponding ethool OPS function is better.
This is too rude and unreasonable.
Compile-tested on arm64. Tested on an arm64 system with an on-board
STMMAC chip.
Changes v7 ... v8:
- Optimize commit description information, optimization parameters of
pm_runtime function.
Changes v6 ... v7:
- fix arg type error of 'dev' to 'priv->device'.
Changes v5 ... v6:
- The 4.19.90 kernel not support pm_runtime, so implemente '.begin' and
'.complete' again. Add return value check of pm_runtime function.
Changes v4 ... v5:
- test the '.begin' will return -13 error on my machine based on 4.19.90
kernel. The platform driver does not supported pm_runtime. So remove the
implementation of '.begin' and '.complete'.
Changes v3 ... v4:
- implement '.complete' ethtool OPS.
Changes v2 ... v3:
- add linux/pm_runtime.h head file.
Changes v1 ... v2:
- fix spell error of dev.
Signed-off-by: Hao Chen <redacted>
---
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
I want to get permanent MAC address when the interface is down. And I think
it is more convenient to get statistics in the down state by 'ethtool -S'.
But current all of the ethool command return -EBUSY.
I don't think we should check that the network interface is up in '.begin',
which will cause that all the ethtool commands can't be used when the
network interface is down. If some ethtool commands can only be used in the
up state, check it in the corresponding ethool OPS function is better.
This is too rude and unreasonable.
Compile-tested on arm64. Tested on an arm64 system with an on-board
STMMAC chip.
I doubt it's compile-tested, at least not with rpm enabled.
See comment below.
quoted hunk
Changes v7 ... v8:
- Optimize commit description information, optimization parameters of
pm_runtime function.
Changes v6 ... v7:
- fix arg type error of 'dev' to 'priv->device'.
Changes v5 ... v6:
- The 4.19.90 kernel not support pm_runtime, so implemente '.begin' and
'.complete' again. Add return value check of pm_runtime function.
Changes v4 ... v5:
- test the '.begin' will return -13 error on my machine based on 4.19.90
kernel. The platform driver does not supported pm_runtime. So remove the
implementation of '.begin' and '.complete'.
Changes v3 ... v4:
- implement '.complete' ethtool OPS.
Changes v2 ... v3:
- add linux/pm_runtime.h head file.
Changes v1 ... v2:
- fix spell error of dev.
Signed-off-by: Hao Chen <redacted>
---
.../ethernet/stmicro/stmmac/stmmac_ethtool.c | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:416:35: error: passing 'struct device' to parameter of incompatible type 'struct device *'; take the address with &
return pm_runtime_resume_and_get(dev->dev);
^~~~~~~~
&
include/linux/pm_runtime.h:400:60: note: passing argument to parameter 'dev' here
static inline int pm_runtime_resume_and_get(struct device *dev)
^
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:421:17: error: passing 'struct device' to parameter of incompatible type 'struct device *'; take the address with &
pm_runtime_put(dev->dev);
^~~~~~~~
&
include/linux/pm_runtime.h:420:49: note: passing argument to parameter 'dev' here
static inline int pm_runtime_put(struct device *dev)
^
1 warning and 2 errors generated.
vim +416 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
413
414 static int stmmac_ethtool_begin(struct net_device *dev)
415 {
> 416 return pm_runtime_resume_and_get(dev->dev);
417 }
418
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:416:38: error: incompatible type for argument 1 of 'pm_runtime_resume_and_get'
416 | return pm_runtime_resume_and_get(dev->dev);
| ~~~^~~~~
| |
| struct device
In file included from drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:17:
include/linux/pm_runtime.h:400:60: note: expected 'struct device *' but argument is of type 'struct device'
400 | static inline int pm_runtime_resume_and_get(struct device *dev)
| ~~~~~~~~~~~~~~~^~~
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c: In function 'stmmac_ethtool_complete':
quoted
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:421:20: error: incompatible type for argument 1 of 'pm_runtime_put'
421 | pm_runtime_put(dev->dev);
| ~~~^~~~~
| |
| struct device
In file included from drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:17:
include/linux/pm_runtime.h:420:49: note: expected 'struct device *' but argument is of type 'struct device'
420 | static inline int pm_runtime_put(struct device *dev)
| ~~~~~~~~~~~~~~~^~~
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c: In function 'stmmac_ethtool_begin':
drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c:417:1: error: control reaches end of non-void function [-Werror=return-type]
417 | }
| ^
cc1: some warnings being treated as errors
vim +/pm_runtime_resume_and_get +416 drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c
413
414 static int stmmac_ethtool_begin(struct net_device *dev)
415 {
> 416 return pm_runtime_resume_and_get(dev->dev);
417 }
418
419 static void stmmac_ethtool_complete(struct net_device *dev)
420 {
> 421 pm_runtime_put(dev->dev);
422 }
423
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org