* Re: [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: David Z. Dai @ 2019-08-30 20:03 UTC (permalink / raw)
To: Cong Wang
Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
Linux Kernel Network Developers, LKML, zdai
In-Reply-To: <CAM_iQpVMYQUdQN5L+ntXZTffZkW4q659bvXoZ8+Ar+zeud7Y4Q@mail.gmail.com>
On Fri, 2019-08-30 at 12:11 -0700, Cong Wang wrote:
> On Fri, Aug 30, 2019 at 12:06 PM David Dai <zdai@linux.vnet.ibm.com> wrote:
> > - if (p->peak_present)
> > + if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
> > + nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
> > + police->params->rate.rate_bytes_ps,
> > + __TCA_POLICE_MAX))
>
> I think the last parameter should be TCA_POLICE_PAD.
Thanks for reviewing it!
I have the impression that last parameter num value should be larger
than the attribute num value in 2nd parameter (TC_POLICE_RATE64 in this
case). This is the reason I changed the last parameter value to
__TCA_POLICE_MAX after I moved the new attributes after TC_POLICE_PAD in
pkt_cls.h header.
I rebuilt the kernel module act_police.ko by using TC_POLICE_PAD in the
4 parameter as before, I am able to set > 32bit rate and peakrate value
in tc command. It also works properly.
If the rest of community thinks I should keep using TC_POLICE_PAD in the
4th parameter too, I can change it to TC_POLICE_PAD in the next version.
Thanks!
^ permalink raw reply
* Re: [v2] iproute2-next: police: support 64bit rate and peakrate in tc utility
From: Stephen Hemminger @ 2019-08-30 19:37 UTC (permalink / raw)
To: David Dai; +Cc: jhs, xiyou.wangcong, jiri, netdev, linux-kernel, zdai
In-Reply-To: <1567192037-11684-1-git-send-email-zdai@linux.vnet.ibm.com>
On Fri, 30 Aug 2019 14:07:17 -0500
David Dai <zdai@linux.vnet.ibm.com> wrote:
> + if (rate64) {
> fprintf(stderr, "Double \"rate\" spec\n");
> return -1;
> }
The m_police filter should start using the common functions
for duparg and invarg that are in lib/utils.c
^ permalink raw reply
* Re: [PATCH v6 net-next 12/19] ionic: Add Rx filter and rx_mode ndo support
From: Shannon Nelson @ 2019-08-30 19:35 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829160610.60563ca0@cakuba.netronome.com>
On 8/29/19 4:06 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:13 -0700, Shannon Nelson wrote:
>> @@ -588,8 +866,26 @@ static int ionic_set_features(struct net_device *netdev,
>>
>> static int ionic_set_mac_address(struct net_device *netdev, void *sa)
>> {
>> - netdev_info(netdev, "%s: stubbed\n", __func__);
>> - return 0;
>> + struct sockaddr *addr = sa;
>> + u8 *mac;
>> +
>> + mac = (u8 *)addr->sa_data;
>> + if (ether_addr_equal(netdev->dev_addr, mac))
>> + return 0;
>> +
>> + if (!is_valid_ether_addr(mac))
>> + return -EADDRNOTAVAIL;
>> +
>> + if (!is_zero_ether_addr(netdev->dev_addr)) {
>> + netdev_info(netdev, "deleting mac addr %pM\n",
>> + netdev->dev_addr);
>> + ionic_addr_del(netdev, netdev->dev_addr);
>> + }
>> +
>> + memcpy(netdev->dev_addr, mac, netdev->addr_len);
>> + netdev_info(netdev, "updating mac addr %pM\n", mac);
>> +
>> + return ionic_addr_add(netdev, mac);
>> }
> Please use the eth_prepare_mac_addr_change() and
> eth_commit_mac_addr_change() helpers.
Oh, hadn't seen those before... sure.
sln
^ permalink raw reply
* Re: [PATCH][V2] wimax/i2400m: remove debug containing bogus calculation of index
From: David Miller @ 2019-08-30 19:32 UTC (permalink / raw)
To: colin.king
Cc: inaky.perez-gonzalez, linux-wimax, netdev, kernel-janitors,
linux-kernel
In-Reply-To: <20190830090711.15300-1-colin.king@canonical.com>
From: Colin King <colin.king@canonical.com>
Date: Fri, 30 Aug 2019 10:07:11 +0100
> From: Colin Ian King <colin.king@canonical.com>
>
> The subtraction of the two pointers is automatically scaled by the
> size of the size of the object the pointers point to, so the division
> by sizeof(*i2400m->barker) is incorrect. This has been broken since
> day one of the driver and is only debug, so remove the debug completely.
>
> Also move && in condition to clean up a checkpatch warning.
>
> Addresses-Coverity: ("Extra sizeof expression")
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>
> V2: completely remove debug, clean up checkpatch warning, change subject line
Applied to net-next, thanks Colin.
^ permalink raw reply
* Re: [PATCH v6 net-next 07/19] ionic: Add basic adminq support
From: Shannon Nelson @ 2019-08-30 19:31 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829155251.3b2d86c7@cakuba.netronome.com>
On 8/29/19 3:52 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:08 -0700, Shannon Nelson wrote:
>> +static void ionic_lif_qcq_deinit(struct ionic_lif *lif, struct ionic_qcq *qcq)
>> +{
>> + struct ionic_dev *idev = &lif->ionic->idev;
>> + struct device *dev = lif->ionic->dev;
>> +
>> + if (!qcq)
>> + return;
>> +
>> + ionic_debugfs_del_qcq(qcq);
>> +
>> + if (!(qcq->flags & IONIC_QCQ_F_INITED))
>> + return;
>> +
>> + if (qcq->flags & IONIC_QCQ_F_INTR) {
>> + ionic_intr_mask(idev->intr_ctrl, qcq->intr.index,
>> + IONIC_INTR_MASK_SET);
>> + synchronize_irq(qcq->intr.vector);
>> + devm_free_irq(dev, qcq->intr.vector, &qcq->napi);
> Doesn't free_irq() basically imply synchronize_irq()?
The synchronize_irq() waits for any threaded handlers to finish, while
free_irq() only waits for HW handling. This helps makes sure we don't
have anything still running before we remove resources.
sln
>
>> + netif_napi_del(&qcq->napi);
>> + }
>> +
>> + qcq->flags &= ~IONIC_QCQ_F_INITED;
^ permalink raw reply
* memory leak in nr_rx_frame (2)
From: syzbot @ 2019-08-30 19:28 UTC (permalink / raw)
To: davem, linux-hams, linux-kernel, netdev, ralf, syzkaller-bugs
Hello,
syzbot found the following crash on:
HEAD commit: 6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=10200912600000
kernel config: https://syzkaller.appspot.com/x/.config?x=e6131eafb9408877
dashboard link: https://syzkaller.appspot.com/bug?extid=0145ea560de205bc09f0
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=12b51f9c600000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+0145ea560de205bc09f0@syzkaller.appspotmail.com
2019/08/29 23:31:49 executed programs: 8
2019/08/29 23:31:56 executed programs: 15
2019/08/29 23:32:02 executed programs: 24
BUG: memory leak
unreferenced object 0xffff888123355800 (size 2048):
comm "softirq", pid 0, jiffies 4295062008 (age 25.620s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
06 00 07 40 00 00 00 00 00 00 00 00 00 00 00 00 ...@............
backtrace:
[<00000000bbb1ff80>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<00000000bbb1ff80>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<00000000bbb1ff80>] slab_alloc mm/slab.c:3319 [inline]
[<00000000bbb1ff80>] __do_kmalloc mm/slab.c:3653 [inline]
[<00000000bbb1ff80>] __kmalloc+0x169/0x300 mm/slab.c:3664
[<000000003948180d>] kmalloc include/linux/slab.h:557 [inline]
[<000000003948180d>] sk_prot_alloc+0x112/0x170 net/core/sock.c:1603
[<00000000ad5c33ee>] sk_alloc+0x35/0x2f0 net/core/sock.c:1657
[<000000004e2b1f5c>] nr_make_new net/netrom/af_netrom.c:476 [inline]
[<000000004e2b1f5c>] nr_rx_frame+0x339/0x8ee net/netrom/af_netrom.c:959
[<00000000df4c3d82>] nr_loopback_timer+0x4e/0xd0
net/netrom/nr_loopback.c:59
[<00000000e886ef23>] call_timer_fn+0x45/0x1e0 kernel/time/timer.c:1322
[<00000000cc0c55bd>] expire_timers kernel/time/timer.c:1366 [inline]
[<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1685 [inline]
[<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1653 [inline]
[<00000000cc0c55bd>] run_timer_softirq+0x256/0x740
kernel/time/timer.c:1698
[<000000008a8ac853>] __do_softirq+0x115/0x33f kernel/softirq.c:292
[<00000000c33f7c40>] invoke_softirq kernel/softirq.c:373 [inline]
[<00000000c33f7c40>] irq_exit+0xbb/0xe0 kernel/softirq.c:413
[<00000000dc851865>] exiting_irq arch/x86/include/asm/apic.h:537
[inline]
[<00000000dc851865>] smp_apic_timer_interrupt+0x96/0x190
arch/x86/kernel/apic/apic.c:1133
[<000000006a57c22f>] apic_timer_interrupt+0xf/0x20
arch/x86/entry/entry_64.S:830
[<00000000ec52384e>] arch_local_irq_restore
arch/x86/include/asm/paravirt.h:768 [inline]
[<00000000ec52384e>] console_unlock.part.0+0x5f0/0x6d0
kernel/printk/printk.c:2471
[<0000000013f07031>] console_unlock kernel/printk/printk.c:2364 [inline]
[<0000000013f07031>] vprintk_emit+0x251/0x360
kernel/printk/printk.c:1986
[<00000000704abaae>] vprintk_default+0x28/0x30
kernel/printk/printk.c:2013
[<000000008aa8a0ba>] vprintk_func+0x59/0xfa
kernel/printk/printk_safe.c:386
[<000000004d884645>] printk+0x60/0x7d kernel/printk/printk.c:2046
BUG: memory leak
unreferenced object 0xffff88810e8bd820 (size 32):
comm "softirq", pid 0, jiffies 4295062008 (age 25.620s)
hex dump (first 32 bytes):
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
03 00 00 00 03 00 00 00 0f 00 00 00 00 00 00 00 ................
backtrace:
[<0000000092f05cd5>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<0000000092f05cd5>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<0000000092f05cd5>] slab_alloc mm/slab.c:3319 [inline]
[<0000000092f05cd5>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
[<00000000f2b13853>] kmalloc include/linux/slab.h:552 [inline]
[<00000000f2b13853>] kzalloc include/linux/slab.h:748 [inline]
[<00000000f2b13853>] selinux_sk_alloc_security+0x48/0xb0
security/selinux/hooks.c:5073
[<000000002301f7f8>] security_sk_alloc+0x49/0x70
security/security.c:2029
[<000000009fb5708b>] sk_prot_alloc+0x12d/0x170 net/core/sock.c:1606
[<00000000ad5c33ee>] sk_alloc+0x35/0x2f0 net/core/sock.c:1657
[<000000004e2b1f5c>] nr_make_new net/netrom/af_netrom.c:476 [inline]
[<000000004e2b1f5c>] nr_rx_frame+0x339/0x8ee net/netrom/af_netrom.c:959
[<00000000df4c3d82>] nr_loopback_timer+0x4e/0xd0
net/netrom/nr_loopback.c:59
[<00000000e886ef23>] call_timer_fn+0x45/0x1e0 kernel/time/timer.c:1322
[<00000000cc0c55bd>] expire_timers kernel/time/timer.c:1366 [inline]
[<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1685 [inline]
[<00000000cc0c55bd>] __run_timers kernel/time/timer.c:1653 [inline]
[<00000000cc0c55bd>] run_timer_softirq+0x256/0x740
kernel/time/timer.c:1698
[<000000008a8ac853>] __do_softirq+0x115/0x33f kernel/softirq.c:292
[<00000000c33f7c40>] invoke_softirq kernel/softirq.c:373 [inline]
[<00000000c33f7c40>] irq_exit+0xbb/0xe0 kernel/softirq.c:413
[<00000000dc851865>] exiting_irq arch/x86/include/asm/apic.h:537
[inline]
[<00000000dc851865>] smp_apic_timer_interrupt+0x96/0x190
arch/x86/kernel/apic/apic.c:1133
[<000000006a57c22f>] apic_timer_interrupt+0xf/0x20
arch/x86/entry/entry_64.S:830
[<00000000ec52384e>] arch_local_irq_restore
arch/x86/include/asm/paravirt.h:768 [inline]
[<00000000ec52384e>] console_unlock.part.0+0x5f0/0x6d0
kernel/printk/printk.c:2471
[<0000000013f07031>] console_unlock kernel/printk/printk.c:2364 [inline]
[<0000000013f07031>] vprintk_emit+0x251/0x360
kernel/printk/printk.c:1986
[<00000000704abaae>] vprintk_default+0x28/0x30
kernel/printk/printk.c:2013
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply
* INFO: task hung in p9_fd_close
From: syzbot @ 2019-08-30 19:28 UTC (permalink / raw)
To: asmadeus, davem, ericvh, linux-kernel, lucho, netdev,
syzkaller-bugs, v9fs-developer
Hello,
syzbot found the following crash on:
HEAD commit: 6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=1118a71e600000
kernel config: https://syzkaller.appspot.com/x/.config?x=58485246ad14eafe
dashboard link: https://syzkaller.appspot.com/bug?extid=8b41a1365f1106fd0f33
compiler: clang version 9.0.0 (/home/glider/llvm/clang
80fee25776c2fb61e74c1ecb1a523375c2500b69)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1125ee12600000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+8b41a1365f1106fd0f33@syzkaller.appspotmail.com
INFO: task syz-executor.1:13699 blocked for more than 143 seconds.
Not tainted 5.3.0-rc6+ #94
"echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message.
syz-executor.1 D28888 13699 9148 0x00004004
Call Trace:
context_switch kernel/sched/core.c:3254 [inline]
__schedule+0x877/0xc50 kernel/sched/core.c:3880
schedule+0x131/0x1e0 kernel/sched/core.c:3947
schedule_timeout+0x46/0x240 kernel/time/timer.c:1783
do_wait_for_common+0x2e7/0x4d0 kernel/sched/completion.c:83
__wait_for_common kernel/sched/completion.c:104 [inline]
wait_for_common kernel/sched/completion.c:115 [inline]
wait_for_completion+0x47/0x60 kernel/sched/completion.c:136
__flush_work+0xd4/0x150 kernel/workqueue.c:3040
__cancel_work_timer+0x420/0x570 kernel/workqueue.c:3127
cancel_work_sync+0x17/0x20 kernel/workqueue.c:3163
p9_conn_destroy net/9p/trans_fd.c:868 [inline]
p9_fd_close+0x297/0x3c0 net/9p/trans_fd.c:898
p9_client_create+0x974/0xee0 net/9p/client.c:1068
v9fs_session_init+0x192/0x18e0 fs/9p/v9fs.c:406
v9fs_mount+0x82/0x810 fs/9p/vfs_super.c:120
legacy_get_tree+0xf9/0x1a0 fs/fs_context.c:661
vfs_get_tree+0x8f/0x380 fs/super.c:1413
do_new_mount fs/namespace.c:2791 [inline]
do_mount+0x169d/0x2490 fs/namespace.c:3111
ksys_mount+0xcc/0x100 fs/namespace.c:3320
__do_sys_mount fs/namespace.c:3334 [inline]
__se_sys_mount fs/namespace.c:3331 [inline]
__x64_sys_mount+0xbf/0xd0 fs/namespace.c:3331
do_syscall_64+0xfe/0x140 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x459879
Code: 8b 44 24 18 48 8b 4c 24 30 48 83 c1 08 48 89 0c 24 48 89 44 24 08 48
c7 44 24 10 10 00 00 00 e8 0d da fa ff 48 8b 44 24 18 48 <89> 44 24 40 48
8b 6c 24 20 48 83 c4 28 c3 e8 14 b9 ff ff eb 82 cc
RSP: 002b:00007f6b4dda7c78 EFLAGS: 00000246 ORIG_RAX: 00000000000000a5
RAX: ffffffffffffffda RBX: 0000000000000005 RCX: 0000000000459879
RDX: 0000000020000140 RSI: 0000000020000000 RDI: 0000000000000000
RBP: 000000000075c118 R08: 0000000020000480 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f6b4dda86d4
R13: 00000000004c5e2f R14: 00000000004da930 R15: 00000000ffffffff
INFO: lockdep is turned off.
NMI backtrace for cpu 0
CPU: 0 PID: 1057 Comm: khungtaskd Not tainted 5.3.0-rc6+ #94
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x1d8/0x2f8 lib/dump_stack.c:113
nmi_cpu_backtrace+0xaf/0x1a0 lib/nmi_backtrace.c:101
nmi_trigger_cpumask_backtrace+0x174/0x290 lib/nmi_backtrace.c:62
arch_trigger_cpumask_backtrace+0x10/0x20 arch/x86/kernel/apic/hw_nmi.c:38
trigger_all_cpu_backtrace+0x17/0x20 include/linux/nmi.h:146
check_hung_uninterruptible_tasks kernel/hung_task.c:205 [inline]
watchdog+0xbb9/0xbd0 kernel/hung_task.c:289
kthread+0x332/0x350 kernel/kthread.c:255
ret_from_fork+0x24/0x30 arch/x86/entry/entry_64.S:352
Sending NMI from CPU 0 to CPUs 1:
NMI backtrace for cpu 1 skipped: idling at native_safe_halt+0xe/0x10
arch/x86/include/asm/irqflags.h:60
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply
* memory leak in hci_inquiry_cache_update
From: syzbot @ 2019-08-30 19:28 UTC (permalink / raw)
To: davem, johan.hedberg, linux-bluetooth, linux-kernel, marcel,
netdev, syzkaller-bugs
Hello,
syzbot found the following crash on:
HEAD commit: 6525771f Merge tag 'arc-5.3-rc7' of git://git.kernel.org/p..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=11ce405c600000
kernel config: https://syzkaller.appspot.com/x/.config?x=e6131eafb9408877
dashboard link: https://syzkaller.appspot.com/bug?extid=82e5dfb66f1a36c0ffbb
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=16ef5ade600000
IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+82e5dfb66f1a36c0ffbb@syzkaller.appspotmail.com
2019/08/30 10:10:13 executed programs: 1
2019/08/30 10:10:24 executed programs: 2
2019/08/30 10:10:39 executed programs: 3
2019/08/30 10:10:49 executed programs: 4
BUG: memory leak
unreferenced object 0xffff8881227b8ac0 (size 64):
comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
hex dump (first 32 bytes):
70 2a b0 2a 81 88 ff ff c0 7e c6 1a 81 88 ff ff p*.*.....~......
80 2a b0 2a 81 88 ff ff d0 7e c6 1a 81 88 ff ff .*.*.....~......
backtrace:
[<0000000003c40121>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
[<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
[<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
[<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
[<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0
net/bluetooth/hci_core.c:1183
[<000000000fa97823>] hci_inquiry_result_with_rssi_evt
net/bluetooth/hci_event.c:4079 [inline]
[<000000000fa97823>] hci_event_packet+0x1224/0x3453
net/bluetooth/hci_event.c:5952
[<0000000021923028>] hci_rx_work+0x1b6/0x2f0
net/bluetooth/hci_core.c:4462
[<00000000eb63bebf>] process_one_work+0x210/0x490
kernel/workqueue.c:2269
[<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
[<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
[<00000000c66acc55>] ret_from_fork+0x1f/0x30
arch/x86/entry/entry_64.S:352
BUG: memory leak
unreferenced object 0xffff88811ac67ec0 (size 64):
comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
hex dump (first 32 bytes):
c0 8a 7b 22 81 88 ff ff 80 7e c6 1a 81 88 ff ff ..{".....~......
d0 8a 7b 22 81 88 ff ff 90 7e c6 1a 81 88 ff ff ..{".....~......
backtrace:
[<0000000003c40121>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
[<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
[<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
[<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
[<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0
net/bluetooth/hci_core.c:1183
[<000000000fa97823>] hci_inquiry_result_with_rssi_evt
net/bluetooth/hci_event.c:4079 [inline]
[<000000000fa97823>] hci_event_packet+0x1224/0x3453
net/bluetooth/hci_event.c:5952
[<0000000021923028>] hci_rx_work+0x1b6/0x2f0
net/bluetooth/hci_core.c:4462
[<00000000eb63bebf>] process_one_work+0x210/0x490
kernel/workqueue.c:2269
[<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
[<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
[<00000000c66acc55>] ret_from_fork+0x1f/0x30
arch/x86/entry/entry_64.S:352
BUG: memory leak
unreferenced object 0xffff88811ac67e80 (size 64):
comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
hex dump (first 32 bytes):
c0 7e c6 1a 81 88 ff ff 40 7e c6 1a 81 88 ff ff .~......@~......
d0 7e c6 1a 81 88 ff ff 50 7e c6 1a 81 88 ff ff .~......P~......
backtrace:
[<0000000003c40121>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
[<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
[<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
[<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
[<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0
net/bluetooth/hci_core.c:1183
[<000000000fa97823>] hci_inquiry_result_with_rssi_evt
net/bluetooth/hci_event.c:4079 [inline]
[<000000000fa97823>] hci_event_packet+0x1224/0x3453
net/bluetooth/hci_event.c:5952
[<0000000021923028>] hci_rx_work+0x1b6/0x2f0
net/bluetooth/hci_core.c:4462
[<00000000eb63bebf>] process_one_work+0x210/0x490
kernel/workqueue.c:2269
[<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
[<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
[<00000000c66acc55>] ret_from_fork+0x1f/0x30
arch/x86/entry/entry_64.S:352
BUG: memory leak
unreferenced object 0xffff88811ac67e40 (size 64):
comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
hex dump (first 32 bytes):
80 7e c6 1a 81 88 ff ff 00 7e c6 1a 81 88 ff ff .~.......~......
90 7e c6 1a 81 88 ff ff 10 7e c6 1a 81 88 ff ff .~.......~......
backtrace:
[<0000000003c40121>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
[<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
[<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
[<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
[<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0
net/bluetooth/hci_core.c:1183
[<000000000fa97823>] hci_inquiry_result_with_rssi_evt
net/bluetooth/hci_event.c:4079 [inline]
[<000000000fa97823>] hci_event_packet+0x1224/0x3453
net/bluetooth/hci_event.c:5952
[<0000000021923028>] hci_rx_work+0x1b6/0x2f0
net/bluetooth/hci_core.c:4462
[<00000000eb63bebf>] process_one_work+0x210/0x490
kernel/workqueue.c:2269
[<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
[<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
[<00000000c66acc55>] ret_from_fork+0x1f/0x30
arch/x86/entry/entry_64.S:352
BUG: memory leak
unreferenced object 0xffff88811ac67e00 (size 64):
comm "kworker/u5:0", pid 1543, jiffies 4294990660 (age 28.050s)
hex dump (first 32 bytes):
40 7e c6 1a 81 88 ff ff c0 7d c6 1a 81 88 ff ff @~.......}......
50 7e c6 1a 81 88 ff ff d0 7d c6 1a 81 88 ff ff P~.......}......
backtrace:
[<0000000003c40121>] kmemleak_alloc_recursive
include/linux/kmemleak.h:43 [inline]
[<0000000003c40121>] slab_post_alloc_hook mm/slab.h:522 [inline]
[<0000000003c40121>] slab_alloc mm/slab.c:3319 [inline]
[<0000000003c40121>] kmem_cache_alloc_trace+0x145/0x2c0 mm/slab.c:3548
[<00000000bdd76485>] kmalloc include/linux/slab.h:552 [inline]
[<00000000bdd76485>] kzalloc include/linux/slab.h:748 [inline]
[<00000000bdd76485>] hci_inquiry_cache_update+0x138/0x2b0
net/bluetooth/hci_core.c:1183
[<000000000fa97823>] hci_inquiry_result_with_rssi_evt
net/bluetooth/hci_event.c:4079 [inline]
[<000000000fa97823>] hci_event_packet+0x1224/0x3453
net/bluetooth/hci_event.c:5952
[<0000000021923028>] hci_rx_work+0x1b6/0x2f0
net/bluetooth/hci_core.c:4462
[<00000000eb63bebf>] process_one_work+0x210/0x490
kernel/workqueue.c:2269
[<00000000873e1703>] worker_thread+0x56/0x4c0 kernel/workqueue.c:2415
[<00000000a3c26b57>] kthread+0x13e/0x160 kernel/kthread.c:255
[<00000000c66acc55>] ret_from_fork+0x1f/0x30
arch/x86/entry/entry_64.S:352
---
This bug is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzkaller@googlegroups.com.
syzbot will keep track of this bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches
^ permalink raw reply
* Re: [PATCH bpf-next] tools: libbpf: update extended attributes version of bpf_object__open()
From: Song Liu @ 2019-08-30 19:24 UTC (permalink / raw)
To: Anton Protopopov
Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
Yonghong Song, Networking, bpf, linux-kernel@vger.kernel.org
In-Reply-To: <CAGn_itwS=bLf8NGVNbByNx8FmR_JtPWnuEnKO23ig8xnK_GYOw@mail.gmail.com>
> On Aug 30, 2019, at 11:53 AM, Anton Protopopov <a.s.protopopov@gmail.com> wrote:
>
> чт, 29 авг. 2019 г. в 16:02, Song Liu <songliubraving@fb.com>:
>>
>>
>>
>>> On Aug 14, 2019, at 5:03 PM, Anton Protopopov <a.s.protopopov@gmail.com> wrote:
>>>
>>
>> [...]
>>
>>>
>>>
>>> int bpf_object__unload(struct bpf_object *obj)
>>> diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
>>> index e8f70977d137..634f278578dd 100644
>>> --- a/tools/lib/bpf/libbpf.h
>>> +++ b/tools/lib/bpf/libbpf.h
>>> @@ -63,8 +63,13 @@ LIBBPF_API libbpf_print_fn_t libbpf_set_print(libbpf_print_fn_t fn);
>>> struct bpf_object;
>>>
>>> struct bpf_object_open_attr {
>>> - const char *file;
>>> + union {
>>> + const char *file;
>>> + const char *obj_name;
>>> + };
>>> enum bpf_prog_type prog_type;
>>> + void *obj_buf;
>>> + size_t obj_buf_sz;
>>> };
>>
>> I think this would break dynamically linked libbpf. No?
>
> Ah, yes, sure. What is the right way to make changes which break ABI in libbpf?
I don't have a good idea here on the top of my head.
Maybe we need a new struct and/or function for this.
>
> BTW, does the commit ddc7c3042614 ("libbpf: implement BPF CO-RE offset
> relocation algorithm") which adds a new field to the struct
> bpf_object_load_attr also break ABI?
I think this change was in the same release, so it is OK.
Thanks,
Song
^ permalink raw reply
* [PATCH][next] zd1211rw: zd_usb: Use struct_size() helper
From: Gustavo A. R. Silva @ 2019-08-30 18:57 UTC (permalink / raw)
To: Daniel Drake, Ulrich Kunitz, Kalle Valo, David S. Miller
Cc: linux-wireless, netdev, linux-kernel, Gustavo A. R. Silva
One of the more common cases of allocation size calculations is finding
the size of a structure that has a zero-sized array at the end, along
with memory for some number of elements for that array. For example:
struct usb_int_regs {
...
struct reg_data regs[0];
} __packed;
Make use of the struct_size() helper instead of an open-coded version
in order to avoid any potential type mistakes.
So, replace the following function:
static int usb_int_regs_length(unsigned int count)
{
return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
}
with:
struct_size(regs, regs, count)
This code was detected with the help of Coccinelle.
Signed-off-by: Gustavo A. R. Silva <gustavo@embeddedor.com>
---
drivers/net/wireless/zydas/zd1211rw/zd_usb.c | 11 +++--------
1 file changed, 3 insertions(+), 8 deletions(-)
diff --git a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
index 1965cd0fafc4..4e44ea8c652d 100644
--- a/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zydas/zd1211rw/zd_usb.c
@@ -1597,11 +1597,6 @@ static int zd_ep_regs_out_msg(struct usb_device *udev, void *data, int len,
}
}
-static int usb_int_regs_length(unsigned int count)
-{
- return sizeof(struct usb_int_regs) + count * sizeof(struct reg_data);
-}
-
static void prepare_read_regs_int(struct zd_usb *usb,
struct usb_req_read_regs *req,
unsigned int count)
@@ -1636,10 +1631,10 @@ static bool check_read_regs(struct zd_usb *usb, struct usb_req_read_regs *req,
/* The created block size seems to be larger than expected.
* However results appear to be correct.
*/
- if (rr->length < usb_int_regs_length(count)) {
+ if (rr->length < struct_size(regs, regs, count)) {
dev_dbg_f(zd_usb_dev(usb),
- "error: actual length %d less than expected %d\n",
- rr->length, usb_int_regs_length(count));
+ "error: actual length %d less than expected %ld\n",
+ rr->length, struct_size(regs, regs, count));
return false;
}
--
2.23.0
^ permalink raw reply related
* Re: [PATCH v6 net-next 04/19] ionic: Add port management commands
From: Shannon Nelson @ 2019-08-30 19:18 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829154613.4e2b479a@cakuba.netronome.com>
On 8/29/19 3:46 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:05 -0700, Shannon Nelson wrote:
>> The port management commands apply to the physical port
>> associated with the PCI device, which might be shared among
>> several logical interfaces.
>>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> ---
>> drivers/net/ethernet/pensando/ionic/ionic.h | 4 +
>> .../ethernet/pensando/ionic/ionic_bus_pci.c | 16 ++++
>> .../net/ethernet/pensando/ionic/ionic_dev.c | 92 +++++++++++++++++++
>> .../net/ethernet/pensando/ionic/ionic_dev.h | 13 +++
>> .../net/ethernet/pensando/ionic/ionic_main.c | 86 +++++++++++++++++
>> 5 files changed, 211 insertions(+)
>>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic.h b/drivers/net/ethernet/pensando/ionic/ionic.h
>> index 89ad9c590736..4960effd2bcc 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic.h
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic.h
>> @@ -42,4 +42,8 @@ int ionic_identify(struct ionic *ionic);
>> int ionic_init(struct ionic *ionic);
>> int ionic_reset(struct ionic *ionic);
>>
>> +int ionic_port_identify(struct ionic *ionic);
>> +int ionic_port_init(struct ionic *ionic);
>> +int ionic_port_reset(struct ionic *ionic);
>> +
>> #endif /* _IONIC_H_ */
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> index 286b4b450a73..804dd43e92a6 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_bus_pci.c
>> @@ -138,12 +138,27 @@ static int ionic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
>> goto err_out_teardown;
>> }
>>
>> + /* Configure the ports */
>> + err = ionic_port_identify(ionic);
>> + if (err) {
>> + dev_err(dev, "Cannot identify port: %d, aborting\n", err);
>> + goto err_out_reset;
>> + }
>> +
>> + err = ionic_port_init(ionic);
>> + if (err) {
>> + dev_err(dev, "Cannot init port: %d, aborting\n", err);
>> + goto err_out_reset;
>> + }
>> +
>> err = ionic_devlink_register(ionic);
>> if (err)
>> dev_err(dev, "Cannot register devlink: %d\n", err);
>>
>> return 0;
>>
>> +err_out_reset:
>> + ionic_reset(ionic);
>> err_out_teardown:
>> ionic_dev_teardown(ionic);
>> err_out_unmap_bars:
>> @@ -170,6 +185,7 @@ static void ionic_remove(struct pci_dev *pdev)
>> return;
>>
>> ionic_devlink_unregister(ionic);
>> + ionic_port_reset(ionic);
>> ionic_reset(ionic);
>> ionic_dev_teardown(ionic);
>> ionic_unmap_bars(ionic);
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.c b/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>> index 0bf1bd6bd7b1..3137776e9191 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.c
>> @@ -134,3 +134,95 @@ void ionic_dev_cmd_reset(struct ionic_dev *idev)
>>
>> ionic_dev_cmd_go(idev, &cmd);
>> }
>> +
>> +/* Port commands */
>> +void ionic_dev_cmd_port_identify(struct ionic_dev *idev)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_init.opcode = IONIC_CMD_PORT_IDENTIFY,
>> + .port_init.index = 0,
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_init(struct ionic_dev *idev)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_init.opcode = IONIC_CMD_PORT_INIT,
>> + .port_init.index = 0,
>> + .port_init.info_pa = cpu_to_le64(idev->port_info_pa),
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_reset(struct ionic_dev *idev)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_reset.opcode = IONIC_CMD_PORT_RESET,
>> + .port_reset.index = 0,
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_state(struct ionic_dev *idev, u8 state)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> + .port_setattr.index = 0,
>> + .port_setattr.attr = IONIC_PORT_ATTR_STATE,
>> + .port_setattr.state = state,
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_speed(struct ionic_dev *idev, u32 speed)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> + .port_setattr.index = 0,
>> + .port_setattr.attr = IONIC_PORT_ATTR_SPEED,
>> + .port_setattr.speed = cpu_to_le32(speed),
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_autoneg(struct ionic_dev *idev, u8 an_enable)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> + .port_setattr.index = 0,
>> + .port_setattr.attr = IONIC_PORT_ATTR_AUTONEG,
>> + .port_setattr.an_enable = an_enable,
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_fec(struct ionic_dev *idev, u8 fec_type)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> + .port_setattr.index = 0,
>> + .port_setattr.attr = IONIC_PORT_ATTR_FEC,
>> + .port_setattr.fec_type = fec_type,
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
>> +
>> +void ionic_dev_cmd_port_pause(struct ionic_dev *idev, u8 pause_type)
>> +{
>> + union ionic_dev_cmd cmd = {
>> + .port_setattr.opcode = IONIC_CMD_PORT_SETATTR,
>> + .port_setattr.index = 0,
>> + .port_setattr.attr = IONIC_PORT_ATTR_PAUSE,
>> + .port_setattr.pause_type = pause_type,
>> + };
>> +
>> + ionic_dev_cmd_go(idev, &cmd);
>> +}
> Hm. So you haven't moved those?
They make for a nice consistent bundle of service routines that get used
in a later patch in this patchset, and helps keep that other patch a
little leaner and perhaps easier to review.
>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_dev.h b/drivers/net/ethernet/pensando/ionic/ionic_dev.h
>> index 7050545a83aa..81b6910aabc1 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_dev.h
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_dev.h
>> @@ -117,6 +117,10 @@ struct ionic_dev {
>> struct ionic_intr __iomem *intr_ctrl;
>> u64 __iomem *intr_status;
>>
>> + u32 port_info_sz;
>> + struct ionic_port_info *port_info;
>> + dma_addr_t port_info_pa;
>> +
>> struct ionic_devinfo dev_info;
>> };
>>
>> @@ -135,4 +139,13 @@ void ionic_dev_cmd_identify(struct ionic_dev *idev, u8 ver);
>> void ionic_dev_cmd_init(struct ionic_dev *idev);
>> void ionic_dev_cmd_reset(struct ionic_dev *idev);
>>
>> +void ionic_dev_cmd_port_identify(struct ionic_dev *idev);
>> +void ionic_dev_cmd_port_init(struct ionic_dev *idev);
>> +void ionic_dev_cmd_port_reset(struct ionic_dev *idev);
>> +void ionic_dev_cmd_port_state(struct ionic_dev *idev, u8 state);
>> +void ionic_dev_cmd_port_speed(struct ionic_dev *idev, u32 speed);
>> +void ionic_dev_cmd_port_autoneg(struct ionic_dev *idev, u8 an_enable);
>> +void ionic_dev_cmd_port_fec(struct ionic_dev *idev, u8 fec_type);
>> +void ionic_dev_cmd_port_pause(struct ionic_dev *idev, u8 pause_type);
>> +
>> #endif /* _IONIC_DEV_H_ */
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_main.c b/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> index 5c311b9241ee..96de2789587d 100644
>> --- a/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_main.c
>> @@ -317,6 +317,92 @@ int ionic_reset(struct ionic *ionic)
>> return err;
>> }
>>
>> +int ionic_port_identify(struct ionic *ionic)
>> +{
>> + struct ionic_identity *ident = &ionic->ident;
>> + struct ionic_dev *idev = &ionic->idev;
>> + size_t sz;
>> + int err;
>> +
>> + mutex_lock(&ionic->dev_cmd_lock);
>> +
>> + ionic_dev_cmd_port_identify(idev);
>> + err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
>> + if (!err) {
>> + sz = min(sizeof(ident->port), sizeof(idev->dev_cmd_regs->data));
>> + memcpy_fromio(&ident->port, &idev->dev_cmd_regs->data, sz);
>> + }
>> +
>> + mutex_unlock(&ionic->dev_cmd_lock);
>> +
>> + return err;
>> +}
>> +
>> +int ionic_port_init(struct ionic *ionic)
>> +{
>> + struct ionic_identity *ident = &ionic->ident;
>> + struct ionic_dev *idev = &ionic->idev;
>> + size_t sz;
>> + int err;
>> +
>> + if (idev->port_info)
>> + return 0;
>> +
>> + idev->port_info_sz = ALIGN(sizeof(*idev->port_info), PAGE_SIZE);
>> + idev->port_info = dma_alloc_coherent(ionic->dev, idev->port_info_sz,
>> + &idev->port_info_pa,
>> + GFP_KERNEL);
>> + if (!idev->port_info) {
>> + dev_err(ionic->dev, "Failed to allocate port info, aborting\n");
>> + return -ENOMEM;
>> + }
>> +
>> + sz = min(sizeof(ident->port.config), sizeof(idev->dev_cmd_regs->data));
>> +
>> + mutex_lock(&ionic->dev_cmd_lock);
>> +
>> + memcpy_toio(&idev->dev_cmd_regs->data, &ident->port.config, sz);
>> + ionic_dev_cmd_port_init(idev);
>> + err = ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
>> +
>> + ionic_dev_cmd_port_state(&ionic->idev, IONIC_PORT_ADMIN_STATE_UP);
>> + (void)ionic_dev_cmd_wait(ionic, DEVCMD_TIMEOUT);
>> +
>> + mutex_unlock(&ionic->dev_cmd_lock);
>> + if (err) {
>> + dev_err(ionic->dev, "Failed to init port\n");
>> + dma_free_coherent(ionic->dev, idev->port_info_sz,
>> + idev->port_info, idev->port_info_pa);
> idev->port_info = NULL;
Yep
Thanks,
sln
^ permalink raw reply
* Re: [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: Cong Wang @ 2019-08-30 19:11 UTC (permalink / raw)
To: David Dai
Cc: Jamal Hadi Salim, Jiri Pirko, David Miller,
Linux Kernel Network Developers, LKML, zdai
In-Reply-To: <1567191974-11578-1-git-send-email-zdai@linux.vnet.ibm.com>
On Fri, Aug 30, 2019 at 12:06 PM David Dai <zdai@linux.vnet.ibm.com> wrote:
> - if (p->peak_present)
> + if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
> + nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
> + police->params->rate.rate_bytes_ps,
> + __TCA_POLICE_MAX))
I think the last parameter should be TCA_POLICE_PAD.
^ permalink raw reply
* [v2] iproute2-next: police: support 64bit rate and peakrate in tc utility
From: David Dai @ 2019-08-30 19:07 UTC (permalink / raw)
To: jhs, xiyou.wangcong, jiri, netdev, linux-kernel; +Cc: zdai, zdai
For high speed adapter like Mellanox CX-5 card, it can reach upto
100 Gbits per second bandwidth. Currently htb already supports 64bit rate
in tc utility. However police action rate and peakrate are still limited
to 32bit value (upto 32 Gbits per second). Taking advantage of the 2 new
attributes TCA_POLICE_RATE64 and TCA_POLICE_PEAKRATE64 from kernel,
tc can use them to break the 32bit limit, and still keep the backward
binary compatibility.
Tested-by: David Dai <zdai@linux.vnet.ibm.com>
Signed-off-by: David Dai <zdai@linux.vnet.ibm.com>
---
Changelog:
v1->v2:
- Change patch submit component from iproute2 to iproute2-next
- Move 2 attributes TCA_POLICE_RATE64 TCA_POLICE_PEAKRATE64 after
TCA_POLICE_PAD in pkt_cls.h header to be consistent with kernel's
pkt_cls.h header.
---
include/uapi/linux/pkt_cls.h | 2 +
tc/m_police.c | 64 +++++++++++++++++++++++++++--------------
tc/tc_core.c | 29 +++++++++++++++++++
tc/tc_core.h | 3 ++
4 files changed, 76 insertions(+), 22 deletions(-)
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index b057aee..a6aa466 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -160,6 +160,8 @@ enum {
TCA_POLICE_RESULT,
TCA_POLICE_TM,
TCA_POLICE_PAD,
+ TCA_POLICE_RATE64,
+ TCA_POLICE_PEAKRATE64,
__TCA_POLICE_MAX
#define TCA_POLICE_RESULT TCA_POLICE_RESULT
};
diff --git a/tc/m_police.c b/tc/m_police.c
index 862a39f..db913f4 100644
--- a/tc/m_police.c
+++ b/tc/m_police.c
@@ -71,6 +71,7 @@ static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
unsigned int linklayer = LINKLAYER_ETHERNET; /* Assume ethernet */
int Rcell_log = -1, Pcell_log = -1;
struct rtattr *tail;
+ __u64 rate64 = 0, prate64 = 0;
if (a) /* new way of doing things */
NEXT_ARG();
@@ -121,11 +122,11 @@ static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
}
} else if (strcmp(*argv, "rate") == 0) {
NEXT_ARG();
- if (p.rate.rate) {
+ if (rate64) {
fprintf(stderr, "Double \"rate\" spec\n");
return -1;
}
- if (get_rate(&p.rate.rate, *argv)) {
+ if (get_rate64(&rate64, *argv)) {
explain1("rate");
return -1;
}
@@ -141,11 +142,11 @@ static int act_parse_police(struct action_util *a, int *argc_p, char ***argv_p,
}
} else if (matches(*argv, "peakrate") == 0) {
NEXT_ARG();
- if (p.peakrate.rate) {
+ if (prate64) {
fprintf(stderr, "Double \"peakrate\" spec\n");
return -1;
}
- if (get_rate(&p.peakrate.rate, *argv)) {
+ if (get_rate64(&prate64, *argv)) {
explain1("peakrate");
return -1;
}
@@ -189,23 +190,23 @@ action_ctrl_ok:
if (!ok)
return -1;
- if (p.rate.rate && avrate)
+ if (rate64 && avrate)
return -1;
/* Must at least do late binding, use TB or ewma policing */
- if (!p.rate.rate && !avrate && !p.index) {
+ if (!rate64 && !avrate && !p.index) {
fprintf(stderr, "\"rate\" or \"avrate\" MUST be specified.\n");
return -1;
}
/* When the TB policer is used, burst is required */
- if (p.rate.rate && !buffer && !avrate) {
+ if (rate64 && !buffer && !avrate) {
fprintf(stderr, "\"burst\" requires \"rate\".\n");
return -1;
}
- if (p.peakrate.rate) {
- if (!p.rate.rate) {
+ if (prate64) {
+ if (!rate64) {
fprintf(stderr, "\"peakrate\" requires \"rate\".\n");
return -1;
}
@@ -215,22 +216,24 @@ action_ctrl_ok:
}
}
- if (p.rate.rate) {
+ if (rate64) {
+ p.rate.rate = (rate64 >= (1ULL << 32)) ? ~0U : rate64;
p.rate.mpu = mpu;
p.rate.overhead = overhead;
- if (tc_calc_rtable(&p.rate, rtab, Rcell_log, mtu,
- linklayer) < 0) {
+ if (tc_calc_rtable_64(&p.rate, rtab, Rcell_log, mtu,
+ linklayer, rate64) < 0) {
fprintf(stderr, "POLICE: failed to calculate rate table.\n");
return -1;
}
- p.burst = tc_calc_xmittime(p.rate.rate, buffer);
+ p.burst = tc_calc_xmittime(rate64, buffer);
}
p.mtu = mtu;
- if (p.peakrate.rate) {
+ if (prate64) {
+ p.peakrate.rate = (prate64 >= (1ULL << 32)) ? ~0U : prate64;
p.peakrate.mpu = mpu;
p.peakrate.overhead = overhead;
- if (tc_calc_rtable(&p.peakrate, ptab, Pcell_log, mtu,
- linklayer) < 0) {
+ if (tc_calc_rtable_64(&p.peakrate, ptab, Pcell_log, mtu,
+ linklayer, prate64) < 0) {
fprintf(stderr, "POLICE: failed to calculate peak rate table.\n");
return -1;
}
@@ -238,10 +241,16 @@ action_ctrl_ok:
tail = addattr_nest(n, MAX_MSG, tca_id);
addattr_l(n, MAX_MSG, TCA_POLICE_TBF, &p, sizeof(p));
- if (p.rate.rate)
+ if (rate64) {
addattr_l(n, MAX_MSG, TCA_POLICE_RATE, rtab, 1024);
- if (p.peakrate.rate)
+ if (rate64 >= (1ULL << 32))
+ addattr64(n, MAX_MSG, TCA_POLICE_RATE64, rate64);
+ }
+ if (prate64) {
addattr_l(n, MAX_MSG, TCA_POLICE_PEAKRATE, ptab, 1024);
+ if (prate64 >= (1ULL << 32))
+ addattr64(n, MAX_MSG, TCA_POLICE_PEAKRATE64, prate64);
+ }
if (avrate)
addattr32(n, MAX_MSG, TCA_POLICE_AVRATE, avrate);
if (presult)
@@ -268,6 +277,7 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
struct rtattr *tb[TCA_POLICE_MAX+1];
unsigned int buffer;
unsigned int linklayer;
+ __u64 rate64, prate64;
if (arg == NULL)
return 0;
@@ -286,16 +296,26 @@ static int print_police(struct action_util *a, FILE *f, struct rtattr *arg)
#endif
p = RTA_DATA(tb[TCA_POLICE_TBF]);
+ rate64 = p->rate.rate;
+ if (tb[TCA_POLICE_RATE64] &&
+ RTA_PAYLOAD(tb[TCA_POLICE_RATE64]) >= sizeof(rate64))
+ rate64 = rta_getattr_u64(tb[TCA_POLICE_RATE64]);
+
fprintf(f, " police 0x%x ", p->index);
- fprintf(f, "rate %s ", sprint_rate(p->rate.rate, b1));
- buffer = tc_calc_xmitsize(p->rate.rate, p->burst);
+ fprintf(f, "rate %s ", sprint_rate(rate64, b1));
+ buffer = tc_calc_xmitsize(rate64, p->burst);
fprintf(f, "burst %s ", sprint_size(buffer, b1));
fprintf(f, "mtu %s ", sprint_size(p->mtu, b1));
if (show_raw)
fprintf(f, "[%08x] ", p->burst);
- if (p->peakrate.rate)
- fprintf(f, "peakrate %s ", sprint_rate(p->peakrate.rate, b1));
+ prate64 = p->peakrate.rate;
+ if (tb[TCA_POLICE_PEAKRATE64] &&
+ RTA_PAYLOAD(tb[TCA_POLICE_PEAKRATE64]) >= sizeof(prate64))
+ prate64 = rta_getattr_u64(tb[TCA_POLICE_PEAKRATE64]);
+
+ if (prate64)
+ fprintf(f, "peakrate %s ", sprint_rate(prate64, b1));
if (tb[TCA_POLICE_AVRATE])
fprintf(f, "avrate %s ",
diff --git a/tc/tc_core.c b/tc/tc_core.c
index 8eb1122..498d35d 100644
--- a/tc/tc_core.c
+++ b/tc/tc_core.c
@@ -152,6 +152,35 @@ int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab,
return cell_log;
}
+int tc_calc_rtable_64(struct tc_ratespec *r, __u32 *rtab,
+ int cell_log, unsigned int mtu,
+ enum link_layer linklayer, __u64 rate)
+{
+ int i;
+ unsigned int sz;
+ __u64 bps = rate;
+ unsigned int mpu = r->mpu;
+
+ if (mtu == 0)
+ mtu = 2047;
+
+ if (cell_log < 0) {
+ cell_log = 0;
+ while ((mtu >> cell_log) > 255)
+ cell_log++;
+ }
+
+ for (i = 0; i < 256; i++) {
+ sz = tc_adjust_size((i + 1) << cell_log, mpu, linklayer);
+ rtab[i] = tc_calc_xmittime(bps, sz);
+ }
+
+ r->cell_align = -1;
+ r->cell_log = cell_log;
+ r->linklayer = (linklayer & TC_LINKLAYER_MASK);
+ return cell_log;
+}
+
/*
stab[pkt_len>>cell_log] = pkt_xmit_size>>size_log
*/
diff --git a/tc/tc_core.h b/tc/tc_core.h
index bd4a99f..6dab272 100644
--- a/tc/tc_core.h
+++ b/tc/tc_core.h
@@ -21,6 +21,9 @@ unsigned tc_calc_xmittime(__u64 rate, unsigned size);
unsigned tc_calc_xmitsize(__u64 rate, unsigned ticks);
int tc_calc_rtable(struct tc_ratespec *r, __u32 *rtab,
int cell_log, unsigned mtu, enum link_layer link_layer);
+int tc_calc_rtable_64(struct tc_ratespec *r, __u32 *rtab,
+ int cell_log, unsigned mtu, enum link_layer link_layer,
+ __u64 rate);
int tc_calc_size_table(struct tc_sizespec *s, __u16 **stab);
int tc_setup_estimator(unsigned A, unsigned time_const, struct tc_estimator *est);
--
1.7.1
^ permalink raw reply related
* [v2] net_sched: act_police: add 2 new attributes to support police 64bit rate and peakrate
From: David Dai @ 2019-08-30 19:06 UTC (permalink / raw)
To: jhs, xiyou.wangcong, jiri, davem, netdev, linux-kernel; +Cc: zdai, zdai
For high speed adapter like Mellanox CX-5 card, it can reach upto
100 Gbits per second bandwidth. Currently htb already supports 64bit rate
in tc utility. However police action rate and peakrate are still limited
to 32bit value (upto 32 Gbits per second). Add 2 new attributes
TCA_POLICE_RATE64 and TCA_POLICE_RATE64 in kernel for 64bit support
so that tc utility can use them for 64bit rate and peakrate value to
break the 32bit limit, and still keep the backward binary compatibility.
Tested-by: David Dai <zdai@linux.vnet.ibm.com>
Signed-off-by: David Dai <zdai@linux.vnet.ibm.com>
---
Changelog:
v1->v2:
- Move 2 attributes TCA_POLICE_RATE64 TCA_POLICE_PEAKRATE64 after
TCA_POLICE_PAD in pkt_cls.h header.
---
include/uapi/linux/pkt_cls.h | 2 ++
net/sched/act_police.c | 27 +++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/include/uapi/linux/pkt_cls.h b/include/uapi/linux/pkt_cls.h
index b057aee..a6aa466 100644
--- a/include/uapi/linux/pkt_cls.h
+++ b/include/uapi/linux/pkt_cls.h
@@ -160,6 +160,8 @@ enum {
TCA_POLICE_RESULT,
TCA_POLICE_TM,
TCA_POLICE_PAD,
+ TCA_POLICE_RATE64,
+ TCA_POLICE_PEAKRATE64,
__TCA_POLICE_MAX
#define TCA_POLICE_RESULT TCA_POLICE_RESULT
};
diff --git a/net/sched/act_police.c b/net/sched/act_police.c
index 49cec3e..425f2a3 100644
--- a/net/sched/act_police.c
+++ b/net/sched/act_police.c
@@ -40,6 +40,8 @@ static int tcf_police_walker(struct net *net, struct sk_buff *skb,
[TCA_POLICE_PEAKRATE] = { .len = TC_RTAB_SIZE },
[TCA_POLICE_AVRATE] = { .type = NLA_U32 },
[TCA_POLICE_RESULT] = { .type = NLA_U32 },
+ [TCA_POLICE_RATE64] = { .type = NLA_U64 },
+ [TCA_POLICE_PEAKRATE64] = { .type = NLA_U64 },
};
static int tcf_police_init(struct net *net, struct nlattr *nla,
@@ -58,6 +60,7 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
struct tcf_police_params *new;
bool exists = false;
u32 index;
+ u64 rate64, prate64;
if (nla == NULL)
return -EINVAL;
@@ -155,14 +158,18 @@ static int tcf_police_init(struct net *net, struct nlattr *nla,
}
if (R_tab) {
new->rate_present = true;
- psched_ratecfg_precompute(&new->rate, &R_tab->rate, 0);
+ rate64 = tb[TCA_POLICE_RATE64] ?
+ nla_get_u64(tb[TCA_POLICE_RATE64]) : 0;
+ psched_ratecfg_precompute(&new->rate, &R_tab->rate, rate64);
qdisc_put_rtab(R_tab);
} else {
new->rate_present = false;
}
if (P_tab) {
new->peak_present = true;
- psched_ratecfg_precompute(&new->peak, &P_tab->rate, 0);
+ prate64 = tb[TCA_POLICE_PEAKRATE64] ?
+ nla_get_u64(tb[TCA_POLICE_PEAKRATE64]) : 0;
+ psched_ratecfg_precompute(&new->peak, &P_tab->rate, prate64);
qdisc_put_rtab(P_tab);
} else {
new->peak_present = false;
@@ -313,10 +320,22 @@ static int tcf_police_dump(struct sk_buff *skb, struct tc_action *a,
lockdep_is_held(&police->tcf_lock));
opt.mtu = p->tcfp_mtu;
opt.burst = PSCHED_NS2TICKS(p->tcfp_burst);
- if (p->rate_present)
+ if (p->rate_present) {
psched_ratecfg_getrate(&opt.rate, &p->rate);
- if (p->peak_present)
+ if ((police->params->rate.rate_bytes_ps >= (1ULL << 32)) &&
+ nla_put_u64_64bit(skb, TCA_POLICE_RATE64,
+ police->params->rate.rate_bytes_ps,
+ __TCA_POLICE_MAX))
+ goto nla_put_failure;
+ }
+ if (p->peak_present) {
psched_ratecfg_getrate(&opt.peakrate, &p->peak);
+ if ((police->params->peak.rate_bytes_ps >= (1ULL << 32)) &&
+ nla_put_u64_64bit(skb, TCA_POLICE_PEAKRATE64,
+ police->params->peak.rate_bytes_ps,
+ __TCA_POLICE_MAX))
+ goto nla_put_failure;
+ }
if (nla_put(skb, TCA_POLICE_TBF, sizeof(opt), &opt))
goto nla_put_failure;
if (p->tcfp_result &&
--
1.7.1
^ permalink raw reply related
* Re: [PATCH v6 net-next 02/19] ionic: Add basic framework for IONIC Network device driver
From: Shannon Nelson @ 2019-08-30 19:02 UTC (permalink / raw)
To: Jakub Kicinski; +Cc: netdev, davem
In-Reply-To: <20190829153825.396efbf5@cakuba.netronome.com>
On 8/29/19 3:38 PM, Jakub Kicinski wrote:
> On Thu, 29 Aug 2019 11:27:03 -0700, Shannon Nelson wrote:
>> This patch adds a basic driver framework for the Pensando IONIC
>> network device. There is no functionality right now other than
>> the ability to load and unload.
>>
>> Signed-off-by: Shannon Nelson <snelson@pensando.io>
>> diff --git a/drivers/net/ethernet/pensando/ionic/ionic_devlink.c b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
>> new file mode 100644
>> index 000000000000..6892409cd64b
>> --- /dev/null
>> +++ b/drivers/net/ethernet/pensando/ionic/ionic_devlink.c
>> @@ -0,0 +1,44 @@
>> +// SPDX-License-Identifier: GPL-2.0
>> +/* Copyright(c) 2017 - 2019 Pensando Systems, Inc */
>> +
>> +#include <linux/module.h>
>> +#include <linux/netdevice.h>
>> +
>> +#include "ionic.h"
>> +#include "ionic_bus.h"
>> +#include "ionic_devlink.h"
>> +
>> +static int ionic_dl_info_get(struct devlink *dl, struct devlink_info_req *req,
>> + struct netlink_ext_ack *extack)
>> +{
>> + devlink_info_driver_name_put(req, IONIC_DRV_NAME);
> This may fail, should the error not be propagated?
Will fix
>
>> + return 0;
>> +}
>> +
>> +static const struct devlink_ops ionic_dl_ops = {
>> + .info_get = ionic_dl_info_get,
>> +};
>> +
>> +struct ionic *ionic_devlink_alloc(struct device *dev)
>> +{
>> + struct ionic *ionic;
>> + struct devlink *dl;
>> +
>> + dl = devlink_alloc(&ionic_dl_ops, sizeof(struct ionic));
>> + if (!dl) {
>> + dev_warn(dev, "devlink_alloc failed");
> missing new line at the end of warning, but the warning is unnecessary,
> if memory allocation fails kernel will generate a big OOM splat, anyway
yep
>
>> + return NULL;
>> + }
>> +
>> + ionic = devlink_priv(dl);
>> +
>> + return ionic;
> return devlink_priv(dl);
yep
Thanks,
sln
>
>> +}
>> +
>> +void ionic_devlink_free(struct ionic *ionic)
>> +{
>> + struct devlink *dl = priv_to_devlink(ionic);
>> +
>> + devlink_free(dl);
>> +}
^ permalink raw reply
* Re: [PATCH bpf-next] tools: libbpf: update extended attributes version of bpf_object__open()
From: Anton Protopopov @ 2019-08-30 18:53 UTC (permalink / raw)
To: Song Liu
Cc: Andrii Nakryiko, Alexei Starovoitov, Daniel Borkmann, Martin Lau,
Yonghong Song, Networking, bpf, linux-kernel@vger.kernel.org
In-Reply-To: <796E4DA8-4844-4708-866E-A8AE9477E94E@fb.com>
чт, 29 авг. 2019 г. в 16:02, Song Liu <songliubraving@fb.com>:
>
>
>
> > On Aug 14, 2019, at 5:03 PM, Anton Protopopov <a.s.protopopov@gmail.com> wrote:
> >
>
> [...]
>
> >
> >
> > int bpf_object__unload(struct bpf_object *obj)
> > diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
> > index e8f70977d137..634f278578dd 100644
> > --- a/tools/lib/bpf/libbpf.h
> > +++ b/tools/lib/bpf/libbpf.h
> > @@ -63,8 +63,13 @@ LIBBPF_API libbpf_print_fn_t libbpf_set_print(libbpf_print_fn_t fn);
> > struct bpf_object;
> >
> > struct bpf_object_open_attr {
> > - const char *file;
> > + union {
> > + const char *file;
> > + const char *obj_name;
> > + };
> > enum bpf_prog_type prog_type;
> > + void *obj_buf;
> > + size_t obj_buf_sz;
> > };
>
> I think this would break dynamically linked libbpf. No?
Ah, yes, sure. What is the right way to make changes which break ABI in libbpf?
BTW, does the commit ddc7c3042614 ("libbpf: implement BPF CO-RE offset
relocation algorithm") which adds a new field to the struct
bpf_object_load_attr also break ABI?
>
> Thanks,
> Song
>
^ permalink raw reply
* Re: [PATCH] net: bcmgenet: use ethtool_op_get_ts_info()
From: Florian Fainelli @ 2019-08-30 18:51 UTC (permalink / raw)
To: Ryan M. Collins, Doug Berger, David S. Miller
Cc: bcm-kernel-feedback-list, netdev, linux-kernel
In-Reply-To: <20190830184955.GA27521@pop-os.localdomain>
On 8/30/19 11:49 AM, Ryan M. Collins wrote:
> This change enables the use of SW timestamping on the Raspberry Pi 4.
Finally the first bcmgenet patch that was tested on the Pi 4!
>
> bcmgenet's transmit function bcmgenet_xmit() implements software
> timestamping. However the SOF_TIMESTAMPING_TX_SOFTWARE capability was
> missing and only SOF_TIMESTAMPING_RX_SOFTWARE was announced. By using
> ethtool_ops bcmgenet_ethtool_ops() as get_ts_info(), the
> SOF_TIMESTAMPING_TX_SOFTWARE capability is announced.
>
> Similar to commit a8f5cb9e7991 ("smsc95xx: use ethtool_op_get_ts_info()")
>
> Signed-off-by: Ryan M. Collins <rmc032@bucknell.edu>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
--
Florian
^ permalink raw reply
* [PATCH] net: bcmgenet: use ethtool_op_get_ts_info()
From: Ryan M. Collins @ 2019-08-30 18:49 UTC (permalink / raw)
To: Doug Berger, Florian Fainelli, David S. Miller
Cc: bcm-kernel-feedback-list, netdev, linux-kernel
This change enables the use of SW timestamping on the Raspberry Pi 4.
bcmgenet's transmit function bcmgenet_xmit() implements software
timestamping. However the SOF_TIMESTAMPING_TX_SOFTWARE capability was
missing and only SOF_TIMESTAMPING_RX_SOFTWARE was announced. By using
ethtool_ops bcmgenet_ethtool_ops() as get_ts_info(), the
SOF_TIMESTAMPING_TX_SOFTWARE capability is announced.
Similar to commit a8f5cb9e7991 ("smsc95xx: use ethtool_op_get_ts_info()")
Signed-off-by: Ryan M. Collins <rmc032@bucknell.edu>
---
drivers/net/ethernet/broadcom/genet/bcmgenet.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/drivers/net/ethernet/broadcom/genet/bcmgenet.c b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
index 1586316eb6f1..12cb77ef1081 100644
--- a/drivers/net/ethernet/broadcom/genet/bcmgenet.c
+++ b/drivers/net/ethernet/broadcom/genet/bcmgenet.c
@@ -1124,6 +1124,7 @@ static const struct ethtool_ops bcmgenet_ethtool_ops = {
.set_coalesce = bcmgenet_set_coalesce,
.get_link_ksettings = bcmgenet_get_link_ksettings,
.set_link_ksettings = bcmgenet_set_link_ksettings,
+ .get_ts_info = ethtool_op_get_ts_info,
};
/* Power down the unimac, based on mode. */
--
2.23.0
^ permalink raw reply related
* Re: [PATCH v2 1/1] netfilter: nf_tables: fib: Drop IPV6 packages if IPv6 is disabled on boot
From: Leonardo Bras @ 2019-08-30 18:16 UTC (permalink / raw)
To: Florian Westphal
Cc: Pablo Neira Ayuso, David S. Miller, netfilter-devel, coreteam,
netdev, linux-kernel, Jozsef Kadlecsik, Alexey Kuznetsov,
Hideaki YOSHIFUJI
In-Reply-To: <20190829205832.GM20113@breakpoint.cc>
[-- Attachment #1: Type: text/plain, Size: 293 bytes --]
On Thu, 2019-08-29 at 22:58 +0200, Florian Westphal wrote:
> Ah, it was the latter.
> Making bridge netfilter not pass packets up with ipv6 off closes
> the problem for fib_ipv6 and inet, so only _netdev.c needs fixing.
Ok then, preparing a v4.
https://lkml.org/lkml/2019/8/30/843
[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply
* [PATCH net] net: Properly update v4 routes with v6 nexthop
From: Donald Sharp @ 2019-08-30 18:14 UTC (permalink / raw)
To: netdev, dsahern, sworley
When creating a v4 route that uses a v6 nexthop from a nexthop group.
Allow the kernel to properly send the nexthop as v6 via the RTA_VIA
attribute.
Broken behavior:
$ ip nexthop add via fe80::9 dev eth0
$ ip nexthop show
id 1 via fe80::9 dev eth0 scope link
$ ip route add 4.5.6.7/32 nhid 1
$ ip route show
default via 10.0.2.2 dev eth0
4.5.6.7 nhid 1 via 254.128.0.0 dev eth0
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
$
Fixed behavior:
$ ip nexthop add via fe80::9 dev eth0
$ ip nexthop show
id 1 via fe80::9 dev eth0 scope link
$ ip route add 4.5.6.7/32 nhid 1
$ ip route show
default via 10.0.2.2 dev eth0
4.5.6.7 nhid 1 via inet6 fe80::9 dev eth0
10.0.2.0/24 dev eth0 proto kernel scope link src 10.0.2.15
$
Fixes: dcb1ecb50edf (“ipv4: Prepare for fib6_nh from a nexthop object”)
Signed-off-by: Donald Sharp <sharpd@cumulusnetworks.com>
---
include/net/ip_fib.h | 4 ++--
include/net/nexthop.h | 2 +-
net/ipv4/fib_semantics.c | 21 ++++++++++++---------
net/ipv6/route.c | 9 +++++----
4 files changed, 20 insertions(+), 16 deletions(-)
diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h
index 4c81846ccce8..c7e94edae482 100644
--- a/include/net/ip_fib.h
+++ b/include/net/ip_fib.h
@@ -513,7 +513,7 @@ int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
struct netlink_callback *cb);
int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nh,
- unsigned char *flags, bool skip_oif);
+ u8 family, unsigned char *flags, bool skip_oif);
int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nh,
- int nh_weight);
+ int nh_weight, u8 family);
#endif /* _NET_FIB_H */
diff --git a/include/net/nexthop.h b/include/net/nexthop.h
index 95f766c31c90..f13c61806abf 100644
--- a/include/net/nexthop.h
+++ b/include/net/nexthop.h
@@ -172,7 +172,7 @@ int nexthop_mpath_fill_node(struct sk_buff *skb, struct nexthop *nh)
struct fib_nh_common *nhc = &nhi->fib_nhc;
int weight = nhg->nh_entries[i].weight;
- if (fib_add_nexthop(skb, nhc, weight) < 0)
+ if (fib_add_nexthop(skb, nhc, weight, nhc->nhc_family) < 0)
return -EMSGSIZE;
}
diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c
index 2db089e10ba0..e4417d171863 100644
--- a/net/ipv4/fib_semantics.c
+++ b/net/ipv4/fib_semantics.c
@@ -1582,7 +1582,7 @@ struct fib_info *fib_create_info(struct fib_config *cfg,
}
int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
- unsigned char *flags, bool skip_oif)
+ u8 family, unsigned char *flags, bool skip_oif)
{
if (nhc->nhc_flags & RTNH_F_DEAD)
*flags |= RTNH_F_DEAD;
@@ -1613,7 +1613,7 @@ int fib_nexthop_info(struct sk_buff *skb, const struct fib_nh_common *nhc,
/* if gateway family does not match nexthop family
* gateway is encoded as RTA_VIA
*/
- if (nhc->nhc_gw_family != nhc->nhc_family) {
+ if (family != nhc->nhc_gw_family) {
int alen = sizeof(struct in6_addr);
struct nlattr *nla;
struct rtvia *via;
@@ -1654,7 +1654,7 @@ EXPORT_SYMBOL_GPL(fib_nexthop_info);
#if IS_ENABLED(CONFIG_IP_ROUTE_MULTIPATH) || IS_ENABLED(CONFIG_IPV6)
int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
- int nh_weight)
+ int nh_weight, u8 family)
{
const struct net_device *dev = nhc->nhc_dev;
struct rtnexthop *rtnh;
@@ -1667,7 +1667,7 @@ int fib_add_nexthop(struct sk_buff *skb, const struct fib_nh_common *nhc,
rtnh->rtnh_hops = nh_weight - 1;
rtnh->rtnh_ifindex = dev ? dev->ifindex : 0;
- if (fib_nexthop_info(skb, nhc, &flags, true) < 0)
+ if (fib_nexthop_info(skb, nhc, family, &flags, true) < 0)
goto nla_put_failure;
rtnh->rtnh_flags = flags;
@@ -1684,7 +1684,8 @@ EXPORT_SYMBOL_GPL(fib_add_nexthop);
#endif
#ifdef CONFIG_IP_ROUTE_MULTIPATH
-static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
+static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi,
+ u8 family)
{
struct nlattr *mp;
@@ -1699,7 +1700,8 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
}
for_nexthops(fi) {
- if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight) < 0)
+ if (fib_add_nexthop(skb, &nh->nh_common, nh->fib_nh_weight,
+ family) < 0)
goto nla_put_failure;
#ifdef CONFIG_IP_ROUTE_CLASSID
if (nh->nh_tclassid &&
@@ -1717,7 +1719,8 @@ static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
return -EMSGSIZE;
}
#else
-static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi)
+static int fib_add_multipath(struct sk_buff *skb, struct fib_info *fi,
+ u8 family)
{
return 0;
}
@@ -1775,7 +1778,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
const struct fib_nh_common *nhc = fib_info_nhc(fi, 0);
unsigned char flags = 0;
- if (fib_nexthop_info(skb, nhc, &flags, false) < 0)
+ if (fib_nexthop_info(skb, nhc, AF_INET, &flags, false) < 0)
goto nla_put_failure;
rtm->rtm_flags = flags;
@@ -1790,7 +1793,7 @@ int fib_dump_info(struct sk_buff *skb, u32 portid, u32 seq, int event,
}
#endif
} else {
- if (fib_add_multipath(skb, fi) < 0)
+ if (fib_add_multipath(skb, fi, AF_INET) < 0)
goto nla_put_failure;
}
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index fd059e08785a..d91dd8d832cd 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -5337,7 +5337,7 @@ static int rt6_fill_node_nexthop(struct sk_buff *skb, struct nexthop *nh,
struct fib6_nh *fib6_nh;
fib6_nh = nexthop_fib6_nh(nh);
- if (fib_nexthop_info(skb, &fib6_nh->nh_common,
+ if (fib_nexthop_info(skb, &fib6_nh->nh_common, AF_INET6,
flags, false) < 0)
goto nla_put_failure;
}
@@ -5466,13 +5466,14 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
goto nla_put_failure;
if (fib_add_nexthop(skb, &rt->fib6_nh->nh_common,
- rt->fib6_nh->fib_nh_weight) < 0)
+ rt->fib6_nh->fib_nh_weight, AF_INET6) < 0)
goto nla_put_failure;
list_for_each_entry_safe(sibling, next_sibling,
&rt->fib6_siblings, fib6_siblings) {
if (fib_add_nexthop(skb, &sibling->fib6_nh->nh_common,
- sibling->fib6_nh->fib_nh_weight) < 0)
+ sibling->fib6_nh->fib_nh_weight,
+ AF_INET6) < 0)
goto nla_put_failure;
}
@@ -5489,7 +5490,7 @@ static int rt6_fill_node(struct net *net, struct sk_buff *skb,
rtm->rtm_flags |= nh_flags;
} else {
- if (fib_nexthop_info(skb, &rt->fib6_nh->nh_common,
+ if (fib_nexthop_info(skb, &rt->fib6_nh->nh_common, AF_INET6,
&nh_flags, false) < 0)
goto nla_put_failure;
--
2.21.0
^ permalink raw reply related
* [PATCH v4 0/2] Drop IPV6 packets if IPv6 is disabled on boot
From: Leonardo Bras @ 2019-08-30 18:13 UTC (permalink / raw)
To: netfilter-devel, coreteam, bridge, netdev, linux-kernel
Cc: Leonardo Bras, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, Roopa Prabhu, Nikolay Aleksandrov,
David S. Miller
This patchset was prevously a single patch named:
- netfilter: nf_tables: fib: Drop IPV6 packets if IPv6 is disabled on boot
It fixes a bug where a host, with IPv6 disabled on boot, has to deal with
guest IPv6 packets, that comes from a bridge interface.
When these packets reach the host ip6tables they cause a kernel panic.
---
Changes from v3:
- Move drop logic from nft_fib6_eval{,_type} to nft_fib_netdev_eval
- Add another patch to drop ipv6 packets from bridge when ipv6 disabled
Changes from v2:
- Replace veredict.code from NF_DROP to NFT_BREAK
- Updated commit message (s/package/packet)
Changes from v1:
- Move drop logic from nft_fib_inet_eval() to nft_fib6_eval{,_type}
so it can affect other usages of these functions.
Leonardo Bras (2):
netfilter: Terminate rule eval if protocol=IPv6 and ipv6 module is
disabled
net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not
loaded
net/bridge/br_netfilter_hooks.c | 2 ++
net/netfilter/nft_fib_netdev.c | 3 +++
2 files changed, 5 insertions(+)
--
2.20.1
^ permalink raw reply
* [PATCH v4 1/2] netfilter: Terminate rule eval if protocol=IPv6 and ipv6 module is disabled
From: Leonardo Bras @ 2019-08-30 18:13 UTC (permalink / raw)
To: netfilter-devel, coreteam, bridge, netdev, linux-kernel
Cc: Leonardo Bras, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, Roopa Prabhu, Nikolay Aleksandrov,
David S. Miller
In-Reply-To: <20190830181354.26279-1-leonardo@linux.ibm.com>
If IPv6 is disabled on boot (ipv6.disable=1), but nft_fib_inet ends up
dealing with a IPv6 packet, it causes a kernel panic in
fib6_node_lookup_1(), crashing in bad_page_fault.
The panic is caused by trying to deference a very low address (0x38
in ppc64le), due to ipv6.fib6_main_tbl = NULL.
BUG: Kernel NULL pointer dereference at 0x00000038
The kernel panic was reproduced in a host that disabled IPv6 on boot and
have to process guest packets (coming from a bridge) using it's ip6tables.
Terminate rule evaluation when packet protocol is IPv6 but the ipv6 module
is not loaded.
Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
---
net/netfilter/nft_fib_netdev.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/net/netfilter/nft_fib_netdev.c b/net/netfilter/nft_fib_netdev.c
index 2cf3f32fe6d2..a2e726ae7f07 100644
--- a/net/netfilter/nft_fib_netdev.c
+++ b/net/netfilter/nft_fib_netdev.c
@@ -14,6 +14,7 @@
#include <linux/netfilter/nf_tables.h>
#include <net/netfilter/nf_tables_core.h>
#include <net/netfilter/nf_tables.h>
+#include <net/ipv6.h>
#include <net/netfilter/nft_fib.h>
@@ -34,6 +35,8 @@ static void nft_fib_netdev_eval(const struct nft_expr *expr,
}
break;
case ETH_P_IPV6:
+ if (!ipv6_mod_enabled())
+ break;
switch (priv->result) {
case NFT_FIB_RESULT_OIF:
case NFT_FIB_RESULT_OIFNAME:
--
2.20.1
^ permalink raw reply related
* [PATCH v4 2/2] net: br_netfiler_hooks: Drops IPv6 packets if IPv6 module is not loaded
From: Leonardo Bras @ 2019-08-30 18:13 UTC (permalink / raw)
To: netfilter-devel, coreteam, bridge, netdev, linux-kernel
Cc: Leonardo Bras, Pablo Neira Ayuso, Jozsef Kadlecsik,
Florian Westphal, Roopa Prabhu, Nikolay Aleksandrov,
David S. Miller
In-Reply-To: <20190830181354.26279-1-leonardo@linux.ibm.com>
A kernel panic can happen if a host has disabled IPv6 on boot and have to
process guest packets (coming from a bridge) using it's ip6tables.
IPv6 packets need to be dropped if the IPv6 module is not loaded.
Signed-off-by: Leonardo Bras <leonardo@linux.ibm.com>
---
net/bridge/br_netfilter_hooks.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/net/bridge/br_netfilter_hooks.c b/net/bridge/br_netfilter_hooks.c
index d3f9592f4ff8..5e8693730df1 100644
--- a/net/bridge/br_netfilter_hooks.c
+++ b/net/bridge/br_netfilter_hooks.c
@@ -493,6 +493,8 @@ static unsigned int br_nf_pre_routing(void *priv,
brnet = net_generic(state->net, brnf_net_id);
if (IS_IPV6(skb) || is_vlan_ipv6(skb, state->net) ||
is_pppoe_ipv6(skb, state->net)) {
+ if (!ipv6_mod_enabled())
+ return NF_DROP;
if (!brnet->call_ip6tables &&
!br_opt_get(br, BROPT_NF_CALL_IP6TABLES))
return NF_ACCEPT;
--
2.20.1
^ permalink raw reply related
* Re: [PATCH] net/skbuff: silence warnings under memory pressure
From: Qian Cai @ 2019-08-30 18:06 UTC (permalink / raw)
To: Eric Dumazet, davem; +Cc: netdev, linux-mm, linux-kernel
In-Reply-To: <229ebc3b-1c7e-474f-36f9-0fa603b889fb@gmail.com>
On Fri, 2019-08-30 at 18:15 +0200, Eric Dumazet wrote:
>
> On 8/30/19 5:25 PM, Qian Cai wrote:
> > On Fri, 2019-08-30 at 17:11 +0200, Eric Dumazet wrote:
> > >
> > > On 8/30/19 4:57 PM, Qian Cai wrote:
> > > > When running heavy memory pressure workloads, the system is throwing
> > > > endless warnings below due to the allocation could fail from
> > > > __build_skb(), and the volume of this call could be huge which may
> > > > generate a lot of serial console output and cosumes all CPUs as
> > > > warn_alloc() could be expensive by calling dump_stack() and then
> > > > show_mem().
> > > >
> > > > Fix it by silencing the warning in this call site. Also, it seems
> > > > unnecessary to even print a warning at all if the allocation failed in
> > > > __build_skb(), as it may just retransmit the packet and retry.
> > > >
> > >
> > > Same patches are showing up there and there from time to time.
> > >
> > > Why is this particular spot interesting, against all others not adding
> > > __GFP_NOWARN ?
> > >
> > > Are we going to have hundred of patches adding __GFP_NOWARN at various
> > > points,
> > > or should we get something generic to not flood the syslog in case of
> > > memory
> > > pressure ?
> > >
> >
> > From my testing which uses LTP oom* tests. There are only 3 places need to
> > be
> > patched. The other two are in IOMMU code for both Intel and AMD. The place
> > is
> > particular interesting because it could cause the system with floating
> > serial
> > console output for days without making progress in OOM. I suppose it ends up
> > in
> > a looping condition that warn_alloc() would end up generating more calls
> > into
> > __build_skb() via ksoftirqd.
> >
>
> Yes, but what about other tests done by other people ?
Sigh, I don't know what tests do you have in mind. I tried many memory pressure
tests including LTP, stress-ng, and mmtests etc running for years. I don't
recall see other places that could loop like this for days.
>
> You do not really answer my last question, which was really the point I tried
> to make.
>
> If there is a risk of flooding the syslog, we should fix this generically
> in mm layer, not adding hundred of __GFP_NOWARN all over the places.
>
> Maybe just make __GFP_NOWARN the default, I dunno.
I don't really see how it could end up with adding hundred of _GFP_NOWARN in the
kernel code. If there is really a hundred places could loop like this, it may
make more sense looking into a general solution.
^ permalink raw reply
* Re: [PATCH net-next v2 16/22] bnxt_en: Handle firmware reset.
From: kbuild test robot @ 2019-08-30 17:56 UTC (permalink / raw)
To: Michael Chan; +Cc: kbuild-all, davem, netdev, vasundhara-v.volam, ray.jui
In-Reply-To: <1567137305-5853-17-git-send-email-michael.chan@broadcom.com>
[-- Attachment #1: Type: text/plain, Size: 2764 bytes --]
Hi Michael,
I love your patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/Michael-Chan/bnxt_en-health-and-error-recovery/20190830-164635
config: x86_64-randconfig-f001-201934 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-11) 7.4.0
reproduce:
# save the attached .config to linux build tree
make ARCH=x86_64
If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>
All errors (new ones prefixed by >>):
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_fw_reset':
>> drivers/net/ethernet/broadcom/bnxt/bnxt.c:10021:35: error: 'struct bnxt' has no member named 'sriov_cfg'
if (bp->pf.registered_vfs || bp->sriov_cfg) {
^~
drivers/net/ethernet/broadcom/bnxt/bnxt.c: In function 'bnxt_fw_reset_task':
drivers/net/ethernet/broadcom/bnxt/bnxt.c:10418:34: error: 'struct bnxt' has no member named 'sriov_cfg'
if (bp->pf.registered_vfs || bp->sriov_cfg) {
^~
drivers/net/ethernet/broadcom/bnxt/bnxt.c:10425:11: error: 'struct bnxt' has no member named 'sriov_cfg'
bp->sriov_cfg);
^~
vim +10021 drivers/net/ethernet/broadcom/bnxt/bnxt.c
10003
10004 void bnxt_fw_reset(struct bnxt *bp)
10005 {
10006 int rc;
10007
10008 bnxt_rtnl_lock_sp(bp);
10009 if (test_bit(BNXT_STATE_OPEN, &bp->state) &&
10010 !test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
10011 set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
10012 if (BNXT_PF(bp) && bp->pf.active_vfs) {
10013 rc = bnxt_hwrm_func_qcfg(bp);
10014 if (rc) {
10015 netdev_err(bp->dev, "Firmware reset aborted, first func_qcfg cmd failed, rc = %d\n",
10016 rc);
10017 clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
10018 dev_close(bp->dev);
10019 goto fw_reset_exit;
10020 }
10021 if (bp->pf.registered_vfs || bp->sriov_cfg) {
10022 u16 vf_tmo_dsecs = bp->pf.registered_vfs * 10;
10023
10024 if (bp->fw_reset_max_dsecs < vf_tmo_dsecs)
10025 bp->fw_reset_max_dsecs = vf_tmo_dsecs;
10026 bp->fw_reset_state =
10027 BNXT_FW_RESET_STATE_POLL_VF;
10028 bnxt_queue_fw_reset_work(bp, HZ / 10);
10029 goto fw_reset_exit;
10030 }
10031 }
10032 bnxt_fw_reset_close(bp);
10033 bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10034 bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10);
10035 }
10036 fw_reset_exit:
10037 bnxt_rtnl_unlock_sp(bp);
10038 }
10039
---
0-DAY kernel test infrastructure Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all Intel Corporation
[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 33761 bytes --]
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox