* Re: [PATCH bpf-next] tools/bpf: bpftool: improve output format for bpftool net
From: Yonghong Song @ 2018-09-17 22:21 UTC (permalink / raw)
To: Daniel Borkmann, Alexei Starovoitov, netdev@vger.kernel.org; +Cc: Kernel Team
In-Reply-To: <5e65458e-aec5-baf7-9e0f-50e3647542ff@iogearbox.net>
On 9/17/18 3:19 AM, Daniel Borkmann wrote:
> On 09/14/2018 11:49 PM, Yonghong Song wrote:
>> This is a followup patch for Commit f6f3bac08ff9
>> ("tools/bpf: bpftool: add net support").
>> Some improvements are made for the bpftool net output.
>> Specially, plain output is more concise such that
>> per attachment should nicely fit in one line.
>> Compared to previous output, the prog tag is removed
>> since it can be easily obtained with program id.
>> Similar to xdp attachments, the device name is added
>> to tc_filters attachments.
>>
>> The bpf program attached through shared block
>> mechanism is supported as well.
>> $ ip link add dev v1 type veth peer name v2
>> $ tc qdisc add dev v1 ingress_block 10 egress_block 20 clsact
>> $ tc qdisc add dev v2 ingress_block 10 egress_block 20 clsact
>> $ tc filter add block 10 protocol ip prio 25 bpf obj bpf_shared.o sec ingress flowid 1:1
>> $ tc filter add block 20 protocol ip prio 30 bpf obj bpf_cyclic.o sec classifier flowid 1:1
>> $ bpftool net
>> xdp [
>> ]
>> tc_filters [
>> v2(7) qdisc_clsact_ingress bpf_shared.o:[ingress] id 23
>> v2(7) qdisc_clsact_egress bpf_cyclic.o:[classifier] id 24
>> v1(8) qdisc_clsact_ingress bpf_shared.o:[ingress] id 23
>> v1(8) qdisc_clsact_egress bpf_cyclic.o:[classifier] id 24
>
> Just one minor note for this one here, do we even need the "qdisc_" prefix? Couldn't it just simply
> be "clsact/ingress", "clsact/egress", "htb" etc?
Will do.
>
>> ]
>>
>> The documentation and "bpftool net help" are updated
>> to make it clear that current implementation only
>> supports xdp and tc attachments. For programs
>> attached to cgroups, "bpftool cgroup" can be used
>> to dump attachments. For other programs e.g.
>> sk_{filter,skb,msg,reuseport} and lwt/seg6,
>> iproute2 tools should be used.
>>
>> The new output:
>> $ bpftool net
>> xdp [
>> eth0(2) id/drv 198
>
> Could we change the "id/{drv,offload,generic} xyz" into e.g. "eth0(2) {driver,offload,generic} id 198",
> meaning, the "id xyz" being a child of either "driver", "offload" or "generic". Reason would be two-fold:
> i) we can keep the "id xyz" notion consistent as used under "tc_filters", and ii) it allows to put further
> information aside from just "id" member under "driver", "offload" or "generic" in the future.
Will do.
>
>> ]
>> tc_filters [
>
> Nit: can we use just "tc" for the above? Main use case would be clsact with one of its two hooks anyway,
> and the term "filter" is sort of tc historic; while being correct bpf progs would do much more than just
> filtering, and context is pretty clear anyway from qdisc that we subsequently dump.
Make sense.
Will address all these comments and submit a revision soon. Thanks!
>
>> eth0(2) qdisc_clsact_ingress fbflow_icmp id 335 act [{icmp_action id 336}]
>> eth0(2) qdisc_clsact_egress fbflow_egress id 334
>> ]
>> $ bpftool -jp net
>> [{
>> "xdp": [{
>> "devname": "eth0",
>> "ifindex": 2,
>> "id/drv": 198
>> }
>> ],
>> "tc_filters": [{
>> "devname": "eth0",
>> "ifindex": 2,
>> "kind": "qdisc_clsact_ingress",
>> "name": "fbflow_icmp",
>> "id": 335,
>> "act": [{
>> "name": "icmp_action",
>> "id": 336
>> }
>> ]
>> },{
>> "devname": "eth0",
>> "ifindex": 2,
>> "kind": "qdisc_clsact_egress",
>> "name": "fbflow_egress",
>> "id": 334
>> }
>> ]
>> }
>> ]
>>
>> Signed-off-by: Yonghong Song <yhs@fb.com>
^ permalink raw reply
* Re: [RFC/fix] Re: libbpf build broken on musl libc (Alpine Linux)
From: Alexei Starovoitov @ 2018-09-18 4:18 UTC (permalink / raw)
To: Jakub Kicinski
Cc: Arnaldo Carvalho de Melo, Daniel Borkmann, Thomas Richter,
Hendrik Brueckner, Jiri Olsa, Namhyung Kim, linux-kernel, netdev
In-Reply-To: <20180917193952.6709fd1b@cakuba.netronome.com>
On Mon, Sep 17, 2018 at 07:39:52PM -0700, Jakub Kicinski wrote:
> On Mon, 17 Sep 2018 17:52:59 -0700, Alexei Starovoitov wrote:
> > LGPL-2.1 in the above?
>
> Could we possibly make it dual licensed LGPL + BSD?
that's a separate discussion. let's not mix it up with this fix.
> > The rest looks good to me.
> > Should we take it via bpf-next tree?
> > If you feel there is an urgency to fix musl build, we can take it via
> > bpf tree too.
> >
> > Jakub, thoughts? you've been messing with strerror last..
>
> Sorry for the mess, I didn't know libc compat is such a pain.
>
> I kind of knowingly ignored the existing str_error_r(), as it didn't
> seem excessively clean. Yet, two months later I have no better
> ideas.. We could as well switch back to the XSI version, which we used
> before I needed access to reallocarray() (I mean change the str_error()
> to be a plain XSI wrapper).
>
> Perhaps placing the new helper in libbpf_errno.c file would make
> sense? The only reason for this separate file to exist is in fact to
> make use of XSI-compliant strerror_r().
that's a good idea. libbpf_errno.c sounds more appropriate to me as well.
> Also, I need to go relicense tools/include/tools/libc_compat.h ASAP
> too :S
argh. an oversight. pls send the patch.
^ permalink raw reply
* Re: [PATCH net-next v3 02/17] zinc: introduce minimal cryptography library
From: Herbert Xu @ 2018-09-18 4:21 UTC (permalink / raw)
To: Jason A. Donenfeld
Cc: ard.biesheuvel, luto, davem, andrew, ebiggers, gregkh,
linux-kernel, netdev, sneves, jeanphilippe.aumasson, linux-crypto
In-Reply-To: <CAHmME9qwRzuoo-3Hxahwu=Li2LCz06Uowaq1GFmkts6tsffM7w@mail.gmail.com>
Hi Jason:
Jason A. Donenfeld <Jason@zx2c4.com> wrote:
>
> On Mon, Sep 17, 2018 at 7:26 AM Ard Biesheuvel
> <ard.biesheuvel@linaro.org> wrote:
>> OK, so let me summarize my remaining concerns as well. I may be a bit
>> more finicky than Andy, though.
>
> Yes, and generally hostile to this whole initiative since the
> beginning. But I am very grateful for your reviews nonetheless, and
> I'll do my best to incorporate as much as is reasonable.
>> I would like to urge Jason to
>> bear with us and bring this discussion to a close before resubmitting.
>
> What I fear is that either:
> - You don't like the Zinc initiative in one way or another, and the
> desire to "keep discussing" and adding more things is less out of
> their necessity and more out of a desire to stall it indefinitely.
> - You're going to bikeshed and bikeshed and waste tons of time until
> Zinc copies lots of the same design decisions from the present crypto
> API.
That may be your view but from what I've read Ard has been very
constructive in pointing out issues in your submission. If your
response to criticism is to dismiss them as hostile then I'm afraid
that we will not be able to progress on this patch series.
Please keep in mind that this is a large project that has to support
multiple users on one hand (not just WireGuard) and complex hardware
acceleration drivers on the other. Ard has been one of the most
prolific contributors to the crypto code and his review should be
taken seriously.
Thanks,
--
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
^ permalink raw reply
* Re: [PATCH net-next v3 02/17] zinc: introduce minimal cryptography library
From: Jason A. Donenfeld @ 2018-09-18 4:26 UTC (permalink / raw)
To: Herbert Xu
Cc: Ard Biesheuvel, Andrew Lutomirski, David Miller, Andrew Lunn,
Eric Biggers, Greg Kroah-Hartman, LKML, Netdev, Samuel Neves,
Jean-Philippe Aumasson, Linux Crypto Mailing List
In-Reply-To: <20180918042133.4ybztgdooxkoyiru@gondor.apana.org.au>
Hi Herbert,
On Tue, Sep 18, 2018 at 6:21 AM Herbert Xu <herbert@gondor.apana.org.au> wrote:
> That may be your view but from what I've read Ard has been very
> constructive in pointing out issues in your submission.
> Please keep in mind that this is a large project that has to support
> multiple users on one hand (not just WireGuard) and complex hardware
> acceleration drivers on the other. Ard has been one of the most
> prolific contributors to the crypto code and his review should be
> taken seriously.
I'm well aware, which is why I also wrote:
"I do sincerely hope these are only fears and not what actually is
going on. I'll do my best to take into serious consideration what you
say -- many are indeed extremely helpful"
Worry not, I've been working around the clock to implement suggestions
from Ard and from others.
I'll be submitting v5 fairly soon, which will probably be a good spot
for you to review as well, if you're interested. I'm just going to
give kbuild testbot a few more hours on it first.
Regards,
Jason
^ permalink raw reply
* [PATCH 4.14 098/126] ipv6: export ip6 fragments sysctl to unprivileged users
From: Greg Kroah-Hartman @ 2018-09-17 22:42 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable,
netdev@vger.kernel.org, stable@vger.kernel.org, edumazet@google.com, Nikolay Borisov,
Eric Dumazet, David S. Miller, Nikolay Borisov
In-Reply-To: <20180917211703.481236999@linuxfoundation.org>
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Eric Dumazet <edumazet@google.com>
IPv4 was changed in commit 52a773d645e9 ("net: Export ip fragment
sysctl to unprivileged users")
The only sysctl that is not per-netns is not used :
ip6frag_secret_interval
Signed-off-by: Eric Dumazet <edumazet@google.com>
Cc: Nikolay Borisov <kernel@kyup.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 18dcbe12fe9fca0ab825f7eff993060525ac2503)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv6/reassembly.c | 4 ----
1 file changed, 4 deletions(-)
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -649,10 +649,6 @@ static int __net_init ip6_frags_ns_sysct
table[1].data = &net->ipv6.frags.low_thresh;
table[1].extra2 = &net->ipv6.frags.high_thresh;
table[2].data = &net->ipv6.frags.timeout;
-
- /* Don't export sysctls to unprivileged users */
- if (net->user_ns != &init_user_ns)
- table[0].procname = NULL;
}
hdr = register_net_sysctl(net, "net/ipv6", table);
^ permalink raw reply
* [PATCH 4.14 118/126] ipv4: frags: precedence bug in ip_expire()
From: Greg Kroah-Hartman @ 2018-09-17 22:42 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable,
netdev@vger.kernel.org, stable@vger.kernel.org, edumazet@google.com, Dan Carpenter,
David S. Miller, Dan Carpenter
In-Reply-To: <20180917211703.481236999@linuxfoundation.org>
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Dan Carpenter <dan.carpenter@oracle.com>
We accidentally removed the parentheses here, but they are required
because '!' has higher precedence than '&'.
Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit 70837ffe3085c9a91488b52ca13ac84424da1042)
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/ip_fragment.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -154,7 +154,7 @@ static void ip_expire(struct timer_list
__IP_INC_STATS(net, IPSTATS_MIB_REASMFAILS);
__IP_INC_STATS(net, IPSTATS_MIB_REASMTIMEOUT);
- if (!qp->q.flags & INET_FRAG_FIRST_IN)
+ if (!(qp->q.flags & INET_FRAG_FIRST_IN))
goto out;
/* sk_buff::dev and sk_buff::rbnode are unionized. So we
^ permalink raw reply
* [PATCH 4.14 121/126] ip: frags: fix crash in ip_do_fragment()
From: Greg Kroah-Hartman @ 2018-09-17 22:42 UTC (permalink / raw)
To: linux-kernel
Cc: Greg Kroah-Hartman, stable,
netdev@vger.kernel.org, stable@vger.kernel.org, edumazet@google.com, Taehee Yoo,
Eric Dumazet, David S. Miller, Taehee Yoo
In-Reply-To: <20180917211703.481236999@linuxfoundation.org>
4.14-stable review patch. If anyone has any objections, please let me know.
------------------
From: Taehee Yoo <ap420073@gmail.com>
commit 5d407b071dc369c26a38398326ee2be53651cfe4 upstream
A kernel crash occurrs when defragmented packet is fragmented
in ip_do_fragment().
In defragment routine, skb_orphan() is called and
skb->ip_defrag_offset is set. but skb->sk and
skb->ip_defrag_offset are same union member. so that
frag->sk is not NULL.
Hence crash occurrs in skb->sk check routine in ip_do_fragment() when
defragmented packet is fragmented.
test commands:
%iptables -t nat -I POSTROUTING -j MASQUERADE
%hping3 192.168.4.2 -s 1000 -p 2000 -d 60000
splat looks like:
[ 261.069429] kernel BUG at net/ipv4/ip_output.c:636!
[ 261.075753] invalid opcode: 0000 [#1] SMP DEBUG_PAGEALLOC KASAN PTI
[ 261.083854] CPU: 1 PID: 1349 Comm: hping3 Not tainted 4.19.0-rc2+ #3
[ 261.100977] RIP: 0010:ip_do_fragment+0x1613/0x2600
[ 261.106945] Code: e8 e2 38 e3 fe 4c 8b 44 24 18 48 8b 74 24 08 e9 92 f6 ff ff 80 3c 02 00 0f 85 da 07 00 00 48 8b b5 d0 00 00 00 e9 25 f6 ff ff <0f> 0b 0f 0b 44 8b 54 24 58 4c 8b 4c 24 18 4c 8b 5c 24 60 4c 8b 6c
[ 261.127015] RSP: 0018:ffff8801031cf2c0 EFLAGS: 00010202
[ 261.134156] RAX: 1ffff1002297537b RBX: ffffed0020639e6e RCX: 0000000000000004
[ 261.142156] RDX: 0000000000000000 RSI: 0000000000000000 RDI: ffff880114ba9bd8
[ 261.150157] RBP: ffff880114ba8a40 R08: ffffed0022975395 R09: ffffed0022975395
[ 261.158157] R10: 0000000000000001 R11: ffffed0022975394 R12: ffff880114ba9ca4
[ 261.166159] R13: 0000000000000010 R14: ffff880114ba9bc0 R15: dffffc0000000000
[ 261.174169] FS: 00007fbae2199700(0000) GS:ffff88011b400000(0000) knlGS:0000000000000000
[ 261.183012] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 261.189013] CR2: 00005579244fe000 CR3: 0000000119bf4000 CR4: 00000000001006e0
[ 261.198158] Call Trace:
[ 261.199018] ? dst_output+0x180/0x180
[ 261.205011] ? save_trace+0x300/0x300
[ 261.209018] ? ip_copy_metadata+0xb00/0xb00
[ 261.213034] ? sched_clock_local+0xd4/0x140
[ 261.218158] ? kill_l4proto+0x120/0x120 [nf_conntrack]
[ 261.223014] ? rt_cpu_seq_stop+0x10/0x10
[ 261.227014] ? find_held_lock+0x39/0x1c0
[ 261.233008] ip_finish_output+0x51d/0xb50
[ 261.237006] ? ip_fragment.constprop.56+0x220/0x220
[ 261.243011] ? nf_ct_l4proto_register_one+0x5b0/0x5b0 [nf_conntrack]
[ 261.250152] ? rcu_is_watching+0x77/0x120
[ 261.255010] ? nf_nat_ipv4_out+0x1e/0x2b0 [nf_nat_ipv4]
[ 261.261033] ? nf_hook_slow+0xb1/0x160
[ 261.265007] ip_output+0x1c7/0x710
[ 261.269005] ? ip_mc_output+0x13f0/0x13f0
[ 261.273002] ? __local_bh_enable_ip+0xe9/0x1b0
[ 261.278152] ? ip_fragment.constprop.56+0x220/0x220
[ 261.282996] ? nf_hook_slow+0xb1/0x160
[ 261.287007] raw_sendmsg+0x21f9/0x4420
[ 261.291008] ? dst_output+0x180/0x180
[ 261.297003] ? sched_clock_cpu+0x126/0x170
[ 261.301003] ? find_held_lock+0x39/0x1c0
[ 261.306155] ? stop_critical_timings+0x420/0x420
[ 261.311004] ? check_flags.part.36+0x450/0x450
[ 261.315005] ? _raw_spin_unlock_irq+0x29/0x40
[ 261.320995] ? _raw_spin_unlock_irq+0x29/0x40
[ 261.326142] ? cyc2ns_read_end+0x10/0x10
[ 261.330139] ? raw_bind+0x280/0x280
[ 261.334138] ? sched_clock_cpu+0x126/0x170
[ 261.338995] ? check_flags.part.36+0x450/0x450
[ 261.342991] ? __lock_acquire+0x4500/0x4500
[ 261.348994] ? inet_sendmsg+0x11c/0x500
[ 261.352989] ? dst_output+0x180/0x180
[ 261.357012] inet_sendmsg+0x11c/0x500
[ ... ]
v2:
- clear skb->sk at reassembly routine.(Eric Dumarzet)
Fixes: fa0f527358bd ("ip: use rb trees for IP frag queue.")
Suggested-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: Taehee Yoo <ap420073@gmail.com>
Reviewed-by: Eric Dumazet <edumazet@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
net/ipv4/ip_fragment.c | 1 +
net/ipv6/netfilter/nf_conntrack_reasm.c | 1 +
2 files changed, 2 insertions(+)
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -599,6 +599,7 @@ static int ip_frag_reasm(struct ipq *qp,
nextp = &fp->next;
fp->prev = NULL;
memset(&fp->rbnode, 0, sizeof(fp->rbnode));
+ fp->sk = NULL;
head->data_len += fp->len;
head->len += fp->len;
if (head->ip_summed != fp->ip_summed)
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -453,6 +453,7 @@ nf_ct_frag6_reasm(struct frag_queue *fq,
else if (head->ip_summed == CHECKSUM_COMPLETE)
head->csum = csum_add(head->csum, fp->csum);
head->truesize += fp->truesize;
+ fp->sk = NULL;
}
sub_frag_mem_limit(fq->q.net, head->truesize);
^ permalink raw reply
* [PATCH bpf-next v2] tools/bpf: bpftool: improve output format for bpftool net
From: Yonghong Song @ 2018-09-17 23:13 UTC (permalink / raw)
To: ast, daniel, netdev; +Cc: kernel-team
This is a followup patch for Commit f6f3bac08ff9
("tools/bpf: bpftool: add net support").
Some improvements are made for the bpftool net output.
Specially, plain output is more concise such that
per attachment should nicely fit in one line.
Compared to previous output, the prog tag is removed
since it can be easily obtained with program id.
Similar to xdp attachments, the device name is added
to tc attachments.
The bpf program attached through shared block
mechanism is supported as well.
$ ip link add dev v1 type veth peer name v2
$ tc qdisc add dev v1 ingress_block 10 egress_block 20 clsact
$ tc qdisc add dev v2 ingress_block 10 egress_block 20 clsact
$ tc filter add block 10 protocol ip prio 25 bpf obj bpf_shared.o sec ingress flowid 1:1
$ tc filter add block 20 protocol ip prio 30 bpf obj bpf_cyclic.o sec classifier flowid 1:1
$ bpftool net
xdp:
tc:
v2(7) clsact/ingress bpf_shared.o:[ingress] id 23
v2(7) clsact/egress bpf_cyclic.o:[classifier] id 24
v1(8) clsact/ingress bpf_shared.o:[ingress] id 23
v1(8) clsact/egress bpf_cyclic.o:[classifier] id 24
The documentation and "bpftool net help" are updated
to make it clear that current implementation only
supports xdp and tc attachments. For programs
attached to cgroups, "bpftool cgroup" can be used
to dump attachments. For other programs e.g.
sk_{filter,skb,msg,reuseport} and lwt/seg6,
iproute2 tools should be used.
The new output:
$ bpftool net
xdp:
eth0(2) driver id 198
tc:
eth0(2) clsact/ingress fbflow_icmp id 335 act [{icmp_action id 336}]
eth0(2) clsact/egress fbflow_egress id 334
$ bpftool -jp net
[{
"xdp": [{
"devname": "eth0",
"ifindex": 2,
"mode": "driver",
"id": 198
}
],
"tc": [{
"devname": "eth0",
"ifindex": 2,
"kind": "clsact/ingress",
"name": "fbflow_icmp",
"id": 335,
"act": [{
"name": "icmp_action",
"id": 336
}
]
},{
"devname": "eth0",
"ifindex": 2,
"kind": "clsact/egress",
"name": "fbflow_egress",
"id": 334
}
]
}
]
Signed-off-by: Yonghong Song <yhs@fb.com>
---
.../bpf/bpftool/Documentation/bpftool-net.rst | 78 +++++++------
tools/bpf/bpftool/main.h | 3 +-
tools/bpf/bpftool/net.c | 103 ++++++++++++------
tools/bpf/bpftool/netlink_dumper.c | 85 +++++++--------
tools/bpf/bpftool/netlink_dumper.h | 22 ++--
5 files changed, 161 insertions(+), 130 deletions(-)
Changelogs:
v1 -> v2:
. Addressed several output format suggestions from Daniel
diff --git a/tools/bpf/bpftool/Documentation/bpftool-net.rst b/tools/bpf/bpftool/Documentation/bpftool-net.rst
index 48a61837a264..408ec30d8872 100644
--- a/tools/bpf/bpftool/Documentation/bpftool-net.rst
+++ b/tools/bpf/bpftool/Documentation/bpftool-net.rst
@@ -26,9 +26,20 @@ NET COMMANDS
DESCRIPTION
===========
**bpftool net { show | list } [ dev name ]**
- List all networking device driver and tc attachment in the system.
-
- Output will start with all xdp program attachment, followed by
+ List bpf program attachments in the kernel networking subsystem.
+
+ Currently, only device driver xdp attachments and tc filter
+ classification/action attachments are implemented, i.e., for
+ program types **BPF_PROG_TYPE_SCHED_CLS**,
+ **BPF_PROG_TYPE_SCHED_ACT** and **BPF_PROG_TYPE_XDP**.
+ For programs attached to a particular cgroup, e.g.,
+ **BPF_PROG_TYPE_CGROUP_SKB**, **BPF_PROG_TYPE_CGROUP_SOCK**,
+ **BPF_PROG_TYPE_SOCK_OPS** and **BPF_PROG_TYPE_CGROUP_SOCK_ADDR**,
+ users can use **bpftool cgroup** to dump cgroup attachments.
+ For sk_{filter, skb, msg, reuseport} and lwt/seg6
+ bpf programs, users should consult other tools, e.g., iproute2.
+
+ The current output will start with all xdp program attachments, followed by
all tc class/qdisc bpf program attachments. Both xdp programs and
tc programs are ordered based on ifindex number. If multiple bpf
programs attached to the same networking device through **tc filter**,
@@ -61,21 +72,15 @@ EXAMPLES
::
- xdp [
- ifindex 2 devname eth0 prog_id 198
- ]
- tc_filters [
- ifindex 2 kind qdisc_htb name prefix_matcher.o:[cls_prefix_matcher_htb]
- prog_id 111727 tag d08fe3b4319bc2fd act []
- ifindex 2 kind qdisc_clsact_ingress name fbflow_icmp
- prog_id 130246 tag 3f265c7f26db62c9 act []
- ifindex 2 kind qdisc_clsact_egress name prefix_matcher.o:[cls_prefix_matcher_clsact]
- prog_id 111726 tag 99a197826974c876
- ifindex 2 kind qdisc_clsact_egress name cls_fg_dscp
- prog_id 108619 tag dc4630674fd72dcc act []
- ifindex 2 kind qdisc_clsact_egress name fbflow_egress
- prog_id 130245 tag 72d2d830d6888d2c
- ]
+ xdp:
+ eth0(2) driver id 198
+
+ tc:
+ eth0(2) htb name prefix_matcher.o:[cls_prefix_matcher_htb] id 111727 act []
+ eth0(2) clsact/ingress fbflow_icmp id 130246 act []
+ eth0(2) clsact/egress prefix_matcher.o:[cls_prefix_matcher_clsact] id 111726
+ eth0(2) clsact/egress cls_fg_dscp id 108619 act []
+ eth0(2) clsact/egress fbflow_egress id 130245
|
| **# bpftool -jp net**
@@ -84,44 +89,45 @@ EXAMPLES
[{
"xdp": [{
- "ifindex": 2,
"devname": "eth0",
- "prog_id": 198
+ "ifindex": 2,
+ "mode": "driver",
+ "id": 198
}
],
- "tc_filters": [{
+ "tc": [{
+ "devname": "eth0",
"ifindex": 2,
- "kind": "qdisc_htb",
+ "kind": "htb",
"name": "prefix_matcher.o:[cls_prefix_matcher_htb]",
- "prog_id": 111727,
- "tag": "d08fe3b4319bc2fd",
+ "id": 111727,
"act": []
},{
+ "devname": "eth0",
"ifindex": 2,
- "kind": "qdisc_clsact_ingress",
+ "kind": "clsact/ingress",
"name": "fbflow_icmp",
- "prog_id": 130246,
- "tag": "3f265c7f26db62c9",
+ "id": 130246,
"act": []
},{
+ "devname": "eth0",
"ifindex": 2,
- "kind": "qdisc_clsact_egress",
+ "kind": "clsact/egress",
"name": "prefix_matcher.o:[cls_prefix_matcher_clsact]",
- "prog_id": 111726,
- "tag": "99a197826974c876"
+ "id": 111726,
},{
+ "devname": "eth0",
"ifindex": 2,
- "kind": "qdisc_clsact_egress",
+ "kind": "clsact/egress",
"name": "cls_fg_dscp",
- "prog_id": 108619,
- "tag": "dc4630674fd72dcc",
+ "id": 108619,
"act": []
},{
+ "devname": "eth0",
"ifindex": 2,
- "kind": "qdisc_clsact_egress",
+ "kind": "clsact/egress",
"name": "fbflow_egress",
- "prog_id": 130245,
- "tag": "72d2d830d6888d2c"
+ "id": 130245,
}
]
}
diff --git a/tools/bpf/bpftool/main.h b/tools/bpf/bpftool/main.h
index 02dfbcb92a23..40492cdc4e53 100644
--- a/tools/bpf/bpftool/main.h
+++ b/tools/bpf/bpftool/main.h
@@ -171,5 +171,6 @@ struct nlattr;
struct ifinfomsg;
struct tcmsg;
int do_xdp_dump(struct ifinfomsg *ifinfo, struct nlattr **tb);
-int do_filter_dump(struct tcmsg *ifinfo, struct nlattr **tb, const char *kind);
+int do_filter_dump(struct tcmsg *ifinfo, struct nlattr **tb, const char *kind,
+ const char *devname, int ifindex);
#endif
diff --git a/tools/bpf/bpftool/net.c b/tools/bpf/bpftool/net.c
index 77dd73dd9ade..ed205ee57655 100644
--- a/tools/bpf/bpftool/net.c
+++ b/tools/bpf/bpftool/net.c
@@ -2,6 +2,7 @@
// Copyright (C) 2018 Facebook
#define _GNU_SOURCE
+#include <errno.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
@@ -17,8 +18,13 @@
#include "main.h"
#include "netlink_dumper.h"
+struct ip_devname_ifindex {
+ char devname[64];
+ int ifindex;
+};
+
struct bpf_netdev_t {
- int *ifindex_array;
+ struct ip_devname_ifindex *devices;
int used_len;
int array_len;
int filter_idx;
@@ -36,6 +42,12 @@ struct bpf_tcinfo_t {
bool is_qdisc;
};
+struct bpf_filter_t {
+ const char *kind;
+ const char *devname;
+ int ifindex;
+};
+
static int dump_link_nlmsg(void *cookie, void *msg, struct nlattr **tb)
{
struct bpf_netdev_t *netinfo = cookie;
@@ -45,11 +57,20 @@ static int dump_link_nlmsg(void *cookie, void *msg, struct nlattr **tb)
return 0;
if (netinfo->used_len == netinfo->array_len) {
- netinfo->ifindex_array = realloc(netinfo->ifindex_array,
- (netinfo->array_len + 16) * sizeof(int));
+ netinfo->devices = realloc(netinfo->devices,
+ (netinfo->array_len + 16) *
+ sizeof(struct ip_devname_ifindex));
+ if (!netinfo->devices)
+ return -ENOMEM;
+
netinfo->array_len += 16;
}
- netinfo->ifindex_array[netinfo->used_len++] = ifinfo->ifi_index;
+ netinfo->devices[netinfo->used_len].ifindex = ifinfo->ifi_index;
+ snprintf(netinfo->devices[netinfo->used_len].devname,
+ sizeof(netinfo->devices[netinfo->used_len].devname),
+ "%s",
+ tb[IFLA_IFNAME] ? nla_getattr_str(tb[IFLA_IFNAME]) : "");
+ netinfo->used_len++;
return do_xdp_dump(ifinfo, tb);
}
@@ -71,13 +92,15 @@ static int dump_class_qdisc_nlmsg(void *cookie, void *msg, struct nlattr **tb)
if (tcinfo->used_len == tcinfo->array_len) {
tcinfo->handle_array = realloc(tcinfo->handle_array,
(tcinfo->array_len + 16) * sizeof(struct tc_kind_handle));
+ if (!tcinfo->handle_array)
+ return -ENOMEM;
+
tcinfo->array_len += 16;
}
tcinfo->handle_array[tcinfo->used_len].handle = info->tcm_handle;
snprintf(tcinfo->handle_array[tcinfo->used_len].kind,
sizeof(tcinfo->handle_array[tcinfo->used_len].kind),
- "%s_%s",
- tcinfo->is_qdisc ? "qdisc" : "class",
+ "%s",
tb[TCA_KIND] ? nla_getattr_str(tb[TCA_KIND]) : "unknown");
tcinfo->used_len++;
@@ -86,60 +109,71 @@ static int dump_class_qdisc_nlmsg(void *cookie, void *msg, struct nlattr **tb)
static int dump_filter_nlmsg(void *cookie, void *msg, struct nlattr **tb)
{
- const char *kind = cookie;
+ const struct bpf_filter_t *filter_info = cookie;
- return do_filter_dump((struct tcmsg *)msg, tb, kind);
+ return do_filter_dump((struct tcmsg *)msg, tb, filter_info->kind,
+ filter_info->devname, filter_info->ifindex);
}
-static int show_dev_tc_bpf(int sock, unsigned int nl_pid, int ifindex)
+static int show_dev_tc_bpf(int sock, unsigned int nl_pid,
+ struct ip_devname_ifindex *dev)
{
+ struct bpf_filter_t filter_info;
struct bpf_tcinfo_t tcinfo;
- int i, handle, ret;
+ int i, handle, ret = 0;
tcinfo.handle_array = NULL;
tcinfo.used_len = 0;
tcinfo.array_len = 0;
tcinfo.is_qdisc = false;
- ret = nl_get_class(sock, nl_pid, ifindex, dump_class_qdisc_nlmsg,
+ ret = nl_get_class(sock, nl_pid, dev->ifindex, dump_class_qdisc_nlmsg,
&tcinfo);
if (ret)
- return ret;
+ goto out;
tcinfo.is_qdisc = true;
- ret = nl_get_qdisc(sock, nl_pid, ifindex, dump_class_qdisc_nlmsg,
+ ret = nl_get_qdisc(sock, nl_pid, dev->ifindex, dump_class_qdisc_nlmsg,
&tcinfo);
if (ret)
- return ret;
+ goto out;
+ filter_info.devname = dev->devname;
+ filter_info.ifindex = dev->ifindex;
for (i = 0; i < tcinfo.used_len; i++) {
- ret = nl_get_filter(sock, nl_pid, ifindex,
+ filter_info.kind = tcinfo.handle_array[i].kind;
+ ret = nl_get_filter(sock, nl_pid, dev->ifindex,
tcinfo.handle_array[i].handle,
dump_filter_nlmsg,
- tcinfo.handle_array[i].kind);
+ &filter_info);
if (ret)
- return ret;
+ goto out;
}
/* root, ingress and egress handle */
handle = TC_H_ROOT;
- ret = nl_get_filter(sock, nl_pid, ifindex, handle, dump_filter_nlmsg,
- "root");
+ filter_info.kind = "root";
+ ret = nl_get_filter(sock, nl_pid, dev->ifindex, handle,
+ dump_filter_nlmsg, &filter_info);
if (ret)
- return ret;
+ goto out;
handle = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_INGRESS);
- ret = nl_get_filter(sock, nl_pid, ifindex, handle, dump_filter_nlmsg,
- "qdisc_clsact_ingress");
+ filter_info.kind = "clsact/ingress";
+ ret = nl_get_filter(sock, nl_pid, dev->ifindex, handle,
+ dump_filter_nlmsg, &filter_info);
if (ret)
- return ret;
+ goto out;
handle = TC_H_MAKE(TC_H_CLSACT, TC_H_MIN_EGRESS);
- ret = nl_get_filter(sock, nl_pid, ifindex, handle, dump_filter_nlmsg,
- "qdisc_clsact_egress");
+ filter_info.kind = "clsact/egress";
+ ret = nl_get_filter(sock, nl_pid, dev->ifindex, handle,
+ dump_filter_nlmsg, &filter_info);
if (ret)
- return ret;
+ goto out;
+out:
+ free(tcinfo.handle_array);
return 0;
}
@@ -168,7 +202,7 @@ static int do_show(int argc, char **argv)
return -1;
}
- dev_array.ifindex_array = NULL;
+ dev_array.devices = NULL;
dev_array.used_len = 0;
dev_array.array_len = 0;
dev_array.filter_idx = filter_idx;
@@ -176,15 +210,15 @@ static int do_show(int argc, char **argv)
if (json_output)
jsonw_start_array(json_wtr);
NET_START_OBJECT;
- NET_START_ARRAY("xdp", "\n");
+ NET_START_ARRAY("xdp", "%s:\n");
ret = nl_get_link(sock, nl_pid, dump_link_nlmsg, &dev_array);
NET_END_ARRAY("\n");
if (!ret) {
- NET_START_ARRAY("tc_filters", "\n");
+ NET_START_ARRAY("tc", "%s:\n");
for (i = 0; i < dev_array.used_len; i++) {
ret = show_dev_tc_bpf(sock, nl_pid,
- dev_array.ifindex_array[i]);
+ &dev_array.devices[i]);
if (ret)
break;
}
@@ -200,7 +234,7 @@ static int do_show(int argc, char **argv)
libbpf_strerror(ret, err_buf, sizeof(err_buf));
fprintf(stderr, "Error: %s\n", err_buf);
}
- free(dev_array.ifindex_array);
+ free(dev_array.devices);
close(sock);
return ret;
}
@@ -214,7 +248,12 @@ static int do_help(int argc, char **argv)
fprintf(stderr,
"Usage: %s %s { show | list } [dev <devname>]\n"
- " %s %s help\n",
+ " %s %s help\n"
+ "Note: Only xdp and tc attachments are supported now.\n"
+ " For progs attached to cgroups, use \"bpftool cgroup\"\n"
+ " to dump program attachments. For program types\n"
+ " sk_{filter,skb,msg,reuseport} and lwt/seg6, please\n"
+ " consult iproute2.\n",
bin_name, argv[-2], bin_name, argv[-2]);
return 0;
diff --git a/tools/bpf/bpftool/netlink_dumper.c b/tools/bpf/bpftool/netlink_dumper.c
index e12494fd1d2e..6f5e9cc6836c 100644
--- a/tools/bpf/bpftool/netlink_dumper.c
+++ b/tools/bpf/bpftool/netlink_dumper.c
@@ -12,12 +12,18 @@
#include "netlink_dumper.h"
static void xdp_dump_prog_id(struct nlattr **tb, int attr,
- const char *type)
+ const char *mode,
+ bool new_json_object)
{
if (!tb[attr])
return;
- NET_DUMP_UINT(type, nla_getattr_u32(tb[attr]))
+ if (new_json_object)
+ NET_START_OBJECT
+ NET_DUMP_STR("mode", " %s", mode);
+ NET_DUMP_UINT("id", " id %u", nla_getattr_u32(tb[attr]))
+ if (new_json_object)
+ NET_END_OBJECT
}
static int do_xdp_dump_one(struct nlattr *attr, unsigned int ifindex,
@@ -37,18 +43,26 @@ static int do_xdp_dump_one(struct nlattr *attr, unsigned int ifindex,
return 0;
NET_START_OBJECT;
- NET_DUMP_UINT("ifindex", ifindex);
-
if (name)
- NET_DUMP_STR("devname", name);
-
- if (tb[IFLA_XDP_PROG_ID])
- NET_DUMP_UINT("prog_id", nla_getattr_u32(tb[IFLA_XDP_PROG_ID]));
+ NET_DUMP_STR("devname", "%s", name);
+ NET_DUMP_UINT("ifindex", "(%d)", ifindex);
if (mode == XDP_ATTACHED_MULTI) {
- xdp_dump_prog_id(tb, IFLA_XDP_SKB_PROG_ID, "generic_prog_id");
- xdp_dump_prog_id(tb, IFLA_XDP_DRV_PROG_ID, "drv_prog_id");
- xdp_dump_prog_id(tb, IFLA_XDP_HW_PROG_ID, "offload_prog_id");
+ if (json_output) {
+ jsonw_name(json_wtr, "multi_attachments");
+ jsonw_start_array(json_wtr);
+ }
+ xdp_dump_prog_id(tb, IFLA_XDP_SKB_PROG_ID, "generic", true);
+ xdp_dump_prog_id(tb, IFLA_XDP_DRV_PROG_ID, "driver", true);
+ xdp_dump_prog_id(tb, IFLA_XDP_HW_PROG_ID, "offload", true);
+ if (json_output)
+ jsonw_end_array(json_wtr);
+ } else if (mode == XDP_ATTACHED_DRV) {
+ xdp_dump_prog_id(tb, IFLA_XDP_PROG_ID, "driver", false);
+ } else if (mode == XDP_ATTACHED_SKB) {
+ xdp_dump_prog_id(tb, IFLA_XDP_PROG_ID, "generic", false);
+ } else if (mode == XDP_ATTACHED_HW) {
+ xdp_dump_prog_id(tb, IFLA_XDP_PROG_ID, "offload", false);
}
NET_END_OBJECT_FINAL;
@@ -64,26 +78,9 @@ int do_xdp_dump(struct ifinfomsg *ifinfo, struct nlattr **tb)
nla_getattr_str(tb[IFLA_IFNAME]));
}
-static char *hexstring_n2a(const unsigned char *str, int len,
- char *buf, int blen)
-{
- char *ptr = buf;
- int i;
-
- for (i = 0; i < len; i++) {
- if (blen < 3)
- break;
- sprintf(ptr, "%02x", str[i]);
- ptr += 2;
- blen -= 2;
- }
- return buf;
-}
-
static int do_bpf_dump_one_act(struct nlattr *attr)
{
struct nlattr *tb[TCA_ACT_BPF_MAX + 1];
- char buf[256];
if (nla_parse_nested(tb, TCA_ACT_BPF_MAX, attr, NULL) < 0)
return -LIBBPF_ERRNO__NLPARSE;
@@ -93,13 +90,11 @@ static int do_bpf_dump_one_act(struct nlattr *attr)
NET_START_OBJECT_NESTED2;
if (tb[TCA_ACT_BPF_NAME])
- NET_DUMP_STR("name", nla_getattr_str(tb[TCA_ACT_BPF_NAME]));
+ NET_DUMP_STR("name", "%s",
+ nla_getattr_str(tb[TCA_ACT_BPF_NAME]));
if (tb[TCA_ACT_BPF_ID])
- NET_DUMP_UINT("bpf_id", nla_getattr_u32(tb[TCA_ACT_BPF_ID]));
- if (tb[TCA_ACT_BPF_TAG])
- NET_DUMP_STR("tag", hexstring_n2a(nla_data(tb[TCA_ACT_BPF_TAG]),
- nla_len(tb[TCA_ACT_BPF_TAG]),
- buf, sizeof(buf)));
+ NET_DUMP_UINT("id", " id %u",
+ nla_getattr_u32(tb[TCA_ACT_BPF_ID]));
NET_END_OBJECT_NESTED;
return 0;
}
@@ -128,13 +123,13 @@ static int do_bpf_act_dump(struct nlattr *attr)
if (nla_parse_nested(tb, TCA_ACT_MAX_PRIO, attr, NULL) < 0)
return -LIBBPF_ERRNO__NLPARSE;
- NET_START_ARRAY("act", "");
+ NET_START_ARRAY("act", " %s [");
for (act = 0; act <= TCA_ACT_MAX_PRIO; act++) {
ret = do_dump_one_act(tb[act]);
if (ret)
break;
}
- NET_END_ARRAY(" ");
+ NET_END_ARRAY("] ");
return ret;
}
@@ -142,20 +137,15 @@ static int do_bpf_act_dump(struct nlattr *attr)
static int do_bpf_filter_dump(struct nlattr *attr)
{
struct nlattr *tb[TCA_BPF_MAX + 1];
- char buf[256];
int ret;
if (nla_parse_nested(tb, TCA_BPF_MAX, attr, NULL) < 0)
return -LIBBPF_ERRNO__NLPARSE;
if (tb[TCA_BPF_NAME])
- NET_DUMP_STR("name", nla_getattr_str(tb[TCA_BPF_NAME]));
+ NET_DUMP_STR("name", " %s", nla_getattr_str(tb[TCA_BPF_NAME]));
if (tb[TCA_BPF_ID])
- NET_DUMP_UINT("prog_id", nla_getattr_u32(tb[TCA_BPF_ID]));
- if (tb[TCA_BPF_TAG])
- NET_DUMP_STR("tag", hexstring_n2a(nla_data(tb[TCA_BPF_TAG]),
- nla_len(tb[TCA_BPF_TAG]),
- buf, sizeof(buf)));
+ NET_DUMP_UINT("id", " id %u", nla_getattr_u32(tb[TCA_BPF_ID]));
if (tb[TCA_BPF_ACT]) {
ret = do_bpf_act_dump(tb[TCA_BPF_ACT]);
if (ret)
@@ -165,14 +155,17 @@ static int do_bpf_filter_dump(struct nlattr *attr)
return 0;
}
-int do_filter_dump(struct tcmsg *info, struct nlattr **tb, const char *kind)
+int do_filter_dump(struct tcmsg *info, struct nlattr **tb, const char *kind,
+ const char *devname, int ifindex)
{
int ret = 0;
if (tb[TCA_OPTIONS] && strcmp(nla_data(tb[TCA_KIND]), "bpf") == 0) {
NET_START_OBJECT;
- NET_DUMP_UINT("ifindex", info->tcm_ifindex);
- NET_DUMP_STR("kind", kind);
+ if (devname[0] != '\0')
+ NET_DUMP_STR("devname", "%s", devname);
+ NET_DUMP_UINT("ifindex", "(%u)", ifindex);
+ NET_DUMP_STR("kind", " %s", kind);
ret = do_bpf_filter_dump(tb[TCA_OPTIONS]);
NET_END_OBJECT_FINAL;
}
diff --git a/tools/bpf/bpftool/netlink_dumper.h b/tools/bpf/bpftool/netlink_dumper.h
index 552d8851ac06..0788cfbbed0e 100644
--- a/tools/bpf/bpftool/netlink_dumper.h
+++ b/tools/bpf/bpftool/netlink_dumper.h
@@ -50,13 +50,13 @@
fprintf(stderr, "\n"); \
}
-#define NET_START_ARRAY(name, newline) \
+#define NET_START_ARRAY(name, fmt_str) \
{ \
if (json_output) { \
jsonw_name(json_wtr, name); \
jsonw_start_array(json_wtr); \
} else { \
- fprintf(stderr, "%s [%s", name, newline);\
+ fprintf(stderr, fmt_str, name); \
} \
}
@@ -65,31 +65,23 @@
if (json_output) \
jsonw_end_array(json_wtr); \
else \
- fprintf(stderr, "]%s", endstr); \
+ fprintf(stderr, "%s", endstr); \
}
-#define NET_DUMP_UINT(name, val) \
+#define NET_DUMP_UINT(name, fmt_str, val) \
{ \
if (json_output) \
jsonw_uint_field(json_wtr, name, val); \
else \
- fprintf(stderr, "%s %d ", name, val); \
+ fprintf(stderr, fmt_str, val); \
}
-#define NET_DUMP_LLUINT(name, val) \
-{ \
- if (json_output) \
- jsonw_lluint_field(json_wtr, name, val);\
- else \
- fprintf(stderr, "%s %lld ", name, val); \
-}
-
-#define NET_DUMP_STR(name, str) \
+#define NET_DUMP_STR(name, fmt_str, str) \
{ \
if (json_output) \
jsonw_string_field(json_wtr, name, str);\
else \
- fprintf(stderr, "%s %s ", name, str); \
+ fprintf(stderr, fmt_str, str); \
}
#define NET_DUMP_STR_ONLY(str) \
--
2.17.1
^ permalink raw reply related
* Re: [PATCH net-next 5/5] ebpf: Add sample ebpf program for SOCKET_SG_FILTER
From: Alexei Starovoitov @ 2018-09-17 23:15 UTC (permalink / raw)
To: Sowmini Varadhan
Cc: Tushar Dave, ast, daniel, davem, santosh.shilimkar,
jakub.kicinski, quentin.monnet, jiong.wang, sandipan,
john.fastabend, kafai, rdna, yhs, netdev, rds-devel
In-Reply-To: <20180913101013.GA1039@oracle.com>
On Thu, Sep 13, 2018 at 06:10:13AM -0400, Sowmini Varadhan wrote:
> On (09/12/18 19:07), Alexei Starovoitov wrote:
> >
> > I didn't know that. The way I understand your statement that
> > this new program type, new sg logic, and all the complexity
> > are only applicable to RDMA capable hw and RDS.
>
> I dont know if you have been following the RFC series at all
> (and DanielB/JohnF feedback to it) but that is not what the patch
> set is about.
>
> To repeat a summary of the original problem statement:
>
> RDS (hardly a "niche" driver, let's please not get carried away
> with strong assertions based on incomplete understanding),
> is an example of a driver that happens to pass up packets
> as both scatterlist and sk_buffs to the ULPs.
>
> The scatterlist comes from IB, the sk_buffs come from the ethernet
> drivers. At the moment, the only way to build firewalls for
> this is to convert scatterlist to skb and use either netfilter
> or eBPF on the skb. What Tushar is adding is support to use eBPF
> on the scatterlist itself, so that you dont have to do this
> inefficient scatterlist->skb conversion.
if the goal is to add firewall ability to RDS then the patch set
is going in the wrong direction.
New bpf prog type and attaching to sockets isn't going to be
helpful in building firewalls.
Also there was a mention of some form of 'redirect' for some
future use? That doesn't fit the firewall goal as well.
I think it would be the best to start from scratch and discuss
the bigger goal first.
May be the right answer is to teach rds to behave like the rest of protocols.
Then all existing tooling and features will 'just work' ?
^ permalink raw reply
* Re: [PATCH bpf-next] samples/bpf: remove duplicated includes
From: Y Song @ 2018-09-18 4:48 UTC (permalink / raw)
To: yuehaibing; +Cc: Alexei Starovoitov, Daniel Borkmann, LKML, netdev
In-Reply-To: <20180918014534.26128-1-yuehaibing@huawei.com>
On Mon, Sep 17, 2018 at 6:46 PM YueHaibing <yuehaibing@huawei.com> wrote:
>
> Remove duplicated includes.
>
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Acked-by: Yonghong Song <yhs@fb.com>
^ permalink raw reply
* Re: [PATCH net-next 5/5] ebpf: Add sample ebpf program for SOCKET_SG_FILTER
From: Sowmini Varadhan @ 2018-09-17 23:23 UTC (permalink / raw)
To: Alexei Starovoitov
Cc: Tushar Dave, ast, daniel, davem, santosh.shilimkar,
jakub.kicinski, quentin.monnet, jiong.wang, sandipan,
john.fastabend, kafai, rdna, yhs, netdev, rds-devel
In-Reply-To: <20180917231513.mevvgup4y4qnrb2k@ast-mbp>
On (09/17/18 16:15), Alexei Starovoitov wrote:
>
> if the goal is to add firewall ability to RDS then the patch set
> is going in the wrong direction.
The goal is to add the ability to process scatterlist directly,
just like we process skb's today.
Your main objection was that you wanted a test case in selftests
that was aligned with existing tests, Tushar is working on that
patchset. Why dont we wait for that patchset before continuing
this discussion further?
> May be the right answer is to teach rds to behave like the rest of protocols.
> Then all existing tooling and features will 'just work' ?
RDS does not need to be taught anything :-) I think KCM is modeled
on the RDS stack model. Before we "teach" rds anything, "we" need
to understand what RDS does first - google can provide lot of slide-decks
that explain the rds stack to you, suggest you look at that first.
Meanwhile, how about waiting for Tushar's next patchset, where
you will have your selftests that are based on veth/netns
just like exising tests for XDP. vxlan etc. I strongly suggest
waiting for that.
And btw, it would have been very useful/courteous to help with
the RFC reviews to start with.
--Sowmini
^ permalink raw reply
* [PATCH v2] net: bnxt: Fix a uninitialized variable warning.
From: zhong jiang @ 2018-09-18 4:55 UTC (permalink / raw)
To: michael.chan, davem, vasundhara-v.volam; +Cc: netdev, linux-kernel
Fix the following compile warning:
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:49:5: warning: nvm_param.dir_type may be used uninitialized in this function [-Wmaybe-uninitialized]
if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index f3b9fbc..1ae56fc 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -46,6 +46,9 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
}
}
+ if (i == ARRAY_SIZE(nvm_params))
+ return -EINVAL;
+
if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
idx = bp->pf.port_id;
else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
--
1.7.12.4
^ permalink raw reply related
* Re: [PATCH net-next 5/5] ebpf: Add sample ebpf program for SOCKET_SG_FILTER
From: Alexei Starovoitov @ 2018-09-17 23:26 UTC (permalink / raw)
To: Sowmini Varadhan
Cc: Tushar Dave, ast, daniel, davem, santosh.shilimkar,
jakub.kicinski, quentin.monnet, jiong.wang, sandipan,
john.fastabend, kafai, rdna, yhs, netdev, rds-devel
In-Reply-To: <20180917232348.GH29475@oracle.com>
On Mon, Sep 17, 2018 at 07:23:48PM -0400, Sowmini Varadhan wrote:
> On (09/17/18 16:15), Alexei Starovoitov wrote:
> >
> > if the goal is to add firewall ability to RDS then the patch set
> > is going in the wrong direction.
>
> The goal is to add the ability to process scatterlist directly,
> just like we process skb's today.
that doesn't answer my question and doesn't address the objection.
It is still a nack.
^ permalink raw reply
* RE: [PATCH] bonding: avoid repeated display of same link status change
From: Manish Kumar Singh @ 2018-09-18 5:05 UTC (permalink / raw)
To: Eric Dumazet, netdev
Cc: Jay Vosburgh, Veaceslav Falico, Andy Gospodarek, David S. Miller,
linux-kernel
In-Reply-To: <33a66a80-22ed-d6b3-f6b2-4463357c5ffa@gmail.com>
> -----Original Message-----
> From: Eric Dumazet [mailto:eric.dumazet@gmail.com]
> Sent: 17 सितम्बर 2018 20:08
> To: Manish Kumar Singh; netdev@vger.kernel.org
> Cc: Jay Vosburgh; Veaceslav Falico; Andy Gospodarek; David S. Miller; linux-
> kernel@vger.kernel.org
> Subject: Re: [PATCH] bonding: avoid repeated display of same link status
> change
>
>
>
> On 09/17/2018 12:20 AM, mk.singh@oracle.com wrote:
> > From: Manish Kumar Singh <mk.singh@oracle.com>
> >
> > When link status change needs to be committed and rtnl lock couldn't be
> > taken, avoid redisplay of same link status change message.
> >
> > Signed-off-by: Manish Kumar Singh <mk.singh@oracle.com>
> > ---
> > drivers/net/bonding/bond_main.c | 6 ++++--
> > include/net/bonding.h | 1 +
> > 2 files changed, 5 insertions(+), 2 deletions(-)
> >
> > diff --git a/drivers/net/bonding/bond_main.c
> b/drivers/net/bonding/bond_main.c
> > index 217b790d22ed..fb4e3aff1677 100644
> > --- a/drivers/net/bonding/bond_main.c
> > +++ b/drivers/net/bonding/bond_main.c
> > @@ -2087,7 +2087,7 @@ static int bond_miimon_inspect(struct bonding
> *bond)
> > bond_propose_link_state(slave, BOND_LINK_FAIL);
> > commit++;
> > slave->delay = bond->params.downdelay;
> > - if (slave->delay) {
> > + if (slave->delay && !bond->rtnl_needed) {
> > netdev_info(bond->dev, "link status down for
> %sinterface %s, disabling it in %d ms\n",
> > (BOND_MODE(bond) ==
> > BOND_MODE_ACTIVEBACKUP) ?
> > @@ -2127,7 +2127,7 @@ static int bond_miimon_inspect(struct bonding
> *bond)
> > commit++;
> > slave->delay = bond->params.updelay;
> >
> > - if (slave->delay) {
> > + if (slave->delay && !bond->rtnl_needed) {
> > netdev_info(bond->dev, "link status up for
> interface %s, enabling it in %d ms\n",
> > slave->dev->name,
> > ignore_updelay ? 0 :
> > @@ -2301,9 +2301,11 @@ static void bond_mii_monitor(struct
> work_struct *work)
> > if (!rtnl_trylock()) {
> > delay = 1;
> > should_notify_peers = false;
> > + bond->rtnl_needed = true;
>
> How can you set a shared variable with no synchronization ?
Thanks Eric for reviewing the patch. rtnl_needed is not a shared variable, it is part of bonding structure, that is one per bonding driver instance. There can't be two parallel instances of bond_miimon_inspect for a single bonding driver instance at any given point of time. and only bond_miimon_inspect updates it. That’s why I think there is no need of any synchronization here.
>
> A bool is particularly dangerous here, at least on some arches.
Thank you for cautioning us on bool usage. even a u8 can meet our requirement. we will change it. but; if time permits can you share more on "particularly dangerous here, at least on some arches".
F
>
> > goto re_arm;
> > }
> >
> > + bond->rtnl_needed = false;
> > bond_for_each_slave(bond, slave, iter) {
> > bond_commit_link_state(slave,
> BOND_SLAVE_NOTIFY_LATER);
> > }
> > diff --git a/include/net/bonding.h b/include/net/bonding.h
> > index 808f1d167349..50d61cf77855 100644
> > --- a/include/net/bonding.h
> > +++ b/include/net/bonding.h
> > @@ -234,6 +234,7 @@ struct bonding {
> > struct dentry *debug_dir;
> > #endif /* CONFIG_DEBUG_FS */
> > struct rtnl_link_stats64 bond_stats;
> > + bool rtnl_needed;
> > };
> >
> > #define bond_slave_get_rcu(dev) \
> >
^ permalink raw reply
* [PATCH] netfilter: nft_osf: use enum nft_data_types for nft_validate_register_store
From: Stefan Agner @ 2018-09-18 5:21 UTC (permalink / raw)
To: ffmancera, pablo, kadlec, fw, davem
Cc: netfilter-devel, coreteam, netdev, linux-kernel, Stefan Agner
The function nft_validate_register_store requires a struct of type
struct nft_data_types. NFTA_DATA_VALUE is of type enum
nft_verdict_attributes. Pass the correct enum type.
This fixes a warning seen with Clang:
net/netfilter/nft_osf.c:52:8: warning: implicit conversion from
enumeration type 'enum nft_data_attributes' to different enumeration
type 'enum nft_data_types' [-Wenum-conversion]
NFTA_DATA_VALUE, NFT_OSF_MAXGENRELEN);
^~~~~~~~~~~~~~~
Link: https://github.com/ClangBuiltLinux/linux/issues/103
Signed-off-by: Stefan Agner <stefan@agner.ch>
---
net/netfilter/nft_osf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/net/netfilter/nft_osf.c b/net/netfilter/nft_osf.c
index 5af74b37f423..a35fb59ace73 100644
--- a/net/netfilter/nft_osf.c
+++ b/net/netfilter/nft_osf.c
@@ -49,7 +49,7 @@ static int nft_osf_init(const struct nft_ctx *ctx,
priv->dreg = nft_parse_register(tb[NFTA_OSF_DREG]);
err = nft_validate_register_store(ctx, priv->dreg, NULL,
- NFTA_DATA_VALUE, NFT_OSF_MAXGENRELEN);
+ NFT_DATA_VALUE, NFT_OSF_MAXGENRELEN);
if (err < 0)
return err;
--
2.19.0
^ permalink raw reply related
* [net-next 1/3] net/mlx5: Fix read from coherent memory
From: Saeed Mahameed @ 2018-09-18 0:01 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Eli Cohen, Saeed Mahameed
In-Reply-To: <20180918000201.23609-1-saeedm@mellanox.com>
From: Eli Cohen <eli@mellanox.com>
Use accessor function READ_ONCE to read from coherent memory modified
by the device and read by the driver. This becomes most important in
preemptive kernels where cond_resched implementation does not have the
side effect which guaranteed the updated value.
Fixes: 269d26f47f6f ("net/mlx5: Reduce command polling interval")
Signed-off-by: Eli Cohen <eli@mellanox.com>
Reported-by: Jesper Dangaard Brouer <brouer@redhat.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
index 3ce14d42ddc8..a53736c26c0c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/cmd.c
@@ -206,7 +206,7 @@ static void poll_timeout(struct mlx5_cmd_work_ent *ent)
u8 own;
do {
- own = ent->lay->status_own;
+ own = READ_ONCE(ent->lay->status_own);
if (!(own & CMD_OWNER_HW)) {
ent->ret = 0;
return;
--
2.17.1
^ permalink raw reply related
* [pull request][net-next 0/3] Mellanox, mlx5 fixes 2018-09-17
From: Saeed Mahameed @ 2018-09-18 0:01 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Saeed Mahameed
This series provides three fixes to mlx5 core and mlx5e netdevice
driver.
Please pull and let me know if there's any problem.
For -stable v4.16:
('net/mlx5: Check for SQ and not RQ state when modifying hairpin SQ')
Thanks,
Saeed.
---
The following changes since commit c73480910e9686a5c25155cb4d418d594b678196:
net: ethernet: Fix a unused function warning. (2018-09-17 08:24:25 -0700)
are available in the Git repository at:
git://git.kernel.org/pub/scm/linux/kernel/git/saeed/linux.git tags/mlx5-fixes-2018-09-17
for you to fetch changes up to 8f92e35aff9692028279d3c03e88547df6d15020:
net/mlx5e: TLS, Read capabilities only when it is safe (2018-09-17 15:12:31 -0700)
----------------------------------------------------------------
mlx5-fixes-2018-09-17
----------------------------------------------------------------
Alaa Hleihel (1):
net/mlx5: Check for SQ and not RQ state when modifying hairpin SQ
Eli Cohen (1):
net/mlx5: Fix read from coherent memory
Saeed Mahameed (1):
net/mlx5e: TLS, Read capabilities only when it is safe
drivers/net/ethernet/mellanox/mlx5/core/cmd.c | 2 +-
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 3 ++-
drivers/net/ethernet/mellanox/mlx5/core/transobj.c | 2 +-
3 files changed, 4 insertions(+), 3 deletions(-)
^ permalink raw reply
* [net-next 3/3] net/mlx5e: TLS, Read capabilities only when it is safe
From: Saeed Mahameed @ 2018-09-18 0:02 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Saeed Mahameed
In-Reply-To: <20180918000201.23609-1-saeedm@mellanox.com>
Read TLS caps from the core driver only when TLS is supported, i.e
mlx5_accel_is_tls_device returns true.
Fixes: 790af90c00d2 ("net/mlx5e: TLS, build TLS netdev from capabilities")
Reported-by: Michal Kubecek <mkubecek@suse.cz>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
Reviewed-by: Boris Pismenny <borisp@mellanox.com>
Reviewed-by: Tariq Toukan <tariqt@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c
index eddd7702680b..e88340e196f7 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/en_accel/tls.c
@@ -183,12 +183,13 @@ static const struct tlsdev_ops mlx5e_tls_ops = {
void mlx5e_tls_build_netdev(struct mlx5e_priv *priv)
{
- u32 caps = mlx5_accel_tls_device_caps(priv->mdev);
struct net_device *netdev = priv->netdev;
+ u32 caps;
if (!mlx5_accel_is_tls_device(priv->mdev))
return;
+ caps = mlx5_accel_tls_device_caps(priv->mdev);
if (caps & MLX5_ACCEL_TLS_TX) {
netdev->features |= NETIF_F_HW_TLS_TX;
netdev->hw_features |= NETIF_F_HW_TLS_TX;
--
2.17.1
^ permalink raw reply related
* [net-next 2/3] net/mlx5: Check for SQ and not RQ state when modifying hairpin SQ
From: Saeed Mahameed @ 2018-09-18 0:02 UTC (permalink / raw)
To: David S. Miller; +Cc: netdev, Alaa Hleihel, Saeed Mahameed
In-Reply-To: <20180918000201.23609-1-saeedm@mellanox.com>
From: Alaa Hleihel <alaa@mellanox.com>
When modifying hairpin SQ, instead of checking if the next state equals
to MLX5_SQC_STATE_RDY, we compare it against the MLX5_RQC_STATE_RDY enum
value.
The code worked since both of MLX5_RQC_STATE_RDY and MLX5_SQC_STATE_RDY
have the same value today.
This patch fixes this issue.
Fixes: 18e568c390c6 ("net/mlx5: Hairpin pair core object setup")
Signed-off-by: Alaa Hleihel <alaa@mellanox.com>
Reviewed-by: Or Gerlitz <ogerlitz@mellanox.com>
Signed-off-by: Saeed Mahameed <saeedm@mellanox.com>
---
drivers/net/ethernet/mellanox/mlx5/core/transobj.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
index dae1c5c5d27c..d2f76070ea7c 100644
--- a/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
+++ b/drivers/net/ethernet/mellanox/mlx5/core/transobj.c
@@ -509,7 +509,7 @@ static int mlx5_hairpin_modify_sq(struct mlx5_core_dev *peer_mdev, u32 sqn,
sqc = MLX5_ADDR_OF(modify_sq_in, in, ctx);
- if (next_state == MLX5_RQC_STATE_RDY) {
+ if (next_state == MLX5_SQC_STATE_RDY) {
MLX5_SET(sqc, sqc, hairpin_peer_rq, peer_rq);
MLX5_SET(sqc, sqc, hairpin_peer_vhca, peer_vhca);
}
--
2.17.1
^ permalink raw reply related
* [PATCH net-next] net: hns3: fix return type of ndo_start_xmit function
From: YueHaibing @ 2018-09-18 6:09 UTC (permalink / raw)
To: davem, yisen.zhuang, salil.mehta; +Cc: linux-kernel, netdev, YueHaibing
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, also the implementation in this
driver has returns 'netdev_tx_t' value, so just change the function
return type to netdev_tx_t.
Found by coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/hisilicon/hip04_eth.c | 3 ++-
drivers/net/ethernet/hisilicon/hix5hd2_gmac.c | 2 +-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/hisilicon/hip04_eth.c b/drivers/net/ethernet/hisilicon/hip04_eth.c
index 14374a8..be268dc 100644
--- a/drivers/net/ethernet/hisilicon/hip04_eth.c
+++ b/drivers/net/ethernet/hisilicon/hip04_eth.c
@@ -422,7 +422,8 @@ static void hip04_start_tx_timer(struct hip04_priv *priv)
ns, HRTIMER_MODE_REL);
}
-static int hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
+static netdev_tx_t
+hip04_mac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
struct hip04_priv *priv = netdev_priv(ndev);
struct net_device_stats *stats = &ndev->stats;
diff --git a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
index c572700..471805e 100644
--- a/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
+++ b/drivers/net/ethernet/hisilicon/hix5hd2_gmac.c
@@ -736,7 +736,7 @@ static int hix5hd2_fill_sg_desc(struct hix5hd2_priv *priv,
return 0;
}
-static int hix5hd2_net_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t hix5hd2_net_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct hix5hd2_priv *priv = netdev_priv(dev);
struct hix5hd2_desc *desc;
--
1.8.3.1
^ permalink raw reply related
* [PATCH net-next] net: cavium: fix return type of ndo_start_xmit function
From: YueHaibing @ 2018-09-18 6:19 UTC (permalink / raw)
To: davem, derek.chickles, satananda.burla, felix.manlunas,
raghu.vatsavayi, alexander.sverdlin, david.daney
Cc: linux-kernel, netdev, YueHaibing
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, so make sure the implementation in
this driver has returns 'netdev_tx_t' value, and change the function
return type to netdev_tx_t.
Found by coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/cavium/liquidio/lio_main.c | 2 +-
drivers/net/ethernet/cavium/liquidio/lio_vf_main.c | 2 +-
drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c | 5 +++--
drivers/net/ethernet/cavium/octeon/octeon_mgmt.c | 5 +++--
4 files changed, 8 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_main.c b/drivers/net/ethernet/cavium/liquidio/lio_main.c
index f42c1b0..9d70e5c6 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_main.c
@@ -2313,7 +2313,7 @@ static inline int send_nic_timestamp_pkt(struct octeon_device *oct,
* @returns whether the packet was transmitted to the device okay or not
* (NETDEV_TX_OK or NETDEV_TX_BUSY)
*/
-static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct lio *lio;
struct octnet_buf_free_info *finfo;
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
index 0ec4bfe..54b2457 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_main.c
@@ -1401,7 +1401,7 @@ static int send_nic_timestamp_pkt(struct octeon_device *oct,
* @returns whether the packet was transmitted to the device okay or not
* (NETDEV_TX_OK or NETDEV_TX_BUSY)
*/
-static int liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t liquidio_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct octnet_buf_free_info *finfo;
union octnic_cmd_setup cmdsetup;
diff --git a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
index 96cf4a4..ea9859e 100644
--- a/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
+++ b/drivers/net/ethernet/cavium/liquidio/lio_vf_rep.c
@@ -30,7 +30,8 @@
static int lio_vf_rep_open(struct net_device *ndev);
static int lio_vf_rep_stop(struct net_device *ndev);
-static int lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev);
+static netdev_tx_t lio_vf_rep_pkt_xmit(struct sk_buff *skb,
+ struct net_device *ndev);
static void lio_vf_rep_tx_timeout(struct net_device *netdev);
static int lio_vf_rep_phys_port_name(struct net_device *dev,
char *buf, size_t len);
@@ -361,7 +362,7 @@ static void lio_vf_rep_get_stats64(struct net_device *dev,
netif_wake_queue(ndev);
}
-static int
+static netdev_tx_t
lio_vf_rep_pkt_xmit(struct sk_buff *skb, struct net_device *ndev)
{
struct lio_vf_rep_desc *vf_rep = netdev_priv(ndev);
diff --git a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
index bb43ddb..4b3aecf 100644
--- a/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
+++ b/drivers/net/ethernet/cavium/octeon/octeon_mgmt.c
@@ -1268,12 +1268,13 @@ static int octeon_mgmt_stop(struct net_device *netdev)
return 0;
}
-static int octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t
+octeon_mgmt_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct octeon_mgmt *p = netdev_priv(netdev);
union mgmt_port_ring_entry re;
unsigned long flags;
- int rv = NETDEV_TX_BUSY;
+ netdev_tx_t rv = NETDEV_TX_BUSY;
re.d64 = 0;
re.s.tstamp = ((skb_shinfo(skb)->tx_flags & SKBTX_HW_TSTAMP) != 0);
--
1.8.3.1
^ permalink raw reply related
* [PATCH][net-next] net: caif: remove redundant null check on frontpkt
From: Colin King @ 2018-09-18 6:22 UTC (permalink / raw)
To: Dmitry Tarnyagin, David S . Miller, netdev; +Cc: kernel-janitors, linux-kernel
From: Colin Ian King <colin.king@canonical.com>
It is impossible for frontpkt to be null at the point of the null
check because it has been assigned from rearpkt and there is no
way realpkt can be null at the point of the assignment because
of the sanity checking and exit paths taken previously. Remove
the redundant null check.
Detected by CoverityScan, CID#114434 ("Logically dead code")
Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
net/caif/cfrfml.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/net/caif/cfrfml.c b/net/caif/cfrfml.c
index b82440e1fcb4..a931a71ef6df 100644
--- a/net/caif/cfrfml.c
+++ b/net/caif/cfrfml.c
@@ -264,9 +264,6 @@ static int cfrfml_transmit(struct cflayer *layr, struct cfpkt *pkt)
frontpkt = rearpkt;
rearpkt = NULL;
- err = -ENOMEM;
- if (frontpkt == NULL)
- goto out;
err = -EPROTO;
if (cfpkt_add_head(frontpkt, head, 6) < 0)
goto out;
--
2.17.1
^ permalink raw reply related
* [PATCH net-next] net: ibm: fix return type of ndo_start_xmit function
From: YueHaibing @ 2018-09-18 6:35 UTC (permalink / raw)
To: davem, dougmill, benh, paulus, mpe, tlfalcon, jallen, ivan,
chunkeey, keescook
Cc: linux-kernel, netdev, linuxppc-dev, YueHaibing
The method ndo_start_xmit() is defined as returning an 'netdev_tx_t',
which is a typedef for an enum type, so make sure the implementation in
this driver has returns 'netdev_tx_t' value, and change the function
return type to netdev_tx_t.
Found by coccinelle.
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/net/ethernet/ibm/ehea/ehea_main.c | 2 +-
drivers/net/ethernet/ibm/emac/core.c | 7 ++++---
drivers/net/ethernet/ibm/ibmvnic.c | 4 ++--
3 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/net/ethernet/ibm/ehea/ehea_main.c b/drivers/net/ethernet/ibm/ehea/ehea_main.c
index ba580bf..88128d3 100644
--- a/drivers/net/ethernet/ibm/ehea/ehea_main.c
+++ b/drivers/net/ethernet/ibm/ehea/ehea_main.c
@@ -2038,7 +2038,7 @@ static void ehea_xmit3(struct sk_buff *skb, struct net_device *dev,
dev_consume_skb_any(skb);
}
-static int ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
+static netdev_tx_t ehea_start_xmit(struct sk_buff *skb, struct net_device *dev)
{
struct ehea_port *port = netdev_priv(dev);
struct ehea_swqe *swqe;
diff --git a/drivers/net/ethernet/ibm/emac/core.c b/drivers/net/ethernet/ibm/emac/core.c
index 7410a1d..5107c94 100644
--- a/drivers/net/ethernet/ibm/emac/core.c
+++ b/drivers/net/ethernet/ibm/emac/core.c
@@ -1409,7 +1409,7 @@ static inline u16 emac_tx_csum(struct emac_instance *dev,
return 0;
}
-static inline int emac_xmit_finish(struct emac_instance *dev, int len)
+static inline netdev_tx_t emac_xmit_finish(struct emac_instance *dev, int len)
{
struct emac_regs __iomem *p = dev->emacp;
struct net_device *ndev = dev->ndev;
@@ -1436,7 +1436,7 @@ static inline int emac_xmit_finish(struct emac_instance *dev, int len)
}
/* Tx lock BH */
-static int emac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
+static netdev_tx_t emac_start_xmit(struct sk_buff *skb, struct net_device *ndev)
{
struct emac_instance *dev = netdev_priv(ndev);
unsigned int len = skb->len;
@@ -1494,7 +1494,8 @@ static inline int emac_xmit_split(struct emac_instance *dev, int slot,
}
/* Tx lock BH disabled (SG version for TAH equipped EMACs) */
-static int emac_start_xmit_sg(struct sk_buff *skb, struct net_device *ndev)
+static netdev_tx_t
+emac_start_xmit_sg(struct sk_buff *skb, struct net_device *ndev)
{
struct emac_instance *dev = netdev_priv(ndev);
int nr_frags = skb_shinfo(skb)->nr_frags;
diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c
index 4f0daf6..a8369ad 100644
--- a/drivers/net/ethernet/ibm/ibmvnic.c
+++ b/drivers/net/ethernet/ibm/ibmvnic.c
@@ -1428,7 +1428,7 @@ static int ibmvnic_xmit_workarounds(struct sk_buff *skb,
return 0;
}
-static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
+static netdev_tx_t ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
{
struct ibmvnic_adapter *adapter = netdev_priv(netdev);
int queue_num = skb_get_queue_mapping(skb);
@@ -1452,7 +1452,7 @@ static int ibmvnic_xmit(struct sk_buff *skb, struct net_device *netdev)
u64 *handle_array;
int index = 0;
u8 proto = 0;
- int ret = 0;
+ netdev_tx_t ret = NETDEV_TX_OK;
if (adapter->resetting) {
if (!netif_subqueue_stopped(netdev, skb))
--
1.8.3.1
^ permalink raw reply related
* Re: [PATCH v2] net: bnxt: Fix a uninitialized variable warning.
From: Michael Chan @ 2018-09-18 7:02 UTC (permalink / raw)
To: zhong jiang; +Cc: David Miller, Vasundhara Volam, Netdev, open list
In-Reply-To: <1537246516-33100-1-git-send-email-zhongjiang@huawei.com>
On Mon, Sep 17, 2018 at 9:55 PM, zhong jiang <zhongjiang@huawei.com> wrote:
> Fix the following compile warning:
>
> drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:49:5: warning: ‘nvm_param.dir_type’ may be used uninitialized in this function [-Wmaybe-uninitialized]
> if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
>
> Signed-off-by: zhong jiang <zhongjiang@huawei.com>
> ---
> drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> index f3b9fbc..1ae56fc 100644
> --- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> +++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
> @@ -46,6 +46,9 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
> }
> }
>
> + if (i == ARRAY_SIZE(nvm_params))
> + return -EINVAL;
> +
-EOPNOTSUPP might be a better return code. Other than that, it looks
good to me. Thanks.
> if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
> idx = bp->pf.port_id;
> else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
> --
> 1.7.12.4
>
^ permalink raw reply
* [PATCHv3] net: bnxt: Fix a uninitialized variable warning.
From: zhong jiang @ 2018-09-18 7:15 UTC (permalink / raw)
To: michael.chan, davem, vasundhara-v.volam; +Cc: netdev, linux-kernel
Fix the following compile warning:
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c:49:5: warning: nvm_param.dir_type may be used uninitialized in this function [-Wmaybe-uninitialized]
if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
Signed-off-by: zhong jiang <zhongjiang@huawei.com>
---
drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
index f3b9fbc..790c684 100644
--- a/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
+++ b/drivers/net/ethernet/broadcom/bnxt/bnxt_devlink.c
@@ -46,6 +46,9 @@ static int bnxt_hwrm_nvm_req(struct bnxt *bp, u32 param_id, void *msg,
}
}
+ if (i == ARRAY_SIZE(nvm_params))
+ return -EOPNOTSUPP;
+
if (nvm_param.dir_type == BNXT_NVM_PORT_CFG)
idx = bp->pf.port_id;
else if (nvm_param.dir_type == BNXT_NVM_FUNC_CFG)
--
1.7.12.4
^ permalink raw reply related
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