Re: [PATCH 1/2] mm: Fix struct page layout on 32-bit systems

2021-04-20 Thread Rasmus Villemoes
On 17/04/2021 01.07, Matthew Wilcox (Oracle) wrote: > 32-bit architectures which expect 8-byte alignment for 8-byte integers > and need 64-bit DMA addresses (arc, arm, mips, ppc) had their struct > page inadvertently expanded in 2019. When the dma_addr_t was added, > it forced the alignment of the

Re: [PATCH 1/2] workqueue: Have 'alloc_workqueue()' like macros accept a format specifier

2021-04-18 Thread Rasmus Villemoes
On 18/04/2021 23.26, Christophe JAILLET wrote: > Improve 'create_workqueue', 'create_freezable_workqueue' and > 'create_singlethread_workqueue' so that they accept a format > specifier and a variable number of arguments. > > This will put these macros more in line with 'alloc_ordered_workqueue' an

gianfar driver and GFAR_MQ_POLLING

2021-04-06 Thread Rasmus Villemoes
Hi, I noticed that gfar_of_init() has if (of_device_is_compatible(np, "fsl,etsec2")) { mode = MQ_MG_MODE; poll_mode = GFAR_SQ_POLLING; } else { mode = SQ_SG_MODE; poll_mode = GFAR_SQ_POLLING; } i.e., poll_mod

Re: [PATCH] [v2] hinic: avoid gcc -Wrestrict warning

2021-03-24 Thread Rasmus Villemoes
-qualified argument 1 was declared here > 464 | char set_link_str[SET_LINK_STR_MAX_LEN] = {0}; > > Rewrite this to avoid the nested sprintf and instead use separate > buffers, which is simpler. > This looks much better. Thanks. > Cc: Rasmus Villemoes > Signed-off-by: Arnd Be

Re: [PATCH net-next] hinic: avoid gcc -Wrestrict warning

2021-03-23 Thread Rasmus Villemoes
On 23/03/2021 13.56, Arnd Bergmann wrote: > From: Arnd Bergmann > > With extra warnings enabled, gcc complains that snprintf should not > take the same buffer as source and destination: > > drivers/net/ethernet/huawei/hinic/hinic_ethtool.c: In function > 'hinic_set_settings_to_hw': > drivers/ne

Re: [PATCH] ethernet: ucc_geth: Use kmemdup instead of kmalloc and memcpy

2021-03-09 Thread Rasmus Villemoes
;ugeth_primary_info, sizeof(*ug_info), GFP_KERNEL); > if (ug_info == NULL) > return -ENOMEM; > - memcpy(ug_info, &ugeth_primary_info, sizeof(*ug_info)); > > ug_info->uf_info.ucc_num = ucc_num; > > Ah, yes, of course, I should have used that. Acked-by: Rasmus Villemoes

Re: [PATCH net 2/2] switchdev: mrp: Remove SWITCHDEV_ATTR_ID_MRP_PORT_STAT

2021-02-08 Thread Rasmus Villemoes
chdev API to offload MRP") > Signed-off-by: Horatiu Vultur Acked-by: Rasmus Villemoes

Re: [PATCH net 1/2] bridge: mrp: Fix the usage of br_mrp_port_switchdev_set_state

2021-02-08 Thread Rasmus Villemoes
th the switchdev API") > Fixes: fadd409136f0f2 ("bridge: switchdev: mrp: Implement MRP API for > switchdev") > Fixes: 2f1a11ae11d222 ("bridge: mrp: Add MRP interface.") > Reported-by: Rasmus Villemoes > Signed-off-by: Horatiu Vultur > --- Tested-by: Rasmus Villemoes

Re: [PATCH net-next v2 0/4] bridge: mrp: Extend br_mrp_switchdev_*

2021-02-01 Thread Rasmus Villemoes
On 30/01/2021 04.01, Jakub Kicinski wrote: > On Wed, 27 Jan 2021 21:52:37 +0100 Horatiu Vultur wrote: >> This patch series extends MRP switchdev to allow the SW to have a better >> understanding if the HW can implement the MRP functionality or it needs >> to help the HW to run it. There are 3 cases

[PATCH net-next v2 2/2] net: dsa: mv88e6xxx: use mv88e6185_g1_vtu_loadpurge() for the 6250

2021-01-26 Thread Rasmus Villemoes
ias Waldekranz Signed-off-by: Rasmus Villemoes --- drivers/net/dsa/mv88e6xxx/chip.c| 2 +- drivers/net/dsa/mv88e6xxx/global1.h | 2 -- drivers/net/dsa/mv88e6xxx/global1_vtu.c | 33 +++-- 3 files changed, 5 insertions(+), 32 deletions(-) diff --git a/drivers/net/

[PATCH v2 net] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP

2021-01-25 Thread Rasmus Villemoes
->handled stays false, so the logic in switchdev_port_obj_notify() can propagate that information. Fixes: f30f0601eb93 ("switchdev: Add helpers to aid traversal through lower devices") Reviewed-by: Petr Machata Signed-off-by: Rasmus Villemoes --- v2: reword commit message to make it

Re: [PATCH net] net: mrp: use stp state as substitute for unimplemented mrp state

2021-01-25 Thread Rasmus Villemoes
On 19/01/2021 16.52, Andrew Lunn wrote: > On Tue, Jan 19, 2021 at 09:32:40AM +0100, Horatiu Vultur wrote: >> The 01/18/2021 21:27, Vladimir Oltean wrote: >>> EXTERNAL EMAIL: Do not click links or open attachments unless you know the >>> content is safe >>> >>> On Mon, Jan 18, 2021 at 09:20:36PM +0

[PATCH net-next v2 1/2] net: dsa: mv88e6xxx: use mv88e6185_g1_vtu_getnext() for the 6250

2021-01-25 Thread Rasmus Villemoes
Waldekranz Tested-by: Tobias Waldekranz Reviewed-by: Florian Fainelli Signed-off-by: Rasmus Villemoes --- drivers/net/dsa/mv88e6xxx/chip.c| 2 +- drivers/net/dsa/mv88e6xxx/global1.h | 2 -- drivers/net/dsa/mv88e6xxx/global1_vtu.c | 36 ++--- 3 files changed, 3

[PATCH net-next v2 0/2] net: dsa: mv88e6xxx: remove some 6250-specific methods

2021-01-25 Thread Rasmus Villemoes
v2: - resend now that the bug-fix patch (87fe04367d84, "net: dsa: mv88e6xxx: also read STU state in mv88e6250_g1_vtu_getnext") is in net and also merged to net-next. - include various tags in patch 1. - add second similar patch for loadpurge. Rasmus Villemoes (2): net: dsa:

Re: [PATCH resend net] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP

2021-01-22 Thread Rasmus Villemoes
On 22/01/2021 10.05, Horatiu Vultur wrote: > The 01/22/2021 00:43, Rasmus Villemoes wrote: >> >> It's not true that switchdev_port_obj_notify() only inspects the >> ->handled field of "struct switchdev_notifier_port_obj_info" if >> call_switchdev_block

[PATCH resend net] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP

2021-01-21 Thread Rasmus Villemoes
hdev_port_obj_notify() can propagate that information. Fixes: f30f0601eb93 ("switchdev: Add helpers to aid traversal through lower devices") Signed-off-by: Rasmus Villemoes --- Resending with more folks on cc and a tentative fixes tag. net/switchdev/switchdev.c | 23 +---

Re: [PATCH net v2 1/2] net: mrp: fix definitions of MRP test packets

2021-01-21 Thread Rasmus Villemoes
On 21/01/2021 22.23, Horatiu Vultur wrote: > The 01/21/2021 21:40, Rasmus Villemoes wrote: > > It seems that is missing a Fixes tag, other than that it looks fine. That would be these two I guess: Fixes: 2801758391ba ("bridge: uapi: mrp: Extend MRP attributes for MRP interc

[PATCH net v2 0/2] fix and move definitions of MRP data structures

2021-01-21 Thread Rasmus Villemoes
v2: update commit log of the patch to include comments on 32 bit alignment; include second patch moving the structs out of uapi. Rasmus Villemoes (2): net: mrp: fix definitions of MRP test packets net: mrp: move struct definitions out of uapi include/uapi/linux/mrp_bridge.h | 86

[PATCH net v2 2/2] net: mrp: move struct definitions out of uapi

2021-01-21 Thread Rasmus Villemoes
fact, most of these structs are unused in the kernel, so only keep the few that are actually referenced in the kernel code, and move them to the br_private_mrp.h header. Signed-off-by: Rasmus Villemoes --- include/uapi/linux/mrp_bridge.h | 86 - net/bridge/br_pri

[PATCH net v2 1/2] net: mrp: fix definitions of MRP test packets

2021-01-21 Thread Rasmus Villemoes
tibility issues. Signed-off-by: Rasmus Villemoes --- include/uapi/linux/mrp_bridge.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h index 6aeb13ef0b1e..d1d0cf65916d 100644 --- a/include/uapi/linux/mrp_br

Re: [PATCH net-next v2 08/17] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private

2021-01-20 Thread Rasmus Villemoes
On 20/01/2021 07.57, Christophe Leroy wrote: > > > Le 19/01/2021 à 16:07, Rasmus Villemoes a écrit : >> These fields are only used within ucc_geth_startup(), so they might as >> well be local variables in that function rather than being stashed in >> struct ucc_get

Re: [PATCH net-next v2 13/17] ethernet: ucc_geth: remove bd_mem_part and all associated code

2021-01-20 Thread Rasmus Villemoes
On 20/01/2021 08.17, Christophe Leroy wrote: > > Le 19/01/2021 à 16:07, Rasmus Villemoes a écrit : >> The bd_mem_part member of ucc_geth_info always has the value >> MEM_PART_SYSTEM, and AFAICT, there has never been any code setting it >> to any other value. Moreover, mura

Re: [PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info

2021-01-20 Thread Rasmus Villemoes
On 20/01/2021 08.02, Christophe Leroy wrote: > >> @@ -3715,25 +3713,23 @@ static int ucc_geth_probe(struct >> platform_device* ofdev) >>   if ((ucc_num < 0) || (ucc_num > 7)) >>   return -ENODEV; >>   -    ug_info = &ugeth_info[ucc_num]; >> -    if (ug_info == NULL) { >> -    if (ne

[PATCH net-next v2 02/17] soc: fsl: qe: make cpm_muram_offset take a const void* argument

2021-01-19 Thread Rasmus Villemoes
Allow passing const-qualified pointers without requiring a cast in the caller. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c | 2 +- include/soc/fsl/qe/qe.h| 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b

[PATCH net-next v2 07/17] ethernet: ucc_geth: replace kmalloc+memset by kzalloc

2021-01-19 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index be997b559577..74ee2ed2fbbb 100644 --- a/drivers/net

[PATCH net-next v2 00/17] ucc_geth improvements

2021-01-19 Thread Rasmus Villemoes
; address minor style issues; don't introduce a use-after-free in patch "don't statically allocate eight ucc_geth_info". Rasmus Villemoes (17): ethernet: ucc_geth: remove unused read of temoder field soc: fsl: qe: make cpm_muram_offset take a const void* argument soc: fsl: qe:

[PATCH net-next v2 01/17] ethernet: ucc_geth: remove unused read of temoder field

2021-01-19 Thread Rasmus Villemoes
In theory, such a read-after-write might be required by the hardware, but nothing in the data sheet suggests that to be the case. The name test also suggests that it's some debug leftover. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 3 --- 1 file chang

[PATCH net-next v2 08/17] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private

2021-01-19 Thread Rasmus Villemoes
fixes the problems with using IS_ERR_VALUE() on a u32 as explained in commit 800cd6fb76f0 ("soc: fsl: qe: change return type of cpm_muram_alloc() to s32"). Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 21 + drivers/net/ethernet

[PATCH net-next v2 09/17] ethernet: ucc_geth: factor out parsing of {rx,tx}-clock{,-name} properties

2021-01-19 Thread Rasmus Villemoes
Reduce the code duplication a bit by moving the parsing of rx-clock-name and the fallback handling to a helper function. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 80 ++- 1 file changed, 36 insertions(+), 44 deletions(-) diff --git a

Re: [PATCH net 1/2] net: mrp: fix definitions of MRP test packets

2021-01-19 Thread Rasmus Villemoes
On 28/12/2020 23.24, Jakub Kicinski wrote: > On Wed, 23 Dec 2020 15:45:32 +0100 Rasmus Villemoes wrote: >> Wireshark says that the MRP test packets cannot be decoded - and the >> reason for that is that there's a two-byte hole filled with garbage >> between the &q

[PATCH net-next v2 12/17] ethernet: ucc_geth: use UCC_GETH_{RX,TX}_BD_RING_ALIGNMENT macros directly

2021-01-19 Thread Rasmus Villemoes
These macros both have the value 32, there's no point first initializing align to a lower value. If anything, one could throw in a BUILD_BUG_ON(UCC_GETH_TX_BD_RING_ALIGNMENT < 4), but it's not worth it - lots of code depends on named constants having sensible values. Signed-o

[PATCH net-next v2 05/17] ethernet: ucc_geth: use qe_muram_free_addr()

2021-01-19 Thread Rasmus Villemoes
This removes the explicit NULL checks, and allows us to stop storing at least some of the _offset values separately. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 77 ++- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a

[PATCH net-next v2 13/17] ethernet: ucc_geth: remove bd_mem_part and all associated code

2021-01-19 Thread Rasmus Villemoes
a lot of dead code, this is also motivated by wanting to clean up the "store result from kmalloc() in a u32" mess. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 108 ++ include/soc/fsl/qe/qe.h | 6 -- inc

[PATCH net-next v2 06/17] ethernet: ucc_geth: remove unnecessary memset_io() calls

2021-01-19 Thread Rasmus Villemoes
These buffers have all just been handed out from qe_muram_alloc(), aka cpm_muram_alloc(), and the helper cpm_muram_alloc_common() already does memset_io(cpm_muram_addr(start), 0, size); Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 19

[PATCH net-next v2 11/17] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info

2021-01-19 Thread Rasmus Villemoes
k was dead code, as the address of some static array element can obviously never be NULL. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 32 +-- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc

[PATCH net-next v2 04/17] soc: fsl: qe: add cpm_muram_free_addr() helper

2021-01-19 Thread Rasmus Villemoes
Add a helper that takes a virtual address rather than the muram offset. This will be used in a couple of places to avoid having to store both the offset and the virtual address, as well as removing NULL checks from the callers. Signed-off-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c

[PATCH net-next v2 03/17] soc: fsl: qe: store muram_vbase as a void pointer instead of u8

2021-01-19 Thread Rasmus Villemoes
ff-by: Rasmus Villemoes --- drivers/soc/fsl/qe/qe_common.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/soc/fsl/qe/qe_common.c b/drivers/soc/fsl/qe/qe_common.c index 0fbdc965c4cb..303cc2f5eb4a 100644 --- a/drivers/soc/fsl/qe/qe_common.c +++ b/drivers/soc/f

[PATCH net-next v2 14/17] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc()

2021-01-19 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 1e9d2f3f47a3..621a9e3e4b65 100644 --- a

[PATCH net-next v2 15/17] ethernet: ucc_geth: add helper to replace repeated switch statements

2021-01-19 Thread Rasmus Villemoes
The translation from the ucc_geth_num_of_threads enum value to the actual count can be written somewhat more compactly with a small lookup table, allowing us to replace the four switch statements. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 100

[PATCH net-next v2 16/17] ethernet: ucc_geth: inform the compiler that numQueues is always 1

2021-01-19 Thread Rasmus Villemoes
that are not really loops by creating static inline helpers. If and when the numQueuesTx/numQueuesRx fields are re-introduced, it suffices to update those helper to return the appropriate field. This cuts the .text segment of ucc_geth.o by 8%. Signed-off-by: Rasmus Villemoes --- drivers/net/eth

[PATCH net-next v2 17/17] ethernet: ucc_geth: simplify rx/tx allocations

2021-01-19 Thread Rasmus Villemoes
ery elegant and certainly makes a reader of the code pause for a while. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 50 --- drivers/net/ethernet/freescale/ucc_geth.h | 2 - 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/drive

[PATCH net-next v2 10/17] ethernet: ucc_geth: constify ugeth_primary_info

2021-01-19 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 75d1fb049698..65ef7ae38912 100644 --- a/drivers/net

Re: commit 4c7ea3c0791e (net: dsa: mv88e6xxx: disable SA learning for DSA and CPU ports)

2021-01-18 Thread Rasmus Villemoes
On 18/01/2021 22.19, Vladimir Oltean wrote: > On Sat, Jan 16, 2021 at 02:42:12AM +0100, Tobias Waldekranz wrote: >>> What I'm _really_ trying to do is to get my mv88e6250 to participate in >>> an MRP ring, which AFAICT will require that the master device's MAC gets >>> added as a static entry in th

[PATCH net] net: mrp: use stp state as substitute for unimplemented mrp state

2021-01-18 Thread Rasmus Villemoes
with that. Signed-off-by: Rasmus Villemoes --- I don't really understand why SWITCHDEV_ATTR_ID_MRP_PORT_STATE even has to exist seperately from SWITCHDEV_ATTR_ID_PORT_STP_STATE, and it's hard to tell what the difference might be since no kernel code implements the former.

Re: commit 4c7ea3c0791e (net: dsa: mv88e6xxx: disable SA learning for DSA and CPU ports)

2021-01-18 Thread Rasmus Villemoes
On 16/01/2021 02.42, Tobias Waldekranz wrote: > On Thu, Jan 14, 2021 at 14:49, Rasmus Villemoes > wrote: >> Hi >> >> I've noticed something rather odd with my mv88e6250, which led me to the >> commit in the subject. >> >> First, the MAC address

Re: [PATCH 0/2] net: dsa: mv88e6xxx: fix vlan filtering for 6250

2021-01-18 Thread Rasmus Villemoes
On 17/01/2021 22.08, Vladimir Oltean wrote: > Hi Rasmus, > > On Sat, Jan 16, 2021 at 03:39:34AM +0100, Rasmus Villemoes wrote: >> I finally managed to figure out why enabling VLAN filtering on the >> 6250 broke all (ingressing) traffic, >> cf. >> https://lore.ker

[PATCH net 1/2] net: dsa: mv88e6xxx: also read STU state in mv88e6250_g1_vtu_getnext

2021-01-15 Thread Rasmus Villemoes
sure to keep them that way when the entry is updated. Fixes: 92307069a96c (net: dsa: mv88e6xxx: Avoid VTU corruption on 6097) Signed-off-by: Rasmus Villemoes --- drivers/net/dsa/mv88e6xxx/global1_vtu.c | 4 1 file changed, 4 insertions(+) diff --git a/drivers/net/dsa/mv88e6xxx/global1_vtu.c

[PATCH net-next 2/2] net: dsa: mv88e6xxx: use mv88e6185_g1_vtu_getnext() for the 6250

2021-01-15 Thread Rasmus Villemoes
mv88e6250_g1_vtu_getnext is almost identical to mv88e6185_g1_vtu_getnext, except for the 6250 only having 64 databases instead of 256. We can reduce code duplication by simply masking off the extra two garbage bits when assembling the fid from VTU op [3:0] and [11:8]. Signed-off-by: Rasmus

[PATCH 0/2] net: dsa: mv88e6xxx: fix vlan filtering for 6250

2021-01-15 Thread Rasmus Villemoes
. Rasmus Villemoes (2): net: dsa: mv88e6xxx: also read STU state in mv88e6250_g1_vtu_getnext net: dsa: mv88e6xxx: use mv88e6185_g1_vtu_getnext() for the 6250 drivers/net/dsa/mv88e6xxx/chip.c| 2 +- drivers/net/dsa/mv88e6xxx/global1.h | 2 -- drivers/net/dsa/mv88e6xxx/global1_vtu.c

commit 4c7ea3c0791e (net: dsa: mv88e6xxx: disable SA learning for DSA and CPU ports)

2021-01-14 Thread Rasmus Villemoes
Hi I've noticed something rather odd with my mv88e6250, which led me to the commit in the subject. First, the MAC address of the master device never seems to get learned (at least according to "mv88e6xxx_dump --atu"), so all packets destined for the machine gets flooded out all ports - which I ca

[PATCH net 1/2] net: mrp: fix definitions of MRP test packets

2020-12-23 Thread Rasmus Villemoes
ehind a +1000$ paywall can be called a standard. Signed-off-by: Rasmus Villemoes --- include/uapi/linux/mrp_bridge.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/uapi/linux/mrp_bridge.h b/include/uapi/linux/mrp_bridge.h index 6aeb13ef0b1e..d1d0cf65916d 100644 -

[PATCH net 2/2] net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP

2020-12-23 Thread Rasmus Villemoes
hdev_port_obj_notify() can propagate that information. Signed-off-by: Rasmus Villemoes --- net/switchdev/switchdev.c | 23 +-- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c index 23d868545362..2c1ffc9ba2eb 100

[PATCH net 0/2] MRP without hardware offload?

2020-12-23 Thread Rasmus Villemoes
chip-ung/mrp.git and kernel v5.10.2. Rasmus Villemoes (2): net: mrp: fix definitions of MRP test packets net: switchdev: don't set port_obj_info->handled true when -EOPNOTSUPP include/uapi/linux/mrp_bridge.h | 4 ++-- net/switchdev/switchdev.c | 23 +-- 2 fi

[PATCH net v2 3/3] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-18 Thread Rasmus Villemoes
ugeth is the netdiv_priv() part of the netdevice. Accessing the memory pointed to by ugeth (such as done by ucc_geth_memclean() and the two of_node_puts) after free_netdev() is thus use-after-free. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file

[PATCH net v2 1/3] ethernet: ucc_geth: set dev->max_mtu to 1518

2020-12-18 Thread Rasmus Villemoes
Vladimir Oltean Reviewed-by: Andrew Lunn Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 714b501be7d0..380c1f09adaf 10064

[PATCH net v2 2/3] ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram

2020-12-18 Thread Rasmus Villemoes
t could be attributed to this, but it seems to be the kind of thing that would be extremely hard to debug. So extend the struct definition so that we do allocate 192 bytes. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.h | 9 - 1 file changed, 8 insertions(+),

[PATCH net v2 0/3] ucc_geth fixes

2020-12-18 Thread Rasmus Villemoes
This is three bug fixes that fell out of a series of cleanups of the ucc_geth driver. Please consider applying via the net tree. v2: reorder and split off from larger series; add Andrew's R-b to patch 1; only move the free_netdev() call in patch 3. Rasmus Villemoes (3): ethernet: ucc_geth

[PATCH net-next v2] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250

2020-12-10 Thread Rasmus Villemoes
method, use the existence of the ->port_setup_message_port method as a proxy for determining whether the learn2all bit exists (and should be set). Signed-off-by: Rasmus Villemoes --- v2: add comment explaining why ->port_setup_message_port is being used. This doesn't fix anything from what

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-09 Thread Rasmus Villemoes
On 05/12/2020 22.27, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 22:11:39 +0100 Rasmus Villemoes wrote: >>> Looks like a nice clean up on a quick look. >>> >>> Please separate patches 1 and 11 (which are the two bug fixes I see) >> >> I think patch 2

Re: [PATCH 14/20] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info

2020-12-08 Thread Rasmus Villemoes
On 08/12/2020 16.13, Christophe Leroy wrote: > > > Le 05/12/2020 à 20:17, Rasmus Villemoes a écrit : >> @@ -3714,25 +3712,23 @@ static int ucc_geth_probe(struct >> platform_device* ofdev) >>   if ((ucc_num < 0) || (ucc_num > 7)) >>   return -

Re: [PATCH 18/20] ethernet: ucc_geth: add helper to replace repeated switch statements

2020-12-08 Thread Rasmus Villemoes
On 08/12/2020 16.21, Christophe Leroy wrote: > > > Le 05/12/2020 à 20:17, Rasmus Villemoes a écrit : >> The translation from the ucc_geth_num_of_threads enum value to the >> actual count can be written somewhat more compactly with a small >> lookup table, allowing us

Re: [PATCH 02/20] ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram

2020-12-08 Thread Rasmus Villemoes
On 08/12/2020 20.14, Li Yang wrote: > On Sat, Dec 5, 2020 at 1:21 PM Rasmus Villemoes > wrote: >> >> Table 8-53 in the QUICC Engine Reference manual shows definitions of >> fields up to a size of 192 bytes, not just 128. But in table 8-111, >> one does find the te

[PATCH net-next] net: dsa: mv88e6xxx: don't set non-existing learn2all bit for 6220/6250

2020-12-08 Thread Rasmus Villemoes
, use the existence of the ->port_setup_message_port method as a proxy for determining whether the learn2all bit exists (and should be set). Signed-off-by: Rasmus Villemoes --- This doesn't fix anything from what I can tell, in particular not the VLAN problems I'm having, so just ta

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-08 Thread Rasmus Villemoes
On 08/12/2020 04.07, Qiang Zhao wrote: > On 06/12/2020 05:12, Rasmus Villemoes wrote: > >> I think patch 2 is a bug fix as well, but I'd like someone from NXP to >> comment. > > It 's ok for me. I was hoping for something a bit more than that. Can you please

Re: vlan_filtering=1 breaks all traffic

2020-12-07 Thread Rasmus Villemoes
On 06/12/2020 20.45, Vladimir Oltean wrote: > It would be interesting to see what is the ingress drop reason, if that > could be deduced from the drop counters that are incrementing in ethtool -S. I don't see anything obvious from running ethtool -S before/during/after ping. > Since you've alrea

Re: [PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
> I only noticed because I needed to add a free of the ug_info in a later > patch. Where, ironically, I add a use-after-free bug by freeing ug_info before the ucc_geth_memclean() call. :facepalm:

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 22.27, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 22:11:39 +0100 Rasmus Villemoes wrote: >>> rebase (retest) and post them against the net tree: >>> >>> https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/ >> >> So I thought th

Re: [PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 22.19, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 22:04:28 +0100 Rasmus Villemoes wrote: >> On 05/12/2020 21.48, Jakub Kicinski wrote: >>> On Sat, 5 Dec 2020 20:17:34 +0100 Rasmus Villemoes wrote: >>>> - unregister_netdev(dev); >>>> - f

Re: [PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 21.53, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 20:17:23 +0100 Rasmus Villemoes wrote: >> While trying to figure out how to allow bumping the MTU with the >> ucc_geth driver, I fell into a rabbit hole and stumbled on a whole >> bunch of issues of varying

Re: [PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 21.48, Jakub Kicinski wrote: > On Sat, 5 Dec 2020 20:17:34 +0100 Rasmus Villemoes wrote: >> -unregister_netdev(dev); >> -free_netdev(dev); >> ucc_geth_memclean(ugeth); >> if (of_phy_is_fixed_link(np)) >>

Re: vlan_filtering=1 breaks all traffic

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 20.03, Vladimir Oltean wrote: > Hi Rasmus, > > On Sat, Dec 05, 2020 at 03:49:02PM +0100, Rasmus Villemoes wrote: >> So I'm out of ideas. I also tried booting a 5.3, but that had some >> horrible UBI/nand failure, > > Test with a ramdisk maybe? >

[PATCH 01/20] ethernet: ucc_geth: set dev->max_mtu to 1518

2020-12-05 Thread Rasmus Villemoes
Vladimir Oltean Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 714b501be7d0..380c1f09adaf 100644 --- a/drivers/net/eth

[PATCH 13/20] ethernet: ucc_geth: constify ugeth_primary_info

2020-12-05 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index 700eafef4921..a06744d8b4af 100644 --- a/drivers/net

[PATCH 14/20] ethernet: ucc_geth: don't statically allocate eight ucc_geth_info

2020-12-05 Thread Rasmus Villemoes
k was dead code, as the address of some static array element can obviously never be NULL. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 32 +-- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc

[PATCH 20/20] ethernet: ucc_geth: simplify rx/tx allocations

2020-12-05 Thread Rasmus Villemoes
ery elegant and certainly makes a reader of the code pause for a while. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 50 --- drivers/net/ethernet/freescale/ucc_geth.h | 2 - 2 files changed, 17 insertions(+), 35 deletions(-) diff --git a/drive

[PATCH 17/20] ethernet: ucc_geth: replace kmalloc_array()+for loop by kcalloc()

2020-12-05 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 14 -- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index c9f619908561..3aebea191b52 100644 --- a

[PATCH 16/20] ethernet: ucc_geth: remove bd_mem_part and all associated code

2020-12-05 Thread Rasmus Villemoes
a lot of dead code, this is also motivated by wanting to clean up the "store result from kmalloc() in a u32" mess. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 106 ++ include/soc/fsl/qe/qe.h | 6 -- inc

[PATCH 19/20] ethernet: ucc_geth: inform the compiler that numQueues is always 1

2020-12-05 Thread Rasmus Villemoes
that are not really loops by creating static inline helpers. If and when the numQueuesTx/numQueuesRx fields are re-introduced, it suffices to update those helper to return the appropriate field. This cuts the .text segment of ucc_geth.o by 8%. Signed-off-by: Rasmus Villemoes --- drivers/net/eth

[PATCH 18/20] ethernet: ucc_geth: add helper to replace repeated switch statements

2020-12-05 Thread Rasmus Villemoes
The translation from the ucc_geth_num_of_threads enum value to the actual count can be written somewhat more compactly with a small lookup table, allowing us to replace the four switch statements. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 100

[PATCH 15/20] ethernet: ucc_geth: use UCC_GETH_{RX,TX}_BD_RING_ALIGNMENT macros directly

2020-12-05 Thread Rasmus Villemoes
These macros both have the value 32, there's no point first initializing align to a lower value. If anything, one could throw in a BUILD_BUG_ON(UCC_GETH_TX_BD_RING_ALIGNMENT < 4), but it's not worth it - lots of code depends on named constants having sensible values. Signed-o

[PATCH 10/20] ethernet: ucc_geth: remove {rx,tx}_glbl_pram_offset from struct ucc_geth_private

2020-12-05 Thread Rasmus Villemoes
fixes the problems with using IS_ERR_VALUE() on a u32 as explained in commit 800cd6fb76f0 ("soc: fsl: qe: change return type of cpm_muram_alloc() to s32"). Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 21 + drivers/net/ethernet

[PATCH 11/20] ethernet: ucc_geth: fix use-after-free in ucc_geth_remove()

2020-12-05 Thread Rasmus Villemoes
ugeth is the netdiv_priv() part of the netdevice. Accessing the memory pointed to by ugeth (such as done by ucc_geth_memclean() and the two of_node_puts) after free_netdev() is thus use-after-free. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 4 ++-- 1 file

[PATCH 12/20] ethernet: ucc_geth: factor out parsing of {rx,tx}-clock{,-name} properties

2020-12-05 Thread Rasmus Villemoes
Reduce the code duplication a bit by moving the parsing of rx-clock-name and the fallback handling to a helper function. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 79 ++- 1 file changed, 35 insertions(+), 44 deletions(-) diff --git a

[PATCH 07/20] ethernet: ucc_geth: use qe_muram_free_addr()

2020-12-05 Thread Rasmus Villemoes
This removes the explicit NULL checks, and allows us to stop storing at least some of the _offset values separately. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 77 ++- 1 file changed, 33 insertions(+), 44 deletions(-) diff --git a

[PATCH 08/20] ethernet: ucc_geth: remove unnecessary memset_io() calls

2020-12-05 Thread Rasmus Villemoes
These buffers have all just been handed out from qe_muram_alloc(), aka cpm_muram_alloc(), and the helper cpm_muram_alloc_common() already does memset_io(cpm_muram_addr(start), 0, size); Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 19

[PATCH 09/20] ethernet: ucc_geth: replace kmalloc+memset by kzalloc

2020-12-05 Thread Rasmus Villemoes
Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/net/ethernet/freescale/ucc_geth.c b/drivers/net/ethernet/freescale/ucc_geth.c index f854ff90f238..e1574c14b7e5 100644 --- a/drivers/net

[PATCH 02/20] ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram

2020-12-05 Thread Rasmus Villemoes
t could be attributed to this, but it seems to be the kind of thing that would be extremely hard to debug. So extend the struct definition so that we do allocate 192 bytes. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.h | 9 - 1 file changed, 8 insertions(+),

[PATCH 03/20] ethernet: ucc_geth: remove unused read of temoder field

2020-12-05 Thread Rasmus Villemoes
In theory, such a read-after-write might be required by the hardware, but nothing in the data sheet suggests that to be the case. The name test also suggests that it's some debug leftover. Signed-off-by: Rasmus Villemoes --- drivers/net/ethernet/freescale/ucc_geth.c | 3 --- 1 file chang

[PATCH 00/20] ethernet: ucc_geth: assorted fixes and simplifications

2020-12-05 Thread Rasmus Villemoes
tch 2, someone in NXP should check how the hardware actually works and make an updated reference manual available. Rasmus Villemoes (20): ethernet: ucc_geth: set dev->max_mtu to 1518 ethernet: ucc_geth: fix definition and size of ucc_geth_tx_global_pram ethernet: ucc_geth: remove unused read of

[PATCH net-next] net: dsa: print the MTU value that could not be set

2020-12-05 Thread Rasmus Villemoes
These warnings become somewhat more informative when they include the MTU value that could not be set and not just the errno. Signed-off-by: Rasmus Villemoes --- net/dsa/master.c | 7 --- net/dsa/slave.c | 4 ++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/net/dsa

Re: vlan_filtering=1 breaks all traffic

2020-12-05 Thread Rasmus Villemoes
On 05/12/2020 16.45, Russell King - ARM Linux admin wrote: > On Sat, Dec 05, 2020 at 03:49:02PM +0100, Rasmus Villemoes wrote: >> So, I found out that the problem disappers when I disable >> vlan_filtering, and googling then led me to Russell's patches from >&

vlan_filtering=1 breaks all traffic (was: Re: warnings from MTU setting on switch ports)

2020-12-05 Thread Rasmus Villemoes
On 30/11/2020 23.13, Rasmus Villemoes wrote: > On 30/11/2020 17.04, Vladimir Oltean wrote: > Thanks, but I don't think that will change anything. -34 is -ERANGE. >> But you might also want to look into adding .ndo_change_mtu for >> ucc_geth. > > Well, that

Re: warnings from MTU setting on switch ports

2020-11-30 Thread Rasmus Villemoes
On 30/11/2020 23.35, Vladimir Oltean wrote: > On Mon, Nov 30, 2020 at 11:13:39PM +0100, Rasmus Villemoes wrote: >> FWIW, on a 4.19 kernel, I can do 'ping -s X -M do' for X up to 1472 >> for IPv4 and 1452 for IPv6, but I don't think that tells me much about >>

Re: warnings from MTU setting on switch ports

2020-11-30 Thread Rasmus Villemoes
On 30/11/2020 17.04, Vladimir Oltean wrote: > Hi Rasmus, > > On Mon, Nov 30, 2020 at 03:30:50PM +0100, Rasmus Villemoes wrote: >> Hi, >> >> Updating our mpc8309 board to 5.9, we're starting to get >> >> [0.709832] mv88e6085 mdio@e0102120:10:

warnings from MTU setting on switch ports

2020-11-30 Thread Rasmus Villemoes
Hi, Updating our mpc8309 board to 5.9, we're starting to get [0.709832] mv88e6085 mdio@e0102120:10: nonfatal error -34 setting MTU on port 0 [0.720721] mv88e6085 mdio@e0102120:10: nonfatal error -34 setting MTU on port 1 [0.731002] mv88e6085 mdio@e0102120:10: nonfatal error -34 settin

Re: powering off phys on 'ip link set down'

2020-08-27 Thread Rasmus Villemoes
On 27/08/2020 13.14, Heiner Kallweit wrote: > On 27.08.2020 13:00, Rasmus Villemoes wrote: >> On 27/08/2020 12.29, Heiner Kallweit wrote: >>> On 27.08.2020 12:08, Rasmus Villemoes wrote: >>>> Hi, >>>> >>>> We have a requirement that when an

Re: powering off phys on 'ip link set down'

2020-08-27 Thread Rasmus Villemoes
On 27/08/2020 12.29, Heiner Kallweit wrote: > On 27.08.2020 12:08, Rasmus Villemoes wrote: >> Hi, >> >> We have a requirement that when an interface is taken down >> administratively, the phy should be powered off. That also works when >> the interface has link w

powering off phys on 'ip link set down'

2020-08-27 Thread Rasmus Villemoes
Hi, We have a requirement that when an interface is taken down administratively, the phy should be powered off. That also works when the interface has link when the 'ip link set down ...' is run. But if there's no cable plugged in, the phy stays powered on (as can be seen both using phytool, and f

Re: [PATCH 08/30] net: wireless: ath: carl9170: Mark 'ar9170_qmap' as __maybe_unused

2020-08-17 Thread Rasmus Villemoes
On 14/08/2020 17.14, Christian Lamparter wrote: > On 2020-08-14 13:39, Lee Jones wrote: >> 'ar9170_qmap' is used in some source files which include carl9170.h, >> but not all of them.  Mark it as __maybe_unused to show that this is >> not only okay, it's expected. >> >> Fixes the following W=1 kern

Re: rtnl_trylock() versus SCHED_FIFO lockup

2020-08-07 Thread Rasmus Villemoes
On 07/08/2020 05.39, Stephen Hemminger wrote: > On Thu, 6 Aug 2020 12:46:43 +0300 > Nikolay Aleksandrov wrote: > >> On 06/08/2020 12:17, Rasmus Villemoes wrote: >>> On 06/08/2020 01.34, Stephen Hemminger wrote: >>>> On Wed, 5 Aug 2020 16:25:23 +0200

  1   2   >