Re: [PATCH v2 1/9] riscv: add __init section marker to some functions

2021-04-11 Thread Jisheng Zhang
On Fri, 2 Apr 2021 09:38:02 +0530 Anup Patel wrote: > > > On Wed, Mar 31, 2021 at 10:00 PM Jisheng Zhang > wrote: > > > > From: Jisheng Zhang > > > > They are not needed after booting, so mark them as __init to move them > > to the __init sec

[PATCH v2 9/9] riscv: Set ARCH_HAS_STRICT_MODULE_RWX if MMU

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang Now we can set ARCH_HAS_STRICT_MODULE_RWX for MMU riscv platforms, this is good from security perspective. Signed-off-by: Jisheng Zhang --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 87d7b52f278f

[PATCH v2 8/9] riscv: module: Create module allocations without exec permissions

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang The core code manages the executable permissions of code regions of modules explicitly, it is not necessary to create the module vmalloc regions with RWX permissions. Create them with RW- permissions instead. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/module.c | 10

[PATCH v2 7/9] riscv: bpf: Avoid breaking W^X on RV64

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang bpf_jit_binary_lock_ro() in core not only set RO but also set EXEC permission when JIT is done, so no need to allocate RWX from the beginning, and it's not safe. Signed-off-by: Jisheng Zhang --- arch/riscv/net/bpf_jit_comp64.c | 2 +- 1 file changed, 1 insertion(

[PATCH v2 6/9] riscv: bpf: Write protect JIT code

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang Call bpf_jit_binary_lock_ro() to write protect JIT code. Signed-off-by: Jisheng Zhang --- arch/riscv/net/bpf_jit_core.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/net/bpf_jit_core.c b/arch/riscv/net/bpf_jit_core.c index 3630d447352c..40d5bf113fee 100644

[PATCH v2 5/9] riscv: kprobes: Implement alloc_insn_page()

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang Allocate PAGE_KERNEL_READ_EXEC(read only, executable) page for kprobes insn page. This is to prepare for STRICT_MODULE_RWX. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/probes/kprobes.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/riscv/kernel

[PATCH v2 4/9] riscv: Constify sbi_ipi_ops

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang Constify the sbi_ipi_ops so that it will be placed in the .rodata section. This will cause attempts to modify it to fail when strict page permissions are in place. Signed-off-by: Jisheng Zhang --- arch/riscv/include/asm/smp.h | 4 ++-- arch/riscv/kernel/sbi.c | 2

[PATCH v2 3/9] riscv: Constify sys_call_table

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang Constify the sys_call_table so that it will be placed in the .rodata section. This will cause attempts to modify the table to fail when strict page permissions are in place. Signed-off-by: Jisheng Zhang --- arch/riscv/include/asm/syscall.h | 2 +- arch/riscv/kernel

[PATCH v2 2/9] riscv: Mark some global variables __ro_after_init

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang All of these are never modified after init, so they can be __ro_after_init. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/sbi.c | 8 arch/riscv/kernel/smp.c | 4 ++-- arch/riscv/kernel/time.c | 2 +- arch/riscv/kernel/vdso.c | 4 ++-- arch/riscv/mm/init.c

[PATCH v2 1/9] riscv: add __init section marker to some functions

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang They are not needed after booting, so mark them as __init to move them to the __init section. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/traps.c | 2 +- arch/riscv/mm/init.c | 6 +++--- arch/riscv/mm/kasan_init.c | 6 +++--- arch/riscv/mm/ptdump.c | 2

[PATCH v2 0/9] riscv: improve self-protection

2021-03-31 Thread Jisheng Zhang
From: Jisheng Zhang patch1 is a trivial improvement patch to move some functions to .init section Then following patches improve self-protection by: Marking some variables __ro_after_init Constifing some variables Enabling ARCH_HAS_STRICT_MODULE_RWX Since v1: - no need to move

[PATCH 9/9] riscv: Set ARCH_HAS_STRICT_MODULE_RWX if MMU

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang Now we can set ARCH_HAS_STRICT_MODULE_RWX for MMU riscv platforms, this is good from security perspective. Signed-off-by: Jisheng Zhang --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 87d7b52f278f

[PATCH 8/9] riscv: module: Create module allocations without exec permissions

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang The core code manages the executable permissions of code regions of modules explicitly, it is not necessary to create the module vmalloc regions with RWX permissions. Create them with RW- permissions instead. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/module.c | 2

[PATCH 7/9] riscv: bpf: Avoid breaking W^X

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang We allocate Non-executable pages, then call bpf_jit_binary_lock_ro() to enable executable permission after mapping them read-only. This is to prepare for STRICT_MODULE_RWX in following patch. Signed-off-by: Jisheng Zhang --- arch/riscv/net/bpf_jit_core.c | 3 ++- 1 file

[PATCH 6/9] riscv: bpf: Move bpf_jit_alloc_exec() and bpf_jit_free_exec() to core

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang We will drop the executable permissions of the code pages from the mapping at allocation time soon. Move bpf_jit_alloc_exec() and bpf_jit_free_exec() to bpf_jit_core.c so that they can be shared by both RV64I and RV32I. Signed-off-by: Jisheng Zhang --- arch/riscv/net

[PATCH 5/9] riscv: kprobes: Implement alloc_insn_page()

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang Allocate PAGE_KERNEL_READ_EXEC(read only, executable) page for kprobes insn page. This is to prepare for STRICT_MODULE_RWX. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/probes/kprobes.c | 8 1 file changed, 8 insertions(+) diff --git a/arch/riscv/kernel

[PATCH 4/9] riscv: Constify sbi_ipi_ops

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang Constify the sbi_ipi_ops so that it will be placed in the .rodata section. This will cause attempts to modify it to fail when strict page permissions are in place. Signed-off-by: Jisheng Zhang --- arch/riscv/include/asm/smp.h | 4 ++-- arch/riscv/kernel/sbi.c | 2

[PATCH 3/9] riscv: Constify sys_call_table

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang Constify the sys_call_table so that it will be placed in the .rodata section. This will cause attempts to modify the table to fail when strict page permissions are in place. Signed-off-by: Jisheng Zhang --- arch/riscv/include/asm/syscall.h | 2 +- arch/riscv/kernel

[PATCH 2/9] riscv: Mark some global variables __ro_after_init

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang All of these are never modified after init, so they can be __ro_after_init. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/sbi.c | 8 arch/riscv/kernel/smp.c | 4 ++-- arch/riscv/kernel/time.c | 2 +- arch/riscv/kernel/vdso.c | 4 ++-- arch/riscv/mm/init.c

[PATCH 1/9] riscv: add __init section marker to some functions

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang They are not needed after booting, so mark them as __init to move them to the __init section. Signed-off-by: Jisheng Zhang --- arch/riscv/kernel/traps.c | 2 +- arch/riscv/mm/init.c | 6 +++--- arch/riscv/mm/kasan_init.c | 6 +++--- arch/riscv/mm/ptdump.c | 2

[PATCH 0/9] riscv: improve self-protection

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang patch1 is a trivial improvement patch to move some functions to .init section Then following patches improve self-protection by: Marking some variables __ro_after_init Constifing some variables Enabling ARCH_HAS_STRICT_MODULE_RWX Jisheng Zhang (9): riscv: add __init

[PATCH] selftests/bpf: add LDFLAGS when building test_verifier

2021-03-29 Thread Jisheng Zhang
From: Jisheng Zhang This is useful for cross compile process to point linker to the correct libelf, libcap, libz path. Signed-off-by: Jisheng Zhang --- tools/testing/selftests/bpf/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/testing/selftests/bpf/Makefile

Re: [PATCH] net: 9p: free what was emitted when read count is 0

2021-03-02 Thread Jisheng Zhang
On Tue, 2 Mar 2021 17:08:13 +0900 Dominique Martinet wrote: > > > Jisheng Zhang wrote on Tue, Mar 02, 2021 at 03:39:40PM +0800: > > > Rather than make an exception for 0, how about just removing the if as > > > follow ? > > > > IMHO, we may need to kee

[PATCH v2] net: 9p: advance iov on empty read

2021-03-02 Thread Jisheng Zhang
] R13: 0001 R14: 0001 R15: [8.295782] ---[ end trace 63317af81b3ca24b ]--- Signed-off-by: Jisheng Zhang --- Since v1: - reword the commit msg - fix the issue by removing exception for 0 code path, thank Dominique! net/9p/client.c | 4 1 file ch

Re: [PATCH] net: 9p: free what was emitted when read count is 0

2021-03-02 Thread Jisheng Zhang
On Tue, 2 Mar 2021 13:38:08 +0900 Dominique Martinet wrote: > > > Jisheng Zhang wrote on Mon, Mar 01, 2021 at 11:01:57AM +0800: > > Per my understanding of iov_iter, we need to call iov_iter_advance() > > even when the read out count is 0. I believe we can see this common

Re: [PATCH] net: 9p: free what was emitted when read count is 0

2021-02-28 Thread Jisheng Zhang
On Mon, 1 Mar 2021 11:51:24 +0900 Dominique Martinet wrote: > > > Jisheng Zhang wrote on Mon, Mar 01, 2021 at 10:33:36AM +0800: > > I met below warning when cating a small size(about 80bytes) txt file > > on 9pfs(msize=2097152 is passed to 9p mount option), the

[PATCH] net: 9p: free what was emitted when read count is 0

2021-02-28 Thread Jisheng Zhang
001 R15: [8.295782] ---[ end trace 63317af81b3ca24b ]--- Signed-off-by: Jisheng Zhang --- net/9p/client.c | 1 + 1 file changed, 1 insertion(+) diff --git a/net/9p/client.c b/net/9p/client.c index 4f62f299da0c..6dc01008cd3b 100644 --- a/net/9p/client.c +++ b/net/9p/clie

Re: [PATCH v2 16/24] net: stmmac: Use optional reset control API to work with stmmaceth

2021-02-09 Thread Jisheng Zhang
Hi, On Mon, 8 Feb 2021 16:56:00 +0300 Serge Semin wrote: > > Since commit bb3222f71b57 ("net: stmmac: platform: use optional clk/reset > get APIs") a manual implementation of the optional device reset control > functionality has been replaced with using the > devm_reset_control_get_optional() m

Re: [PATCH RFC] ethernet: stmmac: clean up the code for release/suspend/resume function

2020-12-10 Thread Jisheng Zhang
On Tue, 8 Dec 2020 10:49:03 + Joakim Zhang wrote: > > > > -Original Message- > > From: Jisheng Zhang > > Sent: 2020年12月8日 18:24 > > To: Joakim Zhang > > Cc: peppe.cavall...@st.com; alexandre.tor...@st.com; > > joab...@synopsys.com; da...@

Re: [PATCH RFC] ethernet: stmmac: clean up the code for release/suspend/resume function

2020-12-08 Thread Jisheng Zhang
On Mon, 7 Dec 2020 19:38:49 +0800 Joakim Zhang wrote: > > commit 1c35cc9cf6a0 ("net: stmmac: remove redundant null check before > clk_disable_unprepare()"), > have not clean up check NULL clock parameter completely, this patch did it. > > commit e8377e7a29efb ("net: stmmac: only call pmt() du

[PATCH] mwifiex: Remove duplicated REG_PORT definition

2020-11-18 Thread Jisheng Zhang
The REG_PORT is defined twice, so remove one of them. Signed-off-by: Jisheng Zhang --- drivers/net/wireless/marvell/mwifiex/sdio.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/net/wireless/marvell/mwifiex/sdio.h b/drivers/net/wireless/marvell/mwifiex/sdio.h index dec534a6ddb1

[PATCH] net: stmmac: dwmac_lib: enlarge dma reset timeout

2020-11-12 Thread Jisheng Zhang
If the phy enables power saving technology, the dwmac's software reset needs more time to complete, enlarge dma reset timeout to 20us. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/dwmac_lib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dr

[PATCH v2 net-next] net: stmmac: platform: use optional clk/reset get APIs

2020-11-11 Thread Jisheng Zhang
Use the devm_reset_control_get_optional() and devm_clk_get_optional() rather than open coding them. Signed-off-by: Jisheng Zhang --- Since v1: - keep wrapped as suggested by Jakub .../ethernet/stmicro/stmmac/stmmac_platform.c | 22 --- 1 file changed, 9 insertions(+), 13

Re: [PATCH net-next] net: stmmac: platform: use optional clk/reset get APIs

2020-11-10 Thread Jisheng Zhang
On Mon, 9 Nov 2020 11:57:13 -0800 Jakub Kicinski wrote: > > > On Mon, 9 Nov 2020 16:09:10 +0800 Jisheng Zhang wrote: > > @@ -596,14 +595,10 @@ stmmac_probe_config_dt(struct platform_device *pdev, > > const char **mac) > > dev_dbg(&pdev->dev, &

[PATCH net-next] net: stmmac: platform: use optional clk/reset get APIs

2020-11-09 Thread Jisheng Zhang
Use the devm_reset_control_get_optional() and devm_clk_get_optional() rather than open coding them. Signed-off-by: Jisheng Zhang --- .../ethernet/stmicro/stmmac/stmmac_platform.c | 21 +++ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/drivers/net/ethernet

[PATCH net-next] net: stmmac: dwc-qos: Change the dwc_eth_dwmac_data's .probe prototype

2020-11-09 Thread Jisheng Zhang
The return pointer of dwc_eth_dwmac_data's .probe isn't used, and "probe" usually return int, so change the prototype to follow standard way. Secondly, it can simplify the tegra_eqos_probe() code. Signed-off-by: Jisheng Zhang --- .../stmicro/stmmac/dwmac-dwc-q

[PATCH net-next] net: phy: microchip_t1: Don't set .config_aneg

2020-11-08 Thread Jisheng Zhang
The .config_aneg in microchip_t1 is genphy_config_aneg, so it's not needed, because the phy core will call genphy_config_aneg() if the .config_aneg is NULL. Signed-off-by: Jisheng Zhang --- drivers/net/phy/microchip_t1.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/ne

Re: [RFC] net: phy: add shutdown hook to struct phy_driver

2020-10-06 Thread Jisheng Zhang
On Tue, 6 Oct 2020 07:45:10 +0200 Heiner Kallweit wrote: > > On 05.10.2020 18:00, Florian Fainelli wrote: > > > > > > On 10/5/2020 8:54 AM, Heiner Kallweit wrote: > >> On 05.10.2020 17:41, Florian Fainelli wrote: > >>> > >>> > &g

[PATCH] net: phy: marvell: Use phy_read_paged() instead of open coding it

2020-10-05 Thread Jisheng Zhang
Convert m88e1318_get_wol() to use the well implemented phy_read_paged() instead of open coding it. Signed-off-by: Jisheng Zhang --- drivers/net/phy/marvell.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c

Re: [RFC] net: phy: add shutdown hook to struct phy_driver

2020-10-05 Thread Jisheng Zhang
On Wed, 30 Sep 2020 13:23:29 -0700 Florian Fainelli wrote: > > On 9/30/2020 1:11 PM, Andrew Lunn wrote: > > On Wed, Sep 30, 2020 at 01:07:19PM -0700, Florian Fainelli wrote: > >> > >> > >> On 9/30/2020 12:09 PM, Andrew Lunn wrote: > >>>

[RFC] net: phy: add shutdown hook to struct phy_driver

2020-09-30 Thread Jisheng Zhang
Hi, A GE phy supports pad isolation which can save power in WOL mode. But once the isolation is enabled, the MAC can't send/receive pkts to/from the phy because the phy is "isolated". To make the PHY work normally, I need to move the enabling isolation to suspend hook, so far so good. But the isol

[PATCH v2 net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F

2020-09-20 Thread Jisheng Zhang
Enable ALDPS(Advanced Link Down Power Saving) to save power when link down. Signed-off-by: Jisheng Zhang --- Since v1: - add what does ALDPS mean. - replace magic number 0x18 with RTL8211F_PHYCR1 macro. drivers/net/phy/realtek.c | 9 + 1 file changed, 9 insertions(+) diff --git a

[PATCH net-next] net: phy: realtek: enable ALDPS to save power for RTL8211F

2020-09-17 Thread Jisheng Zhang
Enable ALDPS function to save power when link down. Signed-off-by: Jisheng Zhang --- drivers/net/phy/realtek.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/net/phy/realtek.c b/drivers/net/phy/realtek.c index 95dbe5e8e1d8..961570186822 100644 --- a/drivers/net/phy

[PATCH net-next] net: stmmac: fix failed to suspend if phy based WOL is enabled

2020-08-03 Thread Jisheng Zhang
up of the correct device when implementing phy based WOL feature. To be honest, I caught the issue when implementing phy based WOL and then fix it locally, but forgot to amend the phy based wol patch. Today, I found the issue by testing net-next tree. Signed-off-by: Jisheng Zhang --- driver

Re: [PATCH] net: ethernet: fix potential memory leak in gemini_ethernet_port_probe()

2020-07-29 Thread Jisheng Zhang
On Wed, 29 Jul 2020 11:46:06 +0800 Lu Wei wrote: > > > If some processes in gemini_ethernet_port_probe() fail, > free_netdev(dev) needs to be called to avoid a memory leak. Using devm_alloc_etherdev_mqs() would be much simpler > > Fixes: 4d5ae32f5e1e ("net: ethernet: Add a driver for Gemini

Re: [PATCH net-nex 2/2] net: mvneta: Don't speed down the PHY when changing mtu

2020-07-29 Thread Jisheng Zhang
Hi David, On Tue, 28 Jul 2020 17:52:02 -0700 (PDT) David Miller wrote: > > > > @@ -3651,7 +3651,8 @@ static void mvneta_stop_dev(struct mvneta_port *pp) > > > > set_bit(__MVNETA_DOWN, &pp->state); > > > > - if (device_may_wakeup(&pp->dev->dev)) > > + if (device_may_wakeup(&pp->dev

[PATCH net-next v2] net: mvneta: fix comment about phylink_speed_down

2020-07-29 Thread Jisheng Zhang
mvneta has switched to phylink, so the comment should look like "We may have called phylink_speed_down before". Signed-off-by: Jisheng Zhang --- Since v1: - drop patch2 which tries to avoid link flapping when changing mtu I need more time on the change mtu refactoring. d

[PATCH net-nex 2/2] net: mvneta: Don't speed down the PHY when changing mtu

2020-07-27 Thread Jisheng Zhang
We found a case where the phy link speed is changed to 10Mbps then back to 1000Mbps when changing the mtu: ethtool -s eth0 wol g ip link set eth0 mtu 1400 Add a simple check to avoid unnecessary phylink_speed_down() when changing the mtu. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet

[PATCH net-nex 1/2] net: mvneta: fix comment about phylink_speed_down

2020-07-27 Thread Jisheng Zhang
mvneta has switched to phylink, so the comment should look like "We may have called phylink_speed_down before". Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/marvell/mvneta.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/marvell/m

[PATCH net-nex 0/2] net: mvneta: improve phylink_speed_up/down usage

2020-07-27 Thread Jisheng Zhang
patch1 fix the comment patch2 tries to avoid unnecessary phylink_speed_up() and phylink_speed_down() during changing the mtu. Jisheng Zhang (2): net: mvneta: fix comment about phylink_speed_down net: mvneta: Don't speed down the PHY when changing mtu drivers/net/ethernet/marvell/mvn

[PATCH 2/5] net: stmmac: Move device_can_wakeup() check earlier in set_wol

2020-07-27 Thread Jisheng Zhang
If !device_can_wakeup(), there's no need to futher check. And return -EOPNOTSUPP rather than -EINVAL if !device_can_wakeup(). Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dr

[PATCH 3/5] net: stmmac: only call pmt() during suspend/resume if HW enables PMT

2020-07-27 Thread Jisheng Zhang
l phylink_start() if PMT is disabled. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net/ethernet/stmicro/stmmac/stmm

[PATCH 4/5] net: stmmac: Support WOL with phy

2020-07-27 Thread Jisheng Zhang
Currently, the stmmac driver WOL implementation relies on MAC's PMT feature. We have a case: the MAC HW doesn't enable PMT, instead, we rely on the phy to support WOL. Implement the support for this case. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_etht

[PATCH 1/5] net: stmmac: Remove WAKE_MAGIC if HW shows no pmt_magic_frame

2020-07-27 Thread Jisheng Zhang
Remove WAKE_MAGIC from supported modes if the HW capability register shows no support for pmt_magic_frame. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_ethtool.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/stmicro/stmmac

[PATCH 5/5] net: stmmac: Speed down the PHY if WoL to save energy

2020-07-27 Thread Jisheng Zhang
When WoL is enabled and the machine is powered off, the PHY remains waiting for wakeup events at max speed, which is a waste of energy. Slow down the PHY speed before stopping the ethernet if WoL is enabled, Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 8

[PATCH 0/5] net: stmmac: improve WOL

2020-07-27 Thread Jisheng Zhang
if WOL is enabled. Jisheng Zhang (5): net: stmmac: Remove WAKE_MAGIC if HW shows no pmt_magic_frame net: stmmac: Move device_can_wakeup() check earlier in set_wol net: stmmac: only call pmt() during suspend/resume if HW enables PMT net: stmmac: Support WOL with phy net: stmmac: speed

[PATCH net-next] net: mdio-mux-gpio: use devm_gpiod_get_array()

2020-07-21 Thread Jisheng Zhang
Use devm_gpiod_get_array() to simplify the error handling and exit code path. Signed-off-by: Jisheng Zhang --- drivers/net/phy/mdio-mux-gpio.c | 11 +++ 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/net/phy/mdio-mux-gpio.c b/drivers/net/phy/mdio-mux-gpio.c index

[PATCH v4 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-24 Thread Jisheng Zhang
systems the other OS could leave the PHY in whatever state." as pointed out by Heiner. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy_device.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_de

[PATCH v4 1/2] net: phy: make phy_disable_interrupts() non-static

2020-06-24 Thread Jisheng Zhang
atever state." Make phy_disable_interrupts() non-static so that it could be used in phy_init_hw() to have a defined init state. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy.c | 2 +- include/linux/phy.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) dif

[PATCH v4 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-24 Thread Jisheng Zhang
en config_init, thank Florian Since v2: - Don't export phy_disable_interrupts() but just make it non-static Since v1: - EXPORT the correct symbol Jisheng Zhang (2): net: phy: make phy_disable_interrupts() non-static net: phy: call phy_disable_interrupts() in phy_init_hw() dr

[PATCH v3 1/2] net: phy: make phy_disable_interrupts() non-static

2020-06-23 Thread Jisheng Zhang
atever state." Make phy_disable_interrupts() non-static so that it could be used in phy_init_hw() to have a defined init state. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy.c | 2 +- include/linux/phy.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) dif

[PATCH v3 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-23 Thread Jisheng Zhang
atic Since v1: - EXPORT the correct symbol Jisheng Zhang (2): net: phy: make phy_disable_interrupts() non-static net: phy: call phy_disable_interrupts() in phy_init_hw() drivers/net/phy/phy.c| 2 +- drivers/net/phy/phy_device.c | 7 +-- include/linux/phy.h | 1 + 3 fil

[PATCH v3 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-23 Thread Jisheng Zhang
systems the other OS could leave the PHY in whatever state." as pointed out by Heiner. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy_device.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/dri

[PATCH v2 1/2] net: phy: export phy_disable_interrupts()

2020-06-23 Thread Jisheng Zhang
ever state." Export phy_disable_interrupts() so that it could be used in phy_init_hw() to have a defined init state. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy.c | 3 ++- include/linux/phy.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git

[PATCH v2 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-23 Thread Jisheng Zhang
te." patch1 exports phy_disable_interrupts() so that it could be used in phy_init_hw() to have a defined init state. patch2 calls phy_disable_interrupts() in phy_init_hw() to have a defined init state. Since v1: - EXPORT the correct symbol Jisheng Zhang (2): net: phy: export phy_disabl

[PATCH v2 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-23 Thread Jisheng Zhang
systems the other OS could leave the PHY in whatever state." as pointed out by Heiner. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy_device.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/dri

[PATCH 1/2] net: phy: export phy_disable_interrupts()

2020-06-22 Thread Jisheng Zhang
ever state." Export phy_disable_interrupts() so that it could be used in phy_init_hw() to have a defined init state. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy.c | 3 ++- include/linux/phy.h | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git

[PATCH 2/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-22 Thread Jisheng Zhang
systems the other OS could leave the PHY in whatever state." as Pointed out by Heiner. Suggested-by: Heiner Kallweit Signed-off-by: Jisheng Zhang --- drivers/net/phy/phy_device.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/net/phy/phy_device.c b/dri

[PATCH 0/2] net: phy: call phy_disable_interrupts() in phy_init_hw()

2020-06-22 Thread Jisheng Zhang
te." patch1 exports phy_disable_interrupts() so that it could be used in phy_init_hw() to have a defined init state. patch2 calls phy_disable_interrupts() in phy_init_hw() to have a defined init state. Jisheng Zhang (2): net: phy: export phy_disable_interrupts() net: phy: call ph

Re: [PATCH] net: phy: realtek: clear interrupt during init for rtl8211f

2020-06-17 Thread Jisheng Zhang
On Fri, 15 May 2020 19:30:38 +0200 Heiner Kallweit wrote: > > > On 15.05.2020 18:18, Florian Fainelli wrote: > > > > > > On 5/15/2020 12:41 AM, Jisheng Zhang wrote: > >> On Thu, 14 May 2020 21:50:53 +0200 Heiner Kallweit wrote: > >> > &g

Re: [PATCH] net: phy: realtek: clear interrupt during init for rtl8211f

2020-05-15 Thread Jisheng Zhang
On Thu, 14 May 2020 21:50:53 +0200 Heiner Kallweit wrote: > > > On 14.05.2020 08:25, Jisheng Zhang wrote: > > On Wed, 13 May 2020 20:45:13 +0200 Heiner Kallweit wrote: > > > >> > >> On 13.05.2020 08:51, Jisheng Zhang wrote: > >>> Hi, &g

Re: [PATCH] net: phy: realtek: clear interrupt during init for rtl8211f

2020-05-13 Thread Jisheng Zhang
On Wed, 13 May 2020 20:45:13 +0200 Heiner Kallweit wrote: > > On 13.05.2020 08:51, Jisheng Zhang wrote: > > Hi, > > > > On Tue, 12 May 2020 20:43:40 +0200 Heiner Kallweit wrote: > > > >> > >> > >> On 12.05.2020 12:46, Jisheng Zhan

Re: [PATCH] net: phy: realtek: clear interrupt during init for rtl8211f

2020-05-12 Thread Jisheng Zhang
Hi, On Tue, 12 May 2020 20:43:40 +0200 Heiner Kallweit wrote: > > > On 12.05.2020 12:46, Jisheng Zhang wrote: > > The PHY Register Accessible Interrupt is enabled by default, so > > there's such an interrupt during init. In PHY POLL mode case, the > > INTB/PME

[PATCH] net: phy: realtek: clear interrupt during init for rtl8211f

2020-05-12 Thread Jisheng Zhang
The PHY Register Accessible Interrupt is enabled by default, so there's such an interrupt during init. In PHY POLL mode case, the INTB/PMEB pin is alway active, it is not good. Clear the interrupt by calling rtl8211f_ack_interrupt(). Signed-off-by: Jisheng Zhang --- drivers/net/phy/real

[PATCH net-next] net: stmmac: Switch to devm_alloc_etherdev_mqs

2019-05-27 Thread Jisheng Zhang
Make use of devm_alloc_etherdev_mqs() to simplify the code. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/stmicro/stmmac/stmmac_main.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_main.c b/drivers/net

Re: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE

2018-12-19 Thread Jisheng Zhang
On Wed, 19 Dec 2018 10:24:37 +0100 Marcin Wojtas wrote: > Hi Jisheng, > > śr., 19 gru 2018 o 04:11 Jisheng Zhang > napisał(a): > > > > > > On Mon, 17 Dec 2018 08:37:35 +0100 Thomas Petazzoni wrote: > > > > > Hello Marcin, > > > > &g

Re: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE

2018-12-18 Thread Jisheng Zhang
On Mon, 17 Dec 2018 08:37:35 +0100 Thomas Petazzoni wrote: > Hello Marcin, > > On Mon, 17 Dec 2018 00:25:58 +0100, Marcin Wojtas wrote: > > > Thanks. Indeed, the patch is valid as a fix for current version of SW > > BM. However, because this concept is broken, I will rework it and > > submit p

Re: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE

2018-12-12 Thread Jisheng Zhang
Hi Marcin, On Wed, 12 Dec 2018 09:22:57 +0100 Marcin Wojtas wrote: > Hi Jisheng, > > śr., 12 gru 2018 o 03:48 Jisheng Zhang > napisał(a): > > > > Hi, > > > > On Tue, 11 Dec 2018 13:56:49 +0100 Marcin Wojtas wrote: > > > > > Recent changes

Re: [PATCH net] net: mvneta: fix operation for 64K PAGE_SIZE

2018-12-11 Thread Jisheng Zhang
Hi, On Tue, 11 Dec 2018 13:56:49 +0100 Marcin Wojtas wrote: > Recent changes in the mvneta driver reworked allocation > and handling of the ingress buffers to use entire pages. > Apart from that in SW BM scenario the HW must be informed > via PRXDQS about the biggest possible incoming buffer > th

[query] about recent mvneta patches

2018-08-10 Thread Jisheng Zhang
Hi, Today I have a look at recent mvneta patches in net-next, I worried two patches: 1. commit 562e2f467e71 ("net: mvneta: Improve the buffer allocation method for SWBM") sets rx_offset_correction as 0 for SW BM, but IIRC, the offset is introduced to support 64bit platforms. So in theory the comm

Re: [PATCH v1 6/7] net: mvneta: Don't use GRO on Armada 3720

2018-08-09 Thread Jisheng Zhang
On Thu, 9 Aug 2018 19:27:55 +0800 Jisheng Zhang wrote: > Hi, > > On Thu, 9 Aug 2018 12:40:41 +0800 Jisheng Zhang wrote: > > > + more people > > > > On Wed, 8 Aug 2018 17:27:05 +0200 Marek Behún wrote: > > > > > For some reason on Armada

Re: [PATCH v1 6/7] net: mvneta: Don't use GRO on Armada 3720

2018-08-09 Thread Jisheng Zhang
Hi, On Thu, 9 Aug 2018 12:40:41 +0800 Jisheng Zhang wrote: > + more people > > On Wed, 8 Aug 2018 17:27:05 +0200 Marek Behún wrote: > > > For some reason on Armada 3720 boards (EspressoBin and Turris Mox) the > > networking driver behaves weirdly when using napi_g

Re: [PATCH v1 6/7] net: mvneta: Don't use GRO on Armada 3720

2018-08-08 Thread Jisheng Zhang
+ more people On Wed, 8 Aug 2018 17:27:05 +0200 Marek Behún wrote: > For some reason on Armada 3720 boards (EspressoBin and Turris Mox) the > networking driver behaves weirdly when using napi_gro_receive. > > For example downloading a big file from a local network (low ping) is > fast, but when

[PATCH] drivers: net: replace UINT64_MAX with U64_MAX

2018-04-27 Thread Jisheng Zhang
ivers. Replace the UINT64_MAX with U64_MAX to clean up the source code. Signed-off-by: Jisheng Zhang --- drivers/net/dsa/mv88e6xxx/chip.c | 6 +++--- drivers/net/dsa/mv88e6xxx/chip.h | 4 drivers/net/phy/bcm-phy-lib.c| 6 +- drivers/net/phy/marvell.c| 5 + drivers/net/phy/mic

Re: [PATCH] net: phy: marvell: clear wol event before setting it

2018-04-27 Thread Jisheng Zhang
On Thu, 26 Apr 2018 12:39:59 +0530 Bhadram Varka wrote: > > > > diff --git a/drivers/net/phy/marvell.c b/drivers/net/phy/marvell.c > > index c22e8e383247..b6abe1cbc84b 100644 > > --- a/drivers/net/phy/marvell.c > > +++ b/drivers/net/phy/marvell.c > > @@ -115,6 +115,9 @@ > >

Re: [PATCH] net: phy: marvell: clear wol event before setting it

2018-04-27 Thread Jisheng Zhang
On Fri, 27 Apr 2018 09:22:34 +0530 Bhadram Varka wrote: > Hi Andrew/Jisheng, > > On 4/26/2018 6:10 PM, Andrew Lunn wrote: > >> hmm, so you want a "stick" WOL feature, I dunno whether Linux kernel > >> requires WOL should be "stick". > > I see two different cases: > > > > Suspend/resume: The WoL

Re: [PATCH] net: phy: marvell: clear wol event before setting it

2018-04-26 Thread Jisheng Zhang
On Thu, 26 Apr 2018 11:56:33 +0530 Bhadram Varka wrote: > Hi, > On 4/26/2018 11:45 AM, Jisheng Zhang wrote: > > Hi, > > > > On Thu, 26 Apr 2018 11:10:21 +0530 Bhadram Varka wrote: > > > >> Hi, > >> > >> On 4/19/2018 5:48 PM, Andrew Lun

Re: [PATCH] net: phy: marvell: clear wol event before setting it

2018-04-25 Thread Jisheng Zhang
Hi, On Thu, 26 Apr 2018 11:10:21 +0530 Bhadram Varka wrote: > Hi, > > On 4/19/2018 5:48 PM, Andrew Lunn wrote: > > On Thu, Apr 19, 2018 at 04:02:32PM +0800, Jisheng Zhang wrote: > >> From: Jingju Hou > >> > >> If WOL event happened once, the LED

[PATCH v2] net: phy: marvell: clear wol event before setting it

2018-04-23 Thread Jisheng Zhang
ff-by: Jingju Hou Signed-off-by: Jisheng Zhang --- Since v1: - reuse MII_M1011_IEVENT, suggested by Bhadram Varka - make read conditional on !phy_interrupt_is_valid(), suggested by Andrew drivers/net/phy/marvell.c | 9 + 1 file changed, 9 insertions(+) diff --git a/drivers/ne

Re: [PATCH] net: phy: marvell: clear wol event before setting it

2018-04-19 Thread Jisheng Zhang
On Thu, 19 Apr 2018 09:00:40 + Bhadram Varka wrote: > Hi, > > > -Original Message- > > From: Jisheng Zhang > > Sent: Thursday, April 19, 2018 2:24 PM > > To: Bhadram Varka > > Cc: Andrew Lunn ; Florian Fainelli ; > > David S. Mille

Re: [PATCH] net: phy: marvell: clear wol event before setting it

2018-04-19 Thread Jisheng Zhang
Hi, On Thu, 19 Apr 2018 08:38:45 + Bhadram Varka wrote: > Hi, > > > -Original Message- > > From: netdev-ow...@vger.kernel.org On > > Behalf Of Jisheng Zhang > > Sent: Thursday, April 19, 2018 1:33 PM > > To: Andrew Lunn ; Florian Fainelli ;

[PATCH] net: phy: marvell: clear wol event before setting it

2018-04-19 Thread Jisheng Zhang
From: Jingju Hou If WOL event happened once, the LED[2] interrupt pin will not be cleared unless reading the CSISR register. So clear the WOL event before enabling it. Signed-off-by: Jingju Hou Signed-off-by: Jisheng Zhang --- drivers/net/phy/marvell.c | 9 + 1 file changed, 9

[PATCH v3 2/2] net: mvneta: improve suspend/resume

2018-04-01 Thread Jisheng Zhang
to fragmented dma coherent memory. After this patch, the non-necessary memory alloc/free is optimized out. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/marvell/mvneta.c | 69 +++ 1 file changed, 62 insertions(+), 7 deletions(-) diff --git a/drivers/net

[PATCH v3 1/2] net: mvneta: split rxq/txq init and txq deinit into SW and HW parts

2018-04-01 Thread Jisheng Zhang
ned-off-by: Jisheng Zhang --- drivers/net/ethernet/marvell/mvneta.c | 85 +++ 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 30aab9bf77cc..f96815853108 100644 --- a/d

[PATCH v3 0/2] net: mvneta: improve suspend/resume

2018-04-01 Thread Jisheng Zhang
esume behavior - split txq deinit into sw/hw parts as well - adjust mvneta_stop_dev() location I didn't add Thomas's Ack tag to patch1, because in v2, I add new code to split the txq deinit into two parts. Jisheng Zhang (2): net: mvneta: split rxq/txq init and txq deinit into SW and

[PATCH v2 2/2] net: mvneta: improve suspend/resume

2018-03-30 Thread Jisheng Zhang
to fragmented dma coherent memory. After this patch, the non-necessary memory alloc/free is optimized out. Signed-off-by: Jisheng Zhang --- drivers/net/ethernet/marvell/mvneta.c | 71 ++- 1 file changed, 61 insertions(+), 10 deletions(-) diff --git a/drivers/net

[PATCH v2 1/2] net: mvneta: split rxq/txq init and txq deinit into SW and HW parts

2018-03-30 Thread Jisheng Zhang
ned-off-by: Jisheng Zhang --- drivers/net/ethernet/marvell/mvneta.c | 85 +++ 1 file changed, 66 insertions(+), 19 deletions(-) diff --git a/drivers/net/ethernet/marvell/mvneta.c b/drivers/net/ethernet/marvell/mvneta.c index 30aab9bf77cc..f96815853108 100644 --- a/d

[PATCH v2 0/2] net: mvneta: improve suspend/resume

2018-03-30 Thread Jisheng Zhang
's Ack tag to patch1, because in v2, I added new code to split the txq deinit into two parts. Jisheng Zhang (2): net: mvneta: split rxq/txq init and txq deinit into SW and HW parts net: mvneta: improve suspend/resume drivers/net/ethernet/marvell/mvneta.c | 156 +++

Re: [PATCH 2/2] net: mvneta: improve suspend/resume

2018-03-30 Thread Jisheng Zhang
On Thu, 29 Mar 2018 13:54:32 +0200 Thomas Petazzoni wrote: > Hello Jisheng, Hi Thomas, > > On Thu, 29 Mar 2018 18:15:36 +0800, Jisheng Zhang wrote: > > Current suspend/resume implementation reuses the mvneta_open() and > > mvneta_close(), but it could be optimized t

Re: [PATCH 1/2] net: mvneta: split rxq/txq init into SW and HW parts

2018-03-30 Thread Jisheng Zhang
Hi, On Thu, 29 Mar 2018 13:42:59 +0200 Thomas Petazzoni wrote: > Hello, > > On Thu, 29 Mar 2018 18:13:56 +0800, Jisheng Zhang wrote: > > This is to prepare the suspend/resume improvement in next patch. The > > SW parts can be optimized out during resume. > > >

  1   2   >