Netdev List
 help / color / mirror / Atom feed
* Re: [Patch net-next] mlx5: use RCU lock in mlx5_eq_cq_get()
From: Saeed Mahameed @ 2019-02-06 17:35 UTC (permalink / raw)
  To: xiyou.wangcong@gmail.com; +Cc: netdev@vger.kernel.org, Tariq Toukan
In-Reply-To: <CAM_iQpW5GQD8PS1d34tNF5Dfd63pTJDfz_5kJWyqJOOrAMdU7g@mail.gmail.com>

On Wed, 2019-02-06 at 09:15 -0800, Cong Wang wrote:
> On Wed, Feb 6, 2019 at 8:55 AM Saeed Mahameed <saeedm@mellanox.com>
> wrote:
> > Hi Cong,
> > 
> > The patch is ok to me, but i really doubt that you can hit a
> > contention
> > on latest upstream driver, since we already have spinlock per EQ,
> > which
> > means spinlock per core,  each EQ (core) msix handler can only
> > access
> > one spinlock (its own), so I am surprised how you got the
> > contention,
> > Maybe you are not running on latest upstream driver ?
> 
> We are running 4.14 stable release. Which commit changes the game
> here? We can consider to backport it unless it is complicated.
> 

Ok, so there is no issue upstream, you are just missing the following
patch:

commit 02d92f7903647119e125b24f5470f96cee0d4b4b
Author: Saeed Mahameed <saeedm@mellanox.com>
Date:   Fri Jan 19 16:13:01 2018 -0800

    net/mlx5: CQ Database per EQ
    
    Before this patch the driver had one CQ database protected via one
    spinlock, this spinlock is meant to synchronize between CQ
    adding/removing and CQ IRQ interrupt handling.
[...]

> Also, if you don't like this patch, we are happy to carry it for our
> own,
> sometimes it isn't worth the time to push into upstream.

I Do like it and it always worth it to push upstream, we all get to
learn cool new stuff.

> 
> > what is the workload ?
> > 
> 
> It's a memcached RPC performance test, that is all I can tell.

cool, thanks, so the missing commit should fix your issue.

> (Apparently I have almost zero knowledge about memcached.)
> 
> 
> > > > In fact, radix_tree_lookup() is perfectly fine with RCU read
> > > > lock,
> > > > we don't have to take a spinlock on this hot path. It is pretty
> > > > much
> > > > similar to commit 291c566a2891
> > > > ("net/mlx4_core: Fix racy CQ (Completion Queue) free"). Slow
> > > > paths
> > > > are still serialized with the spinlock, and with
> > > > synchronize_irq()
> > > > it should be safe to just move the fast path to RCU read lock.
> > > > 
> > > > This patch itself reduces the latency by about 50% with our
> > > > workload.
> > > > 
> > > > Cc: Saeed Mahameed <saeedm@mellanox.com>
> > > > Cc: Tariq Toukan <tariqt@mellanox.com>
> > > > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> > > > ---
> > > >   drivers/net/ethernet/mellanox/mlx5/core/eq.c | 12 ++++++-----
> > > > -
> > > >   1 file changed, 6 insertions(+), 6 deletions(-)
> > > > 
> > > > diff --git a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> > > > b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> > > > index ee04aab65a9f..7092457705a2 100644
> > > > --- a/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> > > > +++ b/drivers/net/ethernet/mellanox/mlx5/core/eq.c
> > > > @@ -114,11 +114,11 @@ static struct mlx5_core_cq
> > > > *mlx5_eq_cq_get(struct mlx5_eq *eq, u32 cqn)
> > > >     struct mlx5_cq_table *table = &eq->cq_table;
> > > >     struct mlx5_core_cq *cq = NULL;
> > > > 
> > > > -   spin_lock(&table->lock);
> > > > +   rcu_read_lock();
> > > >     cq = radix_tree_lookup(&table->tree, cqn);
> > > >     if (likely(cq))
> > > >             mlx5_cq_hold(cq);
> > > > -   spin_unlock(&table->lock);
> > > > +   rcu_read_unlock();
> > > 
> > > Thanks for you patch.
> > > 
> > > I think we can improve it further, by taking the if statement out
> > > of
> > > the
> > > critical section.
> > > 
> > 
> > No, mlx5_cq_hold must stay under RCU read, otherwise cq might get
> > freed
> > before the irq gets a change to increment ref count on it.
> > 
> 
> Agreed.
> 

Cool, I will ack the patch.. 

> 
> Thanks.

^ permalink raw reply

* Re: [Patch net-next] mlx5: use RCU lock in mlx5_eq_cq_get()
From: Saeed Mahameed @ 2019-02-06 17:35 UTC (permalink / raw)
  To: netdev@vger.kernel.org, xiyou.wangcong@gmail.com; +Cc: Tariq Toukan
In-Reply-To: <20190206003525.5041-1-xiyou.wangcong@gmail.com>

On Tue, 2019-02-05 at 16:35 -0800, Cong Wang wrote:
> mlx5_eq_cq_get() is called in IRQ handler, the spinlock inside
> gets a lot of contentions when we test some heavy workload
> with 60 RX queues and 80 CPU's, and it is clearly shown in the
> flame graph.
> 
> In fact, radix_tree_lookup() is perfectly fine with RCU read lock,
> we don't have to take a spinlock on this hot path. It is pretty much
> similar to commit 291c566a2891
> ("net/mlx4_core: Fix racy CQ (Completion Queue) free"). Slow paths
> are still serialized with the spinlock, and with synchronize_irq()
> it should be safe to just move the fast path to RCU read lock.
> 
> This patch itself reduces the latency by about 50% with our workload.
> 
> Cc: Saeed Mahameed <saeedm@mellanox.com>
> Cc: Tariq Toukan <tariqt@mellanox.com>
> Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>

Acked-by: Saeed Mahameed <saeedm@mellanox.com>


^ permalink raw reply

* [BUG] kernel panic 4.14.95 in kmem_cache_alloc / build_skb
From: Frank Wunderlich @ 2019-02-06 17:36 UTC (permalink / raw)
  To: netdev

Hi,

linux-net-mailinglist for reporting bugs seems not existing anymore and i have not found out the right one..."scripts/get_maintainer.pl -f ./include/linux/skbuff.h" shows only linux-kernel as mailing list which is not specific for network, so sorry, if i'm in the wrong mailinglist.

i've recently noticed panics on my bananapi-r2 with kernel 4.14.95, but can't locate them in detail...all is pointing to kmem_cache_alloc and build_skb, but over complete different ways. so i guess it's network-related

i currently don't know what is triggering this crashes, so i cannot reproduce them on my test-machine :(

it's not only an oops...the machine stays still and have to be resettet, sometimes after an half hour running

i had kernel 4.14.78 running before, so i think it's a change between these 2 Kernel-versions and no OS-related (debian-stretch) or Hardware-issue

currently i test with 4.14.90, if it has same behaviour...at the moment it seems stable...

i cannot test it with another kernel-branch (4.19+), because i need to test it on my productive machine till i find a way to reproduce it....maybe you can see a hint in stacktrace to guide me...at the moment crash occours unexpectely

i looked through git-tree but did not found anything related

regards Frank

here my 3 recorded crash-logs...maybe you can point me in the right direction (reproduce/debug/fix):

first is thrown out of mt76-module (had mt7612 inserted which i had disabled on last 2 crashes):

[ 1281.724002] Unable to handle kernel NULL pointer dereference at virtual address 00000001
[ 1281.732105] pgd = c0004000
[ 1281.734836] [00000001] *pgd=00000000
[ 1281.738425] Internal error: Oops: 5 [#1] SMP ARM
[ 1281.743016] Modules linked in: xt_addrtype veth pppoe pppox ppp_generic slhc sit tunnel4 ip_tunnel bridge ip6t_REJECT nf_reject_ipv6 xt_mac
ip6t_rt nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipt_REJECT nf_reject_ipv4 xt_limit xt_iprange xt_recent xt_conntrack iptabl
e_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 xt_nat tun xt_tcpudp iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrac
k xt_mark iptable_mangle mt76x2e mt76 mtk_thermal spi_mt65xx thermal_sys mt6577_auxadc pwm_mediatek nvmem_mtk_efuse mtk_pmic_keys evbug rtc_mt6
397 nfsd ip_tables x_tables ipv6
[ 1281.795425] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.95-bpi-r2-main #49
[ 1281.802510] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1281.808043] task: c11073c0 task.stack: c1100000
[ 1281.812551] PC is at kmem_cache_alloc+0xd0/0x21c
[ 1281.817134] LR is at 0x391d6
[ 1281.819990] pc : [<c028c0f4>] lr : [<000391d6>] psr: 280f0113
[ 1281.826209] sp : c1101c18 ip : a80f0113 fp : c1101c4c
[ 1281.831393] r10: 00000001 r9 : dbdf6900 r8 : c0895b9c
[ 1281.836578] r7 : de801cc0 r6 : 01080020 r5 : c1226790 r4 : de801cc0
[ 1281.843056] r3 : 00000000 r2 : df5a39d4 r1 : 1e4e9000 r0 : 000391d5
[ 1281.849535] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 1281.856617] Control: 10c5387d Table: 9bdc006a DAC: 00000051
[ 1281.862319] Process swapper/0 (pid: 0, stack limit = 0xc1100218)
[ 1281.868280] Stack: (0xc1101c18 to 0xc1102000)
[ 1281.872608] 1c00: db119900 df5a0fb8
[ 1281.880733] 1c20: c1101c54 df5a0784 00000000 00000300 da308b00 680f0113 00000000 da1dd6b0
[ 1281.888858] 1c40: c1101c74 c1101c50 c0895b9c c028c030 df5a0784 00000000 00000300 da308b00
[ 1281.896983] 1c60: 680f0113 00000000 c1101c9c c1101c78 c0895d10 c0895b70 00000000 dcc48b78
[ 1281.905109] 1c80: db6e5f00 dcc48580 de8ec460 c1101d10 c1101d04 c1101ca0 c0a729cc c0895c88
[ 1281.913234] 1ca0: c015ff18 c01593b4 d63e99d9 00000000 c1101d0c c01525cc c0b02a08 df5a0f80
[ 1281.921359] 1cc0: c1101ce4 c1101cd0 c01525cc c0151994 df5a0f80 da029e00 c1101d1c 00000000
[ 1281.929484] 1ce0: 00000000 de8ec460 bf16bb90 dcc48b78 00000001 00000003 c1101d3c c1101d08
[ 1281.937608] 1d00: c0a72ba8 c0a727b4 00000002 c04e15c8 00000000 00000000 c04e15c8 de8ecd20
[ 1281.945732] 1d20: dcc48b78 00000002 bf16bb90 de8ecd20 c1101d54 c1101d40 bf16bbd4 c0a72b74
[ 1281.953858] 1d40: dcc48580 de8ecab0 c1101d8c c1101d58 c0a78f20 bf16bb9c c1101d64 de8ec460
[ 1281.961983] 1d60: ff76abc0 de8ecd20 de8ed868 c1101db0 bf16baf8 c10af2a8 ffffe000 00000040
[ 1281.970108] 1d80: c1101d9c c1101d90 c0a78fbc c0a78e90 c1101e04 c1101da0 bf16c0a8 c0a78fac
[ 1281.978232] 1da0: de8ecd20 00200000 c1101ddc de8ecd20 c1101db0 c1101db0 00000000 00000000
[ 1281.986357] 1dc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
[ 1281.994482] 1de0: c0aa6524 de8ed864 de8ed868 00000000 00000000 c10af2a8 c1101e2c c1101e08
[ 1282.002607] 1e00: c012cf74 bf16c058 c1102098 00000006 c11bcd08 00000100 00000007 ffffe000
[ 1282.010732] 1e20: c1101e8c c1101e30 c0101614 c012cf10 c0182400 c0185260 00000001 00200102
[ 1282.018858] 1e40: c1102d00 00017f7c c0b023a8 0000000a c11f4c40 c1103c6c c10af310 c1102080
[ 1282.026982] 1e60: c0185740 c10b7b3c 00000000 00000000 00000001 de819000 e1003000 e07fcc00
[ 1282.035107] 1e80: c1101e9c c1101e90 c012c998 c01014f4 c1101ec4 c1101ea0 c01818f4 c012c8c0
[ 1282.043231] 1ea0: c11043f8 c1168010 e100200c e1002000 c1101ef0 e1003000 c1101eec c1101ec8
[ 1282.051357] 1ec0: c01014a0 c0181890 c01098b0 680f0013 ffffffff c1101f24 c0d2c0e0 c1100000
[ 1282.059481] 1ee0: c1101f4c c1101ef0 c010e24c c0101450 00000000 0018f100 1e4e9000 c011f8e0
[ 1282.067607] 1f00: ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001 e07fcc00 c1101f4c
[ 1282.075731] 1f20: c1101f50 c1101f40 c01098ac c01098b0 680f0013 ffffffff 00000051 00000000
[ 1282.083856] 1f40: c1101f5c c1101f50 c0ac2d88 c0109874 c1101f84 c1101f60 c016e3b0 c0ac2d64
[ 1282.091982] 1f60: 000000be c11f3f00 c1103c40 ffffffff c11f3f00 c1079e30 c1101f94 c1101f88
[ 1282.100107] 1f80: c016e6b0 c016e2d0 c1101fac c1101f98 c0abcc9c c016e694 c11f3f40 c11f3f00
[ 1282.108231] 1fa0: c1101ff4 c1101fb0 c1000e28 c0abcbe8 ffffffff ffffffff 00000000 c1000784
[ 1282.116357] 1fc0: 00000000 c1079e30 00000000 c11f4494 c1103c58 c1079e2c c1108800 8000406a
[ 1282.124481] 1fe0: 410fc073 00000000 00000000 c1101ff8 8000807c c1000a7c 00000000 00000000
[ 1282.132624] [<c028c0f4>] (kmem_cache_alloc) from [<c0895b9c>] (__build_skb+0x38/0xa0)
[ 1282.140411] [<c0895b9c>] (__build_skb) from [<c0895d10>] (__netdev_alloc_skb+0x94/0x110)
[ 1282.148456] [<c0895d10>] (__netdev_alloc_skb) from [<c0a729cc>] (__ieee80211_beacon_get+0x224/0x3a0)
[ 1282.157535] [<c0a729cc>] (__ieee80211_beacon_get) from [<c0a72ba8>] (ieee80211_beacon_get_tim+0x40/0x11c)
[ 1282.167077] [<c0a72ba8>] (ieee80211_beacon_get_tim) from [<bf16bbd4>] (mt76x2_update_beacon_iter+0x44/0x5c [mt76x2e])
[ 1282.177647] [<bf16bbd4>] (mt76x2_update_beacon_iter [mt76x2e]) from [<c0a78f20>] (__iterate_interfaces+0x9c/0x11c)
[ 1282.187936] [<c0a78f20>] (__iterate_interfaces) from [<c0a78fbc>] (ieee80211_iterate_active_interfaces_atomic+0x1c/0x20)
[ 1282.198756] [<c0a78fbc>] (ieee80211_iterate_active_interfaces_atomic) from [<bf16c0a8>] (mt76x2_pre_tbtt_tasklet+0x5c/0x148 [mt76x2e])
[ 1282.210783] [<bf16c0a8>] (mt76x2_pre_tbtt_tasklet [mt76x2e]) from [<c012cf74>] (tasklet_action+0x70/0x104)
[ 1282.220379] [<c012cf74>] (tasklet_action) from [<c0101614>] (__do_softirq+0x12c/0x378)
[ 1282.228248] [<c0101614>] (__do_softirq) from [<c012c998>] (irq_exit+0xe4/0x15c)
[ 1282.235516] [<c012c998>] (irq_exit) from [<c01818f4>] (__handle_domain_irq+0x70/0xc4)
[ 1282.243299] [<c01818f4>] (__handle_domain_irq) from [<c01014a0>] (gic_handle_irq+0x5c/0xa0)
[ 1282.251601] [<c01014a0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 1282.259031] Exception stack(0xc1101ef0 to 0xc1101f38)
[ 1282.264048] 1ee0: 00000000 0018f100 1e4e9000 c011f8e0
[ 1282.272173] 1f00: ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001 e07fcc00 c1101f4c
[ 1282.280296] 1f20: c1101f50 c1101f40 c01098ac c01098b0 680f0013 ffffffff
[ 1282.286872] [<c010e24c>] (__irq_svc) from [<c01098b0>] (arch_cpu_idle+0x48/0x4c)
[ 1282.294225] [<c01098b0>] (arch_cpu_idle) from [<c0ac2d88>] (default_idle_call+0x30/0x3c)
[ 1282.302267] [<c0ac2d88>] (default_idle_call) from [<c016e3b0>] (do_idle+0xec/0x150)
[ 1282.309877] [<c016e3b0>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 1282.317402] [<c016e6b0>] (cpu_startup_entry) from [<c0abcc9c>] (rest_init+0xc0/0xc4)
[ 1282.325101] [<c0abcc9c>] (rest_init) from [<c1000e28>] (start_kernel+0x3b8/0x3c4)
[ 1282.332539] Code: e121f00c e35a0000 0a000002 e5943014 (e79a3003)

Message from[ 1282.338703] ---[ end trace 8329366c083f9bce ]---
syslogd@bpi-r2-[ 1282.344651] Kernel panic - not syncing: Fatal exception in interrupt
[ 1282.352323] CPU2: stopping
[ 1282.355026] CPU: 2 PID: 3188 Comm: dmesg Tainted: G D 4.14.95-bpi-r2-main #49
[ 1282.363232] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1282.368786] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 1282.376485] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 1282.383666] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 1282.391017] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 1282.398539] [<c01014e0>] (gic_handle_irq) from [<c010e614>] (__irq_usr+0x54/0x80)
[ 1282.405970] Exception stack(0xd8149fb0 to 0xd8149ff8)
[ 1282.410987] 9fa0: beaaa9e8 004c62e1 00000000 00000032
[ 1282.419113] 9fc0: beaaa9e4 004c62e4 beaaa980 004c62e0 b6f144c0 004cb758 beaaa9e0 beaaa9e4
[ 1282.427236] 9fe0: 004c60b4 beaaa8e8 beaaa9e4 b6de2a3c 800f0030 ffffffff
[ 1282.433804] CPU1: stopping
[ 1282.436496] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D 4.14.95-bpi-r2-main #49
[ 1282.444789] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1282.450328] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 1282.458024] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 1282.465202] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 1282.472552] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 1282.480073] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 1282.487503] Exception stack(0xde943f38 to 0xde943f80)
[ 1282.492517] 3f20: 00000000 000b9204
[ 1282.500642] 3f40: 1e4fa000 c011f8e0 ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001
[ 1282.508767] 3f60: 00000000 de943f94 de943f98 de943f88 c01098ac c01098b0 60000013 ffffffff
[ 1282.516895] [<c010e24c>] (__irq_svc) from [<c01098b0>] (arch_cpu_idle+0x48/0x4c)
[ 1282.524247] [<c01098b0>] (arch_cpu_idle) from [<c0ac2d88>] (default_idle_call+0x30/0x3c)
[ 1282.532289] [<c0ac2d88>] (default_idle_call) from [<c016e3b0>] (do_idle+0xec/0x150)
[ 1282.539898] [<c016e3b0>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 1282.547421] [<c016e6b0>] (cpu_startup_entry) from [<c0110c60>] (secondary_start_kernel+0x170/0x194)
[ 1282.556409] [<c0110c60>] (secondary_start_kernel) from [<801018ec>] (0x801018ec)
[ 1282.563755] CPU3: stopping
[ 1282.566447] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G D 4.14.95-bpi-r2-main #49
[ 1282.574739] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1282.580279] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 1282.587975] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 1282.595152] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 1282.602503] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 1282.610024] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 1282.617454] Exception stack(0xde947ea0 to 0xde947ee8)
[ 1282.622474] 7ea0: dbc09200 00000001 dbc09200 0000b59f c10b7f80 00000000 df5d3f80 1e51c000
[ 1282.630598] 7ec0: c0abdbfc ffffe000 de91c800 de947f34 de947f38 de947ef0 c0abdbfc c015028c
[ 1282.638718] 7ee0: 600d0013 ffffffff
[ 1282.642188] [<c010e24c>] (__irq_svc) from [<c015028c>] (finish_task_switch+0xf0/0x244)
[ 1282.650059] [<c015028c>] (finish_task_switch) from [<c0abdbfc>] (__schedule+0x21c/0x6f8)
[ 1282.658101] [<c0abdbfc>] (__schedule) from [<c0abe500>] (schedule_idle+0x44/0x84)
[ 1282.665538] [<c0abe500>] (schedule_idle) from [<c016e3d4>] (do_idle+0x110/0x150)
[ 1282.672889] [<c016e3d4>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 1282.680413] [<c016e6b0>] (cpu_startup_entry) from [<c0110c60>] (secondary_start_kernel+0x170/0x194)
[ 1282.689400] [<c0110c60>] (secondary_start_kernel) from [<801018ec>] (0x801018ec)
[ 1282.696754] ---[ end Kernel panic - not syncing: Fatal exception in interrupt
e at Feb 4 19:03:43 ...
kernel:[ 1281.738425] Internal error: Oops: 5 [#1] SMP ARM

=============================================================================================================================

19:15] root@bpi-r2-e:~ (156)# [ 666.687166] Unable to handle kernel NULL pointer dereference at virtual address 00000001
[ 666.695237] pgd = c0004000
[ 666.697927] [00000001] *pgd=00000000
[ 666.701484] Internal error: Oops: 5 [#1] SMP ARM
[ 666.706066] Modules linked in: xt_addrtype veth pppoe pppox ppp_generic slhc sit tunnel4 ip_tunnel bridge ip6t_REJECT nf_reject_ipv6 xt_mac
ip6t_rt nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables ipt_REJECT nf_reject_ipv4 xt_limit xt_iprange xt_recent xt_conntrack iptabl
e_filter ipt_MASQUERADE nf_nat_masquerade_ipv4 tun xt_nat xt_tcpudp iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrac
k xt_mark iptable_mangle spi_mt65xx mtk_thermal thermal_sys evbug mt6577_auxadc pwm_mediatek mtk_pmic_keys rtc_mt6397 nvmem_mtk_efuse nfsd ip_t
ables x_tables ipv6 [last unloaded: mt76]
[ 666.759246] CPU: 0 PID: 0 Comm: swapper/0 Not tainted 4.14.95-bpi-r2-main #49
[ 666.766329] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 666.771860] task: c11073c0 task.stack: c1100000
[ 666.776363] PC is at kmem_cache_alloc+0xd0/0x21c
[ 666.780945] LR is at 0x179ab
[ 666.783801] pc : [<c028c0f4>] lr : [<000179ab>] psr: 200f0113
[ 666.790020] sp : c1101cd0 ip : a00f0113 fp : c1101d04
[ 666.795204] r10: 00000001 r9 : de97cb40 r8 : c0895b9c
[ 666.800389] r7 : de801cc0 r6 : 01080020 r5 : c1226790 r4 : de801cc0
[ 666.806867] r3 : 00000000 r2 : df5a39d4 r1 : 1e4e9000 r0 : 000179aa
[ 666.813347] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 666.820429] Control: 10c5387d Table: 9bbc806a DAC: 00000051
[ 666.826133] Process swapper/0 (pid: 0, stack limit = 0xc1100218)
[ 666.832093] Stack: (0xc1101cd0 to 0xc1102000)
[ 666.836423] 1cc0: 9a7c0c40 df9b1700 00000500 da723ec0
[ 666.844549] 1ce0: 00000740 00000740 da723ec0 dd8a0000 9a7c0500 deb6c728 c1101d2c c1101d08
[ 666.852674] 1d00: c0895b9c c028c030 da723ec0 00000740 da723ec0 e1038b00 dd8a0000 9a7c0500
[ 666.860799] 1d20: c1101d44 c1101d30 c0895c24 c0895b70 deb6c628 000005b0 c1101dbc c1101d48
[ 666.868924] 1d40: c071b4a0 c0895c10 00000002 00000000 c0dba83c 00000040 deb6c010 c1225940
[ 666.877050] 1d60: 3fff0000 00000000 c0b0184c 9a723f00 e1033000 c5ee0004 c08a9a98 c08a6ef0
[ 666.885175] 1d80: 00000040 da7c04c0 2a678002 00000000 c1101dbc deb6c728 00000001 00000040
[ 666.893299] 1da0: c11c0048 0000012c 00008f3d c1101df0 c1101e2c c1101dc0 c08ae4d8 c071b328
[ 666.901424] 1dc0: dd889940 dead4d00 c1101de4 c0debe30 c1104fcc c1103c6c ffffe000 c11bcb49
[ 666.909550] 1de0: c10b8840 df5a1840 1e4e9000 c1102d00 c1101df0 c1101df0 c1101df8 c1101df8
[ 666.917675] 1e00: ffffe000 c110208c 00000003 c11bcd08 00000100 00000004 ffffe000 00000008
[ 666.925800] 1e20: c1101e8c c1101e30 c0101614 c08ae39c c0182400 c0185260 00000001 00200102
[ 666.933925] 1e40: c1102d00 00008f3d c0b023a8 0000000a c11f4c40 c1103c6c c10af310 c1102080
[ 666.942050] 1e60: c0185740 c10b7b3c 00000000 00000000 00000001 de819000 e1003000 e07fcc00
[ 666.950176] 1e80: c1101e9c c1101e90 c012c998 c01014f4 c1101ec4 c1101ea0 c01818f4 c012c8c0
[ 666.958302] 1ea0: c11043f8 c1168010 e100200c e1002000 c1101ef0 e1003000 c1101eec c1101ec8
[ 666.966428] 1ec0: c01014a0 c0181890 c01098b0 600f0013 ffffffff c1101f24 c0d2c0e0 c1100000
[ 666.974553] 1ee0: c1101f4c c1101ef0 c010e24c c0101450 00000000 000aeb14 1e4e9000 c011f8e0
[ 666.982678] 1f00: ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001 e07fcc00 c1101f4c
[ 666.990803] 1f20: c1101f50 c1101f40 c01098ac c01098b0 600f0013 ffffffff 00000051 00000000
[ 666.998927] 1f40: c1101f5c c1101f50 c0ac2d88 c0109874 c1101f84 c1101f60 c016e3b0 c0ac2d64
[ 667.007053] 1f60: 000000be c11f3f00 c1103c40 ffffffff c11f3f00 c1079e30 c1101f94 c1101f88
[ 667.015180] 1f80: c016e6b0 c016e2d0 c1101fac c1101f98 c0abcc9c c016e694 c11f3f40 c11f3f00
[ 667.023305] 1fa0: c1101ff4 c1101fb0 c1000e28 c0abcbe8 ffffffff ffffffff 00000000 c1000784
[ 667.031431] 1fc0: 00000000 c1079e30 00000000 c11f4494 c1103c58 c1079e2c c1108800 8000406a
[ 667.039556] 1fe0: 410fc073 00000000 00000000 c1101ff8 8000807c c1000a7c 00000000 00000000
[ 667.047698] [<c028c0f4>] (kmem_cache_alloc) from [<c0895b9c>] (__build_skb+0x38/0xa0)
[ 667.055485] [<c0895b9c>] (__build_skb) from [<c0895c24>] (build_skb+0x20/0x78)
[ 667.062671] [<c0895c24>] (build_skb) from [<c071b4a0>] (mtk_napi_rx+0x184/0x568)
[ 667.070024] [<c071b4a0>] (mtk_napi_rx) from [<c08ae4d8>] (net_rx_action+0x148/0x400)
[ 667.077722] [<c08ae4d8>] (net_rx_action) from [<c0101614>] (__do_softirq+0x12c/0x378)
[ 667.085507] [<c0101614>] (__do_softirq) from [<c012c998>] (irq_exit+0xe4/0x15c)
[ 667.092775] [<c012c998>] (irq_exit) from [<c01818f4>] (__handle_domain_irq+0x70/0xc4)
[ 667.100561] [<c01818f4>] (__handle_domain_irq) from [<c01014a0>] (gic_handle_irq+0x5c/0xa0)
[ 667.108861] [<c01014a0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 667.116293] Exception stack(0xc1101ef0 to 0xc1101f38)
[ 667.121309] 1ee0: 00000000 000aeb14 1e4e9000 c011f8e0
[ 667.129436] 1f00: ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001 e07fcc00 c1101f4c
[ 667.137560] 1f20: c1101f50 c1101f40 c01098ac c01098b0 600f0013 ffffffff
[ 667.144138] [<c010e24c>] (__irq_svc) from [<c01098b0>] (arch_cpu_idle+0x48/0x4c)
[ 667.151494] [<c01098b0>] (arch_cpu_idle) from [<c0ac2d88>] (default_idle_call+0x30/0x3c)
[ 667.159537] [<c0ac2d88>] (default_idle_call) from [<c016e3b0>] (do_idle+0xec/0x150)
[ 667.167150] [<c016e3b0>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 667.174675] [<c016e6b0>] (cpu_startup_entry) from [<c0abcc9c>] (rest_init+0xc0/0xc4)
[ 667.182376] [<c0abcc9c>] (rest_init) from [<c1000e28>] (start_kernel+0x3b8/0x3c4)
[ 667.189815] Code: e121f00c e35a0000 0a000002 e5943014 (e79a3003)
[ 667.195994] ---[ end trace 2a6dec570c221166 ]---
[ 667.200595] Kernel panic - not syncing: Fatal exception in interrupt
[ 667.206914] CPU3: stopping
[ 667.209614] CPU: 3 PID: 165 Comm: systemd-journal Tainted: G D 4.14.95-bpi-r2-main #49
[ 667.218596] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 667.224148] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 667.231845] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 667.239025] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 667.246376] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 667.253898] [<c01014e0>] (gic_handle_irq) from [<c010e614>] (__irq_usr+0x54/0x80)
[ 667.261329] Exception stack(0xdde3ffb0 to 0xdde3fff8)
[ 667.266346] ffa0: bec8224f 0000000a 00000001 000005e8
[ 667.274471] ffc0: 00000001 b6ccd97d bec81e28 bec81db0 00000000 bec82280 00000009 00000000
[ 667.282594] ffe0: b6d69010 bec81d90 b6cb24cb b6cb1a5e 200d0030 ffffffff
[ 667.289161] CPU2: stopping
[ 667.291854] CPU: 2 PID: 0 Comm: swapper/2 Tainted: G D 4.14.95-bpi-r2-main #49
[ 667.300146] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 667.305685] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 667.313380] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 667.320559] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 667.327909] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 667.335431] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 667.342861] Exception stack(0xde945f38 to 0xde945f80)
[ 667.347875] 5f20: 00000000 000611a4
[ 667.356000] 5f40: 1e50b000 c011f8e0 ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001
[ 667.364125] 5f60: 00000000 de945f94 de945f98 de945f88 c01098ac c01098b0 600f0013 ffffffff
[ 667.372253] [<c010e24c>] (__irq_svc) from [<c01098b0>] (arch_cpu_idle+0x48/0x4c)
[ 667.379605] [<c01098b0>] (arch_cpu_idle) from [<c0ac2d88>] (default_idle_call+0x30/0x3c)
[ 667.387646] [<c0ac2d88>] (default_idle_call) from [<c016e3b0>] (do_idle+0xec/0x150)
[ 667.395254] [<c016e3b0>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 667.402778] [<c016e6b0>] (cpu_startup_entry) from [<c0110c60>] (secondary_start_kernel+0x170/0x194)
[ 667.411766] [<c0110c60>] (secondary_start_kernel) from [<801018ec>] (0x801018ec)
[ 667.419113] CPU1: stopping
[ 667.421805] CPU: 1 PID: 0 Comm: swapper/1 Tainted: G D 4.14.95-bpi-r2-main #49
[ 667.430098] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 667.435639] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 667.443334] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 667.450513] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 667.457863] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 667.465385] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 667.472816] Exception stack(0xde943f38 to 0xde943f80)
[ 667.477831] 3f20: 00000000 00071d18
[ 667.485956] 3f40: 1e4fa000 c011f8e0 ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001
[ 667.494081] 3f60: 00000000 de943f94 de943f98 de943f88 c01098ac c01098b0 680e0013 ffffffff
[ 667.502208] [<c010e24c>] (__irq_svc) from [<c01098b0>] (arch_cpu_idle+0x48/0x4c)
[ 667.509558] [<c01098b0>] (arch_cpu_idle) from [<c0ac2d88>] (default_idle_call+0x30/0x3c)
[ 667.517598] [<c0ac2d88>] (default_idle_call) from [<c016e3b0>] (do_idle+0xec/0x150)
[ 667.525207] [<c016e3b0>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 667.532730] [<c016e6b0>] (cpu_startup_entry) from [<c0110c60>] (secondary_start_kernel+0x170/0x194)
[ 667.541717] [<c0110c60>] (secondary_start_kernel) from [<801018ec>] (0x801018ec)
[ 667.549071] ---[ end Kernel panic - not syncing: Fatal exception in interrupt

=============================================================================================================

[ 1851.777568] Internal err
or: Oops: 5 [#1] SMP ARM
[ 1851.782161] Modules linked in: xt_addrtype veth pppoe pppox ppp_generic slhc sit tunnel4 ip_tunnel brid
ge ip6t_REJECT nf_reject_ipv6 xt_mac ip6t_rt nf_conntrack_ipv6 nf_defrag_ipv6 ip6table_filter ip6_tables i
pt_REJECT nf_reject_ipv4 xt_limit xt_iprange xt_recent xt_conntrack iptable_filter ipt_MASQUERADE nf_nat_m
asquerade_ipv4 xt_nat tun xt_tcpudp iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_con
ntrack xt_mark iptable_mangle mtk_thermal thermal_sys mt6577_auxadc pwm_mediatek spi_mt65xx evbug mtk_pmic
_keys rtc_mt6397 nvmem_mtk_efuse nfsd ip_tables x_tables ipv6 [last unloaded: mt76]
[ 1851.835334] CPU: 0 PID: 3428 Comm: SoftwareVsyncTh Not tainted 4.14.95-bpi-r2-main #49
[ 1851.843192] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1851.848722] task: da788600 task.stack: da77e000
[ 1851.853226] PC is at kmem_cache_alloc+0xd0/0x21c
[ 1851.857807] LR is at 0x6fc3d
[ 1851.860663] pc : [<c028c0f4>] lr : [<0006fc3d>] psr: 20070113
[ 1851.866881] sp : da77fd70 ip : a0070113 fp : da77fda4
[ 1851.872064] r10: 00000001 r9 : de950900 r8 : c08958f0
[ 1851.877249] r7 : de801cc0 r6 : 01080020 r5 : c1226790 r4 : de801cc0
[ 1851.883727] r3 : 00000000 r2 : df5a39d4 r1 : 1e4e9000 r0 : 0006fc3c
[ 1851.890207] Flags: nzCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
[ 1851.897290] Control: 10c5387d Table: 9bba006a DAC: 00000051
[ 1851.902992] Process SoftwareVsyncTh (pid: 3428, stack limit = 0xda77e218)
[ 1851.909729] Stack: (0xda77fd70 to 0xda780000)
[ 1851.914054] fd60: 1e4e9000 c019d1cc 20070193 01080020
[ 1851.922175] fd80: 00000080 00000000 de801cc0 01080020 00000000 00000000 da77fdd4 da77fda8
[ 1851.930302] fda0: c08958f0 c028c030 00000000 df59eb9c 01080020 db7b8300 c119f040 db7b8314
[ 1851.938428] fdc0: 0000001c 00000000 da77fe0c da77fdd8 c08b965c c08958a8 da77fdfc da77fde8
[ 1851.946553] fde0: c0149494 db7b8300 db7b8318 00000001 db7b8314 00000003 00000000 ffffe000
[ 1851.954678] fe00: da77fe34 da77fe10 c08be820 c08b961c c11bd17c 00000100 c08be68c db7b8330
[ 1851.962803] fe20: 00000200 00000000 da77fe6c da77fe38 c019bdc4 c08be698 c019db48 df5a4140
[ 1851.970928] fe40: 00000000 2617d280 000001af db7b8330 df59c440 da77fea8 c11bd17c 00000200
[ 1851.979053] fe60: da77fea4 da77fe70 c019c008 c019bd84 df5a4140 c1103c6c 00000000 da77fea4
[ 1851.987179] fe80: df59c440 da77fea4 c1102d00 c10b3440 1e4e9000 00000282 da77feec da77fea8
[ 1851.995304] fea0: c019c158 c019bf20 00000000 df59d5f8 da77ff0c da77fec0 c019ea04 c01af384
[ 1852.003429] fec0: a54fec74 000001af c1102084 00000001 c11bcd08 00000100 00000002 ffffe000
[ 1852.011554] fee0: da77ff4c da77fef0 c0101614 c019c090 00000010 de819000 e1003000 00400040
[ 1852.019679] ff00: c1102d00 00025e29 c0b023a8 0000000a c11f4c40 c1103c6c c10af310 c1102080
[ 1852.027804] ff20: c0186bf8 c10b7b3c 00000000 00000000 00000001 de819000 e1003000 6e5f9d25
[ 1852.035929] ff40: da77ff5c da77ff50 c012c998 c01014f4 da77ff84 da77ff60 c01818f4 c012c8c0
[ 1852.044054] ff60: c11043f8 c1168010 e100200c e1002000 da77ffb0 e1003000 da77ffac da77ff88
[ 1852.052178] ff80: c01014a0 c0181890 b6d8875e 20070030 ffffffff 10c5387d 10c5387d a54fec30
[ 1852.060303] ffa0: 00000000 da77ffb0 c010e614 c0101450 00000b98 000003e8 b6d88688 0002eaba
[ 1852.068427] ffc0: a556b64c a54fec30 b6f86ce8 a54fec70 a54fec44 a54fec30 6e5f9d25 00000000
[ 1852.076551] ffe0: 2d4ca952 a54febf0 b361d339 b6d8875e 20070030 ffffffff 00000000 00000000
[ 1852.084692] [<c028c0f4>] (kmem_cache_alloc) from [<c08958f0>] (__alloc_skb+0x54/0x140)
[ 1852.092568] [<c08958f0>] (__alloc_skb) from [<c08b965c>] (__neigh_notify+0x4c/0xdc)
[ 1852.100181] [<c08b965c>] (__neigh_notify) from [<c08be820>] (neigh_timer_handler+0x194/0x278)
[ 1852.108657] [<c08be820>] (neigh_timer_handler) from [<c019bdc4>] (call_timer_fn+0x4c/0x19c)
[ 1852.116959] [<c019bdc4>] (call_timer_fn) from [<c019c008>] (expire_timers+0xf4/0x170)
[ 1852.124742] [<c019c008>] (expire_timers) from [<c019c158>] (run_timer_softirq+0xd4/0x1cc)
[ 1852.132870] [<c019c158>] (run_timer_softirq) from [<c0101614>] (__do_softirq+0x12c/0x378)
[ 1852.140999] [<c0101614>] (__do_softirq) from [<c012c998>] (irq_exit+0xe4/0x15c)
[ 1852.148266] [<c012c998>] (irq_exit) from [<c01818f4>] (__handle_domain_irq+0x70/0xc4)
[ 1852.156049] [<c01818f4>] (__handle_domain_irq) from [<c01014a0>] (gic_handle_irq+0x5c/0xa0)
[ 1852.164349] [<c01014a0>] (gic_handle_irq) from [<c010e614>] (__irq_usr+0x54/0x80)
[ 1852.171779] Exception stack(0xda77ffb0 to 0xda77fff8)
[ 1852.176795] ffa0: 00000b98 000003e8 b6d88688 0002eaba
[ 1852.184920] ffc0: a556b64c a54fec30 b6f86ce8 a54fec70 a54fec44 a54fec30 6e5f9d25 00000000
[ 1852.193043] ffe0: 2d4ca952 a54febf0 b361d339 b6d8875e 20070030 ffffffff
[ 1852.199615] Code: e121f00c e35a0000 0a000002 e5943014 (e79a3003)
[ 1852.205765] ---[ end trace eeb67939bd037a21 ]---
[ 1852.210418] Kernel panic - not syncing: Fatal exception in interrupt
[ 1852.216750] CPU2: stopping
[ 1852.219449] CPU: 2 PID: 164 Comm: systemd-journal Tainted: G D 4.14.95-bpi-r2-main #49
[ 1852.228431] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1852.233982] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 1852.241680] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 1852.248860] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 1852.256212] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 1852.263734] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 1852.271165] Exception stack(0xdde57eb0 to 0xdde57ef8)
[ 1852.276183] 7ea0: 004e6190 beffffff 00000055 00000010
[ 1852.284308] 7ec0: ffffe000 00000051 004e6180 80808080 deb6d01c fefefeff 00000ff0 dde57f34
[ 1852.292431] 7ee0: 00000fe0 dde57f00 c04a9fd4 c0aa688c 20000013 ffffffff
[ 1852.299004] [<c010e24c>] (__irq_svc) from [<c0aa688c>] (__get_user_4+0x0/0x20)
[ 1852.306177] CPU1: stopping
[ 1852.308869] CPU: 1 PID: 402 Comm: rs:main Q:Reg Tainted: G D 4.14.95-bpi-r2-main #49
[ 1852.317679] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1852.323219] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 1852.330914] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 1852.338092] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 1852.345443] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 1852.352964] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 1852.360395] Exception stack(0xdc0d5da0 to 0xdc0d5de8)
[ 1852.365413] 5da0: c1232c48 a0030013 00000007 00004fbe c1232c48 dec3a000 00000000 00000076
[ 1852.373537] 5dc0: 00000fff dcd36400 dc18a076 dc0d5dfc dc0d5e00 dc0d5df0 c052f398 c0ac2f24
[ 1852.381658] 5de0: 80030013 ffffffff
[ 1852.385127] [<c010e24c>] (__irq_svc) from [<c0ac2f24>] (_raw_spin_unlock_irqrestore+0x30/0x34)
[ 1852.393686] [<c0ac2f24>] (_raw_spin_unlock_irqrestore) from [<c052f398>] (uart_write+0x128/0x194)
[ 1852.402505] [<c052f398>] (uart_write) from [<c0514660>] (n_tty_write+0x1c8/0x454)
[ 1852.409942] [<c0514660>] (n_tty_write) from [<c05103c4>] (tty_write+0x19c/0x378)
[ 1852.417296] [<c05103c4>] (tty_write) from [<c029fd28>] (__vfs_write+0x38/0x130)
[ 1852.424563] [<c029fd28>] (__vfs_write) from [<c029ffb4>] (vfs_write+0xb4/0x178)
[ 1852.431829] [<c029ffb4>] (vfs_write) from [<c02a01a8>] (SyS_write+0x4c/0xa0)
[ 1852.438833] [<c02a01a8>] (SyS_write) from [<c0108c80>] (ret_fast_syscall+0x0/0x54)
[ 1852.446352] CPU3: stopping
[ 1852.449046] CPU: 3 PID: 0 Comm: swapper/3 Tainted: G D 4.14.95-bpi-r2-main #49
[ 1852.457338] Hardware name: Mediatek Cortex-A7 (Device Tree)
[ 1852.462878] [<c0113358>] (unwind_backtrace) from [<c010d580>] (show_stack+0x20/0x24)
[ 1852.470574] [<c010d580>] (show_stack) from [<c0aa8e18>] (dump_stack+0x94/0xa8)
[ 1852.477753] [<c0aa8e18>] (dump_stack) from [<c011124c>] (handle_IPI+0x358/0x378)
[ 1852.485103] [<c011124c>] (handle_IPI) from [<c01014e0>] (gic_handle_irq+0x9c/0xa0)
[ 1852.492625] [<c01014e0>] (gic_handle_irq) from [<c010e24c>] (__irq_svc+0x6c/0x90)
[ 1852.500055] Exception stack(0xde947f38 to 0xde947f80)
[ 1852.505071] 7f20: 00000000 000fa8e8
[ 1852.513195] 7f40: 1e51c000 c011f8e0 ffffe000 c1103ccc c1103c6c c11bc85f c0d2c0e0 00000001
[ 1852.521320] 7f60: 00000000 de947f94 de947f98 de947f88 c01098ac c01098b0 60000013 ffffffff
[ 1852.529447] [<c010e24c>] (__irq_svc) from [<c01098b0>] (arch_cpu_idle+0x48/0x4c)
[ 1852.536799] [<c01098b0>] (arch_cpu_idle) from [<c0ac2d88>] (default_idle_call+0x30/0x3c)
[ 1852.544841] [<c0ac2d88>] (default_idle_call) from [<c016e3b0>] (do_idle+0xec/0x150)
[ 1852.552451] [<c016e3b0>] (do_idle) from [<c016e6b0>] (cpu_startup_entry+0x28/0x2c)
[ 1852.559974] [<c016e6b0>] (cpu_startup_entry) from [<c0110c60>] (secondary_start_kernel+0x170/0x194)
[ 1852.568962] [<c0110c60>] (secondary_start_kernel) from [<801018ec>] (0x801018ec)
[ 1852.576318] ---[ end Kernel panic - not syncing: Fatal exception in interrupt

^ permalink raw reply

* Re: pull-request: wireless-drivers-next 2019-02-06
From: David Miller @ 2019-02-06 17:37 UTC (permalink / raw)
  To: kvalo; +Cc: linux-wireless, netdev, linux-kernel
In-Reply-To: <878sytbd3d.fsf@kamboji.qca.qualcomm.com>

From: Kalle Valo <kvalo@codeaurora.org>
Date: Wed, 06 Feb 2019 09:17:10 +0200

> here's a pull request to net-next for 5.1, more info below. Please let
> me know if there are any problems.

Pulled, thanks Kalle!

^ permalink raw reply

* Re: [Patch net-next] mlx5: use RCU lock in mlx5_eq_cq_get()
From: Saeed Mahameed @ 2019-02-06 17:37 UTC (permalink / raw)
  To: eric.dumazet@gmail.com, netdev@vger.kernel.org, Tariq Toukan,
	xiyou.wangcong@gmail.com
In-Reply-To: <8df59337-8c20-de92-6088-d008031da6f2@gmail.com>

On Wed, 2019-02-06 at 09:17 -0800, Eric Dumazet wrote:
> 
> On 02/06/2019 08:55 AM, Saeed Mahameed wrote:
> > On Wed, 2019-02-06 at 12:02 +0000, Tariq Toukan wrote:
> > > On 2/6/2019 2:35 AM, Cong Wang wrote:
> > > > mlx5_eq_cq_get() is called in IRQ handler, the spinlock inside
> > > > gets a lot of contentions when we test some heavy workload
> > > > with 60 RX queues and 80 CPU's, and it is clearly shown in the
> > > > flame graph.
> > > > 
> > 
> > Hi Cong,
> > 
> > The patch is ok to me, but i really doubt that you can hit a
> > contention
> > on latest upstream driver, since we already have spinlock per EQ,
> > which
> > means spinlock per core,  each EQ (core) msix handler can only
> > access
> > one spinlock (its own), so I am surprised how you got the
> > contention,
> > Maybe you are not running on latest upstream driver ?
> > 
> > what is the workload ? 
> 
> Surprisingly (or not), atomic operations, even on _not_ contended
> cache lines can
> stall the cpu enough for perf tools to notice...
> 
> If the atomic operation can be trivially replaced by RCU, then do it
> by any mean.
> 
> 

Totally agree, Thanks Eric.

^ permalink raw reply

* Re: [Patch net-next] mlx5: use RCU lock in mlx5_eq_cq_get()
From: Saeed Mahameed @ 2019-02-06 17:40 UTC (permalink / raw)
  To: netdev@vger.kernel.org, xiyou.wangcong@gmail.com; +Cc: Tariq Toukan
In-Reply-To: <04cf201a72e3c75c706fb12f235eeba9203ce0dd.camel@mellanox.com>

On Wed, 2019-02-06 at 09:35 -0800, Saeed Mahameed wrote:
> On Tue, 2019-02-05 at 16:35 -0800, Cong Wang wrote:
> > mlx5_eq_cq_get() is called in IRQ handler, the spinlock inside
> > gets a lot of contentions when we test some heavy workload
> > with 60 RX queues and 80 CPU's, and it is clearly shown in the
> > flame graph.
> > 
> > In fact, radix_tree_lookup() is perfectly fine with RCU read lock,
> > we don't have to take a spinlock on this hot path. It is pretty
> > much
> > similar to commit 291c566a2891
> > ("net/mlx4_core: Fix racy CQ (Completion Queue) free"). Slow paths
> > are still serialized with the spinlock, and with synchronize_irq()
> > it should be safe to just move the fast path to RCU read lock.
> > 
> > This patch itself reduces the latency by about 50% with our
> > workload.
> > 
> > Cc: Saeed Mahameed <saeedm@mellanox.com>
> > Cc: Tariq Toukan <tariqt@mellanox.com>
> > Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
> 
> Acked-by: Saeed Mahameed <saeedm@mellanox.com>
> 

Actually, the commit message needs some rework, since there is no
contention upstream, Cong can you take care of this and post a V2 ?

Thanks,
Saeed.

^ permalink raw reply

* Re: [PATCH] rhashtable: use irq-safe spinlock in rhashtable_rehash_table()
From: David Miller @ 2019-02-06 17:40 UTC (permalink / raw)
  To: johannes; +Cc: linux-wireless, netdev, j, tgraf, herbert
In-Reply-To: <726dba28e925c6ade53f362c4f48b2ee28841dc2.camel@sipsolutions.net>

From: Johannes Berg <johannes@sipsolutions.net>
Date: Wed, 06 Feb 2019 09:15:15 +0100

> On Tue, 2019-02-05 at 15:37 +0100, Johannes Berg wrote:
>> From: Johannes Berg <johannes.berg@intel.com>
>> 
>> When an rhashtabl walk is done from irq/bh context, we rightfully
>> get a lockdep complaint saying that we could get a (soft-)IRQ in
>> the middle of a rehash. This happened e.g. in mac80211 as it does
>> a walk in soft-irq context.
>> 
>> Fix this by using irq-safe locking here. We don't need _irqsave()
>> as we know this will be called only in process context from the
>> workqueue. We could get away with _bh() but that seems a bit less
>> generic, though I'm not sure anyone would want to do a walk from
>> a real IRQ handler.
> 
> Please drop this, it doesn't make sense.
> 
> I'll resend with all the spinlock usage changed to either _bh or
> _irqsave(), since it makes no sense to enforce any kind of outside
> BH/irq disabling for purposes of the inner lock.

Ok.

^ permalink raw reply

* Re: [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee()
From: Florian Fainelli @ 2019-02-06 17:42 UTC (permalink / raw)
  To: Dan Carpenter, Andrew Lunn
  Cc: Vivien Didelot, David S. Miller, netdev, kernel-janitors
In-Reply-To: <20190206153514.GA11033@kadam>

On 2/6/19 7:35 AM, Dan Carpenter wrote:
> This function can't succeed if dp->pl is NULL.  It will Oops inside the
> call to return phylink_ethtool_get_eee(dp->pl, e);
> 
> Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Florian Fainelli <f.fainelli@gmail.com>

thanks Dan!
-- 
Florian

^ permalink raw reply

* Re: [Patch net-next] mlx5: use RCU lock in mlx5_eq_cq_get()
From: Cong Wang @ 2019-02-06 17:43 UTC (permalink / raw)
  To: Saeed Mahameed; +Cc: netdev@vger.kernel.org, Tariq Toukan
In-Reply-To: <f1a0ff14f4c7c970dda40dd6e59adb994d1989de.camel@mellanox.com>

On Wed, Feb 6, 2019 at 9:35 AM Saeed Mahameed <saeedm@mellanox.com> wrote:
>
> On Wed, 2019-02-06 at 09:15 -0800, Cong Wang wrote:
> > On Wed, Feb 6, 2019 at 8:55 AM Saeed Mahameed <saeedm@mellanox.com>
> > wrote:
> > > Hi Cong,
> > >
> > > The patch is ok to me, but i really doubt that you can hit a
> > > contention
> > > on latest upstream driver, since we already have spinlock per EQ,
> > > which
> > > means spinlock per core,  each EQ (core) msix handler can only
> > > access
> > > one spinlock (its own), so I am surprised how you got the
> > > contention,
> > > Maybe you are not running on latest upstream driver ?
> >
> > We are running 4.14 stable release. Which commit changes the game
> > here? We can consider to backport it unless it is complicated.
> >
>
> Ok, so there is no issue upstream, you are just missing the following
> patch:
>
> commit 02d92f7903647119e125b24f5470f96cee0d4b4b
> Author: Saeed Mahameed <saeedm@mellanox.com>
> Date:   Fri Jan 19 16:13:01 2018 -0800
>
>     net/mlx5: CQ Database per EQ
>
>     Before this patch the driver had one CQ database protected via one
>     spinlock, this spinlock is meant to synchronize between CQ
>     adding/removing and CQ IRQ interrupt handling.


Thanks for pointing it out! I will evaluate if we should backport it to
4.14.

^ permalink raw reply

* [PATCH net-next v4 07/12] nfp: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

NFP only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().

Since NFP uses switchdev_port_same_parent_id() convert it to use
netdev_port_same_parent_id().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../ethernet/netronome/nfp/flower/action.c    |  3 +--
 .../ethernet/netronome/nfp/nfp_net_common.c   |  4 +---
 .../net/ethernet/netronome/nfp/nfp_net_repr.c |  4 +---
 drivers/net/ethernet/netronome/nfp/nfp_port.c | 22 +++++--------------
 drivers/net/ethernet/netronome/nfp/nfp_port.h |  4 +++-
 5 files changed, 11 insertions(+), 26 deletions(-)

diff --git a/drivers/net/ethernet/netronome/nfp/flower/action.c b/drivers/net/ethernet/netronome/nfp/flower/action.c
index 8d54b36afee8..7b217d7285c7 100644
--- a/drivers/net/ethernet/netronome/nfp/flower/action.c
+++ b/drivers/net/ethernet/netronome/nfp/flower/action.c
@@ -3,7 +3,6 @@
 
 #include <linux/bitfield.h>
 #include <net/pkt_cls.h>
-#include <net/switchdev.h>
 #include <net/tc_act/tc_csum.h>
 #include <net/tc_act/tc_gact.h>
 #include <net/tc_act/tc_mirred.h>
@@ -137,7 +136,7 @@ nfp_fl_output(struct nfp_app *app, struct nfp_fl_output *output,
 
 		if (nfp_netdev_is_nfp_repr(in_dev)) {
 			/* Confirm ingress and egress are on same device. */
-			if (!switchdev_port_same_parent_id(in_dev, out_dev))
+			if (!netdev_port_same_parent_id(in_dev, out_dev))
 				return -EOPNOTSUPP;
 		}
 
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
index 7d2d4241498f..776f6c07701b 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_common.c
@@ -36,7 +36,6 @@
 #include <linux/vmalloc.h>
 #include <linux/ktime.h>
 
-#include <net/switchdev.h>
 #include <net/vxlan.h>
 
 #include "nfpcore/nfp_nsp.h"
@@ -3531,6 +3530,7 @@ const struct net_device_ops nfp_net_netdev_ops = {
 	.ndo_udp_tunnel_add	= nfp_net_add_vxlan_port,
 	.ndo_udp_tunnel_del	= nfp_net_del_vxlan_port,
 	.ndo_bpf		= nfp_net_xdp,
+	.ndo_get_port_parent_id	= nfp_port_get_port_parent_id,
 };
 
 /**
@@ -3815,8 +3815,6 @@ static void nfp_net_netdev_init(struct nfp_net *nn)
 	netdev->netdev_ops = &nfp_net_netdev_ops;
 	netdev->watchdog_timeo = msecs_to_jiffies(5 * 1000);
 
-	SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops);
-
 	/* MTU range: 68 - hw-specific max */
 	netdev->min_mtu = ETH_MIN_MTU;
 	netdev->max_mtu = nn->max_mtu;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
index 69d7aebda09b..62839807e21e 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_net_repr.c
@@ -5,7 +5,6 @@
 #include <linux/io-64-nonatomic-hi-lo.h>
 #include <linux/lockdep.h>
 #include <net/dst_metadata.h>
-#include <net/switchdev.h>
 
 #include "nfpcore/nfp_cpp.h"
 #include "nfpcore/nfp_nsp.h"
@@ -273,6 +272,7 @@ const struct net_device_ops nfp_repr_netdev_ops = {
 	.ndo_fix_features	= nfp_repr_fix_features,
 	.ndo_set_features	= nfp_port_set_features,
 	.ndo_set_mac_address    = eth_mac_addr,
+	.ndo_get_port_parent_id	= nfp_port_get_port_parent_id,
 };
 
 void
@@ -336,8 +336,6 @@ int nfp_repr_init(struct nfp_app *app, struct net_device *netdev,
 
 	netdev->max_mtu = pf_netdev->max_mtu;
 
-	SWITCHDEV_SET_OPS(netdev, &nfp_port_switchdev_ops);
-
 	/* Set features the lower device can support with representors */
 	if (repr_cap & NFP_NET_CFG_CTRL_LIVE_ADDR)
 		netdev->priv_flags |= IFF_LIVE_ADDR_CHANGE;
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.c b/drivers/net/ethernet/netronome/nfp/nfp_port.c
index 86bc149ca231..7e90880fa46b 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.c
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.c
@@ -31,34 +31,22 @@ struct nfp_port *nfp_port_from_netdev(struct net_device *netdev)
 	return NULL;
 }
 
-static int
-nfp_port_attr_get(struct net_device *netdev, struct switchdev_attr *attr)
+int nfp_port_get_port_parent_id(struct net_device *netdev,
+				struct netdev_phys_item_id *ppid)
 {
 	struct nfp_port *port;
+	const u8 *serial;
 
 	port = nfp_port_from_netdev(netdev);
 	if (!port)
 		return -EOPNOTSUPP;
 
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID: {
-		const u8 *serial;
-		/* N.B: attr->u.ppid.id is binary data */
-		attr->u.ppid.id_len = nfp_cpp_serial(port->app->cpp, &serial);
-		memcpy(&attr->u.ppid.id, serial, attr->u.ppid.id_len);
-		break;
-	}
-	default:
-		return -EOPNOTSUPP;
-	}
+	ppid->id_len = nfp_cpp_serial(port->app->cpp, &serial);
+	memcpy(&ppid->id, serial, ppid->id_len);
 
 	return 0;
 }
 
-const struct switchdev_ops nfp_port_switchdev_ops = {
-	.switchdev_port_attr_get	= nfp_port_attr_get,
-};
-
 int nfp_port_setup_tc(struct net_device *netdev, enum tc_setup_type type,
 		      void *type_data)
 {
diff --git a/drivers/net/ethernet/netronome/nfp/nfp_port.h b/drivers/net/ethernet/netronome/nfp/nfp_port.h
index b2479a2a49e5..90ae053f5c07 100644
--- a/drivers/net/ethernet/netronome/nfp/nfp_port.h
+++ b/drivers/net/ethernet/netronome/nfp/nfp_port.h
@@ -7,6 +7,7 @@
 #include <net/devlink.h>
 
 struct net_device;
+struct netdev_phys_item_id;
 struct nfp_app;
 struct nfp_pf;
 struct nfp_port;
@@ -90,7 +91,6 @@ struct nfp_port {
 };
 
 extern const struct ethtool_ops nfp_port_ethtool_ops;
-extern const struct switchdev_ops nfp_port_switchdev_ops;
 
 __printf(2, 3) u8 *nfp_pr_et(u8 *data, const char *fmt, ...);
 
@@ -106,6 +106,8 @@ int
 nfp_port_set_features(struct net_device *netdev, netdev_features_t features);
 
 struct nfp_port *nfp_port_from_netdev(struct net_device *netdev);
+int nfp_port_get_port_parent_id(struct net_device *netdev,
+				struct netdev_phys_item_id *ppid);
 struct nfp_port *
 nfp_port_from_id(struct nfp_pf *pf, enum nfp_port_type type, unsigned int id);
 struct nfp_eth_table_port *__nfp_port_get_eth_port(struct nfp_port *port);
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 11/12] net: dsa: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

DSA implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 net/dsa/slave.c | 18 ++++++++++++------
 1 file changed, 12 insertions(+), 6 deletions(-)

diff --git a/net/dsa/slave.c b/net/dsa/slave.c
index 91de3a663226..70395a0ae52e 100644
--- a/net/dsa/slave.c
+++ b/net/dsa/slave.c
@@ -362,18 +362,23 @@ static int dsa_slave_port_obj_del(struct net_device *dev,
 	return err;
 }
 
-static int dsa_slave_port_attr_get(struct net_device *dev,
-				   struct switchdev_attr *attr)
+static int dsa_slave_get_port_parent_id(struct net_device *dev,
+					struct netdev_phys_item_id *ppid)
 {
 	struct dsa_port *dp = dsa_slave_to_port(dev);
 	struct dsa_switch *ds = dp->ds;
 	struct dsa_switch_tree *dst = ds->dst;
 
+	ppid->id_len = sizeof(dst->index);
+	memcpy(&ppid->id, &dst->index, ppid->id_len);
+
+	return 0;
+}
+
+static int dsa_slave_port_attr_get(struct net_device *dev,
+				   struct switchdev_attr *attr)
+{
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(dst->index);
-		memcpy(&attr->u.ppid.id, &dst->index, attr->u.ppid.id_len);
-		break;
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT:
 		attr->u.brport_flags_support = 0;
 		break;
@@ -1046,6 +1051,7 @@ static const struct net_device_ops dsa_slave_netdev_ops = {
 	.ndo_get_phys_port_name	= dsa_slave_get_phys_port_name,
 	.ndo_setup_tc		= dsa_slave_setup_tc,
 	.ndo_get_stats64	= dsa_slave_get_stats64,
+	.ndo_get_port_parent_id	= dsa_slave_get_port_parent_id,
 };
 
 static const struct switchdev_ops dsa_slave_switchdev_ops = {
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 12/12] net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

Now that we have a dedicated NDO for getting a port's parent ID, get rid
of SWITCHDEV_ATTR_ID_PORT_PARENT_ID and convert all callers to use the
NDO exclusively. This is a preliminary change to getting rid of
switchdev_ops eventually.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/net/switchdev.h   | 11 -----------
 net/bridge/br_switchdev.c | 14 +++-----------
 net/core/net-sysfs.c      | 19 ++++---------------
 net/core/rtnetlink.c      | 16 +++-------------
 net/ipv4/ipmr.c           | 19 +++++--------------
 net/switchdev/switchdev.c | 20 --------------------
 6 files changed, 15 insertions(+), 84 deletions(-)

diff --git a/include/net/switchdev.h b/include/net/switchdev.h
index 63843ae5dc81..5e87b54c5dc5 100644
--- a/include/net/switchdev.h
+++ b/include/net/switchdev.h
@@ -43,7 +43,6 @@ static inline bool switchdev_trans_ph_commit(struct switchdev_trans *trans)
 
 enum switchdev_attr_id {
 	SWITCHDEV_ATTR_ID_UNDEFINED,
-	SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
 	SWITCHDEV_ATTR_ID_PORT_STP_STATE,
 	SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS,
 	SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS_SUPPORT,
@@ -61,7 +60,6 @@ struct switchdev_attr {
 	void *complete_priv;
 	void (*complete)(struct net_device *dev, int err, void *priv);
 	union {
-		struct netdev_phys_item_id ppid;	/* PORT_PARENT_ID */
 		u8 stp_state;				/* PORT_STP_STATE */
 		unsigned long brport_flags;		/* PORT_BRIDGE_FLAGS */
 		unsigned long brport_flags_support;	/* PORT_BRIDGE_FLAGS_SUPPORT */
@@ -208,9 +206,6 @@ void switchdev_port_fwd_mark_set(struct net_device *dev,
 				 struct net_device *group_dev,
 				 bool joining);
 
-bool switchdev_port_same_parent_id(struct net_device *a,
-				   struct net_device *b);
-
 int switchdev_handle_port_obj_add(struct net_device *dev,
 			struct switchdev_notifier_port_obj_info *port_obj_info,
 			bool (*check_cb)(const struct net_device *dev),
@@ -295,12 +290,6 @@ call_switchdev_blocking_notifiers(unsigned long val,
 	return NOTIFY_DONE;
 }
 
-static inline bool switchdev_port_same_parent_id(struct net_device *a,
-						 struct net_device *b)
-{
-	return false;
-}
-
 static inline int
 switchdev_handle_port_obj_add(struct net_device *dev,
 			struct switchdev_notifier_port_obj_info *port_obj_info,
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 06b0ae44585f..db9e8ab96d48 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -14,8 +14,7 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
 
 	/* dev is yet to be added to the port list. */
 	list_for_each_entry(p, &br->port_list, list) {
-		if (netdev_port_same_parent_id(dev, p->dev) ||
-		    switchdev_port_same_parent_id(dev, p->dev))
+		if (netdev_port_same_parent_id(dev, p->dev))
 			return p->offload_fwd_mark;
 	}
 
@@ -24,19 +23,12 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
 
 int nbp_switchdev_mark_set(struct net_bridge_port *p)
 {
-	const struct net_device_ops *ops = p->dev->netdev_ops;
-	struct switchdev_attr attr = {
-		.orig_dev = p->dev,
-		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
-	};
+	struct netdev_phys_item_id ppid = { };
 	int err;
 
 	ASSERT_RTNL();
 
-	if (ops->ndo_get_port_parent_id)
-		err = dev_get_port_parent_id(p->dev, &attr.u.ppid, true);
-	else
-		err = switchdev_port_attr_get(p->dev, &attr);
+	err = dev_get_port_parent_id(p->dev, &ppid, true);
 	if (err) {
 		if (err == -EOPNOTSUPP)
 			return 0;
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index 4eace9f1dcf9..7c5061123ead 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -12,7 +12,6 @@
 #include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
-#include <net/switchdev.h>
 #include <linux/if_arp.h>
 #include <linux/slab.h>
 #include <linux/sched/signal.h>
@@ -495,27 +494,17 @@ static ssize_t phys_switch_id_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
 	struct net_device *netdev = to_net_dev(dev);
-	const struct net_device_ops *ops = netdev->netdev_ops;
 	ssize_t ret = -EINVAL;
 
 	if (!rtnl_trylock())
 		return restart_syscall();
 
 	if (dev_isalive(netdev)) {
-		struct switchdev_attr attr = {
-			.orig_dev = netdev,
-			.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
-			.flags = SWITCHDEV_F_NO_RECURSE,
-		};
-
-		if (ops->ndo_get_port_parent_id)
-			ret = dev_get_port_parent_id(netdev, &attr.u.ppid,
-						     false);
-		else
-			ret = switchdev_port_attr_get(netdev, &attr);
+		struct netdev_phys_item_id ppid = { };
+
+		ret = dev_get_port_parent_id(netdev, &ppid, false);
 		if (!ret)
-			ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
-				      attr.u.ppid.id);
+			ret = sprintf(buf, "%*phN\n", ppid.id_len, ppid.id);
 	}
 	rtnl_unlock();
 
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index 90dd02c1f561..a51cab95ba64 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -46,7 +46,6 @@
 
 #include <linux/inet.h>
 #include <linux/netdevice.h>
-#include <net/switchdev.h>
 #include <net/ip.h>
 #include <net/protocol.h>
 #include <net/arp.h>
@@ -1146,26 +1145,17 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
 
 static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
 {
-	const struct net_device_ops *ops = dev->netdev_ops;
+	struct netdev_phys_item_id ppid = { };
 	int err;
-	struct switchdev_attr attr = {
-		.orig_dev = dev,
-		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
-		.flags = SWITCHDEV_F_NO_RECURSE,
-	};
 
-	if (ops->ndo_get_port_parent_id)
-		err = dev_get_port_parent_id(dev, &attr.u.ppid, false);
-	else
-		err = switchdev_port_attr_get(dev, &attr);
+	err = dev_get_port_parent_id(dev, &ppid, false);
 	if (err) {
 		if (err == -EOPNOTSUPP)
 			return 0;
 		return err;
 	}
 
-	if (nla_put(skb, IFLA_PHYS_SWITCH_ID, attr.u.ppid.id_len,
-		    attr.u.ppid.id))
+	if (nla_put(skb, IFLA_PHYS_SWITCH_ID, ppid.id_len, ppid.id))
 		return -EMSGSIZE;
 
 	return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index c71bcc42d66d..e536970557dd 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -67,7 +67,6 @@
 #include <net/fib_rules.h>
 #include <linux/netconf.h>
 #include <net/nexthop.h>
-#include <net/switchdev.h>
 
 #include <linux/nospec.h>
 
@@ -837,11 +836,8 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
 static int vif_add(struct net *net, struct mr_table *mrt,
 		   struct vifctl *vifc, int mrtsock)
 {
-	const struct net_device_ops *ops;
+	struct netdev_phys_item_id ppid = { };
 	int vifi = vifc->vifc_vifi;
-	struct switchdev_attr attr = {
-		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
-	};
 	struct vif_device *v = &mrt->vif_table[vifi];
 	struct net_device *dev;
 	struct in_device *in_dev;
@@ -920,15 +916,10 @@ static int vif_add(struct net *net, struct mr_table *mrt,
 			vifc->vifc_flags | (!mrtsock ? VIFF_STATIC : 0),
 			(VIFF_TUNNEL | VIFF_REGISTER));
 
-	attr.orig_dev = dev;
-	ops = dev->netdev_ops;
-	if (ops->ndo_get_port_parent_id &&
-	    !dev_get_port_parent_id(dev, &attr.u.ppid, true)) {
-		memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
-		v->dev_parent_id.id_len = attr.u.ppid.id_len;
-	} else if (!switchdev_port_attr_get(dev, &attr)) {
-		memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
-		v->dev_parent_id.id_len = attr.u.ppid.id_len;
+	err = dev_get_port_parent_id(dev, &ppid, true);
+	if (err == 0) {
+		memcpy(v->dev_parent_id.id, ppid.id, ppid.id_len);
+		v->dev_parent_id.id_len = ppid.id_len;
 	} else {
 		v->dev_parent_id.id_len = 0;
 	}
diff --git a/net/switchdev/switchdev.c b/net/switchdev/switchdev.c
index cd78253de31d..7e1357db33d7 100644
--- a/net/switchdev/switchdev.c
+++ b/net/switchdev/switchdev.c
@@ -592,26 +592,6 @@ int call_switchdev_blocking_notifiers(unsigned long val, struct net_device *dev,
 }
 EXPORT_SYMBOL_GPL(call_switchdev_blocking_notifiers);
 
-bool switchdev_port_same_parent_id(struct net_device *a,
-				   struct net_device *b)
-{
-	struct switchdev_attr a_attr = {
-		.orig_dev = a,
-		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
-	};
-	struct switchdev_attr b_attr = {
-		.orig_dev = b,
-		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
-	};
-
-	if (switchdev_port_attr_get(a, &a_attr) ||
-	    switchdev_port_attr_get(b, &b_attr))
-		return false;
-
-	return netdev_phys_item_id_same(&a_attr.u.ppid, &b_attr.u.ppid);
-}
-EXPORT_SYMBOL_GPL(switchdev_port_same_parent_id);
-
 static int __switchdev_handle_port_obj_add(struct net_device *dev,
 			struct switchdev_notifier_port_obj_info *port_obj_info,
 			bool (*check_cb)(const struct net_device *dev),
-- 
2.17.1


^ permalink raw reply related

* [PATCH] Using rates in bits when limits are specified in %
From: Marcos Antonio Moraes @ 2019-02-06 17:14 UTC (permalink / raw)
  To: netdev; +Cc: Marcos Antonio Moraes

As /sys/class/net/<iface>/speed indicates a value in Mbits/sec, the
transformation is necessary to create the correct limitations.
---
 tc/tc_util.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tc/tc_util.c b/tc/tc_util.c
index ab717890..b82142ab 100644
--- a/tc/tc_util.c
+++ b/tc/tc_util.c
@@ -194,7 +194,7 @@ static int parse_percent_rate(char *rate, const char *str, const char *dev)
 {
 	long dev_mbit;
 	int ret;
-	double perc, rate_mbit;
+	double perc, rate_bit;
 	char *str_perc;
 
 	if (!dev[0]) {
@@ -219,9 +219,9 @@ static int parse_percent_rate(char *rate, const char *str, const char *dev)
 		return -1;
 	}
 
-	rate_mbit = perc * dev_mbit;
+	rate_bit = perc * dev_mbit * 1000 * 1000;
 
-	ret = snprintf(rate, 20, "%lf", rate_mbit);
+	ret = snprintf(rate, 20, "%lf", rate_bit);
 	if (ret <= 0 || ret >= 20) {
 		fprintf(stderr, "Unable to parse calculated rate\n");
 		return -1;
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 09/12] netdevsim: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

netdevsim only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/netdevsim/netdev.c | 23 ++++++-----------------
 1 file changed, 6 insertions(+), 17 deletions(-)

diff --git a/drivers/net/netdevsim/netdev.c b/drivers/net/netdevsim/netdev.c
index 8d8e2b3f263e..75a50b59cb8f 100644
--- a/drivers/net/netdevsim/netdev.c
+++ b/drivers/net/netdevsim/netdev.c
@@ -22,7 +22,6 @@
 #include <net/netlink.h>
 #include <net/pkt_cls.h>
 #include <net/rtnetlink.h>
-#include <net/switchdev.h>
 
 #include "netdevsim.h"
 
@@ -148,26 +147,16 @@ static struct device_type nsim_dev_type = {
 	.release = nsim_dev_release,
 };
 
-static int
-nsim_port_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int nsim_get_port_parent_id(struct net_device *dev,
+				   struct netdev_phys_item_id *ppid)
 {
 	struct netdevsim *ns = netdev_priv(dev);
 
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(ns->sdev->switch_id);
-		memcpy(&attr->u.ppid.id, &ns->sdev->switch_id,
-		       attr->u.ppid.id_len);
-		return 0;
-	default:
-		return -EOPNOTSUPP;
-	}
+	ppid->id_len = sizeof(ns->sdev->switch_id);
+	memcpy(&ppid->id, &ns->sdev->switch_id, ppid->id_len);
+	return 0;
 }
 
-static const struct switchdev_ops nsim_switchdev_ops = {
-	.switchdev_port_attr_get	= nsim_port_attr_get,
-};
-
 static int nsim_init(struct net_device *dev)
 {
 	char sdev_ddir_name[10], sdev_link_name[32];
@@ -214,7 +203,6 @@ static int nsim_init(struct net_device *dev)
 		goto err_bpf_uninit;
 
 	SET_NETDEV_DEV(dev, &ns->dev);
-	SWITCHDEV_SET_OPS(dev, &nsim_switchdev_ops);
 
 	err = nsim_devlink_setup(ns);
 	if (err)
@@ -493,6 +481,7 @@ static const struct net_device_ops nsim_netdev_ops = {
 	.ndo_setup_tc		= nsim_setup_tc,
 	.ndo_set_features	= nsim_set_features,
 	.ndo_bpf		= nsim_bpf,
+	.ndo_get_port_parent_id	= nsim_get_port_parent_id,
 };
 
 static void nsim_setup(struct net_device *dev)
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 10/12] staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

ethsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
index daabaceeea52..e559f4c25cf7 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/ethsw.c
@@ -505,6 +505,17 @@ static netdev_tx_t port_dropframe(struct sk_buff *skb,
 	return NETDEV_TX_OK;
 }
 
+static int swdev_get_port_parent_id(struct net_device *dev,
+				    struct netdev_phys_item_id *ppid)
+{
+	struct ethsw_port_priv *port_priv = netdev_priv(dev);
+
+	ppid->id_len = 1;
+	ppid->id[0] = port_priv->ethsw_data->dev_id;
+
+	return 0;
+}
+
 static const struct net_device_ops ethsw_port_ops = {
 	.ndo_open		= port_open,
 	.ndo_stop		= port_stop,
@@ -515,6 +526,7 @@ static const struct net_device_ops ethsw_port_ops = {
 	.ndo_get_offload_stats	= port_get_offload_stats,
 
 	.ndo_start_xmit		= port_dropframe,
+	.ndo_get_port_parent_id	= swdev_get_port_parent_id,
 };
 
 static void ethsw_links_state_update(struct ethsw_core *ethsw)
@@ -634,10 +646,6 @@ static int swdev_port_attr_get(struct net_device *netdev,
 	struct ethsw_port_priv *port_priv = netdev_priv(netdev);
 
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = 1;
-		attr->u.ppid.id[0] = port_priv->ethsw_data->dev_id;
-		break;
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		attr->u.brport_flags =
 			(port_priv->ethsw_data->learning ? BR_LEARNING : 0) |
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 08/12] rocker: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/rocker/rocker_main.c | 17 +++++++++++++----
 1 file changed, 13 insertions(+), 4 deletions(-)

diff --git a/drivers/net/ethernet/rocker/rocker_main.c b/drivers/net/ethernet/rocker/rocker_main.c
index 62a205eba9f7..596f44dbfae1 100644
--- a/drivers/net/ethernet/rocker/rocker_main.c
+++ b/drivers/net/ethernet/rocker/rocker_main.c
@@ -2026,6 +2026,18 @@ static void rocker_port_neigh_destroy(struct net_device *dev,
 			    err);
 }
 
+static int rocker_port_get_port_parent_id(struct net_device *dev,
+					  struct netdev_phys_item_id *ppid)
+{
+	const struct rocker_port *rocker_port = netdev_priv(dev);
+	const struct rocker *rocker = rocker_port->rocker;
+
+	ppid->id_len = sizeof(rocker->hw.id);
+	memcpy(&ppid->id, &rocker->hw.id, ppid->id_len);
+
+	return 0;
+}
+
 static const struct net_device_ops rocker_port_netdev_ops = {
 	.ndo_open			= rocker_port_open,
 	.ndo_stop			= rocker_port_stop,
@@ -2035,6 +2047,7 @@ static const struct net_device_ops rocker_port_netdev_ops = {
 	.ndo_get_phys_port_name		= rocker_port_get_phys_port_name,
 	.ndo_change_proto_down		= rocker_port_change_proto_down,
 	.ndo_neigh_destroy		= rocker_port_neigh_destroy,
+	.ndo_get_port_parent_id		= rocker_port_get_port_parent_id,
 };
 
 /********************
@@ -2049,10 +2062,6 @@ static int rocker_port_attr_get(struct net_device *dev,
 	int err = 0;
 
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(rocker->hw.id);
-		memcpy(&attr->u.ppid.id, &rocker->hw.id, attr->u.ppid.id_len);
-		break;
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		err = rocker_world_port_attr_bridge_flags_get(rocker_port,
 							      &attr->u.brport_flags);
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 04/12] net/mlx5e: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

mlx5e only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get().

Since mlx5e makes use of switchdev_port_parent_id() convert it to use
netdev_port_same_parent_id().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../ethernet/mellanox/mlx5/core/en/tc_tun.c   |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  | 31 +++++++------------
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   |  5 ++-
 3 files changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
index 046948ead152..19dc4a963b90 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en/tc_tun.c
@@ -25,7 +25,7 @@ static int get_route_and_out_devs(struct mlx5e_priv *priv,
 	/* if the egress device isn't on the same HW e-switch or
 	 * it's a LAG device, use the uplink
 	 */
-	if (!switchdev_port_same_parent_id(priv->netdev, dev) ||
+	if (!netdev_port_same_parent_id(priv->netdev, dev) ||
 	    dst_is_lag_dev) {
 		*route_dev = uplink_dev;
 		*out_dev = *route_dev;
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
index 5d2e0c2f6624..0b1988b330f3 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_rep.c
@@ -381,7 +381,8 @@ static const struct ethtool_ops mlx5e_uplink_rep_ethtool_ops = {
 	.set_pauseparam    = mlx5e_uplink_rep_set_pauseparam,
 };
 
-static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int mlx5e_rep_get_port_parent_id(struct net_device *dev,
+					struct netdev_phys_item_id *ppid)
 {
 	struct mlx5e_priv *priv = netdev_priv(dev);
 	struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
@@ -398,20 +399,14 @@ static int mlx5e_attr_get(struct net_device *dev, struct switchdev_attr *attr)
 		uplink_priv = netdev_priv(uplink_dev);
 	}
 
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = ETH_ALEN;
-		if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
-			ether_addr_copy(attr->u.ppid.id, uplink_upper->dev_addr);
-		} else {
-			struct mlx5e_rep_priv *rpriv = priv->ppriv;
-			struct mlx5_eswitch_rep *rep = rpriv->rep;
+	ppid->id_len = ETH_ALEN;
+	if (uplink_upper && mlx5_lag_is_sriov(uplink_priv->mdev)) {
+		ether_addr_copy(ppid->id, uplink_upper->dev_addr);
+	} else {
+		struct mlx5e_rep_priv *rpriv = priv->ppriv;
+		struct mlx5_eswitch_rep *rep = rpriv->rep;
 
-			ether_addr_copy(attr->u.ppid.id, rep->hw_id);
-		}
-		break;
-	default:
-		return -EOPNOTSUPP;
+		ether_addr_copy(ppid->id, rep->hw_id);
 	}
 
 	return 0;
@@ -1284,10 +1279,6 @@ static int mlx5e_uplink_rep_set_vf_vlan(struct net_device *dev, int vf, u16 vlan
 	return 0;
 }
 
-static const struct switchdev_ops mlx5e_rep_switchdev_ops = {
-	.switchdev_port_attr_get	= mlx5e_attr_get,
-};
-
 static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
 	.ndo_open                = mlx5e_vf_rep_open,
 	.ndo_stop                = mlx5e_vf_rep_close,
@@ -1298,6 +1289,7 @@ static const struct net_device_ops mlx5e_netdev_ops_vf_rep = {
 	.ndo_has_offload_stats	 = mlx5e_rep_has_offload_stats,
 	.ndo_get_offload_stats	 = mlx5e_rep_get_offload_stats,
 	.ndo_change_mtu          = mlx5e_vf_rep_change_mtu,
+	.ndo_get_port_parent_id	 = mlx5e_rep_get_port_parent_id,
 };
 
 static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
@@ -1319,6 +1311,7 @@ static const struct net_device_ops mlx5e_netdev_ops_uplink_rep = {
 	.ndo_get_vf_config       = mlx5e_get_vf_config,
 	.ndo_get_vf_stats        = mlx5e_get_vf_stats,
 	.ndo_set_vf_vlan         = mlx5e_uplink_rep_set_vf_vlan,
+	.ndo_get_port_parent_id	 = mlx5e_rep_get_port_parent_id,
 };
 
 bool mlx5e_eswitch_rep(struct net_device *netdev)
@@ -1393,8 +1386,6 @@ static void mlx5e_build_rep_netdev(struct net_device *netdev)
 	netdev->watchdog_timeo    = 15 * HZ;
 
 
-	netdev->switchdev_ops = &mlx5e_rep_switchdev_ops;
-
 	netdev->features	 |= NETIF_F_HW_TC | NETIF_F_NETNS_LOCAL;
 	netdev->hw_features      |= NETIF_F_HW_TC;
 
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
index 74159d39dd66..098b28feba0c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_tc.c
@@ -38,7 +38,6 @@
 #include <linux/mlx5/fs.h>
 #include <linux/mlx5/device.h>
 #include <linux/rhashtable.h>
-#include <net/switchdev.h>
 #include <net/tc_act/tc_mirred.h>
 #include <net/tc_act/tc_vlan.h>
 #include <net/tc_act/tc_tunnel_key.h>
@@ -2569,8 +2568,8 @@ static int parse_tc_fdb_actions(struct mlx5e_priv *priv, struct tcf_exts *exts,
 
 			action |= MLX5_FLOW_CONTEXT_ACTION_FWD_DEST |
 				  MLX5_FLOW_CONTEXT_ACTION_COUNT;
-			if (switchdev_port_same_parent_id(priv->netdev,
-							  out_dev) ||
+			if (netdev_port_same_parent_id(priv->netdev,
+						       out_dev) ||
 			    is_merged_eswitch_dev(priv, out_dev)) {
 				struct mlx5_eswitch *esw = priv->mdev->priv.eswitch;
 				struct net_device *uplink_dev = mlx5_eswitch_uplink_get_proto_dev(esw, REP_ETH);
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 06/12] mscc: ocelot: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

Ocelot only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID as a valid
switchdev attribute getter, convert it to use ndo_get_port_parent_id()
and get rid of the switchdev_ops::switchdev_port_attr_get altogether.

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/mscc/ocelot.c | 33 ++++++++++++------------------
 1 file changed, 13 insertions(+), 20 deletions(-)

diff --git a/drivers/net/ethernet/mscc/ocelot.c b/drivers/net/ethernet/mscc/ocelot.c
index c6a575eb0ff5..195306d05bcd 100644
--- a/drivers/net/ethernet/mscc/ocelot.c
+++ b/drivers/net/ethernet/mscc/ocelot.c
@@ -916,6 +916,18 @@ static int ocelot_set_features(struct net_device *dev,
 	return 0;
 }
 
+static int ocelot_get_port_parent_id(struct net_device *dev,
+				     struct netdev_phys_item_id *ppid)
+{
+	struct ocelot_port *ocelot_port = netdev_priv(dev);
+	struct ocelot *ocelot = ocelot_port->ocelot;
+
+	ppid->id_len = sizeof(ocelot->base_mac);
+	memcpy(&ppid->id, &ocelot->base_mac, ppid->id_len);
+
+	return 0;
+}
+
 static const struct net_device_ops ocelot_port_netdev_ops = {
 	.ndo_open			= ocelot_port_open,
 	.ndo_stop			= ocelot_port_stop,
@@ -930,6 +942,7 @@ static const struct net_device_ops ocelot_port_netdev_ops = {
 	.ndo_vlan_rx_add_vid		= ocelot_vlan_rx_add_vid,
 	.ndo_vlan_rx_kill_vid		= ocelot_vlan_rx_kill_vid,
 	.ndo_set_features		= ocelot_set_features,
+	.ndo_get_port_parent_id		= ocelot_get_port_parent_id,
 };
 
 static void ocelot_get_strings(struct net_device *netdev, u32 sset, u8 *data)
@@ -1013,25 +1026,6 @@ static const struct ethtool_ops ocelot_ethtool_ops = {
 	.set_link_ksettings	= phy_ethtool_set_link_ksettings,
 };
 
-static int ocelot_port_attr_get(struct net_device *dev,
-				struct switchdev_attr *attr)
-{
-	struct ocelot_port *ocelot_port = netdev_priv(dev);
-	struct ocelot *ocelot = ocelot_port->ocelot;
-
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(ocelot->base_mac);
-		memcpy(&attr->u.ppid.id, &ocelot->base_mac,
-		       attr->u.ppid.id_len);
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	return 0;
-}
-
 static int ocelot_port_attr_stp_state_set(struct ocelot_port *ocelot_port,
 					  struct switchdev_trans *trans,
 					  u8 state)
@@ -1331,7 +1325,6 @@ static int ocelot_port_obj_del(struct net_device *dev,
 }
 
 static const struct switchdev_ops ocelot_port_switchdev_ops = {
-	.switchdev_port_attr_get	= ocelot_port_attr_get,
 	.switchdev_port_attr_set	= ocelot_port_attr_set,
 };
 
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 05/12] mlxsw: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

mlxsw implements SWITCHDEV_ATTR_ID_PORT_PARENT_ID and we want to get rid
of switchdev_ops eventually, ease that migration by implementing a
ndo_get_port_parent_id() function which returns what
switchdev_port_attr_get() would do.

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 13 +++++++
 .../mellanox/mlxsw/spectrum_switchdev.c       |  5 ---
 .../net/ethernet/mellanox/mlxsw/switchx2.c    | 37 +++++++------------
 3 files changed, 26 insertions(+), 29 deletions(-)

diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
index a88169738b4a..8dd808b7f931 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum.c
@@ -1700,6 +1700,18 @@ static int mlxsw_sp_set_features(struct net_device *dev,
 				       mlxsw_sp_feature_hw_tc);
 }
 
+static int mlxsw_sp_port_get_port_parent_id(struct net_device *dev,
+					    struct netdev_phys_item_id *ppid)
+{
+	struct mlxsw_sp_port *mlxsw_sp_port = netdev_priv(dev);
+	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
+
+	ppid->id_len = sizeof(mlxsw_sp->base_mac);
+	memcpy(&ppid->id, &mlxsw_sp->base_mac, ppid->id_len);
+
+	return 0;
+}
+
 static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
 	.ndo_open		= mlxsw_sp_port_open,
 	.ndo_stop		= mlxsw_sp_port_stop,
@@ -1715,6 +1727,7 @@ static const struct net_device_ops mlxsw_sp_port_netdev_ops = {
 	.ndo_vlan_rx_kill_vid	= mlxsw_sp_port_kill_vid,
 	.ndo_get_phys_port_name	= mlxsw_sp_port_get_phys_port_name,
 	.ndo_set_features	= mlxsw_sp_set_features,
+	.ndo_get_port_parent_id	= mlxsw_sp_port_get_port_parent_id,
 };
 
 static void mlxsw_sp_port_get_drvinfo(struct net_device *dev,
diff --git a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
index a4a9fe992193..95e37de3e48f 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/spectrum_switchdev.c
@@ -451,11 +451,6 @@ static int mlxsw_sp_port_attr_get(struct net_device *dev,
 	struct mlxsw_sp *mlxsw_sp = mlxsw_sp_port->mlxsw_sp;
 
 	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(mlxsw_sp->base_mac);
-		memcpy(&attr->u.ppid.id, &mlxsw_sp->base_mac,
-		       attr->u.ppid.id_len);
-		break;
 	case SWITCHDEV_ATTR_ID_PORT_BRIDGE_FLAGS:
 		mlxsw_sp_port_bridge_flags_get(mlxsw_sp->bridge, attr->orig_dev,
 					       &attr->u.brport_flags);
diff --git a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
index 2d4f213e154d..533fe6235b7c 100644
--- a/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
+++ b/drivers/net/ethernet/mellanox/mlxsw/switchx2.c
@@ -11,7 +11,6 @@
 #include <linux/device.h>
 #include <linux/skbuff.h>
 #include <linux/if_vlan.h>
-#include <net/switchdev.h>
 
 #include "pci.h"
 #include "core.h"
@@ -390,6 +389,18 @@ static int mlxsw_sx_port_get_phys_port_name(struct net_device *dev, char *name,
 						  name, len);
 }
 
+static int mlxsw_sx_port_get_port_parent_id(struct net_device *dev,
+					    struct netdev_phys_item_id *ppid)
+{
+	struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
+	struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
+
+	ppid->id_len = sizeof(mlxsw_sx->hw_id);
+	memcpy(&ppid->id, &mlxsw_sx->hw_id, ppid->id_len);
+
+	return 0;
+}
+
 static const struct net_device_ops mlxsw_sx_port_netdev_ops = {
 	.ndo_open		= mlxsw_sx_port_open,
 	.ndo_stop		= mlxsw_sx_port_stop,
@@ -397,6 +408,7 @@ static const struct net_device_ops mlxsw_sx_port_netdev_ops = {
 	.ndo_change_mtu		= mlxsw_sx_port_change_mtu,
 	.ndo_get_stats64	= mlxsw_sx_port_get_stats64,
 	.ndo_get_phys_port_name = mlxsw_sx_port_get_phys_port_name,
+	.ndo_get_port_parent_id	= mlxsw_sx_port_get_port_parent_id,
 };
 
 static void mlxsw_sx_port_get_drvinfo(struct net_device *dev,
@@ -901,28 +913,6 @@ static const struct ethtool_ops mlxsw_sx_port_ethtool_ops = {
 	.set_link_ksettings	= mlxsw_sx_port_set_link_ksettings,
 };
 
-static int mlxsw_sx_port_attr_get(struct net_device *dev,
-				  struct switchdev_attr *attr)
-{
-	struct mlxsw_sx_port *mlxsw_sx_port = netdev_priv(dev);
-	struct mlxsw_sx *mlxsw_sx = mlxsw_sx_port->mlxsw_sx;
-
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(mlxsw_sx->hw_id);
-		memcpy(&attr->u.ppid.id, &mlxsw_sx->hw_id, attr->u.ppid.id_len);
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-
-	return 0;
-}
-
-static const struct switchdev_ops mlxsw_sx_port_switchdev_ops = {
-	.switchdev_port_attr_get	= mlxsw_sx_port_attr_get,
-};
-
 static int mlxsw_sx_hw_id_get(struct mlxsw_sx *mlxsw_sx)
 {
 	char spad_pl[MLXSW_REG_SPAD_LEN] = {0};
@@ -1034,7 +1024,6 @@ static int __mlxsw_sx_port_eth_create(struct mlxsw_sx *mlxsw_sx, u8 local_port,
 
 	dev->netdev_ops = &mlxsw_sx_port_netdev_ops;
 	dev->ethtool_ops = &mlxsw_sx_port_ethtool_ops;
-	dev->switchdev_ops = &mlxsw_sx_port_switchdev_ops;
 
 	err = mlxsw_sx_port_dev_addr_get(mlxsw_sx_port);
 	if (err) {
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 02/12] bnxt: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

BNXT only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it a
great candidate to be converted to use the ndo_get_port_parent_id() NDO
instead of implementing switchdev_port_attr_get(). The conversion is
straight forward here since the PF and VF code use the same getter.

Since bnxt makes uses of switchdev_port_same_parent_id() convert it to
use netdev_port_same_parent_id().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 28 ++++++-------------
 drivers/net/ethernet/broadcom/bnxt/bnxt.h     |  4 +--
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c  |  2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 12 +++-----
 4 files changed, 15 insertions(+), 31 deletions(-)

diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.c b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
index 6a512871176b..1c2987c3d708 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.c
@@ -9981,8 +9981,11 @@ static int bnxt_get_phys_port_name(struct net_device *dev, char *buf,
 	return 0;
 }
 
-int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr)
+int bnxt_get_port_parent_id(struct net_device *dev,
+			    struct netdev_phys_item_id *ppid)
 {
+	struct bnxt *bp = netdev_priv(dev);
+
 	if (bp->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
 		return -EOPNOTSUPP;
 
@@ -9990,27 +9993,12 @@ int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr)
 	if (!BNXT_PF(bp))
 		return -EOPNOTSUPP;
 
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = sizeof(bp->switch_id);
-		memcpy(attr->u.ppid.id, bp->switch_id, attr->u.ppid.id_len);
-		break;
-	default:
-		return -EOPNOTSUPP;
-	}
-	return 0;
-}
+	ppid->id_len = sizeof(bp->switch_id);
+	memcpy(ppid->id, bp->switch_id, ppid->id_len);
 
-static int bnxt_swdev_port_attr_get(struct net_device *dev,
-				    struct switchdev_attr *attr)
-{
-	return bnxt_port_attr_get(netdev_priv(dev), attr);
+	return 0;
 }
 
-static const struct switchdev_ops bnxt_switchdev_ops = {
-	.switchdev_port_attr_get	= bnxt_swdev_port_attr_get
-};
-
 static const struct net_device_ops bnxt_netdev_ops = {
 	.ndo_open		= bnxt_open,
 	.ndo_start_xmit		= bnxt_start_xmit,
@@ -10042,6 +10030,7 @@ static const struct net_device_ops bnxt_netdev_ops = {
 	.ndo_bpf		= bnxt_xdp,
 	.ndo_bridge_getlink	= bnxt_bridge_getlink,
 	.ndo_bridge_setlink	= bnxt_bridge_setlink,
+	.ndo_get_port_parent_id	= bnxt_get_port_parent_id,
 	.ndo_get_phys_port_name = bnxt_get_phys_port_name
 };
 
@@ -10400,7 +10389,6 @@ static int bnxt_init_one(struct pci_dev *pdev, const struct pci_device_id *ent)
 	dev->netdev_ops = &bnxt_netdev_ops;
 	dev->watchdog_timeo = BNXT_TX_TIMEOUT;
 	dev->ethtool_ops = &bnxt_ethtool_ops;
-	SWITCHDEV_SET_OPS(dev, &bnxt_switchdev_ops);
 	pci_set_drvdata(pdev, dev);
 
 	rc = bnxt_alloc_hwrm_resources(bp);
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt.h b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
index 5c886a700bcc..17554d4be651 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt.h
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt.h
@@ -22,7 +22,6 @@
 #include <linux/rhashtable.h>
 #include <net/devlink.h>
 #include <net/dst_metadata.h>
-#include <net/switchdev.h>
 #include <net/xdp.h>
 #include <linux/net_dim.h>
 
@@ -1795,7 +1794,8 @@ int bnxt_check_rings(struct bnxt *bp, int tx, int rx, bool sh, int tcs,
 int bnxt_setup_mq_tc(struct net_device *dev, u8 tc);
 int bnxt_get_max_rings(struct bnxt *, int *, int *, bool);
 int bnxt_restore_pf_fw_resources(struct bnxt *bp);
-int bnxt_port_attr_get(struct bnxt *bp, struct switchdev_attr *attr);
+int bnxt_get_port_parent_id(struct net_device *dev,
+			    struct netdev_phys_item_id *ppid);
 void bnxt_dim_work(struct work_struct *work);
 int bnxt_hwrm_set_ring_coal(struct bnxt *bp, struct bnxt_napi *bnapi);
 
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
index c683b5e96b1d..86950f70de1f 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c
@@ -45,7 +45,7 @@ static u16 bnxt_flow_get_dst_fid(struct bnxt *pf_bp, struct net_device *dev)
 	struct bnxt *bp;
 
 	/* check if dev belongs to the same switch */
-	if (!switchdev_port_same_parent_id(pf_bp->dev, dev)) {
+	if (!netdev_port_same_parent_id(pf_bp->dev, dev)) {
 		netdev_info(pf_bp->dev, "dev(ifindex=%d) not on same switch",
 			    dev->ifindex);
 		return BNXT_FID_INVALID;
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
index 9a25c05aa571..2bdd2da9aac7 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c
@@ -237,21 +237,17 @@ static void bnxt_vf_rep_get_drvinfo(struct net_device *dev,
 	strlcpy(info->version, DRV_MODULE_VERSION, sizeof(info->version));
 }
 
-static int bnxt_vf_rep_port_attr_get(struct net_device *dev,
-				     struct switchdev_attr *attr)
+static int bnxt_vf_rep_get_port_parent_id(struct net_device *dev,
+					  struct netdev_phys_item_id *ppid)
 {
 	struct bnxt_vf_rep *vf_rep = netdev_priv(dev);
 
 	/* as only PORT_PARENT_ID is supported currently use common code
 	 * between PF and VF-rep for now.
 	 */
-	return bnxt_port_attr_get(vf_rep->bp, attr);
+	return bnxt_get_port_parent_id(vf_rep->bp->dev, ppid);
 }
 
-static const struct switchdev_ops bnxt_vf_rep_switchdev_ops = {
-	.switchdev_port_attr_get	= bnxt_vf_rep_port_attr_get
-};
-
 static const struct ethtool_ops bnxt_vf_rep_ethtool_ops = {
 	.get_drvinfo		= bnxt_vf_rep_get_drvinfo
 };
@@ -262,6 +258,7 @@ static const struct net_device_ops bnxt_vf_rep_netdev_ops = {
 	.ndo_start_xmit		= bnxt_vf_rep_xmit,
 	.ndo_get_stats64	= bnxt_vf_rep_get_stats64,
 	.ndo_setup_tc		= bnxt_vf_rep_setup_tc,
+	.ndo_get_port_parent_id	= bnxt_vf_rep_get_port_parent_id,
 	.ndo_get_phys_port_name = bnxt_vf_rep_get_phys_port_name
 };
 
@@ -392,7 +389,6 @@ static void bnxt_vf_rep_netdev_init(struct bnxt *bp, struct bnxt_vf_rep *vf_rep,
 
 	dev->netdev_ops = &bnxt_vf_rep_netdev_ops;
 	dev->ethtool_ops = &bnxt_vf_rep_ethtool_ops;
-	SWITCHDEV_SET_OPS(dev, &bnxt_vf_rep_switchdev_ops);
 	/* Just inherit all the featues of the parent PF as the VF-R
 	 * uses the RX/TX rings of the parent PF
 	 */
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 03/12] liquidio: Implement ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

Liquidio only supports SWITCHDEV_ATTR_ID_PORT_PARENT_ID, which makes it
a great candidate to be converted to use the ndo_get_port_parent_id()
NDO instead of implementing switchdev_port_attr_get().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 .../net/ethernet/cavium/liquidio/lio_main.c   | 22 ++++------------
 .../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 ++++++-------------
 2 files changed, 12 insertions(+), 35 deletions(-)

diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index 3d24133e5e49..e97e6754ee09 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -21,7 +21,6 @@
 #include <linux/firmware.h>
 #include <net/vxlan.h>
 #include <linux/kthread.h>
-#include <net/switchdev.h>
 #include "liquidio_common.h"
 #include "octeon_droq.h"
 #include "octeon_iq.h"
@@ -3184,7 +3183,8 @@ static const struct devlink_ops liquidio_devlink_ops = {
 };
 
 static int
-lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+liquidio_get_port_parent_id(struct net_device *dev,
+			    struct netdev_phys_item_id *ppid)
 {
 	struct lio *lio = GET_LIO(dev);
 	struct octeon_device *oct = lio->oct_dev;
@@ -3192,24 +3192,12 @@ lio_pf_switchdev_attr_get(struct net_device *dev, struct switchdev_attr *attr)
 	if (oct->eswitch_mode != DEVLINK_ESWITCH_MODE_SWITCHDEV)
 		return -EOPNOTSUPP;
 
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = ETH_ALEN;
-		ether_addr_copy(attr->u.ppid.id,
-				(void *)&lio->linfo.hw_addr + 2);
-		break;
-
-	default:
-		return -EOPNOTSUPP;
-	}
+	ppid->id_len = ETH_ALEN;
+	ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2);
 
 	return 0;
 }
 
-static const struct switchdev_ops lio_pf_switchdev_ops = {
-	.switchdev_port_attr_get = lio_pf_switchdev_attr_get,
-};
-
 static int liquidio_get_vf_stats(struct net_device *netdev, int vfidx,
 				 struct ifla_vf_stats *vf_stats)
 {
@@ -3259,6 +3247,7 @@ static const struct net_device_ops lionetdevops = {
 	.ndo_set_vf_trust	= liquidio_set_vf_trust,
 	.ndo_set_vf_link_state  = liquidio_set_vf_link_state,
 	.ndo_get_vf_stats	= liquidio_get_vf_stats,
+	.ndo_get_port_parent_id	= liquidio_get_port_parent_id,
 };
 
 /** \brief Entry point for the liquidio module
@@ -3534,7 +3523,6 @@ static int setup_nic_devices(struct octeon_device *octeon_dev)
 		 * netdev tasks.
 		 */
 		netdev->netdev_ops = &lionetdevops;
-		SWITCHDEV_SET_OPS(netdev, &lio_pf_switchdev_ops);
 
 		retval = netif_set_real_num_rx_queues(netdev, num_oqueues);
 		if (retval) {
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
index de61060721c4..f3f2e71431ac 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
@@ -25,7 +25,6 @@
 #include "octeon_nic.h"
 #include "octeon_main.h"
 #include "octeon_network.h"
-#include <net/switchdev.h>
 #include "lio_vf_rep.h"
 
 static int lio_vf_rep_open(struct net_device *ndev);
@@ -38,6 +37,8 @@ static int lio_vf_rep_phys_port_name(struct net_device *dev,
 static void lio_vf_rep_get_stats64(struct net_device *dev,
 				   struct rtnl_link_stats64 *stats64);
 static int lio_vf_rep_change_mtu(struct net_device *ndev, int new_mtu);
+static int lio_vf_get_port_parent_id(struct net_device *dev,
+				     struct netdev_phys_item_id *ppid);
 
 static const struct net_device_ops lio_vf_rep_ndev_ops = {
 	.ndo_open = lio_vf_rep_open,
@@ -47,6 +48,7 @@ static const struct net_device_ops lio_vf_rep_ndev_ops = {
 	.ndo_get_phys_port_name = lio_vf_rep_phys_port_name,
 	.ndo_get_stats64 = lio_vf_rep_get_stats64,
 	.ndo_change_mtu = lio_vf_rep_change_mtu,
+	.ndo_get_port_parent_id = lio_vf_get_port_parent_id,
 };
 
 static int
@@ -443,31 +445,19 @@ lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev)
 	return NETDEV_TX_OK;
 }
 
-static int
-lio_vf_rep_attr_get(struct net_device *dev, struct switchdev_attr *attr)
+static int lio_vf_get_port_parent_id(struct net_device *dev,
+				     struct netdev_phys_item_id *ppid)
 {
 	struct lio_vf_rep_desc *vf_rep = netdev_priv(dev);
 	struct net_device *parent_ndev = vf_rep->parent_ndev;
 	struct lio *lio = GET_LIO(parent_ndev);
 
-	switch (attr->id) {
-	case SWITCHDEV_ATTR_ID_PORT_PARENT_ID:
-		attr->u.ppid.id_len = ETH_ALEN;
-		ether_addr_copy(attr->u.ppid.id,
-				(void *)&lio->linfo.hw_addr + 2);
-		break;
-
-	default:
-		return -EOPNOTSUPP;
-	}
+	ppid->id_len = ETH_ALEN;
+	ether_addr_copy(ppid->id, (void *)&lio->linfo.hw_addr + 2);
 
 	return 0;
 }
 
-static const struct switchdev_ops lio_vf_rep_switchdev_ops = {
-	.switchdev_port_attr_get        = lio_vf_rep_attr_get,
-};
-
 static void
 lio_vf_rep_fetch_stats(struct work_struct *work)
 {
@@ -524,7 +514,6 @@ lio_vf_rep_create(struct octeon_device *oct)
 		ndev->min_mtu = LIO_MIN_MTU_SIZE;
 		ndev->max_mtu = LIO_MAX_MTU_SIZE;
 		ndev->netdev_ops = &lio_vf_rep_ndev_ops;
-		SWITCHDEV_SET_OPS(ndev, &lio_vf_rep_switchdev_ops);
 
 		vf_rep = netdev_priv(ndev);
 		memset(vf_rep, 0, sizeof(*vf_rep));
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 01/12] net: Introduce ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE
In-Reply-To: <20190206174546.23597-1-f.fainelli@gmail.com>

In preparation for getting rid of switchdev_ops, create a dedicated NDO
operation for getting the port's parent identifier. There are
essentially two classes of drivers that need to implement getting the
port's parent ID which are VF/PF drivers with a built-in switch, and
pure switchdev drivers such as mlxsw, ocelot, dsa etc.

We introduce a helper function: dev_get_port_parent_id() which supports
recursion into the lower devices to obtain the first port's parent ID.

Convert the bridge, core and ipv4 multicast routing code to check for
such ndo_get_port_parent_id() and call the helper function when valid
before falling back to switchdev_port_attr_get(). This will allow us to
convert all relevant drivers in one go instead of having to implement
both switchdev_port_attr_get() and ndo_get_port_parent_id() operations,
then get rid of switchdev_port_attr_get().

Acked-by: Jiri Pirko <jiri@mellanox.com>
Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
---
 include/linux/netdevice.h |  9 +++++++
 net/bridge/br_switchdev.c |  9 +++++--
 net/core/dev.c            | 57 +++++++++++++++++++++++++++++++++++++++
 net/core/net-sysfs.c      |  7 ++++-
 net/core/rtnetlink.c      |  6 ++++-
 net/ipv4/ipmr.c           |  8 +++++-
 6 files changed, 91 insertions(+), 5 deletions(-)

diff --git a/include/linux/netdevice.h b/include/linux/netdevice.h
index ba57d0ba425e..1d95e634f3fe 100644
--- a/include/linux/netdevice.h
+++ b/include/linux/netdevice.h
@@ -1188,6 +1188,10 @@ struct dev_ifalias {
  *	not implement this, it is assumed that the hw is not able to have
  *	multiple net devices on single physical port.
  *
+ * int (*ndo_get_port_parent_id)(struct net_device *dev,
+ *				 struct netdev_phys_item_id *ppid)
+ *	Called to get the parent ID of the physical port of this device.
+ *
  * void (*ndo_udp_tunnel_add)(struct net_device *dev,
  *			      struct udp_tunnel_info *ti);
  *	Called by UDP tunnel to notify a driver about the UDP port and socket
@@ -1412,6 +1416,8 @@ struct net_device_ops {
 						      bool new_carrier);
 	int			(*ndo_get_phys_port_id)(struct net_device *dev,
 							struct netdev_phys_item_id *ppid);
+	int			(*ndo_get_port_parent_id)(struct net_device *dev,
+							  struct netdev_phys_item_id *ppid);
 	int			(*ndo_get_phys_port_name)(struct net_device *dev,
 							  char *name, size_t len);
 	void			(*ndo_udp_tunnel_add)(struct net_device *dev,
@@ -3651,6 +3657,9 @@ int dev_get_phys_port_id(struct net_device *dev,
 			 struct netdev_phys_item_id *ppid);
 int dev_get_phys_port_name(struct net_device *dev,
 			   char *name, size_t len);
+int dev_get_port_parent_id(struct net_device *dev,
+			   struct netdev_phys_item_id *ppid, bool recurse);
+bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b);
 int dev_change_proto_down(struct net_device *dev, bool proto_down);
 struct sk_buff *validate_xmit_skb_list(struct sk_buff *skb, struct net_device *dev, bool *again);
 struct sk_buff *dev_hard_start_xmit(struct sk_buff *skb, struct net_device *dev,
diff --git a/net/bridge/br_switchdev.c b/net/bridge/br_switchdev.c
index 4d2b9eb7604a..06b0ae44585f 100644
--- a/net/bridge/br_switchdev.c
+++ b/net/bridge/br_switchdev.c
@@ -14,7 +14,8 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
 
 	/* dev is yet to be added to the port list. */
 	list_for_each_entry(p, &br->port_list, list) {
-		if (switchdev_port_same_parent_id(dev, p->dev))
+		if (netdev_port_same_parent_id(dev, p->dev) ||
+		    switchdev_port_same_parent_id(dev, p->dev))
 			return p->offload_fwd_mark;
 	}
 
@@ -23,6 +24,7 @@ static int br_switchdev_mark_get(struct net_bridge *br, struct net_device *dev)
 
 int nbp_switchdev_mark_set(struct net_bridge_port *p)
 {
+	const struct net_device_ops *ops = p->dev->netdev_ops;
 	struct switchdev_attr attr = {
 		.orig_dev = p->dev,
 		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
@@ -31,7 +33,10 @@ int nbp_switchdev_mark_set(struct net_bridge_port *p)
 
 	ASSERT_RTNL();
 
-	err = switchdev_port_attr_get(p->dev, &attr);
+	if (ops->ndo_get_port_parent_id)
+		err = dev_get_port_parent_id(p->dev, &attr.u.ppid, true);
+	else
+		err = switchdev_port_attr_get(p->dev, &attr);
 	if (err) {
 		if (err == -EOPNOTSUPP)
 			return 0;
diff --git a/net/core/dev.c b/net/core/dev.c
index bfa4be42afff..8c6d5cf8a308 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -7877,6 +7877,63 @@ int dev_get_phys_port_name(struct net_device *dev,
 }
 EXPORT_SYMBOL(dev_get_phys_port_name);
 
+/**
+ *	dev_get_port_parent_id - Get the device's port parent identifier
+ *	@dev: network device
+ *	@ppid: pointer to a storage for the port's parent identifier
+ *	@recurse: allow/disallow recursion to lower devices
+ *
+ *	Get the devices's port parent identifier
+ */
+int dev_get_port_parent_id(struct net_device *dev,
+			   struct netdev_phys_item_id *ppid,
+			   bool recurse)
+{
+	const struct net_device_ops *ops = dev->netdev_ops;
+	struct netdev_phys_item_id first = { };
+	struct net_device *lower_dev;
+	struct list_head *iter;
+	int err = -EOPNOTSUPP;
+
+	if (ops->ndo_get_port_parent_id)
+		return ops->ndo_get_port_parent_id(dev, ppid);
+
+	if (!recurse)
+		return err;
+
+	netdev_for_each_lower_dev(dev, lower_dev, iter) {
+		err = dev_get_port_parent_id(lower_dev, ppid, recurse);
+		if (err)
+			break;
+		if (!first.id_len)
+			first = *ppid;
+		else if (memcmp(&first, ppid, sizeof(*ppid)))
+			return -ENODATA;
+	}
+
+	return err;
+}
+EXPORT_SYMBOL(dev_get_port_parent_id);
+
+/**
+ *	netdev_port_same_parent_id - Indicate if two network devices have
+ *	the same port parent identifier
+ *	@a: first network device
+ *	@b: second network device
+ */
+bool netdev_port_same_parent_id(struct net_device *a, struct net_device *b)
+{
+	struct netdev_phys_item_id a_id = { };
+	struct netdev_phys_item_id b_id = { };
+
+	if (dev_get_port_parent_id(a, &a_id, true) ||
+	    dev_get_port_parent_id(b, &b_id, true))
+		return false;
+
+	return netdev_phys_item_id_same(&a_id, &b_id);
+}
+EXPORT_SYMBOL(netdev_port_same_parent_id);
+
 /**
  *	dev_change_proto_down - update protocol port state information
  *	@dev: device
diff --git a/net/core/net-sysfs.c b/net/core/net-sysfs.c
index ff9fd2bb4ce4..4eace9f1dcf9 100644
--- a/net/core/net-sysfs.c
+++ b/net/core/net-sysfs.c
@@ -495,6 +495,7 @@ static ssize_t phys_switch_id_show(struct device *dev,
 				   struct device_attribute *attr, char *buf)
 {
 	struct net_device *netdev = to_net_dev(dev);
+	const struct net_device_ops *ops = netdev->netdev_ops;
 	ssize_t ret = -EINVAL;
 
 	if (!rtnl_trylock())
@@ -507,7 +508,11 @@ static ssize_t phys_switch_id_show(struct device *dev,
 			.flags = SWITCHDEV_F_NO_RECURSE,
 		};
 
-		ret = switchdev_port_attr_get(netdev, &attr);
+		if (ops->ndo_get_port_parent_id)
+			ret = dev_get_port_parent_id(netdev, &attr.u.ppid,
+						     false);
+		else
+			ret = switchdev_port_attr_get(netdev, &attr);
 		if (!ret)
 			ret = sprintf(buf, "%*phN\n", attr.u.ppid.id_len,
 				      attr.u.ppid.id);
diff --git a/net/core/rtnetlink.c b/net/core/rtnetlink.c
index f5a98082ac7a..90dd02c1f561 100644
--- a/net/core/rtnetlink.c
+++ b/net/core/rtnetlink.c
@@ -1146,6 +1146,7 @@ static int rtnl_phys_port_name_fill(struct sk_buff *skb, struct net_device *dev)
 
 static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
 {
+	const struct net_device_ops *ops = dev->netdev_ops;
 	int err;
 	struct switchdev_attr attr = {
 		.orig_dev = dev,
@@ -1153,7 +1154,10 @@ static int rtnl_phys_switch_id_fill(struct sk_buff *skb, struct net_device *dev)
 		.flags = SWITCHDEV_F_NO_RECURSE,
 	};
 
-	err = switchdev_port_attr_get(dev, &attr);
+	if (ops->ndo_get_port_parent_id)
+		err = dev_get_port_parent_id(dev, &attr.u.ppid, false);
+	else
+		err = switchdev_port_attr_get(dev, &attr);
 	if (err) {
 		if (err == -EOPNOTSUPP)
 			return 0;
diff --git a/net/ipv4/ipmr.c b/net/ipv4/ipmr.c
index fb99002c3d4e..c71bcc42d66d 100644
--- a/net/ipv4/ipmr.c
+++ b/net/ipv4/ipmr.c
@@ -837,6 +837,7 @@ static void ipmr_update_thresholds(struct mr_table *mrt, struct mr_mfc *cache,
 static int vif_add(struct net *net, struct mr_table *mrt,
 		   struct vifctl *vifc, int mrtsock)
 {
+	const struct net_device_ops *ops;
 	int vifi = vifc->vifc_vifi;
 	struct switchdev_attr attr = {
 		.id = SWITCHDEV_ATTR_ID_PORT_PARENT_ID,
@@ -920,7 +921,12 @@ static int vif_add(struct net *net, struct mr_table *mrt,
 			(VIFF_TUNNEL | VIFF_REGISTER));
 
 	attr.orig_dev = dev;
-	if (!switchdev_port_attr_get(dev, &attr)) {
+	ops = dev->netdev_ops;
+	if (ops->ndo_get_port_parent_id &&
+	    !dev_get_port_parent_id(dev, &attr.u.ppid, true)) {
+		memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
+		v->dev_parent_id.id_len = attr.u.ppid.id_len;
+	} else if (!switchdev_port_attr_get(dev, &attr)) {
 		memcpy(v->dev_parent_id.id, attr.u.ppid.id, attr.u.ppid.id_len);
 		v->dev_parent_id.id_len = attr.u.ppid.id_len;
 	} else {
-- 
2.17.1


^ permalink raw reply related

* [PATCH net-next v4 00/12] net: Introduce ndo_get_port_parent_id()
From: Florian Fainelli @ 2019-02-06 17:45 UTC (permalink / raw)
  To: netdev
  Cc: Florian Fainelli, David S. Miller, Ido Schimmel, open list,
	open list:MELLANOX MLX5 core VPI driver,
	open list:NETRONOME ETHERNET DRIVERS, open list:STAGING SUBSYSTEM,
	moderated list:ETHERNET BRIDGE

Hi all,

Based on discussion with Ido and feedback from Jakub there are clearly
two classes of users that implement SWITCHDEV_ATTR_ID_PORT_PARENT_ID:

- PF/VF drivers which typically only implement return the port's parent
  ID, yet have to implement switchdev_port_attr_get() just for that

- Ethernet switch drivers: mlxsw, ocelot, DSA, etc. which implement more
  attributes which we want to be able to eventually veto in the context
  of the caller, thus making them candidates for using a blocking notifier
  chain

Changes in v4:

- remove superfluous net/switchdev.h inclusions in a few files
- added Jiri's Acked-by where given
- removed err = -EOPNOTSUPP initializations
- changed according to Jiri's suggestion in net/ipv4/ipmr.c

Changes in v3:

- keep ethsw's switchdev_ops assignment
- remove inclusion of net/switchdev.h in netdevsim which is no longer
  necesary

Changes in v2:

- resolved build failures spotted by kbuild test robot
- added helpers functions into the core network device layer:
  dev_get_port_parent_id() and netdev_port_same_parent_id();
- added support for recursion to lower devices

Changes from RFC:

- introduce a ndo_get_port_parent_id() and convert all relevant drivers
  to use it

- get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID

A subsequent set of patches will convert switchdev_port_attr_set() to
use a blocking notifier call, and still get rid of
switchdev_port_attr_get() altogether.

Florian Fainelli (12):
  net: Introduce ndo_get_port_parent_id()
  bnxt: Implement ndo_get_port_parent_id()
  liquidio: Implement ndo_get_port_parent_id()
  net/mlx5e: Implement ndo_get_port_parent_id()
  mlxsw: Implement ndo_get_port_parent_id()
  mscc: ocelot: Implement ndo_get_port_parent_id()
  nfp: Implement ndo_get_port_parent_id()
  rocker: Implement ndo_get_port_parent_id()
  netdevsim: Implement ndo_get_port_parent_id()
  staging: fsl-dpaa2: ethsw: Implement ndo_get_port_parent_id()
  net: dsa: Implement ndo_get_port_parent_id()
  net: Get rid of SWITCHDEV_ATTR_ID_PORT_PARENT_ID

 drivers/net/ethernet/broadcom/bnxt/bnxt.c     | 28 +++------
 drivers/net/ethernet/broadcom/bnxt/bnxt.h     |  4 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_tc.c  |  2 +-
 drivers/net/ethernet/broadcom/bnxt/bnxt_vfr.c | 12 ++--
 .../net/ethernet/cavium/liquidio/lio_main.c   | 22 ++-----
 .../net/ethernet/cavium/liquidio/lio_vf_rep.c | 25 +++-----
 .../ethernet/mellanox/mlx5/core/en/tc_tun.c   |  2 +-
 .../net/ethernet/mellanox/mlx5/core/en_rep.c  | 31 ++++------
 .../net/ethernet/mellanox/mlx5/core/en_tc.c   |  5 +-
 .../net/ethernet/mellanox/mlxsw/spectrum.c    | 13 +++++
 .../mellanox/mlxsw/spectrum_switchdev.c       |  5 --
 .../net/ethernet/mellanox/mlxsw/switchx2.c    | 37 +++++-------
 drivers/net/ethernet/mscc/ocelot.c            | 33 +++++------
 .../ethernet/netronome/nfp/flower/action.c    |  3 +-
 .../ethernet/netronome/nfp/nfp_net_common.c   |  4 +-
 .../net/ethernet/netronome/nfp/nfp_net_repr.c |  4 +-
 drivers/net/ethernet/netronome/nfp/nfp_port.c | 22 ++-----
 drivers/net/ethernet/netronome/nfp/nfp_port.h |  4 +-
 drivers/net/ethernet/rocker/rocker_main.c     | 17 ++++--
 drivers/net/netdevsim/netdev.c                | 23 ++------
 drivers/staging/fsl-dpaa2/ethsw/ethsw.c       | 16 ++++--
 include/linux/netdevice.h                     |  9 +++
 include/net/switchdev.h                       | 11 ----
 net/bridge/br_switchdev.c                     |  9 +--
 net/core/dev.c                                | 57 +++++++++++++++++++
 net/core/net-sysfs.c                          | 12 +---
 net/core/rtnetlink.c                          | 12 +---
 net/dsa/slave.c                               | 18 ++++--
 net/ipv4/ipmr.c                               | 13 ++---
 net/switchdev/switchdev.c                     | 20 -------
 30 files changed, 214 insertions(+), 259 deletions(-)

-- 
2.17.1


^ permalink raw reply

* Re: [PATCH net] net: dsa: Fix NULL checking in dsa_slave_set_eee()
From: Vivien Didelot @ 2019-02-06 17:48 UTC (permalink / raw)
  To: Dan Carpenter
  Cc: Andrew Lunn, Florian Fainelli, David S. Miller, netdev,
	kernel-janitors
In-Reply-To: <20190206153514.GA11033@kadam>

On Wed, 6 Feb 2019 18:35:15 +0300, Dan Carpenter <dan.carpenter@oracle.com> wrote:
> This function can't succeed if dp->pl is NULL.  It will Oops inside the
> call to return phylink_ethtool_get_eee(dp->pl, e);
> 
> Fixes: 1be52e97ed3e ("dsa: slave: eee: Allow ports to use phylink")
> Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>

Reviewed-by: Vivien Didelot <vivien.didelot@gmail.com>

^ permalink raw reply

* Re: [PATCH 0/8] ARM: at91/dt: update to existing drivers for the sam9x60 SoC
From: Nicolas.Ferre @ 2019-02-06 17:51 UTC (permalink / raw)
  To: alexandre.belloni, Ludovic.Desroches, sre, gregkh, robh+dt
  Cc: linux-kernel, linux-arm-kernel, linux-pm, netdev, davem,
	linux-usb, stern, devicetree
In-Reply-To: <cover.1547629763.git.nicolas.ferre@microchip.com>

All,

On 16/01/2019 at 10:57, Nicolas Ferre wrote:
> Hi,
> 
> This series collects some little modifications to DT bindings and associated
> drivers changes for supporting the upcoming SAM9X60 SoC.
> 
> I took the advantage of this series for fixing some of the leftovers in DT
> bindings for reset controller and Ethernet macb.
> 
> These changes touch several sub-systems but I would like that these (mostly
> trivial) patches stay together for facilitating reviews, prevent breaking
> dependencies and facilitating the tracking of acceptance status. However, tell
> me if you think otherwise.

It seems it's not the preferred way to go and that I must split and send 
to sub-system Maintainers so that bindings and driver code go together 
through Maintainer's git trees (USB, power/reset, netdev).

> My intentions are that the series would enter Mainline through arm-soc tree:
> sounds okay to everyone? If okay, I'm ready to collect Ack tags...

I'm re-sending this split series. Some of the "Reviewed-by:" are missing 
so we'll have the chance to add them on individual series.

Thanks for your reviews so far.

Best regards,
   Nicolas


> For the first batch, I send the whole series to everyone. I'll try my best to
> reduce subsequent message deliveries if one part of the serries needs rework.
> 
> Best regards,
>    Nicolas
> 
> 
> Nicolas Ferre (8):
>    dt-bindings: arm: atmel: add missing samx7 to reset controller
>    dt-bindings: arm: atmel: add new sam9x60 reset controller binding
>    dt-bindings: arm: atmel: add new sam9x60 SFR binding
>    net/macb: bindings doc/trivial: fix documentation for sama5d3 10/100
>      interface
>    net/macb: bindings doc: add sam9x60 binding
>    power: reset: at91-reset: add support for sam9x60 SoC
>    USB: host: ohci-at91: add sam9x60-sfr definition for ohci
>    net: macb: add sam9x60-macb compatibility string
> 
>   .../devicetree/bindings/arm/atmel-sysregs.txt       |  4 +++-
>   Documentation/devicetree/bindings/net/macb.txt      |  4 ++--
>   drivers/net/ethernet/cadence/macb_main.c            |  1 +
>   drivers/power/reset/at91-reset.c                    | 13 +++++++++++++
>   drivers/usb/host/ohci-at91.c                        |  7 +++++--
>   5 files changed, 24 insertions(+), 5 deletions(-)
> 


-- 
Nicolas Ferre

^ permalink raw reply


This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox